File management method, system and medium for data acquisition and playback

文档序号:1904481 发布日期:2021-11-30 浏览:3次 中文

阅读说明:本技术 用于数据采集回放的文件管理方法、系统及介质 (File management method, system and medium for data acquisition and playback ) 是由 邓新志 卢少林 王萌 孙恩元 于 2021-07-20 设计创作,主要内容包括:本发明公开了一种用于数据采集回放的文件管理方法、系统及介质,方法包括:根据待采集文件的参数信息配置对应文件目录的信息和数据采集通道,使能FPGA采集数据采集通道的数据,将被采集文件的数据根据对应的文件索引信息依次保存在存储空间的连续地址中,根据待采集文件的数据量大小更新文件系统中的索引表信息;根据待删除文件的参数信息匹配对应文件目录的信息得到对应的文件索引信息,将文件目录信息删除,根据文件索引信息找到对应的已使用的索引表并整合为新的可用的索引表,将新的可用的索引表设置于所有可用的索引表的末尾。本发明能够支持为文件添加属性信息,还可以将文件存储在连续的区域中,提高了数据的安全性和稳定性。(The invention discloses a file management method, a system and a medium for data acquisition and playback, wherein the method comprises the following steps: configuring information corresponding to a file directory and a data acquisition channel according to parameter information of a file to be acquired, enabling an FPGA to acquire data of the data acquisition channel, sequentially storing the data of the acquired file in continuous addresses of a storage space according to corresponding file index information, and updating index table information in a file system according to the data size of the file to be acquired; and matching the information of the corresponding file directory according to the parameter information of the file to be deleted to obtain corresponding file index information, deleting the file directory information, finding a corresponding used index table according to the file index information, integrating the used index table into a new available index table, and setting the new available index table at the tail of all the available index tables. The invention can support the addition of attribute information to the file, and can also store the file in a continuous area, thereby improving the safety and stability of data.)

1. A file management method for data acquisition and playback is characterized by comprising the following steps:

s1) receiving the instruction and judging the type of the instruction, jumping to the step S2) if the instruction is a collection instruction, jumping to the step S3) if the instruction is a deletion instruction, and jumping to the step S4) if the instruction is a playback instruction;

s2) acquiring parameter information of the file to be acquired, configuring information of a corresponding file directory and a data acquisition channel according to the parameter information of the file to be acquired, enabling the FPGA to acquire data of the data acquisition channel, updating used table items and the number of available index tables in an index table in a file system according to the data volume of the file to be acquired, updating corresponding file index information, sequentially storing the data of the acquired file in continuous addresses of a storage space according to the corresponding file index information, ending and exiting;

s3) acquiring parameter information of the file to be deleted, matching the parameter information of the file to be deleted with information of a corresponding file directory to obtain corresponding file index information, deleting the file directory information, finding a corresponding used index table according to the file index information and integrating the index table into a new available index table, setting the new available index table at the tail of all the available index tables, ending and exiting;

s4) acquiring parameter information of the file to be played back, matching the parameter information of the file to be played back with information of the corresponding file directory to obtain corresponding file index information, configuring a data playback channel, enabling the FPGA to read data from the storage space according to the file index information and play back through the data playback channel, ending and exiting.

2. The file management method for data collection and playback according to claim 1, wherein step S2) specifically includes:

acquiring parameter information of a file to be acquired, generating a corresponding file directory according to the parameter information of the acquired file, configuring a data acquisition channel, enabling an FPGA to acquire data of the data acquisition channel, sequentially writing the data into an address of a storage space specified by a currently available index table for each index table, writing the data into an address of a storage space specified by a next available index table until the acquisition is finished after the address of the storage space specified by the currently available index table is full, and finally acquiring an end address of data writing and the use number of the index tables;

calculating the size of the acquired file according to the end address of data writing and the using number of the index table, and updating the available capacity, the number of the available index tables, the number of the files, the available table entries, the used table entries and the index length of the currently available index table in the file system information; updating the information of the corresponding file directory according to the file directory and the used list items; and updating the corresponding file index information according to the using quantity of the index table.

3. The file management method for data collection and playback as claimed in claim 1, wherein the type of instruction in step S1) further includes a file data import instruction, and further includes a step of file data import after step S4), specifically including:

receiving structure parameters of file import, generating a corresponding file directory according to the structure parameters of the file import, receiving USB or network data, writing the USB or network data into a queue, reading data to be imported from the queue and sending the data to the FPGA, writing the data into an address of a storage space specified by a currently available index table in sequence for each index table, writing the data into an address of a storage space specified by a next available index table until the queue is completely read after the address of the storage space specified by the currently available index table is fully written, and finally obtaining an end address of data writing and the use number of the index tables;

calculating the size of the acquired file according to the end address of data writing and the using number of the index table, and updating the available capacity, the number of the available index tables, the number of the files, the available table entries, the used table entries and the index length of the currently available index table in the file system information; updating the information of the corresponding file directory according to the file directory and the used list items; and updating the corresponding file index information according to the using quantity of the index table.

4. The file management method for data collection and playback as claimed in claim 1, wherein the step S3) of finding the corresponding used index table according to the file index information and integrating the index table into a new available index table specifically comprises: and matching all the index tables according to the file index information to obtain corresponding used index tables, traversing the available index tables, and integrating the used index tables corresponding to the continuous address intervals and other index tables to obtain a new available index table.

5. The file management method for data collection and playback according to claim 1, wherein step S4) specifically includes: acquiring parameter information of a file to be played back, matching all file directories according to file names in the parameter information of the file to be played back to obtain information of corresponding file directories, obtaining corresponding file index information according to the information of the corresponding file directories, matching the file index information according to offset time and playback time in the parameter information of the file to be played back to obtain a data storage address of the file to be played back, configuring a data playback channel according to the playback channel in the parameter information of the file to be played back, enabling the FPGA to read data from a storage space according to the data storage address of the file to be played back, and playing back the data through the data playback channel.

6. The file management method for data collection playback of claim 1, wherein the type of command in step S1) further includes a file data export command, and further includes a step of file data export after step S4), specifically including:

receiving a structural body parameter exported by a file, matching all file directories according to file names in the structural body parameter to obtain information of corresponding file directories, obtaining corresponding file index information according to the information of the corresponding file directories, calculating a data storage address and an export size in the file index information according to import time offset and export duration in the structural body parameter, storing the data storage address and the export size in a global variable table, sending the information in the global variable table to an FPGA (field programmable gate array), enabling the FPGA to read data from a storage space according to the data storage address and the export size, writing the data into a sending queue, reading the data in the sending queue and sending the data out through a network or a USB (universal serial bus) until the data reading of the data storage address is completed.

7. The file management method for data collection and playback as claimed in claim 1, wherein the type of the instruction in step S1) further includes a file list query instruction, and further includes a step of file list query after step S4), specifically including:

the method comprises the steps of obtaining a file serial number and a file information structure, matching all file directory information according to the file serial number to obtain information corresponding to a file directory, sequentially writing effective information in the information corresponding to the file directory into the file information structure, taking out the effective information in the file information structure, and writing the effective information into a data stream.

8. The file management method for data collection and playback according to claim 1, wherein step S1) is preceded by a step of pre-configuration, specifically comprising: the method comprises the steps of dividing a storage space into a file system area, a file directory area, a file index area and a file data area, storing file system information in the file system area, storing file directory information in the file directory area, storing file index information in the file index area, and storing file data in the file data area, wherein an index table of the file system comprises two long type parameters of a starting address and an address number.

9. A file management system for data collection playback, comprising a computer device programmed or configured to perform the file management method for data collection playback of any of claims 1-8.

10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program for executing the file management method for data collection playback according to any one of claims 1 to 8.

Technical Field

The present invention relates to the field of data acquisition and playback, and in particular, to a file management method, system, and medium for data acquisition and playback.

Background

With the rapid development of information technology and the informatization of military equipment, the bandwidth requirements of the fields of radar systems, aerospace and aviation and the like on acquisition and storage equipment are further improved, the traditional file system has strict limitation on data bandwidth, and high-speed bandwidth data can cause serious packet loss because the high-speed bandwidth data cannot be stored in time. The reason for this is at the bottom because conventional file systems require system support, which results in a reduction in the rate of storage.

At present, mainstream data acquisition and playback equipment in the world mainly comprises a disk array and a PCIE interface combination under an X86 architecture, and two Flash arrays based on an FPGA. Both approaches have drawbacks in terms of data transfer speed or file management approach.

Although the scheme can realize the acquisition and playback functions of high-speed data, the defects of large volume, high power consumption, high cost, complex deployment and the like exist, and meanwhile, a separate database needs to be matched to manage files, and the acquisition and storage speed of the files is limited due to the system.

