isp2.c File Reference

Go to the source code of this file.

Defines

#define ISPMOSI_PORT   PORTE
#define ISPMOSI_DDR   DDRE
#define ISPMOSI_BIT   0
#define ISPMISO_PORT   PORTE
#define ISPMISO_DDR   DDRE
#define ISPMISO_PIN   PINE
#define ISPMISO_BIT   1
#define ISPSCK_PORT   PORTB
#define ISPSCK_DDR   DDRB
#define ISPSCK_BIT   1

Functions

int SpiFlashEnable (void)
 Enable SPI device flash programming.
void SpiFlashId (uint8_t *id)
int SpiFlashWriteByte (uint8_t high, uint16_t addr, uint8_t data)
 Write byte to the target's flash memory.
int SpiFlashWriteWord (uint16_t addr, uint16_t data)
 Write word to the target's flash memory.
void SpiFlashErase (void)
 Erase target's flash memory.
int main (void)

Define Documentation

#define ISPMOSI_PORT   PORTE

$Log$ Revision 1.1 2003/11/03 15:51:31 haraldkipp First check in

Definition at line 74 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPMOSI_DDR   DDRE

Definition at line 75 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPMOSI_BIT   0

Definition at line 76 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPMISO_PORT   PORTE

Definition at line 78 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPMISO_DDR   DDRE

Definition at line 79 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPMISO_PIN   PINE

Definition at line 80 of file isp2.c.

#define ISPMISO_BIT   1

Definition at line 81 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPSCK_PORT   PORTB

Definition at line 83 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPSCK_DDR   DDRB

Definition at line 84 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPSCK_BIT   1

Definition at line 85 of file isp2.c.

Referenced by SpiFlashEnable().


Function Documentation

int SpiFlashEnable ( void   ) 

Enable SPI device flash programming.

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

Definition at line 115 of file isp2.c.

Referenced by main().

void SpiFlashId ( uint8_t id  ) 

Read SPI device ID.

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

Definition at line 159 of file isp2.c.

Referenced by main().

int SpiFlashWriteByte ( uint8_t  high,
uint16_t  addr,
uint8_t  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.

Definition at line 184 of file isp2.c.

Referenced by SpiFlashWriteWord().

int SpiFlashWriteWord ( uint16_t  addr,
uint16_t  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.

Definition at line 229 of file isp2.c.

Referenced by main().

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 245 of file isp2.c.

Referenced by main().

int main ( void   ) 

© 2000-2010 by contributors - visit http://www.ethernut.de/