-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
CCDebugger.h
137 lines (106 loc) · 2.35 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#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
// defaŭltaj valoroj por pingloj
// por restarigi al pinglo 35, DC al pinglo 36, DD al pinglo 38
#define PIN_RST 24
#define PIN_DC 27
#define PIN_DD 28
// alternativaj valoroj por pingloj
// por restarigi al pinglo 3, DC al pinglo 11, DD al pinglo 13
// Utila por pi 1.
//#define PIN_RST 8
//#define PIN_DC 0
//#define PIN_DD 2
int cc_init( int pinRST, int pinDC, int pinDD );
void cc_delay( unsigned int d );
void cc_setmult(int mult);
int cc_getmult();
uint8_t cc_error();
void cc_reset();
////////////////////////////
// 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