CN108664578A - A kind of file cycle storage method and system - Google Patents

A kind of file cycle storage method and system Download PDF

Info

Publication number
CN108664578A
CN108664578A CN201810415463.2A CN201810415463A CN108664578A CN 108664578 A CN108664578 A CN 108664578A CN 201810415463 A CN201810415463 A CN 201810415463A CN 108664578 A CN108664578 A CN 108664578A
Authority
CN
China
Prior art keywords
file
address
date information
area
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810415463.2A
Other languages
Chinese (zh)
Other versions
CN108664578B (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.)
North University of China
Original Assignee
North University of China
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 North University of China filed Critical North University of China
Priority to CN201810415463.2A priority Critical patent/CN108664578B/en
Publication of CN108664578A publication Critical patent/CN108664578A/en
Application granted granted Critical
Publication of CN108664578B publication Critical patent/CN108664578B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Read Only Memory (AREA)

Abstract

本发明公开了一种文件循环存储方法及系统,该系统包括:上位机、FPGA、授时模块和数据存储模块,数据存储模块包括ROM存储单元和FLASH存储单元;ROM存储单元存储单元分为配置区和地址区,FLASH存储单元分为数据区和空闲区,配置区用于存储数据存储模块的配置信息,地址区用于存储用户文件的起始块地址;数据区用于存储用户文件;空闲区用于存储日期信息。本发明通过获取文件日期信息,得到文件日期信息列表,在文件日期信息列表中读取用户文件存储的起始块地址,根据该日期信息对应的起始块地址即可确定出所需用户文件的存储位置,在实现循环存储记录的同时实现对用户数据的可视化选择性读取。

The invention discloses a file circulation storage method and system. The system includes: a host computer, FPGA, a timing module and a data storage module. The data storage module includes a ROM storage unit and a FLASH storage unit; the ROM storage unit storage unit is divided into a configuration area and address area, the FLASH storage unit is divided into data area and free area, the configuration area is used to store the configuration information of the data storage module, the address area is used to store the starting block address of the user file; the data area is used to store the user file; the free area Used to store date information. The present invention obtains the file date information list by acquiring the file date information, reads the starting block address of user file storage in the file date information list, and can determine the required user file address according to the starting block address corresponding to the date information The storage location realizes the visual and selective reading of user data while realizing circular storage records.

Description

一种文件循环存储方法及系统A file storage method and system

技术领域technical field

本发明涉及文件管理技术领域,特别涉及一种文件循环存储方法及系统。The invention relates to the technical field of file management, in particular to a file circular storage method and system.

背景技术Background technique

随着现代科学技术的高速发展发展,大容量数据的存储与读取已经在航天、勘测、医疗等众多领域得到了广泛的运用。在实际环境中,人们总是希望通过大量的数据来更好地研究数据间的联系,或者通过数据的比对来及时发现问题从而避免可能出现的问题,进而在今后的设计实践中提供直接性的经验。所以,大容量存储器的研究从未止步。With the rapid development of modern science and technology, the storage and reading of large-capacity data has been widely used in many fields such as aerospace, surveying, and medical treatment. In the actual environment, people always hope to use a large amount of data to better study the relationship between data, or to find problems in time through data comparison so as to avoid possible problems, and then provide directness in future design practice. experience of. Therefore, the research on large-capacity storage has never stopped.

在科学研究和工业生产中需要处理越来越多的动态信息,需要研究的数据量也越来越多,相应地,对存储器的存储容量,存储速度以及对存储器的读取速度、读取方式也就提出了更高的要求。这时,与读取速度有直接关系的文件处理系统就显得分外重要。In scientific research and industrial production, more and more dynamic information needs to be processed, and the amount of data to be studied is also increasing. Correspondingly, the storage capacity, storage speed, and reading speed and reading method of the memory It also puts forward higher requirements. At this time, the file processing system that is directly related to the reading speed is extremely important.

在数据采集存储的应用领域方面,根据系统的资源环境,文件系统被大致分为基于操作系统下的文件循环存储系统和无操作系统的文件循环存储系统。无操作系统的文件循环存储系统适用于功能相对简单,专用性较强的存储设备中。这种文件管理具有很强的灵活性,并且,可以根据应用环境的不同而对其功能进行相应的修改,从而达到用最小成本实现最优性能的目的。In terms of the application field of data acquisition and storage, according to the resource environment of the system, the file system is roughly divided into the file circular storage system based on the operating system and the file circular storage system without the operating system. The file circulation storage system without an operating system is suitable for storage devices with relatively simple functions and strong specialization. This kind of file management has strong flexibility, and its functions can be modified accordingly according to different application environments, so as to achieve the purpose of achieving optimal performance with minimum cost.

现如今,针对于存储器的文件循环存储方法日新月异。但总体来说,现有的文件循环存储方法大都是在NAND FLASH数据区中预留若干块,将这些块用来存储文件的索引信息,索引信息一般包括文件总数、文件大小、文件更新时间、文件存放首末地址等一些用户文件的具体信息,并对这些信息进行及时更新等操作。最后,通过上位机读取索引信息列表来实现对用户数据的可视化读取。但由于这类文件循环存储方法需要额外开辟一定容量内存来存储索引信息,而且每次存储数据都需对索引区内的文件进行更新,不仅更新方式较为繁琐,程序设计也是比较复杂的,况且频繁对预留存储文件信息的块进行擦除、写入等操作,会使得该部分的块存储空间损耗不能够得到很好的均衡。Nowadays, file circular storage methods for storage are changing with each passing day. But in general, most of the existing file circular storage methods are to reserve several blocks in the NAND FLASH data area, and these blocks are used to store the index information of the file. The index information generally includes the total number of files, file size, file update time, The file stores the specific information of some user files such as the first and last addresses, and performs operations such as timely updating of this information. Finally, the visual reading of user data is realized by reading the index information list through the host computer. However, since this kind of file circular storage method needs to open up a certain amount of memory to store index information, and each time the data is stored, the files in the index area need to be updated. Operations such as erasing and writing to blocks reserved for storing file information will cause the loss of block storage space in this part to not be well balanced.

