This application claims the priority benefit of China application serial No. 201310145914.2, filed on Apr. 24, 2013. The entirety of the above-mentioned patent application is hereby incorporated by reference herein and made a part of specification.
1. Field of the Invention
The disclosure relates to an electronic device and a loading method of control program.
2. Description of the Related Art
Firmware is a kind of software embedded in hardware devices. Firmware is a necessary control program (or called as a program code) for the basic hardware initialization and the peripheral control, which is used to control and coordinate the integrated circuit to make the device operate normally. Thus, the firmware is widely used in kinds of electronic devices, such as a host computer and an electronic device cooperating with a host computer, the electronic device may be an optical drive, a CD writer, a hard drive, a memory card, a wireless base station, an IP router, a digital camera, or a modem.
Generally speaking, the firmware of the electronic device can be stored in a read-only memory or a flash memory. When the firmware is stored in the read-only memory, since the data stored in the read-only memory cannot be modified or deleted, the user will not be able to add, modify or modify the firmware stored in the read-only memory. In other words, the user cannot make the electronic device adapt to a new hardware environment or make the electronic device have an additional function or optimize the electronic device just by updating the firmware.
In addition, when the firmware of the electronic device is stored in a flash memory, the firmware should be transmitted from a flash memory to a random access memory first, and then executed by a processing unit when the electronic device needs to execute the firmware. Although it allows the users to add or modify the firmware when the firmware is stored in a flash memory, at least one additional flash memory is needed for storing the firmware, and thus the layout of the circuit is limited.
The disclosure provides an electronic device and a loading method of control program. The stored firmware can be added, modified or changed, and the circuit layout is simplified.
An electronic device comprises a first memory unit, a processing unit and an operating interface. The processing unit is electronically connected to the first memory unit. The operating interface is electronically connected to the processing unit. When the processing unit is communicated with a host device via the operating interface, the processing unit executes a loading program and transmits a notification signal to the host device. The host device transmits at least one control program to the first memory unit according to the notification signal. After the control program is transmitted, the processing unit is resets and then executes the control program stored in the first memory unit. The format of the control program is a single-row serial data and has no communication protocol data.
A loading method of a control program is applied to an electronic device and the electronic device is connected to a host device. The loading method comprising: a processing unit of the electronic device executes a loading program and transmits a notification signal to the host device; the host device transmits at least one control program to a first memory unit of the electronic device according to the notification signal. After the control program is transmitted, the processing unit is reset and then executes the control program stored in the first memory unit. The format of the control program is a single-row serial data and has no communication protocol data.
The processing unit of the electronic device executes the loading program to inform the host device to transmit at least one control program to the first memory unit of the electronic device. The processing unit is reset and then executes the control program stored in the first memory unit after the control program is transmitted. The stored firmware can be added or modified, and the circuit layout is simplified.
The electronic device 1 is communicated with a host device H via the operating interface 14. The operating interface 14 may be a peripheral component interconnect (PCI) interface or a peripheral component interconnect express (PCI-E) interface. The host device H may be a desktop computer or a notebook computer. In addition, the electronic device 1 may include other components according to function requirements.
Please refer to
Then, the electronic device 1 receives the loading program 111 transmitted from the host device H via the operating interface 14, and the loading program 111 is stored in the first memory unit 11. The loading program 111 is firmware, as shown in
In step S02, the host device H transmits at least one control program to the first memory unit 11 of the electronic device 1 according to the notification signal. When the host device H receives the notification signal from the electronic device 2, at least one control program is transmitted to the electronic device 1. The control program is firmware. Compared to the program code stored in the second memory unit 12, the control program may be firmware providing additional features for the electronic device 1 or further optimizing the processing performance of the electronic device 1.
The control program is transmitted to the first memory unit 11 via the operating interface 14, and the loading program 111 receives the control program. The control program is stored in the first memory unit 11. The host device H determines the required control program according to the notification signal transmitted from the electronic device 1. In addition, the control program is written sequentially from the forefront addresses of the storage space of the first memory unit 11.
In step S03, the processing unit 13 is resets and then executes the control program stored in the first memory unit 11 after the control program is transmitted. The host device H informs the electronic device 1 after the control programs which need to be transmitted are all transmitted to the electronic device 1. Then, the processing unit 13 of the electronic device 1 is reset and then executes the control program which is written in step S02. During the resetting process of the processing unit 13, the electronic device 1 still has power, in other words, the first memory unit 11 can still preserve the control program completely. After the processing unit 13 is reset, the pointer executed by the program code can point to the lowest address of the first memory unit 11, that is the forefront address of the storage space in the first memory unit 11, and the processing unit 13 executes the control program in the first memory unit 11.
Therefore, the electronic device 1 and the loading method of control program not only can save a flash memory for storing firmware to simplify the circuit structure but also can load additional control program from the host device H according to the requirements of the user or the electronic device 1 to add or modify the functions of the electronic device 1 or enhance the performance of the electronic device 1.
In addition, the format of the control program received via the loading program 111 is a single-row serial data. Please refer to
Compared to the conventional control program, the control program in embodiments significantly reduces the overhead of the extra data packet to make the data package only include actual data. Therefore, it avoids the waste of bandwidth in the transmission of the control program (data) and improves the transmission speed of the control program (data).
Please refer to
The loading method of the control program also can be applied to the electronic device 2. When the electronic device 2 is communicated with the host device H, the processing unit 23 executes the program code stored in the second memory unit 22 to perform the self-test and initialization and loads system default valves. Then, the electronic device 2 executes the loading program 221 stored in the second memory unit 22 and transmits the notification signal to the host device H. Then, the electronic device 2 will execute the step S01 to S03, which is omitted herein.
In conclusion, according to the electronic device and the method of loading a control program in embodiments, the processing unit of the electronic device executes the loading program to inform the host device to transmit at least one control program to the first memory unit of the electronic device. The processing unit is reset and it executes the control program stored in the first memory unit after the control program is transmitted. Consequently, the stored firmware can be added, modified or changed, and the circuit layout is simplified.
Although the present disclosure has been described in considerable detail with reference to certain preferred embodiments thereof, the disclosure is not for limiting the scope. Persons having ordinary skill in the art may make various modifications and changes without departing from the scope. Therefore, the scope of the appended claims should not be limited to the description of the preferred embodiments described above.
Number | Date | Country | Kind |
---|---|---|---|
201310145914.2 | Apr 2013 | CN | national |