Data storage method and device applied to embedded system, equipment and medium
By determining the data capacity and current data capacity of the target storage container in the embedded system, and thus determining the data storage method, the efficiency problem of data export in the queue data structure is solved, data container reuse is realized, and the efficiency of data export is improved.
Patent Information
- Application Number
- CN202310346618.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-03
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2043-04-03
AI Technical Summary
In embedded systems, historical records are typically stored using a queue data structure. This results in the latest and earliest records not being stored sequentially by time, leading to inefficient data export and requiring complex reordering or retrieval calculations.
By acquiring the instruction information to be applied, the target storage container that matches the preset instruction information is determined, and the data capacity information and current data capacity are acquired. Based on this information, the data storage method is determined, thereby enabling the reuse of the data storage container.
It improves the efficiency of data export in embedded systems, avoids reordering and complicated retrieval calculations, and improves the efficiency of data storage.
Smart Images

Figure CN116301653B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and in particular to a data storage method and device applied to an embedded system, equipment and medium. BACKGROUND
[0002] With the rapid development of computer technology, historical records are essential functions in many power electronic system products, which can record the past running information of local systems, such as historical fault information, historical power generation data, etc. These information records can be viewed by users, used for tracing system running state and system defects, and statistical data, providing evidence for system operation anomalies, and providing necessary reference for product defect troubleshooting and function upgrade.
[0003] However, in the process of embedded system software design, the storage of historical record information usually adopts a queue data structure to store in a circular manner. Since all historical record information entries in the queue structure are not stored in the queue space in order of time point, the latest and earliest generated historical record information entries are not always stored in a fixed position in the queue space. After local display or information export, all historical record information needs to be re-sequenced or relatively complex retrieval calculation needs to be performed, thereby reducing the data export efficiency. SUMMARY
[0004] The present application provides a data storage method and device applied to an embedded system, equipment and medium, which realizes the determination of data storage mode according to data capacity information and current data capacity of a target storage container, thereby realizing the reuse of data storage containers and improving the data export efficiency in the embedded system.
[0005] In a first aspect, the present application embodiment provides a data storage method applied to an embedded system, comprising:
[0006] Obtaining to-be-applied instruction information and determining whether the to-be-applied instruction information matches preset instruction information;
[0007] If the to-be-applied instruction information matches the preset instruction information, a target storage container corresponding to the to-be-applied instruction information is determined, and data capacity information and current data capacity corresponding to the target storage container are obtained; wherein the target storage container includes a valve stack set in advance;
[0008] Determining a data storage mode based on the data capacity information and the current data capacity, and performing data storage based on the data storage mode.
[0009] In a second aspect, the present application embodiment further provides a data storage device applied to an embedded system, which comprises:
[0010] an instruction confirmation module, configured to acquire to-be-applied instruction information, and determine whether the to-be-applied instruction information matches preset instruction information;
[0011] an information acquisition module, configured to, if the to-be-applied instruction information matches the preset instruction information, determine a target storage container corresponding to the to-be-applied instruction information, and acquire data capacity information and a current data capacity corresponding to the target storage container; wherein the target storage container comprises a valve stack that is set in advance.
[0012] a data storage module, configured to determine a data storage manner based on the data capacity information and the current data capacity, and perform data storage based on the data storage manner.
[0013] In a third aspect, an electronic device is also provided, and the device comprises:
[0014] one or more processors; and
[0015] a memory in communication with the at least one processor; wherein
[0016] the memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to implement the data storage method for an embedded system according to any of the embodiments of the present application.
[0017] In a fourth aspect, a computer readable storage medium is also provided, and the computer readable storage medium stores a computer program that, when executed by a processor, implements the data storage method for an embedded system according to any of the embodiments of the present application.
[0018] The technical solution of the embodiments of the present application acquires to-be-applied instruction information, and determines whether the to-be-applied instruction information matches preset instruction information, and if the to-be-applied instruction information matches the preset instruction information, determines a target storage container corresponding to the to-be-applied instruction information, and acquires data capacity information and a current data capacity corresponding to the target storage container, and then determines a data storage manner based on the data capacity information and the current data capacity, and performs data storage based on the data storage manner. Based on the above technical solution, the data storage manner is determined according to the data capacity information and the current data capacity of the target storage container, and then the data storage container is multiplexed, and the data export efficiency in the embedded system is improved.
[0019] It should be understood that the content described in this section is not intended to identify key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart illustrating a data storage method applied to an embedded system according to an embodiment of the present invention;
[0022] Figure 2 This is a schematic diagram of the data storage structure of the valve stack provided in an embodiment of the present invention;
[0023] Figure 3 This is a schematic diagram of the data translation and storage process of the valve stack provided in an embodiment of the present invention;
[0024] Figure 4 This is a flowchart of a data storage method applied to an embedded system provided by an embodiment of the present invention;
[0025] Figure 5 This is a structural block diagram of a data storage device applied to an embedded system provided by an embodiment of the present invention;
[0026] Figure 6 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0027] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and in the above drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] Embodiment one
[0030] Figure 1 A flowchart of a data storage method applied to an embedded system is provided for an embodiment of the present application. After obtaining instruction information, the embodiment can determine a target storage container corresponding to the instruction information, determine a data storage mode according to data capacity information of the target storage container and a current data capacity, and then realize data storage. The method can be executed by a data storage device applied to an embedded system. The data storage device applied to an embedded system can be realized in the form of hardware and / or software. The device can be configured in an electronic device, which can be a PC or a server, etc.
[0031] As shown in Figure 1 , the method comprises:
[0032] S110, obtaining to-be-applied instruction information, and determining whether the to-be-applied instruction information matches preset instruction information.
[0033] The to-be-applied instruction information can be instruction information generated when data needs to be processed. The preset instruction information can be understood as instruction information that is set in advance for identifying the to-be-applied instruction information.
[0034] Specifically, if the current data needs to be processed, to-be-applied instruction information corresponding to the current data is obtained, and whether the to-be-applied instruction information meets a preset condition is determined according to the preset instruction information. For example, the to-be-applied instruction information and the preset instruction information can be matched, a matching result is obtained, and then whether the to-be-applied instruction information matches the preset instruction information is determined based on the matching result.
[0035] On the basis of the above technical solutions, the determining whether the to-be-applied instruction information matches the preset instruction information comprises: acquiring instruction type information of the to-be-applied instruction information; and determining whether the to-be-applied instruction information matches the preset instruction information based on the instruction type information.
[0036] The instruction type information can be a data processing type of the current to-be-applied instruction information. Correspondingly, the instruction type information comprises at least one of a data storage type, a data export type, and a data zeroing type. The data storage type can be understood as storing data corresponding to the current to-be-applied instruction information. The data export type can be exporting historical data in a storage container. The data zeroing can be understood as deleting data in the storage container.
[0037] Specifically, the instruction type information is extracted from the to-be-applied instruction information, and then it is determined whether the to-be-applied instruction information matches the preset instruction information based on the instruction type information. For example, the preset instruction information can be instruction information of the data storage type, and then it is determined that the current to-be-applied instruction information matches the preset instruction information when the to-be-applied instruction information needs to perform a data storage operation.
[0038] S120, if the to-be-applied instruction information matches the preset instruction information, determining a target storage container corresponding to the to-be-applied instruction information, and acquiring data capacity information and a current data capacity corresponding to the target storage container.
[0039] The target storage container can be a container that needs to perform data storage, for example, a pre-set stack, a queue, and the like. It should be noted that the target storage container comprises a pre-set valve stack, as shown in Figure 2 The valve stack is a kind of "stack" data storage structure, which is open at the top and closed at the bottom, but has a "valve" at the bottom. The data capacity information can be the maximum data capacity information pre-set when the target storage container is set. The current data capacity can be understood as the number of currently stored data in the target storage container.
[0040] Specifically, if the to-be-applied instruction information matches the preset instruction information, the corresponding target storage container is determined based on the to-be-applied instruction information. For example, address information associated with the target storage container can be extracted from the to-be-applied instruction information, and then the target storage container is determined based on the address information. Then, after the target storage container is determined, the data capacity information and the current data capacity corresponding to the target storage container are acquired.
[0041] On the basis of the above technical solutions, the data capacity information corresponding to the target storage container and the current data capacity are acquired, including: acquiring the data capacity information of the target storage container; and determining the current data capacity corresponding to the target storage container based on the push-in counter of the target storage container.
[0042] The data capacity information is a pre-set data storage quantity. The push-in counter can be a timer for counting the quantity of data pushed in.
[0043] Specifically, a designer can abstractly construct a "valve stack" data storage structure according to product function requirements and actual storage resource conditions, and pre-set the storage space depth and content composition of the "valve stack" data storage structure. When initializing the "valve stack" data storage structure, the values of the "push-in counter SP" and the "push-out counter SP" are both set to zero, and the entire "valve stack" data storage container is cleared. Then, when data needs to be stored, the data capacity information of the target storage container can be acquired, and the current data capacity corresponding to the target storage container can be determined based on the push-in counter of the target storage container.
[0044] S130, determining a data storage mode based on the data capacity information and the current data capacity, and storing data based on the data storage mode.
[0045] The data storage mode can be a mode of storing current data.
[0046] Specifically, the data storage mode can be determined based on the data capacity information and the current data capacity, and data can be stored based on the data storage mode. For example, a corresponding data storage mode can be pre-set, and a corresponding index information table can be set, so that the data storage mode can be determined in the index information table based on the data capacity information and the current data capacity, and data can be stored based on the data storage mode.
[0047] On the basis of the above technical solutions, the data storage mode corresponding to the data capacity information and the current data capacity is determined based on the data capacity information and the current data capacity, and data is stored based on the data storage mode, including: if the current data capacity is less than the data capacity information, determining that the data storage mode is direct storage; acquiring the to-be-stored data corresponding to the to-be-applied instruction information, directly storing the to-be-stored data into the target storage container, and updating the current data capacity.
[0048] The direct storage can be directly storing the to-be-stored data into the target storage container. The to-be-stored data can be understood as data corresponding to the to-be-applied instruction information.
[0049] Specifically, if the current data capacity is less than the data capacity information, it is determined that the data storage mode is direct storage, and then the data to be stored corresponding to the to-be-applied instruction information is obtained, the data to be stored is directly stored into the target storage container, and the current data capacity is updated. For example, when a new historical record information is generated, the historical record information needs to be stored in the "valve stack" data storage structure, the "stacking" operation (i.e. "write" operation) is performed, the "stacking counter SP" value is increased by 1 for each historical record information, and the "stacking counter SP" value remains unchanged after the data storage structure is full.
[0050] On the basis of the above technical solutions, the data storage mode corresponding to the data capacity information and the current data capacity is determined, and data storage is performed based on the data storage mode, including: if the current data capacity is greater than or equal to the data capacity information, it is determined that the data storage mode is translation storage; the historical data at the bottom of the target storage container is deleted, and the remaining data information in the target storage container is translated to the bottom of the container in turn; the data to be stored corresponding to the to-be-applied instruction information is obtained, and the data to be stored is stored into the target storage container.
[0051] In the translation storage, after the last day data in the target storage container is deleted, the remaining data is translated downward, and then the data is stored into the target storage container. The historical data can be understood as the data that has been stored into the target storage container.
[0052] Specifically, if the current data capacity is greater than or equal to the data capacity information, it means that the current target storage container is full, and the data in the target storage container needs to be processed to complete the data storage, so the data storage mode is determined to be translation storage. Then the historical data at the bottom of the target storage container needs to be deleted, and the remaining data information in the target storage container needs to be translated to the bottom of the container in turn. Finally, the data to be stored corresponding to the to-be-applied instruction information is obtained, and the data to be stored is stored into the target storage container. It should be noted that, as shown in the figure, since the space depth (size) of the "valve stack" data storage structure is fixed and has been set in advance, when the number of historical record information reaches the pre-set storage space capacity, the "valve" at the bottom of the "valve stack" data storage structure is used to delete or cover the earliest historical record information in it through the "valve", and then the data information in the "valve stack" data storage structure is translated to the bottom of the stack in turn, and finally the newly generated historical record information is stored in the storage space. Figure 3
[0053] On the basis of the above technical solutions, the method further comprises: if the to-be-applied instruction information is of a data export type, performing a data export operation based on a stack-out counter and updating stack-out record information of the stack-out counter in real time; and if historical data in the target storage container has been completely exported, setting the stack-out record information of the stack-out counter to a preset value.
[0054] The stack-out counter can be a counter preset for counting the amount of exported data. The stack-out record information can be understood as the record of the stack-out counter updated in real time.
[0055] Specifically, if the to-be-applied instruction information is of a data export type, a data export operation is performed based on a stack-out counter, and stack-out record information of the stack-out counter is updated in real time. If historical data in the target storage container has been completely exported, the stack-out record information of the stack-out counter is set to a preset value. For example, when local display or execution information is exported, historical record information needs to be read from the "valve stack" data storage structure, and an "export" operation (i.e., a "read" operation) is performed. The value of the "stack-out counter SP" is increased by one for each piece of historical record information read, and the value of the "stack-out counter SP" returns to 0 after the last piece of historical record information is read.
[0056] On the basis of the above technical solutions, the method further comprises: if the to-be-applied instruction information is of a data zero-clearing type, obtaining stack-in record information and stack-out record information of the target storage container; and setting the stack-in record information and the stack-out record information to preset values to clear data in the target storage container.
[0057] The stack-in record information can be the amount of data stacked in real time by a stack-in counter.
[0058] Specifically, if the to-be-applied instruction information is of a data zero-clearing type, stack-in record information and stack-out record information of the target storage container are obtained, and the stack-in record information and the stack-out record information are set to preset values to clear data in the target storage container. For example, the "valve stack" data storage structure can also be subjected to a zero-clearing operation through a command. After zero-clearing, all data in the storage structure are cleared, and the values of the "stack-in counter SP" and the "stack-out counter SP" are both set to 0.
[0059] The technical scheme of the embodiment of the present application comprises the following steps: obtaining to-be-applied instruction information, determining whether the to-be-applied instruction information matches preset instruction information, determining a target storage container corresponding to the to-be-applied instruction information if the to-be-applied instruction information matches the preset instruction information, obtaining data capacity information and a current data capacity corresponding to the target storage container, determining a data storage mode based on the data capacity information and the current data capacity, and performing data storage based on the data storage mode. Based on the above technical scheme, the data storage mode is determined according to the data capacity information and the current data capacity of the target storage container, and then the data storage container is reused, and the data export efficiency in the embedded system is improved.
[0060] Embodiment two
[0061] Figure 4 is a flowchart of a data storage method applied to an embedded system provided by the embodiment of the present application. The embodiment further optimizes the above-mentioned data storage method applied to an embedded system on the basis of the above-mentioned embodiment. The specific implementation manner can be referred to the technical scheme of the embodiment. The technical terms same as or corresponding to those in the above-mentioned embodiment are not described herein.
[0062] The technical scheme provided by the embodiment comprises the following steps: Figure 4
[0063] When the system product software is designed, the designer can abstractly construct a "valve stack" data storage structure according to the actual situation of product function demand and storage resource, and pre-set the storage space depth and content composition of the "valve stack" data storage structure. When the "valve stack" data storage structure is initialized, the "stack-in counter SP" and the "stack-out counter SP" are both set to zero, and the entire "valve stack" data storage container is cleared.
[0064] When a new historical record information is generated, the historical record information needs to be stored in the "valve stack" data storage structure, and then the "stack-in" operation (i.e. the "write" operation) is performed. The "stack-in counter SP" value is increased by one for each historical record information, and the "stack-in counter SP" value remains unchanged after the data storage structure is full. When the local display or the information export is performed, the historical record information needs to be read from the "valve stack" data storage structure, and then the "stack-out" operation (i.e. the "read" operation) is performed. The "stack-out counter SP" value is increased by one for each historical record information, and the "stack-out counter SP" value returns to 0 after the last historical record information is read.
[0065] Since the space depth (size) of the "valve stack" data storage structure is fixed and has been set in advance, when the number of historical record information is full of the storage space capacity set in advance, the earliest generated historical record information in the "valve" at the bottom of the "valve stack" data storage structure needs to be deleted through the "valve", and then the data information in the "valve stack" data storage structure is translated to the bottom of the stack in turn, and finally the newly generated historical record information is stored in the storage space. The "valve stack" data storage structure can also be cleared by command. After clearing, all data in the entire storage structure is cleared, and the values of the "stack counter SP" and the "stack counter SP" are both set to zero.
[0066] It should be noted that the historical record information generated by the device is arranged in the storage space in strict accordance with the time point of generation. The latest generated historical record information is always arranged at the top of the "stack" storage structure, and the earliest generated historical record information is always arranged at the bottom of the "stack" storage structure. After local display or information export, there is no need to reorder all the historical record information, and there is no need to perform relatively complex retrieval calculation. At the same time, the "valve stack" data storage structure can be regarded as a whole module. When writing software code, the whole "valve stack" data storage structure can be operated in a modular design idea, reducing the coupling of the software code.
[0067] The technical scheme of the embodiment of the application comprises the following steps: obtaining to-be-applied instruction information, determining whether the to-be-applied instruction information matches preset instruction information, determining a target storage container corresponding to the to-be-applied instruction information if the to-be-applied instruction information matches the preset instruction information, obtaining data capacity information and a current data capacity corresponding to the target storage container, determining a data storage mode based on the data capacity information and the current data capacity, and performing data storage based on the data storage mode. Based on the above technical scheme, the data storage mode is determined according to the data capacity information and the current data capacity of the target storage container, and the data storage container is multiplexed, thereby improving the data export efficiency in the embedded system.
[0068] Embodiment three
[0069] Figure 5 is a structural block diagram of a data storage device applied to an embedded system provided by the embodiment of the application. The device comprises an instruction confirmation module 510, an information obtaining module 520, and a data storage module 530.
[0070] The instruction confirmation module 510 is configured to obtain to-be-applied instruction information and determine whether the to-be-applied instruction information matches preset instruction information.
[0071] The information obtaining module 520 is configured to determine a target storage container corresponding to the to-be-applied instruction information and obtain data capacity information and a current data capacity corresponding to the target storage container if the to-be-applied instruction information matches the preset instruction information, wherein the target storage container includes a valve stack that is set in advance.
[0072] The data storage module 530 is configured to determine a data storage manner based on the data capacity information and the current data capacity and perform data storage based on the data storage manner.
[0073] On the basis of the above technical solution, the instruction confirming module is configured to obtain instruction type information of the to-be-applied instruction information, wherein the instruction type information includes at least one of a data storage type, a data export type, and a data zeroing type; and determine whether the to-be-applied instruction information matches the preset instruction information based on the instruction type information.
[0074] On the basis of the above technical solution, the information obtaining module is configured to obtain data capacity information of the target storage container, wherein the data capacity information is a data storage quantity that is set in advance; and determine a current data capacity corresponding to the target storage container based on a push-in counter of the target storage container.
[0075] On the basis of the above technical solution, the data storage module is configured to determine a data storage manner as direct storage if the current data capacity is less than the data capacity information; obtain to-be-stored data corresponding to the to-be-applied instruction information; directly store the to-be-stored data into the target storage container; and update the current data capacity.
[0076] On the basis of the above technical solution, the data storage module is configured to determine the data storage manner as translational storage if the current data capacity is greater than or equal to the data capacity information; delete historical data at a bottom of the target storage container; and sequentially translate remaining data information in the target storage container to the bottom of the container; obtain to-be-stored data corresponding to the to-be-applied instruction information; and store the to-be-stored data into the target storage container.
[0077] On the basis of the above technical solution, the device includes a data export module configured to perform a data pop operation based on a pop counter and update pop record information of the pop counter in real time if the to-be-applied instruction information is of a data export type; and set the pop record information of the pop counter to a preset value if historical data in the target storage container has been completely exported.
[0078] On the basis of the technical scheme, the device comprises a data zeroing module, configured to, if the to-be-applied instruction information is of a data zeroing type, acquire in-stack record information and out-stack record information of the target storage container; and set the in-stack record information and the out-stack record information as preset values to empty data in the target storage container.
[0079] The technical scheme of the embodiment of the application comprises the following steps: acquiring to-be-applied instruction information, determining whether the to-be-applied instruction information matches preset instruction information, determining a target storage container corresponding to the to-be-applied instruction information if the to-be-applied instruction information matches the preset instruction information, acquiring data capacity information and a current data capacity corresponding to the target storage container, determining a data storage mode based on the data capacity information and the current data capacity, and performing data storage based on the data storage mode. Based on the technical scheme, the data storage mode is determined according to the data capacity information and the current data capacity of the target storage container, and then the data storage container is reused, and the data export efficiency in the embedded system is improved.
[0080] The data storage device applied to the embedded system provided in the embodiment of the application can execute the data storage method applied to the embedded system provided in any embodiment of the present disclosure, and has the function modules and beneficial effects corresponding to the execution method.
[0081] It should be noted that each unit and module included in the above device is only divided according to the function logic, but is not limited to the above division, as long as the corresponding function can be realized; in addition, the specific name of each functional unit is only for convenient mutual distinction, and does not limit the protection scope of the embodiments of the present disclosure.
[0082] Embodiment Four
[0083] Figure 6 A structural schematic diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smart phones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present application described and / or claimed in this document.
[0084] As Figure 6As shown, the electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., communicatively connected to the at least one processor 11, where the memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer programs stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0085] Various components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, a speaker, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0086] The processor 11 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the data storage method for embedded systems.
[0087] In some embodiments, the data storage method for embedded systems can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the data storage method for embedded systems described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the data storage method for embedded systems by any other appropriate means, such as by means of firmware.
[0088] The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a load programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0089] Computer programs used to implement the processes of the application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer program, when executed, can cause instructions defined in the flow charts and / or block diagrams to be implemented. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as a standalone software package and partially on a remote machine or entirely on a remote machine or server.
[0090] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store computer programs for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable storage media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0091] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0092] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0093] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server is generally established using computer programs running on the respective computers and having a client-server relationship. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.
[0094] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be executed in parallel, executed in sequence, or executed in a different order, as long as the desired results of the technical solutions of the present disclosure are achieved, and the present disclosure is not limited herein.
[0095] The above detailed description does not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A data storage method applied to an embedded system, characterized in that, The method comprises the following steps: acquiring to-be-applied instruction information, and determining whether the to-be-applied instruction information matches preset instruction information; if the to-be-applied instruction information matches the preset instruction information, determining a target storage container corresponding to the to-be-applied instruction information, and acquiring data capacity information and a current data capacity corresponding to the target storage container; wherein the target storage container comprises a valve stack which is set in advance; the valve stack comprises a push-in counter, a push-out counter and a valve; the push-out counter is used for data export of the valve stack; determining a data storage mode based on the data capacity information and the current data capacity, and performing data storage based on the data storage mode.
2. The method of claim 1, wherein, The step of determining whether the to-be-applied instruction information matches the preset instruction information comprises the following steps: acquiring instruction type information of the to-be-applied instruction information; wherein the instruction type information comprises at least one of a data storage type, a data export type and a data zeroing type; determining whether the to-be-applied instruction information matches the preset instruction information based on the instruction type information.
3. The method of claim 1, wherein, The step of acquiring the data capacity information and the current data capacity corresponding to the target storage container comprises the following steps: acquiring data capacity information of the target storage container; wherein the data capacity information is a data storage quantity which is set in advance; determining the current data capacity corresponding to the target storage container based on the push-in counter of the target storage container.
4. The method of claim 1, wherein, The step of determining the corresponding data storage mode based on the data capacity information and the current data capacity, and performing data storage based on the data storage mode comprises the following steps: if the current data capacity is less than the data capacity information, determining that the data storage mode is direct storage; acquiring to-be-stored data corresponding to the to-be-applied instruction information, storing the to-be-stored data directly into the target storage container, and updating the current data capacity.
5. The method of claim 1, wherein, The step of determining the corresponding data storage mode based on the data capacity information and the current data capacity, and performing data storage based on the data storage mode comprises the following steps: if the current data capacity is greater than or equal to the data capacity information, determining that the data storage mode is shift storage; deleting historical data at the bottom of the target storage container, and shifting the remaining data information in the target storage container to the bottom of the container in turn; acquiring to-be-stored data corresponding to the to-be-applied instruction information, and storing the to-be-stored data into the target storage container.
6. The method of claim 1, wherein, The method further comprises the following steps: if the to-be-applied instruction information is of the data export type, performing a data push-out operation based on the push-out counter, and updating push-out record information of the push-out counter in real time; if historical data in the target storage container has been completely exported, setting the push-out record information of the push-out counter to a preset value.
7. The method of claim 1, wherein, The method further comprises the following steps: if the to-be-applied instruction information is of the data zeroing type, acquiring push-in record information and push-out record information of the target storage container; setting the push-in record information and the push-out record information to preset values to empty the data in the target storage container.
8. A data storage device for use in an embedded system, characterized in that The method comprises the following steps: An instruction confirmation module is configured to acquire to-be-applied instruction information and determine whether the to-be-applied instruction information matches preset instruction information. An information acquisition module is configured to, if the to-be-applied instruction information matches the preset instruction information, determine a target storage container corresponding to the to-be-applied instruction information, and acquire data capacity information and a current data capacity corresponding to the target storage container. The target storage container includes a valve stack that is preset. The valve stack includes a push-down counter, a pop-down counter, and a valve. The pop-down counter is configured to export data from the valve stack. A data storage module is configured to determine a data storage mode based on the data capacity information and the current data capacity, and perform data storage based on the data storage mode.
9. An electronic device, comprising: The electronic device includes: one or more processors; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to perform the data storage method for an embedded system according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for enabling the processor to perform the data storage method for an embedded system according to any one of claims 1-7 when the processor executes the computer instructions.
Citation Information
Patent Citations
USB equipment monitoring method and device, equipment and storage medium
CN113934589A