![]() |
When AVR CPUs are attached to the SPI, then the routines in this module can be used to write to the flash ROM of these devices.
These routines are poorly supported and may not work as expected.
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. |
int SpiFlashEnable | ( | void | ) |
Enable SPI device flash programming.
Definition at line 90 of file spiflash.c.
References BV, cbi, ISPMISO_BIT, ISPMISO_DDR, ISPMISO_PORT, ISPMOSI_BIT, ISPMOSI_DDR, ISPMOSI_PORT, ISPSCK_BIT, ISPSCK_DDR, ISPSCK_PORT, outp, and sbi.
void SpiFlashId | ( | u_char * | id | ) |
Read SPI device ID.
id | Three byte character array, which receives the CPU ID. |
Definition at line 165 of file spiflash.c.
Write byte to the target's flash memory.
The target must have been erased by a previous call to SpiFlashErase().
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. |
Definition at line 190 of file spiflash.c.
References NutDelay().
Write word to the target's flash memory.
addr | Word address to write to. | |
data | Word value to write. |
Definition at line 235 of file spiflash.c.
References SpiFlashWriteByte().
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).
Definition at line 251 of file spiflash.c.
References NutDelay().