| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
BOARD: Driver for K9F1G
BOARD: Board specific NAND Flash drivers

## Detailed Description

Various functions for reading and writing to the K9F1G NAND FLASH

## Macros
#define | COLUMN_ADDR(block, page) (block * K9F1G_PAGES_PER_BLOCK + page)

## Functions
void | lpc_nandflash_init (void)
| Initialize flash.
void | lpc_nandflash_DeInit (void)
| De-initialize flash.
const lpc_nandflash_size_t * | lpc_nandflash_get_size (void)
| Return the flash size.
void | lpc_nandflash_get_id (uint8_t *pData)
| Read manufacturer ID and device ID.
uint8_t | lpc_nandflash_read_status (void)
| Read status.
void | lpc_nandflash_erase_block (uint32_t block)
| Erase a block.
uint32_t | lpc_nandflash_write_page (uint32_t block, uint32_t page, uint8_t *data, uint32_t size)
| Write a page to NAND FLASH.
void | lpc_nandflash_read_start (uint32_t block, uint32_t page, uint32_t ofs)
| Start reading data from NAND FLASH.
void | lpc_nandflash_read_data (uint8_t *data, uint32_t size)
| Read data from NAND FLASH.

## Variables
static const lpc_nandflash_size_t | nandSize

## Macro Definition Documentation

#define COLUMN_ADDR | ( |  | block,
|  |  | page
| ) |  | (block * K9F1G_PAGES_PER_BLOCK + page)

Definition at line 45 of file lpc_nandflash_k9f1g.c.

## Function Documentation

void lpc_nandflash_DeInit | ( | void |  | ) |

De-initialize flash.

Returns
  Nothing

Definition at line 68 of file lpc_nandflash_k9f1g.c.

void lpc_nandflash_erase_block | ( | uint32_t | block | ) |

Erase a block.

Parameters

  block | : block address

Returns
  Nothing

Note
  After returning from this function, read the status to get the result.

Definition at line 115 of file lpc_nandflash_k9f1g.c.

void lpc_nandflash_get_id | ( | uint8_t * | pData | ) |

Read manufacturer ID and device ID.

Parameters

  pData | pointer to buffer to read

Returns
  Nothing

Definition at line 78 of file lpc_nandflash_k9f1g.c.

const lpc_nandflash_size_t* lpc_nandflash_get_size | ( | void |  | ) |

Return the flash size.

Returns
  NAND FLASH information

Definition at line 72 of file lpc_nandflash_k9f1g.c.

void lpc_nandflash_init | ( | void |  | ) |

Initialize flash.

Returns
  Nothing

Definition at line 64 of file lpc_nandflash_k9f1g.c.

void lpc_nandflash_read_data | ( | uint8_t * | data,
|  | uint32_t | size
| ) |  |

Read data from NAND FLASH.

Parameters

  data | : pointer to buffer to read
  size | : the number of read bytes

Returns
  Nothing

Definition at line 187 of file lpc_nandflash_k9f1g.c.

void lpc_nandflash_read_start | ( | uint32_t | block,
|  | uint32_t | page,
|  | uint32_t | ofs
| ) |  |

Start reading data from NAND FLASH.

Parameters

  block | : block index
  page | : page index
  ofs | : offset in page

Returns
  Nothing

Definition at line 165 of file lpc_nandflash_k9f1g.c.

uint8_t lpc_nandflash_read_status | ( | void |  | ) |

Read status.

Returns
  status byte (or-ed bit value of NANDFLASH_STATUS_*)

Definition at line 98 of file lpc_nandflash_k9f1g.c.

uint32_t lpc_nandflash_write_page | ( | uint32_t | block,
|  | uint32_t | page,
|  | uint8_t * | data,
|  | uint32_t | size
| ) |  |

Write a page to NAND FLASH.

Parameters

  block | : block index
  page | : page index
  data | : pointer to buffer to write
  size | : the number of written bytes

Returns
  The number of written bytes

Note
  After returning from this function, read the status to get the result.

Definition at line 135 of file lpc_nandflash_k9f1g.c.

## Variable Documentation

const lpc_nandflash_size_t nandSize
| static

Initial value:
= {
K9F1G_PAGE_SIZE, K9F1G_SPARE_SIZE, K9F1G_PAGES_PER_BLOCK, K9F1G_BLOCK_COUNT
}

Definition at line 48 of file lpc_nandflash_k9f1g.c.