2 \author Travis Goodspeed
3 \brief Command codes and buffers.
8 #define u8 unsigned char
9 #define u16 unsigned int
10 #define u32 unsigned long
14 //256 bytes, plus overhead
15 //For chips with very little RAM.
16 #define CMDDATALEN 0x104
17 //#warning Very little RAM.
22 #define CMDDATALEN 0x204
24 //#define CMDDATALEN 0x1004
27 //! Global data buffer.
28 extern unsigned char cmddata[CMDDATALEN];
29 extern unsigned char silent;
31 #define cmddataword ((unsigned int*) cmddata)
32 #define cmddatalong ((unsigned long*) cmddata)
33 #define memorybyte ((unsigned char*) 0)
34 #define memoryword ((unsigned int*) 0)
52 #define MONITOR_CHANGE_BAUD 0x80
53 #define MONITOR_RAM_PATTERN 0x90
54 #define MONITOR_RAM_DEPTH 0x91
56 #define MONITOR_DIR 0xA0
57 #define MONITOR_OUT 0xA1
58 #define MONITOR_IN 0xA2
60 #define MONITOR_SILENT 0xB0
62 #define MONITOR_READBUF 0xC0
63 #define MONITOR_WRITEBUF 0xC1
64 #define MONITOR_SIZEBUF 0xC2
70 #define SPI_JEDEC 0x80
71 #define SPI_ERASE 0x81
78 #define WEAKDEF __attribute__ ((weak))
80 //Compiler doesn't support weak linking. :(
84 //! Handle a plugin, weak-linked to error.
85 extern int pluginhandle(unsigned char app,
91 //! Handle a command. Defined in goodfet.c
92 void handle(unsigned char app,
95 //! Transmit a header.
96 void txhead(unsigned char app,
100 void txdata(unsigned char app,
103 //! Transmit a string.
104 void txstring(unsigned char app,
109 unsigned long rxlong();
111 unsigned int rxword();
114 void txlong(unsigned long l);
116 void txword(unsigned int l);
118 //! Transmit a debug sequence of bytes
119 void debugbytes(const char *bytes, unsigned int len);
120 //! Transmit a debug string.
121 void debugstr(const char *str);
122 //! brief Debug a hex word string.
123 void debughex(u16 v);
124 //! brief Debug a hex long string.
125 void debughex32(u32 v);
127 //! Delay for a count.
128 void delay(unsigned int count);
130 void msdelay(unsigned int ms);
133 //! Prepare Timer A; call before using delay_ms or delay_us.
136 //! Delay for specified number of milliseconds (given 16 MHz clock)
137 void delay_ms( unsigned int ms );
139 //! Delay for specified number of microseconds (given 16 MHz clock)
140 void delay_us( unsigned int us );
142 //! Delay for specified number of clock ticks (16 MHz clock implies 62.5 ns per tick).
143 void delay_ticks( unsigned int num_ticks );
146 void monitorhandle(unsigned char, unsigned char, unsigned long);
147 void spihandle(unsigned char, unsigned char, unsigned long);
148 void i2chandle(unsigned char, unsigned char, unsigned long) WEAKDEF;
149 void cchandle(unsigned char, unsigned char, unsigned long) WEAKDEF;
150 void jtaghandle(unsigned char, unsigned char, unsigned long);
151 void jtag430handle(unsigned char, unsigned char, unsigned long);
152 void ejtaghandle(unsigned char, unsigned char, unsigned long);
153 void jtagarm7tdmihandle(unsigned char app, unsigned char verb, unsigned long len);
155 void jtag430x2handle(unsigned char app, unsigned char verb, unsigned long len);
157 void avrhandle(unsigned char app,
160 int smartcardhandle(unsigned char app,
164 void pichandle( unsigned char app,