AVR client connecting and reading ID correctly!
[goodfet] / firmware / include / chipcon.h
1 /*! \file chipcon.h
2   \author Travis Goodspeed
3   \brief Chipcon application functions.
4 */
5
6
7 //! Erase a chipcon chip.
8 void cc_chip_erase();
9 //! Write the configuration byte.
10 void cc_wr_config(unsigned char config);
11 //! Read the configuration byte.
12 unsigned char cc_rd_config();
13 //! Read the status register.
14 unsigned char cc_read_status();
15 //! Read the CHIP ID bytes.
16 unsigned short cc_get_chip_id();
17 //! Get the PC
18 unsigned short cc_get_pc();
19 //! Set a hardware breakpoint.
20 void cc_set_hw_brkpnt(unsigned short);
21 //! Debug an instruction, for remote use.
22 void cc_debug_instr(unsigned char);
23 //!Read a byte of code memory.
24 unsigned char cc_peekcodebyte(unsigned long adr);
25 //!Read a byte of data memory.
26 unsigned char cc_peekdatabyte(unsigned int adr);
27 //! Set a byte of data memory.
28 unsigned char cc_pokedatabyte(unsigned int adr,
29                               unsigned char val);
30 //! Debug an instruction, for local use.
31 unsigned char cc_debug(unsigned char len,
32                        unsigned char a,
33                        unsigned char b,
34                        unsigned char c);
35
36 //! Halt the CPU.
37 void cc_halt();
38 //! Resume the CPU.
39 void cc_resume();
40 //! Step an instruction
41 void cc_step_instr();
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