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