orcus
Macros | Functions
nand.h File Reference

NAND. More...

#include <stdint.h>

Macros

#define NAND_BLOCK_SIZE   512
 Number of bytes in a NAND block.
 

Functions

void nandErase (uint32_t startAdddr, int numberOfBlocks)
 Erase blocks on NAND. More...
 
void nandRead (uint32_t startAddr, int numberOfBlocks, void *dest)
 Read blocks from NAND. More...
 
void nandWrite (uint32_t startAddr, int numberOfBlocks, void *src)
 Write blocks to NAND. More...
 

Function Documentation

◆ nandErase()

void nandErase ( uint32_t  startAdddr,
int  numberOfBlocks 
)

Erase (set to 0xFF) 512B blocks on NAND. You must do this before writing due to the nature of NAND storage where a write operating can only unset bits.

Warning
You can brick a GP2X if you erase the first 512K of NAND, where the bootloader is stored.
Parameters
startAddrAddress to start erasing from (absolute, not in terms of blocks)
numberOfBlocksNumber of 512B blocks to erase
See also
nandWrite

◆ nandRead()

void nandRead ( uint32_t  startAddr,
int  numberOfBlocks,
void *  dest 
)

Read 512B blocks from NAND.

Parameters
startAddrAddress to start reading from (absolute, not in terms of blocks)
numberOfBlocksNumber of 512B blocks to read
destPointer to memory location to store data

◆ nandWrite()

void nandWrite ( uint32_t  startAddr,
int  numberOfBlocks,
void *  src 
)

Write 512B blocks to NAND. You must first erase the blocks.

Warning
You can brick a GP2X if you write to the first 512K of NAND, where the bootloader is stored.
Parameters
startAddrAddress to start start writing to (absolute, not in terms of blocks)
numberOfBlocksNumber of 512B blocks to write
srcPointer to memory location holding data to write
See also
nandWrite