Method and device for recording current working mode of storage unit and electronic equipment
By transferring the current working mode information of the storage unit from the static random memory of the main control chip to the NAND Flash storage, the problem of firmware management load and static random memory cost in the prior art is solved, and the load of firmware and main control chip is reduced. effect.
Patent Information
- Application Number
- CN202411029867.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-11-15
AI Technical Summary
The prior art records the current working mode of the storage unit through firmware, increasing the workload of the main control chip and firmware, and the static random memory on the main control chip is small in capacity and expensive, so it is impossible to effectively store the "storage unit working mode" information. resulting in increased costs.
Transfer the current working mode information of the storage unit from the static random memory of the main control chip to be stored in NAND Flash, and use preset registers to store in the NAND Flash memory block through power-off and power-up instructions to reduce the load of firmware And reduce the cost of the main control chip.
By transferring the current working mode information of the storage unit to NAND Flash, the cost problems caused by firmware maintenance workloads and static random memory storage requirements are avoided, and the load and cost of firmware and master chips are reduced.
Smart Images

Figure CN118963661A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data storage, and in particular to a method, device and electronic device for recording the current working mode of a storage unit. Background Art
[0002] At present, the existing technology records the current working mode of the storage unit through firmware, which undoubtedly increases the workload of the main control chip and firmware, making the firmware algorithm processing more complicated. In addition, the static random access memory on the main control chip has a small capacity, high price, and short storage time compared to NAND Flash, and the "storage unit working mode" information is actually stored in the static random access memory on the main control chip, thereby increasing the cost of the main control chip. Summary of the invention
[0003] The purpose of the present invention is to provide a method, device and electronic device for recording the current working mode of a storage unit, so as to avoid the workload brought by the firmware maintaining the "current working mode of the storage unit" information, and to avoid the cost problem caused by the static random access memory on the main control chip, which needs to provide a larger space to store the "current working mode of the storage unit" information.
[0004] In a first aspect, an embodiment of the present invention provides a method for recording the current working mode of a storage unit, comprising: if a power-off instruction sent by a main control chip is received, based on the power-off instruction, the current working mode information of the storage unit in each storage block in the NAND Flash is written from a preset register to the corresponding storage block for storage; wherein the register is pre-added in each storage block of the NAND Flash; the register is used to record the current working mode information of the storage unit in the corresponding storage block; if a power-on instruction sent by the main control chip is received, based on the power-on instruction, the current working mode information of the storage unit stored in the storage block is loaded into the corresponding register.
[0005] In a preferred embodiment of the present invention, if a power-on instruction sent by the above-mentioned main control chip is received, based on the above-mentioned power-on instruction, the current working mode information of the above-mentioned storage unit stored in the above-mentioned storage block is loaded into the corresponding above-mentioned register. After that, the above-mentioned method includes: if a current working mode information query instruction of the storage unit of the target storage block is received from the above-mentioned main control chip, based on the above-mentioned storage unit current working mode information query instruction, the current working mode information of the above-mentioned storage unit of the above-mentioned target storage block corresponding to the above-mentioned register is queried.
[0006] In a preferred embodiment of the present invention, if a power-on instruction sent by the above-mentioned main control chip is received, based on the above-mentioned power-on instruction, the step of loading the current working mode information of the above-mentioned storage unit stored in the above-mentioned storage block into the corresponding above-mentioned register includes: based on the above-mentioned power-on instruction, representing the current working mode information of the above-mentioned storage unit in the above-mentioned storage block through the target field provided by the above-mentioned register.
[0007] In a preferred embodiment of the present invention, the target field includes: a first byte, a second byte, a third byte and a fourth byte.
[0008] In a preferred embodiment of the present invention, the first byte and the third byte are original codes corresponding to the current working mode information of the storage unit; the second byte and the fourth byte are complement codes corresponding to the original codes.
[0009] In a preferred embodiment of the present invention, the first byte is 0b00010001, the second byte is 0b11101110, the third byte is 0b00010001, and the fourth byte is 0b11101110.
[0010] In a preferred embodiment of the present invention, when the number of the above-mentioned storage blocks is 1000, the total capacity of the registers of all the above-mentioned storage blocks in the above-mentioned NAND Flash is 3.9KB.
[0011] In a preferred embodiment of the present invention, the number of the registers in each storage block is one.
[0012] In the second aspect, an embodiment of the present invention further provides a device for recording the current working mode of a storage unit, comprising: a first instruction receiving module, for, if a power-off instruction sent by a main control chip is received, based on the power-off instruction, writing the current working mode information of the storage unit in each storage block in the NAND Flash from a preset register to the corresponding storage block for storage; wherein the above-mentioned register is pre-added in each storage block of the above-mentioned NAND Flash; the above-mentioned register is used to record the current working mode information of the storage unit in the corresponding storage block; and a second instruction receiving module, for, if a power-on instruction sent by the above-mentioned main control chip is received, based on the above-mentioned power-on instruction, loading the current working mode information of the above-mentioned storage unit stored in the above-mentioned storage block into the corresponding above-mentioned register.
[0013] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the current working mode recording method of the storage unit.
[0014] The embodiments of the present invention have the following beneficial technical effects:
[0015] The embodiment of the present invention provides a method, device and electronic device for recording the current working mode of a storage unit, including: if a power-off instruction sent by a main control chip is received, based on the power-off instruction, the current working mode information of the storage unit in each storage block in the NAND Flash is written from a preset register to the corresponding storage block for storage; wherein the register is pre-added in each storage block of the NAND Flash; the register is used to record the current working mode information of the storage unit in the corresponding storage block; if a power-on instruction sent by the main control chip is received, based on the power-on instruction, the current working mode information of the storage unit stored in the storage block is loaded into the corresponding register. The method transfers the current working mode information of the storage unit that originally needs to be managed by the firmware to the NAND Flash for storage, thereby avoiding the workload brought by the firmware maintaining the "current working mode of the storage unit" information, and avoiding the cost problem brought by the static random access memory on the main control chip, which needs to provide a larger space to store the "current working mode of the storage unit" information, thereby reducing the firmware load and the cost of the main control chip. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 A schematic diagram of a flow chart of a method for recording the current working mode of a storage unit provided by an embodiment of the present invention;
[0018] Figure 2 A schematic flow chart of another method for recording the current working mode of a storage unit provided by an embodiment of the present invention;
[0019] Figure 3 A schematic diagram of the structure of a device for recording the current working mode of a storage unit provided by an embodiment of the present invention;
[0020] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.
[0021] Icons: 31 - first instruction receiving module; 32 - second instruction receiving module; 41 - memory; 42 - processor; 43 - bus; 44 - communication interface. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0023] The existing technology records the current working mode of the storage unit through firmware, which undoubtedly increases the workload of the main control chip and firmware, making the firmware algorithm processing more complicated. In addition, the static random access memory on the main control chip has a small capacity, high price, and short storage time compared to NAND Flash, and the "storage unit working mode" information is actually stored in the static random access memory on the main control chip, thereby increasing the cost of the main control chip.
[0024] Based on this, the embodiment of the present invention provides a method, device and electronic device for recording the current working mode of a storage unit. The method transfers the current working mode information of the storage unit that originally needs to be managed by the firmware to NAND Flash for storage, thereby avoiding the workload caused by the firmware maintaining the "current working mode of the storage unit" information, and avoiding the cost problem caused by the static random access memory on the main control chip, which needs to provide a larger space to store the "current working mode of the storage unit" information, thereby reducing the firmware load and the cost of the main control chip. For ease of understanding, the method for recording the current working mode of the storage unit is first introduced in detail.
[0025] Example 1
[0026] In this embodiment, Figure 1 A schematic flow chart of a method for recording the current working mode of a storage unit provided in an embodiment of the present invention.
[0027] Depend on Figure 1 As can be seen, the method includes:
[0028] Step S101: If a power-off instruction sent by the main control chip is received, based on the power-off instruction, the current working mode information of the storage unit in each storage block in the NAND Flash is written from a preset register to the corresponding storage block for storage; wherein the above register is pre-added in each storage block of the above NAND Flash; the above register is used to record the current working mode information of the storage unit in the corresponding storage block.
[0029] Step S102: if a power-on instruction sent by the main control chip is received, based on the power-on instruction, the current working mode information of the storage unit stored in the storage block is loaded into the corresponding register.
[0030] The embodiment of the present invention provides a method for recording the current working mode of a storage unit, comprising: if a power-off instruction sent by a main control chip is received, based on the power-off instruction, the current working mode information of the storage unit in each storage block in the NAND Flash is written from a preset register to the corresponding storage block for storage; wherein the register is pre-added in each storage block of the NAND Flash; the register is used to record the current working mode information of the storage unit in the corresponding storage block; if a power-on instruction sent by the main control chip is received, based on the power-on instruction, the current working mode information of the storage unit stored in the storage block is loaded into the corresponding register. The method transfers the current working mode information of the storage unit that originally needs to be managed by the firmware to the NAND Flash for storage, thereby avoiding the workload brought by the firmware maintaining the "current working mode of the storage unit" information, and avoiding the cost problem brought by the static random access memory on the main control chip, which needs to provide a larger space to store the "current working mode of the storage unit" information, thereby reducing the firmware load and the cost of the main control chip.
[0031] Example 2
[0032] Based on the above embodiments, Figure 2 A schematic flow chart of another method for recording the current working mode of a storage unit provided in an embodiment of the present invention.
[0033] Step S201: If a power-off instruction sent by the main control chip is received, based on the above power-off instruction, the current working mode information of the storage unit in each storage block in the NAND Flash is written from a preset register to the corresponding storage block for storage; wherein the above register is pre-added in each storage block of the above NAND Flash; the above register is used to record the current working mode information of the storage unit in the corresponding storage block.
[0034] In this embodiment, the number of the registers in each storage block is one.
[0035] Step S202: if a power-on instruction sent by the main control chip is received, based on the power-on instruction, the current working mode information of the storage unit stored in the storage block is loaded into the corresponding register.
[0036] In actual operation, step S202 includes: based on the power-on instruction, the target field provided by the register indicates the current working mode information of the storage unit in the storage block.
[0037] Furthermore, the above-mentioned target field includes: a first byte, a second byte, a third byte and a fourth byte.
[0038] Among them, the above-mentioned first byte and the above-mentioned third byte are the original codes corresponding to the current working mode information of the above-mentioned storage unit; the above-mentioned second byte and the above-mentioned fourth byte are the complement codes corresponding to the above-mentioned original codes.
[0039] In one implementation manner, the first byte is 0b00010001, the second byte is 0b11101110, the third byte is 0b00010001, and the fourth byte is 0b11101110.
[0040] In one implementation manner, when the number of the storage blocks is 1000, the total capacity of the registers of all the storage blocks in the NAND Flash is 3.9 KB.
[0041] Here, the formula for calculating the total capacity of the above registers is as follows:
[0042] 1000x 4Byte / 1024≈3.9KB
[0043] When the number of storage blocks is other values, the total capacity of the registers of all the storage blocks in the corresponding NAND Flash may also be calculated accordingly.
[0044] Step S203: If a current working mode information query instruction of the storage unit of the target storage block sent by the above-mentioned main control chip is received, based on the above-mentioned storage unit current working mode information query instruction, the current working mode information of the above-mentioned storage unit of the above-mentioned target storage block corresponding to the above-mentioned register is queried.
[0045] An embodiment of the present invention provides a method for recording the current working mode of a storage unit, comprising: if a power-off instruction sent by a main control chip is received, based on the power-off instruction, the current working mode information of the storage unit in each storage block in the NAND Flash is written from a preset register to the corresponding storage block for storage; wherein the register is pre-added in each storage block of the NAND Flash; the register is used to record the current working mode information of the storage unit in the corresponding storage block; if a power-on instruction sent by the main control chip is received, based on the power-on instruction, the current working mode information of the storage unit stored in the storage block is loaded into the corresponding register; if a current working mode information query instruction of the storage unit of the target storage block is received from the main control chip, based on the current working mode information query instruction of the storage unit, the current working mode information of the storage unit of the target storage block corresponding to the register is queried. This method not only transfers the current working mode information of the storage unit that originally needs to be managed by the firmware to the NAND Flash for storage, thereby avoiding the workload brought by the firmware maintaining the "current working mode of the storage unit" information, and avoiding the cost problem brought by the static random access memory on the main control chip and the need to provide a larger space to store the "current working mode of the storage unit" information, thereby reducing the firmware load and the cost of the main control chip, but also queries the current working mode information of the above-mentioned storage unit of the above-mentioned target storage block corresponding to the above-mentioned register based on the current working mode information query instruction, thereby increasing the convenience of current working mode information query.
[0046] Example 3
[0047] Based on the above embodiments, Figure 3 A schematic structural diagram of a device for recording the current working mode of a storage unit provided in an embodiment of the present invention.
[0048] Depend on Figure 3 As can be seen, the device includes:
[0049] The first instruction receiving module 31 is used for, if a power-off instruction sent by the main control chip is received, based on the above power-off instruction, writing the current working mode information of the storage unit in each storage block in the NAND Flash from a preset register to the corresponding storage block for storage; wherein the above register is pre-added in each storage block of the above NAND Flash; the above register is used to record the current working mode information of the storage unit in the corresponding storage block.
[0050] The second instruction receiving module 32 is used for loading the current working mode information of the storage unit stored in the storage block into the corresponding register based on the power-on instruction if the power-on instruction sent by the main control chip is received.
[0051] The first instruction receiving module 31 and the second instruction receiving module 32 are connected.
[0052] In one embodiment, the device also includes a query module connected to the above-mentioned second instruction receiving module 32; the above-mentioned query module is used to query the current working mode information of the above-mentioned storage unit of the above-mentioned target storage block corresponding to the above-mentioned register based on the above-mentioned storage unit current working mode information query instruction if the above-mentioned query module receives the current working mode information query instruction of the storage unit of the target storage block sent by the above-mentioned main control chip.
[0053] In one embodiment, the second instruction receiving module 32 is further configured to indicate, based on the power-on instruction, the current working mode information of the storage unit in the storage block through the target field provided by the register.
[0054] The storage unit current working mode recording device provided in the embodiment of the present invention has the same technical features as the storage unit current working mode recording method provided in the above embodiment, so it can also solve the same technical problems and achieve the same technical effects. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the device described above can refer to the corresponding process in the above method embodiment, and will not be repeated here.
[0055] Example 3
[0056] This embodiment provides an electronic device, including a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the steps of the method for recording the current working mode of a storage unit.
[0057] This embodiment provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the method for recording the current working mode of a storage unit are implemented.
[0058] See also Figure 4 The structural schematic diagram of an electronic device shown in the figure comprises: a memory 41 and a processor 42. The memory 41 stores a computer program that can be run on the processor 42. When the processor executes the computer program, the steps provided by the current working mode recording method of the above-mentioned storage unit are implemented.
[0059] like Figure 4 As shown, the device further includes: a bus 43 and a communication interface 44, a processor 42, a communication interface 44 and a memory 41 are connected via the bus 43; the processor 42 is used to execute executable modules stored in the memory 41, such as computer programs.
[0060] The memory 41 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 44 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.
[0061] The bus 43 may be an ISA bus, a PCI bus, or an EISA bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0062] Among them, the memory 41 is used to store the program, and the processor 42 executes the program after receiving the execution instruction. The method executed by the current working mode recording device of the storage unit disclosed in any embodiment of the present invention can be applied to the processor 42, or implemented by the processor 42. The processor 42 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 42. The above processor 42 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 41, and the processor 42 reads the information in the memory 41 and completes the steps of the above method in combination with its hardware.
[0063] Furthermore, an embodiment of the present invention also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by the processor 42, the machine-executable instructions prompt the processor 42 to implement the above-mentioned storage unit current working mode recording method.
[0064] The electronic device and computer-readable storage medium provided by the embodiments of the present invention have the same technical features, and therefore can solve the same technical problems and achieve the same technical effects.
[0065] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0066] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
Claims
1. A method for recording the current working mode of a storage unit, characterized in that: include: If a power-off instruction sent by the main control chip is received, based on the power-off instruction, the current working mode information of the storage unit in each storage block in the NAND Flash is written from a preset register to the corresponding storage block for storage; wherein the register is pre-added in each storage block of the NAND Flash; the register is used to record the current working mode information of the storage unit in the corresponding storage block; If a power-on instruction sent by the main control chip is received, based on the power-on instruction, the current working mode information of the storage unit stored in the storage block is loaded into the corresponding register.
2. The method for recording the current working mode of a storage unit according to claim 1, characterized in that: If a power-on instruction sent by the main control chip is received, after the step of loading the current working mode information of the storage unit stored in the storage block into the corresponding register based on the power-on instruction, the method includes: If a current working mode information query instruction of a storage unit of a target storage block sent by the main control chip is received, based on the current working mode information query instruction of the storage unit, the current working mode information of the storage unit of the target storage block corresponding to the register is queried.
3. The method for recording the current working mode of a storage unit according to claim 1, characterized in that: If a power-on instruction sent by the main control chip is received, the step of loading the current working mode information of the storage unit stored in the storage block into the corresponding register based on the power-on instruction includes: Based on the power-on instruction, the target field provided by the register indicates current working mode information of the storage unit in the storage block.
4. The method for recording the current working mode of a storage unit according to claim 3, characterized in that: The target field includes: a first byte, a second byte, a third byte and a fourth byte.
5. The method for recording the current working mode of a storage unit according to claim 4, characterized in that: The first byte and the third byte are original codes corresponding to the current working mode information of the storage unit; the second byte and the fourth byte are complement codes corresponding to the original codes.
6. The method for recording the current working mode of a storage unit according to claim 4, characterized in that: The first byte is 0b00010001, the second byte is 0b11101110, the third byte is 0b00010001, and the fourth byte is 0b11101110.
7. The method for recording the current working mode of a storage unit according to claim 1, characterized in that: When the number of the storage blocks is 1000, the total capacity of the registers of all the storage blocks in the NAND Flash is 3.9 KB.
8. The method for recording the current working mode of a storage unit according to claim 1, characterized in that: The number of the registers in each storage block is 1.
9. A device for recording the current working mode of a storage unit, characterized in that: include: A first instruction receiving module is used for, if a power-off instruction sent by the main control chip is received, based on the power-off instruction, writing the current working mode information of the storage unit in each storage block in the NAND Flash from a preset register to the corresponding storage block for storage; wherein the register is pre-added in each storage block of the NAND Flash; the register is used to record the current working mode information of the storage unit in the corresponding storage block; The second instruction receiving module is used for loading the current working mode information of the storage unit stored in the storage block into the corresponding register based on the power-on instruction if the power-on instruction sent by the main control chip is received.
10. An electronic device, characterized in that: The electronic device includes a processor and a memory, the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the current working mode recording method of the storage unit according to any one of claims 1 to 8.
