Unit pff
Description
Petit FatFs is a sub-set of FatFs module for Tiny 8-bit MicroControllers. It can be incorporated into the Tiny MicroControllers with limited memory even if the RAM size is less than sector size.
Overview
Classes, Interfaces, Objects and Records
Functions and Procedures
Types
Constants
Description
Functions and Procedures
function pf_mount(var fs: FATFS): FRESULT; |
Mount/Unmount a logical Drive
The pf_mount() function registers a work area to the Petit FatFs module. The volume is mounted on registration. The volume must be mounted with this function prior to use any file function and after every media changes.
Parameters
- fs
- Pointer to the work area (file system object) to be registered.
Returns
FR_OK The function succeeded.
FR_NOT_READY The storage device could not be initialized due to a hard error or no medium.
FR_DISK_ERR An error occured in the disk read function.
FR_NO_FILESYSTEM There is no valid FAT partition on the drive. |
function pf_open(path: PChar): FRESULT; |
Opens an existing file
The file must be opend prior to use pf_read and pf_lseek function. The open file is valid until next open.
Parameters
- path
- Pointer to a null-terminated string that specifies the file name to open.
Returns
FR_OK The function succeeded.
FR_NO_FILE Could not find the file or path.
FR_DISK_ERR The function failed due to a hard error in the disk function, a wrong FAT structure or an internal error.
FR_NOT_ENABLED The volume has not been mounted. |
function pf_read(buff: Pointer; btr: UINT; var br: UINT): FRESULT; |
Read data from the open file.
The file read/write pointer in the file system object advances in number of bytes read. After the function succeeded, br should be checked to detect end of file. In case of br is less than btr , it means the read pointer has reached end of the file during read operation. If a null pointer is given to the buff, the read data bytes are forwarded to the outgoing stream instead of the memory. The streaming function depends on each project will be typically built-in the disk_readp function.
Parameters
- buff
- Pointer to the read buffer (nil: Forward data to the stream)
- btr
- Number of bytes to read
- br
- Pointer to number of bytes read
Returns
FRESULT |
function pf_write(buff: Pointer; btw: UINT; bw: pUINT): FRESULT; |
Write data to the open file. The write function has some restrictions listed below:
Cannot create file. Only existing file can be written. Cannot expand file size. Cannot update time stamp of the file. Write operation can start/stop on the sector boundary only. Read-only attribute of the file cannot block write operation.
The read/write pointer in the file system object advances in number of bytes written. After the function succeeded, bw should be checked to detect end of file. In case of bw is less than btw , it means the read/write pointer reached end of file during the write operation. Once a write operation is initiated, it must be finalized properly, or the written data can be lost.
Parameters
- buff
- Pointer to the data to be written
- btw
- Number of bytes to write (0:Finalize the current write operation)
- bw
- Pointer to number of bytes written
Returns
FRESULT |
function pf_lseek(ofs: DWORD): FRESULT; |
Move file pointer of the open file
The pf_lseek() function moves the file read/write pointer of the open file. The ofs can be specified in only origin from top of the file.
Parameters
- ofs
- File pointer from top of file
Returns
FRESULT |
function pf_opendir(var dj: DIR; path: PChar): FRESULT; |
Create a directory Object.
The pf_opendir() function opens an exsisting directory and creates the directory object for subsequent calls. The directory object structure can be discarded at any time without any procedure.
Parameters
- dj
- Directory object
- path
- Directory path
Returns
FRESULT |
function pf_readdir(var dj: DIR; var fno: FILINFO): FRESULT; |
Read a directory item from the open directory.
The pf_readdir() function reads directory entries in sequence. All items in the directory can be read by calling this function repeatedly. When all directory entries have been read and no item to read, the function returns a null string into member f_name[] in the file information structure without error.
Parameters
- dj
- Open directory object
- fno
- Pointer to file information to return
Returns
FRESULT |
function pf_rewinddir(var dj: DIR): FRESULT; |
Directory rewind.
Parameters
- dj
- Open directory object
Returns
FRESULT |
Types
FRESULT = (...); |
File function return code
Values
-
FR_OK = 0
-
FR_DISK_ERR
-
FR_NOT_READY
-
FR_NO_FILE
-
FR_NOT_OPENED
-
FR_NOT_ENABLED
-
FR_NO_FILESYSTEM
|
Constants
PF_FS_FAT12 = True; |
Revision ID
|
FA_OPENED = $01; |
File status flag (FATFS.flag)
|
AM_VOL = $08; |
Volume label
|
AM_MASK = $3F; |
Mask of defined bits
|
Generated by PasDoc 0.15.0.
|