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 (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 main (void)


Define Documentation

#define ISPMOSI_PORT   PORTE

Log
isp2.c,v
Revision 1.1 2003/11/03 15:51:31 haraldkipp First check in

Definition at line 73 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPMOSI_DDR   DDRE

Definition at line 74 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPMOSI_BIT   0

Definition at line 75 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPMISO_PORT   PORTE

Definition at line 77 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPMISO_DDR   DDRE

Definition at line 78 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPMISO_PIN   PINE

Definition at line 79 of file isp2.c.

#define ISPMISO_BIT   1

Definition at line 80 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPSCK_PORT   PORTB

Definition at line 82 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPSCK_DDR   DDRB

Definition at line 83 of file isp2.c.

Referenced by SpiFlashEnable().

#define ISPSCK_BIT   1

Definition at line 84 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 114 of file isp2.c.

Referenced by main().

void SpiFlashId ( u_char id  ) 

Read SPI device ID.

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

Definition at line 158 of file isp2.c.

Referenced by main().

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.

Definition at line 183 of file isp2.c.

References NutDelay().

Referenced by SpiFlashWriteWord().

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.

Definition at line 228 of file isp2.c.

References SpiFlashWriteByte().

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

Referenced by main().

int main ( void   ) 


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/