CN116225317A - Data read-write method and device for user identification card, user identification card and medium - Google Patents

Data read-write method and device for user identification card, user identification card and medium Download PDF

Info

Publication number
CN116225317A
CN116225317A CN202211653300.0A CN202211653300A CN116225317A CN 116225317 A CN116225317 A CN 116225317A CN 202211653300 A CN202211653300 A CN 202211653300A CN 116225317 A CN116225317 A CN 116225317A
Authority
CN
China
Prior art keywords
file
written
type
random access
access memory
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.)
Pending
Application number
CN202211653300.0A
Other languages
Chinese (zh)
Inventor
王海涛
衣莉莉
云霞
孙阳阳
曹龙涛
韩梦梦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China United Network Communications Group Co Ltd
Original Assignee
China United Network Communications Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China United Network Communications Group Co Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN202211653300.0A priority Critical patent/CN116225317A/en
Publication of CN116225317A publication Critical patent/CN116225317A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0616Improving the reliability of storage systems in relation to life time, e.g. increasing Mean Time Between Failures [MTBF]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application provides a data reading and writing method and device of a user identification card, the user identification card and a medium. The method comprises the following steps: acquiring a file writing instruction sent by a terminal provided with the user identification card, wherein the file writing instruction comprises an identification of a file to be written and the file to be written; searching in a random access memory based on the identification of the file to be written, and judging whether the identification of the file to be written exists in the random access memory or not; if the file type of the file to be written is determined to be a first type file, and the file to be written is subjected to read-write operation in the random access memory, wherein the first type file is a type file with read-write frequency larger than a threshold value. By adopting the method, the service life of the user identification card can be effectively prolonged.

Description

