/
CCDebugger.h
121 lines (92 loc) · 1.96 KB
/
CCDebugger.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef CCDEBUGGER_H
#define CCDEBUGGER_H
#define CC_ERROR_NONE 0
#define CC_ERROR_NOT_ACTIVE 1
#define CC_ERROR_NOT_DEBUGGING 2
#define CC_ERROR_NOT_WIRED 3
int cc_init( int pinRST, int pinDC, int pinDD );
void cc_delay( unsigned char d );
uint8_t cc_error();
////////////////////////////
// High-Level interaction
////////////////////////////
void cc_setActive( uint8_t on );
/**
* Enter debug mode
*/
uint8_t cc_enter();
/**
* Exit from debug mode
*/
uint8_t cc_exit();
/**
* Execute a CPU instructuion
*/
uint8_t cc_exec( uint8_t oc0 );
uint8_t cc_execi( uint8_t oc0, unsigned short c0 );
uint8_t cc_exec2( uint8_t oc0, uint8_t oc1 );
uint8_t cc_exec3( uint8_t oc0, uint8_t oc1, uint8_t oc2 );
/**
* Return chip ID
*/
unsigned short cc_getChipID();
/**
* Return PC
*/
unsigned short cc_getPC();
/**
* Return debug status
*/
uint8_t cc_getStatus();
/**
* resume program exec
*/
uint8_t cc_resume();
/**
* halt program exec
*/
uint8_t cc_halt();
/**
* Step a single instruction
*/
uint8_t cc_step();
/**
* Get debug configuration
*/
uint8_t cc_getConfig();
/**
* Set debug configuration
*/
uint8_t cc_setConfig( uint8_t config );
/**
* Massive erasure on the chip
*/
uint8_t cc_chipErase();
////////////////////////////
// Low-level interaction
////////////////////////////
/**
* Write to the debugger
*/
uint8_t cc_write( uint8_t data );
/**
* Wait until we are ready to read & Switch to read mode
*/
uint8_t cc_switchRead( uint8_t maxWaitCycles );
/**
* Switch to write mode
*/
uint8_t cc_switchWrite();
/**
* Read from the debugger
*/
uint8_t cc_read();
/**
* Update the debug instruction table
*/
uint8_t cc_updateInstructionTable( uint8_t newTable[16] );
/**
* Get the instruction table version
*/
uint8_t cc_getInstructionTableVersion();
#endif