Although the scheme can realize the functions of acquisition and playback of high-speed data, the Flash array based on the FPGA does not have a perfect file management scheme. In most cases, even only the collection and playback of a single file are supported, and the detailed description information of the file, such as information parameters of time, size, remarks and the like, is difficult to increase.

In addition, the conventional file management method divides the storage space into a plurality of regions with fixed sizes, and connects the regions by using a linked list, so that the data is not necessarily stored in a continuous region each time, and the whole linked list needs to be traversed during reading. The method can increase the time for storing and reading the file to a certain extent, and in order to avoid the reduction of the service life of the storage medium, a set of complex read-write balance management algorithm is provided in the prior art, and the process is complex.

Disclosure of Invention

The technical problem to be solved by the invention is as follows: aiming at the technical problems in the prior art, the invention provides a file management method for data acquisition and playback, which can support the addition of attribute information to a file and can store the file in a continuous area.

In order to solve the technical problems, the technical scheme provided by the invention is as follows:

a file management method for data acquisition playback, comprising the steps of:

s1) receiving the instruction and judging the type of the instruction, jumping to the step S2) if the instruction is a collection instruction, jumping to the step S3) if the instruction is a deletion instruction, and jumping to the step S4) if the instruction is a playback instruction;

s2) acquiring parameter information of the file to be acquired, configuring information of a corresponding file directory and a data acquisition channel according to the parameter information of the file to be acquired, enabling the FPGA to acquire data of the data acquisition channel, updating used table items and the number of available index tables in an index table in a file system according to the data volume of the file to be acquired, updating corresponding file index information, sequentially storing the data of the acquired file in continuous addresses of a storage space according to the corresponding file index information, ending and exiting;

s3) acquiring parameter information of the file to be deleted, matching the parameter information of the file to be deleted with information of a corresponding file directory to obtain corresponding file index information, deleting the file directory information, finding a corresponding used table item according to the file index information and integrating the used table item into a new available index table, setting the new available index table at the tail of all the available index tables, ending and exiting;

s4) acquiring parameter information of the file to be played back, matching the parameter information of the file to be played back with information of the corresponding file directory to obtain corresponding file index information, configuring a data playback channel, enabling the FPGA to read data from the storage space according to the file index information and play back through the data playback channel, ending and exiting.

Further, step S2) specifically includes:

acquiring parameter information of a file to be acquired, generating a corresponding file directory according to the parameter information of the acquired file, configuring a data acquisition channel, enabling an FPGA to acquire data of the data acquisition channel, sequentially writing the data into an address of a storage space specified by a currently available index table for each index table, writing the data into an address of a storage space specified by a next available index table until the acquisition is finished after the address of the storage space specified by the currently available index table is full, and finally acquiring an end address of data writing and the use number of the index tables;

calculating the size of the acquired file according to the end address of data writing and the using number of the index table, and updating the available capacity, the number of the available index tables, the number of the files, the available table entries, the used table entries and the index length of the currently available index table in the file system information; updating the information of the corresponding file directory according to the file directory and the used list items; and updating the corresponding file index information according to the index table use number and the used table items.

Further, the instruction type in step S1) further includes a file data import instruction, and after step S4), the method further includes a step of importing file data, which specifically includes:

receiving structure parameters of file import, generating a corresponding file directory according to the structure parameters of the file import, receiving USB or network data, writing the USB or network data into a queue, reading data to be imported from the queue and sending the data to the FPGA, writing the data into an address of a storage space specified by a currently available index table in sequence for each index table, writing the data into an address of a storage space specified by a next available index table until the queue is completely read after the address of the storage space specified by the currently available index table is fully written, and finally obtaining an end address of data writing and the use number of the index tables;

calculating the size of the acquired file according to the end address of data writing and the using number of the index table, and updating the available capacity, the number of the available index tables, the number of the files, the available table entries, the used table entries and the index length of the currently available index table in the file system information; updating the information of the corresponding file directory according to the file directory and the used list items; and updating the corresponding file index information according to the index table use number and the used table items.

Further, the step S3) of finding the corresponding used entry according to the file index information and integrating the used entry into the new available index table specifically includes: and matching all the index tables according to the file index information to obtain corresponding used table items, and integrating the used table items corresponding to the continuous addresses into a new available index table for the used table items.