发明内容Contents of the invention

针对现有技术的不足,本发明目的之一在于提供一种简单有效、可对大容量数据进行有效管理的文件循环存储方法。In view of the deficiencies in the prior art, one of the purposes of the present invention is to provide a file circular storage method that is simple and effective and can effectively manage large-capacity data.

一种文件循环存储方法,该方法包括:A file circular storage method, the method comprising:

FPGA接收上位机发送的写日期信息请求,根据所述写日期信息请求从ROM存储单元的地址区获取本次存储的起始块地址,从授时模块获取日期信息,并将获取的日期信息写入FLASH存储单元的空闲区;The FPGA receives the write date information request sent by the host computer, obtains the initial block address of this storage from the address area of the ROM storage unit according to the write date information request, obtains the date information from the timing module, and writes the obtained date information into The free area of the FLASH storage unit;

所述FPGA接收上位机发送的写用户文件请求,根据所述写用户文件请求从所述ROM存储单元的地址区获取本次存储的起始块地址,并根据获取的起始块地址将用户文件按顺序写入FLASH存储单元的数据区;其中,当所述FLASH存储单元的数据区写满时,擦除其中首个存储块的数据从首个存储块继续循环写入;The FPGA receives the write user file request sent by the upper computer, obtains the initial block address of this storage from the address area of the ROM storage unit according to the write user file request, and writes the user file according to the acquired initial block address Write the data area of FLASH storage unit in order; Wherein, when the data area of described FLASH storage unit is filled up, erase the data of wherein first storage block and continue to circulate write from first storage block;

所述FPGA接收上位机发送的读文件日期信息请求,根据所述读文件日期信息请求从FLASH存储单元的空闲区读取文件日期信息;The FPGA receives the file date information request sent by the upper computer, and reads the file date information from the free area of the FLASH storage unit according to the read file date information request;

所述上位机对读取的文件日期信息进行分析整理,得到文件日期信息列表;The host computer analyzes and organizes the read file date information to obtain a file date information list;

所述上位机从所述文件信息列表中找到所需用户文件的日期信息和起始块地址,并根据找到的用户文件的日期信息和起始块地址从所述FLASH存储单元的数据区读取用户文件。The host computer finds the date information and the starting block address of the required user file from the file information list, and reads from the data area of the FLASH storage unit according to the date information and the starting block address of the user file found user files.

作为本发明的进一步改进,所述在首次接收上位机发送的写文件日期信息请求之前,FPGA将FLASH存储单元的首地址信息写入ROM存储单元的地址区;As a further improvement of the present invention, the FPGA writes the first address information of the FLASH storage unit into the address area of the ROM storage unit before receiving the write file date information request sent by the host computer for the first time;

在第N(N为大于等于1的整数)次将用户文件按顺序写入FLASH存储单元的数据区之后,FPGA将ROM存储单元的地址区的地址更新为第N+1次数据存储的起始块地址。After the user file is written into the data area of the FLASH storage unit in sequence for the Nth time (N is an integer greater than or equal to 1), the FPGA updates the address of the address area of the ROM storage unit to the start of the N+1th data storage block address.

作为本发明的进一步改进,该方法还包括:将ROM存储单元和FLASH存储单元的配置信息写入ROM存储单元的配置区。As a further improvement of the present invention, the method further includes: writing configuration information of the ROM storage unit and the FLASH storage unit into the configuration area of the ROM storage unit.

作为本发明的进一步改进,所述配置信息至少包括ROM存储单元和FLASH存储单元的容量、配置区容量、配置区起始地址、地址区容量、地址区起始地址、数据区容量、数据区起始地址、一个完整帧结构字节数、帧结构表、采样控制速率。As a further improvement of the present invention, the configuration information includes at least the capacity of the ROM storage unit and the FLASH storage unit, the capacity of the configuration area, the starting address of the configuration area, the capacity of the address area, the starting address of the address area, the capacity of the data area, the starting address of the data area The starting address, the number of bytes of a complete frame structure, the frame structure table, and the sampling control rate.

作为本发明的进一步改进,所述并根据获取的起始块地址将用户文件数据按顺序写入FLASH存储单元的数据区,具体包括:As a further improvement of the present invention, the user file data is sequentially written into the data area of the FLASH storage unit according to the obtained starting block address, specifically including:

当写一个块时,判断下个块的存储空间是否为空,若是,则擦除下个块的数据后,将用户文件按顺序写入FLASH存储单元的数据区,否则,直接将用户文件数据按顺序写入FLASH存储单元的数据区。When writing a block, judge whether the storage space of the next block is empty, if so, after erasing the data of the next block, write the user files into the data area of the FLASH storage unit in order, otherwise, directly write the user file data Write the data area of the FLASH storage unit in sequence.

作为本发明的进一步改进,当收到上位机发送的停止记录命令或突然掉电时,电源模块提供电能将FLASH存储单元的数据区中缓存的用户文件写完并更新ROM存储单元的地址区中的地址信息。As a further improvement of the present invention, when receiving the stop recording command sent by the host computer or suddenly losing power, the power module provides power to finish writing the user files cached in the data area of the FLASH storage unit and update the address area of the ROM storage unit address information.

