CN109032962B - Data storage method and device and embedded system - Google Patents

Data storage method and device and embedded system Download PDF

Info

Publication number
CN109032962B
CN109032962B CN201810763095.0A CN201810763095A CN109032962B CN 109032962 B CN109032962 B CN 109032962B CN 201810763095 A CN201810763095 A CN 201810763095A CN 109032962 B CN109032962 B CN 109032962B
Authority
CN
China
Prior art keywords
data
stored
storage
block
data block
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810763095.0A
Other languages
Chinese (zh)
Other versions
CN109032962A (en
Inventor
黄成伟
邱其文
刘晓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Autoroad Tech Co ltd
Original Assignee
Beijing Autoroad Tech Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Autoroad Tech Co ltd filed Critical Beijing Autoroad Tech Co ltd
Priority to CN201810763095.0A priority Critical patent/CN109032962B/en
Publication of CN109032962A publication Critical patent/CN109032962A/en
Application granted granted Critical
Publication of CN109032962B publication Critical patent/CN109032962B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory

Abstract

The invention provides a data storage method, a device and an embedded system, which firstly receive data to be stored; then storing the data to be stored into a specified data block in the storage resource according to the frame number of the data to be stored; wherein the storage resource comprises at least two data blocks; each data block is divided into storage intervals matched with the number of the current data blocks in advance; each data block has a designated storage interval for simultaneously storing data to be stored in the same data segment; in the data segments except the data segment initially stored in the storage resource with the set length, the data to be stored with adjacent frame numbers are respectively stored in different data blocks. In the method, the data in the continuous data segment is stored in different data blocks of the storage resource in a scattered manner, and when partial data blocks in the storage resource are damaged, at least part of the stored data in the data segment can still be read out, so that the reliability of data storage is improved.

Description

Data storage method and device and embedded system
Technical Field
The present invention relates to the field of data storage technologies, and in particular, to a data storage method, an apparatus, and a server.
Background
FLASH memory FLASH is widely applied in the field of storage as a storage medium. FLASH is divided into a plurality of data BLOCKs on the physical structure, and the BLOCKs are independent; FLASH also has the following characteristics: the erasing life is limited by times; the erasing time of the data block is longer; during the use process, some data blocks may be damaged, and once the data blocks are damaged, the data blocks cannot be repaired.
When FLASH is used for storing data in an embedded system, one or more BLOCKs are generally used for sequentially and circularly erasing and writing, so that the data is stored; however, in this storage method, once the BLOCK is damaged, the data stored in the damaged BLOCK will be completely lost, resulting in low reliability of data storage.
Disclosure of Invention
In view of the above, the present invention provides a data storage method, an apparatus and an embedded system to improve reliability of data storage.
In a first aspect, an embodiment of the present invention provides a data storage method, where the method includes: receiving data to be stored; storing the data to be stored into a specified data block in a storage resource according to the frame number of the data to be stored; wherein the storage resource comprises at least two data blocks; each data block is divided into storage intervals matched with the number of the current data blocks in advance; each data block has a designated storage interval for simultaneously storing data to be stored in the same data segment; the data segment comprises a plurality of data to be stored with continuous frame numbers; and storing the data to be stored with adjacent frame numbers in different data blocks in the data segments except the data segment with the set length initially stored in the storage resource.
Further, the method further comprises: setting the storage sequence of the data blocks in the storage resources; when storing data to be stored with frame numbers from 1 st frame to N/N th frame into the storage resource, storing the data to be stored into a first storage interval of a first data block; wherein n is the number of data blocks contained in the storage resource; n is the total number of data frames that can be held per data block.
Further, the method further comprises: when the first storage interval of the first data block is full, the second storage interval of the first data block and the first storage interval of the second data block simultaneously store data to be stored in the same data segment; if the storage resource comprises more than three data blocks, when the first k storage intervals of the current data block x are full, the k +1 storage interval of the current data block x, the k storage interval of the data block x +1 and the k-1 storage interval of the data block x +2 simultaneously store data to be stored in the same data segment; wherein x is less than or equal to N, k is greater than or equal to 2, and k is less than or equal to N.
Further, the method further comprises: and when the data to be stored in the same data segment is stored, determining the data block into which the data to be stored is stored according to the frame number of the data to be stored and the storage sequence of the data block in the storage resource.
Further, the method further comprises: after the data to be stored is written in, reading the data to be stored to obtain read data; judging whether the read data is consistent with the written data to be stored; if not, writing the data to be stored again; and if the writing times of the data to be stored reach a set time threshold value, the read data is still inconsistent with the written data to be stored, and an error signal is output.
In a second aspect, an embodiment of the present invention further provides a data storage apparatus, including: the receiving module is used for receiving data to be stored; the data storage module is used for storing the data to be stored into a specified data block in storage resources according to the frame number of the data to be stored; wherein the storage resource comprises at least two data blocks; each data block is divided into storage intervals matched with the number of the current data blocks in advance; each data block has a designated storage interval for simultaneously storing data to be stored in the same data segment; the data segment comprises a plurality of data to be stored with continuous frame numbers; and storing the data to be stored with adjacent frame numbers in different data blocks in the data segments except the data segment with the set length initially stored in the storage resource.
Further, the above apparatus further comprises: the storage sequence setting module is used for setting the storage sequence of the data blocks in the storage resources; when storing data to be stored with frame numbers from 1 st frame to N/N th frame into the storage resource, storing the data to be stored into a first storage interval of a first data block; wherein n is the number of data blocks contained in the storage resource; n is the total number of data frames that can be held per data block.
Further, the above apparatus further comprises: a storage sequence selection module, configured to store data to be stored in the same data segment simultaneously in a second storage interval of the first data block and a first storage interval of a second data block when a first storage interval of the first data block is full; if the storage resource comprises more than three data blocks, when the first k storage intervals of the current data block x are full, the k +1 storage interval of the current data block x, the k storage interval of the data block x +1 and the k-1 storage interval of the data block x +2 simultaneously store data to be stored in the same data segment; wherein x is less than or equal to N, k is greater than or equal to 2, and k is less than or equal to N.
Further, the apparatus further includes a data block determining module, configured to determine, when storing data to be stored in the same data segment, a data block into which the data to be stored is stored according to the frame number of the data to be stored and the storage sequence of the data block in the storage resource.
In a third aspect, an embodiment of the present invention provides an embedded system, where the system includes a data acquisition device, a processor, and a storage device; the data acquisition device is used for acquiring data to be stored; the storage means has stored thereon a computer program which, when executed by the processor, performs the method of the first aspect.
The embodiment of the invention has the following beneficial effects:
the embodiment of the invention provides a data storage method, a data storage device and an embedded system, and the method comprises the steps of firstly receiving data to be stored; then storing the data to be stored into a specified data block in the storage resource according to the frame number of the data to be stored; wherein the storage resource comprises at least two data blocks; each data block is divided into storage intervals matched with the number of the current data blocks in advance; each data block has a designated storage interval for simultaneously storing data to be stored in the same data segment; in the data segments except the data segment initially stored in the storage resource with the set length, the data to be stored with adjacent frame numbers are respectively stored in different data blocks. In the method, the data in the continuous data segment is stored in different data blocks of the storage resource in a scattered manner, and when partial data blocks in the storage resource are damaged, at least part of the stored data in the data segment can still be read out, so that the reliability of data storage is improved.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the invention as set forth above.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of a data storage method according to an embodiment of the present invention;
FIG. 2 is a flow chart of another data storage method according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a data storage structure in the case of five data blocks according to an embodiment of the present invention;
FIG. 4 is a flow chart of another data storage method according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating a storage form of a diagnostic data frame in a data block after a first storage cycle is completed according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating a storage format of a diagnostic data frame in a data block after a second storage cycle is completed according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a data storage device according to an embodiment of the present invention.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In view of the fact that the reliability of data storage is low due to the fact that stored data of a data block is completely lost after the data block is damaged in the existing storage mode, embodiments of the present invention provide a data storage method, an apparatus, and an embedded system. For the convenience of understanding the embodiment, a detailed description will be given to a data storage method disclosed in the embodiment of the present invention.
Referring to FIG. 1, a flow chart of a data storage method is shown; the method comprises the following steps:
step S102, receiving data to be stored;
the data to be stored can be audio data, radar diagnosis data or other data; the data to be stored can be received by a receiving module or a sensing device of an embedded system or other systems; when the embedded system adopts FLASH to store data, the FLASH data block is always in a state to be received, and when the data needs to be stored, the data block can receive the data.
And step S104, storing the data to be stored into a specified data block in the storage resource according to the frame number of the data to be stored.
Wherein the storage resource comprises at least two data blocks; each data block is divided into storage intervals matched with the number of the current data blocks in advance; each data block has a designated storage interval for simultaneously storing data to be stored in the same data segment; the data segment comprises a plurality of data to be stored with continuous frame numbers; in the data segments except the data segment initially stored in the storage resource with the set length, the data to be stored with adjacent frame numbers are respectively stored in different data blocks.
Specifically, each data frame of the data to be stored has a unique data frame number corresponding to the frame number, and the data frame is stored in the specified storage interval of the specified data block according to the frame number.
The storage resource has two or more data blocks, and each data block is divided into a plurality of storage sections according to the number of the data blocks. For example, if there are three data blocks, then there are three storage intervals for each data block; besides the first data block, before each data block starts to store data, the data is written only after the previous data block is written in a storage interval; when the first storage interval of the first data block is full, writing data into the second storage interval of the first data block and the first storage interval of the second data block at the same time; when the first storage interval of the second data block is full, writing data into the third storage interval of the first data block, the second storage interval of the second data block and the first storage interval of the third storage interval simultaneously; after the first data block finishes writing data, erasing the data, and continuously and circularly writing the data until the data to be stored are completely stored, in order to avoid that all the data are lost due to erasing the original stored data when the data are rewritten in the data block, a certain time interval needs to be kept when the data are written in the two data blocks for the first time, that is, a certain time interval exists between erasing operations.
In the storage interval of the data blocks, only when the storage is started, the data frame numbers stored in the first storage interval of the first data block are adjacent; in all other storage intervals, the data frame numbers are not adjacent, so that a certain amount of latest storage data can be read at any time, and when an individual FLASH data block is damaged, a certain amount of storage data can still be read from other data blocks, thereby improving the reliability of data storage.
The data in the continuous data segment is stored in different data blocks of the storage resource in a scattered manner, and when partial data blocks in the storage resource are damaged, at least part of the stored data in the data segment can still be read out, so that the reliability of data storage can be improved.
The data storage method provided by the embodiment of the invention comprises the steps of firstly receiving data to be stored; then storing the data to be stored into a specified data block in the storage resource according to the frame number of the data to be stored; wherein the storage resource comprises at least two data blocks; each data block is divided into storage intervals matched with the number of the current data blocks in advance; each data block has a designated storage interval for simultaneously storing data to be stored in the same data segment; in the data segments except the data segment initially stored in the storage resource with the set length, the data to be stored with adjacent frame numbers are respectively stored in different data blocks. In the method, the data in the continuous data segment is stored in different data blocks of the storage resource in a scattered manner, and when partial data blocks in the storage resource are damaged, at least part of the stored data in the data segment can still be read out, so that the reliability of data storage is improved.
The embodiment of the invention also provides another data storage method, which is implemented on the basis of the method shown in the above fig. 1; as shown in fig. 2, the method comprises the steps of:
step S202, setting the storage sequence of the data blocks in the storage resource;
the storage resource comprises more than two data blocks, the storage sequence of data in each data block is fixed, when the storage is started, the next data block is stored after the previous data block stores a certain data frame, and the data frames to be stored are sequentially stored in turn among the data blocks which are stored in the beginning within the time of waiting for the storage to be started; after all the data blocks start to be stored, the data frames store data among all the data blocks which start to be stored in turn.
Step S204, when storing the data to be stored with the frame numbers from the 1 st frame to the N/N th frame into the storage resource, storing the data to be stored into a first storage interval of a first data block; wherein n is the number of data blocks contained in the storage resource; n is the total number of data frames which can be stored in each data block;
when the storage resource comprises N data blocks, each data block is divided into N storage intervals, each storage interval can store N/N data frames, and when data are stored at the beginning, the data frames with the frame numbers from 1 to N/N in the data frames to be stored are sequentially stored into the first storage interval of the first data block.
Step S206, when the first storage interval of the first data block is full, the second storage interval of the first data block and the first storage interval of the second data block simultaneously store the data to be stored in the same data segment;
step S208, if the storage resource includes more than three data blocks, when the first k storage intervals of the current data block x are full, the k +1 storage interval of the current data block x, the k storage interval of the data block x +1, and the k-1 storage interval of the data block x +2 simultaneously store the data to be stored in the same data segment; wherein x is less than or equal to N, k is greater than or equal to 2, and k is less than or equal to N.
Assuming that there are five data blocks in the storage resource, each data block is divided into five storage intervals, as shown in fig. 3, a schematic diagram of a data storage structure under the five data blocks is shown. When the first storage interval of the first data block is full, the second storage interval of the first data block and the first storage interval of the second data block simultaneously store data to be stored in the same data segment; when the first storage interval of the second data block is full, the third storage interval of the first data block, the second storage interval of the second data block and the first storage interval of the third storage interval simultaneously store the data to be stored in the same data segment; and when the first storage interval of the third data block is full, simultaneously storing the data to be stored in the same data segment in the fourth storage interval of the first data block, the third storage interval of the second data block, the second storage interval of the third storage interval and the first storage interval of the fourth storage interval.
When the first storage interval of the fourth data block is full, the fifth storage interval of the first data block, the fourth storage interval of the second data block, the third storage interval of the third storage interval, the second storage interval of the fourth storage interval and the first storage interval of the fifth storage interval simultaneously store data to be stored in the same data segment, and at the moment, the first data block is full of data, the data is erased, and the data is continuously and circularly written; when the first storage interval of the fifth data block is full, the fifth storage interval of the second data block, the fourth storage interval of the third storage interval, the third storage interval of the fourth storage interval, the second storage interval of the fifth storage interval and the first storage interval of the first data block simultaneously store data to be stored in the same data segment, at this time, the second data block is full of data, the data is erased, and the data is continuously and circularly written until the data to be stored are completely stored.
And when the data to be stored in the same data segment is stored, determining the data block into which the data to be stored is stored according to the frame number of the data to be stored and the storage sequence of the data block in the storage resource.
The frame number of the data to be stored and the storage sequence of the storage resources determine the storage position of the data to be stored, and under the condition of the five data blocks, the data frame with the frame number of 1 to N/5 is stored in the first storage interval of the first data block; the data frames with the frame numbers of N/5+1 to 3N/5 are respectively stored in a second storage interval of the first data block and a first storage interval of the second data block; and respectively storing the data frames with the frame numbers of 3 × N/5+1 to N + N/5 into a third storage interval of the first data block, a second storage interval of the second data block and a first storage interval of the third data block, and so on until all data are stored into the data blocks. The method can store the data in a staggered and alternate way, when the data block is read and written normally, a certain amount of latest stored data can be read at any time, and when individual data block is damaged, a certain amount of latest stored data can still be read.
In order to better understand the data storage method, a specific application scenario is described in this embodiment; in this embodiment, two data blocks, specifically data blocks in FLASH, and data to be stored are taken as an example for explanation.
The diagnosis data of the automotive millimeter wave radar has important significance for judging the working state and detecting faults of the millimeter wave radar, and a nonvolatile memory in the radar can store a certain amount of data at any stage of the life cycle of the radar, so that the latest running state data of the radar is provided.
The millimeter wave radar of the automobile is an application field of an embedded system, hardware resources of the millimeter wave radar are extremely precious, more storage resources cannot be provided for diagnosis information, the radar diagnosis data can be stored by using a smaller storage resource for achieving the purpose of continuously and reliably storing the radar diagnosis data, and the data storage method provided by the embodiment of the invention can be used for storing the radar diagnosis data.
Firstly, selecting two FLASH BLOCKs (equivalent to the data BLOCKs) with the same capacity, numbering the data frames which need to be stored by the radar each time, and starting from 1; assuming that two FLASH BLOCKs are BLOCK a and BLOCK B, respectively, each BLOCK can store diagnostic data (corresponding to the data to be stored) in N frames (N is an even number).
Referring to fig. 4, a flow chart of another data storage method is shown, and the method includes the following specific steps:
step S402, waiting for input of diagnostic data;
step S404, judging whether the diagnostic data frame is less than or equal to half (N/2) of the number of the diagnostic data frames which can be stored in the data block, if the condition is satisfied, executing step S408, and if not, executing step S406;
in the first storage cycle, when the frame number of a radar diagnosis data frame is less than or equal to N/2, the diagnosis data are stored in BLOCK A, and when the frame number of the radar diagnosis data frame is greater than N/2, the diagnosis data are respectively stored in BLOCK A and BLOCK B according to the difference of the frame numbers;
step S406, determining whether the data frame number is an odd number, if so, performing step S408, and if not, performing step S410;
step S408, setting a data storage BLOCK A mark;
step S410, setting a data storage BLOCK B mark;
under the condition that the frame number of the diagnosis data frame is more than N/2, when the frame number of the diagnosis data frame is an odd number, the data frames are sequentially stored in BLOCK A, and when the frame number of the data frame is an even number, the data frames are sequentially stored in BLOCK B, at this time, the first storage cycle is completed, and the storage form of the diagnosis data frame in the data BLOCK is shown in figure 4.
Step S412, according to the set flag, judging whether the BLOCK to be stored in the data is full of data, if so, performing step S414, otherwise, performing step S416;
step S414, erasing the BLOCK data;
step S416, writing diagnosis data;
when the BLOCK a is full of data, the BLOCK B uses just half of the storage space, at this time, the data of the BLOCK ka is erased, a certain time interval exists between erasing the data and writing the data, and the time interval can be the time for storing N/2 data frames; after BLOCK a data is erased, a second cycle is performed, BLOCK B continues to store data in the first cycle until the data is written, and then the data BLOCK is erased, at this time, BLOCK B starts the second cycle, and fig. 5 shows a storage form of the diagnostic data frame in the data BLOCK after BLOCK a and BLOCK B complete the second cycle.
The data storage form after each data storage cycle is similar to that of fig. 5, except that the frame number of each cycle is increased by 2N on the basis of the previous cycle.
Step S418, reading the diagnostic data to obtain read data;
step S420, judging whether the read data is consistent with the written data; if yes, the data to be stored is written again, and step S402 is executed; if not, go to step S422;
and after all the data frames are stored in the data block, reading the diagnostic data, comparing the read diagnostic data with the written diagnostic data, if the read diagnostic data is consistent with the written diagnostic data, returning to the step S402, waiting for inputting the written data to be diagnosed again, and if the read diagnostic data is inconsistent with the written data, explaining errors occurring when the data are written and needing to be checked again.
Step S422, determining whether the number of times of writing the diagnostic data reaches a set number threshold, if not, performing step S416, if so, the read data and the written data to be stored are still inconsistent, and outputting an error signal.
When the read data is inconsistent with the written data, the diagnostic data is written again, if the set time threshold (for example, three times) is reached and the read data is still inconsistent with the written data to be stored, an error signal is output to remind a user that an error occurs in data storage, and the whole process is ended.
Corresponding to the above method embodiment, refer to a schematic structural diagram of a data storage device shown in fig. 7; the device includes:
a receiving module 70, configured to receive data to be stored;
a data storage module 71, configured to store the data to be stored in a specified data block in a storage resource according to the frame number of the data to be stored; wherein the storage resource comprises at least two data blocks; each data block is divided into storage intervals matched with the number of the current data blocks in advance; each data block has a designated storage interval for simultaneously storing data to be stored in the same data segment; the data segment comprises a plurality of data to be stored with continuous frame numbers; in the data segments except the data segment initially stored in the storage resource with the set length, the data to be stored with adjacent frame numbers are respectively stored in different data blocks.
The above-mentioned device still includes: a storage sequence setting module, configured to set a storage sequence of the data blocks in the storage resource; when storing data to be stored with frame numbers from 1 st frame to N/N th frame into the storage resource, storing the data to be stored into a first storage interval of a first data block; wherein n is the number of data blocks contained in the storage resource; n is the total number of data frames that can be held per data block.
The above-mentioned device still includes: a storage sequence selection module, configured to, when the first storage interval of the first data block is full, store data to be stored in the same data segment simultaneously in a second storage interval of the first data block and a first storage interval of a second data block;
if the storage resource comprises more than three data blocks, when the first k storage intervals of the current data block x are full, the k +1 storage interval of the current data block x, the k storage interval of the data block x +1 and the k-1 storage interval of the data block x +2 simultaneously store data to be stored in the same data segment; wherein x is less than or equal to N, k is greater than or equal to 2, and k is less than or equal to N.
The device also comprises a data block determining module, which is used for determining the data block stored in the data to be stored according to the frame number of the data to be stored and the storage sequence of the data block in the storage resource when the data to be stored in the same data segment is stored.
The data storage device provided by the embodiment of the invention has the same technical characteristics as the data storage method provided by the embodiment, so that the same technical problems can be solved, and the same technical effects can be achieved.
The embodiment also provides an embedded system corresponding to the method embodiment, and the system comprises a data acquisition device, a processor and a storage device; the data acquisition device is used for acquiring data to be stored; the storage device has a computer program stored thereon, and the computer program, when executed by the processor, performs a method of data storage provided by the above embodiments.
The embodiment of the invention provides a data storage method, a device and an embedded system, which are characterized in that the data storage method and the device are stored in a staggered way and alternately, when FLASH data BLOCKs are read and written normally, a certain amount of recently stored data can be read at any time, when individual FLASH BLOCKs are damaged, a certain amount of recently stored data can still be read, and the minimum data quantity which can be read under the two conditions is related to the used FLASH BLOCK quantity and the data frame quantity which can be stored in each BLOCK. The technology improves the reliability and flexibility of data storage.
The data storage method, the data storage device, and the computer program product of the embedded system provided in the embodiments of the present invention include a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute the method described in the foregoing method embodiments, and specific implementation may refer to the method embodiments, and will not be described herein again.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (6)

1. A method of data storage, the method comprising:
receiving data to be stored;
storing the data to be stored into a specified data block in a storage resource according to the frame number of the data to be stored;
wherein the storage resource comprises at least two data blocks; each data block is divided into storage intervals matched with the number of the current data blocks in advance; each data block has a designated storage interval for simultaneously storing data to be stored in the same data segment; the data segment comprises a plurality of data to be stored with continuous frame numbers; the data to be stored with adjacent frame numbers are respectively stored in different data blocks except the data segment with the set length initially stored in the storage resource;
the method further comprises the following steps: setting the storage sequence of the data blocks in the storage resources; when storing data to be stored with frame numbers from 1 st frame to N/N th frame into the storage resource, storing the data to be stored into a first storage interval of a first data block; wherein n is the number of data blocks contained in the storage resource; n is the total number of data frames which can be stored in each data block;
the method further comprises the following steps: when the first storage interval of the first data block is full, the second storage interval of the first data block and the first storage interval of the second data block simultaneously store data to be stored in the same data segment; if the storage resource comprises more than three data blocks, when the first k storage intervals of the current data block x are full, the (k + 1) th storage interval of the current data block x, the (k) th storage interval of the data block x +1 and the (k-1) th storage interval of the data block x +2 simultaneously store data to be stored in the same data segment; wherein x is less than or equal to N, k is greater than or equal to 2, and k is less than or equal to N.
2. The method of claim 1, further comprising: and when the data to be stored in the same data segment is stored, determining the data block in which the data to be stored is stored according to the frame number of the data to be stored and the storage sequence of the data blocks in the storage resource.
3. The method of claim 1, further comprising:
after the data to be stored is written in, reading the data to be stored to obtain read data;
judging whether the read data is consistent with the written data to be stored;
if not, writing the data to be stored again;
and if the writing times of the data to be stored reach a set time threshold value, the read data is still inconsistent with the written data to be stored, and an error signal is output.
4. A data storage device, characterized in that the device comprises:
the receiving module is used for receiving data to be stored;
the data storage module is used for storing the data to be stored into a specified data block in storage resources according to the frame number of the data to be stored; wherein the storage resource comprises at least two data blocks; each data block is divided into storage intervals matched with the number of the current data blocks in advance; each data block has a designated storage interval for simultaneously storing data to be stored in the same data segment; the data segment comprises a plurality of data to be stored with continuous frame numbers; the data to be stored with adjacent frame numbers are respectively stored in different data blocks except the data segment with the set length initially stored in the storage resource;
the device further comprises: the storage sequence setting module is used for setting the storage sequence of the data blocks in the storage resources; when storing data to be stored with frame numbers from 1 st frame to N/N th frame into the storage resource, storing the data to be stored into a first storage interval of a first data block; wherein n is the number of data blocks contained in the storage resource; n is the total number of data frames which can be stored in each data block;
the device further comprises: a storage sequence selection module, configured to store data to be stored in the same data segment simultaneously in a second storage interval of the first data block and a first storage interval of a second data block when the first storage interval of the first data block is full; if the storage resource comprises more than three data blocks, when the first k storage intervals of the current data block x are full, the (k + 1) th storage interval of the current data block x, the (k) th storage interval of the data block x +1 and the (k-1) th storage interval of the data block x +2 simultaneously store data to be stored in the same data segment; wherein x is less than or equal to N, k is greater than or equal to 2, and k is less than or equal to N.
5. The apparatus according to claim 4, further comprising a data block determining module, configured to determine, when storing data to be stored in the same data segment, a data block into which the data to be stored is stored according to a frame number of the data to be stored and a storage sequence of the data blocks in the storage resource.
6. An embedded system, characterized in that the system comprises a data acquisition device, a processor and a storage device;
the data acquisition device is used for acquiring data to be stored;
the storage device has stored thereon a computer program which, when executed by the processor, performs the method of any of claims 1 to 3.
CN201810763095.0A 2018-07-12 2018-07-12 Data storage method and device and embedded system Active CN109032962B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810763095.0A CN109032962B (en) 2018-07-12 2018-07-12 Data storage method and device and embedded system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810763095.0A CN109032962B (en) 2018-07-12 2018-07-12 Data storage method and device and embedded system

Publications (2)

Publication Number Publication Date
CN109032962A CN109032962A (en) 2018-12-18
CN109032962B true CN109032962B (en) 2021-07-30

Family

ID=64640608

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810763095.0A Active CN109032962B (en) 2018-07-12 2018-07-12 Data storage method and device and embedded system

Country Status (1)

Country Link
CN (1) CN109032962B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110263554A (en) * 2019-05-14 2019-09-20 深圳市亿联智能有限公司 A kind of low computing capability equipment storage encryption method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6469703B1 (en) * 1999-07-02 2002-10-22 Ati International Srl System of accessing data in a graphics system and method thereof
CN101350217A (en) * 2007-07-17 2009-01-21 普诚科技股份有限公司 Apparatus and method for writing data into memory
CN102404652A (en) * 2010-09-10 2012-04-04 高通创锐讯通讯科技(上海)有限公司 Double data rate (DDR) buffer Ethernet network package method for optical line terminal (OLT) or optical network unit (ONU) chip in Ethernet passive optical network (EPON)
CN103294615A (en) * 2012-02-24 2013-09-11 北京四达时代软件技术股份有限公司 Method for storing user information of set top box
CN104765693A (en) * 2014-01-06 2015-07-08 国际商业机器公司 Data storage method, device and system

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101304528B (en) * 2008-06-10 2010-11-17 浙江大学 Method for mapping video processor video data and memory space
WO2010014696A1 (en) * 2008-07-29 2010-02-04 Marvell World Trade, Ltd. Processing rasterized data
TWI498898B (en) * 2013-04-30 2015-09-01 Phison Electronics Corp Data writing method, memory controller and memory storage apparatus
CN104902202B (en) * 2015-05-15 2018-09-21 百度在线网络技术(北京)有限公司 The method and apparatus of video storage
CN106250320B (en) * 2016-07-19 2019-05-24 诸葛晴凤 A kind of memory file system management method of data consistency and abrasion equilibrium
CN106326439B (en) * 2016-08-26 2019-08-23 东方网力科技股份有限公司 A kind of storage of real-time video, search method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6469703B1 (en) * 1999-07-02 2002-10-22 Ati International Srl System of accessing data in a graphics system and method thereof
CN101350217A (en) * 2007-07-17 2009-01-21 普诚科技股份有限公司 Apparatus and method for writing data into memory
CN102404652A (en) * 2010-09-10 2012-04-04 高通创锐讯通讯科技(上海)有限公司 Double data rate (DDR) buffer Ethernet network package method for optical line terminal (OLT) or optical network unit (ONU) chip in Ethernet passive optical network (EPON)
CN103294615A (en) * 2012-02-24 2013-09-11 北京四达时代软件技术股份有限公司 Method for storing user information of set top box
CN104765693A (en) * 2014-01-06 2015-07-08 国际商业机器公司 Data storage method, device and system

Also Published As

Publication number Publication date
CN109032962A (en) 2018-12-18

Similar Documents

Publication Publication Date Title
CN110442473B (en) Nonvolatile data storage method and device, electronic equipment and medium
US7971114B2 (en) Method for testing a memory device
CN101571827A (en) Method for saving logs and log system
CN111192620B (en) Method for optimizing NAND Flash read reference voltage in SSD
CN114047887B (en) Method, device and medium for improving success rate of data reading
CN111176885A (en) Data verification method and related device for distributed storage system
CN109032962B (en) Data storage method and device and embedded system
CN104658609B (en) The method and system that error correcting code for storage system is distributed
CN112331249B (en) Method, device, terminal equipment and storage medium for predicting service life of storage device
JP6306548B2 (en) Memory management circuit, storage device, memory management method, and memory management program
CN110442474B (en) Data consistency verification method, system and data verification terminal
CN112256462B (en) Service life prediction method, device and medium of NAND Flash memory
CN108108467B (en) Data deleting method and device
CN112559229B (en) Nonvolatile memory life detection method and device, electronic equipment and storage medium
US20150268877A1 (en) Systems and methods for recording data in a memory
CN111309475B (en) Detection task execution method and equipment
CN109358815B (en) NAND flash memory data management method and device
CN112578772A (en) Data processing method of electronic control unit and related device
CN111782141A (en) Data inspection method and device
CN110673788A (en) Data reading method, device and equipment of solid state disk and readable storage medium
CN113553009B (en) Data reading method, data writing method and data reading and writing method
CN110362534B (en) Snapshot verification method and system, electronic equipment and storage medium
CN112466385B (en) Method, system, equipment and medium for testing shallow erasure of flash memory
CN111240580B (en) Data migration method and device
CN116610269B (en) Data storage method, device, storage medium and controller

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant