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))
51 #define LIMIT 0x7B /* limit reached */
52 #define EXIST 0x7C /* already or doesnt exist */
53 #define NMEM 0x7D /* OOM */
62 #define SPI_JEDEC 0x80
63 #define SPI_ERASE 0x81
64 #define SPI_RW_EM260 0x82
71 #define WEAKDEF __attribute__ ((weak))
73 //Compiler doesn't support weak linking. :(
77 //! Handle a command. Defined in goodfet.c
78 void handle(uint8_t const app,
81 //! Transmit a header.
82 void txhead(unsigned char app,
86 void txdata(unsigned char app,
89 //! Transmit a string.
90 void txstring(unsigned char app,
95 unsigned long rxlong();
97 unsigned int rxword();
100 void txlong(unsigned long l);
102 void txword(unsigned int l);
104 //! Transmit a debug sequence of bytes
105 void debugbytes(const char *bytes, unsigned int len);
106 //! Transmit a debug string.
107 void debugstr(const char *str);
108 //! brief Debug a hex word string.
109 void debughex(u16 v);
110 //! brief Debug a hex long string.
111 void debughex32(u32 v);
113 //! Delay for a count.
114 void delay(unsigned int count);
116 void msdelay(unsigned int ms);
119 //! Prepare Timer B; call before using delay_ms or delay_us.
122 //! Delay for specified number of milliseconds (given 16 MHz clock)
123 void delay_ms( unsigned int ms );
125 //! Delay for specified number of microseconds (given 16 MHz clock)
126 void delay_us( unsigned int us );
128 //! Delay for specified number of clock ticks (16 MHz clock implies 62.5 ns per tick).
129 void delay_ticks( unsigned int num_ticks );