作为本发明的进一步改进,所述并根据找到的用户文件的日期信息和起始块地址从所述FLASH存储单元的数据区读取用户文件,具体包括:当读一个块时,判断其是否为最后一块,若是,则在读完该块后停止读取;否则,在读完该块后,继续读取下一块;当所述FLASH存储单元的数据区写满时,擦除首个块的数据从首个块继续写入。As a further improvement of the present invention, reading the user file from the data area of the FLASH storage unit according to the date information and the starting block address of the found user file specifically includes: when reading a block, judging whether it is Last block, if so, then stop reading after reading this block; Otherwise, after reading this block, continue to read next block; The first block continues to be written.

本发明目的之二在于提供一种简单有效、可对大容量数据进行有效管理的文件循环存储系统。The second object of the present invention is to provide a file circulation storage system that is simple and effective and can effectively manage large-capacity data.

一种文件循环存储系统,该系统包括:包括:上位机、FPGA、授时模块和数据存储模块,所述数据存储模块包括ROM存储单元和FLASH存储单元;A file circulation storage system, the system includes: including: a host computer, FPGA, timing module and data storage module, the data storage module includes a ROM storage unit and a FLASH storage unit;

所述ROM存储单元存储单元分为配置区和地址区,所述FLASH存储单元分为数据区和空闲区,所述配置区用于存储所述数据存储模块的配置信息,所述地址区用于存储用户文件的起始块地址;所述数据区用于存储用户文件;所述空闲区用于存储日期信息;The ROM storage unit storage unit is divided into a configuration area and an address area, and the FLASH storage unit is divided into a data area and a free area, the configuration area is used to store configuration information of the data storage module, and the address area is used for storing the starting block address of user files; the data area is used to store user files; the free area is used to store date information;

所述上位机用于向所述FPGA发送写日期信息请求;The host computer is used to send a write date information request to the FPGA;

所述FPGA用于接收所述写日期信息请求,根据所述写日期信息请求从所述地址区获取本次存储的起始块地址,从授时模块获取日期信息,并将获取的日期信息写入所述空闲区的对应页中;Described FPGA is used for receiving described write date information request, according to described write date information request, obtains the starting block address of this storage from described address area, obtains date information from timing module, and writes the date information obtained In the corresponding page of the free area;

所述授时模块用于提供日期信息;The timing module is used to provide date information;

所述上位机还用于向所述FPGA发送写用户文件请求;The host computer is also used to send a write user file request to the FPGA;

所述FPGA还用于接收写用户文件请求,根据所述写用户文件请求从所述地址区获取本次存储的起始块地址,并根据获取的起始块地址将用户文件按顺序写入所述数据区;The FPGA is also used to receive a request for writing a user file, obtain the initial block address of this storage from the address area according to the request for writing a user file, and write the user file in order according to the acquired initial block address. the data area;

所述FPGA还用于当所述FLASH存储单元的数据区写满时,擦除其中首个存储块的数据从首个存储块继续循环写入;The FPGA is also used for erasing the data of the first storage block wherein the first storage block is continuously written in a cycle when the data area of the FLASH storage unit is full;

所述上位机还用于向所述FPGA发送读文件日期信息请求;The host computer is also used to send a request for reading file date information to the FPGA;

所述FPGA还用于接收所述读文件日期信息请求,根据所述读文件日期信息请求从所述空闲区读取日期信息;The FPGA is also used to receive the file read date information request, and read the date information from the free area according to the file read date information request;

所述上位机还用于对读取的日期信息进行分析整理,得到文件日期信息列表;The host computer is also used to analyze and arrange the read date information to obtain a file date information list;

所述上位机还用于从所述文件日期信息列表找到所需用户文件的日期信息和起始块地址,根据找到的用户文件的日期信息和起始块地址从所述数据区读取用户文件。The host computer is also used to find the date information and start block address of the required user file from the file date information list, and read the user file from the data area according to the date information and start block address of the user file found .

作为本发明的进一步改进,所述FPGA还用于:As a further improvement of the present invention, said FPGA is also used for:

在首次接收上位机发送的写文件日期信息请求之前,将FLASH存储单元的首地址信息写入ROM存储单元的地址区;Before receiving the write file date information request sent by the host computer for the first time, write the first address information of the FLASH storage unit into the address area of the ROM storage unit;

在第N(N为大于等于1的整数)次将用户文件按顺序写入FLASH存储单元的数据区之后,将ROM存储单元的地址区的地址更新为第N+1次数据存储的起始块地址。After the user file is written into the data area of the FLASH storage unit in sequence for the Nth (N is an integer greater than or equal to 1) time, update the address of the address area of the ROM storage unit to the starting block of the N+1th data storage address.

作为本发明的进一步改进,该系统还包括:电源模块,用于当收到上位机发送的停止记录命令或突然掉电时,提供电能将FLASH存储单元的数据区中缓存的用户文件写完并更新ROM存储单元的地址区中的地址信息。As a further improvement of the present invention, the system also includes: a power supply module, used to provide electric energy to finish writing the user files cached in the data area of the FLASH storage unit and The address information in the address area of the ROM memory unit is updated.

本发明的有益效果:Beneficial effects of the present invention:

本发明通过利用FLASH数据区来存储用户文件,利用FLASH空闲区来存储文件日期信息,利用ROM配置区来存储配置信息,利用ROM地址区来存储用户文件的起始块地址,通过获取空闲区文件日期信息,得到用户文件信息列表,在文件信息列表中读取用户文件存储的块起始地址,根据该日期信息对应的起始地址即可确定出所需用户文件的存储位置,从而实现上位机对用户数据的可视化选择性读取。The present invention uses the FLASH data area to store user files, uses the FLASH free area to store file date information, uses the ROM configuration area to store configuration information, uses the ROM address area to store the initial block address of the user file, and obtains the free area file Date information, get the user file information list, read the block start address of the user file storage in the file information list, and determine the storage location of the required user file according to the start address corresponding to the date information, so as to realize the upper computer Visual selective reading of user data.

