CN108664482A - FLASH memory and storage file management method - Google Patents

FLASH memory and storage file management method Download PDF

Info

Publication number
CN108664482A
CN108664482A CN201710189447.1A CN201710189447A CN108664482A CN 108664482 A CN108664482 A CN 108664482A CN 201710189447 A CN201710189447 A CN 201710189447A CN 108664482 A CN108664482 A CN 108664482A
Authority
CN
China
Prior art keywords
file
page
written
memory
page number
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
Application number
CN201710189447.1A
Other languages
Chinese (zh)
Other versions
CN108664482B (en
Inventor
楼鹏
王旬贵
谢跃书
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Geehy Semiconductor Co Ltd
Original Assignee
Nasida Ltd By Share 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 Nasida Ltd By Share Ltd filed Critical Nasida Ltd By Share Ltd
Priority to CN202110935551.7A priority Critical patent/CN113641630A/en
Priority to CN201710189447.1A priority patent/CN108664482B/en
Priority to CN202110935528.8A priority patent/CN113641629A/en
Publication of CN108664482A publication Critical patent/CN108664482A/en
Application granted granted Critical
Publication of CN108664482B publication Critical patent/CN108664482B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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/11File system administration, e.g. details of archiving or snapshots
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11CSTATIC STORES
    • G11C16/00Erasable programmable read-only memories
    • G11C16/02Erasable programmable read-only memories electrically programmable
    • G11C16/06Auxiliary circuits, e.g. for writing into memory
    • G11C16/08Address circuits; Decoders; Word-line control circuits

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The present invention provides a kind of FLASH memory and storage file management method, FLASH memory for realizing file write-in, reading or delete operation, including:The memory blocks FLASH, the memory blocks FLASH are divided into the multiple pages originated with No. 0 with the FLASH least units wiped, and the memory blocks FLASH include:Boot section is used to describe the information of FLASH memory;Memory page volume includes multiple items, and the sequence of addresses that each item preserves is corresponding with item No., the page number of next memory page for storage file data, and item No. is corresponded with corresponding memory page page number;Information of the file description volume for describing storage file, the information of storage file include:Fileinfo and file start page number at;File data storage region is used for save file data.FLASH memory provided by the invention and storage file management method, it is possible to reduce the memory space needed for memory page volume, and promote index efficiency.

Description

FLASH memory and storage file management method
Technical field
The present invention relates to FLASH memory technical field more particularly to a kind of FLASH memory and storage file managers Method.
Background technology
FLASH memory is a kind of nonvolatile memory (Non-Volatile Memory) based on semiconductor technology, Have many advantages, such as that low in energy consumption, capacity is big, small, light-weight, access speed is high, gradually replaces other semiconductor storage units And it is widely used in mobile electronic product.Any FLASH memory all has fixed storage capacity, write operation can only It is carried out in unit that is empty or having wiped, so in most cases, erasing must be first carried out before carrying out write operation, But the service life of FLASH chip is limited, is more than maximum erasing times, is easily damaged FLASH chip.
FLASH fixed partitions are several storages according to FLASH capacity, number of files and size by common FLASH chip Region, then the corresponding initial address of each file is recorded, when needing the operations such as to read and write certain file, wipe Its corresponding initial address and area size are first found, the address is then arrived and carries out the operations such as data reading and writing, erasing.The program Simply, easy to implement, but the size that estimate file is allocated, if estimating inaccuracy, leads to not correctly store Or wasting space resource.
In view of the above-mentioned problems, application No. is 01142240.8, it is entitled《FLASH storage file management methods》Patent application A kind of more complete FALSH method for managing system is proposed, FLASH memory partitionings are file index area and number of files by this method According to the memory block regions Liang Ge, file index area is used to record the distribution information of file directory and basic allocation unit " block ", file Data storage area is used for the particular content of storage file.Used in it block distribution information include this block block number, seizure condition with And the chain table pointer of next piece of direction, it realizes the reasonable distribution of FLASH memory capacity, flexibly use.But the prior art Distribution information includes this block block number, seizure condition and the chain table pointer for being directed toward next piece, and the memory space of occupancy is more, and is indexed Efficiency is low.
Invention content
A kind of FLASH memory of present invention offer and storage file management method, it is existing in the prior art for solving The technical problem that the memory space that distribution information occupies is more and index efficiency is low.
The first aspect of the present invention provides a kind of FLASH memory, for realizing the write-in of file, reading or deletes behaviour Make, including:The memory blocks FLASH, the memory blocks FLASH with the FLASH least units wiped be divided into No. 0 originate it is more A page, the memory blocks FLASH include:
Boot section, the information for describing the FLASH memory;
Memory page is rolled up, the distribution information for indicating page, and the distribution information includes multiple items, and each item is for storing text The page number of next memory page of number of packages evidence, the sequence of addresses stored in each item is corresponding with item No., and item No. with it is corresponding Memory page page number correspond;
File description volume, the information of the information for describing storage file, the storage file include:Fileinfo and text Part starts page number at;
File data storage region is used for save file data.
The second aspect of the present invention provides a kind of storage file management method based on above-mentioned FLASH memory, packet It includes:
Read the information of file to be written;
It determines the size of the file description of the file to be written, and judges that the description volume of the file in FLASH memory is It is no to have sufficient space that the file description is written;
If there is sufficient space that the file description is written in the file description volume, judge in the FLASH memory File data storage region whether have enough space that file data to be written is written;
If the file data storage region there are enough spaces that the data of the file to be written are written, the text is searched for First blank page page number of part data storage area is started page number at as file, and the file is written in file description volume Description;
What is described since the file starts page number at beginning in the file data storage region write-in number of files to be written According to;
The page chained list relationship stored in file data storage region according to file updates storage page volume, terminates ablation process.
The third aspect of the present invention provides a kind of storage file management method based on above-mentioned FLASH memory, packet It includes:
File is read from file description volume to start page number at;
It reads the file and starts page number at the file data that corresponding memory page is stored;
The page number for reading one page under file is rolled up according to file memory page, and reads what the corresponding memory page of the page number was stored File data, until file data reading finishes.
The fourth aspect of the present invention provides a kind of storage file management method based on above-mentioned FLASH memory, packet It includes:
Starting page number at for the file address addr that starts page number at of description and file data is read from file description volume PageNum, and the specified address contents of file description starts page number at during memory page is rolled up address addr are set as 0;
According to the content for starting page number at inquiry respective items of file data in memory page volume, with obtaining next page number Location addr and next page number pageNum, and by the memory page roll up in next page number address addr specify address curriculum offering It is 0, until file data deletion finishes.
FLASH memory provided by the invention and storage file management method are protected by each item in rolling up memory page The sequence of addresses deposited it is consistent with item No. (0 at 0 addressing, 1 at 2 addressings, 2 at 4 addressings), item No. is deposited with corresponding It stores up page page number to correspond, so as to form the mapping relations between address, item No. and page, passes through above-mentioned mapping relations, storage Page volume only needs to preserve the page number of lower one page, you can indicates the distribution service condition of page, the storage reduced needed for memory page volume is empty Between, and index efficiency is promoted, it is effectively improved the practicability of the FLASH memory.
Description of the drawings
Attached drawing is used to provide further understanding of the present invention, and a part for constitution instruction, the reality with the present invention It applies example and is used together to explain the present invention, be not construed as limiting the invention.In the accompanying drawings:
The structural schematic diagram for the FLASH memory frame structure that Fig. 1 is provided by the embodiment of the present invention;
The correspondence figure for FLASH memory pages the volume addressing and item No. that Fig. 2 is provided by the embodiment of the present invention;
Fig. 3 is read the structural schematic diagram of use-case by the FLASH files that the embodiment of the present invention provides;
Fig. 4 provides a kind of flow of the storage file management method based on FLASH memory by one embodiment of the invention Figure;
Fig. 5 detects whether to exist corresponding with the file to be written duplication of name file by what the embodiment of the present invention provided Flow chart;
Fig. 6 by the embodiment of the present invention provide judgement leave unused file file describe volume space whether enough write-in described in The flow chart of file description;
Releasable space-wise flow chart in the FLASH releasing documents description volume that Fig. 7 is provided by the embodiment of the present invention;
It is described to be written whether the memory space for the idle file of judgement that Fig. 8 is provided by the embodiment of the present invention is written enough The flow chart of file data;
Fig. 9 discharges deleted document occupied space method flow diagram by the FLASH that the embodiment of the present invention provides;
The whether wrong flow chart of the file data to be written is written by the detection that the embodiment of the present invention provides in Figure 10;
The method flow diagram based on FLASH memory written document that Figure 11 is provided by the embodiment of the present invention;
Figure 12 provides a kind of stream of the storage file management method based on FLASH memory by another embodiment of the present invention Cheng Tu;
Figure 13 provides a kind of stream of the storage file management method based on FLASH memory by further embodiment of this invention Cheng Tu.
Specific implementation mode
With reference to the accompanying drawings and examples, the specific implementation mode of the present invention is described in further detail.Following instance For illustrating the present invention, but it is not limited to the scope of the present invention.
In order to support the operations such as the random writing to FLASH file datas, reading or deletion, an embodiment of the present invention provides A kind of FLASH memory, the FLASH memory include the memory blocks FLASH, and the minimum of FLASH erasings is pressed in the memory blocks FLASH Unit is divided in order to the multiple pages originated for No. 0, then divides the storage region of FLASH by function.In the present embodiment, FLASH storage chips be can be applied into wireless near field communication card (NearFieldCommunication, abbreviation nfc card) In, it should be noted that " page " in the present embodiment is defined as the least unit of FLASH erasings, and " volume " is defined as preserving The one or more of a kind of data is continuous " page ", and the memory capacity per " page " is 1024 bytes, and memory capacity is the FLASH cores of 2M FLASH memory partitionings can be page 2048 by piece.Every page also may be defined as different amount of capacity.
Fig. 1 is the structural schematic diagram of FLASH memory frame structure, and refer to the attached drawing 1 is it is found that the present embodiment deposits FLASH FLASH in reservoir, which is deposited, divides into boot section, memory page volume, file description volume and file data storage region.Wherein, boot section, Memory page is rolled up and file description volume belongs to system area, the distribution of information, fileinfo and page for describing FLASH memory Service condition only takes up a small number of memory pages;File data storage region is used for the data of storage file, occupies most of memory page, Specifically, the concrete function of the above various pieces is act as:
Boot section, the information for describing this FLASH memory, as store name, version number, memory generated time with And the type etc. of memory, details is as shown in table 1:
Table 1
Starting byte position Title Occupy byte Current Content
0 Memory store name 4 “NFSS”
4 Version number 4 “1000”
8 Page length degree 2 1024
10 Entire storage number of pages 2 1994
12 Boot section starts page number at 2 0
14 Boot section number of pages 2 1
16 Memory page volume initialize page number 2 1
18 Memory page scrolling number 2 4
20 File describes volume initialize number 2 5
22 File description volume occupies number of pages 2 5
24 File data area starts page number at 2 10
26 File data area occupies number of pages 2 1984
28 Memory generated time 8
36 Type of memory encodes 2
38 Retain 256
294 Memory name length 2
296 Memory name It is indefinite
It is remaining Retain
As seen from the above table, the memory capacity of FLASH memory used in the embodiment of the present invention is 2M, is wiped by FLASH Least unit be divided into page 2048, entire storage is page 1994 using number of pages.Boot section start page is page 0, occupies page 1 altogether; Memory page volume initialize page is page 1, occupies page 4 altogether;File describe page volume initialize page be page 5, altogether occupy page 5, remaining page 10 to Page 1984 is assigned as file data storage region.
Memory page is rolled up, and is used to indicate the distribution information of page, is illustrated the list structure of the page of document data saving.Distribution letter Breath includes multiple items, and each item is used for the page number of next memory page of storage file data, and each single item in memory page volume is One 16 integers occupy two octets, so the addressing since memory page rolls initial point is twice of a serial number. As shown in Fig. 2, sequence of addresses that each item preserves it is corresponding with item No. (0 at 0 addressing, 1 at 2 addressings, 2 in 4 volumes At location), it should be noted that corresponding at this can be consistent, in addition, one a pair of item No. and corresponding memory page page number It answers (the corresponding page 1,2 of 0 corresponding page 0,1 corresponding page 2), what the content of item normally indicated is next storage of file data The page number of page.Such as 100H addresses are 200H bytes, and if the content of this two byte is 70H, file where this is indicated The 100H pages of data field is used, the next page number used in this file is 70H.
It should be noted that the embodiment of the present invention makees as defined below each content:1) 0x0000 indicates that this is right Answer page data invalid;2) 0xFFFF indicates that corresponding page does not write data;3) 0x7FFF expressions are end of file;4) 0x0006 is indicated System area;5) 0x0003 indicates that this page is bad page.
File description volume, the information for describing storage file, each single item correspond to one preserved in FLASH memory The file of file describes, and content is starting page number at for fileinfo and file, each structure is as shown in table 2:
Table 2
Initial position Title Occupy byte
0 File describes length 2
2 File attribute 2
4 The file generated time 8
12 File starts page number at 2
14 File size 4
18 File verification word 16
34 Reserved area 16
50 Filename length 2
52 Filename It is indefinite
The file description of one file, including information can be that file start page number at and file size, can also include One or more other information, such as filename, file attribute, file size, file are started page number at the file generated time etc..
File data area is used for the preservation of file data, accounts for most of page of the memory blocks FLASH.
FLASH memory provided in this embodiment, the sequence of addresses preserved by each item in rolling up memory page and item It is number consistent (0 at 0 addressing, 1 at 2 addressings, 2 at 4 addressings), item No. and one a pair of corresponding memory page page number It answers, so as to form the mapping relations between address, item No. and page, by above-mentioned mapping relations, memory page volume only needs to preserve The page number of lower one page, you can indicate the distribution service condition of page, reduce the memory space needed for memory page volume, and promote index effect Rate is effectively improved the practicability of the FLASH memory.
Illustrate the file management method of the FLASH files of the embodiment of the present invention with a concrete use case below.Fig. 3 indicates text The structure of part sample.txt files, the memory blocks of page preceding ten of FLASH memory are divided into the system area of FLASH, remaining to be The file data storage region of FLASH.
According to the information of file description volume it is found that the entitled sample.txt of the file of this file, file start page number at for 0x000c, file size 0x0600, i.e. 1536 bytes, one page can store 1024 bytes, then the number of this document sample.txt According to page two need to be occupied;
The starting page number at as 0x000c of this file is learnt from file description volume, according to the mapping of item No. and page distribution volume addressing Relationship searches 0x000c, content 0x0010 in page distribution volume, i.e. lower one page page number of file is 0x0010, by It is 0x0001 in 0x0010 contents, lower one page pointing system area indicates do not have file storage data below;Therefore, literary For the document data saving of part sample.txt in 0x000c and 0x0010 pages two, the storage zone of file is by file header File starts page number at the page number chained list decision of beginning.
In embodiments of the present invention, page distribution volume each item preserve sequence of addresses it is consistent with item No. (0 0 address Place, 1 at 2 addressings, 2 at 4 addressings), each item is corresponded with corresponding memory page, therefore passes through address, item No. With the mapping relations of page, memory page volume only needs to preserve the page number of lower one page, you can indicates that the distribution service condition of page, reduction are deposited The memory space needed for page volume is stored up, and promotes index efficiency.
After carrying out above-mentioned division to the memory blocks FLASH, it can be executed according to the file management method of the embodiment of the present invention The writing, reading and delete operation of file.After system is contacted with FLASH memory foundation, it is (above-mentioned that nfc card is read first FLASH memory is applied in nfc card) memory page volume and file description volume, and extraction document list, so as in whole operation File operation quickly is carried out to nfc card in the process.
Fig. 4 provides a kind of flow of the storage file management method based on FLASH memory by one embodiment of the invention Figure;Refer to the attached drawing 4, should it is found that present embodiments provide a kind of storage file management method based on above-mentioned FLASH memory It is file wiring method that storage file, which manages document method, specifically, the process of write-in file is by parameter-file description, Purpose is to establish the chained list relationship of file description and page, and write data into file data storage region, specifically, including:
S101:Read the information of file to be written;
Wherein, the information of file to be written may include the title of file to be written, the length of file to be written and wait for The content etc. of file is written.
S102:It determines the size of the file description of file to be written, and judges that the description volume of the file in FLASH memory is It is no to have sufficient space write-in file description;
The file description that file to be written can be determined by the information of above-mentioned read file to be written, so as to The size for determining file description, since this document description needs to be written in FLASH memory, therefore, it is necessary to judge that file is retouched State whether volume has sufficient space write-in file description, to ensure being normally written for file description.
S1031:If there is sufficient space write-in file description in file description volume, the file in FLASH memory is judged Whether data storage area has enough spaces that file data to be written is written;
When confirming in file description volume there are when enough spaces, then for explanation is described at this point for file, Ke Yijin The normal write operation of row, due to the purpose of the present embodiment is that the data for being written into file are written in FLASH memory, Therefore, it in order to ensure that the data of file to be written are normally written, needs to judge whether file data storage region has enough spaces File data to be written is written.
S1041:If there are the data that file to be written is written in enough spaces, search file data in file data storage region First blank page page number of memory block is started page number at as file, and the write-in file description in file description volume;
When confirm file data storage region have enough spaces that the data of file to be written are written, then file is retouched at this time It states with for the data of file to be written, can carry out normal write operation, can be that write operation carries out standard therefore It is standby, such as:It can determine that file starts page number at, this document starts page number at the writing position for determining file to be written, generally In the case of, first blank page page number in file data storage region can be started page number at as file, and file can be described It is written in file description volume.
S105:What is described since file starts page number at beginning in file data storage region write-in file data to be written.
S106:The page chained list relationship stored in file data storage region according to file updates storage page volume, and end was written Journey.
After file description is written to file description volume, it can be opened at the position started page number in file description Begin that file data to be written is written, so as to complete file write operations.
It should be noted that judging whether the file description volume in FLASH memory has sufficient space write-in in above-mentioned After file description, this method can also include:
S1032:If not having sufficient space write-in file description in file description volume, output file describes volume space deficiency It is abnormal.
Further, judge whether the file data storage region in FLASH memory there are enough spaces to write in above-mentioned After entering file data to be written, this method can also include:
S1042:If there is no enough spaces that the data of file to be written, output file is written in file data storage region Data storage area insufficient space is abnormal.
Storage file management method provided in this embodiment is realized by using the structure of above-mentioned FLASH memory The process of file is written, specifically, the FLASH memory memory page is rolled up in each item sequence of addresses and the item No. one that preserve Cause (0 at 0 addressing, 1 at 2 addressings, 2 at 4 addressings), item No. is corresponded with corresponding memory page page number, from And the mapping relations between address, item No. and page are formd, by above-mentioned mapping relations, memory page volume only needs to preserve lower one page Page number, you can indicate the distribution service condition of page, reduce the memory space needed for memory page volume, and promote index efficiency, have Improve to effect the quality and efficiency of file write-in.
The flow detected whether in the presence of duplication of name file corresponding with file to be written that Fig. 5 is provided by the embodiment of the present invention Figure, on the basis of the above embodiments, with continued reference to attached drawing 5 it is found that making to further increase the storage file management method Reliability, after the information for reading file to be written, set method to further include:
S201:Detect whether there is file of bearing the same name corresponding with file to be written;
After the information for getting file to be written, can according to the information of file to be written to stored file into Row detection, detects and whether there is file of bearing the same name corresponding with file to be written in stored file, specifically, can will be to be written The name information for entering name information and storage file in the information of file carries out analysis comparison.
S202:If in the presence of duplication of name file abnormal operation is exported;
If it is identical as the name information for having stored information for the name information in fileinfo to be written to analyze comparison result, It then can be confirmed there is file of bearing the same name corresponding with file to be written in FLASH memory, at this time it is possible that same text Part performs the process of secondary write-in, therefore, in order to avoid the maloperation of write operation, can export duplication of name file and grasp extremely Make, so that user or other detection devices detect specific reason, and corresponding processing operation can be carried out.
S203:If being not present, it is determined that the size of the file description of file to be written.
If it is different from the name information for having stored information for the name information in fileinfo to be written to analyze comparison result, It then can be confirmed and do not store above-mentioned file to be written in FLASH memory at this time, it is to be written so as to be normally carried out The write operation of file, you can, later can be according to above-described embodiment to get the size of the file description of file to be written In step 102- steps 105 carry out subsequent write operation, specifically refer to above statement content, details are not described herein.
Storage file management method provided in this embodiment, by detect FLASH memory in the presence or absence of with it is to be written File is born the same name file accordingly, so as to avoid the operation of secondary accidentally write-in has been carried out to identical file, is effectively guaranteed pair File to be written carries out the reliability of write operation, and further improving stabilization that the storage file management method uses can By property.
The file for the idle file of judgement that Fig. 6 is provided by the embodiment of the present invention describes whether volume space is written file enough The flow chart of description;Releasable space-wise flow in the FLASH releasing documents description volume that Fig. 7 is provided by the embodiment of the present invention Figure;On the basis of the above embodiments, with continued reference to attached drawing 6-7 it is found that the present embodiment is the of search file data storage area Before one blank page page number is started page number at as file, method can be set to further include:
S301:Judge that whether enough the file of idle file describes volume space write-in file description;
May include two kinds of situations, a kind of situation when thering are enough spaces to be described file is written in file description volume For leave unused file file describe volume space with enough spaces come be written file description, another situation be entire file retouch Stating volume, (including the file of idle file is described volume space, is described the file of volume space and inactive file using the file of file Description volume space etc.) it is described with enough spaces file is written, therefore, make to further increase this document management method Reliability needs to judge that whether enough the file of idle file describes volume space write-in file description, specifically sentence The size that the file of size and idle file that file describes can be described volume space by disconnected process carries out analysis comparison.
S302:If insufficient space, the occupied space of inactive file description, and the of search file data storage area are discharged One blank page page number is started page number at as file;Alternatively,
If the file of idle file describes volume space and is not enough to write-in file description, at this point, in order to ensure file description It is normally written, the occupied space of inactive file description can be discharged, to increase the space size for storage file description, and Fig. 7 is a kind of embodiment in releasable space in FLASH releasing documents description volume, and the occupancy of release inactive file description is empty Between process file description volume in carry out, it is therefore intended that by deleted file description squeeze out, regenerate new file and retouch Volume is stated, file description volume is reconstructed according to listed files first, then wipes original file description volume, rewrites new file description Volume;After the occupied space of release inactive file description, first blank page page of file data storage region can be continued search for It number starts page number at as file, and carries out the follow-up realization process of the step S1041- steps S105 in above-described embodiment, specifically Above statement content is can refer to, details are not described herein.
S303:If space is enough, first blank page page number for directly searching file data storage region is originated as file Page number.
If the file of idle file describes volume space and file description is written enough, search file data can be continued directly to First blank page page number of memory block is started page number at as file, and carries out the step S1041- steps S105 in above-described embodiment Follow-up realization process, specifically refer to above statement content, details are not described herein.
Whether sufficient storage file management method provided in this embodiment describes volume space by the file of the idle file of judgement Enough write-in file descriptions can effectively ensure the security reliability of file description write-in, further improve the storage file The reliability that management method uses.
Whether the memory space for the idle file of judgement that Fig. 8 is provided by the embodiment of the present invention is written file to be written enough The flow chart of data;Fig. 9 discharges deleted document occupied space method flow diagram by the FLASH that the embodiment of the present invention provides; On the basis of the above embodiments, with continued reference to attached drawing 8-9 it is found that the present embodiment what is described since file starts page number at File data storage region is written before file data to be written, set method to further include:
S401:Judge whether the memory space of idle file is written file data to be written enough;
May include two kinds of situations when the data that file data storage region has enough spaces that file to be written is written, A kind of situation is that file data to be written is written with enough spaces for the memory space of idle file, and another situation is whole A file data storage region (including the memory space of idle file, use the memory space of file and accounting for for deleted document With space etc.) with enough spaces file data to be written is written, therefore, in order to further increase this document management method The reliability used needs to judge whether the memory space of idle file is written file data to be written enough, specifically Deterministic process can be written into the size of file data and the size of the memory space of idle file carries out analysis comparison.
S402:If insufficient space, discharge deleted document occupied space, and what is described since file starts page number at File data to be written is written in file data storage region;Alternatively,
If the memory space inadequate of idle file is to be written file data to be written, at this point, in order to ensure data to be written Normal write operation, deleted document occupied space can be discharged, to increase it is big for storing the space of data to be written It is small, and Fig. 9 is a kind of embodiment that FLASH discharges deleted document occupied space.This operation only need to memory page roll up in into Row, it is that (in vain) page is re-written as 0xffff that effect, which is all labels,;In release deleted document occupied space After, what can be described since file starts page number at beginning in file data storage region write-in file data to be written, and carries out The follow-up realization process of step S1041- steps S105 in above-described embodiment, specifically refers to above statement content, herein not It repeats again.
S403:If space is enough, directly since file describe start page number at beginning file data storage region be written wait for File data is written.
If file data to be written is written in the memory space of idle file enough, the starting that can be directly described from file Page number starts that file data to be written is written in file data storage region, and carries out the step S1041- steps in above-described embodiment The follow-up realization process of S105, specifically refers to above statement content, details are not described herein.
Whether storage file management method provided in this embodiment is written enough by the memory space of the idle file of judgement File data to be written can effectively ensure that file data to be written carries out the reliability of write operation, further carry The reliability that the high storage file management method uses.
The whether wrong flow chart of file data to be written is written by the detection that the embodiment of the present invention provides in Figure 10;Upper On the basis of stating embodiment, with continued reference to attached drawing 10 it is found that in order to further determine data write operation security reliability, this Embodiment what is described since file starts page number at after file data to be written is written in file data storage region, by method Be set as further include:
S501:Whether file data to be written is written in detection wrong;
After being written into file data and carrying out write operation, the file that can will have been written into FLASH memory The content of data content and file data to be written carries out analysis comparison, to detect whether the file data to be written being written has It is wrong.
S502:If it is wrong that file data to be written is written, output error message;Alternatively,
When analyzing, the content that result of the comparison is the file data content and file data to be written that have been written into is inconsistent, this When the file data to be written that is written it is wrong, whereby it was confirmed that be wrong write operation at this time, for the ease of reminding user, Then output error message.
S503:If being written, file data to be written is correct, is stored in file data storage region according to file to be written Page chained list relationship updates storage page volume.
When analysis result of the comparison is that the file data content that has been written into is consistent with the content of file data to be written, at this time The file data to be written of write-in is to be correctly written in operation, and then then stored in file data storage region according to file to be written Page chained list relationship updates storage page volume, in order to which user the operations such as is read out or deletes to the file to be written having been written into.
Storage file management method provided in this embodiment, it is whether wrong by detecting write-in file data to be written, it can Effectively to ensure that file data to be written carries out the correct reliability of write operation, the storage file management is further improved The reliability that method uses.
When concrete application, the method flow based on FLASH memory written document that Figure 11 is provided by the embodiment of the present invention Figure;Refer to the attached drawing 11 is it is found that the data file write step includes:
Step A:System reads the information of file, has then detected whether duplication of name file, if so, output duplication of name file is different Often, if not provided, executing step B;
Step B:It determines the size of file description, and judges whether the file description volume of FLASH has sufficient space to write this text Part describes, if insufficient space, it is insufficient abnormal that output file describes volume space, if to describe volume space enough for file, executes Step C;
Step C:Judge whether file data storage region there are enough space write-in file datas, if insufficient space, Output file data storage area insufficient space is abnormal, if space is enough, executes step D;
Step D:Judge that idle file describes the whether enough written document descriptions of volume space, if insufficient space, discharges nothing Effect file describes occupied space, executes step E;If space is enough, step E is directly executed;
Step E:First blank page page number of search file data storage area is described as the initial page number of file, written document, Execute step F;
Step F:Judge that the idle whether enough file datas of memory space discharge if insufficient space and deleted text Part occupied space executes step G;If space is enough, G is thened follow the steps;
Step G:Since file describe start page number at beginning file data storage region write-in data;Execute step H;
Step H:Whether data are write in detection wrong, if error, returns to error message;If correct, step I is executed;
Step I:According to the page chained list relationship that file is stored in file data storage region, page volume is updated storage, write-in is terminated Process.
Figure 12 provides a kind of stream of the storage file management method based on FLASH memory by another embodiment of the present invention Cheng Tu;It is found that present embodiments providing another storage file management method, which is refer to the attached drawing 12 Document method is read, also, the process of above-mentioned reading file, by parameter-file description, target is file description Chinese The data that part starts page number at the page of determined chained list are read out, specifically, this method includes:
Step A:System describes volume reading file from file and starts page number at;
Step B:It reads file and starts page number at the file data that corresponding memory page is stored;
Specifically, can the specific location of file started page number at first be determined, risen specifically, above-mentioned file can be detected Whether beginning page number is pre-set 0x0001, correct information is read if so, returning, if it is not, then file can be determined Start page number at where other positions, the specific location started page number at of file to be confirmed and then read file start page The file data that number corresponding memory page is stored;
Step C:The page number for reading one page under file is rolled up according to file memory page, and reads the corresponding memory page institute of the page number The file data of storage, until file data reading finishes.
Specifically, being finished after file starts page number at the file data that corresponding memory page is stored reading, for reality Now to the reading of entire file data, the page number of one page under file can be obtained, corresponding memory page is then read according to page number The file data stored.
Further, in order to improve the correct reliability of file reading, corresponding deposit is started page number at reading the file After the file data that is stored of storage page, set method to further include:
Step D:Judge whether to read correct;
If if read error, error message is returned, terminates to read file;
If read correctly, the content for inquiring corresponding item is started page number at according to file in memory page volume, under acquisition The page number of one page, and read the file data that the corresponding memory page of the page number is stored.
Wherein, error message includes:Read operation mistake;File size mistake;End of file verifies character error.
Storage file management method provided in this embodiment is realized by using the structure of above-mentioned FLASH memory The process of file is written, specifically, the FLASH memory memory page is rolled up in each item sequence of addresses and the item No. one that preserve Cause (0 at 0 addressing, 1 at 2 addressings, 2 at 4 addressings), item No. is corresponded with corresponding memory page page number, from And the mapping relations between address, item No. and page are formd, by above-mentioned mapping relations, memory page volume only needs to preserve lower one page Page number, you can indicate the distribution service condition of page, reduce the memory space needed for memory page volume, and promote index efficiency, have Improve the quality and efficiency for reading file to effect.
Figure 13 provides a kind of stream of the storage file management method based on FLASH memory by further embodiment of this invention Cheng Tu, it is found that present embodiments providing another storage file management method, which is refer to the attached drawing 13 Document method is deleted, above-mentioned deletion file processes are described by parameter-file, it is therefore an objective to delete file file description and Its data preserves page and is marked, specifically, the method for the deletion file includes:
Step A:The starting of address addr and file data that file description starts page number at are read from file description volume Page number pageNum, and specified addr address contents during memory page is rolled up be set as 0 (indicate this correspond to page data without Effect);
Read file data start page number at pageNum after, it can be determined that whether page number pageNum is advance The 0x0001 of setting, if it is, returning to correct information;If it is not, then step B can be continued to execute.
Step B:According to the content for starting page number at inquiry respective items of file data in memory page volume, next page number is obtained Address addr and next page number pageNum, and it is 0 that next page number address addr, which specifies the curriculum offering of address, during memory page is rolled up (it is invalid to indicate that this corresponds to page data), until file data deletion finishes.
Further, in order to improve the reliability for deleting file, addr is specified in rolling up memory page is installed in address Be set to after 0, set method to further include:
Step C:Judge whether delete operation malfunctions;
If delete operation malfunctions, error message is returned;
If delete operation is correct, it is located in the next page number address of current page number in being rolled up to the memory page It is installed with and is set to 0, to complete the delete operation to entire file.
Wherein, error message includes:Operating mistake, file occupy data page and miscount mistake.
Storage file management method provided in this embodiment is realized by using the structure of above-mentioned FLASH memory The process of file is written, specifically, the FLASH memory memory page is rolled up in each item sequence of addresses and the item No. one that preserve Cause (0 at 0 addressing, 1 at 2 addressings, 2 at 4 addressings), item No. is corresponded with corresponding memory page page number, from And the mapping relations between address, item No. and page are formd, by above-mentioned mapping relations, memory page volume only needs to preserve lower one page Page number, you can indicate the distribution service condition of page, reduce the memory space needed for memory page volume, and promote index efficiency, have Improve the correct reliability and efficiency for deleting file to effect.
Finally it should be noted that:The above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent Present invention has been described in detail with reference to the aforementioned embodiments for pipe, it will be understood by those of ordinary skill in the art that:Its according to So can with technical scheme described in the above embodiments is modified, either to which part or all technical features into Row equivalent replacement;And these modifications or replacements, various embodiments of the present invention technology that it does not separate the essence of the corresponding technical solution The range of scheme.

