Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
trk.h
Go to the documentation of this file.
1#ifndef __METROTRK_TRK_H__
2#define __METROTRK_TRK_H__
3
4#include "dolphin/types.h"
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
11// Hardware types.
17
18// DS Error returns.
42
43// Where to read/write.
44typedef enum {
49
50// IO returns.
51typedef enum {
56
57// Message command IDs
89
90// Register commands.
97
98// Step commands.
105
131
138
139typedef enum {
140 DSMSGMEMORY_Segmented = 0x01, /* non-flat addr space */
141 DSMSGMEMORY_Extended = 0x02, /* > 32-bit data addr */
142 DSMSGMEMORY_Protected = 0x04, /* non-user memory */
143 DSMSGMEMORY_Userview = 0x08, /* breakpoints are invisible */
148
157
162
167
168typedef int UARTError;
169
170typedef enum {
174 UART_BufferOverflow = 3, // specified buffer was too small
175 UART_NoData = 4, // no data available from polling
177
178typedef enum {
179 kBaudHWSet = -1, // use HW settings such as DIP switches
180 kBaud300 = 300, // valid baud rates
181 kBaud600 = 600,
182 kBaud1200 = 1200,
183 kBaud1800 = 1800,
184 kBaud2000 = 2000,
185 kBaud2400 = 2400,
186 kBaud3600 = 3600,
187 kBaud4800 = 4800,
188 kBaud7200 = 7200,
189 kBaud9600 = 9600,
190 kBaud19200 = 19200,
191 kBaud38400 = 38400,
192 kBaud57600 = 57600,
193 kBaud115200 = 115200,
194 kBaud230400 = 230400
196
198
199typedef int MessageBufferID;
200
201#define TRKMSGBUF_SIZE (0x800 + 0x80)
202
203typedef struct TRKBuffer {
204 /* 0x00 */ u32 _00;
205 /* 0x04 */ BOOL isInUse;
206 /* 0x08 */ u32 length;
207 /* 0x0C */ u32 position;
208 /* 0x10 */ u8 data[TRKMSGBUF_SIZE];
210
218
219typedef struct TRKState_PPC {
220 u32 GPR[32]; // 0x0
221 u32 LR; // 0x80
222 u32 CTR; // 0x84
223 u32 XER; // 0x88
224 u32 MSR; // 0x8c
225 u32 DAR; // 0x90
226 u32 DSISR; // 0x94
227 BOOL stopped; // 0x98
231
232typedef struct CommandReply {
233 u32 _00; // _00
234 union {
237 } commandID; // _04, use MessageCommandID enum
238 union {
239 u8 b;
241 } replyError; // _08, use DSReplyError enum - should be enum type? check size.
242 u32 _0C; // _0C
243 u8 _10[0x30]; // _10, unknown
245
251
253
254#define SPR_XER 1
255#define SPR_LR 8
256#define SPR_CTR 9
257#define SPR_DSISR 18
258#define SPR_DAR 19
259#define SPR_DEC 22
260#define SPR_SDR1 25
261#define SPR_SRR0 26
262#define SPR_SRR1 27
263#define SPR_SPRG0 272
264#define SPR_SPRG1 273
265#define SPR_SPRG2 274
266#define SPR_SPRG3 275
267#define SPR_EAR 282
268#define SPR_TBL 284
269#define SPR_TBU 285
270#define SPR_PVR 287
271#define SPR_IBAT0U 528
272#define SPR_IBAT0L 529
273#define SPR_IBAT1U 530
274#define SPR_IBAT1L 531
275#define SPR_IBAT2U 532
276#define SPR_IBAT2L 533
277#define SPR_IBAT3U 534
278#define SPR_IBAT3L 535
279#define SPR_IBAT4U 560
280#define SPR_IBAT4L 561
281#define SPR_IBAT5U 562
282#define SPR_IBAT5L 563
283#define SPR_IBAT6U 564
284#define SPR_IBAT6L 565
285#define SPR_IBAT7U 566
286#define SPR_IBAT7L 567
287#define SPR_DBAT0U 536
288#define SPR_DBAT0L 537
289#define SPR_DBAT1U 538
290#define SPR_DBAT1L 539
291#define SPR_DBAT2U 540
292#define SPR_DBAT2L 541
293#define SPR_DBAT3U 542
294#define SPR_DBAT3L 543
295#define SPR_DBAT4U 568
296#define SPR_DBAT4L 569
297#define SPR_DBAT5U 570
298#define SPR_DBAT5L 571
299#define SPR_DBAT6U 572
300#define SPR_DBAT6L 573
301#define SPR_DBAT7U 574
302#define SPR_DBAT7L 575
303#define SPR_GQR0 912
304#define SPR_GQR1 913
305#define SPR_GQR2 914
306#define SPR_GQR3 915
307#define SPR_GQR4 916
308#define SPR_GQR5 917
309#define SPR_GQR6 918
310#define SPR_GQR7 919
311#define SPR_HID2 920
312#define SPR_WPAR 921
313#define SPR_DMA_U 922
314#define SPR_DMA_L 923
315#define SPR_UMMCR0 936
316#define SPR_UPMC1 937
317#define SPR_UPMC2 938
318#define SPR_USIA 939
319#define SPR_UMMCR1 940
320#define SPR_UPMC3 941
321#define SPR_UPMC4 942
322#define SPR_USDA 943
323#define SPR_MMCR0 952
324#define SPR_PMC1 953
325#define SPR_PMC2 954
326#define SPR_SIA 955
327#define SPR_MMCR1 956
328#define SPR_PMC3 957
329#define SPR_PMC4 958
330#define SPR_SDA 959
331#define SPR_HID0 1008
332#define SPR_HID1 1009
333#define SPR_IABR 1010
334#define SPR_HID4 1011
335#define SPR_DABR 1013
336#define SPR_L2CR 1017
337#define SPR_ICTC 1019
338#define SPR_THRM1 1020
339#define SPR_THRM2 1021
340#define SPR_FPECR 1022
341
342// PPC exceptions
343// 0x000 is reserved
344#define PPC_SystemReset 0x100
345#define PPC_MachineCheck 0x200
346#define PPC_DataStorage 0x300
347#define PPC_InstructionStorage 0x400
348#define PPC_ExternalInterrupt 0x500
349#define PPC_Alignment 0x600
350#define PPC_Program 0x700
351#define PPC_FloatingPointUnavaiable 0x800
352#define PPC_Decrementer 0x900
353// 0xA00-0xB00 are reserved
354#define PPC_SystemCall 0xC00
355#define PPC_Trace 0xD00
356#define PPC_FloatingPointAssist 0xE00 // unimplemented in 750CL
357#define PPC_PerformanceMonitor 0xF00 // Dolphin/Broadway specific
358// 0x1000-0x1200 are unimplemented in 750CL
359#define PPC_InstructionAddressBreakpoint 0x1300 // Dolphin/Broadway specific
360// 0x1400-0x2F00 are reserved, but TRK uses some
361#define PPC_SystemManagementInterrupt 0x1400
362// 0x1500-0x1600 are unimplemented in 750CL
363#define PPC_ThermalManagementInterrupt 0x1700
364#define PPC_1800Exception 0x1800
365#define PPC_1900Exception 0x1900
366#define PPC_1A00Exception 0x1A00
367#define PPC_1B00Exception 0x1B00
368#define PPC_1C00Exception 0x1C00 // Data breakpoint?
369#define PPC_1D00Exception 0x1D00 // Instruction breakpoint?
370#define PPC_1E00Exception 0x1E00 // Peripheral breakpoint?
371#define PPC_1F00Exception 0x1F00 // Non maskable development port?
372#define PPC_2000Exception 0x2000
373
374#ifdef __cplusplus
375}
376#endif
377
378#endif /* __METROTRK_TRK_H__ */
T cLib_calcTimer(T *value)
Definition c_lib.h:79
Definition trk.h:232
u8 _10[0x30]
Definition trk.h:243
u8 b
Definition trk.h:235
union CommandReply::@16 replyError
u32 _0C
Definition trk.h:242
u32 _00
Definition trk.h:233
DSReplyError r
Definition trk.h:240
union CommandReply::@15 commandID
MessageCommandID m
Definition trk.h:236
Definition trk.h:246
u8 TBR
Definition trk.h:247
u8 DEC
Definition trk.h:248
u8 linker_padding[0x9 - 0x2]
Definition trk.h:249
Definition trk.h:203
BOOL isInUse
Definition trk.h:205
u32 length
Definition trk.h:206
u8 data[TRKMSGBUF_SIZE]
Definition trk.h:208
u32 position
Definition trk.h:207
u32 _00
Definition trk.h:204
Definition trk.h:211
MessageBufferID msgBufID
Definition trk.h:212
u8 fcsType
Definition trk.h:216
ReceiverState receiveState
Definition trk.h:214
BOOL isEscape
Definition trk.h:215
TRKBuffer * buffer
Definition trk.h:213
Definition trk.h:219
u32 DAR
Definition trk.h:225
u8 * inputPendingPtr
Definition trk.h:229
BOOL inputActivated
Definition trk.h:228
u32 CTR
Definition trk.h:222
u32 DSISR
Definition trk.h:226
u32 LR
Definition trk.h:221
u32 GPR[32]
Definition trk.h:220
u32 MSR
Definition trk.h:224
u32 XER
Definition trk.h:223
BOOL stopped
Definition trk.h:227
DSError
Definition trk.h:19
@ DS_InvalidProcessID
Definition trk.h:36
@ DS_MessageBufferOverflow
Definition trk.h:27
@ DS_NoError
Definition trk.h:20
@ DS_MessageBufferReadError
Definition trk.h:28
@ DS_UnsupportedError
Definition trk.h:35
@ DS_InvalidMemory
Definition trk.h:32
@ DS_CWDSException
Definition trk.h:34
@ DS_InvalidRegister
Definition trk.h:33
@ DS_InvalidThreadID
Definition trk.h:37
@ DS_NoMessageBufferAvailable
Definition trk.h:26
@ DS_StepError
Definition trk.h:21
@ DS_DispatchError
Definition trk.h:30
@ DS_EventQueueFull
Definition trk.h:24
@ DS_ParameterError
Definition trk.h:22
@ DS_Error800
Definition trk.h:40
@ DS_OSError
Definition trk.h:38
@ DSMSGMEMORY_Extended
Definition trk.h:141
@ DSMSGMEMORY_Segmented
Definition trk.h:140
@ DSMSGMEMORY_Space_program
Definition trk.h:144
@ DSMSGMEMORY_Userview
Definition trk.h:143
@ DSMSGMEMORY_Space_data
Definition trk.h:145
@ DSMSGMEMORY_Protected
Definition trk.h:142
@ DSMSGMEMORY_Space_io
Definition trk.h:146
UARTErrorOptions
Definition trk.h:170
@ UART_UnknownBaudRate
Definition trk.h:172
@ UART_ConfigurationError
Definition trk.h:173
@ UART_BufferOverflow
Definition trk.h:174
@ UART_NoData
Definition trk.h:175
@ UART_NoError
Definition trk.h:171
DSMessageRegisterOptions
Definition trk.h:91
@ DSREG_Extended2
Definition trk.h:95
@ DSREG_Extended1
Definition trk.h:94
@ DSREG_Default
Definition trk.h:92
@ DSREG_FP
Definition trk.h:93
NubEventType
Definition trk.h:149
@ NUBEVENT_Null
Definition trk.h:150
@ NUBEVENT_Support
Definition trk.h:155
@ NUBEVENT_Shutdown
Definition trk.h:151
@ NUBEVENT_Exception
Definition trk.h:154
@ NUBEVENT_Breakpoint
Definition trk.h:153
@ NUBEVENT_Request
Definition trk.h:152
ReceiverState
Definition trk.h:132
@ DSRECV_InFrame
Definition trk.h:135
@ DSRECV_FrameOverflow
Definition trk.h:136
@ DSRECV_Wait
Definition trk.h:133
@ DSRECV_Found
Definition trk.h:134
DSMessageStepOptions
Definition trk.h:99
@ DSSTEP_IntoRange
Definition trk.h:101
@ DSSTEP_OverRange
Definition trk.h:103
@ DSSTEP_IntoCount
Definition trk.h:100
@ DSSTEP_OverCount
Definition trk.h:102
UARTBaudRate
Definition trk.h:178
@ kBaud38400
Definition trk.h:191
@ kBaud19200
Definition trk.h:190
@ kBaudHWSet
Definition trk.h:179
@ kBaud9600
Definition trk.h:189
@ kBaud115200
Definition trk.h:193
@ kBaud57600
Definition trk.h:192
@ kBaud2400
Definition trk.h:185
@ kBaud3600
Definition trk.h:186
@ kBaud1200
Definition trk.h:182
@ kBaud300
Definition trk.h:180
@ kBaud1800
Definition trk.h:183
@ kBaud600
Definition trk.h:181
@ kBaud7200
Definition trk.h:188
@ kBaud230400
Definition trk.h:194
@ kBaud2000
Definition trk.h:184
@ kBaud4800
Definition trk.h:187
MemoryAccessOptions
Definition trk.h:163
@ MEMACCESS_DebuggerMemory
Definition trk.h:165
@ MEMACCESS_UserMemory
Definition trk.h:164
int UARTError
Definition trk.h:168
void TRKSaveExtended1Block()
Definition mpc_7xx_603e.c:7
int MessageBufferID
Definition trk.h:199
ValidMemoryOptions
Definition trk.h:158
@ VALIDMEM_Writeable
Definition trk.h:160
@ VALIDMEM_Readable
Definition trk.h:159
DSIOResult
Definition trk.h:51
@ DS_IOError
Definition trk.h:53
@ DS_IOEOF
Definition trk.h:54
@ DS_IONoError
Definition trk.h:52
MessageCommandID
Definition trk.h:58
@ DSMSG_ReplyNAK
Definition trk.h:87
@ DSMSG_SetOption
Definition trk.h:71
@ DSMSG_ReadRegisters
Definition trk.h:69
@ DSMSG_WriteMemory
Definition trk.h:68
@ DSMSG_Versions
Definition trk.h:63
@ DSMSG_ReadFile
Definition trk.h:82
@ DSMSG_Step
Definition trk.h:73
@ DSMSG_Stop
Definition trk.h:74
@ DSMSG_ReadMemory
Definition trk.h:67
@ DSMSG_WriteRegisters
Definition trk.h:70
@ DSMSG_Continue
Definition trk.h:72
@ DSMSG_ReplyACK
Definition trk.h:76
@ DSMSG_OpenFile
Definition trk.h:83
@ DSMSG_WriteFile
Definition trk.h:81
@ DSMSG_Reset
Definition trk.h:62
@ DSMSG_NotifyStopped
Definition trk.h:78
@ DSMSG_Disconnect
Definition trk.h:61
@ DSMSG_SupportMask
Definition trk.h:64
@ DSMSG_Connect
Definition trk.h:60
@ DSMSG_Ping
Definition trk.h:59
@ DSMSG_PositionFile
Definition trk.h:85
@ DSMSG_NotifyException
Definition trk.h:79
@ DSMSG_CloseFile
Definition trk.h:84
@ DSMSG_Override
Definition trk.h:65
DSFileHandle
Definition trk.h:44
@ DS_Stdout
Definition trk.h:46
@ DS_Stderr
Definition trk.h:47
@ DS_Stdin
Definition trk.h:45
HardwareType
Definition trk.h:12
@ HARDWARE_BBA
Definition trk.h:15
@ HARDWARE_GDEV
Definition trk.h:14
@ HARDWARE_AMC_DDH
Definition trk.h:13
DSReplyError
Definition trk.h:106
@ DSREPLY_EscapeError
Definition trk.h:111
@ DSREPLY_CWDSError
Definition trk.h:110
@ DSREPLY_Error
Definition trk.h:108
@ DSREPLY_BreakpointConflict
Definition trk.h:124
@ DSREPLY_UnsupportedCommandError
Definition trk.h:116
@ DSREPLY_BadFCS
Definition trk.h:112
@ DSREPLY_ParameterError
Definition trk.h:117
@ DSREPLY_InvalidProcessID
Definition trk.h:127
@ DSREPLY_UnsupportedOptionError
Definition trk.h:118
@ DSREPLY_InvalidRegisterRange
Definition trk.h:120
@ DSREPLY_SequenceMissing
Definition trk.h:114
@ DSREPLY_InvalidMemoryRange
Definition trk.h:119
@ DSREPLY_NoError
Definition trk.h:107
@ DSREPLY_InvalidThreadID
Definition trk.h:128
@ DSREPLY_NotStopped
Definition trk.h:122
@ DSREPLY_Overflow
Definition trk.h:113
@ DSREPLY_DebugSecurityError
Definition trk.h:129
@ DSREPLY_CWDSException
Definition trk.h:121
@ DSREPLY_OSError
Definition trk.h:126
@ DSREPLY_BreakpointsFull
Definition trk.h:123
@ DSREPLY_PacketSizeError
Definition trk.h:109
int BOOL
Definition types.h:27
unsigned long u32
Definition types.h:10
unsigned char u8
Definition types.h:8