The VF library constructs a virtual file system in a specified region.
The VF library has the following characteristics:
OSGetTime())
VFOpenFile(), consume stack space of about 3 KB
To learn how to use the VF library, see ./build/demos/vfdemo/.
Sample demo programs for NAND drives are provided.
Functions declarations are in the ./include/revolution/vf.h header file.
After the necessary device initialization, initialize the VF library by calling VFInit.VFFinalize must be called when finished.
(drive) mount
?
file operations
?
(drive) unmount
Performing operations on a drive mounted in the VF library is the same as directly reading and writing to the vff file that was used for mounting the drive.
If the VF library returns the VF_ERR_EIO error, it means there has been a failure in reading or writing to the vff file, and more specifically, that the process has failed because of an error by a device function. If this error is returned, call the VFGetLastDeviceError function to get the specific device library error and then perform the same error-handling procedure in the guideline that you would follow if a direct call to the device function failed. Below is a list of drive types and their corresponding device-control libraries.
| Drive type | Device functions used inside the VF library. | ||
| VFCreateSystemFile* | VFMount*, VFUnmount* | All other file system operations | |
| NANDFlash | NANDCreate | NANDOpen, NANDClose | NANDRead, NANDWrite |
| DVD | (None) | DVDOpen, DVDClose | DVDRead |
| RAM | (None) | (None) | (None) |
Note: 'None' is written to indicate there is no device access; thus, an VF_ERR_EIO error will not be generated.
All other errors besidesVF_ERR_EIO indicate errors due to a processing failure by the VF library itself, so you will need to review the VFErr function reference and take the appropriate response.
2006/06/01 Fixed a bug that caused an infinite loop when usingVFDeleteFile(W). 2006/06/09 Added an argument toVFReadFileto get the size of the loaded file. 2006/06/16 Because there was a bug when the file system type was set to FAT32, reverted to the original format in which the FAT type is automatically set according to the volume size. 2006/06/27 Revised code when NAND is used. Every timeVFWriteFile()is called, it flushes. Eliminated the alignment restriction for buffers passed byVFWriteFile()andVFReadFile( ). 2006/07/14 AddedVFMove{File, Dir}(W)andVFRename{File, Dir}(W). 2006/08/09 AddedVFCutFileSize(W). 2006/08/24 AddedVFFormatDrive(W). (From now on, after mounting a vff file for the first time, please format it. See the demo for criteria.) 2006/09/12 AddedVFInitEx()andVFFinalize(). 2006/09/13 AddedVFIsAvailable(). 2006/09/14 Fixed a bug that prevented mounting after mounting and unmounting 31 times, using a different drive name. 2006/09/15 Fixed a critical section bug. 2006/09/21 Fixed a bug related to the log name. Fixed the problem when attaching (mounting) with the same drive name twice. (An error is now returnedVFErr.) 2006/09/26 Increased the speed ofVFFormatDrive()when mounting NAND. AddedVFSyncandVFFileSync. 2006/09/27 Changed code so that the cache can be set when mounting.VFMountDrive,VFAttachDrive2006/09/29 Corrected theVF_ERR_ENOEXECthat was returned when there was no space on the drive duringVFWriteFiletoVF_ERR_ENOSPC. AddedVFBuffering(default isVF_WRITE_BACK_ON_SIGNIF_API). 2006/10/02 Corrected problems with various APIs when handling drive names. Included a caution regarding the use of uppercase and lowercase in drive names in the Introduction. 2006/10/11 Changed behavior so thatVF_ERR_VFF_FILE_FORMATis returned when an illegal file is specified during mount. When the above error is detected, create the .vff file again after deleting it. 2006/10/12 Corrected such thatVF_ERR_NOT_ALLOCATED_DRVis returned ifactivateis called beforeattachsucceeds. 2006/10/13 AddedVFDeleteSystemFileNANDFlash. 2006/10/17 Fixed a bug that prevented errors inVFGetFileSizeByFd( ),VFGetOffsetByFd( ), andVFGetDriveFreeSizeW( )from being reflected inVFGetLastError( ). 2006/10/18 Corrected a problem that prevented -1 from being returned when an internal error occurred with the 2006/10/17 version ofVFGetFileSizeByFd( ). 2006/10/25 AddedNANDCheckto the sample demos. 2006/10/27 Added theVF_DTA_GET_FILE_SECONDS(vta)macro to get the file update time from the file search information (VFDta). 2006/10/30 Added a caution regarding stacks in the Introduction and Notes. 2006/11/09 AddedVFUnmountDriveForceto unmount a drive even if a file is open. AddedVFInactivateDriveForceto invalidate a drive even if a file is open. 2006/11/14 Added detailed description to the VFErr document. 2007/04/27 Added VFSetTimeStampCallback. 2007/05/08 Revisions to the Manuals. Added theVFGetApiErrorStringmanual. 2007/06/26 Fixed region corruption that occurred when the same drive was repeatedly mounted and unmounted. 2007/09/10 Added a note aboutVF_ERR_EIO. 2007/10/11 Added the Introduction.
VF_ERR_EIO, use the VFGetLastDeviceError function to get the value of the device error and then perform processing that complies with the guidelines for that device.
VFCreateFile() or VFOpenFile() in directories that contain many files consumes processing time.VFFormatDrive().VF_ERR_VFF_FILE_FORMAT is returned when an illegal file is specified during mount. When the above error is detected, create the .vff file again after deleting it.
NANDCheck within the application when creating files in NAND memory.
VFOpenFile(), consume stack space of about 3 KB.
CONFIDENTIAL