Removed deprecated MSP430 flash test.
[goodfet] / firmware / include / command.h
1 /*! \file command.h
2   \author Travis Goodspeed
3   \brief Command codes and buffers.
4 */
5
6 //! Global data buffer.
7 extern unsigned char cmddata[0x100];
8 extern unsigned char silent;
9
10 #define cmddataword ((unsigned int*) cmddata)
11 #define cmddatalong ((unsigned long*) cmddata)
12 #define memorybyte ((unsigned char*) 0)
13 #define memoryword ((unsigned int*) 0)
14
15 // Global Commands
16 #define READ  0x00
17 #define WRITE 0x01
18 #define PEEK  0x02
19 #define POKE  0x03
20 #define SETUP 0x10
21 #define START 0x20
22 #define STOP  0x21
23 #define NOK   0x7E
24 #define OK    0x7F
25
26 #define DEBUGSTR 0xFF
27
28 // Monitor Commands
29 #define MONITOR_CHANGE_BAUD 0x80
30 #define MONITOR_RAM_PATTERN 0x90
31 #define MONITOR_RAM_DEPTH 0x91
32
33 #define MONITOR_DIR 0xA0
34 #define MONITOR_OUT 0xA1
35 #define MONITOR_IN  0xA2
36
37 #define MONITOR_SILENT 0xB0
38
39 #define MONITOR_READBUF 0xC0
40 #define MONITOR_WRITEBUF 0xC1
41 #define MONITOR_SIZEBUF 0xC2
42
43
44 //CHIPCON commands
45 #define CC_CHIP_ERASE 0x80
46 #define CC_WR_CONFIG 0x81
47 #define CC_RD_CONFIG 0x82
48 #define CC_GET_PC 0x83
49 #define CC_READ_STATUS 0x84
50 #define CC_SET_HW_BRKPNT 0x85
51 #define CC_HALT 0x86
52 #define CC_RESUME 0x87
53 #define CC_DEBUG_INSTR 0x88
54 #define CC_STEP_INSTR 0x89
55 #define CC_STEP_REPLACE 0x8a
56 #define CC_GET_CHIP_ID 0x8b
57 //CHIPCON macros
58 #define CC_READ_CODE_MEMORY 0x90
59 #define CC_READ_XDATA_MEMORY 0x91
60 #define CC_WRITE_XDATA_MEMORY 0x92
61 #define CC_SET_PC 0x93
62 #define CC_CLOCK_INIT 0x94
63 #define CC_WRITE_FLASH_PAGE 0x95
64 #define CC_READ_FLASH_PAGE 0x96
65 #define CC_MASS_ERASE_FLASH 0x97
66 #define CC_PROGRAM_FLASH 0x98
67
68 //JTAG commands
69 #define JTAG_IR_SHIFT 0x80
70 #define JTAG_DR_SHIFT 0x81
71 #define JTAG_DR_SHIFT20 0x91
72
73 //SPI commands
74 #define SPI_JEDEC 0x80
75 #define SPI_ERASE 0x81
76
77 //OCT commands
78 #define OCT_CMP 0x90
79 #define OCT_RES 0x91
80
81 //JTAG430 commands
82 #define JTAG430_HALTCPU 0xA0
83 #define JTAG430_RELEASECPU 0xA1
84 #define JTAG430_SETINSTRFETCH 0xC1
85 #define JTAG430_SETPC 0xC2
86 #define JTAG430_WRITEMEM 0xE0
87 #define JTAG430_WRITEFLASH 0xE1
88 #define JTAG430_READMEM 0xE2
89 #define JTAG430_ERASEFLASH 0xE3
90 #define JTAG430_ERASECHECK 0xE4
91 #define JTAG430_VERIFYMEM 0xE5
92 #define JTAG430_BLOWFUSE 0xE6
93 #define JTAG430_ISFUSEBLOWN 0xE7
94 #define JTAG430_COREIP_ID 0xF0
95 #define JTAG430_DEVICE_ID 0xF1
96
97 //! Handle a command.  Defined in goodfet.c
98 void handle(unsigned char app,
99             unsigned char verb,
100             unsigned  char len);
101
102 //! Transmit data.
103 void txdata(unsigned char app,
104             unsigned char verb,
105             unsigned char len);
106 //! Transmit a string.
107 void txstring(unsigned char app,
108               unsigned char verb,
109               const char *str);
110 //! Transmit a debug string.
111 void debugstr(const char *str);
112
113 //! Delay for a count.
114 void delay(unsigned int count);
115 //! MSDelay
116 void msdelay(unsigned int ms);
117
118
119 void monitorhandle(unsigned char, unsigned char, unsigned char);
120 void spihandle(unsigned char, unsigned char, unsigned char);
121 void i2chandle(unsigned char, unsigned char, unsigned char);
122 void cchandle(unsigned char, unsigned char, unsigned char);
123 void jtaghandle(unsigned char, unsigned char, unsigned char);
124 void jtag430handle(unsigned char, unsigned char, unsigned char);
125 void jtag430x2handle(unsigned char app, unsigned char verb,
126                      unsigned char len);
127