Loading...
Searching...
No Matches

MTD driver interface. More...

Detailed Description

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.

Definition at line 200 of file mtd.h.

#include <mtd.h>

Data Fields

int(* init )(mtd_dev_t *dev)
 Initialize Memory Technology Device (MTD)
 
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(* 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.
 
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)
 
uint8_t flags
 Properties of the MTD driver.
 

Field Documentation

◆ erase

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.

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

Definition at line 288 of file mtd.h.

◆ erase_sector

int(* mtd_desc::erase_sector) (mtd_dev_t *dev, uint32_t sector, uint32_t count)

Erase sector(s) of the Memory Technology Device (MTD)

Parameters
[in]devPointer to the selected driver
[in]sectorthe first sector number to erase
[in]countNumber of sectors to erase
Return values
0on success
<0value on error

Definition at line 303 of file mtd.h.

◆ flags

uint8_t mtd_desc::flags

Properties of the MTD driver.

Definition at line 321 of file mtd.h.

◆ init

int(* mtd_desc::init) (mtd_dev_t *dev)

Initialize Memory Technology Device (MTD)

Parameters
[in]devPointer to the selected driver
Return values
0on success
<0value on error

Definition at line 209 of file mtd.h.

◆ power

int(* mtd_desc::power) (mtd_dev_t *dev, enum mtd_power_state power)

Control power of Memory Technology Device (MTD)

Parameters
[in]devPointer to the selected driver
[in]powerPower state to apply (from mtd_power_state)
Return values
0on success
<0value on error

Definition at line 316 of file mtd.h.

◆ read

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.

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

Definition at line 224 of file mtd.h.

◆ read_page

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

Parameters
[in]devPointer to the selected driver
[out]buffPointer to the data buffer to store read data
[in]pagePage number to start reading from
[in]offsetByte offset from the start of the page
[in]sizeNumber of bytes
Return values
nnumber of bytes read on success
<0value on error

Definition at line 244 of file mtd.h.

◆ write_page

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

A write may write fewer bytes than requested. A driver that maps to a memory with a page-wise write granularity writes at most up to the end of the page. The number of bytes written is returned, so that the caller can continue with the next page.

Parameters
[in]devPointer to the selected driver
[out]buffPointer to the data to be written
[in]pagePage number to start writing to
[in]offsetByte offset from the start of the page
[in]sizeNumber of bytes
Return values
nbytes written on success
<0value on error

Definition at line 270 of file mtd.h.


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