Mouse chip convenient for upgrading firmware and operation method thereof
By using cache controller and virtual hardware in the mouse device, the navigation function is continuously running when upgrading the flash firmware, solving the problem of interruption of navigation function during the upgrade process in the existing technology, and improving the upgrade efficiency and user experience .
Patent Information
- Application Number
- CN202110660785.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-12-29
- Filing Date
- 2021-06-15
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2041-06-15
AI Technical Summary
When upgrading the firmware in the flash memory, existing mouse devices need to stop all firmware running, resulting in interruption of navigation function and inability to continuously perform navigation function during the upgrade process.
Use additional hardware to read the function back-pass value through the cache controller, and upgrade the firmware in the flash memory through the second bus, and use virtual hardware to reply the virtual back-pass value in the format to replace the actual back-pass value, allowing microprocessing The device continues to run to ensure the sustainability of navigation functions.
It realizes the operation of the navigation function without interrupting the operation when upgrading the flash firmware, improves the efficiency and user experience of firmware upgrades, and avoids the necessity of restart.
Smart Images

Figure CN114756269B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a mouse device, and more particularly to a mouse chip and an operating method thereof which does not require stopping all firmware operations when the firmware is upgraded. Background Art
[0002] It is known that flash memory operates based on serial access. Since the microprocessor (MCU) needs to perform random access to the memory when executing a function call, flash memory is not suitable as a storage directly accessed by the microprocessor when executing the called function. If the flash memory can be read using cache, the purpose of random access to the flash memory can be achieved.
[0003] The firmware included in the ASIC of the navigation device can be mainly divided into two parts: one part of the firmware is built into the read-only memory (ROM) to perform the navigation function of the navigation device, and the other part of the firmware is recorded in the flash memory to serve as a driver other than the navigation function.
[0004] However, when the navigation device is being operated by the user, if the firmware in the flash memory is to be upgraded, the operation of the entire firmware must be stopped, such as entering a so-called programming mode, and the system must be restarted after the upgrade is completed to complete the entire upgrade procedure.
[0005] In view of this, the present invention further provides a mouse device and an operating method thereof which can continuously execute a navigation function while upgrading the firmware in the flash memory. Summary of the invention
[0006] The invention provides a control chip and its operation method which uses additional hardware to directly reply the return value of the current calling function of the microprocessor when upgrading the firmware in the flash memory, instead of reading the function return value of the called function from the flash memory.
[0007] The invention also provides a control chip and an operating method thereof, which uses a first bus to read a function return value from a cache controller and upgrades the firmware in a flash memory through a second bus.
[0008] The present invention provides a mouse chip including a microprocessor, a bus arbiter, a flash memory, a cache controller and a flash memory controller. The microprocessor is used to generate a function address of a calling function. The bus arbiter is connected to the microprocessor and is used to perform address mapping on the function address to generate an operation address to read a function return value from a first bus, or to receive upgrade data from the microprocessor to send through a second bus. The flash memory has a first firmware, and the content of the flash memory is used to operate the function called by the microprocessor and generate the function return value. The cache controller is connected to the first bus and is used to cache the function return value generated in the flash memory to the cache memory according to the operation address. The flash memory controller is connected to the cache controller and the second bus and is used to save the mapping between the cache address and the flash memory address, so as to cache the function return value of the corresponding flash memory address according to the operation address, or to receive the upgrade data through the second bus.
[0009] The present invention also provides an operation method of a mouse chip. The mouse chip includes a microprocessor, a bus arbitrator, a first bus, a second bus, a cache controller, a flash memory controller, and a flash memory. The operation method includes the following steps: the microprocessor generates a function address of a calling function; the bus arbitrator performs address mapping on the function address to generate an operation address, and transmits the operation address to the cache controller through the first bus; the cache controller caches the content of the corresponding flash memory address in the flash memory through the flash memory controller according to the operation address to generate a function return value, and returns the function return value to the microprocessor through the first bus; and when the microprocessor transmits upgrade data to the bus arbitrator, the bus arbitrator stops reading the function return value through the first bus and sends the upgrade data to the flash memory controller through the second bus to upgrade the first firmware in the flash memory.
[0010] The present invention provides a chip including a microprocessor, a flash memory, a flash memory controller, a cache controller, a bus arbiter and virtual hardware. The microprocessor is used to generate a function address of a calling function. The flash memory has a first firmware built in it, and the content of the flash memory is used to operate the function called by the microprocessor and generate a function return value. The flash memory controller is used to read and write the flash memory. The cache controller is used to cache the function return value in the flash memory through the flash memory controller. The bus arbiter is connected to the microprocessor and is used to read the function return value from the cache controller through a first bus, or to upgrade the first firmware in the flash memory through a second bus and the flash memory controller. The virtual hardware is used to generate and reply a virtual return value in a format that conforms to the function return value of the function to the microprocessor to replace the function return value when the bus arbiter upgrades the first firmware in the flash memory through the second bus and the flash memory controller.
[0011] In order to make the above and other purposes, features and advantages of the present invention more obvious, the following will be described in detail with reference to the accompanying drawings. In addition, in the description of the present invention, the same components are represented by the same symbols, which are hereby described together. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 is a block diagram of a mouse device according to an embodiment of the present invention;
[0013] Figure 2 is a schematic diagram of the operation of the mouse device in a normal mode according to an embodiment of the present invention;
[0014] Figure 3 is a schematic diagram of the operation of the mouse device in a virtual mode according to an embodiment of the present invention; and
[0015] Figure 4 is a flow chart of an operating method of a mouse device according to an embodiment of the present invention.
[0016] Description of Reference Numerals
[0017] 100 Mouse Chip
[0018] 11 Microprocessor
[0019] 12 Bus Arbiter
[0020] 13 Virtual Hardware
[0021] 141 First Bus
[0022] 142 second bus
[0023] 15 Cache
[0024] 151 Cache Controller
[0025] 152 Cache memory
[0026] 16 Flash
[0027] 161 Flash Memory Controller
[0028] 162 Flash memory
[0029] 17 Read-only memory
[0030] 18 Random Access Memory
[0031] 200 buttons / switches
[0032] 90 Host DETAILED DESCRIPTION
[0033] The mouse device of the present invention communicates with an external host 90, for example, via a USB interface or a Bluetooth interface. The USB interface is used to provide power for the mouse device during operation, transmit mouse movement data and control signals such as key clicks and wheel rotations, and transmit upgrade data, which is used to upgrade the firmware in the flash memory of the mouse device. The Bluetooth interface is used to transmit mouse movement data and control signals such as key clicks and wheel rotations, and transmit upgrade data. In order to enable random access to the flash memory when the microprocessor (MCU) makes a function call, the mouse device of the present invention, for example, uses a cache controller to cache the flash memory.
[0034] Please refer to Figure 1 , which is a block diagram of a mouse device according to an embodiment of the present invention. The mouse device comprises a mouse chip 100 and a button / switch 200, wherein the mouse chip 100 is disposed in a mouse housing and connected to an external host 90 via a USB interface or a Bluetooth interface, and the operation of the USB interface and the Bluetooth interface is known. The button / switch 200 is disposed on the mouse housing to generate a control signal Sc to the mouse chip 100, such as a click signal or a switch signal for issuing a data upgrade command.
[0035] In one embodiment, the button / switch 200 is a dedicated component for generating an upgrade command (e.g., included in Figure 1Sc shown in the control signal Sc). When the mouse chip 100 receives the upgrade command from the button / switch 200, the upgrade command is transmitted to the host 90 so that the host 90 starts to send the upgrade data Data_upd to the mouse chip 100. In another embodiment, the upgrade command is generated by the host 90 executing a predetermined software (APP). After the host 90 sends the upgrade command to the mouse chip 100, it then sends the upgrade data Data_upd to the mouse chip 100 to update the firmware in its flash memory. The upgrade data Data_upd is, for example, downloaded from a network or other storage device.
[0036] The mouse chip 100 includes a microprocessor 11, a bus arbiter 12, virtual hardware 13, a first bus 141, a second bus 142, a cache 15 and a flash memory 16, wherein the virtual hardware 13 is an additionally configured hardware, which is included in the bus arbiter 12 or is independent of the bus arbiter 12, and runs specifically in a virtual mode (an example is described later); the cache 15 includes a cache controller 151 and a cache memory 152 (for example, represented by DRAM, but not limited to this); the flash memory 16 includes a flash controller 161 and a flash memory 162.
[0037] The flash memory 162 has a first firmware (shown as firmware 1), which is used to control functions other than the navigation function, such as being used as a third-party integrated circuit driver. In one embodiment, when the mouse device of the present invention is a gaming mouse, the first firmware is used to control the lighting and / or flashing of multiple light-emitting diodes (not used for the navigation function). For example, the first firmware is not built into the mouse device before leaving the factory, but is installed through the interface between the mouse device and the host 90 after leaving the factory and recorded as a program code in the flash memory 16, but the present invention is not limited to this.
[0038] The mouse device of the present invention further includes at least one of a read-only memory (ROM) 17 and a random access memory (RAM) 18 connected to the bus arbiter 12, and a second firmware (shown as firmware II) is built into the ROM 17 or the RAM 18. In one embodiment, the second firmware is used to calculate mouse movement, determine mouse button clicks, and mouse wheel rotations. For example, the second firmware is built into the application specific integrated circuit (ASIC) of the mouse device before leaving the factory to serve as the basic control code of the mouse device.
[0039] In the present invention, the mouse chip 100 is described by taking the AMBA system as an example, but is not limited thereto.
[0040] The microprocessor 11 is connected to the host 90 by wire or wirelessly, and is used to transmit a control signal Sc to the host 90 and receive an upgrade data Data_upd from the host 90, wherein the upgrade data Data_upd is used to upgrade the first firmware in the flash memory 162; the control signal Sc includes, for example, mouse movement data, a mouse button click signal, a wheel rotation signal, and an upgrade command (for example, generated by a predetermined button / switch 200). When a function call is made, the microprocessor 11 is used to generate a function address ADD_f of the calling function, and the function address ADD_f is, for example, a 32-bit address.
[0041] The microprocessor 11 also generates a 32-bit address to access the read-only memory 17 and the random access memory (RAM) 18 and other peripherals, which are known and not the main purpose of the present invention, and are not described here.
[0042] The microprocessor 11 further includes a plurality of registers, such as a stack pointer (SP) register, a link register (LR), a program counter (PC) register, and a frame pointer (FP) register, wherein the link register is used, for example, to record a function return address of a function called by the microprocessor 11; and the program counter register is used, for example, to record a function address ADD_f of a called function.
[0043] The mouse device of the present invention can operate in a normal mode or a virtual mode, depending on whether the microprocessor 11 receives an upgrade command from the button / switch 200 or the host 90.
[0044] The normal mode refers to a mode in which the microprocessor 11 can normally read the function return value RTN of the function called by the microprocessor 11 from the flash memory 16. In other words, the content of the flash memory 162 is used to operate the function called by the microprocessor 11 and generate the function return value RTN, wherein the content may refer to the program code of the first firmware or the program code other than the first firmware.
[0045] The virtual mode refers to a mode in which the microprocessor 11 upgrades the first firmware of the flash memory 162 and does not read the function return value RTN from the flash memory 16 , and the microprocessor 11 enters the mode after receiving the upgrade command.
[0046] The bus arbiter 12 is connected to the microprocessor 11. In the normal mode, the bus arbiter 12 performs address mapping on the function address ADD_f to generate an operation address ADD_o, which is used to read the function return value RTN from the cache controller 151 through the first bus 141, wherein the operation address ADD_o refers to the content address (or subroutine address) in the flash memory 162 for executing the function called by the microprocessor 11.
[0047] The cache controller 151 is connected to the first bus 141. In the normal mode, the cache controller 151 caches the function return value RTN generated by the flash memory 162 into the cache memory 152 through the flash memory controller 161 according to the operation address ADD_o for the bus arbiter 12 to read. The bus arbiter 12 then returns the read function return value RTN to the microprocessor 11.
[0048] The flash controller 161 is connected to the cache controller 151 and the second bus 142, and is used to read and write the flash memory 162. For example, the flash controller 161 stores the mapping between the cache address (e.g., the operation address ADD_o) and the flash memory address, so that when the cache controller 151 receives the operation address ADD_o, the flash memory 162 can be cached according to the mapping, but the present invention is not limited to this. The flash controller 161 can respond to the cache controller 151 in other ways to achieve random access to the flash memory 16 by the cache controller 151. In normal mode, the flash controller 161 caches the content (or program) of the corresponding flash address in the flash memory 162 according to the operation address ADD_o to generate the function return value RTN.
[0049] More specifically, when the microprocessor 11 does not receive the upgrade command, it runs in the normal mode, and the bus arbiter 12 reads the function return value RTN of the cache memory 162 from the first bus 141 to reply to the function called by the microprocessor 11 .
[0050] When the microprocessor 11 receives the upgrade command, it enters the virtual mode (or upgrade mode). In the virtual mode, the bus arbiter 12 receives the upgrade data Data_upd from the microprocessor 11 and sends the upgrade data Data_upd to the flash controller 161 via the second bus 142 (not via the first bus 141), so as to upgrade the first firmware in the flash memory 162 through the flash controller 161.
[0051] That is, in the normal mode, the bus arbiter 12 uses the first bus 141 to read the flash memory 16 ; and in the dummy mode, the bus arbiter 12 uses the second bus 162 to write into the flash memory 16 .
[0052] For example, refer to Figure 2As shown, in normal mode, when the main program runs to address 0x2000000 (e.g., recorded in the PC register), a function is called, and the function address of the called function is, for example, 0x3000000 located in the flash memory 162 (i.e., the address of the program code that executes the function in the flash memory 162). When the function operation is completed (e.g., at address 0x2000008) and the function return value RTN is obtained, the PC register points to the next program address of the main program (e.g., displayed as 0x2000004, which is recorded in the LR register, for example). The cache controller 151 returns the function return value RTN to the microprocessor 11 via the first bus 141.
[0053] Please refer to Figure 3 As shown, in the virtual mode, the bus arbiter 12 intends to upgrade the first firmware in the flash memory 162 through the second bus 142. Similarly, when the main program runs to the address 0x2000000 (for example, recorded in the PC register), the bus arbiter 12 does not read the function return value RTN through the first bus 141. However, since the microprocessor 11 still needs to receive the return value of the called function to allow the main program to continue running, the virtual hardware 13 generates and returns a virtual return value RTN_void in the format of the function return value RTN of the function called by the microprocessor 11 to the microprocessor 11 to replace the function return value RTN. Although the virtual return value RTN_void will cause an error result in the main program executed by the microprocessor 11, the error result will not affect the navigation function of the mouse device. At the same time, the virtual hardware 13 directly changes the function address in the PC register to the next program address (for example, displayed as 0x4000000), that is, the function return address in the LR register. Figure 3 In the example, the function address of the flash memory 162 is displayed in a lighter color to indicate that it has not been executed.
[0054] In the virtual mode, the bus arbiter 12 can change the values in the SP register, the LR register and the FP register to any appropriate values as long as the program is not executed into the flash memory 162 .
[0055] In more detail, the mouse chip 100 of the present invention is additionally configured with dummy hardware 13, which is used to automatically generate and reply a dummy return value RTN_void in the format of the function return value RTN of the function called by the microprocessor 11 to the microprocessor 11 to replace the function return value RTN when the bus arbiter 12 upgrades the first firmware in the flash memory 162 through the second bus 142 and the flash controller 161, so as to allow the main program to continue to run. In this way, in the dummy mode, only the first firmware in the flash memory 162 stops running and is upgraded; the second firmware in the ROM 17 and / or RAM 18 continues to run. That is, while the first firmware is upgraded, the mouse device still continues to calculate the mouse movement, determine the mouse button click and the scroll wheel rotation.
[0056] It must be pointed out that Figure 2 and Figure 3 Only the function address is shown to illustrate the operation mode of each mode. Since the operation address is only an image of the function address and actually points to the same memory location, it is not shown separately here. Figures 2 to 3 The addresses in the figure are only examples and are not intended to limit the present invention.
[0057] Please refer to Figure 4 As shown, it is a flowchart of the operation method of the mouse device (or mouse chip) according to an embodiment of the present invention, which is applicable to Figure 1 The mouse device includes the following steps: generating a function address ADD_f of a calling function by a microprocessor 11 (step S41); performing address mapping on the function address ADD_f by a bus arbiter 12 to generate an operation address ADD_o, and transmitting the operation address ADD_o to a cache controller 151 through a first bus 141 (step S42); generating a function return value RTN by the cache controller 151 according to the operation address ADD_o by caching the content of the corresponding flash memory address in a flash memory 162 through a flash controller 161, and returning the function return value RTN to the microprocessor 11 through the first bus 141 (step S43); and when the microprocessor 11 transmits upgrade data Data_upd to the bus arbiter 12, the bus arbiter 12 stops reading the function return value RTN through the first bus 141 and sends the upgrade data Data_upd to the flash controller 161 through a second bus 142 to upgrade the first firmware in the flash memory 162 (step S44).
[0058] The details of this embodiment have been described above, so they will not be repeated here. In the present invention, the bus arbiter 12 does not use the first bus 141 and the second bus 142 at the same time.
[0059] The flash cache structure of the present invention is not limited to being applicable to mouse devices, but can also be applied to chips of other electronic devices that need to upgrade the firmware in the flash memory during operation, so as to make the firmware upgrade more efficient.
[0060] Preferably, after completing the upgrade of the first firmware, the present invention allows the first firmware to continue to run with the upgraded version without restarting the mouse device or the system. The upgrade program can be started by, for example, pressing a button 200 of the mouse housing or changing the position of the switch 200.
[0061] In summary, when upgrading the firmware in the flash memory of the conventional mouse device, the mouse device needs to be stopped before the upgrade can be performed, and the mouse device or the system needs to be restarted after the upgrade is completed. Therefore, the present invention further provides a mouse chip that can maintain the operation of a part of the firmware while upgrading the firmware in the flash memory (refer to Figure 1 ) and its operation method (refer to Figure 4 ), which includes additional hardware to actively respond to function return values and change addresses in the microprocessor's registers when updating the firmware in the flash memory.
[0062] Although the present invention has been disclosed through the above examples, they are not intended to limit the present invention. Any person skilled in the art with ordinary knowledge in the art to which the present invention belongs can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the scope defined by the appended claims.
Claims
1. A mouse chip, comprising: A microprocessor, the microprocessor being used to generate a function address of a calling function; A bus arbiter connected to the microprocessor, used for performing address mapping on the function address to generate an operation address for reading a function return value from the first bus, or for receiving update data from the microprocessor to be sent via the second bus; A flash memory, wherein the flash memory has a first firmware, and the content of the flash memory is used to operate the function called by the microprocessor and generate the function return value; a cache controller connected to the first bus and used for caching the function return value generated in the flash memory to a cache memory according to the operation address; as well as A flash memory controller connected to the cache controller and the second bus and configured to: Preserve the mapping between the cache address and the flash memory address, and cache the function return value corresponding to the flash memory address according to the operation address, or The upgrade data is received through the second bus.
2. The mouse chip according to claim 1, wherein: When the microprocessor does not receive an upgrade command, the bus arbiter reads the function return value of the cache memory from the first bus, and When the microprocessor receives the upgrade command, the bus arbiter sends the upgrade data via the second bus to upgrade the first firmware in the flash memory through the flash controller.
3. The mouse chip according to claim 2 further comprises dummy hardware, wherein: When the microprocessor receives the upgrade command, the dummy hardware is used to generate and return a dummy return value that complies with the format of the function return value of the function to the microprocessor to replace the function return value.
4. The mouse chip according to claim 3, wherein the virtual hardware is contained in the bus arbitrator or is independent of the bus arbitrator.
5. The mouse chip according to claim 3, wherein: The microprocessor further comprises a plurality of registers for recording the function address and the function return address of the function, and The virtual hardware is further used to change the function addresses and the function return addresses in the plurality of registers when the microprocessor receives the upgrade command.
6. The mouse chip according to claim 5, wherein the plurality of registers include a program counter register and a link register.
7. The mouse chip according to claim 2, wherein the upgrade command is generated by a mouse button or by an external host.
8. The mouse chip according to claim 1, further comprising at least one of a read-only memory and a random access memory connected to the bus arbiter, wherein the read-only memory or the random access memory has a second firmware built therein.
9. The mouse chip according to claim 8, wherein: The first firmware is used as a third party integrated circuit driver, and The second firmware is used to calculate mouse movement, determine mouse button clicks and scroll wheel rotations.
10. The mouse chip according to claim 9, wherein when the bus arbitrator sends the upgrade data to the flash memory controller through the second bus, the second firmware continues to calculate the mouse movement, determine the mouse button clicks and the scroll wheel rotations.
11. A method for operating a mouse chip, the mouse chip comprising a microprocessor, a bus arbiter, a first bus, a second bus, a cache controller, a flash memory controller and a flash memory, the method comprising: generating a function address of a calling function by the microprocessor; Performing address mapping on the function address by the bus arbiter to generate an operation address, and transmitting the operation address to the cache controller via the first bus; The cache controller caches the content of the corresponding flash memory address in the flash memory through the flash memory controller according to the operation address to generate a function return value, and returns the function return value to the microprocessor through the first bus; as well as When the microprocessor transmits the upgrade data to the bus arbiter, the bus arbiter stops reading the function return value through the first bus and sends the upgrade data to the flash controller via the second bus to upgrade the first firmware in the flash memory.
12. The operating method according to claim 11, wherein the mouse chip further comprises dummy hardware, and when the microprocessor transmits the upgrade data to the bus arbiter, the operating method further comprises: The dummy hardware generates and returns a dummy return value conforming to the format of the function return value to the microprocessor to replace the function return value. 13 . The operating method according to claim 12 , wherein the virtual hardware is included in the bus arbitrator or is independent of the bus arbitrator.
14. The operating method according to claim 12, wherein the microprocessor further comprises a register for recording the function address, the operating method further comprising: The function address in the register is changed to a next program address by the virtual hardware.
15. The operating method according to claim 11, wherein the mouse chip further comprises at least one of a read-only memory and a random access memory connected to the bus arbiter, and the read-only memory or the random access memory has a second firmware built therein, and the operating method further comprises: While the first firmware is being upgraded, the second firmware is used to calculate mouse movement, determine mouse button clicks and scroll wheel rotations.
16. A chip, comprising: A microprocessor, the microprocessor being used to generate a function address of a calling function; A flash memory, wherein the flash memory has a first firmware, and the content of the flash memory is used to operate the function called by the microprocessor and generate a function return value; A flash memory controller, the flash memory controller is used to read and write the flash memory; A cache controller, the cache controller being used to cache the function return value in the flash memory through the flash memory controller; A bus arbiter connected to the microprocessor and used to read the function return value from the cache controller through a first bus, or to update the first firmware in the flash memory through a second bus and the flash controller; as well as The dummy hardware is used to generate and reply a dummy return value conforming to the format of the function return value of the function to the microprocessor to replace the function return value when the bus arbiter upgrades the first firmware in the flash memory through the second bus and the flash controller. 17 . The chip according to claim 16 , wherein the dummy hardware is included in the bus arbitrator or is independent of the bus arbitrator.
18. The chip according to claim 16, wherein: The microprocessor further comprises a plurality of registers for recording the function address and the function return address of the function, and When the bus arbiter upgrades the first firmware in the flash memory through the second bus and the flash controller, the virtual hardware is further used to change the function addresses and the function return addresses in the plurality of registers.
19. The chip according to claim 16, further comprising at least one of a read-only memory and a random access memory connected to the bus arbiter, wherein a second firmware is built in the read-only memory or the random access memory.
20. The chip according to claim 19, wherein when the bus arbiter updates the first firmware in the flash memory through the second bus and the flash controller, the second firmware continues to run.
Citation Information
Patent Citations
Microprocessor, memory subsystem and method for caching data
CN102541771A
Controlled retrieval and execution of commands from transmission queues
DE102020108303A1
Update system capable of updating software across multiple FLASH chips
US20040243992A1
Secure code execution using external memory
US20060107032A1