上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其他目的、特征和优点能够更明显易懂,以下特举较佳实施例,并配合附图,详细说明如下。The above description is only an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable , the following preferred embodiments are specifically cited below, and are described in detail as follows in conjunction with the accompanying drawings.

附图说明Description of drawings

图1是本发明实施例中文件循环存储方法的示意图;Fig. 1 is a schematic diagram of a file circular storage method in an embodiment of the present invention;

图2是本发明实施例中FLASH存储单元的结构示意图。FIG. 2 is a schematic structural diagram of a FLASH storage unit in an embodiment of the present invention.

具体实施方式Detailed ways

下面结合附图和具体实施例对本发明作进一步说明,以使本领域的技术人员可以更好地理解本发明并能予以实施,但所举实施例不作为对本发明的限定。The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, so that those skilled in the art can better understand the present invention and implement it, but the examples given are not intended to limit the present invention.

如图1所示,为本发明实施例中,该方法包括以下步骤:As shown in Figure 1, in the embodiment of the present invention, the method includes the following steps:

步骤S110、FPGA接收上位机发送的写日期信息请求,根据所述写日期信息请求从ROM存储单元的地址区获取本次存储的起始块地址,从授时模块获取日期信息,并将获取的日期信息写入FLASH存储单元的空闲区;Step S110, the FPGA receives the write date information request sent by the host computer, obtains the initial block address of this storage from the address area of the ROM storage unit according to the write date information request, obtains the date information from the timing module, and writes the obtained date The information is written into the free area of the FLASH storage unit;

其中,日期信息存储于用户数据对应的每一块的每一页中。将获取的日期地址写入的空闲区为获取的起始块地址所对应的空闲区;授时模块为GPS授时模块,日期信息的格式为年月日时分秒毫秒,年占用11位,月占用4bit,日占用5bit,时占用5bit,分占用6bit,秒占用6bit,毫秒占用6bit,空闲区每页写日期信息占用43位,即最多占用六个字节。Wherein, the date information is stored in each page of each block corresponding to the user data. The free area where the obtained date address is written is the free area corresponding to the obtained start block address; the time service module is a GPS time service module, and the format of the date information is year, month, day, hour, minute, second, millisecond, year occupies 11 bits, and month occupies 4 bits , the day occupies 5 bits, the hour occupies 5 bits, the minute occupies 6 bits, the second occupies 6 bits, the millisecond occupies 6 bits, and the date information written on each page of the free area occupies 43 bits, that is, it occupies up to six bytes.

优选的,在首次执行步骤S110之前,还包括以下步骤:Preferably, before performing step S110 for the first time, the following steps are also included:

将ROM存储单元和FLASH存储单元的配置信息写入ROM存储单元的配置区;Writing the configuration information of the ROM storage unit and the FLASH storage unit into the configuration area of the ROM storage unit;

具体的,所述配置信息包括ROM存储单元和FLASH存储单元的容量、配置区容量、配置区起始地址、地址区容量、地址区起始地址、数据区容量、数据区起始地址、一个完整帧结构字节数、帧结构表等。Specifically, the configuration information includes the capacity of the ROM storage unit and the FLASH storage unit, the capacity of the configuration area, the start address of the configuration area, the capacity of the address area, the start address of the address area, the capacity of the data area, the start address of the data area, a complete Frame structure bytes, frame structure table, etc.

优选的,在首次执行步骤S110之前,还包括以下步骤:Preferably, before performing step S110 for the first time, the following steps are also included:

所述FPGA将FLASH存储单元的首地址信息写入ROM存储单元的地址区。The FPGA writes the first address information of the FLASH storage unit into the address area of the ROM storage unit.

其中,由于获取到的文件信息列表中包含用户文件存储的起始块地址,而空闲区中并没有存储用户文件的首地址,这要求在最开始的时候将数据存储的首地址信息回写到文件列表中。Among them, since the obtained file information list contains the starting block address of the user file storage, but the first address of the user file is not stored in the free area, it is required to write back the first address information of the data storage to in the file list.

步骤S120、所述FPGA接收上位机发送的写用户文件请求,根据所述写用户文件请求从所述ROM存储单元的地址区获取本次存储的起始块地址,并根据获取的起始块地址将用户文件按顺序写入FLASH存储单元的数据区;其中,当所述FLASH存储单元的数据区写满时,擦除其中首个存储块的数据从首个存储块继续循环写入;Step S120, the FPGA receives the write user file request sent by the host computer, obtains the start block address of this storage from the address area of the ROM storage unit according to the write user file request, and according to the obtained start block address Write user files in order to the data area of the FLASH storage unit; wherein, when the data area of the FLASH storage unit is full, erase the data of the first storage block and continue to write in a loop from the first storage block;

优选的,在每一次用户文件写入之后,若没有写满块存储空间,则掉电后的下次数据存储直接从下一个块开始写入。当数据区存满数据,需循环写入时,由于与非闪存按页写入,按块擦除的特性,数据区的用户文件和空闲区的日期文件将被一起擦除,在写用户数据时的,只需对应写入文件日期信息即可,无须额外设计程序进行信息更新。Preferably, after each user file is written, if the storage space of the block is not full, the next data storage after power-off will be directly written from the next block. When the data area is full of data and needs to be written cyclically, due to the characteristics of writing by page and erasing by block with non-flash memory, the user file in the data area and the date file in the free area will be erased together. When it is time, it is only necessary to write the date information of the file correspondingly, and there is no need for an additional design program to update the information.

其中,在第N(N为大于等于1的整数)次将用户文件按顺序写入FLASH存储单元的数据区之后,FPGA将ROM存储单元的地址区的地址更新为第N+1次数据存储的起始块地址。Wherein, after the user file is written into the data area of the FLASH storage unit in sequence for the Nth (N is an integer greater than or equal to 1) time, the FPGA updates the address of the address area of the ROM storage unit to the address of the N+1th data storage The starting block address.

