MTD driver interface. More...

Detailed Description

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.

Definition at line 75 of file mtd.h.

#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(* write )(mtd_dev_t *dev, const void *buff, uint32_t addr, uint32_t size)
 Write to the Memory Technology Device (MTD) More...
 
int(* erase )(mtd_dev_t *dev, uint32_t addr, uint32_t size)
 Erase sector(s) over 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...
 

Field Documentation

int(* mtd_desc::erase) (mtd_dev_t *dev, uint32_t addr, uint32_t size)

addr must be aligned on a sector boundary. size must be a multiple of a sector size.

Parameters
[in]devPointer to the selected driver
[in]addrStarting address
[in]sizeNumber of bytes
Returns
0 on success
< 0 value on error

Definition at line 135 of file mtd.h.

int(* mtd_desc::init) (mtd_dev_t *dev)
Parameters
[in]devPointer to the selected driver
Returns
0 on success
< 0 value in error

Definition at line 84 of file mtd.h.

int(* mtd_desc::power) (mtd_dev_t *dev, enum mtd_power_state power)
Parameters
[in]devPointer to the selected driver
[in]powerPower state to apply (from mtd_power_state)
Returns
0 on success
< 0 value on error

Definition at line 148 of file mtd.h.

int(* mtd_desc::read) (mtd_dev_t *dev, void *buff, uint32_t addr, uint32_t size)

No alignment is required on addr and size.

Parameters
[in]devPointer to the selected driver
[out]buffPointer to the data buffer to store read data
[in]addrStarting address
[in]sizeNumber of bytes
Returns
the number of bytes actually read
< 0 value on error

Definition at line 99 of file mtd.h.

int(* mtd_desc::write) (mtd_dev_t *dev, const void *buff, uint32_t addr, uint32_t size)

addr + size must be inside a page boundary. addr can be anywhere but the buffer cannot overlap two pages.

Parameters
[in]devPointer to the selected driver
[in]buffPointer to the data to be written
[in]addrStarting address
[in]sizeNumber of bytes
Returns
the number of bytes actually written
< 0 value on error

Definition at line 118 of file mtd.h.


The documentation for this struct was generated from the following file: