CN108255433B - Flash memory, file management method and device of Flash memory - Google Patents

Flash memory, file management method and device of Flash memory Download PDF

Info

Publication number
CN108255433B
CN108255433B CN201810031114.0A CN201810031114A CN108255433B CN 108255433 B CN108255433 B CN 108255433B CN 201810031114 A CN201810031114 A CN 201810031114A CN 108255433 B CN108255433 B CN 108255433B
Authority
CN
China
Prior art keywords
page
file
data
stored
setting
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810031114.0A
Other languages
Chinese (zh)
Other versions
CN108255433A (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
Zhuhai Geehy Semiconductor 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 Zhuhai Geehy Semiconductor Co Ltd filed Critical Zhuhai Geehy Semiconductor Co Ltd
Priority to CN202111355122.9A priority Critical patent/CN114089916B/en
Priority to CN201810031114.0A priority patent/CN108255433B/en
Priority to CN202111353834.7A priority patent/CN114035749B/en
Publication of CN108255433A publication Critical patent/CN108255433A/en
Application granted granted Critical
Publication of CN108255433B publication Critical patent/CN108255433B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/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/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • 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]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Read Only Memory (AREA)

Abstract

The embodiment of the application provides a Flash memory, a file management method and a file management device of the Flash memory, wherein the method comprises the steps of determining a target setting page of a file to be stored for each file to be stored when at least one file to be stored is present, and writing target setting information related to data of the file to be stored into the target setting page; the target setting information comprises first page information of a target data page of a corresponding file to be stored; and for each file to be stored, determining a home page of a corresponding target data page according to corresponding home page information, and continuously writing the acquired target data into a Flash memory from the home page. The data page and the setting page of the file are separately arranged, the data writing process is convenient and quick, and the convenience and the quickness of the data writing process can be guaranteed when a plurality of files to be stored need to be obtained.

Description

