2 \author Travis Goodspeed
3 \brief Command codes and buffers.
13 #define u8 unsigned char
14 #define u16 unsigned int
15 #define u32 unsigned long
19 //256 bytes, plus overhead
20 //For chips with very little RAM.
21 #define CMDDATALEN 0x104
22 //#warning Very little RAM.
27 #define CMDDATALEN 0x204
29 //#define CMDDATALEN 0x1004
32 //! Global data buffer.
33 extern unsigned char cmddata[CMDDATALEN];
34 extern unsigned char silent;
36 #define cmddataword ((unsigned int*) cmddata)
37 #define cmddatalong ((unsigned long*) cmddata)
38 #define memorybyte ((char*) 0)
39 //#define memoryword ((unsigned int*) 0))
59 #define SPI_JEDEC 0x80
60 #define SPI_ERASE 0x81
61 #define SPI_RW_EM260 0x82
68 #define WEAKDEF __attribute__ ((weak))
70 //Compiler doesn't support weak linking. :(
74 //! Handle a command. Defined in goodfet.c
75 void handle(uint8_t const app,
78 //! Transmit a header.
79 void txhead(unsigned char app,
83 void txdata(unsigned char app,
86 //! Transmit a string.
87 void txstring(unsigned char app,
92 unsigned long rxlong();
94 unsigned int rxword();
97 void txlong(unsigned long l);
99 void txword(unsigned int l);
101 //! Transmit a debug sequence of bytes
102 void debugbytes(const char *bytes, unsigned int len);
103 //! Transmit a debug string.
104 void debugstr(const char *str);
105 //! brief Debug a hex word string.
106 void debughex(u16 v);
107 //! brief Debug a hex long string.
108 void debughex32(u32 v);
110 //! Delay for a count.
111 void delay(unsigned int count);
113 void msdelay(unsigned int ms);
116 //! Prepare Timer B; call before using delay_ms or delay_us.
119 //! Delay for specified number of milliseconds (given 16 MHz clock)
120 void delay_ms( unsigned int ms );
122 //! Delay for specified number of microseconds (given 16 MHz clock)
123 void delay_us( unsigned int us );
125 //! Delay for specified number of clock ticks (16 MHz clock implies 62.5 ns per tick).
126 void delay_ticks( unsigned int num_ticks );