Method and device for reading and writing a counter

A read-write method and counter technology, applied in the field of communication, can solve the problems of long execution time of instructions and low read-write efficiency, and achieve the effects of reducing multiple operations, increasing read-write speed, and realizing power-off protection

Active Publication Date: 2021-01-05
BEIJING SMARTCHIP MICROELECTRONICS TECH COMPANY +2
View PDF7 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0006] In view of this, the technical problem to be solved by the present invention is how to provide a method and device for reading and writing counters, so as to solve the problems of long execution time and low reading and writing efficiency of counters in the prior art.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and device for reading and writing a counter
  • Method and device for reading and writing a counter
  • Method and device for reading and writing a counter

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0029]The reading and writing of the FLASH chip is generally operated by block or page. Even if the written data is only 1 byte, the entire block or page data containing this byte must be erased and written during actual writing. The reading and writing characteristics of the FLASH chip will greatly increase the data writing time, and will have a great impact on the execution time of some instructions that need to update the FLASH frequently. When the counter is updated according to the conventional power-down protection scheme, when 4-byte data is required to be updated, the erasing and writing operations of 4 pages of data are actually performed, and the time of these operations becomes the key factor of the execution time of the instruction .

[0030] FLASH chips are divided into two categories according to their erasing performance. The first type of chip, as long as the data in a certain place is modified, it must be erased and rewritten; the second type of chip supports...

Embodiment 2

[0046] figure 2 For the flowchart of the reading and writing method of the counter provided by another embodiment of the present invention, please refer to figure 2 , this embodiment further defines step S3 on the basis of the first embodiment.

[0047] Step S3 in this embodiment may include:

[0048] S31. According to the counter information stored in the first storage page and the second storage page, respectively determine whether the first storage page and the second storage page are empty.

[0049] Specifically, when the FLASH chip leaves the factory, the storage space in the storage page is initialized to 0xFF, that is, whether the storage page is empty can be judged by judging whether the entire page data is 0xFF. Obtain the counter information stored in the storage page. If the counter information stored in the current storage page is all 0xFF, the current storage page is empty.

[0050] S32. If both the first storage page and the second storage page are empty, th...

Embodiment 3

[0067] image 3 For the flowchart of the reading and writing method of the counter provided by the next embodiment of the present invention, please refer to image 3 , in this embodiment, the operation request is a read operation request, which is further limited on the basis of the foregoing embodiments.

[0068] Before step S4, also include:

[0069] Step S51, according to the counter information stored in the first storage page and the second storage page, respectively determine the maximum value of the counter numbers in the first storage page and the second storage page;

[0070] Step S52, respectively determining the offset address of the maximum value of the counter serial numbers in the first storage page and the second storage page relative to the first address of the first storage page;

[0071] Then step S4 includes:

[0072] Step S41 , read the value of the counter according to the operation request and the offset address of the maximum value of the counter numb...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

A reading and writing method and apparatus for a counter, a device, and a storage medium. The method comprises: receiving an operation request, wherein the operation request comprises the address of a first storage page; obtaining counter information stored in the first storage page and a second storage page, wherein the counter information comprises a sequence number, a check value, and a counter value, and the second storage page is the next storage page of the first storage page corresponding to the counter in a FLASH chip; determining a valid storage page according to the counter information stored in the first storage page and the second storage page; and performing operation processing corresponding to the operation request according to the operation request and the counter information in the valid storage page.

Description

technical field [0001] The invention relates to the technical field of communications, in particular to a method and device for reading and writing a counter. Background technique [0002] At present, with the development of power communication, more and more terminal equipment such as concentrators and collection terminals are used. In order to ensure the safety of the equipment, the Terminal Embedded Secure Access Module (TESAM for short) is usually installed in terminal equipment such as concentrators and collection terminals as the security authentication module of the equipment. When the terminal equipment interacts with the application platform through TESAM, various counters will be used. The reading and writing speed of the counter will seriously affect the processing efficiency of terminal equipment such as concentrators and collection terminals. [0003] The counter generally occupies 4 bytes of storage in the flash memory (English full name Flash EEPROM Memory, a...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Patents(China)
IPC IPC(8): G06F12/02G06M3/00
CPCG06F12/0246G06M3/00
Inventor 宁姣袁艳芳张健强张磊杜君王于波
Owner BEIJING SMARTCHIP MICROELECTRONICS TECH COMPANY
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products