CN107678977A - The reading/writing method and device of a kind of counter - Google Patents
The reading/writing method and device of a kind of counter Download PDFInfo
- Publication number
- CN107678977A CN107678977A CN201710944123.4A CN201710944123A CN107678977A CN 107678977 A CN107678977 A CN 107678977A CN 201710944123 A CN201710944123 A CN 201710944123A CN 107678977 A CN107678977 A CN 107678977A
- Authority
- CN
- China
- Prior art keywords
- memory page
- counter
- operation requests
- page
- counter information
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/0223—User address space allocation, e.g. contiguous or non contiguous base addressing
- G06F12/023—Free address space management
- G06F12/0238—Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
- G06F12/0246—Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06M—COUNTING MECHANISMS; COUNTING OF OBJECTS NOT OTHERWISE PROVIDED FOR
- G06M3/00—Counters with additional facilities
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
The present invention relates to a kind of reading/writing method of counter and device, method includes:Operation requests are received, wherein operation requests include the address of the first memory page;The counter information stored in the first memory page and the second memory page is obtained, wherein, counter information includes:Sequence number, check value and Counter Value, the second memory page are next memory page of the first memory page corresponding with counter in flash memory FLASH chip;According to the counter information stored in the first memory page and the second memory page, it is determined that effective memory page;According to the counter information in operation requests and effective memory page, operation processing corresponding with operation requests is performed.The reading/writing method and device of counter provided by the invention, it is possible to achieve the power-off protection of counter information, reduce the multi-pass operation required for backup operation, improve the read-write speed of counter.
Description
Technical field
The present invention relates to the reading/writing method and device of communication technical field, more particularly to a kind of counter.
Background technology
At present, as the use of the terminal device such as the development of power communication, concentrator, acquisition terminal is more and more.In order to
Ensure the safety of equipment, it will usually by terminal embedded type safety control module, (Terminal Embedded Secure
Access Module, abbreviation:TESAM) it is installed in the terminal devices such as concentrator and acquisition terminal, the safety as equipment is recognized
Demonstrate,prove module.A variety of counters can be used when terminal device between TESAM and application platform by interacting, are counted
The read or write speed of device can have a strong impact on the treatment effeciency of the terminal devices such as concentrator and acquisition terminal etc..
Counter is typically in flash memory (English full name Flash EEPROM Memory, abbreviation:FLASH 4 are actually taken in)
Byte stores.In the prior art, directly read during read counter to FLASH addresses corresponding to counter;During refresh counter, press
Need to back up data to write-protected zone, the data mark in write-protect control zone to write-protected zone according to existing power down protection mode
Note, write in actual address is write data and erasing write-protect control zone 4 times is erasable.
Based on this, it was found by the inventors of the present invention that existing counter reading/writing method in the prior art, during refresh counter
Need progress repeatedly erasable, add the execution time of instruction, reduce the place of the terminal devices such as concentrator and acquisition terminal etc.
Manage efficiency.
The information for being disclosed in the background section is merely intended to understanding of the increase to the general background of the present invention, without answering
It has been the prior art well known to persons skilled in the art when being considered as recognizing or implying the information structure in any form.
The content of the invention
In view of this, the technical problem to be solved in the present invention is how to provide the reading/writing method and device of counter, with solution
The problem of certainly existing counter execute instruction time of the prior art is long, read-write efficiency is not high.
To solve above technical problem, the present invention provides a kind of reading/writing method of counter in first aspect, and its feature exists
In, including:Operation requests are received, wherein the operation requests include the address of the first memory page, wherein, first memory page
For the homepage in multiple memory pages corresponding with the counter in FLASH chip;Obtain first memory page and
The counter information stored in two memory pages, wherein, the counter information includes:Sequence number, check value and Counter Value,
Second memory page is next memory page of first memory page corresponding with the counter in FLASH chip;Root
According to the counter information stored in first memory page and the second memory page, it is determined that effective memory page;According to the operation
Counter information in request and the effectively memory page, performs operation processing corresponding with the operation requests.
It is described according to the meter stored in first memory page and the second memory page in a kind of possible implementation
Number device information, it is determined that effectively memory page includes:According to the counting stored in first memory page and second memory page
Device information, judge whether first memory page and second memory page are empty respectively;If first memory page and
Second memory page is all sky, then first memory page is effective memory page.
It is described to be stored according in first memory page and second memory page in a kind of possible implementation
Counter information, after judging whether first memory page and second memory page are sky respectively, in addition to:If institute
Stating the first memory page and second memory page, at least one is not sky, then judges first memory page and institute respectively
Whether the check value for stating the second memory page is effective;If the check value for only existing a memory page is effective, check value is effectively deposited
Storage page is effective memory page.
It is described to judge first memory page and second memory page respectively in a kind of possible implementation
Whether check value effectively includes:The counter information stored in first memory page and second memory page is judged respectively
Check value it is whether correct;If the check value of the counter information stored in first memory page is at least one correct, institute
The check value for stating the first memory page is effective;If the check value of the counter information stored in second memory page is at least one just
Really, then the check value of second memory page is effective.
It is described to judge first memory page and second memory page respectively in a kind of possible implementation
After whether check value is effective, in addition to:If the check value of first memory page and second memory page is effective,
According to the counter information stored in first memory page and second memory page, first memory page is determined respectively
And the maximum of the counter sequence number in second memory page;Compare counter sequence number in first memory page most
The maximum of big value and the counter sequence number in second memory page, the counter sequence number of maximum will be stored with most
The memory page being worth greatly is as effective memory page.
In a kind of possible implementation, when the operation requests are read operation request, described according to the behaviour
Ask and the counter information effectively in memory page, perform before operation corresponding with the operation requests handles,
Also include:According to the counter information stored in first memory page and second memory page, described is determined respectively
The maximum of one memory page and the counter sequence number in second memory page;First memory page and institute are determined respectively
The maximum of the counter sequence number in the second memory page is stated relative to the offset address of the first address of the first memory page;The basis
Counter information in the operation requests and the effectively memory page, is performed at operation corresponding with the operation requests
Reason, including:The maximum of counter sequence number in the operation requests and the effectively memory page is deposited relative to first
The offset address of the first address of page is stored up, reads the value of the counter.
In a kind of possible implementation, when the operation requests are write operation requests, the operation requests are also wrapped
Include counter information to be written;Described according to the operation requests and the counter information effectively in memory page,
Before performing operation processing corresponding with the operation requests, in addition to:First memory page and described are obtained respectively
Next available address of two memory pages relative to the first address of the first memory page offset address;It is described according to the operation requests
And the counter information in the effectively memory page, operation processing corresponding with the operation requests is performed, including:If only deposit
Effective in the check value of a memory page, then the memory page invalid to the check value is wiped;According to the operation requests
In counter information to be written, write the counter information in effectively next available address of memory page.
In a kind of possible implementation, the counting according to the operation requests and in the effectively memory page
Device information, operation processing corresponding with the operation requests is performed, in addition to:If first memory page and described second depositing
The check value of storage page is effective, then the memory page of the maximum to being stored with the small counter sequence number is wiped.
To solve above technical problem, the present invention provides a kind of read-write equipment of counter in second aspect, including:Receive
Module, for receiving operation requests, wherein the operation requests include the address of the first memory page, wherein, first storage
Page is the homepage in multiple memory pages corresponding with the counter in FLASH chip;Acquisition module, for obtaining described
The counter information stored in one memory page and the second memory page, wherein, the counter information includes:Sequence number, verification
Value and Counter Value, second memory page are first memory page corresponding with the counter in FLASH chip
Next memory page;Computing module, for according to the counter information stored in first memory page and the second memory page,
It is determined that effective memory page;Processing module, for according to the operation requests and the counter information effectively in memory page,
Perform operation processing corresponding with the operation requests.
The reading/writing method and device of counter provided by the invention, by obtaining first memory page and the second storage
The counter information stored in page, wherein, the counter information includes:Sequence number, check value and Counter Value;According to institute
The counter information stored in the first memory page and the second memory page is stated, it is determined that effective memory page;According to the operation requests
And the counter information in the effectively memory page, perform operation processing corresponding with the operation requests, it is possible to achieve meter
The power-off protection of number device information, reduces the multi-pass operation required for backup operation, improves the read-write speed of counter.
According to below with reference to the accompanying drawings becoming to detailed description of illustrative embodiments, further feature of the invention and aspect
It is clear.
Brief description of the drawings
Comprising in the description and the accompanying drawing of a part for constitution instruction and specification together illustrate the present invention's
Exemplary embodiment, feature and aspect, and for explaining the principle of the present invention.
Fig. 1 shows the flow chart of the reading/writing method for the counter that one embodiment of the invention provides;
Fig. 2 is the flow chart of the reading/writing method for the counter that further embodiment of this invention provides;
Fig. 3 is the flow chart of the reading/writing method for the counter that the next embodiment of the present invention provides;
Fig. 4 is the flow chart of the reading/writing method for the counter that yet another embodiment of the invention provides;
Fig. 5 shows the structural representation of the read-write equipment for the counter that another embodiment of the present invention provides.
Embodiment
Below in conjunction with the accompanying drawings, the embodiment of the present invention is described in detail, it is to be understood that the guarantor of the present invention
Shield scope is not limited by embodiment.
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention
In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is
Part of the embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art
The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.Unless
Separately have it is other explicitly indicate that, otherwise in entire disclosure and claims, term " comprising " or its conversion such as "comprising" or
" including " etc. will be understood to comprise stated element or part, and not exclude other elements or other compositions
Part.
Special word " exemplary " is meant " being used as example, embodiment or illustrative " herein.Here as " exemplary "
Illustrated any embodiment should not necessarily be construed as preferred or advantageous over other embodiments.
In addition, in order to better illustrate the present invention, numerous details is given in embodiment below.
It will be appreciated by those skilled in the art that without some details, the present invention can equally be implemented.In some instances, for
Method well known to those skilled in the art, means, element are not described in detail, in order to highlight the purport of the present invention.
Embodiment 1
The read-write of FALSH chips is usually to press block or page operations, even if write-in data only have 1 byte, when being actually written into
Monoblock comprising the byte or page data are carried out erasable.This read write attribute of FLASH chip, data can be greatly increased and write
The angle of incidence, the execution time of some instructions for needing frequent updating FLASH can be produced a very large impact.Protected according to the power down of routine
When shield scheme is updated to counter, in the case where requiring to update 4 byte datas, the erasing of 4 page datas has actually been carried out
And write operation, the time of these operations turn into the key factor of time for each instruction length.
FLASH chip divide into two classes according to the difference of its wiping/writing performance.First kind chip, as long as the number in modification somewhere
Rewritten according to it is necessary to wipe;Second class chip, support the bit of data to write 0 by 1, do not support bit to write 1 by 0.Originally carry
Case optimizes for the second class chip.
Ensureing the correctness and validity of counter, while reducing erasing times, preserved using multiple complete pages
One counter, ensure the legitimacy of counter by increasing memory space and storage content.
Fig. 1 shows the flow chart of the reading/writing method for the counter that one embodiment of the invention provides, as shown in figure 1, this method
Comprise the following steps.
Step S1, operation requests are received, wherein the operation requests include the address of the first memory page, wherein, described the
One memory page is the homepage in multiple memory pages corresponding with the counter in FLASH chip.
Step S2, the counter information stored in first memory page and the second memory page is obtained, wherein, the meter
Number device information includes:Sequence number, check value and Counter Value, second memory page be in FLASH chip with the meter
Next memory page of first memory page corresponding to number device.
Specifically, memory page is the storage cells that FALSH chips are management division for convenience, is stored in a memory page
A plurality of counter information.Need to specify the offset address in page address and page simultaneously during read-write.The present embodiment Counter pair
The memory space answered can be multipage, be specifically described in the present embodiment by taking the first memory page and the second memory page as an example, but
It is not limited to page two.
Counter information includes:Sequence number, for verifying the check value of the legitimacy of counter, Counter Value can be with
Including reserved byte.The structure of counter information can refer to table 1:
Element | Length | Explanation |
num | 1byte | Counter sequence number |
counter | 4byte | Actually active Counter Value |
crc | 1byte | Num and counter CRC check and |
rf | 2byte | For the reserved byte of alignment |
Table 1
When performing chip initiation instruction, it is necessary to be initialized to multiple memory pages corresponding to counter.It will count
The memory space of multiple memory pages corresponding to device is initialized as 0xFF, and first counter information of the first memory page is initial
0100000000010000 is turned to, to ensure that page is effective.
Step S3, according to the counter information stored in first memory page and the second memory page, it is determined that effectively depositing
Store up page.
Wherein, the counter information stored in effective memory page is correct counter information.
Step S4, according to the counter information in the operation requests and the effectively memory page, perform and the behaviour
Operation processing corresponding to asking.
Specifically, according to read operation request or write operation requests, the value of counter is read out or updated.
Thus, by obtaining the counter information stored in first memory page and the second memory page, wherein, it is described
Counter information includes:Sequence number, check value and Counter Value;Deposited according in first memory page and the second memory page
The counter information of storage, it is determined that effective memory page;Counter in the operation requests and the effectively memory page is believed
Breath, perform operation processing corresponding with the operation requests, it is possible to achieve the power-off protection of counter information, reduce backup behaviour
Multi-pass operation required for making, improve the read-write speed of counter.
Embodiment 2
Fig. 2 is the flow chart of the reading/writing method for the counter that further embodiment of this invention provides, referring to Fig. 2, this implementation
Example is further limited step S3 on the basis of embodiment one.
Step S3 can include in the present embodiment:
S31, according to the counter information stored in first memory page and second memory page, institute is judged respectively
State whether the first memory page and second memory page are empty.
Specifically, when FLASH chip is dispatched from the factory, the memory space in memory page is initialized to 0xFF, that is to say, that can
With by judging whether that whole page data is all 0xFF to judge to store up whether page is empty.Obtain the counter letter stored in memory page
Breath, if the counter information stored in currently stored page is all 0xFF, currently stored page is sky.
S32, if first memory page and second memory page are all sky, first memory page is effectively to deposit
Store up page.
S33, if first memory page and second memory page at least one be not sky, judge respectively described in
Whether the check value of the first memory page and second memory page is effective.
Specifically, judged by the check value in counter information.
It can include:
S331, the verification of counter information stored in first memory page and second memory page is judged respectively
Whether value is correct;
Specifically include:When performing operation, verification calculating is carried out to current Counter Value, if being calculated according to Counter Value
The check value gone out is identical with the check value of counter information, then the check value of the counter information is correct.
S332, if the check value of the counter information stored in first memory page is at least one correct, described the
The check value of one memory page is effective.
S333, if the check value of the counter information stored in second memory page is at least one correct, described the
The check value of two memory pages is effective.
Thus, whether correctly ensure that Counter Value obtains validity by the check value of memory page.Avoid in power down process
In, when not updating or writing completion, the problem of Counter Value inaccuracy.
S34, if the check value for only existing a memory page is effective, the effective memory page of check value is effective memory page.
Specifically, when first memory page and second memory page at least one to be empty and only exist one
When the check value of memory page is correct, include the first memory page not to be empty and effective, the second memory page is empty or invalid;Second deposits
Page is stored up not to be empty and effective, the first memory page is empty or invalid;First memory page, the second memory page are not sky, but only one
Individual effective situation.
S35, if the check value of first memory page and second memory page is effective, deposited according to described first
The counter information that stores in storage page and second memory page, first memory page is determined respectively and described second is deposited
Store up the maximum of the counter sequence number in page.
Specifically, the maximum of first memory page and the counter sequence number in second memory page is determined respectively
Value, counter sequence number all in the first memory page is obtained, the counter sequence number in the memory page is contrasted, selection is wherein
Maximum, the maximum as the counter sequence number of the first memory page;Counter sequence number all in the second memory page is obtained,
Counter sequence number in the memory page is contrasted, selects maximum therein, the counter sequence number as the second memory page
Maximum.It should be noted that when being updated to Counter Value, the automatic distribution counting device sequence number of system, counter sequence number is most
Big is the Counter Value of newest storage.
S36, the meter in the maximum of the counter sequence number in first memory page and second memory page
The maximum of number device sequence number, the memory page of maximum of the counter sequence number of maximum will be stored with as effective memory page.
Specifically, if the maximum of the counter sequence number in the first memory page is more than the counter sequence number in the second memory page
Maximum, then the first memory page is effective memory page;If the maximum of the counter sequence number in the first memory page is less than second
The maximum of counter sequence number in memory page, then the second memory page is effective memory page.
Thus, the present embodiment is by judging whether the first memory page, the second memory page are empty, when being not space-time, by sentencing
The check value of disconnected memory page determines effective memory page, it is possible to achieve the power-off protection of counter information, reduces backup operation
Required multi-pass operation, further increase the read-write speed of counter.
Embodiment 3
Fig. 3 is the flow chart of the reading/writing method for the counter that the next embodiment of the present invention provides, referring to Fig. 3, this implementation
In example, operation requests are read operation request, are further limited on the basis of above-described embodiment.
After before step S 4, in addition to:
Step S51, it is true respectively according to the counter information stored in first memory page and second memory page
The maximum of fixed first memory page and the counter sequence number in second memory page;
Step S52, the maximum of first memory page and the counter sequence number in second memory page is determined respectively
It is worth the offset address of the first address relative to the first memory page;
Then step S4 includes:
Step S41, the maximum of the counter sequence number in the operation requests and the effectively memory page are relative
In the offset address of the first address of the first memory page, the value of the counter is read.
It can also include, if the check value of first memory page and second memory page is correct, to storage
The memory page for having the maximum of the small counter sequence number is wiped.
It should be noted that the step S51 and S35 in embodiment two in the present embodiment is according to first memory page
And the counter information stored in second memory page, first memory page and second memory page are determined respectively
In counter sequence number maximum, effect it is identical.
Thus, by determining the maximum of the counter sequence number in first memory page and second memory page respectively
It is worth the offset address of the first address relative to the first memory page;According to the meter in the operation requests and the effectively memory page
The maximum of number device sequence numbers reads the value of the counter, Ke Yishi relative to the offset address of the first address of the first memory page
The power-off protection of existing counter information, reduces the multi-pass operation required for backup operation, further increases the reading of counter
Writing speed.
Embodiment 4
Fig. 4 is the flow chart of the reading/writing method for the counter that yet another embodiment of the invention provides, referring to Fig. 4, this implementation
In example, when the operation requests are write operation requests, further limited on the basis of above-described embodiment.Wherein, operate
Request also includes counter information to be written;
Also include before step S 4:
Step S53, obtain respectively next available address of first memory page and second memory page relative to
The offset address of the first address of first memory page.
Step S4 includes:
Step S42, if the check value for only existing a memory page is effective, the memory page invalid to the check value is carried out
Erasing.
Step S43, can in effectively the next of memory page according to counter information to be written in the operation requests
With writing the counter information in address.
Step S44 is small to being stored with if the check value of first memory page and second memory page is effective
The memory page of maximum of the counter sequence number wiped.
Specifically, when the first memory page space is finished, the counter information that needs are updated is saved in second page, then
Whole page erasing is carried out to first page again.
Thus, by the way that when the check value for only existing a memory page is effective, the memory page invalid to the check value enters
Row erasing, according to counter information to be written in the operation requests, in effectively next available address of memory page
Write the counter information;If the check value of first memory page and second memory page is effective, to storage
The memory page for having the maximum of the small counter sequence number is wiped, it is possible to achieve when refresh counter, only renewal is counted
Number device information namely 8 bytes, just need to carry out an erasing operation when writing full one page, reduce that counter updates when
Between, further increase instruction execution efficiency.
Embodiment 5
Fig. 5 shows the structural representation of the read-write equipment for the counter that another embodiment of the present invention provides, as shown in figure 5,
The device includes receiving module 1, acquisition module 2, computing module 3, processing module 4.
Receiving module 1, for receiving operation requests, wherein the operation requests include read operation request or write operation please
Ask, and the address of the first memory page, wherein, first memory page is corresponding with the counter in FLASH chip
Homepage in multiple memory pages.
Acquisition module 2, for obtaining the counter information stored in first memory page and the second memory page, its
In, the counter information includes:Sequence number, check value and Counter Value, second memory page are in FLASH chip
Next memory page of first memory page corresponding with the counter.
Computing module 3, for according to the counter information stored in first memory page and the second memory page, it is determined that
Effective memory page.
Processing module 4, for according to the operation requests and the counter information effectively in memory page, perform with
Operation corresponding to the operation requests is handled.
Thus, by obtaining the counter information stored in first memory page and the second memory page, wherein, it is described
Counter information includes:Sequence number, check value and Counter Value;Deposited according in first memory page and the second memory page
The counter information of storage, it is determined that effective memory page;Counter in the operation requests and the effectively memory page is believed
Breath, perform operation processing corresponding with the operation requests, it is possible to achieve the power-off protection of counter information, reduce backup behaviour
Multi-pass operation required for making, improve the read-write speed of counter.
The description of the foregoing specific illustrative embodiment to the present invention is to illustrate and the purpose of illustration.These descriptions
It is not wishing to limit the invention to disclosed precise forms, and it will be apparent that according to above-mentioned teaching, can be much changed
And change.The purpose of selecting and describing the exemplary embodiment is that explain that the certain principles of the present invention and its reality should
With so that those skilled in the art can realize and utilize the present invention a variety of exemplaries and
Various chooses and changes.The scope of the present invention is intended to be limited by claims and its equivalents.
Device embodiment described above is only schematical, wherein the unit illustrated as separating component can
To be or may not be physically separate, it can be as the part that unit is shown or may not be physics list
Member, you can with positioned at a place, or can also be distributed on multiple NEs.It can be selected according to the actual needs
In some or all of module realize the purpose of this embodiment scheme.Those of ordinary skill in the art are not paying creativeness
Work in the case of, you can to understand and implement.
Claims (9)
- A kind of 1. reading/writing method of counter, it is characterised in that including:Receive operation requests, wherein the operation requests include the address of the first memory page, wherein, first memory page for Homepage in flash memory FLASH chip in multiple memory pages corresponding with the counter;The counter information stored in first memory page and the second memory page is obtained, wherein, the counter information bag Include:Sequence number, check value and Counter Value, second memory page are corresponding with the counter in FLASH chip Next memory page of first memory page;According to the counter information stored in first memory page and the second memory page, it is determined that effective memory page;According to the counter information in the operation requests and the effectively memory page, perform corresponding with the operation requests Operation is handled.
- 2. the reading/writing method of counter according to claim 1, it is characterised in that it is described according to first memory page with And second counter information stored in memory page, it is determined that effectively memory page includes:According to the counter information stored in first memory page and second memory page, judge that described first deposits respectively Whether storage page and second memory page are empty;If first memory page and second memory page are all sky, first memory page is effective memory page.
- 3. the reading/writing method of counter according to claim 2, it is characterised in that it is described according to first memory page with And the counter information stored in second memory page, judge that first memory page and second memory page are respectively It is no for after empty, in addition to:If at least one is not sky for first memory page and second memory page, first storage is judged respectively Whether the check value of page and second memory page is effective;If the check value for only existing a memory page is effective, the effective memory page of check value is effective memory page.
- 4. the reading/writing method of counter according to claim 3, it is characterised in that described to judge first storage respectively Whether the check value of page and second memory page effectively includes:Whether just the check value of counter information stored in first memory page and second memory page is judged respectively Really;If the check value of the counter information stored in first memory page is at least one correct, first memory page Check value is effective;If the check value of the counter information stored in second memory page is at least one correct, second memory page Check value is effective.
- 5. the reading/writing method of counter according to claim 3, it is characterised in that described to judge first storage respectively After whether the check value of page and second memory page is effective, in addition to:If the check value of first memory page and second memory page is effective, according to first memory page and The counter information stored in second memory page, determine respectively in first memory page and second memory page The maximum of counter sequence number;Compare the counter sequence number in first memory page maximum and second memory page in counter sequence number Maximum, will be stored with maximum the counter sequence number maximum memory page as effective memory page.
- 6. the reading/writing method of the counter according to claim any one of 1-5, it is characterised in that when the operation requests are During read operation request, in the counter information according to the operation requests and in the effectively memory page, execution and institute Before stating operation processing corresponding to operation requests, in addition to:Deposited according in first memory page and second memory page The counter information of storage, the maximum of first memory page and the counter sequence number in second memory page is determined respectively Value;Determine the maximum of first memory page and the counter sequence number in second memory page relative to first respectively The offset address of the first address of memory page;The counter information according to the operation requests and in the effectively memory page, perform and the operation requests pair The operation processing answered, including:The maximum of counter sequence number in the operation requests and the effectively memory page is relative to the first memory page First address offset address, read the value of the counter.
- 7. the reading/writing method of the counter according to claim 3 or 5, it is characterised in that when the operation requests are to write behaviour When asking, the operation requests also include counter information to be written;Described according to the operation requests and described Counter information in effective memory page, before performing operation processing corresponding with the operation requests, in addition to:Next available address of first memory page and second memory page is obtained respectively relative to the first memory page The offset address of first address;The counter information according to the operation requests and in the effectively memory page, perform and the operation requests pair The operation processing answered, including:If the check value for only existing a memory page is effective, the memory page invalid to the check value is wiped;According to counter information to be written in the operation requests, write in effectively next available address of memory page The counter information.
- 8. the reading/writing method of counter according to claim 7, it is characterised in that it is described according to the operation requests and Counter information in the effectively memory page, operation processing corresponding with the operation requests is performed, in addition to:If the check value of first memory page and second memory page is effective, to being stored with the small counter The memory page of the maximum of sequence number is wiped.
- A kind of 9. read-write equipment of counter, it is characterised in that including:Receiving module, for receiving operation requests, wherein the operation requests include the address of the first memory page, wherein, it is described First memory page is the homepage in multiple memory pages corresponding with the counter in FLASH chip;Acquisition module, for obtaining the counter information stored in first memory page and the second memory page, wherein, it is described Counter information includes:Sequence number, check value and Counter Value, second memory page be in FLASH chip with it is described Next memory page of first memory page corresponding to counter;Computing module, for according to the counter information stored in first memory page and the second memory page, it is determined that effectively Memory page;Processing module, for according to the operation requests and the counter information effectively in memory page, perform with it is described Operation corresponding to operation requests is handled.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710944123.4A CN107678977B (en) | 2017-09-30 | 2017-09-30 | Reading and writing method and device of counter |
PCT/CN2018/087174 WO2019062147A1 (en) | 2017-09-30 | 2018-05-16 | Reading and writing method and apparatus for counter, device, and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710944123.4A CN107678977B (en) | 2017-09-30 | 2017-09-30 | Reading and writing method and device of counter |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107678977A true CN107678977A (en) | 2018-02-09 |
CN107678977B CN107678977B (en) | 2021-01-05 |
Family
ID=61140710
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710944123.4A Active CN107678977B (en) | 2017-09-30 | 2017-09-30 | Reading and writing method and device of counter |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN107678977B (en) |
WO (1) | WO2019062147A1 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019062147A1 (en) * | 2017-09-30 | 2019-04-04 | 北京智芯微电子科技有限公司 | Reading and writing method and apparatus for counter, device, and storage medium |
CN110729014A (en) * | 2019-10-17 | 2020-01-24 | 深圳忆联信息系统有限公司 | Method and device for backing up erase count table in SSD (solid State disk) storage, computer equipment and storage medium |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110276213B (en) * | 2019-06-24 | 2021-03-16 | 恒宝股份有限公司 | Smart card and storage and verification method for sensitive result thereof |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060059326A1 (en) * | 2002-11-21 | 2006-03-16 | Microsoft Corporation | Dynamic data structures for tracking file system free space in a flash memory device |
CN101079009A (en) * | 2007-07-06 | 2007-11-28 | 北京飞天诚信科技有限公司 | Method and storage device for limiting read of sensitive information |
CN103065675A (en) * | 2011-10-18 | 2013-04-24 | 海力士半导体有限公司 | Memory system |
CN104769557A (en) * | 2012-11-09 | 2015-07-08 | 高通股份有限公司 | Processor memory optimization via page access counting |
CN105023612A (en) * | 2014-04-30 | 2015-11-04 | 质子世界国际公司 | Bi-directional counter in flash memory |
US9442841B2 (en) * | 2012-04-19 | 2016-09-13 | Kabushiki Kaisha Toshiba | Semiconductor memory device and method for logging monitored events into a buffer |
US20160342529A1 (en) * | 2015-05-19 | 2016-11-24 | International Business Machines Corporation | Page replacement algorithms for use with solid-state drives |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4229140B2 (en) * | 2006-06-16 | 2009-02-25 | ソニー株式会社 | Integrated circuit chip, data reading method, data writing method, IC card, and mobile phone |
CN107678977B (en) * | 2017-09-30 | 2021-01-05 | 北京智芯微电子科技有限公司 | Reading and writing method and device of counter |
-
2017
- 2017-09-30 CN CN201710944123.4A patent/CN107678977B/en active Active
-
2018
- 2018-05-16 WO PCT/CN2018/087174 patent/WO2019062147A1/en active Application Filing
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060059326A1 (en) * | 2002-11-21 | 2006-03-16 | Microsoft Corporation | Dynamic data structures for tracking file system free space in a flash memory device |
CN101079009A (en) * | 2007-07-06 | 2007-11-28 | 北京飞天诚信科技有限公司 | Method and storage device for limiting read of sensitive information |
CN103065675A (en) * | 2011-10-18 | 2013-04-24 | 海力士半导体有限公司 | Memory system |
US9442841B2 (en) * | 2012-04-19 | 2016-09-13 | Kabushiki Kaisha Toshiba | Semiconductor memory device and method for logging monitored events into a buffer |
CN104769557A (en) * | 2012-11-09 | 2015-07-08 | 高通股份有限公司 | Processor memory optimization via page access counting |
CN105023612A (en) * | 2014-04-30 | 2015-11-04 | 质子世界国际公司 | Bi-directional counter in flash memory |
US20160342529A1 (en) * | 2015-05-19 | 2016-11-24 | International Business Machines Corporation | Page replacement algorithms for use with solid-state drives |
Non-Patent Citations (1)
Title |
---|
徐晓宇等: "基于ARM+FPGA的PLC计数器的设计", 《计算机测量与控制》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019062147A1 (en) * | 2017-09-30 | 2019-04-04 | 北京智芯微电子科技有限公司 | Reading and writing method and apparatus for counter, device, and storage medium |
CN110729014A (en) * | 2019-10-17 | 2020-01-24 | 深圳忆联信息系统有限公司 | Method and device for backing up erase count table in SSD (solid State disk) storage, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
WO2019062147A1 (en) | 2019-04-04 |
CN107678977B (en) | 2021-01-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101446921B (en) | Dynamic storage method of Flash memory | |
US8234423B2 (en) | Multi-reader multi-writer circular buffer memory | |
CN103440205B (en) | A kind of set top box data storage method and device | |
CN107678977A (en) | The reading/writing method and device of a kind of counter | |
CN106155915A (en) | The processing method and processing device of data storage | |
CN104820641A (en) | Method for reducing FLASH erasure frequency | |
CN101963912A (en) | Implementation method for storing and checking hardware configuration information of system | |
CN106020735A (en) | Data storage method and device | |
CN102163155A (en) | Upgrade controlling device and method for upgrading memory device | |
CN105912601A (en) | Partition storage method for distributed real-time memory database of energy management system | |
CN110413454A (en) | Data re-establishing method, device and storage medium based on storage array | |
CN107479834A (en) | A kind of file memory method and device based on COS | |
CN104978154A (en) | Cache operation-based flash rapid read-write method and system | |
CN109213448A (en) | A kind of method, apparatus, equipment and the storage medium of the erasable data of smart card | |
CN112000513A (en) | Computer and VPD data operation method, device and storage medium thereof | |
CN105808378A (en) | Metadata restoration method and device | |
CN110457321A (en) | Date storage method and Related product based on block chain | |
CN110990207B (en) | BPS memory test method, system, terminal and storage medium based on Whitley platform | |
CN110727399A (en) | Storage array management method and device | |
CN111880745A (en) | Data processing method, device and equipment based on solid-state disk array and storage medium | |
CN106959906A (en) | Information processing method, information processor and electronic equipment | |
CN106920576A (en) | A kind of method and system of inspection Nand Flash mass | |
CN107783725A (en) | The method, apparatus and nonvolatile memory of data storage | |
CN112965919B (en) | Electric energy meter data minute freezing method, storage medium and equipment | |
CN114781903A (en) | Battery replacement place load determination method and device, electronic equipment and storage medium |
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 |