Base Disk Drivers
The Embedded SDK provides an abstract disk layer for handling the I/O operations of file system data. The disk layer provides a common API and
is ultimately used by on-board file systems and USB mass storage interfaces.
Each supported disk contains a create function that is used to initialize the disk driver. Once initialized, the common
disk functions can be used to transfer data to and from the disk.
Supported Disk Drivers
API Reference
STATUS DISK_Mount(DISK* disk)
Mounts a disk.
PARAMETERS
| disk | A pointer to the disk to be mounted. |
| SUCCESS | The disk has been mounted. |
| ERR_NULLREFERENCE | The argument 'disk' was found to be NULL. |
| ERR_NOMEDIA | The media is not present for the disk. |
| ERR_NOTSUPPORTED | The specified disk does not support being mounted. |
REMARKS
| If the disk fails to mount, it is unmounted to leave the disk in a known state. |
STATUS DISK_Unmount(DISK* disk)
Unmounts a disk.
PARAMETERS
| disk | A pointer to the disk to be unmounted. |
| SUCCESS | The disk has been unmounted. |
| ERR_NULLREFERENCE | The argument 'disk' was found to be NULL. |
| ERR_NOTSUPPORTED | The specified disk does not support being unmounted. |
BOOLEAN DISK_Mounted(DISK* disk)
Returns an indication of whether a disk has been mounted.
PARAMETERS
| disk | A pointer to the disk to be checked for being mounted. |
TRUE if the disk has been mounted; otherwise FALSE.
BOOLEAN DISK_WriteProtect(DISK* disk)
Returns an indication of whether the media is write protected for a disk.
PARAMETERS
| disk | A pointer to the disk to be checked for write protection. |
TRUE if the disk's media is write protected; otherwise FALSE.
UINT32 DISK_BlockSize(DISK* disk)
Returns the size of each block within a disk.
PARAMETERS
| disk | A pointer to the target disk. |
The size, in bytes, of each block within the specified disk.
REMARKS
| Depending upon the type of disk, may only be valid after the disk has been mounted. |
UINT32 DISK_BlockCount(DISK* disk)
Returns the number of blocks within a disk.
PARAMETERS
| disk | A pointer to the target disk. |
The total number of blocks contained within the specified disk.
REMARKS
| Depending upon the type of disk, may only be valid after the disk has been mounted. |
STATUS DISK_Read(DISK* disk, UINT32 lba, void* buf, UINT32 nblks)
Reads and returns data from a disk.
PARAMETERS
| disk | A pointer to the disk to be read. |
| lba | The logical block address to be read. |
| buf | A pointer to caller allocated buffer to receive the data read from the disk. |
| nblks | The total number of blocks to be read. |
| SUCCESS | The data has been read and returned from the disk. |
| ERR_NULLREFERENCE | The argument 'disk' or 'buf' was found to be NULL. |
| ERR_NOTSUPPORTED | The specified disk does not support being read. |
STATUS DISK_Write(DISK* disk, UINT32 lba, const void* buf, UINT32 nblks)
Writes data to a disk.
PARAMETERS
| disk | A pointer to the disk to be written. |
| lba | The logical block address to be written. |
| buf | A pointer to the data to be written to the disk. |
| nblks | The total number of blocks to be written. |
| SUCCESS | The data has been written to the disk. |
| ERR_NULLREFERENCE | The argument 'disk' or 'data' was found to be NULL. |
| ERR_NOTSUPPORTED | The specified disk does not support being written. |