Data read-write method and device for user identification card, user identification card and medium
Technical Field
The present invention relates to a user identification card technology, and in particular, to a method and apparatus for reading and writing data of a user identification card, and a medium.
Background
The program memory in the subscriber identity card usually adopts NOR FLASH (nonvolatile memory), and the number of erasures of NOR FLASH is limited, and the subscriber identity card cannot be used when the use frequency of NOR FLASH reaches the service life. In order to improve the service life of the subscriber identity module card, a data reading and writing method of the subscriber identity module card is presented.
At present, the data read-write method of the user identification card mainly comprises the following steps: 1. and backing up NOR FLASH sectors for multiple times, and switching to the backup sector after the current sector is damaged. 2. The erasing and writing equalization technology is to equalize the NOR FLASH sectors to improve the low sector utilization rate of the erasing and writing frequency.
However, in the above two modes, the read-write frequency born by each sector is relatively balanced only from the sector perspective, and the frequency of data erasing is not actually reduced, so that the service life of the subscriber identity module card cannot be effectively prolonged.
Disclosure of Invention
The application provides a data read-write method and device of a user identification card, the user identification card and a medium, which are used for solving the technical problem that the service life of the user identification card cannot be effectively prolonged in the prior art.
In a first aspect, the present application provides a data reading and writing method of a subscriber identity module card, including:
acquiring a file writing instruction sent by a terminal provided with the user identification card, wherein the file writing instruction comprises an identification of a file to be written and the file to be written;
searching in a random access memory based on the identification of the file to be written, and judging whether the identification of the file to be written exists in the random access memory or not;
if the file type of the file to be written is determined to be a first type file, and the file to be written is subjected to read-write operation in the random access memory, wherein the first type file is a type file with read-write frequency larger than a threshold value.
In one embodiment, if it is determined that the file to be written does not exist in the random access memory, the method further comprises:
searching in a nonvolatile memory based on the identification of the file to be written so as to acquire the file to be written;
judging whether the file type of the file to be written is a first type file or not according to the file type identifier carried by the file to be written;
if yes, mapping the file to be written and the identification of the file to be written into the random access memory.
In one embodiment, the file type further includes a second type file, and if the file type of the file to be written is the second type file, the method further includes:
and performing read-write operation on the files to be written in the sector of the nonvolatile memory, wherein the second type of files are files with read-write frequency smaller than or equal to a threshold value.
In one embodiment, the performing, in the random access memory, a read-write operation on the file to be written includes:
reading original data corresponding to the identification of the file to be written, and erasing from the random access memory;
and writing the file to be written into the random access memory.
In one embodiment, if the file to be written is a second type of file, the number of the second type of files is a plurality of files, and each of the files to be written carries the same association identifier, the method further includes:
reading original data of the sector where each file to be written is located into the random access memory;
writing each file to be written into the random access memory;
erasing original data of the sector where each file to be written is located;
and writing original data except the files to be written in the sectors of the files to be written in the random access memory and the data to be written in the sectors of the nonvolatile memory.
In one embodiment, before reading the original data of the sector where each file to be written is located into the random access memory, the method further includes:
judging whether each file to be written is identical to corresponding original data or not;
and if the data are not identical, executing the step of reading the original data of the sector of each file to be written into the random access memory.
In one embodiment, the method further comprises:
if the update times of the file to be written are determined to be larger than a set value within a preset duration, the file type of the file to be written is identified as a first type file;
and if the update times of the file to be written are smaller than or equal to the set value, marking the file type of the file to be written as a second type file.
In a second aspect, the present application provides a data read-write device of a subscriber identity card, including:
the instruction acquisition module is used for acquiring a file writing instruction sent by the terminal provided with the user identification card, wherein the file writing instruction comprises an identifier of a file to be written and the file to be written;
the identification judging module is used for searching in a random access memory based on the identification of the file to be written and judging whether the identification of the file to be written exists in the random access memory or not;
and the read-write operation module is used for determining that the file type of the file to be written is a first type of file if the file to be written is determined to exist in the random access memory, and performing read-write operation on the file to be written in the random access memory, wherein the first type of file is a type of file with read-write frequency larger than a threshold value.
In a third aspect, the present application provides a subscriber identity card, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement the method as described in the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium having stored therein computer-executable instructions for performing the method according to the first aspect when executed by a processor.
The data reading and writing method, the device, the user identification card and the medium of the user identification card acquire a file writing instruction sent by a terminal provided with the user identification card, wherein the file writing instruction comprises an identifier of a file to be written and the file to be written; searching in a random access memory based on the identification of the file to be written, and judging whether the identification of the file to be written exists in the random access memory or not; if the file type of the file to be written is determined to be a first type file, and the file to be written is subjected to read-write operation in the random access memory, wherein the first type file is a type file with read-write frequency larger than a threshold value. The read and write of the random access memory can not affect the service life of the random access memory. Therefore, after the user identification card receives the file writing instruction, if the file to be written is determined to be the first type of file with the reading and writing frequency larger than the threshold value after being searched in the random access memory based on the identification of the file to be written, the file to be written is mapped into the random access memory to perform the reading and writing operation, the reading and writing operation is not performed in the sector of the nonvolatile memory any more, the frequency of the reading and writing operation of the nonvolatile memory can be greatly reduced, the service life of the nonvolatile memory can be prolonged, and the service life of the user identification card is further prolonged.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
Fig. 1 is an application scenario diagram of a data read-write method for implementing a subscriber identity module card according to an embodiment of the present application;
fig. 2 is a flow chart of a method for implementing data reading and writing of a subscriber identity module card according to an embodiment of the present application;
fig. 3 is a flow chart of a method for implementing data reading and writing of a subscriber identity module card according to another embodiment of the present application;
fig. 4 is a schematic structural diagram of a data read-write method for implementing a subscriber identity module card according to the present application;
fig. 5 is a schematic diagram of a structure of a subscriber identity card in a data read-write method for implementing the subscriber identity card.
Specific embodiments thereof have been shown by way of example in the drawings and will herein be described in more detail. These drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
For a clear understanding of the technical solutions of the present application, the prior art solutions will be described in detail first.
The user identification card (USIM card) is used as the core of the identity authentication of the operator, is traditionally used for mobile phones, and can be applied to intelligent water meters, intelligent electric meters, vehicle-mounted videos, pipeline monitoring, even occasions such as bank 110 networking alarm, emergency equipment and the like along with the development of the technology of the Internet of things.
The subscriber identity card comprises hardware including a processor (CPU), a program memory, a Random Access Memory (RAM), etc., and software including a Bootloader (Bootloader), a Card Operating System (COS), a file system. The program memory generally uses a nonvolatile memory NOR FLASH (more precisely, a nonvolatile memory using a NOR eraser), and the memory card operating system, the file system, and the upper layer applications must first empty the corresponding contents of the chip and then write the corresponding contents, that is, write the corresponding contents after erasing the corresponding contents. The erasing times of the NOR FLASH are limited, and the erasing is performed according to the sector, if the high-frequency file is designed on the same FLASH page, the erasing times of the NOR FLASH of the card can be greatly accelerated in practical use. Write failures often occur when the use of NOR FLASH approaches the lifetime. Non-volatile memory (NOR FLASH) corruption can directly result in corruption of the subscriber identity card. Under the application of the scene of the internet of things, as the environmental differences of the scenes such as temperature, humidity, electromagnetism, voltage and the like are large, and the user identification cards in the patch form are partially used, if the user identification cards are damaged, the replacement is very inconvenient, and the user identification cards can have serious consequences. Therefore, some measure is required for the nonvolatile memory to improve the service life of the subscriber identity module card.
In the traditional mode, the data read-write method of the user identification card mainly comprises the following steps: 1. and backing up NOR FLASH sectors for multiple times, and switching to the backup sector after the current sector is damaged. 2. The erasing and writing equalization technology is to equalize the NOR FLASH sectors to improve the low sector utilization rate of the erasing and writing frequency. However, in the above two modes, the read-write frequency born by each sector is relatively balanced only from the sector perspective, and the frequency of data erasing is not actually reduced, so that the service life of the subscriber identity module card cannot be effectively prolonged.
The inventor has found, after having made creative studies, that the service life of the subscriber identity module card is effectively improved. The read and write of the random access memory can not affect the service life of the random access memory. Therefore, the frequency of the read-write operation of the nonvolatile memory can be greatly reduced by mapping the files with higher read-write frequency, such as the first file, into the random access memory for read-write operation, so that the service life of the nonvolatile memory is prolonged, and the service life of the user identification card is further prolonged. In a specific arrangement, after the user identification card is used as an execution subject and a file writing instruction sent by a terminal according to the user identification card is acquired, the user identification card can search in the random access memory based on the identification of the file to be written, and whether the file to be written exists in the random access memory is judged. If the file type of the file to be written is determined to be the first type file, the file to be written is read and written in the random access memory.
As shown in fig. 1, an application scenario of the method for reading and writing data of a subscriber identity card according to the embodiment of the present application includes a subscriber identity card 20 and a terminal 10 with the subscriber identity card 20 installed therein in a corresponding network architecture in the application scenario, and when the terminal 10 sends a file writing instruction to the subscriber identity card 20 in response to a user operation, the subscriber identity card 20 searches in a random access memory 30 based on an identifier of a file to be written, and determines whether the identifier of the file to be written is already in the random access memory 30. If it is determined that the file exists in the random access memory 30, determining that the file type of the file to be written is the first type of file, and performing read-write operation on the file to be written in the random access memory 30.
The following describes the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 2 is a diagram of a method for reading and writing data of a subscriber identity module according to an embodiment of the present application, and as shown in fig. 2, an execution subject of the method for reading and writing data of a subscriber identity module according to the embodiment is a subscriber identity module. The data read-write method of the user identification card provided in this embodiment includes the following steps:
step 101, acquiring a file writing instruction sent by a terminal provided with the user identification card, wherein the file writing instruction comprises an identification of a file to be written and the file to be written.
The file writing instruction is sent by a terminal installed with the user identification card and is used for indicating the user identification card to update the file. For example, when a user changes the number of the short message center and the network waiting process of connecting the terminal from one base station to another base station in the terminal operation, the position information, the base station information and the like are changed, a corresponding file to be written is generated, and the terminal is triggered to send a file writing instruction to the user identification card. Taking the example of modifying the short message center number by the user operating at the terminal, when the user identification card is updated according to the file to be written, the terminal of the user can obtain the modified number.
The file writing instruction comprises an identification of a file to be written and the file to be written. The file to be written is used as an updated file to replace the original file data, so that the data update of the user identification card can be realized. Each file to be written has the corresponding identification of the file to be written, thereby facilitating the distinction of the user identification card.
Step 102, searching in a random access memory based on the identification of the file to be written, and judging whether the file to be written exists in the random access memory.
The random access memory, namely the RAM, has high reading efficiency, so after the user identification card obtains the file writing instruction sent by the terminal, the user identification card directly searches whether the file identifier consistent with the identifier of the file to be written exists in the random access memory. If the file identification consistent with the identification of the file to be written exists in the random access memory, determining that the file to be written exists in the random access memory. If the file identification consistent with the identification of the file to be written does not exist in the random access memory, determining that the file to be written does not exist in the random access memory.
Step 103, if it is determined that the file exists in the random access memory, determining that the file type of the file to be written is a first type file, and performing read-write operation on the file to be written in the random access memory.
The first type of files are files with frequent data updating in the user identification card and the read-write frequency is generally higher than a threshold value. The read and write of the random access memory can not affect the service life of the random access memory. Therefore, in order to reduce the erasing frequency of the sector in the nonvolatile memory, the first type of files with high reading and erasing frequency are mapped into the random access memory for reading and erasing, so that the service life of the nonvolatile memory is prolonged, and the service life of the user identification card is prolonged.
If the file to be written exists in the random access memory, determining that the file type of the file to be written is a first type file and mapping the first type file into the random access memory. Mapping the file to be written into the random access memory, specifically, storing the identification of the file to be written and the file to be written into the random access memory correspondingly.
The file to be written also carries a file type identifier for judging the file type, so that the user identification card can directly determine which type of the file to be written belongs to, such as a first type of file and a second type of file. In some cases, although the user identification card may determine that the file to be written is a first type of file, there may still be a case where the file to be written cannot exist in the random access memory, because the file to be written is not yet mapped into the random access memory at this time. That is, if it is determined that the file to be written does not exist in the random access memory, the file to be written may also be a first type file.
In the application, a file writing instruction sent by a terminal provided with the user identification card is obtained, wherein the file writing instruction comprises an identification of a file to be written and the file to be written; based on the identification of the file to be written
Searching in a random access memory, and judging whether the file to be written exists in the random access memory 5; if it is determined that the file exists in the random access memory, determining the file type of the file to be written
And performing read-write operation on the files to be written in the random access memory, wherein the first files are files with read-write frequency larger than a threshold value. The read and write of the random access memory can not affect the service life of the random access memory. Therefore, after the user identification card receives the file writing instruction, the user identification card is based on
After searching the identification of the file to be written in the random access memory, determining that the file to be written is a first type file with the read-write frequency larger than 0 threshold value, mapping the file to be written into the random access memory for read-write operation, and avoiding the read-write operation
The read-write operation is carried out in the sector of the nonvolatile memory, so that the frequency of the read-write operation of the nonvolatile memory can be greatly reduced, the service life of the nonvolatile memory can be prolonged, and the service life of the user identification card can be prolonged.
As an alternative implementation manner, as shown in FIG. 3, in this embodiment, if the label of the file to be written is determined
The data read-write method of the user identification card which is not stored in the random access memory comprises the following steps: step 5, searching in a nonvolatile memory based on the identification of the file to be written to obtain the file
Files to be written.
Wherein the nonvolatile memory is NOR FLASH. In the conventional manner, when the nonvolatile memory performs read-write operation, generally, all data in the sector where the file to be written is located is read into the random access memory, and then
Writing the file to be written into the random access memory, replacing the corresponding original data, erasing all data on the sector 0 in the nonvolatile memory, and finally, writing the data in the random access memory into the NOR FLASH.
If the file identification consistent with the identification of the file to be written does not exist in the random access memory, determining that the file to be written does not exist in the random access memory, and acquiring the file to be written from the nonvolatile memory.
Step 202, judging whether the file type of the file to be written is a first type file according to the file type identifier carried by the file to be written.
5 As previously mentioned, the files to be written, and possibly files of the first type, present in the non-volatile memory may be obtained by
The user identification card identifies the file type identification carried by the file to be written. If the first type of file is determined, the file to be written is not mapped into the random access memory.
And 203, if yes, mapping the file to be written and the identification of the file to be written into the random access memory.
And 0, in order to enable the file corresponding to the identification of the file to be written to be read and written in the random access memory during subsequent updating, the file to be written and the identification of the file to be written can be mapped into the random access memory.
In this embodiment, searching is performed in a nonvolatile memory based on the identifier of the file to be written, so as to obtain the file to be written; judging whether the file type of the file to be written is a first type file or not according to the file type identifier carried by the file to be written; if yes, mapping the file to be written and the identification of the file to be written into the random access memory. When the file to be written is determined not to exist in the random access memory and is determined to be the first type of file according to the file type identification of the file to be written, the file to be written and the corresponding identification are mapped into the random access memory, so that the file to be written, which belongs to the first type of file, is updated on the user identification card for the first time, the read-write operation can be performed in the random access memory in the subsequent use, and the number of times of the read-write operation in the nonvolatile memory is reduced.
As an optional implementation manner, in this embodiment, the file type further includes a second type file, and if the file type of the file to be written is the second type file; the data read-write method of the user identification card further comprises the following steps: and performing read-write operation on the file to be written in the sector of the nonvolatile memory.
The second type of files are files with read-write frequency smaller than or equal to a threshold value. The second type of files are files with lower read-write frequency than the first type of files. And if the file type of the file to be written is determined to be the second type of file, performing read-write operation on the file to be written in the sector of the nonvolatile memory.
In this embodiment, if the file type of the file to be written is the second type file, the file to be written is read and written in the sector of the nonvolatile memory, and since the second type file is a type file with a read and write frequency smaller than or equal to the threshold value, the update is relatively infrequent, and the service life of the nonvolatile memory is less damaged, so that the read and write operation can be performed on the second type file in the sector of the nonvolatile memory.
In one embodiment. According to relevant specifications and experience, the NOR FLASH content is classified into the following 4 classes according to the read-write attribute and importance degree, and classification identifications are added to the content, for example: marking the content with high update frequency as a first type of file, mainly as a file; marking the content with low update frequency as a second type file, mainly as a file; marking the read-only and high-importance content as a third type of file, wherein the third type of file comprises a card operating system, reset information, catalog information and the like; and marking the read-only and low-importance content as a fourth type file, wherein the read-only files except the third type file.
For the third type of content, because the third type of content is the important content of the user identification card, the third type of content needs to be stored separately from the first type of files and the second type of files and is not required to be placed in the same sector with the first type of files and the second type of files, so that the important information is prevented from being lost due to the damage of other files in the nonvolatile memory sector.
As an alternative implementation manner, in this embodiment, step 103 includes the following steps:
step 301, reading original data corresponding to the identifier of the file to be written, and erasing from the random access memory.
That is, when the file to be written is read and written in the random access memory, the old data in the random access memory is read and erased, and then new data can be written in the random access memory. Here, the file to be written is new data, and the original data corresponding to the identifier of the file to be written is old data.
Step 302, writing the file to be written into the random access memory.
In this embodiment, original data corresponding to the identifier of the file to be written is erased from the random access memory; and writing the file to be written into the random access memory. The old original data is erased first, so that the file to be written as new data can be written into the random access memory to realize the updating of the data in the user identification card.
In this embodiment, if the files to be written are files of a second type, the number of the files of the second type is a plurality of files, and each of the files to be written carries the same association identifier, the data reading and writing method of the user identification card further includes the following steps:
step 401, reading original data of the sector where each file to be written is located into the random access memory.
When the factory setting is carried out, the association identifiers are added to a plurality of files with fixed sequence in the updating sequence according to experience, the files with the same association identifiers are stored in the same sector in the nonvolatile memory, and the erasing times of the nonvolatile memory can be reduced. The files to be written carry the same associated identifier, which indicates that the files to be written have a fixed sequence in the update sequence.
In the use process after leaving the factory, if the files to be written are all the files of the second type and the files to be written carry the same association identifier, the original data of the sector where each file to be written is located is read into the random access memory. Reading into the random access memory can be understood as a copying process, and original data of the sector where each file to be written is located is not modified and updated. The original data of the sector where each file to be written is located not only the original data corresponding to each file to be written, but also other data stored in the sector of the nonvolatile memory.
Step 402, writing each file to be written into the random access memory.
The writing of each file to be written into the random access memory means that each file to be written is used as new data to replace corresponding old data, and data update is realized in the random access memory.
And step 403, erasing original data of the sector where each file to be written is located.
The erasing of the original data corresponding to the sector where each file to be written is located refers to deleting the original data corresponding to each file to be written in the nonvolatile memory and other data in the sector of the nonvolatile memory.
Step 404, writing original data except the files to be written in the sectors of the files to be written in the random access memory and the data to be written in the sectors of the nonvolatile memory.
The original data of the sector where the files to be written are located, except the files to be written, refers to other data which are not updated except the files to be written and are located in the sector where the files to be written are located. Step 404 here is to erase the data content of the sector where each file to be written is located, and then write the other data, which is not updated, of the sector where each file to be written is originally read into the random access memory, and the updated each file to be written into the sector where each file to be written is located.
In this embodiment, if the files to be written are files of a second type, the number of the files of the second type is multiple, and each file to be written carries the same association identifier, original data of a sector where each file to be written is located is read into the random access memory; writing each file to be written into the random access memory; erasing original data of the sector where each file to be written is located; and writing original data except the files to be written in the sectors of the files to be written in the random access memory and the data to be written in the sectors of the nonvolatile memory. The files to be written which carry the same association identifier and belong to the second type of files are read into the random access memory first, and are written into the sector of the nonvolatile memory after all the files are updated, so that the number of times of erasing and writing of the nonvolatile memory can be reduced without executing one-time reading and writing operation on the files to be written respectively.
As an optional implementation manner, in this embodiment, before step 401, step 501 is further included to determine whether each file to be written is identical to the corresponding original data; if the determination result in step 501 is not identical, step 401 is performed.
The original data corresponding to each file to be written refers to old data corresponding to each file to be written before the update.
In this embodiment, whether each file to be written and the corresponding original data are identical is first determined, and under the condition that the files are not identical, the original data of the sector where each file to be written is located is read into the random access memory, so that it is possible to avoid executing steps 401 to 4904 for one pass under the condition that the data content is not updated, and it is beneficial to relatively reduce the erasing times of the sector of the nonvolatile memory.
As an alternative implementation manner, in this embodiment, the steps include the following steps:
in step 501, if it is determined that the number of updates of the file to be written is greater than the set value within the preset duration, the file type of the file to be written is identified as a first type file.
After the terminal is started and before the terminal is shut down, a status instruction is sent to the user identification card according to a fixed time interval so as to acquire the current state of the user identification card. The preset duration may be determined according to the status times, for example, the user identification card receives 1000 status instructions sent by the terminal as the preset duration. If the update times of the files to be written are larger than the set value within the preset time, the update frequency of the files to be written is higher, and the file type identification of the files to be written can be modified from the second type files to the first type files. And in the subsequent updating process, performing read-write operation in the random access memory according to the mode of the first type of files.
The set value may be the number of updates of a file manually preset. For each file to be written, once updated, the user identification card records and accumulates the number of updating times until a preset duration is reached. The setting value is 50 times, the update times of the recorded A file are 10 times in the preset time period of 0-1000 status, and the update times of the recorded A file are 30 times in the preset time period of 1001-2000 status. And in the two preset time periods, the file A does not reach the set value and is the second type file.
Step 502, if it is determined that the update times of the file to be written is less than or equal to the set value, identifying the file type of the file to be written as a second type file.
If the update times of the file to be written is greater than the set value within the preset time, it is determined that the update frequency of the file to be written is higher, and the file type identifier of the file to be written can be modified from the first type file to the second type file. And in the subsequent updating process, performing read-write operation in the sector of the nonvolatile memory according to the mode of the second type file.
In this embodiment, if it is determined that the number of updates of the file to be written is greater than a set value within a preset duration, the file type of the file to be written is identified as a first type file; and if the update times of the file to be written are smaller than or equal to the set value, marking the file type of the file to be written as a second type file. The file type of the file to be written is dynamically adjusted according to the update frequency of the file to be written in the preset time length, so that the service life of the user identification card is prolonged.
Fig. 4 is a schematic structural diagram of a data read/write device of a subscriber identity card according to an embodiment of the present application, and as shown in fig. 4, the data read/write device 40 of a subscriber identity card according to the embodiment is located in the subscriber identity card, and the data read/write device 40 of a subscriber identity card according to the embodiment includes:
the instruction acquisition module is used for acquiring a file writing instruction sent by the terminal provided with the user identification card, wherein the file writing instruction comprises an identifier of a file to be written and the file to be written;
the identification judging module is used for searching in a random access memory based on the identification of the file to be written and judging whether the identification of the file to be written exists in the random access memory or not;
and the read-write operation module is used for determining that the file type of the file to be written is a first type of file if the file to be written is determined to exist in the random access memory, and performing read-write operation on the file to be written in the random access memory, wherein the first type of file is a type of file with read-write frequency larger than a threshold value.
Optionally, the identifier judging module is further configured to: if the file to be written does not exist in the random access memory, searching in a nonvolatile memory based on the identification of the file to be written so as to acquire the file to be written; judging whether the file type of the file to be written is a first type file or not according to the file type identifier carried by the file to be written; if yes, mapping the file to be written and the identification of the file to be written into the random access memory.
Optionally, the data read-write device of the user identification card further includes a sector read-write module, and when the file type further includes a second type file, if the file type of the file to be written is the second type file, the data read-write module is configured to: and performing read-write operation on the files to be written in the sector of the nonvolatile memory, wherein the second type of files are files with read-write frequency smaller than or equal to a threshold value.
Optionally, the read-write operation module is specifically configured to, when performing a read-write operation on the file to be written in the random access memory: reading original data corresponding to the identification of the file to be written, and erasing from the random access memory; and writing the file to be written into the random access memory.
Optionally, when the files to be written are files of a second type, the number of the files of the second type is a plurality of, and each of the files to be written carries the same association identifier, the sector read-write module is specifically configured to: reading original data of the sector where each file to be written is located into the random access memory; writing each file to be written into the random access memory; erasing original data of the sector where each file to be written is located; and writing original data except the files to be written in the sectors of the files to be written in the random access memory and the data to be written in the sectors of the nonvolatile memory.
Optionally, the data read-write device of the user identification card is further configured to: if the update times of the file to be written are determined to be larger than a set value within a preset duration, the file type of the file to be written is identified as a first type file; and if the update times of the file to be written are smaller than or equal to the set value, marking the file type of the file to be written as a second type file.
Fig. 5 is a block diagram of a subscriber identity card, which may be as shown in fig. 5, according to an exemplary embodiment, including: a memory 51, a processor 52; memory 51 is a memory for storing processor-executable instructions; the processor 52 is configured to execute a computer program or instructions to implement the method for reading and writing data of a subscriber identity card provided in any of the above embodiments.
The memory 51 is used for storing programs. In particular, the program may include program code including computer-operating instructions. The memory 51 may comprise a high-speed RAM memory or may further comprise a non-volatile memory (non-volatile memory), such as at least one disk memory.
The processor 52 may be a central processing unit (Central Processing Unit, abbreviated as CPU), or an application specific integrated circuit (Application Specific Integrated Circuit, abbreviated as ASIC), or one or more integrated circuits configured to implement embodiments of the present disclosure.
Alternatively, in a specific implementation, if the memory 51 and the processor 52 are implemented independently, the memory 51 and the processor 52 may be connected to each other and communicate with each other through the bus 53. The bus 53 may be an industry standard architecture (Industry Standard Architecture, abbreviated ISA) bus 53, an external device interconnect (Peripheral Component, abbreviated PCI) bus 53, or an extended industry standard architecture (Extended Industry Standard Architecture, abbreviated EISA) bus 53, among others. The bus 53 may be classified into an address bus 53, a data bus 53, a control bus 53, and the like. For ease of illustration, only one thick line is shown in fig. 5, but not only one bus 53 or one type of bus 53.
Alternatively, in a specific implementation, if the memory 51 and the processor 52 are integrated on a chip, the memory 51 and the processor 52 may perform the same communication through an internal interface.
A non-transitory computer readable storage medium, which when executed by a processor of a subscriber identity card, causes the subscriber identity card to perform the method of reading and writing data of the subscriber identity card.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the present application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A data read-write method for a subscriber identity card, the method being applied to the subscriber identity card, the method comprising:
acquiring a file writing instruction sent by a terminal provided with the user identification card, wherein the file writing instruction comprises an identification of a file to be written and the file to be written;
searching in a random access memory based on the identification of the file to be written, and judging whether the identification of the file to be written exists in the random access memory or not;
if the file type of the file to be written is determined to be a first type file, and the file to be written is subjected to read-write operation in the random access memory, wherein the first type file is a type file with read-write frequency larger than a threshold value.
2. The method of claim 1, wherein if it is determined that the file to be written does not exist in the random access memory, the method further comprises:
searching in a nonvolatile memory based on the identification of the file to be written so as to acquire the file to be written;
judging whether the file type of the file to be written is a first type file or not according to the file type identifier carried by the file to be written;
if yes, mapping the file to be written and the identification of the file to be written into the random access memory.
3. The method of claim 2, wherein the file type further comprises a second type of file, and wherein if the file type of the file to be written is the second type of file, the method further comprises:
and performing read-write operation on the files to be written in the sector of the nonvolatile memory, wherein the second type of files are files with read-write frequency smaller than or equal to a threshold value.
4. The method of claim 1, wherein performing a read-write operation on the file to be written in the random access memory comprises:
reading original data corresponding to the identification of the file to be written, and erasing from the random access memory;
and writing the file to be written into the random access memory.
5. The method of claim 3, wherein if the file to be written is a second type of file, the number of the second type of file is plural, and each of the files to be written carries the same association identifier, the method further comprises:
reading original data of the sector where each file to be written is located into the random access memory;
writing each file to be written into the random access memory;
erasing original data of the sector where each file to be written is located;
and writing original data except the files to be written in the sectors of the files to be written in the random access memory and the data to be written in the sectors of the nonvolatile memory.
6. The method of claim 5, further comprising, prior to reading original data of a sector in which each of the files to be written is located into the random access memory:
judging whether each file to be written is identical to corresponding original data or not;
and if the data are not identical, executing the step of reading the original data of the sector of each file to be written into the random access memory.
7. The method according to claim 1, wherein the method further comprises:
if the update times of the file to be written are determined to be larger than a set value within a preset duration, the file type of the file to be written is identified as a first type file;
and if the update times of the file to be written are smaller than or equal to the set value, marking the file type of the file to be written as a second type file.
8. A data read-write device for a subscriber identity card, said device comprising:
the instruction acquisition module is used for acquiring a file writing instruction sent by the terminal provided with the user identification card, wherein the file writing instruction comprises an identifier of a file to be written and the file to be written;
the identification judging module is used for searching in a random access memory based on the identification of the file to be written and judging whether the identification of the file to be written exists in the random access memory or not;
and the read-write operation module is used for determining that the file type of the file to be written is a first type of file if the file to be written is determined to exist in the random access memory, and performing read-write operation on the file to be written in the random access memory, wherein the first type of file is a type of file with read-write frequency larger than a threshold value.
9. A subscriber identification card, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement the method of any one of claims 1-7.
10. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor are adapted to carry out the method of any one of claims 1-7.
CN202211653300.0A 2022-12-21 2022-12-21 Data read-write method and device for user identification card, user identification card and medium Pending CN116225317A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211653300.0A CN116225317A (en) 2022-12-21 2022-12-21 Data read-write method and device for user identification card, user identification card and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211653300.0A CN116225317A (en) 2022-12-21 2022-12-21 Data read-write method and device for user identification card, user identification card and medium

