Memory Technology Device Drivers¶
include/nuttx/mtd/mtd.h. All structures and APIs needed to work with MTD drivers are provided in this header file.
struct mtd_dev_s. Each MTD device driver must implement an instance of
struct mtd_dev_s. That structure defines a call table with the following methods:
Erase the specified erase blocks (units are erase blocks):
Read/write from the specified read/write blocks:
Some devices may support byte oriented reads (optional). Most MTD devices are inherently block oriented so byte-oriented accesses are not supported. It is recommended that low-level drivers not support read() if it requires buffering.
Some devices may also support byte oriented writes (optional). Most MTD devices are inherently block oriented so byte-oriented accesses are not supported. It is recommended that low-level drivers not support read() if it requires buffering. This interface is only available if
Support other, less frequently used commands:
MTDIOC_GEOMETRY: Get MTD geometry
MTDIOC_BULKERASE: Erase the entire device
is provided via a single
Binding MTD Drivers. MTD drivers are not normally directly accessed by user code, but are usually bound to another, higher level device driver. In general, the binding sequence is:
Get an instance of
struct mtd_dev_sfrom the hardware-specific MTD device driver, and
Provide that instance to the initialization method of the higher level device driver.