Data Structures | |
struct | _PHATFILE |
PHAT file descriptor structure. More... | |
File attributes. | |
#define | PHAT_FATTR_ARCHIV 0x20 |
#define | PHAT_FATTR_DIR 0x10 |
#define | PHAT_FATTR_FILEMASK 0x37 |
#define | PHAT_FATTR_HIDDEN 0x02 |
#define | PHAT_FATTR_LFN (PHAT_FATTR_RDONLY | PHAT_FATTR_HIDDEN | PHAT_FATTR_SYSTEM | PHAT_FATTR_VOLID) |
#define | PHAT_FATTR_RDONLY 0x01 |
#define | PHAT_FATTR_SYSTEM 0x04 |
#define | PHAT_FATTR_VOLID 0x08 |
Defines | |
#define | PHATEOC 0x0FFFFFF8 |
Marks end of cluster chain. | |
Typedefs | |
typedef _PHATFILE | PHATFILE |
PHAT file descriptor structure. | |
Functions | |
u_long | AllocFirstCluster (NUTFILE *nfp) |
Allocate the first cluster of a file. | |
int | PhatFileClose (NUTFILE *nfp) |
Close a file. | |
NUTFILE * | PhatFileOpen (NUTDEVICE *dev, CONST char *path, int mode, int acc) |
Open a file. | |
int | PhatFileRead (NUTFILE *nfp, void *buffer, int size) |
Read data from a file. | |
int | PhatFileWrite (NUTFILE *nfp, CONST void *buffer, int len) |
Write data to a file. | |
Variables | |
NUTDEVICE | devPhat0 |
PHAT file system driver information structure. | |
NUTDEVICE | devPhat0 |
PHAT file system driver information structure. | |
NUTDEVICE | devPhat1 |
NUTDEVICE | devPhat1 |
u_long | _PHATFILE::f_clust |
Current cluster. | |
u_long | _PHATFILE::f_clust_pos |
Sector within the current cluster. | |
u_long | _PHATFILE::f_clust_prv |
Previous cluster used,. | |
u_int | _PHATFILE::f_de_dirty |
Directory entry change marker. | |
u_long | _PHATFILE::f_de_offs |
Offset into the sector containing the directory entry. | |
u_long | _PHATFILE::f_de_sect |
Sector of the directory entry. | |
PHATDIRENT | _PHATFILE::f_dirent |
Directory entry of this file. | |
u_long | _PHATFILE::f_mode |
File open mode flags. | |
u_short | _PHATFILE::f_pde_clust |
First cluster of the parent directory, low word. | |
u_short | _PHATFILE::f_pde_clusthi |
First cluster of the parent directory, high word. | |
u_long | _PHATFILE::f_sect_pos |
Position within the sector. |
#define PHAT_FATTR_ARCHIV 0x20 |
File is not archived. This flag will be set when the file is created or modified.
#define PHAT_FATTR_DIR 0x10 |
File contains a subdirectory.
#define PHAT_FATTR_FILEMASK 0x37 |
Only these flags are allowed for files and directories.
#define PHAT_FATTR_HIDDEN 0x02 |
Hidden file.
#define PHAT_FATTR_LFN (PHAT_FATTR_RDONLY | PHAT_FATTR_HIDDEN | PHAT_FATTR_SYSTEM | PHAT_FATTR_VOLID) |
Long filename entry.
#define PHAT_FATTR_RDONLY 0x01 |
Read only file.
#define PHAT_FATTR_SYSTEM 0x04 |
System file.
#define PHAT_FATTR_VOLID 0x08 |
No file, but a volume label.
Allocate the first cluster of a file.
nfp | The file for which a cluster is allocated. |
int PhatFileClose | ( | NUTFILE * | nfp | ) |
Close a file.
nfp | File descriptor. |
Open a file.
This function is called by the low level open routine of the C runtime library, using the _NUTDEVICE::dev_open entry.
dev | Specifies the file system device. | |
path | Pathname of the file to open. If the last character is a slash, then a directory will be opened. | |
mode | Operation mode. | |
acc | File attribute. |
int PhatFileRead | ( | NUTFILE * | nfp, | |
void * | buffer, | |||
int | size | |||
) |
Read data from a file.
nfp | Pointer to a NUTFILE structure, obtained by a previous call to PnutFileOpen(). | |
buffer | Pointer to the data buffer to fill. | |
size | Maximum number of bytes to read. |
int PhatFileWrite | ( | NUTFILE * | nfp, | |
CONST void * | buffer, | |||
int | len | |||
) |
Write data to a file.
nfp | Pointer to a NUTFILE structure, obtained by a previous call to PnutFileOpen(). | |
buffer | Pointer to the data to be written. If zero, then the output buffer will be flushed. | |
len | Number of bytes to write. |
Initial value:
{ 0, {'P', 'H', 'A', 'T', '0', 0, 0, 0, 0} , IFTYP_FS, 0, 0, 0, 0, PhatInit, PhatApiIOCtl, PhatApiFileRead, PhatApiFileWrite, PhatApiFileOpen, PhatApiFileClose, PhatFileSize }
A pointer to this structure must be passed to NutRegisterDevice() to bind this file system driver to the Nut/OS kernel. An application may then call /verbatim _open("MMC0:1/PHAT0", _O_RDWR | _O_BINARY); /endverbatim to mount partition 1 on the previously registered block device (devMmc0 in this example).
PHAT file system driver information structure.
A pointer to this structure must be passed to NutRegisterDevice() to bind this file system driver to the Nut/OS kernel. An application may then call /verbatim _open("MMC0:1/PHAT0", _O_RDWR | _O_BINARY); /endverbatim to mount partition 1 on the previously registered block device (devMmc0 in this example).
NUTDEVICE devPhat1 |
Initial value:
{ 0, {'P', 'H', 'A', 'T', '1', 0, 0, 0, 0} , IFTYP_FS, 0, 0, 0, 0, PhatInit, PhatApiIOCtl, PhatApiFileRead, PhatApiFileWrite, PhatApiFileOpen, PhatApiFileClose, PhatFileSize }
u_long _PHATFILE::f_de_sect [inherited] |
Sector of the directory entry.
For the root directory this value is zero, because the root doesn't have any entry in another directory.
u_short _PHATFILE::f_pde_clust [inherited] |
First cluster of the parent directory, low word.
Our directory entry is located in this cluster.