fs: File system functions
|Top Previous Next|
The file system functions offers support for standard Windows FAT16/32 format 8.3 file systems. This provides applications with the opportunity to have an almost unlimited storage capacity for extensive data logging, databases, user configurations, etc.
By using standard SD-CARD technology or USB drives (NX32L only), it is straightforward to exchange data with any Windows PC (or any other FAT16/32-compatible platform).
This table show how the medias are identified in VPL:
The drives are addressed by using the drive name A:, B:, P: or U:, for example "B:\DOC\MYLOG.TXT".
Functions operating on the media:
Functions operating on directories:
Functions operating on files:
File system Consistency
The firmware does everything possible to maintain the consistency of the file system. It is ensured that shutting down an operation or performing a controlled reset will automatically be handled by the firmware so that the file system is shut down in a consistent state.
Media removal without the use of fsMediaEject or hardware reset should be avoided as this can result in an inconsistent state of the file system and, in a worst case scenario, even loss of data.
In case of an uncontrolled shutdown, or reinserting a non-ejected media, the firmware will automatically check and repair the file system. As this phase can take some time, the file system will be unavailable until the completion of the operation. The file system API will return a -22 (media is busy) error code during this phase.
In case of a repair operation, the fault entry "Drive X: has been repaired due to unexpected shutdown." will be present in the fault log after the repair has completed, where X is the letter of the media.
The implementation of the FAT format 8.3 file system has the following limitations:
•The absolute path is limited to 60 characters.
•It is possible to have 16 files open simultaneously.
•The file name is restricted to a maximum length of 8 characters plus the 3 file type characters. The "." separator is not included.
•The file name must not contain spaces or special characters. "-" or "_" are both allowed, though.
•A file with a long file name can be accessed with the "~" character, e.g. "Long Filename.txt" is accessed as "LONGFI~1.TXT".
•A directory name must not contain "." or any other special characters as stated above.
•"\" (backslash) is used as a directory separator.
•It supports standard SD-CARDs (non-SDHC) with a capacity of up to 2 GB and SD-CARDs (SDHC) with a capacity of up to 32 GB.
•If more than one partition is present on the media, the file system will use the first.
•There is a separate working directory for each thread. When the thread is first started, the working directory is the root of the drive.
Using the Internal Flash drive.
The size of the internal flash drive is specified in the data sheet and/or technical manual of the device in question.
When using the internal flash drive, it must be observed that the flash memory technology used is the same as used for Persistent Memory and Datalogger storage. For this reason, there is a limited number of write operations possible, and the following must therefore be observed:
•The file system will automatically perform wear leveling - thus swapping heavily used sectors in the flash with lesser used sectors.
•The size of a sector is 512 bytes.
Using a device with 4 MB or 8 MB internal flash drive the wear leveling, combined with the effective write throughput, basically means that there is no write endurance limitations to be observed.
For devices with a small internal flash drive of 512 KBytes the write endurance limitation must however be observed.
The following number of write operations can be expected on the Internal Flash drive:
•With a file OPEN, WRITE and CLOSE operation on the same 512 bytes file, a total number of approx. 51 million write operations can be made.
•With a file CREATE, WRITE and CLOSE operation on a 512 bytes file, a total number of approx. 25.5 million write operations can be made.
•With a file OPEN, WRITE and CLOSE operation on the same 1024 bytes file, a total number of approx. 34 million write operations can be made.
•With a file CREATE, WRITE and CLOSE operation on a 1024 bytes file, a total number of approx. 20.4 million write operations can be made.
Writing every 10 seconds, 24 hours a day, will allow CREATE, WRITE and CLOSE operations on a 1024 bytes file for more than 6 years!
Using the Intellisync Project Drive.
The Intellisync Project Drive is read-only from VPL, and does not support directories. To write to the project drive, it must be synchronized using e.g. the RTCU IDE, using User files. It is not possible to read vsx files from the project drive.