SSBM Decomp
Loading...
Searching...
No Matches
msgcmd.h
Go to the documentation of this file.
1#ifndef _METROTRK_MSGCMD_H
2#define _METROTRK_MSGCMD_H
3
4#include <platform.h>
5
6#define DSFetch_s8(_p_) (*((s8*) _p_))
7#define DSFetch_s16(_p_) (*((s16*) _p_))
8#define DSFetch_s32(_p_) (*((s32*) _p_))
9#define DSFetch_s64(_p_) (*((s64*) _p_))
10
11#define DSFetch_u8(_p_) (*((u8*) _p_))
12#define DSFetch_u16(_p_) (*((u16*) _p_))
13#define DSFetch_u32(_p_) (*((u32*) _p_))
14#define DSFetch_u64(_p_) (*((u64*) _p_))
15
16#define DS_PROTOCOL_MAJOR_VERSION_1 1
17#define DS_PROTOCOL_MINOR_VERSION_10 10
18#define DS_PROTOCOL_MAJOR_VERSION DS_PROTOCOL_MAJOR_VERSION_1
19#define DS_PROTOCOL_MINOR_VERSION DS_PROTOCOL_MINOR_VERSION_10
20#define DS_KERNEL_MAJOR_VERSION 0
21#define DS_KERNEL_MINOR_VERSION 4
22
49
50#define DS_MIN_MSG_LENGTH 1
51#define DS_MIN_REPLY_LENGTH 2
52
53#define DS_MIN_MSG_VERSIONS_LENGTH DS_MIN_MSG_LENGTH
54#define DS_MIN_REPLY_VERSIONS_LENGTH (DS_MIN_REPLY_LENGTH + 4)
55
56/*
57** CPU Major types.
58*/
59
60#define DS_CPU_MAJOR_PPC 0x00
61#define DS_CPU_MAJOR_MIPS 0x01
62#define DS_CPU_MAJOR_NEC_V8XX 0x02
63#define DS_CPU_MAJOR_MOT_DSP 0x03
64#define DS_CPU_MAJOR_ARM 0x04
65#define DS_CPU_MAJOR_X86 0x05
66#define DS_CPU_MAJOR_MCORE 0x06
67#define DS_CPU_MAJOR_M68K 0x07 /* includes ColdFire */
68#define DS_CPU_MAJOR_SUPERH 0x08
69
70/*
71** MIPS CPU minor types.
72*/
73
74#define DS_CPU_MIPS_R3000 0x00
75#define DS_CPU_MIPS_R3081E 0x01
76
77#define DS_CPU_MIPS_VR4100 0x20
78#define DS_CPU_MIPS_VR4300 0x21
79#define DS_CPU_MIPS_VR4500 0x22
80#define DS_CPU_MIPS_VR4111 0x23
81#define DS_CPU_MIPS_TR4101 0x24
82
83#define DS_CPU_MIPS_VR5000 0x40
84
85/*
86** PowerPC CPU minor types.
87*/
88
89#define DS_CPU_PPC_403 0x00
90
91#define DS_CPU_PPC_5XX 0x20 /* used when not precisely known */
92#define DS_CPU_PPC_505 0x21
93#define DS_CPU_PPC_509 0x22
94#define DS_CPU_PPC_50X 0x27 /* used when not precisely known */
95#define DS_CPU_PPC_555 0x28
96
97#define DS_CPU_PPC_603E 0x40
98
99#define DS_CPU_PPC_7XX 0x50 /* used when not precisely known */
100#define DS_CPU_PPC_740 0x51
101#define DS_CPU_PPC_750 0x52
102#define DS_CPU_PPC_7400 0x53
103#define DS_CPU_PPC_7410 0x54
104
105#define DS_CPU_PPC_8260 0x61
106
107#define DS_CPU_PPC_8XX 0x80 /* used when not precisely known */
108#define DS_CPU_PPC_821 0x81
109#define DS_CPU_PPC_823 0x82
110#define DS_CPU_PPC_860 0x83
111
112/*
113** NEC V8xx CPU minor types.
114*/
115
116#define DS_CPU_NEC_V8XX_V810 0x00
117#define DS_CPU_NEC_V8XX_V821 0x01
118
119#define DS_CPU_NEC_V8XX_V830 0x10
120#define DS_CPU_NEC_V8XX_V831 0x11
121#define DS_CPU_NEC_V8XX_V832 0x12
122
123#define DS_CPU_NEC_V8XX_V850 0x20
124#define DS_CPU_NEC_V8XX_V853 0x21
125#define DS_CPU_NEC_V8XX_V850E 0x22
126#define DS_CPU_NEC_V8XX_V850_SA1 0x23
127
128/*
129** M68K/Coldfire CPU minor types.
130*/
131
132#define DS_CPU_M68K_68000 0x00
133#define DS_CPU_M68K_68020 0x02
134#define DS_CPU_M68K_68030 0x04
135#define DS_CPU_M68K_68040 0x06
136#define DS_CPU_M68K_68060 0x08
137
138#define DS_CPU_M68K_68302 0x20
139#define DS_CPU_M68K_68306 0x22
140#define DS_CPU_M68K_68307 0x24
141#define DS_CPU_M68K_68328 0x26
142#define DS_CPU_M68K_68EZ328 0x28
143#define DS_CPU_M68K_68VZ328 0x29
144#define DS_CPU_M68K_68340 0x2A
145#define DS_CPU_M68K_68360 0x2C
146
147#define DS_CPU_M68K_CF5102 0x80
148#define DS_CPU_M68K_CF5202 0x82
149#define DS_CPU_M68K_CF5204 0x84
150#define DS_CPU_M68K_CF5206 0x86
151#define DS_CPU_M68K_CF5206E 0x88
152#define DS_CPU_M68K_CF5307 0x8A
153
154/*
155** MCore CPU minor types.
156*/
157
158#define DS_CPU_MCORE_200 0x00
159#define DS_CPU_MCORE_340 0x20
160
161typedef u8 DSSupportMask[32]; /* 256 bits total */
162
163#define DS_MIN_MSG_SUPPORTMASK_LENGTH DS_MIN_MSG_LENGTH
164#define DS_MIN_REPLY_SUPPORTMASK_LENGTH \
165 (DS_MIN_REPLY_LENGTH + sizeof(DSSupportMask) + 1)
166
167#if DS_PROTOCOL == DS_PROTOCOL_RTOS
168#define DS_MIN_MSG_READMEMORY_LENGTH (DS_MIN_MSG_LENGTH + 15)
169#else
170#define DS_MIN_MSG_READMEMORY_LENGTH (DS_MIN_MSG_LENGTH + 7)
171#endif
172#define DS_MIN_REPLY_READMEMORY_LENGTH (DS_MIN_REPLY_LENGTH + 2)
173
174#if DS_PROTOCOL == DS_PROTOCOL_RTOS
175#define DS_MIN_MSG_WRITEMEMORY_LENGTH (DS_MIN_MSG_LENGTH + 15)
176#else
177#define DS_MIN_MSG_WRITEMEMORY_LENGTH (DS_MIN_MSG_LENGTH + 7)
178#endif
179#define DS_MIN_REPLY_WRITEMEMORY_LENGTH (DS_MIN_REPLY_LENGTH + 2)
180
181// Memory commands options
182#define DS_MSG_MEMORY_SEGMENTED 0x01 /* non-flat addr space */
183#define DS_MSG_MEMORY_EXTENDED 0x02 /* > 32-bit data addr */
184#define DS_MSG_MEMORY_PROTECTED 0x04 /* non-user memory */
185#define DS_MSG_MEMORY_USERVIEW 0x08 /* breakpoints are invisible */
186
187#define DS_MSG_MEMORY_SPACE_PROGRAM 0x00
188#define DS_MSG_MEMORY_SPACE_DATA 0x40
189#define DS_MSG_MEMORY_SPACE_IO 0x80
190
191#define TRK_MSG_HEADER_LENGTH DS_MSG_MEMORY_SPACE_DATA
192#define TRK_MSG_REPLY_HEADER_LENGTH (TRK_MSG_HEADER_LENGTH + DS_MIN_MSG_LENGTH)
193
194// Others
195
196#define DS_MSG_MEMORY_SPACE_MASK 0xC0
197
198#define DS_MAXREADWRITELENGTH 0x0800 /* 2K data portion */
199#define DS_MAXMESSAGESIZE (DS_MAXREADWRITELENGTH + 0x80)
200/* max size of all message including cmd hdr */
201#define MAXMESSAGESIZE DS_MAXMESSAGESIZE
202
203#define DS_MIN_MSG_FLUSHCACHE_LENGTH (DS_MIN_MSG_LENGTH + 9)
204#define DS_MIN_REPLY_FLUSHCACHE_LENGTH (DS_MIN_REPLY_LENGTH)
205
206#if DS_PROTOCOL == DS_PROTOCOL_RTOS
207#define DS_MIN_MSG_READREGISTERS_LENGTH (DS_MIN_MSG_LENGTH + 13)
208#else
209#define DS_MIN_MSG_READREGISTERS_LENGTH (DS_MIN_MSG_LENGTH + 5)
210#endif
211#define DS_MIN_REPLY_READREGISTERS_LENGTH DS_MIN_REPLY_LENGTH
212
213#if DS_PROTOCOL == DS_PROTOCOL_RTOS
214#define DS_MIN_MSG_WRITEREGISTERS_LENGTH (DS_MIN_MSG_LENGTH + 13)
215#else
216#define DS_MIN_MSG_WRITEREGISTERS_LENGTH (DS_MIN_MSG_LENGTH + 5)
217#endif
218#define DS_MIN_REPLY_WRITEREGISTERS_LENGTH DS_MIN_REPLY_LENGTH
219
220// Register commands options
221typedef enum {
222 kDSRegistersDefault = 0x0, /* Default register block */
223 kDSRegistersFP = 0x1, /* floating point registers */
224 kDSRegistersExtended1 = 0x2, /* Extended register set 1 */
225 kDSRegistersExtended2 = 0x3 /* Extended register set 2 */
227
228#if DS_PROTOCOL == DS_PROTOCOL_RTOS
229#define DS_MIN_MSG_STEP_COUNT_LENGTH (DS_MIN_MSG_LENGTH + 10)
230#define DS_MIN_MSG_STEP_RANGE_LENGTH (DS_MIN_MSG_LENGTH + 17)
231#else
232#define DS_MIN_MSG_STEP_COUNT_LENGTH (DS_MIN_MSG_LENGTH + 2)
233#define DS_MIN_MSG_STEP_RANGE_LENGTH (DS_MIN_MSG_LENGTH + 9)
234#endif
235#define DS_MIN_MSG_STEP_LENGTH (DS_MIN_MSG_STEP_COUNT_LENGTH)
236#define DS_MIN_REPLY_STEP_LENGTH DS_MIN_REPLY_LENGTH
237
238// Step command options
239typedef enum {
240 kDSStepIntoCount = 0x00, /* Exec count instructions & stop */
241 kDSStepIntoRange = 0x01, /* Exec until PC is out of specified range */
242 kDSStepOverCount = 0x10, /* Step over 1*count instructions & stop */
243 kDSStepOverRange = 0x11 /* Step over until PC is out of specified range */
245
246/*
247** These are the predefined file handles. Additional files may
248** be opened via the kDSOpenFile command. New file handles
249** returned by that command may be used in addition to the
250** ones defined here.
251*/
252
253typedef enum DSFileHandle {
254 kDSStdin = 0x00,
255 kDSStdout = 0x01,
256 kDSStderr = 0x02
258
259/*
260** The result of an I/O command can be any one of the following.
261*/
262
263typedef enum DSIOResult {
266 kDSIOEOF = 0x02
268
269// Reply errors
293
294#endif
DSMessageRegisterOptions
Definition msgcmd.h:221
@ kDSRegistersExtended2
Definition msgcmd.h:225
@ kDSRegistersExtended1
Definition msgcmd.h:224
@ kDSRegistersDefault
Definition msgcmd.h:222
@ kDSRegistersFP
Definition msgcmd.h:223
u8 DSSupportMask[32]
Definition msgcmd.h:161
DSMessageStepOptions
Definition msgcmd.h:239
@ kDSStepIntoCount
Definition msgcmd.h:240
@ kDSStepOverRange
Definition msgcmd.h:243
@ kDSStepOverCount
Definition msgcmd.h:242
@ kDSStepIntoRange
Definition msgcmd.h:241
DSIOResult
Definition msgcmd.h:263
@ kDSIOError
Definition msgcmd.h:265
@ kDSIONoError
Definition msgcmd.h:264
@ kDSIOEOF
Definition msgcmd.h:266
MessageCommandID
Definition msgcmd.h:23
@ kDSReadMemory
Definition msgcmd.h:31
@ kDSReplyNAK
Definition msgcmd.h:40
@ kDSPositionFile
Definition msgcmd.h:47
@ kDSPing
Definition msgcmd.h:24
@ kDSReplyACK
Definition msgcmd.h:39
@ kDSNotifyException
Definition msgcmd.h:42
@ kDSCloseFile
Definition msgcmd.h:46
@ kDSSupportMask
Definition msgcmd.h:29
@ kDSOverride
Definition msgcmd.h:30
@ kDSStop
Definition msgcmd.h:38
@ kDSConnect
Definition msgcmd.h:25
@ kDSVersions
Definition msgcmd.h:28
@ kDSContinue
Definition msgcmd.h:36
@ kDSReadFile
Definition msgcmd.h:44
@ kDSNotifyStopped
Definition msgcmd.h:41
@ kDSSetOption
Definition msgcmd.h:35
@ kDSWriteRegisters
Definition msgcmd.h:34
@ kDSWriteMemory
Definition msgcmd.h:32
@ kDSWriteFile
Definition msgcmd.h:43
@ kDSStep
Definition msgcmd.h:37
@ kDSDisconnect
Definition msgcmd.h:26
@ kDSOpenFile
Definition msgcmd.h:45
@ kDSReset
Definition msgcmd.h:27
@ kDSReadRegisters
Definition msgcmd.h:33
DSFileHandle
Definition msgcmd.h:253
@ kDSStderr
Definition msgcmd.h:256
@ kDSStdin
Definition msgcmd.h:254
@ kDSStdout
Definition msgcmd.h:255
DSReplyError
Definition msgcmd.h:270
@ kDSReplyCWDSError
Definition msgcmd.h:274
@ kDSReplyInvalidProcessId
Definition msgcmd.h:289
@ kDSReplyNoError
Definition msgcmd.h:271
@ kDSReplyOsError
Definition msgcmd.h:288
@ kDSReplyParameterError
Definition msgcmd.h:280
@ kDSReplyBreakpointsFull
Definition msgcmd.h:286
@ kDSReplyUnsupportedCommandError
Definition msgcmd.h:279
@ kDSReplyOverflow
Definition msgcmd.h:277
@ kDSReplyUnsupportedOptionError
Definition msgcmd.h:281
@ kDSReplyNotStopped
Definition msgcmd.h:285
@ kDSDebugSecurityError
Definition msgcmd.h:291
@ kDSReplyInvalidThreadId
Definition msgcmd.h:290
@ kDSReplyCWDSException
Definition msgcmd.h:284
@ kDSReplyBadFCS
Definition msgcmd.h:276
@ kDSReplyError
Definition msgcmd.h:272
@ kDSReplyInvalidMemoryRange
Definition msgcmd.h:282
@ kDSReplyBreakpointConflict
Definition msgcmd.h:287
@ kDSReplyPacketSizeError
Definition msgcmd.h:273
@ kDSReplyEscapeError
Definition msgcmd.h:275
@ kDSReplySequenceMissing
Definition msgcmd.h:278
@ kDSReplyInvalidRegisterRange
Definition msgcmd.h:283
unsigned char u8
An unsigned 8-bit integer.
Definition platform.h:20