Invention content
The embodiment of the present application provides the file management method and device of a kind of flash storage, flash storage, with reality
Now to the fast operating comprising setting information and the two-part file of continuous data.
In a first aspect, the embodiment of the present application provides a kind of flash storage, including:Storage region;
The storage region is divided into multiple pages, and the storage region includes content regions, and the content regions are used to store
At least one file, each file include setting page and data page, and for storing data, the setting page is used for the data page
Storage is with acquiring the relevant setting information of data.
In a kind of possible design, the storage region further includes distribution area, and the distribution area includes multiple items, when interior
When appearance area is stored with N number of file, then page number of the respective content of N number of item for the setting page of corresponding document in area is distributed, it is described
The page number of setting page is used to indicate the storage location of setting page.
In a kind of possible design, the storage region further includes boot section and default configuration area;
The boot section is used to store the attribute information of corresponding data acquisition device and the division letter of the storage region
Breath;
The default configuration area is for storage and the relevant default information of gathered data.
Second aspect, the embodiment of the present application provide a kind of file management method of flash storage, the method be based on
The method of flash storage described in any possible design of first aspect;The method includes:
When file to be stored is at least one, for each file to be stored, the target setting of file to be stored is determined
Page, and will be written in the target setting page with the relevant target setting information of data for acquiring file to be stored;Wherein, it is described
Target setting information includes the First page information of the target data page of file to be stored;
For each file to be stored, the First page information in target setting information determines the target of file to be stored
The homepage of data page, and since the homepage, the target data of acquisition is continuously written into the flash storage;Wherein,
The target data is that data acquisition device is acquired according to corresponding target setting information.
In a kind of possible design, distribution area is further included, and the distribution area includes multiple items in the storage region,
When content regions are stored with N number of file, then page number of the respective content of N number of item for the setting page of corresponding document in area is distributed
When, the target setting page of the determining file to be stored, including:
The information that page where reading the distribution area includes obtains the content of all that the distribution area includes;
If content regions are stored at least one file, obtain in the content of item that all items include page number most
Big page number;
According to the maximum page number, the page number of the target setting page is obtained, the page number of the target setting page is described
The sum of maximum page number and preset value;
The page number of page according to the target is set, determines the target setting page.
In a kind of possible design, in the information that the page where the reading distribution area includes, at least one item is obtained
Content after, the method further includes:
The quantity of page number that the content of described all includes is obtained, the quantity is used to indicate the text of content regions storage
The quantity of part;
According to the byte number that the offset address of first item and each item occupy in the quantity, distribution area, described in acquisition
The page number of target configuration page is in the target storage position in the distribution area;
According to the maximum page number, after obtaining the page number of the target setting page, the method further includes:
The page number of the write-in target setting page at the target storage position in the distribution area.
In a kind of possible design, after the maximum page number in the content for obtaining described at least one, packet
It includes:
The content of the first setting page of maximum page number instruction is read, obtains the first setting information in the first setting page, institute
State the endpage information that the first setting information includes the data page of file;
According to the endpage information, the First page information of the target data page of the file to be stored is determined.
In a kind of possible design, distribution area is further included, and the distribution area includes multiple items in the storage region,
When content regions are stored with N number of file, then page number of the respective content of N number of item for the setting page of corresponding document in area is distributed
When, the method further includes:
After the process of gathered data, for each file to be stored, the endpage information of file to be stored is written
In the target configuration page of file to be stored;Wherein, the endpage information is including storing the data of last acquisition physically
Location.
In a kind of possible design, distribution area is further included, and the distribution area includes multiple items in the storage region,
When content regions are stored with N number of file, then page number of the respective content of N number of item for the setting page of corresponding document in area is distributed
When;The method further includes:
The information that page where reading the distribution area includes obtains the page number of at least one setting page;
According to the page number of at least one setting page, the setting information of the setting page of each page number instruction is read, is obtained
The setting information of each file stored in the flash storage;
According to the mark of the file input by user that continues, continue the data that the data page of file includes described in reading;Its
In, the mark of the file that continues is that user gets according to the setting information of each file stored in flash storage.
The third aspect, a kind of document management apparatus of flash storage of the embodiment of the present application, described device is is based on
The device of flash storage described in any possible design of first aspect, described device include:
Information setup module, for when file to be stored is at least one, for each file to be stored, determining to wait to deposit
The target setting page of file is stored up, and is set the target is written with the relevant target setting information of data for acquiring file to be stored
It puts in page;Wherein, the target setting information includes the First page information of the target data page of file to be stored;
Data write. module, for for each file to be stored, the First page information in target setting information to determine
The homepage of the target data page of file to be stored, and since the homepage, the target data of acquisition is continuously written into described
In flash storage;Wherein, the target data is that data acquisition device is acquired according to corresponding target setting information.
In a kind of possible design, described device further includes:Data read module;
The data read module is used for, and distribution area is further included, and the distribution area is including multiple in the storage region
, when content regions are stored with N number of file, then distribute page of the respective content of N number of item for the setting page of corresponding document in area
Number when;The information that page where reading the distribution area includes obtains the page number of at least one setting page;
According to the page number of at least one setting page, the setting information of the setting page of each page number instruction is read, is obtained
The setting information of each file stored in the flash storage;
According to the mark of the file input by user that continues, continue the data that the data page of file includes described in reading;Its
In, the mark of the file that continues is that user gets according to the setting information of each file stored in flash storage.
Fourth aspect, the embodiment of the present application provide a kind of file management system of flash storage, including:First aspect
Flash storage, data acquisition device, the control device of the data acquisition device and end described in any possible design
End equipment;
The flash storage, the data acquisition device and the terminal device with the data acquisition device
Control device connects;
Wherein, the control device of the data acquisition device is included described in any possible design of the third aspect
The document management apparatus of flash storage.
5th aspect, the embodiment of the present application provide a kind of computer readable storage medium, including instruction, when it is in computer
During upper operation so that computer performs the method described in any possible design of second aspect.
6th aspect, the embodiment of the present application provide a kind of electronic equipment, including:Processor, memory and communication bus, institute
The connection that communication bus is used to implement between each component is stated, the memory for storing program instruction, use by the processor
Program instruction in the reading memory, and the program instruction in the memory performs any possibility of second aspect
Method described in design.
Setting page and data page in the application due to file are provided separately, and set and corresponding data page is included in page
First page information, therefore, can easily and fast by setting information be written setting page, write data into data page.Meanwhile may be used also
With first by the setting information of multiple files to be stored write-in it is respective setting page in, then respectively according in respective setting information with adopting
Collect the acquisition that the related setting information of data carries out data, be written in respective data page, ensure that is needing to obtain multiple treat
During storage file, the fast and easy of data writing process.
Specific embodiment
Purpose, technical scheme and advantage to make the embodiment of the present application are clearer, below in conjunction with the embodiment of the present application
In attached drawing, the technical solution in the embodiment of the present application is clearly and completely described, it is clear that described embodiment is
Some embodiments of the present application, instead of all the embodiments.Based on the embodiment in the application, those of ordinary skill in the art
All other embodiments obtained without creative efforts shall fall in the protection scope of this application.
Fig. 1 is a kind of possible system architecture diagram provided by the embodiments of the present application, and referring to Fig. 1, which may include
Flash storage 11, data acquisition device 12, the control device 13 of data acquisition device and terminal 14.Wherein, Flash is stored
The storage region of device 11 is divided into multiple pages, and storage region includes content regions, and content regions are for storing at least one file, often
A file includes setting page and data page, and data page is used to store the data of data acquisition device acquisition, sets page for storing
With the relevant setting information of gathered data, setting information includes the First page information of data page corresponding with the setting page, Mei Gewen
The data page of part is at least one page.
Specifically, after flash storage 11 establishes connection with control device 13, control device 13 can be to flash storage
It carries out write operation and reads the operation of the information of flash storage memory storage.Control device 13 can receive terminal 14 and send
With the relevant setting information of gathered data, and will setting information relevant with gathered data be written flash storage 11 in
Set page in, control device 13 according in flash storage 11 set page in setting information control data acquisition device 12 into
Row data acquire, and 12 collected data of data acquisition device are written in data page;Wherein, page and data page group are set
Into the content of a file.
Since each file stored in flash storage includes setting page and data page, in the corresponding text of write-in
During part, setting page is first determined, and Part setting information is written in page is set, so that control device can control data acquisition device
According to setting information gathered data, setting information ablation process is quick and convenient, and due to including corresponding document in setting information
Data page First page information, the region that the data of acquisition are continuously written into also is determined, and therefore, continuous data ablation process is also fast
Speed is convenient.
The flash storage of the application is described in detail using specific embodiment below.
Fig. 2 is that the storage region of flash storage provided by the embodiments of the present application divides schematic diagram, referring to Fig. 2, Flash
The storage region of memory is divided into multiple pages, and storage region includes content regions 21, distribution area 22, boot section 23 and acquiescence and matches
Put area 24.
Content regions 21 are for storing at least one file, and each file includes setting page and data page, and data page is used to deposit
Data are stored up, setting page is used to storing and obtaining the relevant setting information of data.
It distributes area 22 and includes multiple items, when content regions are stored with N number of file, then distribute N number of item in area respectively content
The page number of setting page including corresponding document.
Boot section 23 is used to store the attribute information of corresponding data acquisition device and the division information of storage region.
Default configuration area 24 is for storage and the relevant default information of gathered data.
Specifically, the least unit that the storage region of the flash storage in the present embodiment is wiped according to Flash divides
For multiple pages of No. 0 starting, if the memory capacity of flash storage is 2M, the least unit of Flash erasings is 1KB, then stores
Region is divided into page 2048, wherein, it is smaller than being equal to page 2048 for the number of pages of storage.
First, first boot section 23 is illustrated.
Boot section 23 is used to store the attribute information of corresponding data acquisition device and the division information of storage region, such as
Each area of the storage version of data acquisition device, title, creation time, type, storage region is respective to be started page number at and shared page
Number etc., may also include:The data acquisition device time of making the product and calibration data etc..It can be using page 0 of storage region as boot section.
If data acquisition device be Temperature Humidity Sensor, flash storage boot section storage specific data and
Attribute can be found in table 1.
Table 1, the specific data and attribute of boot section storage
Referring to table 1 it is found that boot section includes:The store name of Temperature Humidity Sensor, temperature resolution, 0 reality represented
Minimum temperature, maximum temperature, humidity resolution ratio, the 0 practical minimum humidity represented, highest humidity etc.;It further includes:Boot section originates
Page number, boot section number of pages, default configuration area start page number at, default configuration area number of pages, distribution area start page number at, distribute area's number of pages,
Content regions start page number at, content regions number of pages.
Therefore, by reading the content of boot section, it can know the position of distribution area, default configuration area, content regions.
Wherein, for temperature resolution;Use two byte representations:[ByteHigh,ByteLow], ByteHighRepresent decimal
Digit after point, ByteLowRepresent number, therefore temperature resolution T1Reduction formula be:I.e.
If the temperature resolution that boot section stores is 0x201, then practical temperature resolution isWherein,
The corresponding low byte Byte of 0x201LowIt is 0X01, the corresponding upper byte Byte of 0x201HighIt is 0X02, [0X02,0X01]=
0X201。
In the actual use process, the control device of Temperature Humidity Sensor reads the temperature stored in boot section and differentiates
Rate, according to the method described above, you can practical temperature resolution is obtained, for controlling measurement of the Temperature Humidity Sensor to temperature.
For the practical minimum temperature T that can be detected in Temperature Humidity Sensor detection rangeMin is real:If flash storage
The temperature value T of middle storageFlash1- 46.85 DEG C are represented when being 0, is expressed as TMin=-46.85 DEG C, then TMin is real=TFlash1*T1+TMin
=0*0.01-46.85=-46.85.
For humidity resolution ratio:With two byte representations:[ByteHigh,ByteLow], ByteHighRepresent the position after decimal point
Number, ByteLowTable number, therefore humidity resolution ratio H1Reduction formula be:I.e. as boot section is deposited
The humidity resolution ratio of storage is 0x201, then practical temperature resolution isWherein, 0x201 is corresponding
Low byte ByteLowIt is 0X01, the corresponding upper byte Byte of 0x201HighIt is 0X02, [0X02,0X01]=0X201.
In the actual use process, the control device of Temperature Humidity Sensor reads the humidity stored in boot section and differentiates
Rate, according to the method described above, you can practical humidity resolution ratio is obtained, for controlling measurement of the Temperature Humidity Sensor to humidity.
For the conversion between the temperature value that is stored in actual temperature and flash storage:If in known flash storage
The temperature value of storage is TFlash2, then actual temperature TIt is real=TFlash2×T1+TMin is realIf known real temperature TIt is real, then
In the actual use process, if the control device of Temperature Humidity Sensor reads the temperature stored in flash storage
Angle value can then pass through formula:TIt is real=TFlash2×T1+TMin is real, obtain practical temperature;If the control device of Temperature Humidity Sensor
By in the collected temperature value write-in flash storage of Temperature Humidity Sensor, then pass through formulaIt obtains
Store the value into flash storage.
For the conversion between the humidity value that is stored in actual humidity and flash storage:If in known flash storage
The humidity value of storage is HFlash, then actual humidity HIt is real=HFlash×H1+HMinIf known actual humidity HIt is real, thenAs shown in Table 1, HMinEqual to 0.
In the actual use process, if being stored in the control device reading flash storage of Temperature Humidity Sensor wet
Angle value can then pass through formula:HIt is real=HFlash×H1+HMin, obtain practical humidity;If the control device of Temperature Humidity Sensor will
In the collected humidity value write-in flash storage of Temperature Humidity Sensor, then pass through formulaIt is stored
Value into flash storage.
Secondly, default configuration area 24 is illustrated.
Default setting area 24, for storage and the relevant default information of gathered data, for example, adopting in setting information
Sample interval.
Then, distribution area 22 is illustrated.
It distributes area 22 and includes multiple items, each single item occupies 2 bytes, and each byte is 8, i.e. 16bytes, each item
Content sets the page number of page for respective file;If content regions 21 are stored with N number of file, distributing in area has N number of item, respective
Page number of the content for the setting page of corresponding document;In addition to N number of item, the content of remaining can be ffffH.
In this way, the physical address of the first item in distribution area is the initial address of page where distributing area, it may thus be appreciated that point
Offset address with the first item in area, quantity and each byte number occupied further according to content area file, it is possible to
To the corresponding offset address of storage location of the target setting page of current file to be stored, the storage location of page is set according to target
Corresponding offset address, so that it may obtain the physical address of storage target setting page.
Then, content regions 21 are illustrated.
For storing at least one file, each file includes setting page and data page for content regions 21.
Data page is used for the data of Coutinuous store data acquisition device acquisition, and the data page of each file includes at least one
Page, and the number of pages that the data page for not limiting each file includes are related to the data for specifically needing to store.
Page is set and includes number corresponding with the setting page with the relevant setting information of gathered data, setting information for storing
According to the First page information of page.
If data acquisition device is Temperature Humidity Sensor, the specific data of the setting page storage of flash storage can join
It is shown in Table 2.
The specific data that table 2, setting page store
As shown in Table 2, the setting option of page is set to include:File attribute, the Starting mode of Temperature Humidity Sensor, humiture pass
The stopping mode of sensor, the sampling interval of Temperature Humidity Sensor, the initial time of sampling, the dwell time of sampling, storage sampling
Address, valid data termination address at 0 location of homepage of data etc..
After being configured to above-mentioned each setting option, it can obtain and the relevant setting information of gathered data.
Fig. 3 is file attribute provided by the embodiments of the present application definition figure, and Fig. 4 is Starting mode provided by the embodiments of the present application
Definition figure, Fig. 5 define figure for stopping mode provided by the embodiments of the present application.
For file attribute, referring to Fig. 3, two bytes are occupied, 16, the position do not used is defaulted as " 1 ";For 0:
If 0 represents to carry out temperature sampling for 0, represented for 1 without temperature sampling;For 1:It represents to carry out humidity sampling for 0, is
1 represents to sample without humidity.
When user demand is detection temperature, user is referred to temperature acquisition by terminal input temp acquisition instructions, terminal
The control device for being sent to Temperature Humidity Sensor is enabled, the control device of Temperature Humidity Sensor is incited somebody to action according to temperature acquisition instruction is received
File attribute is set as collecting temperature, i.e., is substituted for " 0 " by " 1 " in the value of 0 of the corresponding byte of file attribute.When user needs
When asking as detection temperature and humidity, user inputs humiture collection by terminal and instructs, and humiture collection is instructed and sent by terminal
To the control device of Temperature Humidity Sensor, the control device of Temperature Humidity Sensor is instructed according to humiture collection is received by file
Attribute is set as acquisition humiture, i.e., is substituted for " 0 " by " 1 " in the value of 0 of the corresponding byte of file attribute, the value of 1 by
" 1 " is substituted for " 0 ".
By the above process, that is, the setting to file attribute is completed, obtained the corresponding setting information of file attribute.
For the Starting mode of Temperature Humidity Sensor, referring to Fig. 4, occupy two bytes, 16, the position acquiescence do not used
For " 1 ";For 0:If 0 represents that button starts Temperature Humidity Sensor for 1, otherwise button does not influence opening for Temperature Humidity Sensor
It is dynamic;For 1:Delaying a period of time after setting completed for 0 expression setting information, (delay time is that user is set by terminal
) startup Temperature Humidity Sensor, for 2:Start by set date Temperature Humidity Sensor is represented for 1.
Setting for Starting mode obtains the process of the corresponding setting information of Starting mode, referring to obtaining file attribute
The process of corresponding setting information, details are not described herein again.
For stopping mode, referring to Fig. 5, occupy two bytes, 16, the position do not used is defaulted as " 1 ";For 0:
Represent that button stops Temperature Humidity Sensor for 0, otherwise button does not influence the stopping of Temperature Humidity Sensor;For 1:It is represented for 0
To stop sampling when reading data from flash storage, otherwise not influence to sample;For 2:It is fixed for 0 expression hits,
Otherwise sampling length does not limit.
For stopping the setting of mode, the process of the corresponding setting information of stopping mode being obtained, referring to obtaining file attribute
The process of corresponding setting information, details are not described herein again.
For the sampling interval:User will be sent to temperature and humidity sensing in the sampling interval by terminal input sample interval, terminal
The control device of device, the control device of Temperature Humidity Sensor will receive the sampling interval and byte corresponding to the sampling interval are written
Place, has obtained setting information:Sampling interval.
If user is set not over terminal using interval, the control device of Temperature Humidity Sensor is in control temperature and humidity sensing
When device is sampled, it can be sampled by the default sample Separation control Temperature Humidity Sensor read in default setting page.
For sampling initial time:When Temperature Humidity Sensor startup starts to acquire corresponding data, Temperature Humidity Sensor
The corresponding time is written to the corresponding byte of sampling initial time control device, has obtained setting information:During sampling starting
Between.
For sampling dwell time:When Temperature Humidity Sensor stops acquisition corresponding data, the control of Temperature Humidity Sensor
The corresponding time is written to the corresponding byte of sampling dwell time equipment, has obtained setting information:Sample dwell time.
The address at 0 location of homepage for storing sampled data:A kind of mode can input storage by terminal for user and adopt
Address at 0 location of homepage for storing sampled data is sent to Temperature Humidity Sensor by the address at 0 location of homepage of sample data, terminal
Control device, the control device of Temperature Humidity Sensor by the address at 0 location of homepage for receiving storage sampled data be written to
It sets in page, has obtained setting information:Store the address at 0 location of homepage of sampled data.Another mode is:Humiture passes
The control device of sensor sets " address at 0 location of homepage of storage sampled data " write-in in page.
Wherein, " address at 0 location of homepage of storage sampled data " determines the First page information of the data page of corresponding document,
Page namely corresponding to " address at 0 location of homepage of storage sampled data " is exactly the homepage of the data page of corresponding document.
For valid data termination address:After data acquire, the control device of Temperature Humidity Sensor will actually have
Imitate data termination address (address for storing last gathered data of corresponding document) write-in.
For being repeated no more in setting up procedure the present embodiment of the setting information of other setting options.The setting of one file
The setting information that page includes is the description of the attribute of the data of the data page storage to this document.The control of data acquisition device is set
Standby control Temperature Humidity Sensor is during current gathered data, according to the setting information set:For example it is acquisition
Temperature or humidity, the sampling interval, acquisition data (the namely homepage of data page) be written since which page, progress data
Acquisition and acquisition data write-in, and during the entire process of gathered data, improve and the relevant setting of gathered data
The information of page is such as:Sample initial time, sampling dwell time, valid data termination address.After data acquire, with this
The corresponding file of data acquisition, which just stores, to be finished, and the setting information of this document is stored (also in this document setting page
Attribute), that is, how to acquire, what, the storage address of gathered data etc. of acquisition, Coutinuous store is adopted in data page
The data of collection.
The file management method of the flash storage of the application is carried out specifically using specific embodiment below
It is bright.
Fig. 6 is the file management method flow chart one of flash storage that the application provides, as shown in fig. 6, the present embodiment
Method can include:
Step S101, when file to be stored is at least one, for each file to be stored, file to be stored is determined
Target sets page, will be set in page with the relevant target setting information write-in target of data for acquiring file to be stored;Wherein, mesh
Mark the First page information that setting information includes the target data page of corresponding file to be stored;
Step S102, for each file to be stored, the First page information in target setting information determines text to be stored
The homepage of the target data page of part, and since homepage, the target data of acquisition is continuously written into flash storage;Wherein,
Target data is that data acquisition device is acquired according to respective objects setting information.
Specifically, the executive agent in the present embodiment can be the control device 13 in Fig. 1, be related to implementation shown in Fig. 2
The method of flash storage write-in file in example.
Below by data acquisition device for for Temperature Humidity Sensor, file is written in embodiment shown in Fig. 2
The process of flash storage illustrates.
For step S101:When user needs to start one or more data acquisition, that is to say, that exist to
A few file to be stored, it is thus necessary to determine that each respective target configuration page of file to be stored, it will text to be stored corresponding to acquisition
The relevant target setting information of data of part is written in corresponding target configuration page;And to the data of the corresponding file to be stored of acquisition
Relevant setting information includes the First page information of the target data page of corresponding file to be stored, therefore, when user needs to start
During one or more data acquisition, that is to say, that there are during at least one file to be stored, it is also necessary to determine that this waits to deposit
Store up the First page information of the target data page of file.
Above-mentioned target setting information further includes:File attribute, the Starting mode of Temperature Humidity Sensor, Temperature Humidity Sensor
Stopping mode, Temperature Humidity Sensor sampling interval etc..File attribute, the Starting mode of Temperature Humidity Sensor, humiture pass
The stopping mode of sensor, sampling interval of Temperature Humidity Sensor etc., these target setting informations are all need of the user according to oneself
Decision is asked, therefore, these target setting informations are sent to the control device of Temperature Humidity Sensor after being set by terminal, temperature
Target configuration page is written in these target setting informations by the control device of humidity sensor.
It will be appreciated by persons skilled in the art that above-mentioned target setting information is not the setting of file to be stored whole
Information, after data acquisition starts, the control device of Temperature Humidity Sensor can also be written and the relevant setting of gathered data
Information, such as starting sample time, termination sampling time etc..
Process to the First page information of the target data page of determining file to be stored and determining text to be stored separately below
The process of the target configuration page of part illustrates.
The process of the First page information of the target data page of file to be stored and determining file to be stored are determined in explanation
Before the process of target configuration page, the distribution of the storage region of flash storage is illustrated first.
Fig. 7 is the storage region distribution schematic diagram of flash storage provided by the embodiments of the present application.
Referring to Fig. 7, it is known that the page of boot section up front, page of the default configuration area behind boot section distribute Qu Mo
Recognize the page behind configuring area, page of the content regions behind distribution area.Setting page of first P pages of content regions for each file, Mei Gewen
The setting page of part is page 1, the S pages of data page for each file below.
For distribution area and content regions:Referring to Fig. 7, it is 000BH to distribute the content of item that item No. is 0005H in area, instruction
The 000BH pages of setting page in content regions, it is 0010H to distribute the content of item that item No. is 0006H in area, is indicated the in content regions
0010H pages of setting page.Wherein, item No. is intended merely to clearly illustrate distribution area, distributes in area and is not stored with
Item No..
The process of the First page information for the target data page for determining the file to be stored is illustrated first.
Determine that the process of the First page information of the target data page of the file to be stored can be as follows:
A1, the information that the page where distributing area includes is read, obtains the content of all that distribution area includes;
If A2, content regions are stored at least one file, obtain in the content for the item that all items include page number most
Big page number;
A3, the first of the maximum page number instruction content that page is set is read, obtains the first setting information in the first setting page,
First setting information includes the endpage information of the data page of file;
A4, included according to the first setting information file data page endpage information, determine the homepage of file to be stored
Information.
For A1, Temperature Humidity Sensor control device by reading boot section, know distribution area start page and point
With the number of pages that area occupies, that is, the page where distribution area is known.
After the page where having known distribution area, the page that the control device of Temperature Humidity Sensor is read where distributing area includes
Information, obtain the content of all that includes of distribution area;Wherein, distribution area includes multiple items, might not each item it is interior
Hold the page number that page is all set for file.
If being stored at least one file for A2~A3, content regions, all items included from distribution area include page
Number content in extract maximum page number;According to the maximum page number, the setting letter of the first setting page of maximum page number instruction is read
Breath, if that is, maximum page number is M, read the M pages of content.Wherein, maximum page number is last of content regions storage
The page number of the configuration page of a file, then the first setting page is the setting page of the last one file of content regions storage.According to
The aforementioned elaboration to setting page, it is known that setting page includes the endpage information of file:Valid data termination address, therefore, according to
The setting information of the first setting page read can obtain the endpage information of the last one file of content regions storage.
For A4, in the case of content regions are stored at least one file, according to content regions store the last one text
The endpage information of part determines the First page information of file to be stored.Such as the endpage of the last one file stored according to content regions
Information determines that the endpage page number of the last one file of content regions storage is K, then the data homepage page number of file to be stored can
For K+1, it is alternatively K+2 etc. certainly, and then can obtain the First page information of the target data page of file to be stored, such as:Number of targets
According to the address at 0 location of homepage of page.
If content regions do not have storage file, when determining the homepage of first file to be stored, then the head of file to be stored
Page page number can be P+3 (it is corresponding with:Content regions include P pages of setting page, and area accounts for one page, default configuration area accounts for one page, boot section for distribution
One page is accounted for, then content regions can store the P+4 pages of the homepage of data for storage region, page number P+3).
The executive agent of the process of the First page information of above-mentioned acquisition target data page is the control device of Temperature Humidity Sensor,
It is that button starts to be applicable in the Starting mode that scene is Temperature Humidity Sensor, and the control device of Temperature Humidity Sensor can receive at this time
After enabled instruction to user by key-press input Temperature Humidity Sensor, according to the method in A1~A4, file to be stored is determined
Target data page First page information after, by the First page information of the target data page of file to be stored write-in target setting page,
Then control Temperature Humidity Sensor starts gathered data.
In addition, the control device of Temperature Humidity Sensor can set page according to the method in A1~A3 by read first
Setting information is sent to terminal and is shown, user determines the head of the target data page of file to be stored according to the method in A4
After page information, by the First page information input terminal of the target data page of file to be stored, terminal sends it to temperature and humidity sensing
The control device of device, the First page information write-in target of the target data page of the control device file to be stored of Temperature Humidity Sensor are matched
It puts in page.At this point, if content regions do not have storage file, in the homepage for determining first file to be stored, it is sent to end
The page number at end can be P+3.
At this point, the endpage information in the first setting page can be shown as the control of endpage page number, i.e. Temperature Humidity Sensor in terminal
" valid data termination address " can be converted into retransmit to terminal after endpage page number and show by control equipment.Head input by user
Page information is alternatively homepage page number, and the homepage page number received can be converted to that " storage is adopted by the control device of Temperature Humidity Sensor
Address at 0 location of homepage of sample data " is written afterwards in target setting page.
It will be appreciated by those skilled in the art that when file to be stored have it is multiple, and first by the setting of each storage file believe
When breath write-in to corresponding target is set in page, since data are acquired write-in not yet, each text to be stored can not be known
The endpage information of part, first file to be stored (file to be stored of the page number minimum of setting page) can be according to above-mentioned method
Determine the First page information of target data page, it can be at first for the First page information of the target data page of second file to be stored
After file to be stored stores, the control device of Temperature Humidity Sensor is write after determining First page information according to the method in A1~A4
Enter into corresponding setting page (i.e. the First page information of setting information does not first pass through terminal setting), at this point, content regions are just not present
Do not include the situation of file, and page number of the maximum page number in distribution area read at this time for the configuration page of the first file to be stored,
The last one file of content regions storage is first file to be stored.For the target data page of other files to be stored
Homepage, acquisition principle is identical with the acquisition principle of second file to be stored, and details are not described herein again.
Secondly, the process of the target configuration page to obtaining file to be stored illustrates.
The process for obtaining the target configuration page of file to be stored can be as follows:
B1, the information that the page where distributing area includes is read, obtains the content of all that distribution area includes;
If B2, content regions are stored at least one file, obtain in the content for the item that all items include page number most
Big page number;
B3, according to maximum page number, obtain the page number of target setting page, the page number of target setting page be maximum page number with it is default
The sum of value;
B4, the page number that page is set according to target determine that target sets page.
For B1:Referring to the aforementioned description to A1, details are not described herein again.
If being stored at least one file for B2~B3, content regions, distribute all items that area includes and include page number
Content in extract maximum page number;If the number of pages that the setting page of each file occupies is page 1, after can maximum page number being added 1
To the page number of target setting page, i.e., preset value at this time is 1.After the page number of target setting page has been obtained, target has been determined that
Page is set, that is, the physical address of flash storage corresponding with target setting page is determined.
If content regions do not have storage file, there is no maximum page numbers, determine that the target of first file to be stored is set
When putting the page number of page, if area accounts for one page, default configuration area accounts for one page, boot section accounts for one page, first text to be stored for distribution
The page number of the target setting page of part is 3.
In addition, it is necessary to the page number of the target setting page of file to be stored is written in distribution area.Specific method is:
C1, the information that the page where distributing area includes is read, obtains the content of all that distribution area includes;
C2, the quantity of page number that the content of all includes is obtained, which is used to indicate the file of content regions storage
Quantity;
The word that the item No. of first item and each item occupy in C3, the quantity of file stored according to content regions, distribution area
Joint number obtains target storage position of the page number in distribution area of target configuration page;
C4, the page number that page object is written at target storage position.
Specifically, for C1, referring to the aforementioned elaboration to A1, details are not described herein again.
For C2, how many a page numbers are read out from distribution area, there are how many setting pages with regard to description area, because often
A file is respectively provided with a setting page, therefore, distributes the quantity of page number and content regions packet that the content of all in area includes
The quantity of the file included is identical.
For C3, as previously mentioned, each item occupies two bytes, therefore, the text that can include according to content regions in distribution area
First item is inclined in the quantity (quantity of page number that the content of at least one read in other words includes) of part, distribution area
It moves address, the byte number that each item occupies, obtains target storage position of the page number in distribution area of target configuration page.Wherein, mesh
Mark storage location is the physical address for the page number for storing target configuration page.Wherein, the physical address of the first item in distribution area is
To distribute the initial address of area place page, it may thus be appreciated that the offset address of the first item in distribution area.
Specifically, mode can be achieved by the following procedure and obtain target storage position of the page number in distribution area of target configuration page:
The byte number that offset address, each item of first item occupy in the quantity of file that is included according to content regions, distribution area, obtains
Store the target offset address of the item of the page number of target configuration page;According to target offset address and the sum of the base address in distribution area,
The physical address of the page number of storage target configuration page is obtained, that is, has obtained target storage position.
For step S102, target setting information is being written to target setting page, the control of Temperature Humidity Sensor is set
It is standby can be according to the First page information in target setting information:" address at 0 location of homepage of storage sampled data ", obtains target data
The homepage of page, that is, obtain the physical address of the homepage of target data page;Wherein, target data page is used to store text to be stored
The data of part, the data of file to be stored are that current gatherer process starts rear Temperature Humidity Sensor and set in page according to target
The data that configured good target setting information collects, target set the target setting information set in page that can wrap
It includes:Carry out temperature sampling, sampling interval 0.01S etc..
After the homepage of target data page determines, the control device of Temperature Humidity Sensor sets the temperature set in page according to target
The Starting mode of humidity sensor, control Temperature Humidity Sensor start gathered data, and control Temperature Humidity Sensor according to target
Setting information relevant with data acquisition carries out data acquisition, the number that Temperature Humidity Sensor is collected in setting information
According to since the homepage, it is continuously written into flash storage.
Specifically, Temperature Humidity Sensor will be adopted according in target setting information with the relevant setting information of data acquisition
After the data that collection obtains are converted to the value of flash storage storage, since the homepage, it is continuously written into flash storage.Its
In, Temperature Humidity Sensor refers to the method that collected temperature and/or humidity are converted into the value that flash storage stores above-mentioned
Introduction to " boot section " part.
The each single item in every page in target data page is the data of a sampled point, the length of each sampled point be by
What file attribute determined.When file attribute is temperature sampling, the length of each sample point data is two bytes, when file category
Property when being sampled to carry out temperature sampling and humidity, the data length of each sampled point is four bytes, and the first two byte is temperature
It represents, latter two byte is that humidity represents.I.e. target data page is made of a series of sample point data, is not had in corresponding page
Each byte used can be 0xff.
It is for each file to be stored, the endpage information write-in of file to be stored is to be stored after gathered data
In the target configuration page of file, the target configuration information of target configuration page is improved, that is, improve the data of file to be stored
Attribute information.Endpage information may include storing the physical address of last sampled data.
It will be appreciated by persons skilled in the art that if file to be stored has multiple, step S101 and step S102 can be first
After carry out, i.e., after the setting information of multiple files to be stored first being respectively written into respective setting page, then respectively according to respectively setting
The setting information related with gathered data carries out the acquisition of data in confidence breath, is written in respective data page, i.e., first to multiple
File to be stored is configured the setting of information, then acquires the data of each file to be stored respectively;Step S101 and step S102
Sequencing also may not be present, i.e., first by the corresponding setting page of setting information write-in of a file to be stored, then acquisition should
The data of file to be stored, then the setting information write-in of next file to be stored is set page and acquires this accordingly and waits to deposit
The data of file are stored up, i.e., after the setting information of one file to be stored of setting, acquire the data of a file to be stored.
Setting page and data page in the present embodiment due to file are provided separately, and set and corresponding data is included in page
Therefore setting information, can be written setting page easily and fast, write data into data page by the First page information of page.Meanwhile also
Can first by the setting information of multiple files to be stored write-in it is respective setting page in, then respectively according in respective setting information with
The related setting information of gathered data carries out the acquisition of data, is written in respective data page, ensure that need to obtain it is multiple
During file to be stored, the fast and easy of data writing process.
The file management method of the flash storage of the present embodiment, including when file to be stored for it is at least one when, for
Each file to be stored determines the target setting page of file to be stored, target relevant with the data of file to be stored is set
In information write-in target setting page;Wherein, target setting information includes the First page information of the data page of corresponding file to be stored;It is right
In each file to be stored, the First page information included according to target setting information determines the target data page of file to be stored
Homepage, and since the homepage, the target data of acquisition is continuously written into flash storage;Wherein, target data is several
According to harvester according in respective objects setting information with gathered data relevant information collection.The Flash of the present embodiment
The file management method of memory, the fast and easy of data writing process, and can ensure needing to obtain multiple files to be stored
When, the fast and easy of data writing process.
The process that file is read from flash storage is illustrated using specific embodiment below.
Fig. 8 is the file management method flowchart 2 of flash storage that the application provides, as shown in figure 8, the present embodiment
Method can include:
Step S201, the information that the page where reading distribution area includes obtains the page number of at least one setting page;
Step S202, according to the page number of at least one setting page, the setting information of the setting page of each page number instruction is read,
Obtain the setting information of each file stored in flash storage;
Step S203, according to the file identification input by user that continues, read the file that continues data page include it is specific
Data;Wherein, the file identification that continues is that user determines according to the setting information of each file stored in flash storage.
Specifically, for step S201, humidity sensor control device by reading boot section, know rising for distribution area
The number of pages that beginning page and distribution area occupy, that is, known the page where distribution area.
After the page where having known distribution area, the page that the control device of Temperature Humidity Sensor is read where distributing area includes
Information, obtain the content of all, extract the page number in the content for the item that all items include page number, obtain at least one set
Put the page number of page.
For step S202, according to the page number of at least one setting page, read the setting letter of the setting page of each page number instruction
Breath, obtains the setting information of each file stored in flash storage, that is, obtained a setting information list, this sets
Put the setting information that information list includes the All Files stored in flash storage.
The All Files stored in flash storage are got for the control device of step S203, Temperature Humidity Sensor
Setting information after, send it to terminal and shown, user, which is known by the display interface of terminal in flash storage, to deposit
The setting information of the All Files of storage.
As previously mentioned, the setting information of each file includes file attribute, sampling interval, sampling initial time, sampling
Terminate time, the First page information of data page and endpage information etc..For example, user wants to check the temperature sampled in a1~a2 time ranges
Degrees of data, and the file attribute in the setting information of some file is temperature sampling, sampling initial time is b1, when sampling terminates
Between for b2, b1 is later than earlier than or equal to a1, b2 or equal to a2, then this document is can determine as the file that continues, in the setting information
The First page information and endpage information of data page are the mark of the determining file that continues;User inputs the file that continues by terminal
Mark, wherein, user can be homepage page number in the First page information that display interface is seen, can in the endpage information that display interface is seen
For endpage page number.
The mark for the file that continues is sent to the control device of Temperature Humidity Sensor by terminal, and the control of Temperature Humidity Sensor is set
After the data of the data page of the standby file that will continue are read, terminal is sent to, it is achieved thereby that reading the file in flash storage
Process.
Specifically, the control device of Temperature Humidity Sensor reads data since the homepage of the data page for the file that continues, if
The page number of the page currently read, which is less than or equal to, terminates page number, then judges whether occur FFFF pages, if it is not, the current page then read
Data, if so, stop read data;If the page number of the page currently read, which is more than, terminates page number, stop reading data.Its
In, FFFF pages refers to the page for mistake occur.
It will be appreciated by persons skilled in the art that if the First page information stored in the setting page of flash storage is " deposits
Store up the address at 0 location of homepage of sampled data ", and homepage page number is shown to user in terminal, then the control of Temperature Humidity Sensor
" address at 0 location of homepage of storage sampled data " can be converted into retransmit to terminal after homepage page number and shown by control equipment
Show.If the endpage information stored in the setting page of flash storage is " valid data termination address ", and terminal is shown to user
Be endpage page number, then " valid data termination address " can be converted into after endpage page number again by the control device of Temperature Humidity Sensor
Terminal is sent to be shown.
Setting page and data page in the present embodiment due to file are provided separately, and set and corresponding data is included in page
The attribute information of page, user can determine to want the file of reading, reading process fast and easy according to the setting information in setting page.
Fig. 9 is that the document management apparatus of flash storage provided by the embodiments of the present application implements one structure diagram, such as
Shown in Fig. 9, the device of the present embodiment can include:Information setup module 11 and Data write. module 12.
Wherein, the storage region of flash storage is divided into multiple pages, and storage region includes content regions, and content regions are used
In storing at least one file, each file includes setting page and data page, and data page sets page for depositing for storing data
Storage and the relevant setting information of gathered data;Information setup module 11, for when file to be stored for it is at least one when, for every
A file to be stored, determine file to be stored target setting page, and by with acquire file to be stored the relevant target of data
In setting information write-in target setting page;Wherein, target setting information includes the homepage letter of the target data page of file to be stored
Breath;Data write. module 12, for for each file to be stored, the First page information in target setting information to determine to treat
The homepage of the target data page of storage file, and since homepage, the target data of acquisition is continuously written into flash storage
In;Wherein, target data is that data acquisition device is acquired according to corresponding target setting information.
Information setup module 11, the information included specifically for reading the page where distributing area, obtains at least one
Content;If content regions are stored at least one file, the maximum page number in the content of at least one is obtained;According to most big page
Number, the page number of target setting page is obtained, the page number of target setting page is maximum the sum of page number and preset value;Page is set according to target
Page number, determine target set page.
Information setup module 11, also particularly useful for the content of item further includes item No., and the corresponding offset address of item is item No.
Preset multiple in the information that the page read where distributing area includes, after obtaining the content of at least one, obtains at least one
The quantity of page number that the content of item includes, quantity are used to indicate the quantity of the file of content regions storage;According to quantity, distribution area
In the item No. of first item and the byte number that occupies of each item, obtain target of the page number of target configuration page in distribution area and store position
It puts;The byte number that each item occupies is identical with preset multiple;After the page number for according to maximum page number, obtaining target setting page,
The page number of target setting page is written at target storage position.
Information setup module 11, also particularly useful for, after the maximum page number in obtaining multiple setting respective page numbers of page,
The content of the first setting page of maximum page number instruction is read, obtains the first setting information in the first setting page, the first setting letter
Breath includes the endpage information of the data page of file;According to endpage information, the First page information of file to be stored is determined.
Information setup module 11,, will for each file to be stored after the process for being additionally operable to obtain gathered data
In the target configuration page of the endpage information write-in file to be stored of file to be stored;Wherein, endpage information includes storing last
The physical address for the data that item obtains.
The device of the present embodiment can be used for performing the technical solution of above method embodiment, realization principle and technology
Effect is similar, and details are not described herein again.
Figure 10 is that the document management apparatus of flash storage provided by the embodiments of the present application implements two structure diagram,
As shown in Figure 10, on the basis of the device of the present embodiment apparatus structure shown in Fig. 9, further, can also include:Data are read
Modulus block 13.
Data read module 13 obtains the page of at least one setting page for reading the information that the page where distribution area includes
Number;According to the page number of at least one setting page, the setting information of the setting page of each page number instruction is read, obtains Flash storages
The setting information of each file stored in device;According to the mark of the file input by user that continues, the data page for the file that continues is read
The data included;Wherein, the mark of file of continuing is user according to the setting information of each file stored in flash storage
It gets.
The device of the present embodiment can be used for performing the technical solution of above method embodiment, realization principle and technology
Effect is similar, and details are not described herein again.
The embodiment of the present application also provides a kind of file management system of flash storage, including:Flash shown in Fig. 2 is deposited
Reservoir, data acquisition device, data acquisition device control device and terminal device;Flash storage, data acquisition device and
The terminal device is connect with the control device of data acquisition device;Wherein, the control device of data acquisition device includes Fig. 9
Or the document management apparatus of flash storage shown in Fig. 10.
The embodiment of the present application also provides a kind of computer readable storage medium, including instruction, when it runs on computers
When so that computer is performed such as the method in Fig. 6 or shown in Fig. 8 embodiments.
Figure 11 is the structure diagram of electronic equipment provided by the embodiments of the present application, referring to Figure 11, the electronics of the present embodiment
Equipment 300, including:Processor 31, memory 32 and communication bus 33, communication bus 33 are used to implement the company between each component
It connects, for storing program instruction, processor 31 is used to read the program instruction in memory 32, and according to memory memory 32
Program instruction in 32 performs the method in Fig. 6 or shown in Fig. 8 embodiments.
One of ordinary skill in the art will appreciate that:Realizing all or part of step of above-mentioned each method embodiment can lead to
The relevant hardware of program instruction is crossed to complete.Aforementioned program can be stored in a computer read/write memory medium.The journey
Sequence when being executed, performs the step of including above-mentioned each method embodiment;And aforementioned storage medium includes:ROM, RAM, magnetic disc or
The various media that can store program code such as person's CD.
Finally it should be noted that:The above various embodiments is only to illustrate the technical solution of the application, rather than its limitations;To the greatest extent
Pipe is described in detail the application with reference to foregoing embodiments, it will be understood by those of ordinary skill in the art that:Its according to
Can so modify to the technical solution recorded in foregoing embodiments either to which part or all technical features into
Row equivalent replacement;And these modifications or replacement, each embodiment technology of the application that it does not separate the essence of the corresponding technical solution
The range of scheme.