Erase waits for competion to return.
[goodfet] / firmware / include / command.h
1 // Command handling functions.
2
3 //! Global data buffer.
4 extern unsigned char cmddata[256];
5 #define cmddataword ((unsigned int*) cmddata)
6 #define memorybyte ((unsigned char*) 0)
7 #define memoryword ((unsigned int*) 0)
8
9 // Global Commands
10 #define READ  0x00
11 #define WRITE 0x01
12 #define PEEK  0x02
13 #define POKE  0x03
14 #define SETUP 0x10
15 #define START 0x20
16 #define STOP  0x21
17 #define NOK   0x7E
18 #define OK    0x7F
19
20 // Monitor Commands
21 #define MONITOR_CHANGE_BAUD 0x80
22 #define MONITOR_RAM_PATTERN 0x90
23 #define MONITOR_RAM_DEPTH 0x91
24
25 //CHIPCON commands
26 #define CC_CHIP_ERASE 0x80
27 #define CC_WR_CONFIG 0x81
28 #define CC_RD_CONFIG 0x82
29 #define CC_GET_PC 0x83
30 #define CC_READ_STATUS 0x84
31 #define CC_SET_HW_BRKPNT 0x85
32 #define CC_HALT 0x86
33 #define CC_RESUME 0x87
34 #define CC_DEBUG_INSTR 0x88
35 #define CC_STEP_INSTR 0x89
36 #define CC_STEP_REPLACE 0x8a
37 #define CC_GET_CHIP_ID 0x8b
38 //CHIPCON macros
39 #define CC_READ_CODE_MEMORY 0x90
40 #define CC_READ_XDATA_MEMORY 0x91
41 #define CC_WRITE_XDATA_MEMORY 0x92
42 #define CC_SET_PC 0x93
43 #define CC_CLOCK_INIT 0x94
44 #define CC_WRITE_FLASH_PAGE 0x95
45 #define CC_READ_FLASH_PAGE 0x96
46 #define CC_MASS_ERASE_FLASH 0x97
47 #define CC_PROGRAM_FLASH 0x98
48
49 //JTAG commands
50 #define JTAG_IR_SHIFT 0x80
51 #define JTAG_DR_SHIFT 0x81
52 #define JTAG_DR_SHIFT20 0x91
53
54 //SPI commands
55 #define SPI_JEDEC 0x80
56 #define SPI_ERASE 0x81
57
58 //OCT commands
59 #define OCT_CMP 0x90
60
61 //JTAG430 commands
62 #define JTAG430_HALTCPU 0xA0
63 #define JTAG430_RELEASECPU 0xA1
64 #define JTAG430_SETINSTRFETCH 0xC1
65 #define JTAG430_SETPC 0xC2
66 #define JTAG430_WRITEMEM 0xE0
67 #define JTAG430_WRITEFLASH 0xE1
68 #define JTAG430_READMEM 0xE2
69 #define JTAG430_ERASEFLASH 0xE3
70 #define JTAG430_ERASECHECK 0xE4
71 #define JTAG430_VERIFYMEM 0xE5
72 #define JTAG430_BLOWFUSE 0xE6
73 #define JTAG430_ISFUSEBLOWN 0xE7
74
75 //! Handle a command.  Defined in goodfet.c
76 void handle(unsigned char app,
77             unsigned char verb,
78             unsigned  char len);
79
80 //! Transmit data.
81 void txdata(unsigned char app,
82             unsigned char verb,
83             unsigned char len);
84 //! Transmit a string.
85 void txstring(unsigned char app,
86               unsigned char verb,
87               const char *str);
88
89 //! Delay
90 void delay(unsigned int count);
91
92
93 void monitorhandle(unsigned char, unsigned char, unsigned char);
94 void spihandle(unsigned char, unsigned char, unsigned char);
95 void i2chandle(unsigned char, unsigned char, unsigned char);
96 void cchandle(unsigned char, unsigned char, unsigned char);
97 void jtaghandle(unsigned char, unsigned char, unsigned char);
98 void jtag430handle(unsigned char, unsigned char, unsigned char);