Further, step S4) specifically includes: the method comprises the steps of obtaining parameter information of a file to be played back, matching all file directory information according to file names in the parameter information of the file to be played back to obtain information of a corresponding file directory, obtaining corresponding file index information according to the information of the corresponding file directory, matching the file index information according to offset time and playback time in the parameter information of the file to be played back to obtain a data storage address of the file to be played back, configuring a data playback channel according to the playback channel in the parameter information of the file to be played back, enabling an FPGA to read data from a storage space according to the data storage address of the file to be played back, reading required information in the information of the corresponding file directory, and playing back through the data playback channel.

Further, the instruction type in step S1) further includes a file data export instruction, and after step S4) further includes a step of exporting file data, including:

receiving a structural body parameter exported by a file, matching all file directory information according to file names in the structural body parameter to obtain information of corresponding file directories, obtaining corresponding file index information according to the information of the corresponding file directories, calculating a data storage address and an export size in the file index information according to import time offset and export duration in the structural body parameter, storing the data storage address and the export size in a global variable table, sending the information in the global variable table to an FPGA (field programmable gate array), enabling the FPGA to read data from a storage space according to the data storage address and the export size, writing the data into a sending queue, reading the data in the sending queue and sending the data out through a network or a USB (universal serial bus) until the data reading of the data storage address is completed.

Further, the instruction type in step S1) further includes a file list query instruction, and after step S4) further includes a file list query step, which specifically includes:

the method comprises the steps of obtaining a file serial number and a file information structure, matching all file directory information according to the file serial number to obtain information corresponding to a file directory, sequentially writing effective information in the information corresponding to the file directory into the file information structure, taking out the effective information in the file information structure, and writing the effective information into a data stream.

Further, step S1) is preceded by a step of pre-configuring, specifically including: the method comprises the steps of dividing a storage space into a file system area, a file directory area, a file index area and a file data area, storing file system information in the file system area, storing file directory information in the file directory area, storing file index information in the file index area, and storing file data in the file data area, wherein an index table of the file system comprises two long type parameters of a starting address and an address number.

The invention also provides a file management system for data acquisition and playback, which comprises a computer device programmed or configured to execute the file management method for data acquisition and playback.

The invention further provides a computer readable storage medium, which stores a computer program for executing the file management method for data acquisition and playback.

Compared with the prior art, the invention has the advantages that:

1. the invention realizes read-write balance by using a recovery mode, is simple and efficient, and can effectively prevent the data from being repeatedly written at a fixed address all the time, so that the service life of the storage medium is shortened: under the condition of file acquisition or file data import, the data are sequentially stored in the continuous addresses of the storage space, and the phenomenon of repeated rewriting at a certain fixed address can not occur; under the condition of file deletion, a data storage area occupied by the deleted file is recovered, the corresponding used table entries are integrated into a new available index table and are placed at the last edge of the existing available index table, and the earliest recovered area is written after the unwritten area is full.

2. In the initial condition, the data are sequentially stored in the continuous addresses of the storage space, so that the file is stored in a continuous area, the index table is divided after the file is deleted subsequently, and meanwhile, the continuous recovered areas are integrated, so that the subsequently stored file can be continuously stored in the continuous area as much as possible, the number of times of traversing the storage space can be reduced, and the writing and reading speed is improved.

3. The invention uses independent index management, parameters in the index table are all of long long type, and the maximum size of the file under the long long type can reach 2^64 ^ disk sector unit byte number. For example, in the case of 4 SATA disks, the maximum supportable file size reaches 2^64 × 512 bytes, which breaks through the file size limitation in the conventional file management method and far exceeds the space of 4 SATA disks, whereas in the conventional method, the file size limitation is usually determined by the disk space, for example, the file system file size limitation of FAT32 is 4 GB.

4. The invention sets the corresponding file directory for the file, can automatically add the file attribute information such as channel information, remark information and the like according to the requirement, and solves the problem that the Flash array based on the FPGA is difficult to add the detailed description information of the file in the prior art.

5. The invention is based on FPGA and is incompatible with the traditional file system, data can not be obtained at the PC end, and the safety and the confidentiality of the data can be ensured

Drawings

FIG. 1 is a schematic diagram of storage medium region division according to an embodiment of the present invention.

FIG. 2 is an overall framework of file system management in an embodiment of the present invention.

