Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

spiflash.h File Reference

SPI flash definitions. More...

#include <sys/device.h>

Go to the source code of this file.

Functions

int SpiFlashEnable (void)
 Enable SPI device flash programming.

void SpiFlashId (u_char *id)
int SpiFlashWriteByte (u_char high, u_short addr, u_char data)
 Write byte to the target's flash memory.

int SpiFlashWriteWord (u_short addr, u_short data)
 Write word to the target's flash memory.

void SpiFlashErase (void)
 Erase target's flash memory.


Detailed Description

SPI flash definitions.


Function Documentation

int SpiFlashEnable void   
 

Enable SPI device flash programming.

Returns:
0 if device could be located, -1 otherwise.

void SpiFlashErase void   
 

Erase target's flash memory.

Sets all bytes on the target's flash memory to 0xFF. In addtion all lock bits are set to 1 (unprogrammed).

void SpiFlashId u_char   id
 

Read SPI device ID.

Parameters:
id  Three byte character array, which receives the CPU ID.

int SpiFlashWriteByte u_char    high,
u_short    addr,
u_char    data
 

Write byte to the target's flash memory.

The target must have been erased by a previous call to SpiFlashErase().

Parameters:
high  Must be 0 to write the low byte or 8 to write the high byte.
addr  Word address to write to.
data  Byte value to write.
Returns:
0 on success, -1 otherwise.

int SpiFlashWriteWord u_short    addr,
u_short    data
 

Write word to the target's flash memory.

Parameters:
addr  Word address to write to.
data  Word value to write.
Returns:
0 on success, -1 otherwise.


Generated on Thu Jan 30 22:30:55 2003 for EduNet by doxygen1.2.18