其中,所述并根据获取的起始块地址将用户文件数据按顺序写入FLASH存储单元的数据区,具体包括:当写一个块时,判断下个块的存储空间是否为空,若是,则擦除下个块的数据后,将用户文件按顺序写入FLASH存储单元的数据区,否则,直接将用户文件数据按顺序写入FLASH存储单元的数据区。Wherein, the user file data is written into the data area of the FLASH storage unit in order according to the starting block address obtained, specifically including: when writing a block, judging whether the storage space of the next block is empty, if so, then After erasing the data of the next block, write the user files into the data area of the FLASH storage unit in order, otherwise, directly write the user file data into the data area of the FLASH storage unit in order.

步骤S130、所述FPGA接收上位机发送的读文件日期信息请求,根据所述读文件日期信息请求从FLASH存储单元的空闲区读取文件日期信息;Step S130, the FPGA receives the file date information request sent by the host computer, and reads the file date information from the free area of the FLASH storage unit according to the file read date information request;

步骤S140、所述上位机对读取的文件日期信息进行分析整理,得到文件日期信息列表;Step S140, the host computer analyzes and organizes the read file date information to obtain a list of file date information;

其中,文件日期信息列表由写用户文件的起始时间、结束时间、数据存放的首地址构成。Among them, the file date information list is composed of the start time and end time of writing user files, and the first address of data storage.

步骤S150、所述上位机从所述文件信息列表中找到所需用户文件的日期信息和起始块地址,并根据找到的用户文件的日期信息和起始块地址从所述FLASH存储单元的数据区读取用户文件。Step S150, the host computer finds the date information and the starting block address of the required user file from the file information list, and according to the date information and the starting block address of the user file found, the data of the FLASH storage unit is area to read user files.

其中,所述并根据找到的用户文件的日期信息和起始块地址从所述FLASH存储单元的数据区读取用户文件,具体包括:当读一个块时,判断其是否为最后一块,若是,则在读完该块后停止读取;否则,在读完该块后,继续读取下一块。当所述FLASH存储单元的数据区写满时,擦除首个块的数据从首个块继续写入。Wherein, reading the user file from the data area of the FLASH storage unit according to the date information and the starting block address of the user file found, specifically includes: when reading a block, judging whether it is the last block, if so, Then stop reading after reading the block; otherwise, continue reading the next block after reading the block. When the data area of the FLASH storage unit is full, erase the data of the first block and continue writing from the first block.

优选的,该方法还包括以下步骤:Preferably, the method also includes the following steps:

当收到上位机发送的停止记录命令或突然掉电时,电源模块提供电能将FLASH存储单元的数据区中缓存的用户文件写完并更新ROM存储单元的地址区中的地址信息。所述地址信息包括起始块地址。When receiving a command to stop recording from the host computer or a sudden power failure, the power module provides power to write the user files cached in the data area of the FLASH storage unit and update the address information in the address area of the ROM storage unit. The address information includes a start block address.

优选的,所述FLASH存储单元为NAND FLASH大容量存储器。Preferably, the FLASH storage unit is a NAND FLASH mass memory.

本发明还包括文件循环存储系统,该系统包括:上位机、FPGA、授时模块和数据存储模块,所述数据存储模块包括ROM存储单元和FLASH存储单元。The present invention also includes a file circulation storage system, which includes: a host computer, FPGA, a timing module and a data storage module, and the data storage module includes a ROM storage unit and a FLASH storage unit.

ROM存储单元存储单元分为配置区和地址区,配置区用于存储数据存储模块的配置信息,地址区用于存储用户文件的起始块地址;ROM storage unit The storage unit is divided into a configuration area and an address area, the configuration area is used to store the configuration information of the data storage module, and the address area is used to store the initial block address of the user file;

如图2所示,FLASH存储单元包含若干块,每个块包含若干页,每页又包含数据区和空闲区,数据区用于存储用户文件,空闲区用于存储日期信息。As shown in Figure 2, the FLASH storage unit includes several blocks, each block includes several pages, and each page includes a data area and a free area, the data area is used to store user files, and the free area is used to store date information.

上位机用于向FPGA发送写日期信息请求;授时模块用于提供日期信息;The host computer is used to send a request for writing date information to the FPGA; the timing module is used to provide date information;

FPGA用于接收所述写日期信息请求,根据上述写日期信息请求从地址区获取本次存储的起始块地址,从授时模块获取日期信息,并将获取的日期信息写入空闲区的对应页中;The FPGA is used to receive the write date information request, obtain the starting block address of this storage from the address area according to the above write date information request, obtain the date information from the timing module, and write the obtained date information into the corresponding page of the free area middle;

其中,日期信息存储于用户数据对应的每一块的每一页中。将获取的日期地址写入的空闲区为获取的起始块地址所对应的空闲区;授时模块为GPS授时模块,日期信息的格式为年月日时分秒毫秒,年占用11位,月占用4bit,日占用5bit,时占用5bit,分占用6bit,秒占用6bit,毫秒占用6bit,空闲区每页写日期信息占用43位,即最多占用六个字节。Wherein, the date information is stored in each page of each block corresponding to the user data. The free area where the obtained date address is written is the free area corresponding to the obtained start block address; the time service module is a GPS time service module, and the format of the date information is year, month, day, hour, minute, second, millisecond, year occupies 11 bits, and month occupies 4 bits , the day occupies 5 bits, the hour occupies 5 bits, the minute occupies 6 bits, the second occupies 6 bits, the millisecond occupies 6 bits, and the date information written on each page of the free area occupies 43 bits, that is, it occupies up to six bytes.

上位机还用于向FPGA发送写用户文件请求;The host computer is also used to send a request to write user files to the FPGA;

