CN105320614B - A kind of storage processing method and device of protection usage data - Google Patents
A kind of storage processing method and device of protection usage data Download PDFInfo
- Publication number
- CN105320614B CN105320614B CN201410363256.9A CN201410363256A CN105320614B CN 105320614 B CN105320614 B CN 105320614B CN 201410363256 A CN201410363256 A CN 201410363256A CN 105320614 B CN105320614 B CN 105320614B
- Authority
- CN
- China
- Prior art keywords
- usage data
- data
- value
- motion control
- control word
- 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
Links
- 238000003860 storage Methods 0.000 title claims abstract description 91
- 238000003672 processing method Methods 0.000 title claims abstract description 12
- 238000000034 method Methods 0.000 claims abstract description 71
- 238000011084 recovery Methods 0.000 claims abstract description 22
- 238000013500 data storage Methods 0.000 claims description 27
- 238000012795 verification Methods 0.000 claims description 13
- 238000012937 correction Methods 0.000 claims description 11
- 238000001514 detection method Methods 0.000 claims description 3
- 238000012545 processing Methods 0.000 claims description 3
- 235000013399 edible fruits Nutrition 0.000 claims 1
- 230000003139 buffering effect Effects 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 4
- 241001269238 Data Species 0.000 description 3
- 230000006378 damage Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000013459 approach Methods 0.000 description 2
- 238000013524 data verification Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000014759 maintenance of location Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 230000009225 memory damage Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 238000004321 preservation Methods 0.000 description 1
- 238000010200 validation analysis Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Landscapes
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
The invention discloses a kind of storage processing methods and device of protection usage data, wherein this method includes:When storing usage data to memory block, to store each flow setting step motion control word of usage data;When restoring usage data to buffer area, step motion control word is read, and judge whether the process that usage data is stored in memory block has interruption according to the step motion control word of reading, restore usage data further according to the result of judgement.Present invention is mainly used for be convenient for recovery of stored data when storage is interrupted.
Description
Technical field
The present invention relates to data meter technical field, more particularly to a kind of the storage processing method and dress of protection usage data
It sets.
Background technology
Intelligent electronic metering (such as water meter, ammeter and gas meter, flow meter) product mostly works in severe unattended operation environment
Under, metering user usage data or acquisition user's usage data, and statistics charging is carried out according to the usage data of storage, therefore,
Reliable and accurate metering or acquisition usage data are more paid attention to by user.
Intelligent electronic measuring instrument is the reliability and accuracy for the usage data for ensuring acquisition, has put into a large amount of people
Power material resources are studied, and need to put into great cost only according to hardware measure realization, and can not prevent all impulsive disturbance situations,
And only anti-interference also the same the case where there are loss of data is carried out with more Backup Datas of software.
To ensure usage data or acquisition usage data reliability and accuracy, the prior art uses such as " to be taken in three
Two ", the data storage means such as " three are taken in five ", " voting by a show of hands ";However often data are in reading or storage by the external world
Interference, such as:Power surges, magnetic field, electrostatic, power down etc. are influenced and are destroyed.It is attacked or is interfered when Refresh Data stores
When destruction, when using the Backup Data approach of error correction that the minority is subordinate to the majority, it will lose effective new data.Give charge user band
Huge economic loss is carried out.
It follows that the storage scheme to usage data provided in the prior art at least has the disadvantage that:
1, using the minority is subordinate to the majority, means easily lose new brush by multiple Backup Data error correction in Refresh Data
New data causes to acquire usage data to be according to the economic loss for carrying out statistics charge;
2, using the Backup Data error correction method that the minority is subordinate to the majority when design of electronic products is researched and developed, single-chip microprocessor MCU money
Source occupies larger, storage unit increase, hsrdware requirements increasing so that product cost rises;
3, the read-write process time of a large amount of Backup Datas lengthens, and increases the probability that external interference is destroyed.
Invention content
In order to solve, the storage to usage data in the prior art handles existing refresh data easy to be lost, MCU resources account for
With the technical problem that larger, external interference probability is big etc., the present invention propose a kind of protection usage data storage processing method and
Device.
A kind of storage processing method of protection usage data, including:
When storing usage data to memory block, to store each flow setting step motion control word of usage data;
When restoring usage data to buffer area, step motion control word is read, and judge to use according to the step motion control word of reading
Whether the process of amount data deposit memory block has interruption, restores usage data further according to the result of judgement.
Preferably, it to store each flow setting step motion control word of usage data, specifically includes:
When original state, the value of setting step motion control word is first state value;
When starting storage source usage data, the value of setting step motion control word is the second state value;
When the usage data storage verification of source, the value of setting step motion control word is third state value;
When starting the Backup Data of storage source usage data, the value of setting step motion control word is the 4th state value;
When Backup Data verifies, the value of setting step motion control word is the 5th state value.
Preferably, judge whether the process that usage data is stored in memory block has interruption according to the step motion control word of reading, then
Restore usage data according to the result of judgement, specifically includes:
If the value of the step motion control word read is first state value, judge that the process of usage data deposit memory block does not have
There is interruption, restores usage data to buffer area;
If the value for the step motion control word being arranged is not first state value, the process of usage data deposit memory block is judged
There is interruption, and the carry out legitimacy of usage data is handled according to the value of the step motion control word of reading and is arrived to restore usage data
Buffer area.
Preferably, the carry out legitimacy of usage data is handled according to the value of the step motion control word of reading to restore dosage
Data are specifically included to buffer area:
When the value of the step motion control word of reading is the second state value, according to source usage data, Backup Data, source dosage number
According to source data area mark, the Backup Data area mark of Backup Data and the value of minimum resolution determine legal usage data,
And the legal usage data is restored to buffer area;
When the value of the step motion control word of reading is third state value, according to source usage data, Backup Data and minimum point
The value of resolution determines legal usage data, and the legal usage data is restored to buffer area;
When the value of the step motion control word of reading is four state value, it is legal usage data to take source usage data, and
By the source, usage data is restored to buffer area;
When the value of the step motion control word of reading is five state value, source dosage is taken according to the check results to Backup Data
Data or Backup Data are restored to buffer area.
Preferably, this method further includes:
Judge whether the storage region that data are written is legal according to preset write-in frequency threshold value;
If it is determined that the storage region of write-in data is illegal, then the storage region of write-in data is changed.
A kind of storage processing unit of protection usage data, including:
Stepping setup module, for when storing usage data to memory block, each flow to store usage data to be set
Set step motion control word;
Recovery module, for when restoring usage data to buffer area, reading step motion control word, and according to the stepping of reading
Control word judges whether the process of usage data deposit memory block has interruption, restores usage data further according to the result of judgement.
Preferably, stepping setup module, when being specifically used for original state, the value of setting step motion control word is first state
Value;When starting storage source usage data, the value of setting step motion control word is the second state value;When the usage data storage verification of source,
The value that step motion control word is arranged is third state value;When starting the Backup Data of storage source usage data, step motion control word is set
Value be the 4th state value;When Backup Data verifies, the value of setting step motion control word is the 5th state value.
Preferably, recovery module includes:
Initial recovery unit, when the value for the step motion control word in reading is first state value, judgement usage data is deposited
The process for entering memory block is not interrupted, and restores usage data to buffer area;
Error correction recovery unit when the value for the step motion control word in setting is not first state value, judges usage data
The process of deposit memory block has an interruption, and according to the value of the step motion control word of reading to the carry out legitimacy of usage data handle with
Just restore usage data to buffer area.
Preferably, error correction recovery unit is sentenced when the value specifically for the step motion control word in setting is not first state value
The process for determining usage data deposit memory block has an interruption, and when the value of the step motion control word of reading is the second state value, root
According to the source data area mark of source usage data, Backup Data, source usage data, the Backup Data area mark of Backup Data and minimum
The value of resolution ratio determines legal usage data, and the legal usage data is restored to buffer area;When the stepping read
When the value of control word is third state value, legal use is determined according to the value of source usage data, Backup Data and minimum resolution
Data are measured, and the legal usage data is restored to buffer area;It is being the 4th state value when the value of the step motion control word read
When, it is legal usage data to take source usage data, and the source usage data is restored to buffer area;When the stepping control read
When the value of word processed is five state value, source usage data or Backup Data is taken to be restored to according to the check results to Backup Data slow
Deposit area.
Preferably, which further includes:
Storage region detection module, for according to it is preset write-in frequency threshold value judge write-in data storage region whether
It is legal;If it is determined that the storage region of write-in data is illegal, then the storage region of write-in data is changed.
In scheme provided in this embodiment, step motion control is respectively provided with by using to each flow in storage data procedures
The mode record storage flow of word, when to encounter interruption in storage, can it is subsequent can be accurate when restoring usage data
The flow for navigating to storage and interrupting, and restored according to the characteristics of each interruption flow, therefore can intuitively know that data are being deposited
State in which, step in storage operation, acquirement can store step motion control word according to data and carry out error correction and recovery to data, can protect
The technique effect that the usage data that card refreshes is not lost.
Description of the drawings
Attached drawing is used to provide further understanding of the present invention, and a part for constitution instruction, the reality with the present invention
It applies example to be used to explain the present invention together, not be construed as limiting the invention.In the accompanying drawings:
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention without having to pay creative labor, may be used also for those of ordinary skill in the art
With obtain other attached drawings according to these attached drawings.
Fig. 1 is a kind of original block diagram of the storage processing method for protection usage data that the embodiment of the present invention 1 provides;
Fig. 2 is a kind of flow chart of the storage processing method for protection usage data that the embodiment of the present invention 1 provides;
In storage dosage number in a kind of storage processing method for protection usage data that Fig. 3 provides for the embodiment of the present invention 1
Flow chart when according to memory block;
Fig. 4 is a kind of structural schematic diagram of the storage processing unit for protection usage data that the embodiment of the present invention 1 provides.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation describes, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained every other without creative efforts
Embodiment shall fall within the protection scope of the present invention.Also, following embodiment is the alternative of the present invention, embodiment
It puts in order and the number of embodiment is unrelated with the sequence that it preferably is carried out.
Embodiment 1
Method provided in this embodiment is suitble to be deployed on intelligent electronic measuring instrument, microcontroller especially therein
In MCU, as shown in Figure 1, usage data (dosage in the present embodiment of the MCU acquisition dosage metering circuits on the measuring instrument
Data include the data of measuring instrument acquisition and arrangement), when usage data changes, the read-write that MCU opens storage allows,
With the storage processing method of protection usage data provided in this embodiment, new usage data is saved in memory.
To ensure the reliability and accuracy of usage data, the read-write operation of data storage is reduced, data storage is reduced
The probability that device is destroyed, data storage are usually in guard mode or off-position, and usage data update needs only are occurring
Being stored or restored the read-write operation of turn-on data memory when the data that MCU buffering areas are destroyed allows.
Intelligent electronic measuring instrument is interacted in normal work according to protection data and the external world of buffering area,
In, MCU is counted by acquiring the usage data of dosage metering circuit, when minimum resolution or agreement step occur for usage data
(each intelligent electronic measuring instrument has minimum resolution, also referred to as unit stepping-in amount to input, as water meter minimum resolution is
Unit data variation 0.01kWh), when needing to carry out data storage, turn-on data memory read/write allows, and uses step motion control
Method carries out protection operation to the usage data or significant data storage that need to preserve.
A kind of storage processing method of protection usage data provided by the embodiment is detailed below, as shown in Fig. 2, the party
Method includes mainly two stages.
101, when usage data updates, need the usage data storage of update/refreshing (being located at storage to memory block
Device) on when, i.e., when storing usage data to memory block, which includes mainly:Each flow to store usage data is set
Set step motion control word;
102, when needing to be restored to the usage data on the memory block on buffer area (being located at MCU), that is, restoring to use
When measuring data to buffer area, which includes mainly:Step motion control word is read, and dosage is judged according to the step motion control word of reading
Whether the process of data deposit memory block has interruption, restores usage data further according to the result of judgement.
Specifically, can be by step motion control word after the storage for being fully finished usage data in method provided in this embodiment
Value be set as 0, before the source usage data deposit memory block that will refresh, can step motion control word be first set as 1, and often hold
One flow of row all will add 1 to step motion control word.The Stored Procedure of execution is respectively sequentially to start to store source data, source
Data storage verification starts to store Backup Data, Backup Data verification.Correspondingly, in above-mentioned 101 it is storage usage data
Each flow setting step motion control word, specifically includes:
When original state, the value of setting step motion control word is first state value, such as 0;
When starting storage source usage data, the value of setting step motion control word is the second state value, such as 1;
When the usage data storage verification of source, the value of setting step motion control word is third state value;
When starting the Backup Data of storage source usage data, the value of setting step motion control word is the 4th state value;
When Backup Data verifies, the value of setting step motion control word is the 5th state value.
Such as:If rStep_state is step motion control word, then have:
RStep_state=0:Without storage data manipulation;
RStep_state=1:Start to store source data;
RStep_state=2:Source data storage verification;
RStep_state=3:Start to store Backup Data;
RStep_state=4:Backup Data verifies.
So, usage data is stored into the process to memory block in 101 stages, as shown in figure 3, including:
201, original state, i.e. step motion control word rStep_state=0 illustrate that current memory does not carry out data and deposits
Storage operation;
202, step motion control word rStep_state=1 illustrates that measuring instrument occurs usage data and refreshes, initially enters brush
The storage operation of new usage data;Step motion control word state is saved in memory first, and record data storage carries out at present
Step;Initially enter the storage operation for refreshing usage data;
203, step motion control word+1, i.e. rStep_state=2 illustrate that the flow carried out at present is to refreshing usage data
In source data region, whether storage is accurate, reliable, if needs to re-start the operation that write-in preserves;
204, step motion control word+1, i.e. rStep_state=3, the flow carried out at this time are to complete source data region
Source usage data preserve after, source usage data is made a backup store, it is ensured that, can be with can after source data region is destroyed
By accurately restoring usage data, economic loss caused by due to usage data is lost is reduced;
205, step motion control word continues+1, i.e. rStep_state=4, and expression is carrying out Backup Data in Backup Data
It is consistent to preserve verification operation process flow with source usage data for the verification of correctness of region storage operation;
206, after backup data store operation demonstration, step motion control word returns to original state, it was demonstrated that this time brushes
New usage data storage operation completely terminates, and simultaneously closes off memory read/write permission.
In the above method provided in this embodiment due to usage data preserve process controlled by step motion control word, with
When in the arbitrary process of user data storage by external interference accidental interruption, such as program fleet or power down, restoring MCU buffering areas
When data, it can be accurately positioned according to the value of control word rStep_state and interrupt the step of occurring, to take corresponding dosage
Number recovery ways, and the complete operation of storage can be continued to complete.
Specifically, the step motion control word according to reading in 102 judge usage data deposit memory block process whether
There is interruption, restores usage data further according to the result of judgement, specifically include:
If the value of the step motion control word read is first state value, judge that the process of usage data deposit memory block does not have
There is interruption, restores usage data to buffer area;
It is re-powered in intelligent electronic measuring instrument or MCU resets, when the usage data of buffering area needs to restore again,
By reading the value of step motion control word, see whether to take notice of it is outgoing it is current there are data storage operations, if without data manipulation
It is interrupted or interferes, that is, when the value of the step motion control word read is 0, then need to only complete the legitimacy of the usage data in memory
It checks, is restored to MCU buffering areas,
If the value for the step motion control word being arranged is not first state value, the process of usage data deposit memory block is judged
There is interruption, and the carry out legitimacy of usage data is handled according to the value of the step motion control word of reading and is arrived to restore usage data
Buffer area.
That is, the operation stored when stored is interrupted, it can re-execute data according to the value of step motion control word and deposit
Storage operation, and restore the data of buffering area.
Wherein, the value of the above-mentioned step motion control word according to reading is handled the carry out legitimacy of usage data to restore to use
Data are measured to buffer area, are specifically included:
When the value of the step motion control word of reading is the second state value, according to the source usage data, the Backup Data,
The value of the source data area mark of the source usage data, the Backup Data area mark of the Backup Data and minimum resolution determines
Legal usage data, and the legal usage data is restored to the buffer area, specific example can refer to lower 1-4;
When the value of the step motion control word of reading is third state value, according to the source usage data, the Backup Data
Legal usage data is determined with the value of minimum resolution, and the legal usage data is restored to the buffer area, specifically
Example can refer to down 6;
When the value of the step motion control word of reading is four state value, it is legal usage data to take source usage data, and
By the source, usage data is restored to the buffer area, and specific example can refer to down 7;
When the value of the step motion control word of reading is five state value, source dosage is taken according to the check results to Backup Data
Data or Backup Data are restored to the buffer area, and specific example can refer to down 8.
Such as:1, it is just interrupted accidentally i.e. rStep_state=1 in the first step when storage is operated, and need to carry out dosage
When Refresh Data, if it is the prior art, then most identical datas can be selected to be refreshed, to lose new usage data,
And the present embodiment can directly be known according to step motion control status word rStep_state and occur to occur when usage data refreshes storage
It is unexpected, when source usage data differs the value of minimum resolution with Backup Data, then prove that source usage data has been correctly written in
Memory, control flow completion Stored Procedure can be stored according to normal stepping, and (Stored Procedure includes being restored to usage data
Buffer area), to achieve the purpose that refresh data is not lost;
2, source usage data is equal with Backup Data, then source usage data is whole plus being completed again after the value of minimum resolution
A Stored Procedure, it avoids losing and refreshes usage data;
3, when the source usage data in source data area and the Backup Data difference of backup area are used more than minimum resolution, and to source
When the check results for measuring data are illegal, then Backup Data is verified.If the check results of Backup Data are valid data,
Backup Data is then completed into step motion control Stored Procedure again plus after the value of minimum resolution as the usage data refreshed;If
The check results of Backup Data are also invalid data, i.e. whole memory data have been destroyed, and answer and alarm and retain existing
Field is exited;
4, the check results to the source usage data in source data area are legal, and Backup Data area mark is normal, then to standby
Part data are verified.If the check results of Backup Data are legal, by Backup Data plus conduct after minimum resolution value
The usage data of refreshing completes step motion control Stored Procedure again, and according to Stored Procedure sequence, regards Backup Data as legal number
According to;If the check results of Backup Data are illegal, and source data area mark is normal, then storage write operation is continued to complete, depending on source
The source usage data of data field is valid data;
5, the check results to the source usage data in source data area are legal, and Backup Data area mark is abnormal, then continues
Storage write operation is completed, regards the source usage data in source data area as valid data;
Above-mentioned restoration methods provided in this embodiment combine source data area mark, Backup Data area mark, according to source number
According to and Backup Data checksum validation means, realize usage data it is accurate, it is reliable restore or preserve, not because unexpected interference is lost
Lose new refresh data.
6, when interruption appears in rStep_state=2, need verification source usage data whether in reliable preservation shape
State can verify and compare whether legal determine according to source usage data.If source usage data is legal, then compared with Backup Data
The value of minimum resolution, i.e. unit stepping-in amount whether are differed, if difference exceeds unit stepping-in amount, takes Backup Data plus single
Position stepping-in amount is saved in again in the usage data region of source, and continues to complete Stored Procedure;If difference is unit stepping-in amount,
Continue to complete storing process.If source usage data is illegal, unit stepping-in amount weight is added after taking Backup Data verification legal
It is newly saved in the usage data region of source, and continues to complete storing process.According to Stored Procedure, source usage data preserves operation first
In Backup Data, and Backup Data with source data not on the same area or the same page, so visual Backup Data is can
The valid data leaned on.
7, when interruption appears in rStep_state=3, i.e., Stored Procedure is in backup data store operation, can be direct
The source usage data of taking backups to Backup Data region, and continues to complete storage operating process.
8, when interruption appears in rStep_statee=4, that is, verify Backup Data whether reliably preserve state, according to
Source usage data compares, equal to complete last Stored Procedure;It is not equal then to preserve source from rStep_state=3 flows from new
In usage data to Backup Data region and complete Stored Procedure.
In addition, in the storage of source usage data and usage data recovery operation, the hardware shape for paying close attention to memory is needed
State, it is rational using source region in memory or backup area according to the memory state mark in source data area and Backup Data area
Data, and according to memory state and data validity judgement, as early as possible be reported to management system, reduce due to memory damages
Be likely to cause because data can not store in memory, when drop-in, usage data is lost and the economic damage brought
It becomes estranged dispute.Therefore, in a preferred approach, method provided in this embodiment further includes:Sentenced according to preset write-in frequency threshold value
Whether the storage region of disconnected write-in data is legal;If it is determined that the storage region of write-in data is illegal, then write-in data are changed
Storage region.
To make full use of memory as possible, extend life of storage, the embodiment of the present invention is in data storage operations
Used data pointer, when certain unit or certain block storage region are damaged, the storage unit that more renews and or storage region so that
The utilization rate of memory reaches maximum.Such as:Default write-in frequency threshold value is 3.It can be according to the source usage data of storage data
The address calculation of first address and purpose data pointer goes out storage region, and when the number of the storage region is written in data storage operations
When being determined as illegal more than 3 times, the pointer of storage region is changed, and is saved in place appropriate, while judging that the data store
Whether region overflows, and provides corresponding error condition mark.
In method provided in this embodiment, step motion control is respectively provided with by using to each flow in storage data procedures
The mode record storage flow of word, when to encounter interruption in storage, can it is subsequent can be accurate when restoring usage data
The flow for navigating to storage and interrupting, and restored according to the characteristics of each interruption flow, therefore can intuitively know that data are being deposited
State in which, step in storage operation, acquirement can store step motion control word according to data and carry out error correction and recovery to data, can protect
The technique effect that the usage data that card refreshes is not lost.
Embodiment 2
It is realized for the ease of the method in embodiment 1, the present embodiment provides a kind of storages of protection usage data to handle dress
Set, the device may be mounted on intelligent electronic measuring instrument or in which MCU in or the device can be exactly a metering
Instrument or MCU.As shown in figure 4, including:Stepping setup module 21 and recovery module 22.
Stepping setup module 21 is used for when storing usage data to memory block, to store each flow of usage data
Step motion control word is set;Recovery module 22 is used for when restoring usage data to buffer area, reading step motion control word, and according to
The step motion control word of reading judges whether the process of usage data deposit memory block has interruption, restores to use further according to the result of judgement
Measure data.
Specifically, stepping setup module 21, when being specifically used for original state, the value of setting step motion control word is first state
Value;When starting storage source usage data, the value of setting step motion control word is the second state value;When the usage data storage verification of source,
The value that step motion control word is arranged is third state value;When starting the Backup Data of storage source usage data, step motion control word is set
Value be the 4th state value;When Backup Data verifies, the value of setting step motion control word is the 5th state value.
Recovery module 22 includes:
Initial recovery unit, when the value for the step motion control word in reading is first state value, judgement usage data is deposited
The process for entering memory block is not interrupted, and restores usage data to buffer area;
Error correction recovery unit when the value for the step motion control word in setting is not first state value, judges usage data
The process of deposit memory block has an interruption, and according to the value of the step motion control word of reading to the carry out legitimacy of usage data handle with
Just restore usage data to buffer area.
Wherein, error correction recovery unit, when the value specifically for the step motion control word in setting is not first state value, judgement
The process of usage data deposit memory block has an interruption, and when the value of the step motion control word of reading is the second state value, according to
The backup number of the source usage data, the Backup Data, the source data area mark of the source usage data, the Backup Data
Legal usage data is determined according to the value of area's mark and minimum resolution, and the legal usage data is restored to the caching
Area;When the value of the step motion control word of reading is third state value, according to the source usage data, the Backup Data and most
The value of small resolution ratio determines legal usage data, and the legal usage data is restored to the buffer area;When reading
The value of step motion control word when being four state values, it is legal usage data to take source usage data, and by the source usage data
It is restored to the buffer area;When the value of the step motion control word of reading is five state value, according to the verification to Backup Data
As a result source usage data or Backup Data is taken to be restored to the buffer area.
Preferably, which further includes:
Storage region detection module, for according to it is preset write-in frequency threshold value judge write-in data storage region whether
It is legal;If it is determined that the storage region of write-in data is illegal, then the storage region of write-in data is changed.
During data storage operations step motion control word can be arranged, and according to stepping control in device provided in this embodiment
The state recording supervising data storage process steps of word processed, when to monitor data storage operations, which corrupt data walk at
In operating process;Therefore, according to step motion control word process, restart to carry out data recovery in the place of error, avoid because dry
It disturbs or accidental interruption causes loss or the destruction of data.
Substantially the part that contributes to existing technology is shape with software product to technical scheme of the present invention in other words
The reflected function of formula, in other words:Side of each equipment of the device of the invention, equipment or composition system performed by it
Even if method or the function body of realization are hardware, but actually realize that the part of the above-mentioned function of the present invention is computer software
The module or unit of product.And the computer software product is storable in the storage medium that can be read, soft such as computer
Disk, hard disk or CD etc., including some instructions are used so that an equipment executes the method described in each embodiment of the present invention.
The above description is merely a specific embodiment, but the present invention can be there are many various forms of specific implementations
Mode is the present invention above in association with attached drawing for example, this is not meant to the specific implementation mode that the present invention is applied
It can be confined in these specific specific implementation modes, those skilled in the art is it is to be appreciated that specific reality presented above
The mode of applying is some examples in a variety of preferred embodiments, and any specific implementation mode for embodying the claims in the present invention is equal
It should be within the scope of the claims in the present invention be claimed;Those skilled in the art can be to each specific embodiment party above
Technical solution recorded in formula is modified or equivalent replacement of some of the technical features.It is all the present invention
Within spirit and principle, made by any modification, equivalent replacement or improvement etc., should be included in the guarantor of the claims in the present invention
Within the scope of shield.
Claims (8)
1. a kind of storage processing method of protection usage data, which is characterized in that including:
When storing usage data to memory block, to store each flow setting step motion control word of usage data;
When restoring usage data to buffer area, step motion control word is read, and dosage number is judged according to the step motion control word of reading
Whether the process according to deposit memory block has interruption, restores usage data further according to the result of judgement;
Each flow setting step motion control word for storage usage data specifically includes:
When original state, the value of setting step motion control word is first state value;
When starting storage source usage data, the value of setting step motion control word is the second state value;
When the usage data storage verification of source, the value of setting step motion control word is third state value;
When starting the Backup Data of storage source usage data, the value of setting step motion control word is the 4th state value;
When Backup Data verifies, the value of setting step motion control word is the 5th state value.
2. according to the method described in claim 1, it is characterized in that, described judge usage data according to the step motion control word of reading
Whether the process of deposit memory block has interruption, restores usage data further according to the result of judgement, specifically includes:
If the value of the step motion control word read is first state value, judge the process of usage data deposit memory block without in
It is disconnected, restore usage data to buffer area;
If the value for the step motion control word being arranged is not first state value, in judging that the process of usage data deposit memory block has
It is disconnected, and the carry out legitimacy of usage data is handled according to the value of the step motion control word of reading to restore usage data to caching
Area.
3. according to the method described in claim 2, it is characterized in that, the value of the step motion control word according to reading is to dosage number
According to carry out legitimacy handle to restore usage data to buffer area, specifically include:
When the value of the step motion control word of reading is the second state value, according to the source usage data, Backup Data, described
It is legal that the value of the source data area mark of source usage data, the Backup Data area mark of the Backup Data and minimum resolution determines
Usage data, and the legal usage data is restored to the buffer area;
When the value of the step motion control word of reading is third state value, according to the source usage data, the Backup Data and most
The value of small resolution ratio determines legal usage data, and the legal usage data is restored to the buffer area;
When the value of the step motion control word of reading is four state value, it is legal usage data to take source usage data, and should
Source usage data is restored to the buffer area;
When the value of the step motion control word of reading is five state value, source usage data is taken according to the check results to Backup Data
Or Backup Data is restored to the buffer area.
4. method according to any one of claim 1-3, which is characterized in that this method further includes:
Judge whether the storage region that data are written is legal according to preset write-in frequency threshold value;
If it is determined that the storage region of write-in data is illegal, then the storage region of write-in data is changed.
5. a kind of storage processing unit of protection usage data, which is characterized in that including:
Stepping setup module, for when storing usage data to memory block, each flow setting to store usage data to walk
Into control word;
Recovery module, for when restoring usage data to buffer area, reading step motion control word, and according to the step motion control of reading
Word judges whether the process of usage data deposit memory block has interruption, restores usage data further according to the result of judgement;
The stepping setup module, when being specifically used for original state, the value of setting step motion control word is first state value;Start to deposit
When source of bank savings usage data, the value of setting step motion control word is the second state value;When the usage data storage verification of source, stepping control is set
The value of word processed is third state value;When starting the Backup Data of storage source usage data, the value of setting step motion control word is the 4th
State value;When Backup Data verifies, the value of setting step motion control word is the 5th state value.
6. device according to claim 5, which is characterized in that the recovery module includes:
Initial recovery unit, when the value for the step motion control word in reading is first state value, judgement usage data is deposited
The process of storage area is not interrupted, and restores usage data to buffer area;
Error correction recovery unit, when the value for the step motion control word in setting is not first state value, judgement usage data deposit
The process of memory block has interruption, and is handled the carry out legitimacy of usage data so as to extensive according to the value of the step motion control word of reading
Usage data is answered to buffer area.
7. device according to claim 6, which is characterized in that
The error correction recovery unit when value specifically for the step motion control word in setting is not first state value, judges dosage
The process of data deposit memory block has an interruption, and when the value of the step motion control word of reading is the second state value, according to described
The Backup Data area of source usage data, the Backup Data, the source data area mark of the source usage data, the Backup Data
The value of mark and minimum resolution determines legal usage data, and the legal usage data is restored to the buffer area;
When the value of the step motion control word of reading is third state value, according to the source usage data, the Backup Data and minimum
The value of resolution ratio determines legal usage data, and the legal usage data is restored to the buffer area;When reading
When the value of step motion control word is four state value, it is legal usage data to take source usage data, and the source usage data is extensive
The buffer area is arrived again;When the value of the step motion control word of reading is five state value, according to the verification knot to Backup Data
Fruit takes source usage data or Backup Data to be restored to the buffer area.
8. according to the device described in any one of claim 5-7, which is characterized in that the device further includes:
Storage region detection module, for judging whether the storage region that data are written closes according to preset write-in frequency threshold value
Method;If it is determined that the storage region of write-in data is illegal, then the storage region of write-in data is changed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410363256.9A CN105320614B (en) | 2014-07-28 | 2014-07-28 | A kind of storage processing method and device of protection usage data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410363256.9A CN105320614B (en) | 2014-07-28 | 2014-07-28 | A kind of storage processing method and device of protection usage data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105320614A CN105320614A (en) | 2016-02-10 |
CN105320614B true CN105320614B (en) | 2018-09-07 |
Family
ID=55248025
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410363256.9A Active CN105320614B (en) | 2014-07-28 | 2014-07-28 | A kind of storage processing method and device of protection usage data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105320614B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112527566B (en) * | 2020-12-24 | 2023-11-21 | 广东芬尼科技股份有限公司 | Method, system and storage medium for protecting read-write abnormality of equipment power-down operation parameters |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102929806A (en) * | 2012-10-24 | 2013-02-13 | 威盛电子股份有限公司 | Progress recording method and restoration method suitable for encoding operation of storage device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4938328B2 (en) * | 2006-03-28 | 2012-05-23 | 株式会社日立製作所 | Storage system, power supply control method thereof, and storage apparatus |
-
2014
- 2014-07-28 CN CN201410363256.9A patent/CN105320614B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102929806A (en) * | 2012-10-24 | 2013-02-13 | 威盛电子股份有限公司 | Progress recording method and restoration method suitable for encoding operation of storage device |
Also Published As
Publication number | Publication date |
---|---|
CN105320614A (en) | 2016-02-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102890657B (en) | The method that the reading and writing data of a kind of EEPROM of minimizing is made mistakes | |
CN105723348B (en) | Unauthorized memory modification and access are detected using transactional memory | |
TW201212037A (en) | Methods and apparatus to protect segments of memory | |
RU2015147646A (en) | SYSTEMS AND METHODS FOR PREVENTING UNAUTHORIZED STACK MOVEMENT | |
WO2007074395A1 (en) | Method and apparatus for detecting a fault condition and restoration thereafter using user context information | |
US8554727B2 (en) | Method and system of tiered quiescing | |
CN106910528A (en) | A kind of optimization method and device of solid state hard disc data routing inspection | |
CN107315616A (en) | A kind of loading method of firmware, device and electronic equipment | |
CN103955649B (en) | A kind of method of clean boot terminal unit | |
CN106681863B (en) | Save the method and terminal device of electronic health record content of edit | |
CN110442473A (en) | A kind of non-volatile data storage method, apparatus, electronic equipment and medium | |
CN103218275A (en) | Data error repairing method, device and equipment | |
CN108197476A (en) | The leak detection method and device of a kind of intelligent terminal | |
CN105512562B (en) | Vulnerability mining method and device and electronic equipment | |
CN105320614B (en) | A kind of storage processing method and device of protection usage data | |
CN107402843A (en) | Restoration methods, device and the equipment of database corruption | |
CN107977577A (en) | access instruction access detection method and device | |
CN107704333A (en) | Failure store method, device and the readable storage medium storing program for executing of SAN storage system | |
CN110442474A (en) | A kind of data consistency checking method, system and data verification end | |
CN107894900A (en) | A kind of method and system of MCU upgradings | |
US20140245082A1 (en) | Implementing client based throttled error logging | |
CN114282206A (en) | Stack overflow detection method, device, embedded system and storage medium | |
CN103823637B (en) | A kind of data processing method and equipment | |
CN104239201A (en) | Memory read-write monitoring method in flexible single-step system | |
CN109144766B (en) | Data storage and reconstruction method and device and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |