2c722c3343edc0fb83b3d0cfec2b04ae9cacafdd
[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
8 // Global Commands
9 #define READ  0x00
10 #define WRITE 0x01
11 #define PEEK  0x02
12 #define POKE  0x03
13 #define SETUP 0x10
14 #define START 0x20
15 #define STOP  0x21
16 #define NOK   0x7E
17 #define OK    0x7F
18
19 //CHIPCON commands
20 #define CC_CHIP_ERASE 0x80
21 #define CC_WR_CONFIG 0x81
22 #define CC_RD_CONFIG 0x82
23 #define CC_GET_PC 0x83
24 #define CC_READ_STATUS 0x84
25 #define CC_SET_HW_BRKPNT 0x85
26 #define CC_HALT 0x86
27 #define CC_RESUME 0x87
28 #define CC_DEBUG_INSTR 0x88
29 #define CC_STEP_INSTR 0x89
30 #define CC_STEP_REPLACE 0x8a
31 #define CC_GET_CHIP_ID 0x8b
32 //CHIPCON macros
33 #define CC_READ_CODE_MEMORY 0x90
34 #define CC_READ_XDATA_MEMORY 0x91
35 #define CC_WRITE_XDATA_MEMORY 0x92
36 #define CC_SET_PC 0x93
37 #define CC_CLOCK_INIT 0x94
38 #define CC_WRITE_FLASH_PAGE 0x95
39 #define CC_READ_FLASH_PAGE 0x96
40 #define CC_MASS_ERASE_FLASH 0x97
41 #define CC_PROGRAM_FLASH 0x98
42
43 //! Handle a command.  Defined in goodfet.c
44 void handle(unsigned char app,
45             unsigned char verb,
46             unsigned  char len);
47
48 //! Transmit data.
49 void txdata(unsigned char app,
50             unsigned char verb,
51             unsigned char len);
52
53 //! Delay
54 void delay(unsigned int count);