Flash memory, file management method and device of Flash memory
Technical Field
The embodiment of the application relates to a memory technology, in particular to a Flash memory, and a file management method and device of the Flash memory.
Background
The Flash memory is a nonvolatile memory based on semiconductor technology, has the advantages of low power consumption, large capacity, small volume, light weight, high access speed and the like, and has gradually replaced other semiconductor memory devices to be widely applied to mobile electronic products.
Any Flash memory has a fixed storage capacity, and the write operation can only be performed in an empty or erased unit, so in most cases, the erase must be performed before the write operation is performed, but the life of the Flash chip is limited, and the Flash chip is easily damaged beyond the maximum erase time. In order to solve the problem that erasing must be performed before writing operation, the existing Flash file storage management method, for example, patent application No. 01142240 entitled "Flash storage file management method", divides a Flash storage area into two areas, namely a file index area and a file data storage area, wherein the file index area is used for recording file directories and distribution information of basic distribution unit "blocks", and the file data storage area is used for storing specific contents of files, is suitable for random reading, writing and erasing operation on files, and is flexible in operation.
However, in the above method, when the stored file includes two parts, namely, the setting information and the continuous data, the problems of complicated operation, difficulty in implementation, long operation delay and the like occur.
Disclosure of Invention
The embodiment of the application provides a Flash memory and a file management method and device of the Flash memory, so as to realize the rapid operation of a file containing two parts of setting information and continuous data.
In a first aspect, an embodiment of the present application provides a Flash memory, including: a storage area;
the storage area is divided into a plurality of pages, the storage area includes a content area for storing at least one file, each file includes a setup page and a data page, the data page is for storing data, and the setup page is for storing setup information related to collecting the data.
In one possible design, the storage area further includes an allocation area, the allocation area includes a plurality of entries, and when the content area stores N files, the content of each of the N entries in the allocation area is a page number of a setting page of the corresponding file, and the page number of the setting page is used to indicate a storage location of the setting page.
In one possible design, the storage area further includes a boot area and a default configuration area;
the guide area is used for storing attribute information of the corresponding data acquisition device and dividing information of the storage area;
the default configuration area is used for storing default setting information related to the collected data.
In a second aspect, an embodiment of the present application provides a file management method for a Flash memory, where the method is based on the method for a Flash memory described in any possible design of the first aspect; the method comprises the following steps:
when at least one file to be stored exists, determining a target setting page of each file to be stored, and writing target setting information related to the collection of the data of the file to be stored into the target setting page; the target setting information comprises first page information of a target data page of a file to be stored;
for each file to be stored, determining a home page of a target data page of the file to be stored according to home page information in target setting information, and continuously writing acquired target data into the Flash memory from the home page; and the target data is acquired by the data acquisition device according to corresponding target setting information.
In one possible design, when the content area stores N files, and the content of each of the N items in the allocation area is the page number of the setting page of the corresponding file, the determining the target setting page of the file to be stored includes:
reading information included in a page where the distribution area is located to obtain the contents of all items included in the distribution area;
if the content area stores at least one file, acquiring the maximum page number in the content of the item including the page number in all the items;
obtaining the page number of the target setting page according to the maximum page number, wherein the page number of the target setting page is the sum of the maximum page number and a preset value;
and determining the target setting page according to the page number of the target setting page.
In a possible design, after reading information included in the page where the allocation area is located, and obtaining the content of at least one item, the method further includes:
acquiring the number of page numbers included in the contents of all the items, wherein the number is used for indicating the number of files stored in a content area;
acquiring the target storage position of the page number of the target configuration page in the allocation area according to the number, the offset address of the first item in the allocation area and the number of bytes occupied by each item;
after obtaining the page number of the target setup page according to the maximum page number, the method further includes:
writing a page number of the target setup page at a target storage location of the allocation area.
In one possible design, after the obtaining the maximum page number in the content of the at least one item, the method includes:
reading the content of a first setting page indicated by the maximum page number to obtain first setting information in the first setting page, wherein the first setting information comprises tail page information of a data page of a file;
and determining the first page information of the target data page of the file to be stored according to the tail page information.
In one possible design, when the storage area further includes an allocation area, and the allocation area includes a plurality of entries, and when the content area stores N files, and the content of each of the N entries in the allocation area is the page number of the setting page of the corresponding file, the method further includes:
after the process of data acquisition is finished, for each file to be stored, writing tail page information of the file to be stored into a target configuration page of the file to be stored; wherein the end page information includes a physical address where the last item of collected data is stored.
In a possible design, the storage area further includes an allocation area, and the allocation area includes a plurality of entries, when the content area stores N files, the content of each of the N entries in the allocation area is the page number of the setting page of the corresponding file; the method further comprises the following steps:
reading information included in a page where the distribution area is located to obtain a page number of at least one setting page;
reading the setting information of the setting page indicated by each page number according to the page number of the at least one setting page to obtain the setting information of each file stored in the Flash memory;
reading data included in a data page of a file to be read according to an identifier of the file to be read input by a user; and the identification of the file to be read is acquired by the user according to the setting information of each file stored in the Flash memory.
In a third aspect, an apparatus for managing files of a Flash memory according to an embodiment of the present application is based on the Flash memory described in any one of the possible designs of the first aspect, and includes:
the information setting module is used for determining a target setting page of each file to be stored when at least one file to be stored is stored, and writing target setting information related to the collection of the data of the file to be stored into the target setting page; the target setting information comprises first page information of a target data page of a file to be stored;
the data writing module is used for determining a home page of a target data page of each file to be stored according to home page information in the target setting information, and continuously writing the acquired target data into the Flash memory from the home page; and the target data is acquired by the data acquisition device according to corresponding target setting information.
In one possible design, the apparatus further includes: a data reading module;
the data reading module is used for further comprising a distribution area in the storage area, the distribution area comprises a plurality of items, and when N files are stored in the content area, the content of each of the N items in the distribution area is the page number of the setting page of the corresponding file; reading information included in a page where the distribution area is located to obtain a page number of at least one setting page;
reading the setting information of the setting page indicated by each page number according to the page number of the at least one setting page to obtain the setting information of each file stored in the Flash memory;
reading data included in a data page of a file to be read according to an identifier of the file to be read input by a user; and the identification of the file to be read is acquired by the user according to the setting information of each file stored in the Flash memory.
In a fourth aspect, an embodiment of the present application provides a file management system for a Flash memory, including: the Flash memory, the data acquisition device, the control equipment of the data acquisition device and the terminal equipment in any possible design of the first aspect;
the Flash memory, the data acquisition device and the terminal equipment are all connected with the control equipment of the data acquisition device;
wherein the control device of the data acquisition device comprises the file management device of the Flash memory in any possible design of the third aspect.
In a fifth aspect, embodiments of the present application provide a computer-readable storage medium including instructions that, when executed on a computer, cause the computer to perform the method as set forth in any one of the possible designs of the second aspect.
In a sixth aspect, an embodiment of the present application provides an electronic device, including: the device comprises a processor, a memory and a communication bus, wherein the communication bus is used for realizing the connection between each component, the memory is used for storing program instructions, and the processor is used for reading the program instructions in the memory and executing the method in any one of the possible designs of the second aspect according to the program instructions in the memory.
Because the setting page and the data page of the file are separately set, and the setting page contains the first page information of the corresponding data page, the setting page can be written with the setting information conveniently and quickly, and the data can be written into the data page. Meanwhile, the setting information of the files to be stored can be written into respective setting pages, data are acquired according to the setting information related to the acquired data in the respective setting information and are written into the respective data pages, and the convenience and the rapidness of the data writing process are ensured when the files to be stored need to be obtained.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to these drawings without inventive exercise.
FIG. 1 is a diagram of one possible system architecture provided by an embodiment of the present application;
fig. 2 is a schematic diagram illustrating division of a storage area of a Flash memory according to an embodiment of the present application;
FIG. 3 is a diagram of a file attribute definition provided in an embodiment of the present application;
fig. 4 is a diagram illustrating a definition of a start-up mode according to an embodiment of the present application;
FIG. 5 is a diagram illustrating a stop mode definition provided in an embodiment of the present application;
FIG. 6 is a first flowchart of a file management method for a Flash memory according to the present application;
fig. 7 is a schematic diagram illustrating distribution of storage areas of a Flash memory according to an embodiment of the present application;
FIG. 8 is a flowchart of a file management method of a Flash memory according to the present application;
fig. 9 is a schematic structural diagram of a first implementation of a file management apparatus of a Flash memory according to an embodiment of the present application;
FIG. 10 is a schematic structural diagram of a second implementation of a file management apparatus of a Flash memory according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is a diagram of a possible system architecture provided by an embodiment of the present application, and referring to fig. 1, the system architecture may include a Flash memory 11, a data acquisition apparatus 12, a control device 13 of the data acquisition apparatus, and a terminal 14. The storage area of the Flash memory 11 is divided into a plurality of pages, the storage area includes a content area, the content area is used for storing at least one file, each file includes a setting page and a data page, the data page is used for storing data collected by the data collecting device, the setting page is used for storing setting information related to the collected data, the setting information includes first page information of the data page corresponding to the setting page, and the data page of each file is at least one page.
Specifically, after the Flash memory 11 is connected to the control device 13, the control device 13 may perform a write operation on the Flash memory and an operation of reading information stored in the Flash memory. The control device 13 can receive the setting information related to the acquired data sent by the terminal 14, and write the setting information related to the acquired data into the setting page in the Flash memory 11, and the control device 13 controls the data acquisition device 12 to acquire data according to the setting information in the setting page in the Flash memory 11, and writes the data acquired by the data acquisition device 12 into the data page; wherein the setup page and the data page constitute the contents of one file.
Because each file stored in the Flash memory comprises a setting page and a data page, when the corresponding file is written in, the setting page is firstly determined, and partial setting information is written in the setting page, so that the control equipment can control the data acquisition device to acquire data according to the setting information, the writing process of the setting information is quick and convenient, and because the setting information comprises the first page information of the data page of the corresponding file, the area for continuously writing the acquired data is also determined, so that the continuous data writing process is also quick and convenient.
The Flash memory of the present application will be described in detail below with reference to specific embodiments.
Fig. 2 is a schematic diagram illustrating division of a storage area of a Flash memory according to an embodiment of the present disclosure, and referring to fig. 2, the storage area of the Flash memory is divided into a plurality of pages, and the storage area includes a content area 21, an allocation area 22, a boot area 23, and a default configuration area 24.
The content area 21 is used for storing at least one file, each file including a setting page and a data page, the data page being used for storing data, and the setting page being used for storing setting information related to acquired data.
The allocation area 22 includes a plurality of items, and when the content area stores N files, the respective contents of the N items in the allocation area include the page numbers of the setting pages of the corresponding files.
The guide area 23 is used to store attribute information of the corresponding data acquisition device and division information of the storage area.
The default configuration area 24 is used to store default setting information related to the acquired data.
Specifically, the storage area of the Flash memory in this embodiment is divided into a plurality of pages starting with number 0 according to the minimum unit of Flash erasure, and if the storage capacity of the Flash memory is 2M and the minimum unit of Flash erasure is 1KB, the storage area is divided into 2048 pages, where the number of pages for storage may be less than or equal to 2048 pages.
First, the guide area 23 will be explained.
The guiding area 23 is used for storing attribute information of the corresponding data acquisition device and division information of the storage area, such as a storage version, a name, a creation time, a type of the data acquisition device, a start page number and a occupied page number of each area of the storage area, and the like, and may further include: the data acquisition device delivery time, calibration data, and the like. Page 0 of the storage area may be used as a lead-in area.
If the data acquisition device is a temperature and humidity sensor, the specific data and attributes stored in the boot area of the Flash memory can be referred to table 1.
TABLE 1 specific data and attributes stored in the boot sector
Figure BDA0001546497340000071
Figure BDA0001546497340000081
Referring to table 1, the guide region includes: the storage name, the temperature resolution, the actual minimum temperature represented by 0, the maximum temperature, the humidity resolution, the actual minimum humidity represented by 0, the maximum humidity and the like of the temperature and humidity sensor; further comprising: the initial page number of the guide area, the initial page number of the default configuration area, the initial page number of the distribution area, the initial page number of the content area and the page number of the content area.
Therefore, by reading the contents of the lead-in area, the positions of the allocation area, the default allocation area, and the contents area can be known.
Wherein, for temperature resolution; two bytes are used for representation: [ ByteHigh,ByteLow],ByteHighRepresenting the number of bits after the decimal point, ByteLowRepresenting a number, thus a temperature resolution T1The conversion formula of (c) is:
Figure BDA0001546497340000082
that is, if the temperature resolution stored in the boot sector is 0x201, the actual temperature resolution is
Figure BDA0001546497340000083
Wherein, the low Byte corresponding to 0x201LowIs 0X01, the upper Byte Byte corresponding to 0X201HighIs 0X02, [0X02,0X01]=0X201。
In the actual use process, the control device of the temperature and humidity sensor reads the temperature resolution stored in the guide area, and according to the method, the actual temperature resolution can be obtained and used for controlling the temperature measurement of the temperature and humidity sensor.
For the actual minimum temperature T which can be detected in the detection range of the temperature and humidity sensorMin Shi: if the temperature value T stored in the Flash memoryFlash1When 0 denotes-46.85 ℃ and T denotesMinWhen the temperature is-46.85 ℃, then TMin Shi=TFlash1*T1+TMin=0*0.01-46.85=-46.85。
For humidity resolution: represented in two bytes: [ ByteHigh,ByteLow],ByteHighRepresenting the number of bits after the decimal point, ByteLowNumber of tables, therefore humidity resolution H1The conversion formula of (c) is:
Figure BDA0001546497340000091
that is, if the humidity resolution stored in the guiding area is 0x201, the actual temperature resolution is
Figure BDA0001546497340000092
Wherein, the low Byte corresponding to 0x201LowIs 0X01, the upper Byte Byte corresponding to 0X201HighIs 0X02, [0X02,0X01]=0X201。
In the actual use process, the control device of the temperature and humidity sensor reads the humidity resolution stored in the guide area, and according to the method, the actual humidity resolution can be obtained and used for controlling the temperature and humidity sensor to measure the humidity.
For the conversion between the actual temperature and the temperature value stored in the Flash memory: if the temperature value stored in the Flash memory is known to be TFlash2Then the actual temperature TFruit of Chinese wolfberry=TFlash2×T1+TMin ShiIf the actual temperature T is knownFruit of Chinese wolfberryThen, then
Figure BDA0001546497340000093
In the actual using process, if the control device of the temperature and humidity sensor reads the temperature value stored in the Flash memory, the temperature value can be obtained through the formula: t isFruit of Chinese wolfberry=TFlash2×T1+TMin ShiObtaining the actual temperature; if the temperature value acquired by the temperature and humidity sensor is written into the Flash memory by the control equipment of the temperature and humidity sensor, the formula is passed
Figure BDA0001546497340000094
And obtaining the value stored in the Flash memory.
For theAnd (3) conversion between the actual humidity and the humidity value stored in the Flash memory: if the humidity value stored in the Flash memory is known to be HFlashThen the actual humidity HFruit of Chinese wolfberry=HFlash×H1+HMinIf the actual humidity H is knownFruit of Chinese wolfberryThen, then
Figure BDA0001546497340000095
As can be seen from Table 1, HMinEqual to 0.
In the actual use process, if the control device of the temperature and humidity sensor reads the humidity value stored in the Flash memory, the humidity value can be obtained through the formula: hFruit of Chinese wolfberry=HFlash×H1+HMinObtaining the actual humidity; if the control equipment of the temperature and humidity sensor writes the humidity value acquired by the temperature and humidity sensor into the Flash memory, the formula is passed
Figure BDA0001546497340000096
And obtaining the value stored in the Flash memory.
Next, the default configuration area 24 will be described.
A default setting area 24 for storing default setting information related to the collected data, such as a sampling interval in the setting information.
Next, the allocation area 22 will be explained.
The allocation region 22 includes a plurality of entries, each entry occupies 2 bytes, each byte is 8 bits, i.e., 16bytes, and the content of each entry sets the page number of the page for the corresponding file; if the content area 21 stores N files, there are N entries in the allocation area, and the respective content is the page number of the setting page of the corresponding file; the contents of the remaining items other than the N items may be ffffffh.
In this way, the physical address of the first entry in the allocation area is the start address of the page where the allocation area is located, so that the offset address of the first entry in the allocation area can be known, the offset address corresponding to the storage location of the target setting page of the current file to be stored can be obtained according to the number of files in the content area and the number of bytes occupied by each entry, and the physical address for storing the target setting page can be obtained according to the offset address corresponding to the storage location of the target setting page.
Next, the content area 21 will be explained.
The content area 21 is used to store at least one file, each file including a setup page and a data page.
The data pages are used for continuously storing the data collected by the data collection device, the data page of each file at least comprises one page, and the number of pages included in the data page of each file is not limited and is related to the data which needs to be stored specifically.
The setting page is used for storing setting information related to the collected data, and the setting information comprises first page information of a data page corresponding to the setting page.
If the data acquisition device is a temperature and humidity sensor, the specific data stored in the setting page of the Flash memory can be referred to table 2.
TABLE 2 specific data of the setup page store
Figure BDA0001546497340000101
Figure BDA0001546497340000111
As can be seen from table 2, the setting items of the setting page include: the method comprises the following steps of file attribute, starting mode of a temperature and humidity sensor, stopping mode of the temperature and humidity sensor, sampling interval of the temperature and humidity sensor, sampling starting time, sampling stopping time, address of the first page 0 for storing sampling data, effective data ending address and the like.
After the setting items are set, the setting information related to the collected data can be obtained.
Fig. 3 is a file attribute definition diagram provided in the embodiment of the present application, fig. 4 is a start mode definition diagram provided in the embodiment of the present application, and fig. 5 is a stop mode definition diagram provided in the embodiment of the present application.
For file attributes, see FIG. 3, two bytes are occupied, 16 bits, with unused bits defaulting to "1"; for the 0 bit: if the 0 bit is 0, the temperature sampling is carried out, and if the 0 bit is 1, the temperature sampling is not carried out; for 1 bit: a value of 0 indicates that the humidity sampling is performed, and a value of 1 indicates that the humidity sampling is not performed.
When the user needs to detect the temperature, the user inputs a temperature acquisition instruction through the terminal, the terminal sends the temperature acquisition instruction to the control equipment of the temperature and humidity sensor, the control equipment of the temperature and humidity sensor sets the file attribute to be the acquisition temperature according to the received temperature acquisition instruction, namely, the value of 0 bit of the byte corresponding to the file attribute is replaced by 0 from 1. When the user needs to detect temperature and humidity, the user inputs a temperature and humidity acquisition instruction through the terminal, the terminal sends the temperature and humidity acquisition instruction to the control equipment of the temperature and humidity sensor, the control equipment of the temperature and humidity sensor sets file attributes to acquire temperature and humidity according to the received temperature and humidity acquisition instruction, namely, the value of 0 bit of a byte corresponding to the file attributes is replaced by '1' to '0', and the value of 1 bit is replaced by '1' to '0'.
Through the process, the setting of the file attribute is completed, and the setting information corresponding to the file attribute is obtained.
For the starting mode of the temperature and humidity sensor, referring to fig. 4, two bytes and 16 bits are occupied, and the unused bits are defaulted to "1"; for the 0 bit: if the 0 bit is 1, the temperature and humidity sensor is started by the key, otherwise, the key does not influence the starting of the temperature and humidity sensor; for 1 bit: and if 0 represents that the setting information is set, starting the temperature and humidity sensor after a period of time (the delay time is set by the user through the terminal), and if 2 bits: and 1 denotes the timing of the start of the temperature and humidity sensor.
For the setting of the starting mode, the process of obtaining the setting information corresponding to the starting mode refers to the process of obtaining the setting information corresponding to the file attribute, which is not described herein again.
For the stop mode, see fig. 5, two bytes, 16 bits are occupied, and unused bits default to "1"; for the 0 bit: if the value is 0, the button stops the temperature and humidity sensor, otherwise, the button does not influence the stop of the temperature and humidity sensor; for 1 bit: the value of 0 indicates that the sampling is stopped when the data is read from the Flash memory, otherwise, the sampling is not influenced; for 2 bits: a value of 0 indicates that the number of samples is fixed, otherwise the sample length is not limited.
For the setting of the stop mode, the process of obtaining the setting information corresponding to the stop mode refers to the process of obtaining the setting information corresponding to the file attribute, which is not described herein again.
For the sampling interval: the user passes through the terminal input sampling interval, and the terminal sends the sampling interval to temperature and humidity sensor's controlgear, and temperature and humidity sensor's controlgear will receive the sampling interval and write in to the byte department that the sampling interval corresponds, has obtained the setting information: a sampling interval.
If the user does not set the sampling interval through the terminal, when the control equipment of the temperature and humidity sensor controls the temperature and humidity sensor to sample, the temperature and humidity sensor can be controlled to sample through reading the default sampling interval in the default setting page.
For the sample start time: when the temperature and humidity sensor starts to collect corresponding data, the control equipment of the temperature and humidity sensor writes corresponding time into the byte position corresponding to the sampling start time, and the setting information is obtained: the start time of the sampling.
For the sampling stop time: when the temperature and humidity sensor stops collecting corresponding data, the control equipment of the temperature and humidity sensor writes corresponding time into the byte position corresponding to the sampling stop time, and setting information is obtained: the sample stop time.
For the address at the first page 0 address where the sampled data is stored: the utility model provides a mode is that the address of the first page 0 address department of user's accessible terminal input storage sampling data, and the terminal sends the address of the first page 0 address department of storage sampling data to temperature and humidity sensor's controlgear, and temperature and humidity sensor's controlgear writes in the address of the first page 0 address department of receiving storage sampling data to setting page, has obtained the setting information: the address at the first page 0 address of the sampled data is stored. Another way is: the control device of the temperature and humidity sensor writes the address at the first page 0 address for storing the sampling data into the setting page.
The "address at the address of the first page 0 storing the sampled data" determines the first page information of the data page of the corresponding file, that is, the page corresponding to the "address at the address of the first page 0 storing the sampled data" is the first page of the data page of the corresponding file.
For valid data termination address: after the data acquisition is finished, the control equipment of the temperature and humidity sensor writes the actual effective data termination address (namely the address for storing the last acquired data of the corresponding file).
The setting process of the setting information of other setting items is not described in this embodiment again. The setup page of a file includes setup information that is descriptive of attributes of data stored in the data pages of the file. The control equipment of the data acquisition device controls the temperature and humidity sensor to acquire data at present according to the set information which is already set: such as the collection temperature or humidity, the sampling interval, the page from which the collected data is written (i.e. the first page of the data page), the collection of data and the writing of the collected data are performed, and in the whole process of collecting data, the information of the setting page related to the collected data is perfected, such as: sample start time, sample stop time, valid data end address. After the data collection is completed, the file corresponding to the data collection process is stored, the file setup page stores the setup information (i.e., attributes) of the file, i.e., how to collect, what to collect, the storage address of the collected data, etc., and the data page continuously stores the collected data.
The following describes the file management method of the Flash memory according to the present application in detail by using a specific embodiment.
Fig. 6 is a first flowchart of a file management method of a Flash memory provided in the present application, as shown in fig. 6, the method of this embodiment may include:
step S101, when at least one file to be stored exists, determining a target setting page of the file to be stored for each file to be stored, and writing target setting information related to data of the file to be stored into the target setting page; the target setting information comprises first page information of a target data page of a corresponding file to be stored;
step S102, for each file to be stored, determining a home page of a target data page of the file to be stored according to home page information in the target setting information, and continuously writing the acquired target data into a Flash memory from the home page; wherein, the target data is acquired by the data acquisition device according to the corresponding target setting information.
Specifically, the execution subject in this embodiment may be the control device 13 in fig. 1, and relates to a method for writing a file to the Flash memory in the embodiment shown in fig. 2.
The following describes a process of writing a file into the Flash memory in the embodiment shown in fig. 2, taking a data acquisition device as a temperature and humidity sensor as an example.
For step S101: when a user needs to start one or more data acquisition processes, namely at least one file to be stored exists, determining a respective target configuration page of each file to be stored so as to write target setting information related to acquisition of data of the corresponding file to be stored into the corresponding target configuration page; the setting information related to collecting data of the corresponding file to be stored includes the first page information of the target data page of the corresponding file to be stored, so that when a user needs to start one or more data collecting processes, that is, when at least one file to be stored exists, the first page information of the target data page of the file to be stored needs to be determined.
The above target setting information further includes: file attributes, a starting mode of the temperature and humidity sensor, a stopping mode of the temperature and humidity sensor, sampling intervals of the temperature and humidity sensor and the like. The target setting information is determined by a user according to the requirement of the user, so that the target setting information can be set by a terminal and then sent to the control equipment of the temperature and humidity sensor, and the control equipment of the temperature and humidity sensor writes the target setting information into a target configuration page.
It can be understood by those skilled in the art that the target setting information is not all setting information of the file to be stored, and after the data acquisition process is started, the control device of the temperature and humidity sensor may also write setting information related to the acquired data, such as start sampling time, end sampling time, and the like.
The following describes a procedure for determining the first page information of the target data page of the file to be stored and a procedure for determining the target configuration page of the file to be stored, respectively.
Before describing the process of determining the first page information of the target data page of the file to be stored and the process of determining the target configuration page of the file to be stored, the distribution of the storage area of the Flash memory is described first.
Fig. 7 is a schematic diagram of distribution of storage areas of a Flash memory according to an embodiment of the present application.
Referring to fig. 7, it can be seen that the leading area is on the top page, the default configuration area is on the page behind the leading area, the allocation area is on the page behind the default configuration area, and the content area is on the page behind the allocation area. The first P pages of the content area are setting pages of each file, the setting page of each file is 1 page, and the following S pages are data pages of each file.
For the allocation area and the content area: referring to fig. 7, the content of an item having item number 0005H in the allocation area is 000BH indicating the set page of the 000BH page in the content area, and the content of an item having item number 0006H in the allocation area is 0010H indicating the set page of the 0010H page in the content area. The item numbers are only used for clarity of description of the allocation region, and no item numbers are stored in the allocation region.
First, a process of determining the top page information of the target data page of the file to be stored will be described.
The process of determining the first page information of the target data page of the file to be stored may be as follows:
a1, reading the information included in the page where the distribution area is located to obtain the contents of all items included in the distribution area;
a2, if the content area stores at least one file, acquiring the maximum page number in the content of all items including the page number;
a3, reading the content of the first setting page indicated by the maximum page number to obtain first setting information in the first setting page, wherein the first setting information comprises tail page information of a data page of a file;
a4, determining the first page information of the file to be stored according to the last page information of the data page of the file included in the first setting information.
For a1, the control device of the temperature and humidity sensor reads the guide area to know the starting page of the distribution area and the number of pages occupied by the distribution area, namely, the page where the distribution area is located.
After knowing the page of the distribution area, the control equipment of the temperature and humidity sensor reads the information included in the page of the distribution area to obtain the contents of all items included in the distribution area; wherein the allocation area includes a plurality of items, and the content of each item does not necessarily set the page number of the page for the file.
For A2-A3, if the content area stores at least one file, extracting the maximum page number from the content including the page numbers in all the items included in the allocation area; according to the maximum page number, the setting information of the first setting page indicated by the maximum page number is read, that is, if the maximum page number is M, the content of the mth page is read. The maximum page number is the page number of the configuration page of the last file stored in the content area, and the first setting page is the setting page of the last file stored in the content area. From the foregoing explanation of the setting page, it can be known that the setting page includes the end page information of the file: valid data end address, and therefore, the last page information of the last file stored in the content area is available according to the setting information of the read first setting page.
For a4, for the case that the content area stores at least one file, the first page information of the file to be stored is determined according to the last page information of the last file stored in the content area. For example, the last page number of the last file stored in the content area is determined to be K according to the last page information of the last file stored in the content area, then the first page number of the data of the file to be stored may be K +1, and certainly may also be K +2, and so on, and then the first page information of the target data page of the file to be stored may be obtained, such as: the address at the first page 0 address of the target page of data.
If the content area does not store files, and the first page of the first file to be stored is determined, the page number of the first page of the file to be stored can be P +3 (corresponding to the fact that the content area comprises a P page setting page, a distribution area occupies a page, a default configuration area occupies a page, and a guide area occupies a page, the first page of the content area capable of storing data is the P +4 th page of the storage area, and the page number is P + 3).
The execution main body of the process of acquiring the home page information of the target data page is the control equipment of the temperature and humidity sensor, the starting mode of the temperature and humidity sensor is key starting, at the moment, the control equipment of the temperature and humidity sensor can determine the home page information of the target data page of the file to be stored according to the method in A1-A4 after receiving the starting instruction of the temperature and humidity sensor input by a user through keys, write the home page information of the target data page of the file to be stored into the target setting page, and then control the temperature and humidity sensor to start to collect data.
In addition, the control device of the temperature and humidity sensor can send the setting information of the read first setting page to the terminal for displaying according to the method in a 1-A3, after the user determines the first page information of the target data page of the file to be stored according to the method in a4, the first page information of the target data page of the file to be stored is input into the terminal, the terminal sends the first page information to the control device of the temperature and humidity sensor, and the first page information of the target data page of the file to be stored is written into the target configuration page by the control device of the temperature and humidity sensor. At this time, if the content area does not store a file, the page number transmitted to the terminal may be P +3 when determining the top page of the first file to be stored.
At this time, the tail page information in the first setting page can be displayed as a tail page number at the terminal, that is, the control device of the temperature and humidity sensor converts the 'valid data end address' into the tail page number and then sends the tail page number to the terminal for displaying. The home page information input by the user can also be a home page number, and the control equipment of the temperature and humidity sensor can convert the received home page number into an address at the home page 0 address for storing the sampling data and then write the address into a target setting page.
It should be understood by those skilled in the art that when there are a plurality of files to be stored and the setting information of each file is written into the corresponding target setting page, since the data has not been collected and written, the last page information of each file to be stored cannot be known, the first file to be stored (the file to be stored with the smallest page number of the setting page) can determine the first page information of the target data page according to the above-mentioned method, and after the first file to be stored is stored for the first page information of the target data page of the second file to be stored, the control device of the temperature and humidity sensor determines the first page information according to the method in a 1-a 4 and then writes the first page information into the corresponding setting page (i.e. the first page information of the setting information is not set through the terminal first time), at this time, there is no case that the content area includes no file, and the largest page number of the allocation area read at this time is the page number of the allocation page of the first file to be stored, the last file stored in the content area is the first file to be stored. For the first page of the target data page of the other file to be stored, the obtaining principle is the same as that of the second file to be stored, and the details are not repeated here.
Next, a process of acquiring a target configuration page of a file to be stored will be described.
The process of obtaining the target configuration page of the file to be stored may be as follows:
b1, reading the information included in the page where the distribution area is located to obtain the content of all items included in the distribution area;
b2, if the content area stores at least one file, acquiring the maximum page number in the content of the item including the page number in all the items;
b3, obtaining the page number of the target setting page according to the maximum page number, wherein the page number of the target setting page is the sum of the maximum page number and a preset value;
and B4, determining the target setting page according to the page number of the target setting page.
For B1: see the description of a1 above, and will not be described in detail here.
For B2-B3, if the content area stores at least one file, extracting the maximum page number from all the items in the distribution area, wherein the items comprise page numbers; if the number of pages occupied by the setting page of each file is 1 page, the page number of the target setting page can be obtained by adding 1 to the maximum page number, namely the preset value at this time is 1. After the page number of the target setting page is obtained, the target setting page, that is, the physical address of the Flash memory corresponding to the target setting page is determined.
If the content area does not store the file, the maximum page number does not exist, and when the page number of the target setting page of the first file to be stored is determined, if the allocation area occupies one page, the default configuration area occupies one page, and the guide area occupies one page, the page number of the target setting page of the first file to be stored is 3.
In addition, the page number of the target setup page of the file to be stored needs to be written into the allocation area. The specific method comprises the following steps:
c1, reading the information included in the page where the distribution area is located to obtain the content of all items included in the distribution area;
c2, obtaining the number of page numbers included in the content of all items, wherein the number is used for indicating the number of files stored in the content area;
c3, acquiring the target storage position of the page number of the target configuration page in the allocation area according to the number of the files stored in the content area, the item number of the first item in the allocation area and the number of bytes occupied by each item;
c4, writing the page number of the target page at the target storage location.
Specifically, for C1, refer to the foregoing description of a1, which is not repeated here.
With respect to C2, how many page numbers are read out from the allocation area indicates how many set pages the content area has, because each file has one set page, and therefore, the number of page numbers included in the contents of all items of the allocation area is the same as the number of files included in the content area.
For C3, as mentioned above, each entry in the allocation area occupies two bytes, and therefore, the target storage location of the page number of the target configuration page in the allocation area can be obtained according to the number of files included in the content area (or the number of page numbers included in the content of the read at least one entry), the offset address of the first entry in the allocation area, and the number of bytes occupied by each entry. The target storage position is a physical address for storing the page number of the target configuration page. The physical address of the first entry in the allocation area is the start address of the page where the allocation area is located, so that the offset address of the first entry in the allocation area can be known.
Specifically, the target storage location of the page number of the target configuration page in the allocation area can be obtained by the following implementation modes: acquiring a target offset address of an item storing the page number of the target configuration page according to the number of files included in the content area, the offset address of the first item in the allocation area and the number of bytes occupied by each item; the physical address of the page number storing the target configuration page, that is, the target storage location, is obtained according to the sum of the target offset address and the base address of the allocation area.
For step S102, after the target setting information is written into the target setting page, the control device of the temperature and humidity sensor may, according to the first page information in the target setting information: the address at the address of the first page 0 for storing the sampling data is obtained, and the first page of the target data page is obtained, namely the physical address of the first page of the target data page is obtained; the target data page is used for storing data of a file to be stored, the data of the file to be stored is data acquired by the temperature and humidity sensor according to set target setting information in the target setting page after the current acquisition process starts, and the set target setting information in the target setting page can include: temperature sampling, sampling interval 0.01S, etc. are performed.
After the home page of the target data page is determined, the control equipment of the temperature and humidity sensor controls the temperature and humidity sensor to start to collect data according to the starting mode of the temperature and humidity sensor set in the target setting page, controls the temperature and humidity sensor to collect data according to the setting information related to the data collection process in the target setting information, and continuously writes the data collected by the temperature and humidity sensor into the Flash memory from the home page.
Specifically, the temperature and humidity sensor converts data acquired according to setting information related to the data acquisition process in the target setting information into values stored in the Flash memory, and then continuously writes the values into the Flash memory from the home page. The method for converting the collected temperature and/or humidity into the value stored in the Flash memory by the temperature and humidity sensor is described in the section of the "guide area" above.
Each item in each of the target data pages is data of one sample point, and the length of each sample point is determined by the file attribute. When the file attribute is temperature sampling, the length of data of each sampling point is two bytes, and when the file attribute is temperature sampling and humidity sampling, the length of data of each sampling point is four bytes, the first two bytes are temperature representation, and the last two bytes are humidity representation. That is, the target data page is composed of a series of sample point data, and each byte not used in the corresponding page may be 0 xff.
After the data acquisition is finished, for each file to be stored, writing the tail page information of the file to be stored into the target configuration page of the file to be stored, and perfecting the target configuration information of the target configuration page, namely perfecting the attribute information of the data of the file to be stored. The end page information may include a physical address where the last item of sampled data is stored.
As can be understood by those skilled in the art, if there are a plurality of files to be stored, step S101 and step S102 may be performed sequentially, that is, after setting information of the plurality of files to be stored is written into respective setting pages, data is acquired according to setting information related to acquired data in the respective setting information, and the acquired setting information is written into respective data pages, that is, setting information of the plurality of files to be stored is set, and then data of each file to be stored is acquired; step S101 and step S102 may also have no precedence, that is, the setting information of one file to be stored is written into the corresponding setting page, then the data of the file to be stored is collected, then the setting information of the next file to be stored is written into the corresponding setting page and the data of the file to be stored is collected, that is, after the setting information of one file to be stored is set, the data of one file to be stored is collected.
In the embodiment, the setting page and the data page of the file are separately set, and the setting page contains the first page information of the corresponding data page, so that the setting information can be conveniently and quickly written into the setting page, and the data can be written into the data page. Meanwhile, the setting information of the files to be stored can be written into respective setting pages, data are acquired according to the setting information related to the acquired data in the respective setting information and are written into the respective data pages, and the convenience and the rapidness of the data writing process are ensured when the files to be stored need to be obtained.
The file management method of the Flash memory comprises the steps of determining a target setting page of a file to be stored for each file to be stored when at least one file to be stored is stored, and writing target setting information related to data of the file to be stored into the target setting page; the target setting information comprises first page information of a data page of a corresponding file to be stored; for each file to be stored, determining a home page of a target data page of the file to be stored according to home page information included in the target setting information, and continuously writing the acquired target data into a Flash memory from the home page; the target data is acquired by the data acquisition device according to the information related to the acquired data in the corresponding target setting information. The file management method of the Flash memory of the embodiment has the advantages that the data writing process is convenient and quick, and the convenience and the quickness of the data writing process can be ensured when a plurality of files to be stored need to be obtained.
The following describes a process of reading a file from a Flash memory by using a specific embodiment.
Fig. 8 is a flowchart of a second file management method for a Flash memory according to the present application, and as shown in fig. 8, the method of this embodiment may include:
step S201, reading information included in a page where the distribution area is located to obtain a page number of at least one setting page;
step S202, reading the setting information of the setting page indicated by each page number according to the page number of at least one setting page to obtain the setting information of each file stored in a Flash memory;
step S203, reading specific data included in a data page of the file to be read according to the file to be read identifier input by a user; the file identification to be read is determined by the user according to the setting information of each file stored in the Flash memory.
Specifically, for step S201, the control device of the humidity sensor knows the start page of the dispensing area and the number of pages occupied by the dispensing area, that is, the page where the dispensing area is located, by reading the lead area.
After knowing the page of the distribution area, the control equipment of the temperature and humidity sensor reads the information included in the page of the distribution area to obtain the contents of all items, extracts the page numbers in the contents of the items including the page numbers in all items, and obtains the page number of at least one set page.
In step S202, the setting information of the setting page indicated by each page number is read according to the page number of at least one setting page, and the setting information of each file stored in the Flash memory is obtained, that is, a setting information list is obtained, where the setting information list includes the setting information of all files stored in the Flash memory.
In step S203, after the control device of the temperature and humidity sensor obtains the setting information of all files stored in the Flash memory, the setting information is sent to the terminal for displaying, and the user obtains the setting information of all files stored in the Flash memory through the display interface of the terminal.
As described above, the setting information of each file includes file attributes, sampling intervals, sampling start times, sampling end times, leading page information and trailing page information of data pages, and the like. For example, if a user wants to view temperature data sampled in a time range from a1 to a2, and the file attribute in the setting information of a certain file is temperature sampling, the sampling start time is b1, the sampling end time is b2, b1 is earlier than or equal to a1, and b2 is later than or equal to a2, the file is determined to be a file to be read, and the first page information and the last page information of a data page in the setting information are the identifier of the determined file to be read; the user inputs the identification of the file to be read through the terminal, wherein the first page information seen by the user on the display interface can be the first page number, and the last page information seen on the display interface can be the last page number.
The terminal sends the identification of the file to be read to the control equipment of the temperature and humidity sensor, and the control equipment of the temperature and humidity sensor reads out the data of the data page of the file to be read and then sends the data to the terminal, so that the process of reading the file in the Flash memory is realized.
Specifically, the control device of the temperature and humidity sensor starts to read data from the first page of a data page of a file to be read, if the page number of the currently read page is less than or equal to the ending page number, whether an FFFF page appears is judged, if not, the data of the currently read page is read, and if yes, the data reading is stopped; and if the page number of the currently read page is larger than the ending page number, stopping reading the data. Here, the FFFF page refers to a page in which an error occurs.
As can be understood by those skilled in the art, if the first page information stored in the setting page of the Flash memory is "the address at the first page 0 address for storing the sampling data", and the terminal displays the first page number to the user, the control device of the temperature and humidity sensor converts the "address at the first page 0 address for storing the sampling data" into the first page number and then sends the first page number to the terminal for display. If the tail page information stored in the setting page of the Flash memory is the effective data termination address and the terminal displays the tail page number to the user, the control equipment of the temperature and humidity sensor converts the effective data termination address into the tail page number and then sends the tail page number to the terminal for displaying.
In the embodiment, the setting page and the data page of the file are separately set, and the setting page contains the attribute information of the corresponding data page, so that a user can determine the file to be read according to the setting information in the setting page, and the reading process is convenient and quick.
Fig. 9 is a schematic structural diagram of a first implementation of a file management device of a Flash memory according to an embodiment of the present application, and as shown in fig. 9, the device of this embodiment may include: an information setting module 11 and a data writing module 12.
The storage area of the Flash memory is divided into a plurality of pages, the storage area comprises a content area, the content area is used for storing at least one file, each file comprises a setting page and a data page, the data page is used for storing data, and the setting page is used for storing setting information related to collected data; the information setting module 11 is configured to, when at least one file to be stored is present, determine, for each file to be stored, a target setting page of the file to be stored, and write target setting information related to collecting data of the file to be stored into the target setting page; the target setting information comprises first page information of a target data page of a file to be stored; the data writing module 12 is configured to determine, for each file to be stored, a home page of a target data page of the file to be stored according to home page information in the target setting information, and continuously write the acquired target data into the Flash memory from the home page; wherein, the target data is acquired by the data acquisition device according to the corresponding target setting information.
An information setting module 11, configured to specifically read information included in a page where the allocation area is located, to obtain content of at least one item; if the content area stores at least one file, acquiring the maximum page number in the content of at least one item; obtaining the page number of a target setting page according to the maximum page number, wherein the page number of the target setting page is the sum of the maximum page number and a preset value; and determining the target setting page according to the page number of the target setting page.
The information setting module 11 is further specifically configured to enable the content of the item to further include an item number, enable the offset address corresponding to the item to be a preset multiple of the item number, and obtain, after reading information included in a page where the allocation area is located to obtain the content of at least one item, the number of page numbers included in the content of the at least one item, where the number is used to indicate the number of files stored in the content area; acquiring the target storage position of the page number of the target configuration page in the allocation area according to the number, the item number of the first item in the allocation area and the number of bytes occupied by each item; the number of bytes occupied by each item is the same as the preset multiple; after the page number of the target set page is obtained from the maximum page number, the page number of the target set page is written at the target storage location.
The information setting module 11 is further specifically configured to, after obtaining a maximum page number in respective page numbers of the multiple setting pages, read content of a first setting page indicated by the maximum page number to obtain first setting information in the first setting page, where the first setting information includes end page information of a data page of the file; and determining the first page information of the file to be stored according to the tail page information.
The information setting module 11 is further configured to, after the process of acquiring the data is finished, write the tail page information of the file to be stored into the target configuration page of the file to be stored for each file to be stored; wherein the end page information includes a physical address where the last item of acquired data is stored.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
Fig. 10 is a schematic structural diagram of a second implementation of the file management apparatus for a Flash memory according to an embodiment of the present application, and as shown in fig. 10, the apparatus according to the present embodiment may further include, on the basis of the apparatus structure shown in fig. 9: and a data reading module 13.
The data reading module 13 is configured to read information included in a page where the allocation area is located, and obtain a page number of at least one setting page; reading the setting information of the setting page indicated by each page number according to the page number of at least one setting page to obtain the setting information of each file stored in the Flash memory; reading data included in a data page of the file to be read according to the identification of the file to be read input by a user; the identification of the file to be read is obtained by the user according to the setting information of each file stored in the Flash memory.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
An embodiment of the present application further provides a file management system for a Flash memory, including: the Flash memory, the data acquisition device, the control device of the data acquisition device and the terminal device shown in fig. 2; the Flash memory, the data acquisition device and the terminal equipment are all connected with the control equipment of the data acquisition device; the control device of the data acquisition device comprises a file management device of the Flash memory shown in fig. 9 or fig. 10.
Embodiments of the present application also provide a computer-readable storage medium, which includes instructions that, when executed on a computer, cause the computer to perform the method in the embodiment shown in fig. 6 or fig. 8.
Fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present application, and referring to fig. 11, an electronic device 300 according to the embodiment includes: a processor 31, a memory 32 and a communication bus 33, wherein the communication bus 33 is used for realizing the connection between the components, the memory 32 is used for storing program instructions, and the processor 31 is used for reading the program instructions in the memory 32 and executing the method in the embodiment shown in fig. 6 or fig. 8 according to the program instructions in the memory 32.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (13)

1. A Flash memory, comprising: a storage area;
the storage area is divided into a plurality of pages, the storage area comprises a content area, the content area is used for storing at least one file, each file comprises a setting page and a data page, the data page is used for storing data, and the setting page is used for storing setting information related to the collection of the data; the storage area further comprises a distribution area, the distribution area comprises a plurality of items, when N files are stored in the content area, the content of each of the N items in the distribution area is the page number of the setting page of the corresponding file, and the page number of the setting page is used for indicating the storage position of the setting page; the contents of the N items comprise a maximum page number, the maximum page number is used for determining the page number of a target setting page, the page number of the target setting page is the sum of the maximum page number and a preset value, and the page number of the target setting page is used for determining the target setting page.
2. The Flash memory according to claim 1, wherein the storage area further comprises a boot area and a default configuration area;
the guide area is used for storing attribute information of the corresponding data acquisition device and dividing information of the storage area;
the default configuration area is used for storing default setting information related to the collected data.
3. A file management method of a Flash memory, characterized in that the method is based on the method of the Flash memory of claim 1 or 2; the method comprises the following steps:
when at least one file to be stored exists, determining a target setting page of each file to be stored, and writing target setting information related to the collection of the data of the file to be stored into the target setting page; the target setting information comprises first page information of a target data page of a file to be stored;
for each file to be stored, determining a home page of a target data page of the file to be stored according to home page information in target setting information, and continuously writing acquired target data into the Flash memory from the home page; and the target data is acquired by the data acquisition device according to corresponding target setting information.
4. The method according to claim 3, wherein the storage area further includes an allocation area, and the allocation area includes a plurality of entries, and when the content area stores N files, and the content of each of the N entries in the allocation area is the page number of the setting page of the corresponding file, the determining the target setting page of the file to be stored includes:
reading information included in a page where the distribution area is located to obtain the contents of all items included in the distribution area;
if the content area stores at least one file, acquiring the maximum page number in the content of the item including the page number in all the items;
obtaining the page number of the target setting page according to the maximum page number, wherein the page number of the target setting page is the sum of the maximum page number and a preset value;
and determining the target setting page according to the page number of the target setting page.
5. The method according to claim 4, wherein after reading the information included in the page where the allocation area is located to obtain the content of at least one item, the method further comprises:
acquiring the number of page numbers included in the contents of all the items, wherein the number is used for indicating the number of files stored in a content area;
acquiring the target storage position of the page number of the target configuration page in the allocation area according to the number, the offset address of the first item in the allocation area and the number of bytes occupied by each item;
after obtaining the page number of the target setup page according to the maximum page number, the method further includes:
writing a page number of the target setup page at a target storage location of the allocation area.
6. The method of claim 4, after said obtaining the maximum page number in the content of the at least one item, comprising:
reading the content of a first setting page indicated by the maximum page number to obtain first setting information in the first setting page, wherein the first setting information comprises tail page information of a data page of a file;
and determining the first page information of the target data page of the file to be stored according to the tail page information.
7. The method according to claim 3, wherein the storage area further includes an allocation area, and the allocation area includes a plurality of entries, and when the content area stores N files, and the content of each of the N entries in the allocation area is a page number of a setting page of the corresponding file, the method further includes:
after the process of data acquisition is finished, for each file to be stored, writing tail page information of the file to be stored into a target configuration page of the file to be stored; wherein the end page information includes a physical address where the last item of collected data is stored.
8. The method according to claim 3, further comprising an allocation area in the storage area, wherein the allocation area comprises a plurality of items, and when the content area stores N files, the content of each of the N items in the allocation area is the page number of the setting page of the corresponding file; the method further comprises the following steps:
reading information included in a page where the distribution area is located to obtain a page number of at least one setting page;
reading the setting information of the setting page indicated by each page number according to the page number of the at least one setting page to obtain the setting information of each file stored in the Flash memory;
reading data included in a data page of a file to be read according to an identifier of the file to be read input by a user; and the identification of the file to be read is acquired by the user according to the setting information of each file stored in the Flash memory.
9. A file management apparatus of a Flash memory, characterized in that the apparatus is an apparatus based on the Flash memory of claim 1 or 2, the apparatus comprising:
the information setting module is used for determining a target setting page of each file to be stored when at least one file to be stored is stored, and writing target setting information related to the collection of the data of the file to be stored into the target setting page; the target setting information comprises first page information of a target data page of a file to be stored;
the data writing module is used for determining a home page of a target data page of each file to be stored according to home page information in the target setting information, and continuously writing the acquired target data into the Flash memory from the home page; and the target data is acquired by the data acquisition device according to corresponding target setting information.
10. The apparatus of claim 9, further comprising: a data reading module;
the data reading module is used for further comprising a distribution area in the storage area, the distribution area comprises a plurality of items, and when N files are stored in the content area, the content of each of the N items in the distribution area is the page number of the setting page of the corresponding file; reading information included in a page where the distribution area is located to obtain a page number of at least one setting page;
reading the setting information of the setting page indicated by each page number according to the page number of the at least one setting page to obtain the setting information of each file stored in the Flash memory;
reading data included in a data page of a file to be read according to an identifier of the file to be read input by a user; and the identification of the file to be read is acquired by the user according to the setting information of each file stored in the Flash memory.
11. A file management system of a Flash memory is characterized by comprising: the Flash memory, the data acquisition device, the control device and the terminal device of the data acquisition device of claim 1 or 2;
the Flash memory, the data acquisition device and the terminal equipment are all connected with the control equipment of the data acquisition device;
wherein the control device of the data acquisition apparatus comprises the file management apparatus of a Flash memory according to claim 9 or 10.
12. A computer-readable storage medium comprising instructions which, when executed on a computer, cause the computer to perform the method of any of claims 3 to 8.
13. An electronic device, comprising: the device comprises a processor, a memory and a communication bus, wherein the communication bus is used for realizing the connection between all components, the memory is used for storing program instructions, and the processor is used for reading the program instructions in the memory and executing the method of any one of claims 3-8 according to the program instructions in the memory.
CN201810031114.0A 2018-01-12 2018-01-12 Flash memory, file management method and device of Flash memory Active CN108255433B (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN202111355122.9A CN114089916B (en) 2018-01-12 2018-01-12 Data acquisition system and temperature and humidity sensor system
CN201810031114.0A CN108255433B (en) 2018-01-12 2018-01-12 Flash memory, file management method and device of Flash memory
CN202111353834.7A CN114035749B (en) 2018-01-12 2018-01-12 Electronic equipment and Flash memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810031114.0A CN108255433B (en) 2018-01-12 2018-01-12 Flash memory, file management method and device of Flash memory

Related Child Applications (2)

Application Number Title Priority Date Filing Date
CN202111353834.7A Division CN114035749B (en) 2018-01-12 2018-01-12 Electronic equipment and Flash memory
CN202111355122.9A Division CN114089916B (en) 2018-01-12 2018-01-12 Data acquisition system and temperature and humidity sensor system

Publications (2)

Publication Number Publication Date
CN108255433A CN108255433A (en) 2018-07-06
CN108255433B true CN108255433B (en) 2021-12-07

Family

ID=62726963

Family Applications (3)

Application Number Title Priority Date Filing Date
CN202111353834.7A Active CN114035749B (en) 2018-01-12 2018-01-12 Electronic equipment and Flash memory
CN202111355122.9A Active CN114089916B (en) 2018-01-12 2018-01-12 Data acquisition system and temperature and humidity sensor system
CN201810031114.0A Active CN108255433B (en) 2018-01-12 2018-01-12 Flash memory, file management method and device of Flash memory

Family Applications Before (2)

Application Number Title Priority Date Filing Date
CN202111353834.7A Active CN114035749B (en) 2018-01-12 2018-01-12 Electronic equipment and Flash memory
CN202111355122.9A Active CN114089916B (en) 2018-01-12 2018-01-12 Data acquisition system and temperature and humidity sensor system

Country Status (1)

Country Link
CN (3) CN114035749B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109683829B (en) 2019-01-04 2020-10-30 中国科学院声学研究所东海研究站 Intelligent storage control system based on FPGA and application thereof
CN112084147A (en) * 2020-09-10 2020-12-15 珠海美佳音科技有限公司 Data storage method, data acquisition recorder and electronic equipment
CN112698984B (en) * 2020-12-17 2023-07-04 宁波三星医疗电气股份有限公司 Database recovery method of embedded device, electronic device and medium
CN113031880B (en) * 2021-05-27 2021-08-17 湖南博匠信息科技有限公司 Upper computer communication method and system suitable for multi-model storage equipment
CN114265562B (en) * 2021-12-27 2022-09-20 北京国腾创新科技有限公司 File storage method and system based on flash memory

Citations (13)

* 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
US20050132129A1 (en) * 2001-08-28 2005-06-16 International Business Machines Corporation Data management in flash memory
CN1632765A (en) * 2004-12-31 2005-06-29 大唐微电子技术有限公司 A flash memory file system management method
CN101079075A (en) * 2007-05-24 2007-11-28 北京交通大学 Portable serial number recorder and implementation method
CN101520787A (en) * 2008-03-19 2009-09-02 中国科学院自动化研究所 Method for storing real-time data
US7690030B1 (en) * 2000-01-06 2010-03-30 Super Talent Electronics, Inc. Electronic data flash card with fingerprint verification capability
US7984303B1 (en) * 2000-01-06 2011-07-19 Super Talent Electronics, Inc. Flash memory devices with security features
CN102375781A (en) * 2010-08-04 2012-03-14 群联电子股份有限公司 Data protecting method, memory controller and portable memory storage device
CN102981965A (en) * 2012-11-07 2013-03-20 江苏乐买到网络科技有限公司 NAND FLASH file system
CN104317732A (en) * 2014-10-27 2015-01-28 上海动联信息技术股份有限公司 Large-capacity Flash chip space management method
US20150293880A1 (en) * 2013-10-16 2015-10-15 The Regents Of The University Of California Serial bus interface to enable high-performance and energy-efficient data logging
CN105917322A (en) * 2013-12-31 2016-08-31 赫耳墨斯科姆股份责任有限公司 Method for exchanging controls through a usb disc and relative devices which allow the implementation thereof
CN106776752A (en) * 2016-11-22 2017-05-31 上海拓攻机器人有限公司 A kind of embedded type file storage system and method for being applied to unmanned plane during flying data

Family Cites Families (28)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4433792B2 (en) * 2003-12-26 2010-03-17 Tdk株式会社 MEMORY CONTROLLER, FLASH MEMORY SYSTEM PROVIDED WITH MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
US7984084B2 (en) * 2005-08-03 2011-07-19 SanDisk Technologies, Inc. Non-volatile memory with scheduled reclaim operations
CN100370445C (en) * 2005-08-10 2008-02-20 北京中星微电子有限公司 A data transmission apparatus and method based on file allocation table (FAT)
JP4895262B2 (en) * 2005-12-09 2012-03-14 株式会社メガチップス Information processing apparatus, controller, and file reading method
TW201025002A (en) * 2008-12-26 2010-07-01 Asmedia Technology Inc Method of writing data into flash memory based on file system
CN101582089B (en) * 2009-07-02 2011-06-29 北京讯风光通信技术开发有限责任公司 File management method of embedded equipment and system
TWI473101B (en) * 2011-03-08 2015-02-11 Dust Networks Inc Methods and system for erasing data stored in nonvolatile memory in low power applications
KR20130010343A (en) * 2011-07-18 2013-01-28 삼성전자주식회사 Flash memory apparatus
CN102279805A (en) * 2011-09-06 2011-12-14 四川九洲电器集团有限责任公司 Memory data storing and reading method
CN103198166B (en) * 2013-04-16 2015-10-21 电子科技大学 A kind of down-hole Large Copacity acoustic logging while drilling data real-time storage device
CN103456360B (en) * 2013-09-13 2016-08-17 昆腾微电子股份有限公司 The management method of nonvolatile memory and device
CN103646063B (en) * 2013-11-27 2016-08-17 中国航天科技集团公司第五研究院第五一三研究所 A kind of spaceborne high speed document management system
CN103645993B (en) * 2013-12-24 2016-04-06 飞天诚信科技股份有限公司 A kind of Data Update based on large page Flash and read method
JP6274857B2 (en) * 2013-12-26 2018-02-07 キヤノン株式会社 MEMORY CONTROL DEVICE, MEMORY CONTROL METHOD, AND PROGRAM
KR102252419B1 (en) * 2014-01-09 2021-05-14 한국전자통신연구원 System and method for efficient address translation on Flash memory device
EP3115903B1 (en) * 2014-03-07 2020-04-15 Huawei Technologies Co., Ltd. File accessing method and related device
TWI516922B (en) * 2014-03-12 2016-01-11 慧榮科技股份有限公司 Data storage device and flash memory garbage collection method
KR20150113572A (en) * 2014-03-31 2015-10-08 삼성전자주식회사 Electronic Apparatus and Method for Acquiring of Image Data
CN104090732A (en) * 2014-07-21 2014-10-08 昆腾微电子股份有限公司 Nonvolatile memory management method and device
CN111736773A (en) * 2015-04-09 2020-10-02 株式会社日立制作所 Storage system and data control method
JP6542076B2 (en) * 2015-08-28 2019-07-10 東芝メモリ株式会社 Memory system
US9875156B2 (en) * 2015-10-01 2018-01-23 Sandisk Technologies Llc Data storage device with a memory die that includes an interleaver
CN105204788B (en) * 2015-10-28 2018-03-30 内蒙古青电云电力服务有限公司 A kind of data processing method based on Internet of Things
CN105550345B (en) * 2015-12-25 2019-03-26 百度在线网络技术(北京)有限公司 File operation method and device
CN106406756B (en) * 2016-09-05 2019-07-09 华为技术有限公司 A kind of space allocation method and device of file system
CN106878779B (en) * 2016-10-12 2023-10-13 珠海极海半导体有限公司 NFC video playing device and video processing method
CN106569748B (en) * 2016-10-27 2019-04-09 南方电网科学研究院有限责任公司 The data processing method and device of Flash File System
CN107247563A (en) * 2017-07-06 2017-10-13 济南浪潮高新科技投资发展有限公司 A kind of block message mark implementation method of NAND FLASH chips

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7690030B1 (en) * 2000-01-06 2010-03-30 Super Talent Electronics, Inc. Electronic data flash card with fingerprint verification capability
US7984303B1 (en) * 2000-01-06 2011-07-19 Super Talent Electronics, Inc. Flash memory devices with security features
US20050132129A1 (en) * 2001-08-28 2005-06-16 International Business Machines Corporation Data management in flash memory
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
CN101079075A (en) * 2007-05-24 2007-11-28 北京交通大学 Portable serial number recorder and implementation method
CN101520787A (en) * 2008-03-19 2009-09-02 中国科学院自动化研究所 Method for storing real-time data
CN102375781A (en) * 2010-08-04 2012-03-14 群联电子股份有限公司 Data protecting method, memory controller and portable memory storage device
CN102981965A (en) * 2012-11-07 2013-03-20 江苏乐买到网络科技有限公司 NAND FLASH file system
US20150293880A1 (en) * 2013-10-16 2015-10-15 The Regents Of The University Of California Serial bus interface to enable high-performance and energy-efficient data logging
CN105917322A (en) * 2013-12-31 2016-08-31 赫耳墨斯科姆股份责任有限公司 Method for exchanging controls through a usb disc and relative devices which allow the implementation thereof
CN104317732A (en) * 2014-10-27 2015-01-28 上海动联信息技术股份有限公司 Large-capacity Flash chip space management method
CN106776752A (en) * 2016-11-22 2017-05-31 上海拓攻机器人有限公司 A kind of embedded type file storage system and method for being applied to unmanned plane during flying data

Also Published As

Publication number Publication date
CN114035749B (en) 2023-02-28
CN114089916A (en) 2022-02-25
CN114089916B (en) 2022-12-20
CN108255433A (en) 2018-07-06
CN114035749A (en) 2022-02-11

Similar Documents

Publication Publication Date Title
CN108255433B (en) Flash memory, file management method and device of Flash memory
US7664783B2 (en) File management program, data structure, and file management device
US7899967B2 (en) Systems for accessing memory card and methods for accessing memory card by a control unit
US20160034201A1 (en) Managing de-duplication using estimated benefits
CN110442308B (en) Data block storage method, device, equipment and storage medium
CN108399050B (en) Data processing method and device
CN111104178A (en) Dynamic library loading method, terminal device and storage medium
CN110569218B (en) Offline modification method and device for EXT file system and storage medium
CN107562766B (en) Data file writing method, device and system
CN112000628A (en) Multi-channel laser radar data storage method and device and electronic equipment
CN112000589A (en) Data writing method, data reading device and electronic equipment
CN103177019B (en) Usb storage device and driving method thereof
CN108664505A (en) A kind of deriving method and device of database table structure
CN110334057B (en) File access method and system thereof
CN112181275A (en) Data processor and data processing method
CN112764673B (en) Hyperspectral linear array data storage rate optimization method, device and storage medium
CN112637602B (en) JPEG interface and digital image processing system
US10353589B2 (en) Data storage device and data management method for data storage device
CN106815106B (en) Host interface test method, device, test terminal and system
JP5629438B2 (en) File management apparatus and control method thereof
CN112035380A (en) Data processing method, device and equipment and readable storage medium
CN113705821B (en) PCIE-based method, equipment and medium for realizing waveform drawing by ADC board card
CN111831224B (en) Method, system and equipment for erasing residual space of exFAT partition file
JP5844775B2 (en) Apparatus and method for PLC data log retrieval
CN104484634B (en) The dilatation detection method of RAM card and the card reader with dilatation detection function

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: 20200515

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