FIG. 3 is a flowchart illustrating a file management method according to an embodiment of the present invention.

Detailed Description

The invention is further described below with reference to the drawings and specific preferred embodiments of the description, without thereby limiting the scope of protection of the invention.

As shown in fig. 1, the present embodiment divides the storage space of the storage medium into four areas, namely, a file system area 1, a file directory area 2, a file index area 3, and a file data area 4. Generally, in order to save space and facilitate management configuration, consecutive areas in the storage space are defined as the four areas in turn.

The file system area 1 is used for managing information parameters of the whole file system, the part is usually arranged at the forefront of the four areas, the information parameters of the file system comprise capacity information, file number information, index table information and the like of the file system, in the scheme, the file system area 1 stores a fixed number of index tables, each index table points to corresponding address intervals in the file data area 4, and the address intervals corresponding to each index table are sequential.

The file directory area 2 is used for storing attribute parameters of files and offset positions in the file index area 3, the file system area 1 is usually next to the file directory area, each file has a corresponding file directory to store the attribute parameters in the scheme, file attribute information such as channel information, remark information and the like can be added according to requirements, the problem that in the prior art, a Flash array based on an FPGA is difficult to increase detailed description information of the files is solved, and a fixed number of file directories are stored in the file directory area 2.

The file index area 3 is used for storing the storage position and length of data in the file data area 4, the area 4 is usually next to the file directory area 2, in the present embodiment, each file has an array of file index structures corresponding to it, and the area is composed of a fixed number of file index structures. The file index structure comprises a starting address and an index length, and is generated by storing file data in an address interval corresponding to the index table in the file data area.

The file data area 4 is used to store data of a file in which all recorded file data is stored, and is generally next to the file index area 3.

The relationship between the various regions is:

the index table information of the file system area 1 includes the number of available index tables and information of the available index tables for determining the storage location of the new file, and the information of the available index tables includes a start address and an index length. For each index table, after collection is started, the collected data is written into the address interval corresponding to the first available index table in the file data area 4, and when the space corresponding to the first available index table is full, the data is written into the address interval corresponding to the second available index table under the condition that the data is large enough, and so on until the address intervals corresponding to all the available index tables are full, that is, the used available indexes are expressed to the number of the available index tables.

The number of valid file directories in the file directory area 2 and the number of arrays of valid file index structures in the file index area 3 can be determined from the file number information in the file system area 1. Meanwhile, the corresponding file directory of the file directory area 2 can be searched through the file name or the offset serial number, and then the array of the corresponding file index structure of the file index area 3 is obtained through the file position parameter in the file directory, so that the storage initial position and length of the file data area 4 are determined according to the initial address and the index length of the file index structure. On the other hand, unused addresses in the file data area 4 are stored in the form of a list in an available index table.

In this embodiment, the entire disk is regarded as a continuous storage area, multiple disks are processed in parallel in the case of multiple disks, the file system specifies the minimum storage unit of a data area, which is usually an integer multiple of the sector size and the number of disks, and the data is uniformly stored in each disk after being received. As in the case of 4 SATA disks, sectors 0-3 of the system, refers to sectors 0 of SATA1-SATA 4; sectors 4-7 of the system refer to SATA 1-1 sector of SATA4, and so on.

In this embodiment, the information of the index table includes a start address and an index length, both of the two parameters are a long long type with 8 bytes, and the maximum size of the file under the long type can reach 2^64 ^ disk sector unit bytes. For example, in the case of 4 SATA disks, the maximum supportable file size reaches 2^64 × 512 bytes, which breaks through the file size limitation in the conventional file management method and far exceeds the space of 4 SATA disks, whereas in the conventional method, the file size limitation is usually determined by the disk space, for example, the file system file size limitation of FAT32 is 4 GB.

As shown in fig. 2, the following basic interfaces are configured for the file system in this embodiment:

