Functions | |
NUTFILE * | RawFsFileOpen (NUTDEVICE *dev, CONST char *path, int mode, int acc) |
Open a raw file. | |
int | RawFsFileClose (NUTFILE *nfp) |
Close a raw file. | |
int | RawFsFileWrite (NUTFILE *nfp, CONST void *buffer, int len) |
Write data to a file. | |
int | RawFsFileWrite_P (NUTFILE *nfp, PGM_P buffer, int len) |
Write data from program space to a file. | |
int | RawFsFileRead (NUTFILE *nfp, void *buffer, int size) |
Read data from a file. | |
int | RawFsUnmount (NUTDEVICE *dev) |
Unmount a raw volume. | |
int | RawFsMount (NUTDEVICE *dev, NUTFILE *blkmnt, uint8_t part_type) |
Mount a raw volume. | |
Variables | |
NUTDEVICE | devRawFs0 |
Raw device file system driver information structure. |
NUTFILE* RawFsFileOpen | ( | NUTDEVICE * | dev, | |
CONST char * | path, | |||
int | mode, | |||
int | acc | |||
) |
Open a raw 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 which is ignored here, because the raw file system doesn't support multiple file entries. | |
mode | Operation mode. | |
acc | File attribute, ignored. |
Definition at line 214 of file rawfs.c.
References RAWFILE::f_mode, free, malloc, memset(), and NUTFILE_EOF.
int RawFsFileClose | ( | NUTFILE * | nfp | ) |
Close a raw file.
nfp | Pointer to a NUTFILE structure, obtained by a previous call to RawFsFileOpen(). |
int RawFsFileWrite | ( | NUTFILE * | nfp, | |
CONST void * | buffer, | |||
int | len | |||
) |
Write data to a file.
nfp | Pointer to a NUTFILE structure, obtained by a previous call to RawFsFileOpen(). | |
buffer | Pointer to the data to be written. If zero, then the output buffer will be flushed. | |
len | Number of bytes to write. |
Definition at line 274 of file rawfs.c.
References RAWFILE::f_pos, RAWFILE::f_sect_num, RAWFILE::f_sect_pos, memcpy(), and NUTASSERT.
int RawFsFileWrite_P | ( | NUTFILE * | nfp, | |
PGM_P | buffer, | |||
int | len | |||
) |
Write data from program space to a file.
This function is not yet implemented and will always return -1.
Similar to RawFsFileWrite() except that the data is located in program memory.
nfp | Pointer to a NUTFILE structure, obtained by a previous call to RawFsFileOpen(). | |
buffer | Pointer to the data in program space. If zero, then the output buffer will be flushed. | |
len | Number of bytes to write. |
int RawFsFileRead | ( | NUTFILE * | nfp, | |
void * | buffer, | |||
int | size | |||
) |
Read data from a file.
nfp | Pointer to a NUTFILE structure, obtained by a previous call to RawFsFileOpen(). | |
buffer | Pointer to the data buffer to fill. | |
size | Maximum number of bytes to read. |
Definition at line 363 of file rawfs.c.
References RAWFILE::f_pos, RAWFILE::f_sect_num, RAWFILE::f_sect_pos, memcpy(), and NUTASSERT.
int RawFsUnmount | ( | NUTDEVICE * | dev | ) |
int RawFsMount | ( | NUTDEVICE * | dev, | |
NUTFILE * | blkmnt, | |||
uint8_t | part_type | |||
) |
Mount a raw volume.
This routine is called by the block device driver while mounting a partition.
The routine may also initializes any caching mechanism. Thus, it must be called before any other read or write access.
dev | Specifies the file system device. | |
blkmnt | Handle of the block device's partition mount. | |
part_type | Partition type, ignored. |
Definition at line 529 of file rawfs.c.
References ENODEV, errno, free, malloc, memset(), NUTASSERT, NUTBLKDEV_INFO, NutEventPost(), BLKPAR_INFO::par_blkbp, BLKPAR_INFO::par_blksz, BLKPAR_INFO::par_nblks, and BLKPAR_INFO::par_nfp.
NUTDEVICE devRawFs0 |
{ 0, {'R', 'A', 'W', 'F', 'S', '0', 0, 0, 0} , IFTYP_FS, 0, 0, 0, 0, RawFsInit, RawFsApiIOCtl, RawFsApiFileRead, RawFsApiFileWrite, RawFsApiFileWrite_P, RawFsApiFileOpen, RawFsApiFileClose, RawFsFileSize }
Raw device 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("AT45D0:0/RAWFS0", _O_RDWR | _O_BINARY); /endverbatim to mount the file system on the previously registered block device (devSpiAt45d0 in this example).