FPGA还用于接收写用户文件请求,根据上述写用户文件请求从地址区获取本次存储的起始块地址,并根据获取的起始块地址将用户文件按顺序写入数据区;The FPGA is also used to receive a request for writing a user file, obtain the initial block address of this storage from the address area according to the above-mentioned write user file request, and write the user file into the data area in order according to the obtained initial block address;

其中,所述并根据获取的起始块地址将用户文件数据按顺序写入数据区,具体包括:当写一个块时,判断下个块的存储空间是否为空,若是,则擦除下个块的数据后,将用户文件按顺序写入FLASH存储单元的数据区,否则,直接将用户文件数据按顺序写入FLASH存储单元的数据区。Wherein, the user file data is written into the data area in order according to the starting block address obtained, specifically including: when writing a block, judging whether the storage space of the next block is empty, and if so, erasing the next block After the block data, write the user file into the data area of the FLASH storage unit in order, otherwise, directly write the user file data into the data area of the FLASH storage unit in order.

优选的,在每一次用户文件写入之后,若没有写满块存储空间,则掉电后的下次数据存储直接从下一个块开始写入。当数据区存满数据,需循环写入时,由于与非闪存按页写入,按块擦除的特性,数据区的用户文件和空闲区的日期文件将被一起擦除,在写用户数据时的,只需对应写入文件日期信息即可,无须额外设计程序进行信息更新。Preferably, after each user file is written, if the storage space of the block is not full, the next data storage after power-off will be directly written from the next block. When the data area is full of data and needs to be written cyclically, due to the characteristics of writing by page and erasing by block with non-flash memory, the user file in the data area and the date file in the free area will be erased together. When it is time, it is only necessary to write the date information of the file correspondingly, and there is no need for an additional design program to update the information.

FPGA还用于当数据区写满时,擦除数据区中首个存储块的数据从首个存储块继续循环写入;The FPGA is also used to erase the data of the first storage block in the data area and continue to cycle write from the first storage block when the data area is full;

上位机还用于向FPGA发送读文件日期信息请求;The host computer is also used to send a request for reading file date information to the FPGA;

FPGA还用于接收上述读文件日期信息请求,根据上述读文件日期信息请求从空闲区读取日期信息;The FPGA is also used to receive the above-mentioned read file date information request, and read the date information from the free area according to the above-mentioned read file date information request;

上位机还用于对读取的日期信息进行分析整理,得到文件日期信息列表;The upper computer is also used to analyze and organize the read date information to obtain a list of file date information;

其中,文件日期信息列表由写用户文件的起始时间、结束时间、数据存放的首地址构成。Among them, the file date information list is composed of the start time and end time of writing user files, and the first address of data storage.

上位机还用于从上述文件日期信息列表找到所需用户文件的日期信息和起始块地址,根据找到的用户文件的日期信息和起始块地址从数据区读取用户文件。The host computer is also used to find the date information and initial block address of the desired user file from the above-mentioned file date information list, and read the user file from the data area according to the date information and initial block address of the user file found.

其中,所述并根据找到的用户文件的日期信息和起始块地址从所述FLASH存储单元的数据区读取用户文件,具体包括:当读一个块时,判断其是否为最后一块,若是,则在读完该块后停止读取;否则,在读完该块后,继续读取下一块。Wherein, reading the user file from the data area of the FLASH storage unit according to the date information and the starting block address of the user file found, specifically includes: when reading a block, judging whether it is the last block, if so, Then stop reading after reading the block; otherwise, continue reading the next block after reading the block.

优选的,FPGA还用于:Preferably, FPGA is also used for:

在首次接收上位机发送的写日期信息请求之前,将FLASH存储单元的首地址信息写入ROM存储单元的地址区。Before receiving the write date information request sent by the host computer for the first time, write the first address information of the FLASH storage unit into the address area of the ROM storage unit.

其中,由于获取到的文件信息列表中包含用户文件存储的起始块地址,而空闲区中并没有存储用户文件的首地址,这要求在最开始的时候将数据存储的首地址信息回写到文件列表中。Among them, since the obtained file information list contains the starting block address of the user file storage, but the first address of the user file is not stored in the free area, it is required to write back the first address information of the data storage to in the file list.

在第N(N为大于等于1的整数)次将用户文件按顺序写入FLASH存储单元的数据区之后,FPGA将ROM存储单元的地址区的地址更新为第N+1次数据存储的起始块地址。After the user file is written into the data area of the FLASH storage unit in sequence for the Nth time (N is an integer greater than or equal to 1), the FPGA updates the address of the address area of the ROM storage unit to the start of the N+1th data storage block address.

优选的,该系统还包括电源模块,电源模块用于当收到上位机发送的停止记录命令或突然掉电时,提供电能将FLASH存储单元的数据区中缓存的用户文件写完并更新ROM存储单元的地址区中的地址信息。Preferably, the system also includes a power supply module, which is used to provide power to finish writing the user files cached in the data area of the FLASH storage unit and update the ROM storage when receiving a stop recording command sent by the host computer or a sudden power failure. Address information in the address area of the unit.

优选的,所述FLASH存储单元为NAND FLASH大容量存储器。Preferably, the FLASH storage unit is a NAND FLASH mass memory.

本发明的有益效果:Beneficial effects of the present invention:

(1)本发明通过利用FLASH数据区来存储用户文件,利用FLASH空闲区来存储文件日期信息,利用ROM配置区来存储配置信息,利用ROM地址区来存储用户文件的起始块地址,通过获取空闲区文件日期信息,得到用户文件信息列表,在文件信息列表中读取用户文件存储的块起始地址,根据该日期信息对应的起始地址即可确定出所需用户文件的存储位置,从而实现上位机对用户数据的可视化选择性读取。(1) The present invention stores the user file by utilizing the FLASH data area, utilizes the FLASH idle area to store the file date information, utilizes the ROM configuration area to store the configuration information, utilizes the ROM address area to store the starting block address of the user file, and obtains Free area file date information, get the user file information list, read the block start address of user file storage in the file information list, and determine the storage location of the required user file according to the start address corresponding to the date information, thereby Realize the visual and selective reading of user data by the host computer.

