# MTD Erases

# struct erase_info {

## `struct mtd_info *mtd;`

A pointer to the MTD device on which this erase is scheduled.

## `size_t addr;`

Address (in bytes) of the block to be erased.

## `u_long len;`

Length of the erase to perform. This must always be equal to `mtd->erasesize`. I.e. you may only erase one erase block in a single erase request.

## `u_long time;`

## `u_long retries;`

## `u_int dev;`

## `u_int cell;`

These are used internally by the driver module.

## `void (*callback) (struct erase_info *self);`

This is a pointer to a function provided by the user module which will be called when the erase request is completed.

The `callback` function may be called from IRQ context or from a timer, and must not block or schedule.

## `u_long priv;`

Private data for use by the user module which schedules the erase.

## `u_char state;`

The current state of the erase request. Choose from:

    #define MTD_ERASE_PENDING       0x01
    #define MTD_ERASING             0x02
    #define MTD_ERASE_SUSPEND       0x04
    #define MTD_ERASE_DONE          0x08
    #define MTD_ERASE_FAILED        0x10

The driver module should set this to `MTD_ERASE_PENDING` when the erase request is queued, and will generally have set it to `MTD_ERASE_DONE` or `MTD_ERASE_FAILED` when calling the `callback` routine.

## `struct erase_info *next;`

The driver module may use this field for queuing requests.

# `};`

# Notes

The time, retries, dev and cell fields may disappear, and be replaced with a `void *driverpriv` field in which a driver module may keep whatever information it needs, or a pointer to it.

$Id: erase.html,v 1.1.1.1 2003/11/25 22:15:12 jharrell Exp $