and the function of newly adding the file is used for updating the parameter information of the file, such as the file name, the file size, the file remark information, the storage position and the like, into the file directory and the file index structure body corresponding to the file in the file directory area 2 and the file index area 3, and simultaneously updating the file system parameters. The interface function of the newly added file needs two parameters of index table usage quantity and end address of data writing, after receiving input parameters, the legitimacy of the parameters is judged, then according to the two parameter information and an available index table (comprising two parameters of an initial address and an index length) of a file system area 1, wherein the index table usage quantity can calculate the size of a storage area corresponding to the index table which is used up by the newly added file, the end address of the data writing can calculate the space used by the newly added file under the current index table, further the size of the newly added file is calculated, and simultaneously, the capacity information (the available capacity before the newly added file-the size of the newly added file) in the information parameters of the file system area 1, the available index table quantity (the index table quantity available before the newly added file-the index table usage quantity), the file quantity (the file quantity before the newly added file +1), and the file quantity, Available table entries (the available table entries before the new files are added are modified into 0xFFFF), used table entries (the available table entries before the new files are added are converted into used table entries), available index tables (the starting addresses of the currently available index tables are updated into the ending addresses of data writing, and the index lengths are correspondingly modified), and other parameters; updating information of a file directory corresponding to the file in the file directory area, wherein the information mainly comprises parameters such as file name, file time, file index position, file index number and the like; and updating information of the file index structure corresponding to the file in the file index area, wherein the information comprises the number of index tables used by the file, and the initial address and the index length information used by each index table. Finally, updating the file system information to a file system area 1; writing the information of the file directory into the file directory corresponding to the file in the file directory area 2; and writing the file index table information into a file index structure corresponding to the file in the file index table area 3. And after the storage is successful, 0 is returned, and other error values are returned under other conditions, so that the called function can conveniently judge the storage result.

And the function of deleting the file is used for deleting the information of the corresponding file directory stored in the file directory area 2, deleting the information of the corresponding file index structure stored in the file index area 3 according to the file name or the file sequence number, and recovering the file directory and the file index structure after the information is deleted for storing the subsequent newly added file. A function interface for deleting a file needs to transmit a file name, after input parameters are received, firstly traversing a file directory of a file directory area 2, searching a corresponding file directory, obtaining an offset position of a file index area 3 in the corresponding file directory, finding and reading file index information of a corresponding file index structure according to the offset position, finding a used index table according to the file index information, then recovering a storage area used by the file by recovering the used index table, traversing the available index table when recovering the index table, judging the continuity between each recovered index table and address intervals corresponding to other index tables, and integrating the recovered index table corresponding to the continuous address intervals and other index tables to obtain a new available index table; then, the number of files in the information parameters of the file system area 1 is reduced by one; and finally, the file system information is stored again. After the operation of deleting the file is completed, the function returns to 0, and other error values can be returned under other conditions, so that the called function can conveniently judge the deletion result.

The function of modifying the file is used for modifying the attribute information in the file directory corresponding to the file, and usually only modifies parameters such as file names, remark information and the like. And after receiving the input parameters, traversing the file directory of the file directory area 2 to obtain the corresponding file directory, reading the information of the corresponding file directory, and then replacing the old file name with the new file name and then storing the new file name. After the file modification is completed, the function returns to 0, and other error values are returned under other conditions, so that the called function can conveniently judge the modification result.

And a function for reading a file, which is used for reading the information of the file directory corresponding to the file and the data stored in the file data area 4. The input parameters of the function for reading the file comprise a file serial number and a file information list storage buffer area, the function for reading the file reads the information of the corresponding file directory according to the file serial number, and the required information is sequentially put into the file information list, wherein the required information comprises parameter information such as a file name, file time, a file type, a file size, a file annotation and the like.

As shown in fig. 2, in this embodiment, based on the basic interface, functions such as file data acquisition, file data playback, file data import, file data export, and file list query are implemented, and as shown in fig. 3, this embodiment proposes a file management method for data acquisition and playback based on the functions, which includes the following steps:

s1) receiving the instruction and judging the type of the instruction, jumping to the step S2) to collect the file data if the instruction is a collection instruction, jumping to the step S3) to recycle the file if the instruction is a deletion instruction, and jumping to the step S4) to play back the file data if the instruction is a playback instruction;

s2) acquiring file data is a specific example of a function of a newly added file, after an acquisition instruction is received, a file system acquires parameter information of a file to be acquired, configures information corresponding to a file directory and a data acquisition channel of the FPGA according to the parameter information of the file to be acquired, enables the FPGA to acquire data of the data acquisition channel, sequentially stores the data of the acquired file in continuous addresses of a storage space according to corresponding file index information, updates index table information in the file system according to the data size of the file to be acquired after acquisition is finished, reads an end address of data writing, calculates the size of the file through the end address and a start address of the index table, and finishes the operation of acquiring the file data;