(2)当FLASH数据区写满时,擦除其中首个存储块的数据从首个存储块继续循环写入,可以实现循环存储记录。(2) When the FLASH data area is full, erase the data of the first storage block and continue to write circularly from the first storage block, which can realize circular storage and recording.

以上实施例仅是为充分说明本发明而所举的较佳的实施例,本发明的保护范围不限于此。本技术领域的技术人员在本发明基础上所作的等同替代或变换,均在本发明的保护范围之内。本发明的保护范围以权利要求书为准。The above embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or transformations made by those skilled in the art on the basis of the present invention are all within the protection scope of the present invention. The protection scope of the present invention shall be determined by the claims.

Claims (10)

1. a kind of file cycle storage method, which is characterized in that including:
FPGA receives the date information of writing that host computer is sent and asks, and date information request is write from ROM bit cell according to described Address area obtains the starting block address of this storage, obtains date information from time service module, and the date information of acquisition is written The free area of FLASH storage units;
The FPGA receives the user file of writing that host computer is sent and asks, and asks to deposit from the ROM according to the user file of writing The address area of storage unit obtain this storage starting block address, and according to the starting block address of acquisition by user file in order The data field of FLASH storage units is written;Wherein, when the data field of the FLASH storage units writes full, erasing is wherein first The data of memory block continue cycling through write-in from first memory block;
The FPGA receives the reading file date information request that host computer is sent, according to the reading file date information request from Read file date information in the free area of FLASH storage units;
The host computer carries out analysis and arrangement to the file date information of reading, obtains file date information list;
The host computer finds the date information and starting block address of required user file, and root from the fileinfo list According to the date information and starting block address of the user file found user's text is read from the data field of the FLASH storage units Part.
2. file cycle storage method as described in claim 1, which is characterized in that further include:Host computer hair is being received for the first time Before the written document date information request sent, the ground of ROM bit cell is written in the first address information of FLASH storage units by FPGA Location area;
N (N be more than or equal to 1 integer) is secondary the data field of FLASH storage units is written into user file in order after, The address of the address area of ROM bit cell is updated to the starting block address of the N+1 times data storage by FPGA.
3. file cycle storage method as described in claim 1, which is characterized in that further include:By ROM bit cell and The configuring area of the configuration information write-in ROM bit cell of FLASH storage units.
4. file cycle storage method as claimed in claim 3, which is characterized in that the configuration information is deposited including at least ROM Storage unit and the capacity of FLASH storage units, configuring area capacity, configuring area initial address, address area capacity, address area starting point Location, data field capacity, data field initial address, a complete frame structure byte number, frame structure table, controlling of sampling rate.
5. file cycle storage method as described in claim 1, which is characterized in that described and starting block address according to acquisition The data field that user file data are written to FLASH storage units in order, specifically includes:
When writing a block, judge whether next piece of memory space is empty, if so, after the data of next piece of erasing, will be used The data field of FLASH storage units is written in family file in order, otherwise, FLASH is directly written in user file data in order The data field of storage unit.
6. file cycle storage method as described in claim 1, which is characterized in that further include:When receive host computer transmission When stop recording order or unexpected power down, power module provides the user that electric energy will cache in the data field of FLASH storage units File writes and updates the address information in the address area of ROM bit cell.
7. file cycle storage method as described in claim 1, which is characterized in that described and according to the user file found Date information and starting block address read user file from the data field of the FLASH storage units, specifically include:When reading one When block, judge whether it is last block, if so, stopping reading after running through the block;Otherwise, after running through the block, continue Read next piece.
8. a kind of file recycles storage system, which is characterized in that including:Host computer, FPGA, time service module and data store mould Block, the data memory module include ROM bit cell and FLASH storage units;
The ROM bit cell storage unit is divided into configuring area and address area, and the FLASH storage units are divided into data field and sky Not busy area, the configuring area are used to store the configuration information of the data memory module, and described address area is for storing user file Starting block address;The data field is for storing user file;The free area is for storing date information;
The host computer is used to write date information request to FPGA transmissions;
The FPGA is asked for receiving the date information of writing, and date information request is write from the acquisition of described address area according to described The starting block address of this storage obtains date information from time service module, and the free area is written in the date information of acquisition Correspondence page in;
The time service module is used to provide date information to the FPGA;
The host computer is additionally operable to write user file request to FPGA transmissions;
The FPGA, which is additionally operable to receive, writes user file request, asks to obtain this from described address area according to the user file of writing The starting block address of secondary storage, and user file is written according to the starting block address of acquisition by the data field in order;
The FPGA is additionally operable to when the data field of the FLASH storage units writes full, wipes the data of wherein first memory block Write-in is continued cycling through from first memory block;
The host computer, which is additionally operable to send to the FPGA, reads file date information request;
The FPGA is additionally operable to receive the reading file date information request, according to the reading file date information request from described Read date information in free area;
The host computer is additionally operable to carry out analysis and arrangement to the date information of reading, obtains file date information list;
The host computer is additionally operable to find the date information and starting block of required user file from the file date information list User file is read in address according to the date information of the user file found and starting block address from the data field.
9. file as claimed in claim 8 recycles storage system, which is characterized in that the FPGA is additionally operable to:
Before receiving the written document date information request that host computer is sent for the first time, by the first address information of FLASH storage units The address area of ROM bit cell is written;
N (N be more than or equal to 1 integer) is secondary the data field of FLASH storage units is written into user file in order after, The address of the address area of ROM bit cell is updated to the starting block address of the N+1 times data storage.
10. file as claimed in claim 8 recycles storage system, which is characterized in that further include:Power module, for when receipts When the stop recording order sent to host computer or unexpected power down, providing electric energy will cache in the data field of FLASH storage units User file write and update the address information in the address area of ROM bit cell.
CN201810415463.2A 2018-05-03 2018-05-03 File circulating storage method and system Active CN108664578B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810415463.2A CN108664578B (en) 2018-05-03 2018-05-03 File circulating storage method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810415463.2A CN108664578B (en) 2018-05-03 2018-05-03 File circulating storage method and system

