This is the interface for accessing drives.
The drive is usually one of two types:
- Serial Flash (mostly use command flash interface)
- SD/MMC Flash memory
- Page: the size of a writeable chunk of memory
- Sector: the size of an eraseable chunk of memory (commonly 4KB on serial NAND devices)
Multiple pages typically make up a sector. Pages are aligned to sector boundaries.
Gets the driver version.
Gets the drive info (drive_info_t).
Sets the drive attributes (See also: drive_attr_t).
See if the drive is busy. This ioctl call will return greater than one if the device is busy and 0 if drive is not busy.
DRIVE_FLAG_PROTECTEnables driver write protection.
DRIVE_FLAG_UNPROTECTDisables driver write protection.
DRIVE_FLAG_ERASE_BLOCKSErases blocks on the disk. A block consists of the smallest eraseable memory size (See also: driver_info_t and erase_block_size). The return value is the amount of memory actually erased. Some devices can only erase only block at a Time.
DRIVE_FLAG_ERASE_DEVICEErases the drive.
DRIVE_FLAG_POWERDOWNPuts the drive in power down mode.
DRIVE_FLAG_POWERUPPowers up the driver (after power down).
DRIVE_FLAG_INITInitializes the drive.
DRIVE_FLAG_RESETIssue a reset to the drive.
This is the data structure for accessing information about the device.
Attribute flags supported by this driver
MCU Event flags supported by this driver
Number of bytes per address location (typically 1 for small devices 512 for larger ones)
Minimum write block size
Number of write blocks (size is num_write_blocks*write_block_size)
Minimum eraseable block size
Time in microseconds to erase one block
Time in microseconds to erase the device
The maximum number of bytes that can be program as one page
This is the data structure used with setting drive attributes.
Drive flags such as DRIVE_FLAG_INIT
Start block (used with DRIVE_FLAG_ERASE_BLOCKS). This should be the address divided by drive_info_t->address_size.
End block (used with DRIVE_FLAG_ERASE_BLOCKS). This should be the address divided by drive_info_t->address_size.