118#if defined(MODULE_MTD_WRITE_PAGE) || DOXYGEN
166#define MTD_XFA_ADD(dev, idx) \
167 XFA_CONST(mtd_dev_t, mtd_dev_xfa, idx) *mtd ## idx = (mtd_dev_t *)&(dev)
172#define MTD_NUMOF XFA_LEN(mtd_dev_t *, mtd_dev_xfa)
179#define MTD_DRIVER_FLAG_DIRECT_WRITE (1 << 0)
192#define MTD_DRIVER_FLAG_CLEARING_OVERWRITE (1 << 1)
424 uint32_t offset, uint32_t size);
454 uint32_t offset, uint32_t size);
#define assert(cond)
abort the program if assertion is false
mtd_dev_t *const mtd_dev_xfa[]
MTD device array as XFA.
mtd_power_state
MTD power states.
int mtd_write_sector(mtd_dev_t *mtd, const void *src, uint32_t sector, uint32_t num)
Write data to a MTD device with whole sector writes.
int mtd_write(mtd_dev_t *mtd, const void *src, uint32_t addr, uint32_t count)
Write data to a MTD device.
int mtd_init(mtd_dev_t *mtd)
mtd_init Initialize a MTD device
int mtd_write_page_raw(mtd_dev_t *mtd, const void *src, uint32_t page, uint32_t offset, uint32_t size)
Write data to a MTD device with pagewise addressing.
int mtd_read(mtd_dev_t *mtd, void *dest, uint32_t addr, uint32_t count)
Read data from a MTD device.
int mtd_read_page(mtd_dev_t *mtd, void *dest, uint32_t page, uint32_t offset, uint32_t size)
Read data from a MTD device with pagewise addressing.
int mtd_erase(mtd_dev_t *mtd, uint32_t addr, uint32_t count)
Erase sectors of a MTD device.
static mtd_dev_t * mtd_dev_get(unsigned idx)
Get an MTD device by index.
int mtd_write_page(mtd_dev_t *mtd, const void *src, uint32_t page, uint32_t offset, uint32_t size)
Write data to a MTD device with pagewise addressing.
#define MTD_NUMOF
Number of MTDs defined in the MTD device array in XFA.
int mtd_power(mtd_dev_t *mtd, enum mtd_power_state power)
Set power mode on a MTD device.
int mtd_erase_sector(mtd_dev_t *mtd, uint32_t sector, uint32_t num)
Erase sectors of a MTD device.
@ MTD_POWER_DOWN
Power down.
int(* read)(mtd_dev_t *dev, void *buff, uint32_t addr, uint32_t size)
Read from the Memory Technology Device (MTD)
int(* read_page)(mtd_dev_t *dev, void *buff, uint32_t page, uint32_t offset, uint32_t size)
Read from the Memory Technology Device (MTD) using pagewise addressing.
int(* erase)(mtd_dev_t *dev, uint32_t addr, uint32_t size)
Erase sector(s) over the Memory Technology Device (MTD)
int(* erase_sector)(mtd_dev_t *dev, uint32_t sector, uint32_t count)
Erase sector(s) of the Memory Technology Device (MTD)
int(* power)(mtd_dev_t *dev, enum mtd_power_state power)
Control power of Memory Technology Device (MTD)
int(* write_page)(mtd_dev_t *dev, const void *buff, uint32_t page, uint32_t offset, uint32_t size)
Write to the Memory Technology Device (MTD) using pagewise addressing.
uint8_t flags
Properties of the MTD driver.
int(* init)(mtd_dev_t *dev)
Initialize Memory Technology Device (MTD)
uint32_t write_size
Minimum size and alignment of writes to the device.
uint32_t pages_per_sector
Number of pages per sector in the MTD.
uint32_t sector_count
Number of sector in the MTD.
const mtd_desc_t * driver
MTD driver.
void * work_area
sector-sized buffer (only present when mtd_write_page is enabled)
uint32_t page_size
Size of the pages in the MTD.
#define XFA_USE_CONST(type, name)
Declare an external read-only cross-file array.