Publications (2)

Publication Number Publication Date
CN108664578A true CN108664578A (en) 2018-10-16
CN108664578B CN108664578B (en) 2020-10-20

Family

ID=63781690

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810415463.2A Active CN108664578B (en) 2018-05-03 2018-05-03 File circulating storage method and system

Country Status (1)

Country Link
CN (1) CN108664578B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113342272A (en) * 2021-06-07 2021-09-03 深圳数联天下智能科技有限公司 Sitting posture data storage method, sitting posture data display method, intelligent cushion and system

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008026466A1 (en) * 2006-08-31 2008-03-06 Sharp Kabushiki Kaisha File system
CN101872326A (en) * 2010-06-24 2010-10-27 济南大学 A data storage management method of OTP flash memory in an embedded environment
CN102637197A (en) * 2012-02-28 2012-08-15 中北大学 File management method of real-time data acquisition and storage system
CN102667739A (en) * 2010-01-13 2012-09-12 株式会社东芝 Storage device management device and method for managing storage device
CN102902709A (en) * 2012-08-02 2013-01-30 何建亿 Space allocation fixing file memory system and implementation method
CN104317732A (en) * 2014-10-27 2015-01-28 上海动联信息技术股份有限公司 Large-capacity Flash chip space management method
CN104751076A (en) * 2015-04-15 2015-07-01 四川神琥科技有限公司 Method for recovering disk data
CN105468304A (en) * 2015-11-26 2016-04-06 恒宝股份有限公司 Native memory card and management method thereof
CN107168647A (en) * 2017-04-17 2017-09-15 武汉永力科技股份有限公司 FLASH data read-write methods and system
CN107451233A (en) * 2017-07-25 2017-12-08 南京师范大学 Storage method of the preferential space-time trajectory data file of time attribute in auxiliary storage device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008026466A1 (en) * 2006-08-31 2008-03-06 Sharp Kabushiki Kaisha File system
CN102667739A (en) * 2010-01-13 2012-09-12 株式会社东芝 Storage device management device and method for managing storage device
CN101872326A (en) * 2010-06-24 2010-10-27 济南大学 A data storage management method of OTP flash memory in an embedded environment
CN102637197A (en) * 2012-02-28 2012-08-15 中北大学 File management method of real-time data acquisition and storage system
CN102902709A (en) * 2012-08-02 2013-01-30 何建亿 Space allocation fixing file memory system and implementation method
CN104317732A (en) * 2014-10-27 2015-01-28 上海动联信息技术股份有限公司 Large-capacity Flash chip space management method
CN104751076A (en) * 2015-04-15 2015-07-01 四川神琥科技有限公司 Method for recovering disk data
CN105468304A (en) * 2015-11-26 2016-04-06 恒宝股份有限公司 Native memory card and management method thereof
CN107168647A (en) * 2017-04-17 2017-09-15 武汉永力科技股份有限公司 FLASH data read-write methods and system
CN107451233A (en) * 2017-07-25 2017-12-08 南京师范大学 Storage method of the preferential space-time trajectory data file of time attribute in auxiliary storage device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
麻海霞等: "基于FPGA的高速大容量FLASH存储", 《微计算机信息》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113342272A (en) * 2021-06-07 2021-09-03 深圳数联天下智能科技有限公司 Sitting posture data storage method, sitting posture data display method, intelligent cushion and system

Also Published As

Publication number Publication date
CN108664578B (en) 2020-10-20

Similar Documents

Publication Publication Date Title
US11880602B2 (en) Data writing method and storage device
US10976930B2 (en) Memory device and host device
US9189389B2 (en) Memory controller and memory system
US10545876B2 (en) Control unit for data storage system and method for updating logical-to-physical mapping table
US8386698B2 (en) Data accessing method for flash memory and storage system and controller using the same
US10572391B2 (en) Methods and apparatus for implementing a logical to physical address mapping in a solid state drive
CN103646063B (en) A kind of spaceborne high speed document management system
CN108021510A (en) The method for operating the storage device being managed to multiple name space
CN108153487B (en) A spaceborne storage multi-source data file system based on NAND FLASH
US20190339904A1 (en) Solid state drive using two-level indirection architecture
CN111796759B (en) Computer-readable storage medium and method for reading fragment data on multiple planes
CN106354615A (en) Solid state disk log generating method and device
JPWO2008072590A1 (en) Write-once recording device, controller, access device, and write-once recording system
CN102169460A (en) Method and device for managing variable length data
JP6139711B2 (en) Information processing device
CN112882649B (en) Data storage device and non-volatile memory control method
CN106354658B (en) A method of it reducing mapping table memory source in mixed-use developments algorithm and occupies
JPWO2009107393A1 (en) Access device, information recording device, controller, and information recording system
CN108664577B (en) A file management method and system based on FLASH free area
CN110377599A (en) Key assignments storage device and its operating method
CN106469126A (en) Process method and its storage control of I/O Request
CN112882650A (en) Data storage device and non-volatile memory control method
CN111538680A (en) Selecting mass storage device streams for garbage collection based on logical saturation
CN109471819A (en) The storage equipment of short reading response time is provided for the read requests from host
CN109840218A (en) Effective data management method and storage control

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
GR01 Patent grant
GR01 Patent grant