Publications (1)

Publication Number Publication Date
CN116225317A true CN116225317A (en) 2023-06-06

Family

ID=86583368

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211653300.0A Pending CN116225317A (en) 2022-12-21 2022-12-21 Data read-write method and device for user identification card, user identification card and medium

Country Status (1)

Country Link
CN (1) CN116225317A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117573042A (en) * 2024-01-16 2024-02-20 深圳前海深蕾半导体有限公司 Storage space allocation method, device and system, terminal equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117573042A (en) * 2024-01-16 2024-02-20 深圳前海深蕾半导体有限公司 Storage space allocation method, device and system, terminal equipment and storage medium

Similar Documents

Publication Publication Date Title
US7743292B2 (en) Apparatus and method for memory card testing
CN103544031B (en) The android system upgrade method and system of multi partition peripheral storage device
CN109213448B (en) Method, device, equipment and storage medium for erasing and writing data of smart card
CN104346265A (en) Terminal equipment and acquisition method and device for log information thereof
CN116225317A (en) Data read-write method and device for user identification card, user identification card and medium
CN104866388B (en) Data processing method and device
WO2015117356A1 (en) Start-up method and communication terminal
CN108153548A (en) A kind of EMMC firmware upgrade methods and device
CN114089915B (en) File additional writing operation method and device based on FLASH memory
CN105472599A (en) Method for accessing SIM cards and double-card mobile terminal
CN101131649A (en) Updating speed improving method for read-only memory of device with flash memory
CN109164990B (en) Memory data updating method, device, equipment and storage medium
CN115328851A (en) Data protection method, device, equipment and medium
CN112908390B (en) Data storage method, device, electronic equipment and storage medium
CN102202129B (en) Method for loading mobile phone operating system
CN110874416B (en) Image characteristic value storage method and device and electronic equipment
CN113849269A (en) Method and device for adding GPU (graphics processing Unit) resources in virtual machine
CN109471598B (en) Data deleting method and device of storage equipment and computer readable storage medium
CN109388571B (en) Method and device for acquiring identification information, computer equipment and storage medium
CN113254273A (en) Method, system, device and medium for real-time recovery of principal metadata
CN111090542A (en) Abnormal block identification method and device based on abnormal power failure and computer equipment
US20080300019A1 (en) Cellular phone
CN114816833B (en) Writing method, device and system of flash data
CN110795297B (en) Electronic equipment testing method and device
CN111026896B (en) Feature value storage and processing method, device and storage device

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