the part comprises a starting collection function and a collection thread function, wherein the starting collection function transmits parameters such as a file name, a collection type, a collection mode, collection time, channel information and the like, the generation of file directory parameters of the file name, the file time and the like is mainly completed, then an index table is sent to an FPGA, storage parameters of the FPGA and a data collection channel are configured, then the FPGA is enabled to collect data through the data collection channel and store the data in an SATA array, and finally a collection thread function is called to complete collection state detection, the collection thread is effective in the whole collection process, the thread is not exited until the collection is completed, the file storage is also completed in the collection thread, for each index table, the data is sequentially written into the address of a storage space specified by a currently available index table, and after the address of the storage space specified by the currently available index table is fully written, the data is written into the address of a storage space specified by the next available index table until the collection is completed, after detecting the ending instruction, the acquisition thread function informs the FPGA to stop acquisition, then waits for the FPGA to finish data storage in the DDR buffer area, finally reads the ending address written in the file data and the using number of the index table, and transmits the ending address and the using number of the index table as input parameters to the function of the newly added file;

after receiving the input parameters according to the contents, the function of the newly added file judges the parameter validity, then calculates the size of the acquired file according to the end address of data writing and the using number of the index table, and updates the available capacity, the number of the available index table, the number of the files, the available table items, the used table items and the index length of the currently available index table in the file system information; updating the information of the corresponding file directory according to the file directory and the used list items; updating the corresponding file index information according to the using quantity of the index table, thereby completing the whole file data acquisition process;

s3) the file recovery is a specific example of the function of deleting the file, after receiving the deleting instruction, the file system can obtain the parameter information of the file to be deleted, the file name in the parameter information of the file to be deleted is taken as an input parameter and is transmitted to the function of deleting the file, the function of deleting the file traverses all file directories according to the file name after receiving the input parameter according to the content, and obtains the corresponding file directory according to the information of the corresponding file directory, deletes the file directory information, finds the corresponding used index table according to the file index information, traverses the available index table, integrates the used index table corresponding to the continuous address interval and other index tables to obtain a new available index table, sets the new available index table at the tail of all the available index tables, and finishes and exits;

through step S3), this embodiment uses the mode of retrieving to realize read-write balance, and is simple high-efficient, can effectively prevent to write data repeatedly at fixed address always, leads to the storage medium life-span to reduce: the data of the newly added file is sequentially stored in the continuous addresses of the storage space, so that the phenomenon of repeated rewriting at a certain fixed address can be avoided; under the condition of file deletion, a data storage area occupied by the deleted file is recovered, the corresponding used table items are integrated into a new available index table and are placed at the last edge of the existing available index table, and the earliest recovered area is written after the unwritten area is fully written;

through the steps S2) and S3), in this embodiment, in the case of a newly added file, data is sequentially stored in consecutive addresses of a storage space, so that the file is stored in a consecutive area, the index table is divided after the file is subsequently deleted, and the consecutive recovered areas are integrated, so that the subsequently stored file can be continuously stored in the consecutive area as much as possible, the number of times of traversing the storage space can be reduced, and the writing and reading speed can be increased;

s4) the file data playback is a specific example of reading a file, after a playback instruction is received, the file system acquires parameter information of the file to be played back, matches information of a corresponding file directory according to the parameter information of the file to be played back to obtain corresponding file index information, and configures a data playback channel of the FPGA, so that the FPGA can read data from a storage space according to the file index information and play back the data through the data playback channel;

the file data playback comprises two functions of file playback and file playback threads, wherein the file playback function needs to introduce a structure body of playback parameters, the structure body comprises parameters such as a playback file name, a playback channel, playback offset time, playback duration and the like, the file playback function can match all file directories according to the file name to acquire information of the corresponding file directory, and corresponding file index information is acquired according to the information of the corresponding file directory; matching the file index information according to the playback offset time and the playback duration to obtain the data storage address and length information of the file to be played back, and transmitting the information to the FPGA; and then sending the channel information and the SATA read control information to an FPGA configuration data playback channel, enabling the FPGA to read data from a storage space according to a data storage address of a file to be played back after the channel information and the SATA read control information are sent, playing back the data through the data playback channel, calling a playback thread function, wherein the playback thread function mainly realizes state acquisition in the playback process and acquisition of parameters such as playback progress, and after the FPGA reads the data, the playback thread function informs the FPGA to stop reading the data, waits for the FPGA to complete data playback of the DDR buffer area, stops playback and exits the playback thread.

The instruction type in step S1) of this embodiment further includes a file data import instruction, and step S4) is followed by a step of file data import, where the file data import is another example of a newly added file, the file system receives data of the imported file through USB, network, and the like, and stores the data onto a storage medium, after completing the data import, reads an end address of the file data write and the usage number of the index table, and then calculates the file size by the end address and the start address of the index table, and completes the operation of adding the file.

The file import comprises two parts of a file import function and a file import thread. The file import function receives the structure parameters of the file import, and the structure parameter members of the file import comprise a file name, a file size, a file channel and the like. After the import is started, the file import function generates corresponding file directory information according to the file name and the file time in the structure parameters of the file import, then calling a file import thread, receiving USB or network data, writing the data into a queue, reading the data to be imported from the queue and sending the data to the FPGA, then sending the storage position and length information of the data to the FPGA, then initiating SATA data stream write-in command and waiting for FPGA to finish data write-in operation, the import process is executed circularly until all imported file data is landed, for each index table, the data is written into the address of the storage space designated by the currently available index table in turn, and after the address of the storage space specified by the currently available index table is fully written, writing the data into the address of the storage space specified by the next available index table until the queue is completely read, and finally acquiring the end address of data writing and the index table use number as functions of inputting parameters and transmitting the parameters to the newly added file. After receiving the input parameters according to the contents, the function of the newly added file judges the parameter validity, then calculates the size of the acquired file according to the end address of data writing and the using number of the index table, and updates the available capacity, the number of the available index table, the number of the files, the available table items, the used table items and the index length of the currently available index table in the file system information; updating the information of the corresponding file directory according to the file directory and the used list items; and updating the corresponding file index information according to the using quantity of the index table, thereby ending the import thread.

The instruction type in step S1) of this embodiment further includes a file data import instruction, and after step S4), the method further includes a step of exporting file data, where exporting file data is a specific example of reading a file, the file system obtains information corresponding to a file directory and file index information according to file name matching, and sends the information to the FPGA, and then receives file data information sent by the FPGA, and sends the data information out through interfaces such as a USB or a network in sequence, thereby completing file export operation.

File data exports include file export functions and file export thread functions. The file export function receives structure parameters of file export, and the structure parameters of file export comprise export mode, file name, import time offset, export time length and the like. The file export function matches all file directories according to file names in the structural body parameters exported by the files to obtain information of the corresponding file directories, and obtains corresponding file index information according to the information of the corresponding file directories; and calculating according to two parameters of time offset and time length in the structure body parameters exported by the file to obtain a data storage address and an export size in the file index information, storing the data storage address and the export size in the global variable table, and finally calling an export thread function. And the export thread function sequentially sends the file index information in the global variable table to the FPGA, enables the FPGA to read a data stream from the SATA disk according to the data storage address and the export size, then reads the file data transmitted by the FPGA, writes the data into a sending queue, then reads the data in the sending queue and sends the data out through a network or a USB, repeats the operations until all the file data are read, finally stops reading the data stream from the SATA disk, and exits the export thread function.

The instruction type in step S1) of this embodiment further includes a file list query instruction, and step S4) is followed by a file list query step, where the file list query is another example of a function for reading files, and the file system sequentially reads information corresponding to file directories according to file quantity information in file system information parameters, and sequentially sends information such as file names, file sizes, comments, file times, and the like to the query initiator in a data stream. The file list query comprises a file list function, the file list function sequentially sends file serial numbers in file directory information and addresses of file information structure bodies as input parameters to a function for reading files, the function for reading files reads information corresponding to the file directories according to the file serial numbers and sequentially puts required information into the file information structure bodies, then the file list function takes out effective information in the file information structure bodies and writes the effective information into a data stream, and the operation is circulated until all the file directory information of all the files is read out.

The foregoing is considered as illustrative of the preferred embodiments of the invention and is not to be construed as limiting the invention in any way. Although the present invention has been described with reference to the preferred embodiments, it is not intended to be limited thereto. Therefore, any simple modification, equivalent change and modification made to the above embodiments according to the technical spirit of the present invention should fall within the protection scope of the technical scheme of the present invention, unless the technical spirit of the present invention departs from the content of the technical scheme of the present invention.

12页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:基于区块链的电子档案管理方法、装置及系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!