Claims (18)

1. a kind of FLASH memory, which is characterized in that for realizing the write-in, reading or delete operation of file, including:FLASH Memory block, the memory blocks FLASH are divided into the multiple pages originated with No. 0 with the FLASH least units wiped, described The memory blocks FLASH include:
Boot section, the information for describing the FLASH memory;
Memory page is rolled up, the distribution information for indicating page, and the distribution information includes multiple items, and each item is used for storage file number According to next memory page page number, the sequence of addresses that each item preserves is corresponding with item No., and item No. and corresponding memory page Page number corresponds;
File description volume, the information of the information for describing storage file, the storage file include:Fileinfo and file It starts page number at;
File data storage region is used for save file data.
2. FLASH memory according to claim 1, which is characterized in that the information of the FLASH memory includes following At least one:
Store name, version number, memory generated time, type of memory.
3. FLASH memory according to claim 1 or 2, which is characterized in that the information of the storage file further include with It is at least one lower:
Filename, file attribute, file size, file start page number at, the file generated time.
4. a kind of storage file management method based on FLASH memory described in claim 1, which is characterized in that including:
Read the information of file to be written;
It determines the size of the file description of the file to be written, and judges whether the description volume of the file in FLASH memory has The file description is written in sufficient space;
If there is sufficient space that the file description is written in the file description volume, the text in the FLASH memory is judged Whether part data storage area has enough spaces that file data to be written is written;
If the file data storage region there are enough spaces that the data of the file to be written are written, the number of files is searched for It is started page number at as file according to first blank page page number of memory block, and the file is written in file description volume and retouches It states;
What is described since the file starts page number at beginning in the file data storage region write-in file data to be written;
The page chained list relationship stored in file data storage region according to file updates storage page volume, terminates ablation process.
5. according to the method described in claim 4, it is characterized in that, after the information for reading file to be written, the method Further include:
Detect whether there is file of bearing the same name corresponding with the file to be written;
If in the presence of duplication of name file abnormal operation is exported;Alternatively,
If being not present, it is determined that the size of the file description of the file to be written.
6. according to the method described in claim 4, it is characterized in that, whether the file in judging FLASH memory describes volume There is sufficient space to be written after the file description, the method further includes:
If there is no sufficient space that the file description is written in the file description volume, exports the file and describe volume space not Foot is abnormal.
7. according to the method described in claim 4, it is characterized in that, the file data in judging the FLASH memory is deposited Whether storage area has enough spaces to be written after file data to be written, and the method further includes:
If there is no enough spaces that the data of the file to be written, output file number is written in the file data storage region According to memory block insufficient space exception.
8. according to the method described in any one of claim 4-7, which is characterized in that in search file data storage area Before one blank page page number is started page number at as file, the method further includes:
Judge that the file of idle file describes whether volume space is written the file description enough;
If insufficient space, the occupied space of inactive file description, and first blank page of search file data storage area are discharged Page number is started page number at as file;Alternatively,
If space is enough, first blank page page number for directly searching file data storage region is started page number at as file.
9. according to the method described in any one of claim 4-7, which is characterized in that in the start page described from the file Number start before the file data to be written is written in the file data storage region, the method further includes:
Judge whether the memory space of idle file is written the file data to be written enough;
If insufficient space, deleted document occupied space is discharged, and described what is described since the file starts page number at The file data to be written is written in file data storage region;Alternatively,
If space is enough, directly since the file describe start page number at beginning the file data storage region be written described in File data to be written.
10. according to the method described in any one of claim 4-7, which is characterized in that in the starting described from the file Page number starts after the file data to be written is written in the file data storage region, and the method further includes:
Whether the file data to be written is written in detection wrong;
If the write-in file data to be written is wrong, output error message;Alternatively,
If the write-in file data to be written is correct, the page stored in file data storage region according to the file to be written Chained list relationship updates storage page volume.
11. a kind of storage file management method based on FLASH memory described in claim 1, which is characterized in that including:
File is read from file description volume to start page number at;
It reads the file and starts page number at the file data that corresponding memory page is stored;
The page number for reading one page under file is rolled up according to file memory page, and reads the file that the corresponding memory page of the page number is stored Data, until file data reading finishes.
12. according to the method for claim 11, which is characterized in that start page number at corresponding memory page reading the file After the file data stored, the method further includes:
Whether correct judge to read;
If reading correctly, the content for inquiring corresponding item is started page number at according to the file in memory page volume, is obtained next The page number of page, and read the file data that the corresponding memory page of the page number is stored.
13. according to the method for claim 12, which is characterized in that after judging whether reading is correct, the method is also Including:
If read error, error message is returned to, and terminate read operation.
14. according to the method for claim 13, which is characterized in that the error message includes at least one of:
Read operation mistake, file size mistake, end of file verify character error.
15. a kind of storage file management method based on FLASH memory described in claim 1, which is characterized in that including:
Starting page number at for the file address addr that starts page number at of description and file data is read from file description volume PageNum, and the specified address contents of file description starts page number at during memory page is rolled up address addr are set as 0;
According to the content for starting page number at inquiry respective items of file data in memory page volume, next page number address is obtained Addr and next page number pageNum, and be by the curriculum offering of the specified addresses next page number address addr in memory page volume 0, until file data deletion finishes.
16. according to the method for claim 15, which is characterized in that addr is specified in address in rolling up the memory page It is installed with and is set to after 0, the method further includes:
Judge whether delete operation malfunctions;
If delete operation is correct, the curriculum offering that the next page number address of current page number is located in being rolled up to the memory page is 0.
17. according to the method for claim 16, which is characterized in that after judging whether delete operation malfunctions, the side Method further includes:
If delete operation malfunctions, error message is returned.
18. according to the method for claim 17, which is characterized in that the error message includes:Operating mistake and/or file It occupies data page and miscounts mistake.
CN201710189447.1A 2017-03-27 2017-03-27 FLASH memory and storage file management method Active CN108664482B (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN202110935551.7A CN113641630A (en) 2017-03-27 2017-03-27 FLASH memory
CN201710189447.1A CN108664482B (en) 2017-03-27 2017-03-27 FLASH memory and storage file management method
CN202110935528.8A CN113641629A (en) 2017-03-27 2017-03-27 File writing and reading method of FLASH memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710189447.1A CN108664482B (en) 2017-03-27 2017-03-27 FLASH memory and storage file management method

Related Child Applications (2)

Application Number Title Priority Date Filing Date
CN202110935528.8A Division CN113641629A (en) 2017-03-27 2017-03-27 File writing and reading method of FLASH memory
CN202110935551.7A Division CN113641630A (en) 2017-03-27 2017-03-27 FLASH memory

Publications (2)

Publication Number Publication Date
CN108664482A true CN108664482A (en) 2018-10-16
CN108664482B CN108664482B (en) 2021-09-07

Family

ID=63786293

Family Applications (3)

Application Number Title Priority Date Filing Date
CN202110935528.8A Pending CN113641629A (en) 2017-03-27 2017-03-27 File writing and reading method of FLASH memory
CN201710189447.1A Active CN108664482B (en) 2017-03-27 2017-03-27 FLASH memory and storage file management method
CN202110935551.7A Pending CN113641630A (en) 2017-03-27 2017-03-27 FLASH memory

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN202110935528.8A Pending CN113641629A (en) 2017-03-27 2017-03-27 File writing and reading method of FLASH memory

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202110935551.7A Pending CN113641630A (en) 2017-03-27 2017-03-27 FLASH memory

Country Status (1)

Country Link
CN (3) CN113641629A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110716904A (en) * 2019-10-14 2020-01-21 深圳市优创亿科技有限公司 Design method of embedded file system
CN112596670A (en) * 2020-12-04 2021-04-02 北京自动化控制设备研究所 Design method for read-write operation of high-capacity Flash memory
WO2021129048A1 (en) * 2019-12-27 2021-07-01 中兴通讯股份有限公司 Method, device, and apparatus for writing file data and storage medium
CN113934371A (en) * 2021-10-08 2022-01-14 福建星网视易信息系统有限公司 Memory, data management method thereof and computer storage medium
CN112596670B (en) * 2020-12-04 2024-06-07 北京自动化控制设备研究所 Design method for read-write operation of high-capacity Flash memory

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1405683A (en) * 2001-09-18 2003-03-26 华为技术有限公司 FLASH storage file management method
CN1632765A (en) * 2004-12-31 2005-06-29 大唐微电子技术有限公司 A flash memory file system management method
CN106527969A (en) * 2016-09-21 2017-03-22 中国科学院地质与地球物理研究所 NandFlash memory read-write method capable of guaranteeing service life balance

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20040072875A (en) * 2003-02-11 2004-08-19 유비시스테크놀러지 주식회사 Storage using nand flash memory
CN100555246C (en) * 2007-09-24 2009-10-28 中兴通讯股份有限公司 A kind of on flash memory the system and method for access data
CN102279805A (en) * 2011-09-06 2011-12-14 四川九洲电器集团有限责任公司 Memory data storing and reading method
KR101392174B1 (en) * 2011-11-09 2014-05-09 한양대학교 산학협력단 Apparatus and method for controlling flash memory storing mapping table of block to erase
CN102708107A (en) * 2011-12-13 2012-10-03 北京安天电子设备有限公司 Method and system for storing appended files
CN103257928B (en) * 2013-04-16 2016-01-13 深圳市江波龙电子有限公司 Flash memory device data managing method and system
CN103258044B (en) * 2013-05-24 2017-01-18 北京航天自动控制研究所 Two-tuple NANDFLASH data file management method oriented to DSP
US9483397B2 (en) * 2013-07-16 2016-11-01 Intel Corporation Erase management in memory systems
CN105468304B (en) * 2015-11-26 2018-05-11 恒宝股份有限公司 A kind of Native storage cards and its management method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1405683A (en) * 2001-09-18 2003-03-26 华为技术有限公司 FLASH storage file management method
CN1632765A (en) * 2004-12-31 2005-06-29 大唐微电子技术有限公司 A flash memory file system management method
CN106527969A (en) * 2016-09-21 2017-03-22 中国科学院地质与地球物理研究所 NandFlash memory read-write method capable of guaranteeing service life balance

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
EEPW: "www.eepw.com.cn/article/149588_3.htm", 《STM32F103VB的SD卡在应用编程设计》 *
EFFIE_MUMU: "https://blog.csdn.net/Effie_mumu/article/details/53954496", 《数据结构——单链表存储结构》 *
功名半纸: "https://blog.csdn.net/force_eagle/article/details/7969465", 《FAT文件系统原理详细介绍》 *
沙东吉: "https://blog.csdn.net/dingbihu/article/details/51475351", 《FAT文件系统原理》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110716904A (en) * 2019-10-14 2020-01-21 深圳市优创亿科技有限公司 Design method of embedded file system
WO2021129048A1 (en) * 2019-12-27 2021-07-01 中兴通讯股份有限公司 Method, device, and apparatus for writing file data and storage medium
CN112596670A (en) * 2020-12-04 2021-04-02 北京自动化控制设备研究所 Design method for read-write operation of high-capacity Flash memory
CN112596670B (en) * 2020-12-04 2024-06-07 北京自动化控制设备研究所 Design method for read-write operation of high-capacity Flash memory
CN113934371A (en) * 2021-10-08 2022-01-14 福建星网视易信息系统有限公司 Memory, data management method thereof and computer storage medium
CN113934371B (en) * 2021-10-08 2024-04-12 福建星网视易信息系统有限公司 Memory, data management method thereof and computer storage medium

Also Published As

Publication number Publication date
CN108664482B (en) 2021-09-07
CN113641629A (en) 2021-11-12
CN113641630A (en) 2021-11-12

Similar Documents

Publication Publication Date Title
CN104220991B (en) Framework for allowing effective storage of the data on nand flash memory
CN106569748B (en) The data processing method and device of Flash File System
CN101533670B (en) Method and memory device realizing loss balance of memory device
CN101446921B (en) Dynamic storage method of Flash memory
CN102511044A (en) Method for deleting the data and device thereof
CN105138282A (en) Storage space recycling method and storage system
CN108664482A (en) FLASH memory and storage file management method
CN101656106A (en) Method for writing data into EEPROM and device thereof
CN103593257B (en) A kind of data back up method and device
CN108604165A (en) Storage device
CN106155915A (en) The processing method and processing device of data storage
CN103714013A (en) Method and device for allocating storage space of file system
CN109918316B (en) Method and system for reducing FTL address mapping space
CN106959907A (en) A kind of cloud platform fragmentation data backup and reduction system
CN102253985A (en) File system data management method and system
CN102541969A (en) File protection method and system based on file allocation table (FAT) file system, and memory
CN106354718B (en) File management method and device of user identification module
CN109408416B (en) Address mapping table entry page management method and device
CN108563586B (en) Method for separating garbage recovery data and user data in solid-state disk
CN105653466A (en) Data storage device and flash memory control method
CN103699681B (en) The treating method and apparatus of data rewind
CN108646987A (en) A kind of management method of file volume, device, storage medium and terminal
CN102737171B (en) Method and device for storing virus file and storage equipment
CN103176753A (en) Storage device and data management method of storage device
CN102346769B (en) Method and device for consolidating registry file

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
TA01 Transfer of patent application right

Effective date of registration: 20190717

Address after: 519060 Guangwan Street, Xiangzhou District, Zhuhai City, Guangdong Province, 83, 01, 1st, 3rd, 4th, 5th, 6th, 7th and 8th floors

Applicant after: Zhuhai APEX Microelectronics Co., Ltd.

Address before: 519060 Zhuhai City, Guangdong Province, 3883 Zhuhai Avenue 3883, 01 Building 2, 7 Building B, 02, 03, 04 Building 1, 2, 3, 4, 5, 05

Applicant before: Nasida Limited by Share Ltd

TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20200514

Address after: 519000 room 105-68710, No. 6, Baohua Road, Hengqin New District, Zhuhai City, Guangdong Province (centralized office area)

Applicant after: Zhuhai Jihai Semiconductor Co., Ltd

Address before: 519060 Guangwan Street, Xiangzhou District, Zhuhai City, Guangdong Province, 83, 01, 1st, 3rd, 4th, 5th, 6th, 7th and 8th floors

Applicant before: APEX MICROELECTRONICS Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant