BeRTOS
Data Structures | Functions
mt29f.h File Reference

Micron MT29F serial NAND driver. More...

#include "cfg/cfg_mt29f.h"
#include <cfg/macros.h>

Go to the source code of this file.

Data Structures

struct  Mt29f
 MT29F context. More...

Defines

Error codes.
#define MT29F_ERR_ERASE   BV(1)
 Error erasing a block.
#define MT29F_ERR_WRITE   BV(2)
 Error writing a page.
#define MT29F_ERR_RD_TMOUT   BV(2)
 Read timeout.
#define MT29F_ERR_WR_TMOUT   BV(2)
 Write timeout.

Functions

bool mt29f_getDevId (Mt29f *chip, uint8_t dev_id[5])
 Read Device ID and configuration codes.
int mt29f_blockErase (Mt29f *chip, uint32_t blk)
 Erase the whole block containing given page.

Detailed Description

Micron MT29F serial NAND driver.

This module allows read/write access to Micron MT29F serial NANDs. It is a block device, so it must be accessed using the KBlock interface functions (see kblock.h).

Once you have opened the flash for writing, you may want to use kblock_trim() to avoid overwriting data on other flash banks.

Example usage:

 Mt29f chip;
 mt29f_init(&chip);
 // enable access only on desired blocks
 // start block = 50, num blocks = 20
 kblock_trim(&chip.blk, 50, 20);
 // ...
 // now write to the flash
 // block number is automatically converted
 kblock_write(&chip.blk, 0, buf, 0, 128);
Author:
Stefano Fedrigo <aleph@develer.com>

Definition in file mt29f.h.