MTD driver interface. More...
MTD driver interface.
This define the functions to access a MTD.
A MTD is composed of pages combined into sectors. A sector is the smallest erasable unit. The number of pages in a sector must be constant for the whole MTD.
The erase operation is available only for entire sectors.
#include <mtd.h>
Data Fields | |
int(* | init )(mtd_dev_t *dev) |
Initialize Memory Technology Device (MTD) More... | |
int(* | read )(mtd_dev_t *dev, void *buff, uint32_t addr, uint32_t size) |
Read from the Memory Technology Device (MTD) More... | |
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. More... | |
int(* | write )(mtd_dev_t *dev, const void *buff, uint32_t addr, uint32_t size) |
Write to the Memory Technology Device (MTD) More... | |
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. More... | |
int(* | erase )(mtd_dev_t *dev, uint32_t addr, uint32_t size) |
Erase sector(s) over the Memory Technology Device (MTD) More... | |
int(* | erase_sector )(mtd_dev_t *dev, uint32_t sector, uint32_t count) |
Erase sector(s) of the Memory Technology Device (MTD) More... | |
int(* | power )(mtd_dev_t *dev, enum mtd_power_state power) |
Control power of Memory Technology Device (MTD) More... | |
int(* mtd_desc::erase) (mtd_dev_t *dev, uint32_t addr, uint32_t size) |
Erase sector(s) over the Memory Technology Device (MTD)
addr
must be aligned on a sector boundary. size
must be a multiple of a sector size.
[in] | dev | Pointer to the selected driver |
[in] | addr | Starting address |
[in] | size | Number of bytes |
int(* mtd_desc::erase_sector) (mtd_dev_t *dev, uint32_t sector, uint32_t count) |
int(* mtd_desc::init) (mtd_dev_t *dev) |
int(* mtd_desc::power) (mtd_dev_t *dev, enum mtd_power_state power) |
Control power of Memory Technology Device (MTD)
[in] | dev | Pointer to the selected driver |
[in] | power | Power state to apply (from mtd_power_state) |
int(* mtd_desc::read) (mtd_dev_t *dev, void *buff, uint32_t addr, uint32_t size) |
Read from the Memory Technology Device (MTD)
No alignment is required on addr
and size
.
[in] | dev | Pointer to the selected driver |
[out] | buff | Pointer to the data buffer to store read data |
[in] | addr | Starting address |
[in] | size | Number of bytes |
int(* mtd_desc::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.
offset
should not exceed the page size
[in] | dev | Pointer to the selected driver |
[out] | buff | Pointer to the data buffer to store read data |
[in] | page | Page number to start reading from |
[in] | offset | Byte offset from the start of the page |
[in] | size | Number of bytes |
int(* mtd_desc::write) (mtd_dev_t *dev, const void *buff, uint32_t addr, uint32_t size) |
Write to the Memory Technology Device (MTD)
addr
+ size
must be inside a page boundary. addr
can be anywhere but the buffer cannot overlap two pages.
[in] | dev | Pointer to the selected driver |
[in] | buff | Pointer to the data to be written |
[in] | addr | Starting address |
[in] | size | Number of bytes |
int(* mtd_desc::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.
offset
should not exceed the page size
[in] | dev | Pointer to the selected driver |
[out] | buff | Pointer to the data to be written |
[in] | page | Page number to start writing to |
[in] | offset | Byte offset from the start of the page |
[in] | size | Number of bytes |