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
61 #define MONITOR_CONNECTED 0xB1
63 #define MONITOR_READBUF 0xC0
64 #define MONITOR_WRITEBUF 0xC1
65 #define MONITOR_SIZEBUF 0xC2
71 #define SPI_JEDEC 0x80
72 #define SPI_ERASE 0x81
79 #define WEAKDEF __attribute__ ((weak))
81 //Compiler doesn't support weak linking. :(
85 //! Handle a plugin, weak-linked to error.
86 extern int pluginhandle(unsigned char app,
92 //! Handle a command. Defined in goodfet.c
93 void handle(unsigned char app,
96 //! Transmit a header.
97 void txhead(unsigned char app,
101 void txdata(unsigned char app,
104 //! Transmit a string.
105 void txstring(unsigned char app,
110 unsigned long rxlong();
112 unsigned int rxword();
115 void txlong(unsigned long l);
117 void txword(unsigned int l);
119 //! Transmit a debug sequence of bytes
120 void debugbytes(const char *bytes, unsigned int len);
121 //! Transmit a debug string.
122 void debugstr(const char *str);
123 //! brief Debug a hex word string.
124 void debughex(u16 v);
125 //! brief Debug a hex long string.
126 void debughex32(u32 v);
128 //! Delay for a count.
129 void delay(unsigned int count);
131 void msdelay(unsigned int ms);
134 //! Prepare Timer A; call before using delay_ms or delay_us.
137 //! Delay for specified number of milliseconds (given 16 MHz clock)
138 void delay_ms( unsigned int ms );
140 //! Delay for specified number of microseconds (given 16 MHz clock)
141 void delay_us( unsigned int us );
143 //! Delay for specified number of clock ticks (16 MHz clock implies 62.5 ns per tick).
144 void delay_ticks( unsigned int num_ticks );
147 void monitorhandle(unsigned char, unsigned char, unsigned long);
148 void spihandle(unsigned char, unsigned char, unsigned long);
149 void i2chandle(unsigned char, unsigned char, unsigned long) WEAKDEF;
150 void cchandle(unsigned char, unsigned char, unsigned long) WEAKDEF;
151 void jtaghandle(unsigned char, unsigned char, unsigned long);
152 void jtag430handle(unsigned char, unsigned char, unsigned long);
153 void ejtaghandle(unsigned char, unsigned char, unsigned long);
154 WEAKDEF void jtagarm7tdmihandle(unsigned char app, unsigned char verb, unsigned long len);
156 void jtag430x2handle(unsigned char app, unsigned char verb, unsigned long len);
158 WEAKDEF void avrhandle(unsigned char app,
161 WEAKDEF int smartcardhandle(unsigned char app,
165 WEAKDEF void pichandle( unsigned char app,