Commented out unnecessary print.
[goodfet] / firmware / include / command.h
1 /*! \file command.h
2   \author Travis Goodspeed
3   \brief Command codes and buffers.
4 */
5
6
7 //Types
8 #define u8 unsigned char
9 #define u16 unsigned int
10 #define u32 unsigned long
11
12
13 #ifdef msp430x2274
14 //256 bytes, plus overhead
15 //For chips with very little RAM.
16 #define CMDDATALEN 0x104
17 //#warning Very little RAM.
18 #endif
19
20 #ifndef CMDDATALEN
21 //512 bytes
22 #define CMDDATALEN 0x204
23 //4k
24 //#define CMDDATALEN 0x1004
25 #endif
26
27 //! Global data buffer.
28 extern unsigned char cmddata[CMDDATALEN];
29 extern unsigned char silent;
30
31 #define cmddataword ((unsigned int*) cmddata)
32 #define cmddatalong ((unsigned long*) cmddata)
33 #define memorybyte ((unsigned char*) 0)
34 #define memoryword ((unsigned int*) 0)
35
36 // Global Commands
37 #define READ  0x00
38 #define WRITE 0x01
39 #define PEEK  0x02
40 #define POKE  0x03
41 #define SETUP 0x10
42 #define START 0x20
43 #define STOP  0x21
44 #define CALL  0x30
45 #define EXEC  0x31
46 #define NOK   0x7E
47 #define OK    0x7F
48
49 #define DEBUGSTR 0xFF
50
51 // Monitor Commands
52 #define MONITOR_CHANGE_BAUD 0x80
53 #define MONITOR_RAM_PATTERN 0x90
54 #define MONITOR_RAM_DEPTH 0x91
55
56 #define MONITOR_DIR 0xA0
57 #define MONITOR_OUT 0xA1
58 #define MONITOR_IN  0xA2
59
60 #define MONITOR_SILENT 0xB0
61
62 #define MONITOR_READBUF 0xC0
63 #define MONITOR_WRITEBUF 0xC1
64 #define MONITOR_SIZEBUF 0xC2
65
66
67
68
69 //SPI commands
70 #define SPI_JEDEC 0x80
71 #define SPI_ERASE 0x81
72
73 //OCT commands
74 #define OCT_CMP 0x90
75 #define OCT_RES 0x91
76
77 #ifdef GCC
78 #define WEAKDEF __attribute__ ((weak))
79 #else
80 //Compiler doesn't support weak linking. :(
81 #define WEAKDEF
82 #endif
83
84 //! Handle a plugin, weak-linked to error.
85 extern int pluginhandle(unsigned char app,
86                         unsigned char verb,
87                         unsigned int len)
88   WEAKDEF;
89
90
91 //! Handle a command.  Defined in goodfet.c
92 void handle(unsigned char app,
93             unsigned char verb,
94             unsigned long len);
95 //! Transmit a header.
96 void txhead(unsigned char app,
97             unsigned char verb,
98             unsigned long len);
99 //! Transmit data.
100 void txdata(unsigned char app,
101             unsigned char verb,
102             unsigned long len);
103 //! Transmit a string.
104 void txstring(unsigned char app,
105               unsigned char verb,
106               const char *str);
107
108 //! Receive a long.
109 unsigned long rxlong();
110 //! Receive a word.
111 unsigned int rxword();
112
113 //! Transmit a long.
114 void txlong(unsigned long l);
115 //! Transmit a word.
116 void txword(unsigned int l);
117
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);
126
127 //! Delay for a count.
128 void delay(unsigned int count);
129 //! MSDelay
130 void msdelay(unsigned int ms);
131
132
133 //! Prepare Timer A; call before using delay_ms or delay_us.
134 void prep_timer();
135
136 //! Delay for specified number of milliseconds (given 16 MHz clock)
137 void delay_ms( unsigned int ms );
138
139 //! Delay for specified number of microseconds (given 16 MHz clock)
140 void delay_us( unsigned int us );
141
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 );
144
145
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 WEAKDEF void jtagarm7tdmihandle(unsigned char app, unsigned char verb, unsigned long len);
154
155 void jtag430x2handle(unsigned char app, unsigned char verb, unsigned long len);
156
157 WEAKDEF void avrhandle(unsigned char app,
158                        unsigned char verb,
159                        unsigned long len);  
160 WEAKDEF int smartcardhandle(unsigned char app,
161                             unsigned char verb,
162                             unsigned int len);
163
164 WEAKDEF void pichandle( unsigned char app,
165                         unsigned char verb,
166                         unsigned long len );