0
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef __MSGCMD_H__
|
|
19 |
#define __MSGCMD_H__
|
|
20 |
|
|
21 |
|
|
22 |
#include "dstypes.h"
|
|
23 |
|
|
24 |
/*
|
|
25 |
** This is the maximum number of fields that will be encountered
|
|
26 |
** in a message, including the header field(s).
|
|
27 |
*/
|
|
28 |
#define DS_MAXMESSAGEFIELDCOUNT 15
|
|
29 |
|
|
30 |
/*
|
|
31 |
** Some items are declared here only for debug purposes (e.g.,
|
|
32 |
** string names for messages and fields). The following macros
|
|
33 |
** allow these items to be removed when debugging is disabled,
|
|
34 |
** eliminating otherwise wasted data space.
|
|
35 |
*/
|
|
36 |
#ifndef DEBUG_MSGCMD
|
|
37 |
#error "DEBUG_MSGCMD must be defined to either 0 or 1"
|
|
38 |
#endif
|
|
39 |
|
|
40 |
#if DEBUG_MSGCMD
|
|
41 |
#define __debug_only_parm( x ) x,
|
|
42 |
#define __debug_only_field( x ) x;
|
|
43 |
#else
|
|
44 |
#define __debug_only_parm( x )
|
|
45 |
#define __debug_only_field( x )
|
|
46 |
#endif
|
|
47 |
|
|
48 |
/*
|
|
49 |
** Descriptor for a message field.
|
|
50 |
*/
|
|
51 |
typedef struct TrkMsgFieldDesc
|
|
52 |
{
|
|
53 |
__debug_only_field( char *name ) /* Field name - for debugging */
|
|
54 |
int length; /* Length of the field in bytes */
|
|
55 |
} TrkMsgFieldDesc;
|
|
56 |
|
|
57 |
/*
|
|
58 |
** Use this macro to initialize TrkMsgFieldDesc variables.
|
|
59 |
*/
|
|
60 |
#define __trk_msg_field( name, length ) { __debug_only_parm( name ) length }
|
|
61 |
|
|
62 |
/*
|
|
63 |
** Descriptor for a message. Each message consists of a header followed
|
|
64 |
** by additional fields. Note that length, count, and farray should
|
|
65 |
** only account for the additional fields. For example: if the header
|
|
66 |
** has 1 field and the message has 3 additional fields (4 total), count
|
|
67 |
** should be 3.
|
|
68 |
**
|
|
69 |
** Only fixed-length numeric fields should be included in the descriptor.
|
|
70 |
** Variable-length portions of a message, such as memory data, are
|
|
71 |
** typically handled by code that is specific to the message type.
|
|
72 |
** They are outside the scope of the general-purpose routines which use
|
|
73 |
** these descriptors.
|
|
74 |
*/
|
|
75 |
//#if __MWERKS__
|
|
76 |
#if 0 /* SCM: MIPS compiler defect generates bad code in this case */
|
|
77 |
#define __TrkMsgFieldMax
|
|
78 |
#else
|
|
79 |
#define __TrkMsgFieldMax DS_MAXMESSAGEFIELDCOUNT
|
|
80 |
#endif /* #if __MWERKS__ */
|
|
81 |
|
|
82 |
typedef struct TrkMsgDesc
|
|
83 |
{
|
|
84 |
__debug_only_field( char *name ) /* Message name - for debugging */
|
|
85 |
const struct TrkMsgDesc *header; /* Descriptor for header/previous fragment */
|
|
86 |
int length; /* Length of the message in bytes */
|
|
87 |
unsigned int count; /* Number of fields in the message */
|
|
88 |
TrkMsgFieldDesc farray[__TrkMsgFieldMax];/* Descriptors for the message fields */
|
|
89 |
} TrkMsgDesc;
|
|
90 |
|
|
91 |
|
|
92 |
#ifdef TRK_MSGCMD_INIT
|
|
93 |
#define DESCDECLNC
|
|
94 |
#define DESCDECL const
|
|
95 |
#else
|
|
96 |
#define DESCDECLNC extern
|
|
97 |
#define DESCDECL extern const
|
|
98 |
#endif
|
|
99 |
|
|
100 |
/****************************************************************************/
|
|
101 |
/*
|
|
102 |
* Commands
|
|
103 |
*
|
|
104 |
* constant definitions of commands sent from host to target
|
|
105 |
*
|
|
106 |
* L1 = Level 1 CWDS (required)
|
|
107 |
* L2 = Level 2 CWDS (extended board-level debugger)
|
|
108 |
* L3 = Level 3 CWDS (OS-level debugger)
|
|
109 |
*/
|
|
110 |
/****************************************************************************/
|
|
111 |
|
|
112 |
#define DS_PROTOCOL_MIN 1 /* L1 */
|
|
113 |
#define DS_PROTOCOL_BOARD 2 /* L2 */
|
|
114 |
#define DS_PROTOCOL_RTOS 3 /* L3 */
|
|
115 |
|
|
116 |
#if (!defined( DS_PROTOCOL )) || (DS_PROTOCOL == 0)
|
|
117 |
#pragma error "Protocol level must be defined"
|
|
118 |
#endif
|
|
119 |
|
|
120 |
/*
|
|
121 |
** The current protocol version.
|
|
122 |
*/
|
|
123 |
|
|
124 |
#define DS_PROTOCOL_MAJOR_VERSION_3 3
|
|
125 |
#define DS_PROTOCOL_MINOR_VERSION_0 0
|
|
126 |
|
|
127 |
#define DS_PROTOCOL_MINOR_VERSION_1 1
|
|
128 |
#define DS_PROTOCOL_MINOR_VERSION_2 2
|
|
129 |
#define DS_PROTOCOL_MINOR_VERSION_3 3
|
|
130 |
#define DS_PROTOCOL_MINOR_VERSION_4 4
|
|
131 |
#define DS_PROTOCOL_MINOR_VERSION_5 5
|
|
132 |
#define DS_PROTOCOL_MINOR_VERSION_6 6
|
|
133 |
|
|
134 |
|
|
135 |
#define DS_PROTOCOL_MAJOR_VERSION DS_PROTOCOL_MAJOR_VERSION_3
|
|
136 |
#define DS_PROTOCOL_MINOR_VERSION DS_PROTOCOL_MINOR_VERSION_6
|
|
137 |
#define DS_PROTOCOL_VERSION_STRING version_str( DS_PROTOCOL_MAJOR_VERSION, \
|
|
138 |
DS_PROTOCOL_MINOR_VERSION )
|
|
139 |
|
|
140 |
/*
|
|
141 |
** Named constants for significant protocol revisions can be added
|
|
142 |
** here (the existing definitions should not be changed).
|
|
143 |
*/
|
|
144 |
|
|
145 |
/* Sequence IDs were introduced in version 2.0 */
|
|
146 |
#define DS_PROTOCOL_MAJOR_VERSION_SEQUENCEIDS 2
|
|
147 |
#define DS_PROTOCOL_MINOR_VERSION_SEQUENCEIDS 0
|
|
148 |
|
|
149 |
/* Multi-channel communication, ethernet, & other comm enhancements in 3.0 */
|
|
150 |
#define DS_PROTOCOL_MAJOR_VERSION_MULTICHANNEL 3
|
|
151 |
#define DS_PROTOCOL_MINOR_VERSION_MULTICHANNEL 0
|
|
152 |
|
|
153 |
|
|
154 |
#if __MWERKS__
|
|
155 |
#pragma mark MessageCommandID command value list
|
|
156 |
#endif /* __MWERKS__ */
|
|
157 |
|
|
158 |
/****************************************************************************/
|
|
159 |
/*
|
|
160 |
* MessageCommandID command value list
|
|
161 |
*/
|
|
162 |
/****************************************************************************/
|
|
163 |
|
|
164 |
typedef enum MessageCommandID
|
|
165 |
{
|
|
166 |
/* meta commands, minimum feature set */
|
|
167 |
|
|
168 |
kDSPing = 0x00, /* */
|
|
169 |
kDSConnect = 0x01, /* L1 L2 L3 */
|
|
170 |
kDSDisconnect = 0x02, /* L3 */
|
|
171 |
kDSReset = 0x03, /* L2 L3 */
|
|
172 |
kDSVersions = 0x04, /* L1 L2 L3 */
|
|
173 |
kDSSupportMask = 0x05, /* L1 L2 L3 */
|
|
174 |
kDSCPUType = 0x06, /* L2 L3 */
|
|
175 |
kDSConfigTransport = 0x07, /* L2 L3 */
|
|
176 |
kDSVersions2 = 0x08, /* L1 L2 L3 */
|
|
177 |
kDSHostVersions = 0x09,
|
|
178 |
|
|
179 |
/* state commands */
|
|
180 |
|
|
181 |
kDSReadMemory = 0x10, /* L1 L2 L3 */
|
|
182 |
kDSWriteMemory = 0x11, /* L1 L2 L3 */
|
|
183 |
kDSReadRegisters = 0x12, /* L1 L2 L3 */
|
|
184 |
kDSWriteRegisters = 0x13, /* L1 L2 L3 */
|
|
185 |
kDSFillMemory = 0x14, /* */
|
|
186 |
kDSCopyMemory = 0x15, /* */
|
|
187 |
kDSFlushCache = 0x16, /* */
|
|
188 |
|
|
189 |
/* execution commands */
|
|
190 |
|
|
191 |
kDSContinue = 0x18, /* L1 L2 L3 */
|
|
192 |
kDSStep = 0x19, /* L2 L3 */
|
|
193 |
kDSStop = 0x1a, /* L2 L3 */
|
|
194 |
kDSSetBreak = 0x1b, /* L2 L3 */
|
|
195 |
kDSClearBreak = 0x1c, /* L2 L3 */
|
|
196 |
kDSDownload = 0x1d, /* */
|
|
197 |
kDSModifyBreakThread = 0x1e, /* L3 */
|
|
198 |
/* Note: kDSSetWatch & kDSClearWatch are obsolete and have been removed */
|
|
199 |
|
|
200 |
/* host->target IO management */
|
|
201 |
kDSNotifyFileInput = 0x20, /* L2 L3 */
|
|
202 |
kDSBlockFileIo = 0x21, /* L2 L3 */
|
|
203 |
|
|
204 |
/* host->target OS commands */
|
|
205 |
|
|
206 |
kDSOSCreateItem = 0x40, /* L3 */
|
|
207 |
kDSOSDeleteItem = 0x41, /* L3 */
|
|
208 |
kDSOSReadInfo = 0x42, /* L3 */
|
|
209 |
kDSOSWriteInfo = 0x43, /* L3 */
|
|
210 |
|
|
211 |
kDSOSWriteFile = 0x48, /* L3 */
|
|
212 |
kDSOSReadFile = 0x49, /* L3 */
|
|
213 |
kDSOSOpenFile = 0x4a, /* L3 */
|
|
214 |
kDSOSCloseFile = 0x4b, /* L3 */
|
|
215 |
kDSOSPositionFile = 0x4c, /* L3 */
|
|
216 |
kDSOSInstallFile = 0x4d, /* L3 */
|
|
217 |
kDSOSInstallFile2 = 0x4e, /* L3 */
|
|
218 |
|
|
219 |
kDSOSPhoneSWVersion = 0x4f, /* L3 */
|
|
220 |
kDSOSPhoneName = 0x50, /* L3 */
|
|
221 |
kDSVersions3 = 0x51, /* L1 L2 L3 */
|
|
222 |
/*
|
|
223 |
* 0x70 - 0x7F reserved for host->target target-specific commands
|
|
224 |
*/
|
|
225 |
|
|
226 |
/* replies */
|
|
227 |
|
|
228 |
kDSReplyACK = 0x80, /* L1 L2 L3 */
|
|
229 |
kDSReplyNAK = 0xFF, /* L1 L2 L3 */
|
|
230 |
|
|
231 |
|
|
232 |
/*
|
|
233 |
* target->host notification
|
|
234 |
*/
|
|
235 |
|
|
236 |
kDSNotifyStopped = 0x90, /* L1 L2 L3 */
|
|
237 |
kDSNotifyException = 0x91, /* OBSOLETE! */
|
|
238 |
/* kDSNotifyException (0x91) is included for historical */
|
|
239 |
/* reasons only; DON'T IMPLEMENT IN NEW DEBUG NUB CODE! */
|
|
240 |
kDSNotifyInternalError = 0x92, /* */
|
|
241 |
//not used, remove? kDSNotifyBreak = 0x93, /* L2 L3 */
|
|
242 |
kDSNotifyStopped2 = 0x94, /* L3 */
|
|
243 |
|
|
244 |
/*
|
|
245 |
* target->host OS notification
|
|
246 |
*/
|
|
247 |
|
|
248 |
kDSOSNotifyCreated = 0xa0, /* L3 */
|
|
249 |
kDSOSNotifyDeleted = 0xa1, /* L3 */
|
|
250 |
kDSOSNotifyProcessorStarted = 0xa2, /* L3 */
|
|
251 |
kDSOSNotifyProcessorStandby = 0xa6, /* L3 */
|
|
252 |
kDSOSNotifyProcessorReset = 0xa7, /* L3 */
|
|
253 |
|
|
254 |
/*
|
|
255 |
* target->host support commands
|
|
256 |
*/
|
|
257 |
|
|
258 |
kDSWriteFile = 0xD0, /* L2 L3 */
|
|
259 |
kDSReadFile = 0xD1, /* L2 L3 */
|
|
260 |
kDSOpenFile = 0xD2, /* L2 L3 */
|
|
261 |
kDSCloseFile = 0xD3, /* L2 L3 */
|
|
262 |
kDSPositionFile = 0xD4 /* L2 L3 */
|
|
263 |
|
|
264 |
/*
|
|
265 |
* 0xE0 - 0xEF reserved for target->host target-specific commands
|
|
266 |
*/
|
|
267 |
} MessageCommandID;
|
|
268 |
|
|
269 |
/****************************************************************************/
|
|
270 |
/*
|
|
271 |
*
|
|
272 |
* Formatted data for messages sent between host and target.
|
|
273 |
*
|
|
274 |
* Primitive Scalar Types:
|
|
275 |
*
|
|
276 |
* Only use hard data types with fixed sizes:
|
|
277 |
* ui8 8-bit unsigned integer
|
|
278 |
* ui16 16-bit unsigned integer
|
|
279 |
* ui32 32-bit unsigned integer
|
|
280 |
* ui8 [] array of bytes
|
|
281 |
* char[] array of characters (C string)
|
|
282 |
* etc.
|
|
283 |
*
|
|
284 |
* Endian:
|
|
285 |
*
|
|
286 |
* Messages are sent in big-endian format.
|
|
287 |
*
|
|
288 |
* Example layouts:
|
|
289 |
*
|
|
290 |
* Type Value Big Endian Little Endian
|
|
291 |
* -------------------- --------------------------- ---------------------------
|
|
292 |
* ui8 0x12 [0x12] [0x12]
|
|
293 |
* ui16 0x1234 [0x12] [0x34] [0x34] [0x12]
|
|
294 |
* ui32 0x12345678 [0x12] [0x34] [0x56] [0x78] [0x78] [0x56] [0x34] [0x12]
|
|
295 |
* ui8[] 0x12 0x34 [0x12] [0x34] [0x12] [0x34]
|
|
296 |
* ui16[] 0x1234 0x5678 [0x12] [0x34] [0x56] [0x78] [0x34] [0x12] [0x78] [0x56]
|
|
297 |
* ui32[] 0x12345678 [0x12] [0x34] [0x56] [0x78] [0x78] [0x56] [0x34] [0x12]
|
|
298 |
* 0x9ABCDEF0 [0x9A] [0xBC] [0xDE] [0xF0] [0xF0] [0xDE] [0xBC] [0x9A]
|
|
299 |
* char[] "Abcd 234" [0x41] [0x62] [0x63] [0x64] [0x41] [0x62] [0x63] [0x64]
|
|
300 |
* [0x20] [0x32] [0x33] [0x34] [0x20] [0x32] [0x33] [0x34]
|
|
301 |
*
|
|
302 |
* Alignment:
|
|
303 |
*
|
|
304 |
* Messages have no alignment restrictions. For transmission efficiency,
|
|
305 |
* alignment padding is not recommended in messages.
|
|
306 |
*/
|
|
307 |
/****************************************************************************/
|
|
308 |
|
|
309 |
#if __MWERKS__
|
|
310 |
#pragma mark -
|
|
311 |
#pragma mark Message Formats
|
|
312 |
#endif /* __MWERKS__ */
|
|
313 |
/****************************************************************************/
|
|
314 |
/*
|
|
315 |
* M E S S A G E F O R M A T S
|
|
316 |
*/
|
|
317 |
/****************************************************************************/
|
|
318 |
|
|
319 |
#if __MWERKS__
|
|
320 |
#pragma mark Message Header (common)
|
|
321 |
#endif /* __MWERKS__ */
|
|
322 |
/****************************************************************************/
|
|
323 |
/*
|
|
324 |
* Message Header (new format):
|
|
325 |
*
|
|
326 |
* ui8 command - (1) MessageCommandID
|
|
327 |
* ui8 sequenceId - (1) sequence ID of message
|
|
328 |
* <2> total
|
|
329 |
* - OR - (old format):
|
|
330 |
*
|
|
331 |
* ui8 command - (1) MessageCommandID
|
|
332 |
* <1> total
|
|
333 |
*
|
|
334 |
* All messages, including replies begin with this header. Some may consist
|
|
335 |
* of nothing else (e.g., the Reset message). Others contain additional
|
|
336 |
* information following the header.
|
|
337 |
*
|
|
338 |
* Currently MetroTRK only supports sending 1 message at a time, which
|
|
339 |
* means that the sender must wait for a reply to each message before
|
|
340 |
* sending the next message. For this case, the sequence IDs follow
|
|
341 |
* these rules:
|
|
342 |
* - For non-reply messages, the sequence ID should be 1 larger
|
|
343 |
* than the sequence ID of the previous message from the same
|
|
344 |
* sender, or 0x01 if the previous value was 0xFF. The host
|
|
345 |
* and target sequence ID's are independent.
|
|
346 |
* A sequence ID of 0 is a special case. It is always valid
|
|
347 |
* and resets the sequence so that the next expected ID is 1
|
|
348 |
* for both the host and target.
|
|
349 |
* - For ACK reply messages, the sequence ID should equal the
|
|
350 |
* sequence ID of the message to which it is replying.
|
|
351 |
* - For NAK reply messages, if the error code is
|
|
352 |
* kDSReplySequenceMissing then the sequence ID should be the
|
|
353 |
* next value that was expected by the receiver. For
|
|
354 |
* any other error code, the sequence ID is indeterminate.
|
|
355 |
* - If a received, non-reply sequence ID is the same as the
|
|
356 |
* previous received sequence ID, the receiver should re-send
|
|
357 |
* the reply to the previous message *without* re-processing
|
|
358 |
* the message. It is important for certain messages (e.g., file
|
|
359 |
* writes) that duplicates not be re-processed.
|
|
360 |
* - If a received, non-reply sequence ID is not equal to the
|
|
361 |
* previous received sequence ID, the next expected ID, or 0,
|
|
362 |
* the receiver should send a NAK reply with the
|
|
363 |
* kDSReplySequenceMissing error code and discard the
|
|
364 |
* received message.
|
|
365 |
*
|
|
366 |
* The sequenceId field is new in version 2.0 of the protocol. For
|
|
367 |
* backwards compatibility, descriptors are included for both the new
|
|
368 |
* and the old header formats. The new format will be used by default,
|
|
369 |
* but it can be changed at runtime. The old format can also be forced
|
|
370 |
* at build time by defining the following in target.h:
|
|
371 |
* #define TRK_MSG_SEQUENCE_IDS 0
|
|
372 |
*
|
|
373 |
*/
|
|
374 |
/****************************************************************************/
|
|
375 |
#define TRK_MSG_HEADER_LENGTH (gTrkMsgHeader.length)
|
|
376 |
#define TRK_MSG_HEADER_COUNT 2 /* 2 field in header */
|
|
377 |
|
|
378 |
/*
|
|
379 |
** For L1 and L2, sequence IDs are disabled by default. For L3 they are
|
|
380 |
** enabled by default. Individual targets can override this setting by
|
|
381 |
** defining TRK_MSG_SEQUENCE_IDS in target.h.
|
|
382 |
*/
|
|
383 |
|
|
384 |
#ifndef TRK_MSG_SEQUENCE_IDS
|
|
385 |
#if DS_PROTOCOL < DS_PROTOCOL_RTOS
|
|
386 |
#define TRK_MSG_SEQUENCE_IDS 0
|
|
387 |
#else
|
|
388 |
#define TRK_MSG_SEQUENCE_IDS 1
|
|
389 |
#endif
|
|
390 |
#endif
|
|
391 |
|
|
392 |
/* The current header descriptor as of protocol version 2.0 */
|
|
393 |
#define TRK_MSG_HEADER_20_INIT \
|
|
394 |
{ \
|
|
395 |
__debug_only_parm( "Header" ) \
|
|
396 |
NULL, /* previous fragment/header */ \
|
|
397 |
2, /* # of bytes */ \
|
|
398 |
TRK_MSG_HEADER_COUNT, /* # of fields */ \
|
|
399 |
{ /* field descriptors: */ \
|
|
400 |
__trk_msg_field( "command", 1 ), \
|
|
401 |
__trk_msg_field( "sequence ID", 1 ) \
|
|
402 |
} \
|
|
403 |
}
|
|
404 |
|
|
405 |
DESCDECL TrkMsgDesc gTrkMsgHeader20
|
|
406 |
#ifdef TRK_MSGCMD_INIT
|
|
407 |
= TRK_MSG_HEADER_20_INIT
|
|
408 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
409 |
;
|
|
410 |
|
|
411 |
/* The old header descriptor prior to protocol version 2.0 */
|
|
412 |
#define TRK_MSG_HEADER_PRE_20_INIT \
|
|
413 |
{ \
|
|
414 |
__debug_only_parm( "Header" ) \
|
|
415 |
NULL, /* previous fragment/header */ \
|
|
416 |
1, /* # of bytes */ \
|
|
417 |
TRK_MSG_HEADER_COUNT, /* # of fields */ \
|
|
418 |
{ /* field descriptors: */ \
|
|
419 |
__trk_msg_field( "command", 1 ), \
|
|
420 |
__trk_msg_field( "sequence ID (N/A)", 0 ) /* placeholder to make indices consistent */ \
|
|
421 |
} \
|
|
422 |
}
|
|
423 |
|
|
424 |
DESCDECL TrkMsgDesc gTrkMsgHeaderPre20
|
|
425 |
#ifdef TRK_MSGCMD_INIT
|
|
426 |
= TRK_MSG_HEADER_PRE_20_INIT
|
|
427 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
428 |
;
|
|
429 |
|
|
430 |
/* Use new header by default - can be changed at runtime. */
|
|
431 |
DESCDECLNC TrkMsgDesc gTrkMsgHeader
|
|
432 |
#ifdef TRK_MSGCMD_INIT
|
|
433 |
#if TRK_MSG_SEQUENCE_IDS
|
|
434 |
= TRK_MSG_HEADER_20_INIT;
|
|
435 |
#else
|
|
436 |
= TRK_MSG_HEADER_PRE_20_INIT
|
|
437 |
#endif
|
|
438 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
439 |
;
|
|
440 |
|
|
441 |
/* "Index" of fields. */
|
|
442 |
#define TRK_MSG_COMMAND_INDEX 0
|
|
443 |
#define TRK_MSG_SID_INDEX 1
|
|
444 |
|
|
445 |
#if __MWERKS__
|
|
446 |
#pragma mark Reply Header (common)
|
|
447 |
#endif /* __MWERKS__ */
|
|
448 |
/****************************************************************************/
|
|
449 |
/*
|
|
450 |
* Reply Message Header
|
|
451 |
*
|
|
452 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
453 |
* ui8 error - (1) CWDS error value
|
|
454 |
* <1 + header> total
|
|
455 |
*
|
|
456 |
* The command for a reply message must be either kDSReplyACK or kDSReplyNAK.
|
|
457 |
*
|
|
458 |
* A NAK reply indicates that an invalid message or portion of a message
|
|
459 |
* was received. The error value will specify the problem.
|
|
460 |
*
|
|
461 |
* An ACK with an error value other than kDSReplyNoError indicates that
|
|
462 |
* the message was valid but could not be processed for some reason (e.g.,
|
|
463 |
* invalid memory ranges, bad parameters, etc.). The error value will
|
|
464 |
* specify the problem.
|
|
465 |
*
|
|
466 |
* Some command replies include additional information that is specific to
|
|
467 |
* the command. This additional information is included ONLY if the
|
|
468 |
* reply is an ACK with kDSReplyNoError.
|
|
469 |
*/
|
|
470 |
/****************************************************************************/
|
|
471 |
#define TRK_MSG_REPLY_HEADER_LENGTH (1 + TRK_MSG_HEADER_LENGTH) /* 1 addl bytes */
|
|
472 |
#define TRK_MSG_REPLY_HEADER_COUNT (1 + TRK_MSG_HEADER_COUNT) /* 1 addl fields */
|
|
473 |
|
|
474 |
DESCDECL TrkMsgDesc gTrkMsgReplyHeader
|
|
475 |
#ifdef TRK_MSGCMD_INIT
|
|
476 |
= {
|
|
477 |
__debug_only_parm( "Reply Header" )
|
|
478 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
479 |
1, /* # of addl bytes */
|
|
480 |
1, /* # of addl fields */
|
|
481 |
{ /* addl field descriptors: */
|
|
482 |
__trk_msg_field( "error", 1 )
|
|
483 |
}
|
|
484 |
}
|
|
485 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
486 |
;
|
|
487 |
|
|
488 |
/* "Index" of fields. Take # of header fields into account. */
|
|
489 |
#define TRK_MSG_REPLY_ERROR_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
490 |
|
|
491 |
/* Retain these for compatibility with older code */
|
|
492 |
#define DS_MIN_MSG_LENGTH TRK_MSG_HEADER_LENGTH
|
|
493 |
#define DS_MIN_REPLY_LENGTH TRK_MSG_REPLY_HEADER_LENGTH
|
|
494 |
|
|
495 |
/****************************************************************************/
|
|
496 |
/*
|
|
497 |
* Required Send and Reply Messsages
|
|
498 |
*/
|
|
499 |
/****************************************************************************/
|
|
500 |
|
|
501 |
#if __MWERKS__
|
|
502 |
#pragma mark Ping
|
|
503 |
#endif /* __MWERKS__ */
|
|
504 |
/****************************************************************************/
|
|
505 |
/*
|
|
506 |
* kDSPing
|
|
507 |
*
|
|
508 |
* Send:
|
|
509 |
*
|
|
510 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
511 |
* <header> total
|
|
512 |
* Reply:
|
|
513 |
*
|
|
514 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
515 |
* <header> total
|
|
516 |
*
|
|
517 |
* Can be sent by the host at any time. Simply replies with an
|
|
518 |
* ACK. Currently not supported.
|
|
519 |
*/
|
|
520 |
/****************************************************************************/
|
|
521 |
|
|
522 |
#define DS_MIN_MSG_PING_LENGTH DS_MIN_MSG_LENGTH
|
|
523 |
#define DS_MIN_REPLY_PING_LENGTH DS_MIN_REPLY_LENGTH
|
|
524 |
|
|
525 |
|
|
526 |
#if __MWERKS__
|
|
527 |
#pragma mark Connect
|
|
528 |
#endif /* __MWERKS__ */
|
|
529 |
/****************************************************************************/
|
|
530 |
/*
|
|
531 |
* kDSConnect
|
|
532 |
*
|
|
533 |
* Send:
|
|
534 |
*
|
|
535 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
536 |
* <header> total
|
|
537 |
* Reply:
|
|
538 |
*
|
|
539 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
540 |
* <header> total
|
|
541 |
*
|
|
542 |
* The host should send a connect message once at the beginning of
|
|
543 |
* a debug session.
|
|
544 |
*/
|
|
545 |
/****************************************************************************/
|
|
546 |
|
|
547 |
#define DS_MIN_MSG_CONNECT_LENGTH DS_MIN_MSG_LENGTH
|
|
548 |
#define DS_MIN_REPLY_CONNECT_LENGTH DS_MIN_REPLY_LENGTH
|
|
549 |
|
|
550 |
#if __MWERKS__
|
|
551 |
#pragma mark Disconnect
|
|
552 |
#endif /* __MWERKS__ */
|
|
553 |
/****************************************************************************/
|
|
554 |
/*
|
|
555 |
* kDSDisconnect
|
|
556 |
*
|
|
557 |
* Send:
|
|
558 |
*
|
|
559 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
560 |
* <header> total
|
|
561 |
* Reply:
|
|
562 |
*
|
|
563 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
564 |
* <header> total
|
|
565 |
*
|
|
566 |
* The host should send a disconnect message once at the end of
|
|
567 |
* a debug session.
|
|
568 |
*/
|
|
569 |
/****************************************************************************/
|
|
570 |
|
|
571 |
#define DS_MIN_MSG_DISCONNECT_LENGTH DS_MIN_MSG_LENGTH
|
|
572 |
#define DS_MIN_REPLY_DISCONNECT_LENGTH DS_MIN_REPLY_LENGTH
|
|
573 |
|
|
574 |
#if __MWERKS__
|
|
575 |
#pragma mark Reset
|
|
576 |
#endif /* __MWERKS__ */
|
|
577 |
/****************************************************************************/
|
|
578 |
/*
|
|
579 |
* kDSReset
|
|
580 |
*
|
|
581 |
* Send:
|
|
582 |
*
|
|
583 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
584 |
* <header> total
|
|
585 |
* Reply:
|
|
586 |
*
|
|
587 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
588 |
* <header> total
|
|
589 |
*
|
|
590 |
* Sent by the host. Causes a soft reset on the target board. The
|
|
591 |
* ACK reply is sent before reset. The host should also expect a
|
|
592 |
* welcome message after reset.
|
|
593 |
*/
|
|
594 |
/****************************************************************************/
|
|
595 |
|
|
596 |
#define DS_MIN_MSG_RESET_LENGTH DS_MIN_MSG_LENGTH
|
|
597 |
#define DS_MIN_REPLY_RESET_LENGTH DS_MIN_REPLY_LENGTH
|
|
598 |
|
|
599 |
#if __MWERKS__
|
|
600 |
#pragma mark Versions
|
|
601 |
#endif /* __MWERKS__ */
|
|
602 |
/****************************************************************************/
|
|
603 |
/*
|
|
604 |
* kDSVersions
|
|
605 |
*
|
|
606 |
* Send:
|
|
607 |
*
|
|
608 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
609 |
* <header> total
|
|
610 |
*
|
|
611 |
* Reply:
|
|
612 |
*
|
|
613 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
614 |
* ui8 kernelMajor - (1)
|
|
615 |
* ui8 kernelMinor - (1)
|
|
616 |
* ui8 protocolMajor - (1)
|
|
617 |
* ui8 protocolMinor - (1)
|
|
618 |
* <4 + header> total
|
|
619 |
*
|
|
620 |
* Sent by the host, returns TRK version numbers.
|
|
621 |
*/
|
|
622 |
/****************************************************************************/
|
|
623 |
#define DS_MIN_MSG_VERSIONS_LENGTH DS_MIN_MSG_LENGTH
|
|
624 |
|
|
625 |
DESCDECL TrkMsgDesc gTrkMsgVersionsReply
|
|
626 |
#ifdef TRK_MSGCMD_INIT
|
|
627 |
= {
|
|
628 |
__debug_only_parm( "Versions Reply" )
|
|
629 |
&gTrkMsgReplyHeader, /* previous fragment/header */
|
|
630 |
4, /* # of addl bytes */
|
|
631 |
4, /* # of addl fields */
|
|
632 |
{ /* addl field descriptors: */
|
|
633 |
__trk_msg_field( "kernel major", 1 ),
|
|
634 |
__trk_msg_field( "kernel minor", 1 ),
|
|
635 |
__trk_msg_field( "protocol major", 1 ),
|
|
636 |
__trk_msg_field( "protocol minor", 1 )
|
|
637 |
}
|
|
638 |
}
|
|
639 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
640 |
;
|
|
641 |
|
|
642 |
/* "Index" of fields. Take # of header fields into account. */
|
|
643 |
#define TRK_MSG_VR_KMAJOR_INDEX (0 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
644 |
#define TRK_MSG_VR_KMINOR_INDEX (1 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
645 |
#define TRK_MSG_VR_PMAJOR_INDEX (2 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
646 |
#define TRK_MSG_VR_PMINOR_INDEX (3 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
647 |
|
|
648 |
#if __MWERKS__
|
|
649 |
#pragma mark CPUType
|
|
650 |
#endif /* __MWERKS__ */
|
|
651 |
/****************************************************************************/
|
|
652 |
/*
|
|
653 |
* kDSCPUType
|
|
654 |
*
|
|
655 |
* Send:
|
|
656 |
*
|
|
657 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
658 |
* <header> total
|
|
659 |
*
|
|
660 |
* Reply:
|
|
661 |
*
|
|
662 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
663 |
* ui8 CPU major type - (1) DS_CPU_MAJOR_* (see below)
|
|
664 |
* ui8 CPU minor type - (1) DS_CPU_* (see below)
|
|
665 |
* ui8 big_endian - (1) 1 ==> big endian, 0 ==> little endian
|
|
666 |
* ui8 default type size - (1) size of DefaultType
|
|
667 |
* ui8 FP type size - (1) size of FPType (0 if unsupported)
|
|
668 |
* ui8 extended1 type size - (1) size of Extended1Type (0 if unsupported)
|
|
669 |
* ui8 extended2 type size - (1) size of Extended2Type (0 if unsupported)
|
|
670 |
* <7 + header> total
|
|
671 |
*
|
|
672 |
* Sent by the host, returns information indicating the CPU type and
|
|
673 |
* CPU implementation details for the target system.
|
|
674 |
*/
|
|
675 |
/****************************************************************************/
|
|
676 |
#define DS_MIN_MSG_CPUTYPE_LENGTH DS_MIN_MSG_LENGTH
|
|
677 |
|
|
678 |
DESCDECL TrkMsgDesc gTrkMsgCpuTypeReply
|
|
679 |
#ifdef TRK_MSGCMD_INIT
|
|
680 |
= {
|
|
681 |
__debug_only_parm( "CPU Type Reply" )
|
|
682 |
&gTrkMsgReplyHeader, /* previous fragment/header */
|
|
683 |
7, /* # of addl bytes */
|
|
684 |
7, /* # of addl fields */
|
|
685 |
{ /* addl field descriptors: */
|
|
686 |
__trk_msg_field( "CPU major", 1 ),
|
|
687 |
__trk_msg_field( "CPU minor", 1 ),
|
|
688 |
__trk_msg_field( "big endian", 1 ),
|
|
689 |
__trk_msg_field( "default type size", 1 ),
|
|
690 |
__trk_msg_field( "FP type size", 1 ),
|
|
691 |
__trk_msg_field( "extended1 type size", 1 ),
|
|
692 |
__trk_msg_field( "extended2 type size", 1 )
|
|
693 |
}
|
|
694 |
}
|
|
695 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
696 |
;
|
|
697 |
|
|
698 |
/* "Index" of fields. Take # of header fields into account. */
|
|
699 |
#define TRK_MSG_CTR_CMAJOR_INDEX (0 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
700 |
#define TRK_MSG_CTR_CMINOR_INDEX (1 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
701 |
#define TRK_MSG_CTR_BIGENDIAN_INDEX (2 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
702 |
#define TRK_MSG_CTR_DEFAULT_SIZE_INDEX (3 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
703 |
#define TRK_MSG_CTR_FP_SIZE_INDEX (4 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
704 |
#define TRK_MSG_CTR_EXTENDED1_SIZE_INDEX (5 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
705 |
#define TRK_MSG_CTR_EXTENDED2_SIZE_INDEX (6 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
706 |
|
|
707 |
/*
|
|
708 |
** CPU Major types.
|
|
709 |
*/
|
|
710 |
|
|
711 |
#define DS_CPU_MAJOR_PPC 0x00
|
|
712 |
#define DS_CPU_MAJOR_MIPS 0x01
|
|
713 |
#define DS_CPU_MAJOR_NEC_V8XX 0x02
|
|
714 |
#define DS_CPU_MAJOR_MOT_DSP 0x03
|
|
715 |
#define DS_CPU_MAJOR_ARM 0x04
|
|
716 |
#define DS_CPU_MAJOR_X86 0x05
|
|
717 |
#define DS_CPU_MAJOR_MCORE 0x06
|
|
718 |
#define DS_CPU_MAJOR_M68K 0x07 /* includes ColdFire */
|
|
719 |
#define DS_CPU_MAJOR_SUPERH 0x08
|
|
720 |
#define DS_CPU_MAJOR_STARCORE 0x09
|
|
721 |
|
|
722 |
/*
|
|
723 |
** ARM CPU minor types.
|
|
724 |
*/
|
|
725 |
|
|
726 |
#define DS_CPU_ARM_920T 0x00
|
|
727 |
|
|
728 |
/*
|
|
729 |
** MIPS CPU minor types.
|
|
730 |
*/
|
|
731 |
|
|
732 |
#define DS_CPU_MIPS_R3000 0x00
|
|
733 |
#define DS_CPU_MIPS_R3081E 0x01
|
|
734 |
|
|
735 |
#define DS_CPU_MIPS_VR4100 0x20
|
|
736 |
#define DS_CPU_MIPS_VR4300 0x21
|
|
737 |
#define DS_CPU_MIPS_VR4500 0x22
|
|
738 |
#define DS_CPU_MIPS_VR4111 0x23
|
|
739 |
#define DS_CPU_MIPS_TR4101 0x24
|
|
740 |
#define DS_CPU_MIPS_EZ4103 0x25
|
|
741 |
#define DS_CPU_MIPS_RM7000 0x26
|
|
742 |
#define DS_CPU_MIPS_MIPS32_4kc 0x27
|
|
743 |
#define DS_CPU_MIPS_RM5231 0x28
|
|
744 |
|
|
745 |
#define DS_CPU_MIPS_VR5000 0x40
|
|
746 |
|
|
747 |
|
|
748 |
/*
|
|
749 |
** PowerPC CPU minor types.
|
|
750 |
*/
|
|
751 |
|
|
752 |
#define DS_CPU_PPC_403 0x00
|
|
753 |
|
|
754 |
#define DS_CPU_PPC_5XX 0x20 /* used when not precisely known */
|
|
755 |
#define DS_CPU_PPC_505 0x21
|
|
756 |
#define DS_CPU_PPC_509 0x22
|
|
757 |
#define DS_CPU_PPC_50X 0x27 /* used when not precisely known */
|
|
758 |
#define DS_CPU_PPC_555 0x28
|
|
759 |
|
|
760 |
#define DS_CPU_PPC_603E 0x40
|
|
761 |
|
|
762 |
#define DS_CPU_PPC_7XX 0x50 /* used when not precisely known */
|
|
763 |
#define DS_CPU_PPC_740 0x51
|
|
764 |
#define DS_CPU_PPC_750 0x52
|
|
765 |
#define DS_CPU_PPC_7400 0x53
|
|
766 |
#define DS_CPU_PPC_7410 0x54
|
|
767 |
|
|
768 |
#define DS_CPU_PPC_8260 0x61
|
|
769 |
|
|
770 |
#define DS_CPU_PPC_8XX 0x80 /* used when not precisely known */
|
|
771 |
#define DS_CPU_PPC_821 0x81
|
|
772 |
#define DS_CPU_PPC_823 0x82
|
|
773 |
#define DS_CPU_PPC_860 0x83
|
|
774 |
|
|
775 |
|
|
776 |
/*
|
|
777 |
** NEC V8xx CPU minor types.
|
|
778 |
*/
|
|
779 |
|
|
780 |
#define DS_CPU_NEC_V8XX_V810 0x00
|
|
781 |
#define DS_CPU_NEC_V8XX_V821 0x01
|
|
782 |
|
|
783 |
#define DS_CPU_NEC_V8XX_V830 0x10
|
|
784 |
#define DS_CPU_NEC_V8XX_V831 0x11
|
|
785 |
#define DS_CPU_NEC_V8XX_V832 0x12
|
|
786 |
|
|
787 |
#define DS_CPU_NEC_V8XX_V850 0x20
|
|
788 |
#define DS_CPU_NEC_V8XX_V853 0x21
|
|
789 |
#define DS_CPU_NEC_V8XX_V850E 0x22
|
|
790 |
#define DS_CPU_NEC_V8XX_V850_SA1 0x23
|
|
791 |
|
|
792 |
/*
|
|
793 |
** M68K/Coldfire CPU minor types.
|
|
794 |
*/
|
|
795 |
|
|
796 |
#define DS_CPU_M68K_68000 0x00
|
|
797 |
#define DS_CPU_M68K_68020 0x02
|
|
798 |
#define DS_CPU_M68K_68030 0x04
|
|
799 |
#define DS_CPU_M68K_68040 0x06
|
|
800 |
#define DS_CPU_M68K_68060 0x08
|
|
801 |
|
|
802 |
#define DS_CPU_M68K_68302 0x20
|
|
803 |
#define DS_CPU_M68K_68306 0x22
|
|
804 |
#define DS_CPU_M68K_68307 0x24
|
|
805 |
#define DS_CPU_M68K_68328 0x26
|
|
806 |
#define DS_CPU_M68K_68EZ328 0x28
|
|
807 |
#define DS_CPU_M68K_68VZ328 0x29
|
|
808 |
#define DS_CPU_M68K_68340 0x2a
|
|
809 |
#define DS_CPU_M68K_68360 0x2c
|
|
810 |
|
|
811 |
#define DS_CPU_M68K_CF5102 0x80
|
|
812 |
#define DS_CPU_M68K_CF5202 0x82
|
|
813 |
#define DS_CPU_M68K_CF5204 0x84
|
|
814 |
#define DS_CPU_M68K_CF5206 0x86
|
|
815 |
#define DS_CPU_M68K_CF5206E 0x88
|
|
816 |
#define DS_CPU_M68K_CF5307 0x8a
|
|
817 |
|
|
818 |
/*
|
|
819 |
** MCore CPU minor types.
|
|
820 |
*/
|
|
821 |
|
|
822 |
#define DS_CPU_MCORE_200 0x00
|
|
823 |
#define DS_CPU_MCORE_340 0x20
|
|
824 |
|
|
825 |
/*
|
|
826 |
** STARCORE CPU minor types
|
|
827 |
*/
|
|
828 |
|
|
829 |
#define DS_CPU_STARCORE_8101 0x01
|
|
830 |
#define DS_CPU_STARCORE_8102 0x02
|
|
831 |
|
|
832 |
#if __MWERKS__
|
|
833 |
#pragma mark SupportMask
|
|
834 |
#endif /* __MWERKS__ */
|
|
835 |
/****************************************************************************/
|
|
836 |
/*
|
|
837 |
* kDSSupportMask
|
|
838 |
*
|
|
839 |
* Send:
|
|
840 |
*
|
|
841 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
842 |
* <header> total
|
|
843 |
*
|
|
844 |
* Reply:
|
|
845 |
*
|
|
846 |
* ui8 command - (1) ack/nak MessageCommandID
|
|
847 |
* ui8 error - (1) CWDS error value
|
|
848 |
* ui8 mask[32] - (32) DSSupportMask
|
|
849 |
* ui8 protocolLevel - (1) value of DS_PROTOCOL (1-3)
|
|
850 |
* <34>
|
|
851 |
*
|
|
852 |
* Sent by the host, returns support mask indicating which commands are
|
|
853 |
* supported by that particular TRK.
|
|
854 |
*/
|
|
855 |
/****************************************************************************/
|
|
856 |
|
|
857 |
/*
|
|
858 |
* Meaning: (bit x == 1) <==> (command x is supported)
|
|
859 |
* where bit 0 is the least significant bit of mask[0] and
|
|
860 |
* bit 255 is the most significant bit of mask[31].
|
|
861 |
*/
|
|
862 |
typedef ui8 DSSupportMask[32]; /* 256 bits total */
|
|
863 |
|
|
864 |
#define DS_MIN_MSG_SUPPORTMASK_LENGTH DS_MIN_MSG_LENGTH
|
|
865 |
#define DS_MIN_REPLY_SUPPORTMASK_LENGTH (DS_MIN_REPLY_LENGTH + sizeof( DSSupportMask ) + 1)
|
|
866 |
|
|
867 |
#if __MWERKS__
|
|
868 |
#pragma mark ConfigTransport
|
|
869 |
#endif /* __MWERKS__ */
|
|
870 |
/****************************************************************************/
|
|
871 |
/*
|
|
872 |
* kDSConfigTransport
|
|
873 |
*
|
|
874 |
* Send: (if type == TRK_TRANSPORT_TYPE_ETHERNET)
|
|
875 |
*
|
|
876 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
877 |
* ui32 general options - (4) reserved (set to 0)
|
|
878 |
* ui32 type - (4) TRK_TRANSPORT_TYPE_ETHERNET (see below)
|
|
879 |
* ui32 channel# - (4) reserved (set to 0)
|
|
880 |
* ui32 ethernet options - (4) reserved (set to 0)
|
|
881 |
* ui32 address - (4) IP address of TRK
|
|
882 |
* ui32 port - (4) port used by TRK
|
|
883 |
* ui32 gateway - (4) gateway IP address (0 if none)
|
|
884 |
* ui32 subnet mask - (4) IP subnet mask (0 if none)
|
|
885 |
* <header + 32> total
|
|
886 |
*
|
|
887 |
* Reply:
|
|
888 |
*
|
|
889 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
890 |
* <header> total
|
|
891 |
*
|
|
892 |
* Sent by the host, configures a transport channel on the target with
|
|
893 |
* appropriate parameters. The first 3 fields should be common to all
|
|
894 |
* transport types. The number and format of any remaining fields
|
|
895 |
* depend on the value of the "type" field. Currently only ethernet
|
|
896 |
* channels can be configured in this way. Also, since the bare-board
|
|
897 |
* TRK TCP/IP stack only supports a single hardware ethernet channel, the
|
|
898 |
* "channel#" field should be set to 0 for now.
|
|
899 |
*/
|
|
900 |
/****************************************************************************/
|
|
901 |
/* values to be used in the "type" field */
|
|
902 |
#define TRK_MSG_TRANSPORT_TYPE_ETHERNET 0
|
|
903 |
|
|
904 |
|
|
905 |
/* common segment of message */
|
|
906 |
#define TRK_MSG_CT_HEADER_COUNT (3 + TRK_MSG_HEADER_COUNT)
|
|
907 |
DESCDECL TrkMsgDesc gTrkMsgConfigTransport
|
|
908 |
#ifdef TRK_MSGCMD_INIT
|
|
909 |
= {
|
|
910 |
__debug_only_parm( "Config Transport" )
|
|
911 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
912 |
12, /* # of addl bytes */
|
|
913 |
3, /* # of addl fields */
|
|
914 |
{ /* addl field descriptors: */
|
|
915 |
__trk_msg_field( "general options", 4 ),
|
|
916 |
__trk_msg_field( "type", 4 ),
|
|
917 |
__trk_msg_field( "channel#", 4 )
|
|
918 |
}
|
|
919 |
}
|
|
920 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
921 |
;
|
|
922 |
|
|
923 |
/* "Index" of fields. Take # of header fields into account. */
|
|
924 |
#define TRK_MSG_CT_GENOPT_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
925 |
#define TRK_MSG_CT_TYPE_INDEX (1 + TRK_MSG_HEADER_COUNT)
|
|
926 |
#define TRK_MSG_CT_CHANNEL_INDEX (2 + TRK_MSG_HEADER_COUNT)
|
|
927 |
|
|
928 |
|
|
929 |
/* ethernet-specific segment of message */
|
|
930 |
DESCDECL TrkMsgDesc gTrkMsgConfigTransportEthernet
|
|
931 |
#ifdef TRK_MSGCMD_INIT
|
|
932 |
= {
|
|
933 |
__debug_only_parm( "Config Transport (Ethernet)" )
|
|
934 |
&gTrkMsgConfigTransport, /* previous fragment/header */
|
|
935 |
20, /* # of addl bytes */
|
|
936 |
5, /* # of addl fields */
|
|
937 |
{ /* addl field descriptors: */
|
|
938 |
__trk_msg_field( "ethernet options", 4 ),
|
|
939 |
__trk_msg_field( "address", 4 ),
|
|
940 |
__trk_msg_field( "port", 4 ),
|
|
941 |
__trk_msg_field( "gateway", 4 ),
|
|
942 |
__trk_msg_field( "netmask", 4 )
|
|
943 |
}
|
|
944 |
}
|
|
945 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
946 |
;
|
|
947 |
|
|
948 |
/* "Index" of fields. Take # of header fields into account. */
|
|
949 |
#define TRK_MSG_CTE_ETHOPT_INDEX (0 + TRK_MSG_CT_HEADER_COUNT)
|
|
950 |
#define TRK_MSG_CTE_ADDRESS_INDEX (1 + TRK_MSG_CT_HEADER_COUNT)
|
|
951 |
#define TRK_MSG_CTE_PORT_INDEX (2 + TRK_MSG_CT_HEADER_COUNT)
|
|
952 |
#define TRK_MSG_CTE_GATEWAY_INDEX (3 + TRK_MSG_CT_HEADER_COUNT)
|
|
953 |
#define TRK_MSG_CTE_NETMASK_INDEX (4 + TRK_MSG_CT_HEADER_COUNT)
|
|
954 |
|
|
955 |
#if __MWERKS__
|
|
956 |
#pragma mark Versions2
|
|
957 |
#endif /* __MWERKS__ */
|
|
958 |
/****************************************************************************/
|
|
959 |
/*
|
|
960 |
* kDSVersions
|
|
961 |
*
|
|
962 |
* Send:
|
|
963 |
*
|
|
964 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
965 |
* <header> total
|
|
966 |
*
|
|
967 |
* Reply:
|
|
968 |
*
|
|
969 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
970 |
* ui8 kernelMajor - (1)
|
|
971 |
* ui8 kernelMinor - (1)
|
|
972 |
* ui8 protocolMajor - (1)
|
|
973 |
* ui8 protocolMinor - (1)
|
|
974 |
* <4 + header> total
|
|
975 |
*
|
|
976 |
* Sent by the host, returns TRK version numbers.
|
|
977 |
*/
|
|
978 |
/****************************************************************************/
|
|
979 |
#define DS_MIN_MSG_VERSIONS2_LENGTH DS_MIN_MSG_LENGTH
|
|
980 |
|
|
981 |
DESCDECL TrkMsgDesc gTrkMsgVersions2Reply
|
|
982 |
#ifdef TRK_MSGCMD_INIT
|
|
983 |
= {
|
|
984 |
__debug_only_parm( "Versions2 Reply" )
|
|
985 |
&gTrkMsgReplyHeader, /* previous fragment/header */
|
|
986 |
5, /* # of addl bytes */
|
|
987 |
5, /* # of addl fields */
|
|
988 |
{ /* addl field descriptors: */
|
|
989 |
__trk_msg_field( "kernel major", 1 ),
|
|
990 |
__trk_msg_field( "kernel minor", 1 ),
|
|
991 |
__trk_msg_field( "protocol major", 1 ),
|
|
992 |
__trk_msg_field( "protocol minor", 1 ),
|
|
993 |
__trk_msg_field( "build number", 1 )
|
|
994 |
}
|
|
995 |
}
|
|
996 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
997 |
;
|
|
998 |
|
|
999 |
/* "Index" of fields. Take # of header fields into account. */
|
|
1000 |
#define TRK_MSG_VR2_KMAJOR_INDEX (0 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
1001 |
#define TRK_MSG_VR2_KMINOR_INDEX (1 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
1002 |
#define TRK_MSG_VR2_PMAJOR_INDEX (2 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
1003 |
#define TRK_MSG_VR2_PMINOR_INDEX (3 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
1004 |
#define TRK_MSG_VR2_BUILDNUM_INDEX (4 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
1005 |
|
|
1006 |
#if __MWERKS__
|
|
1007 |
#pragma mark ReadMemory
|
|
1008 |
#endif /* __MWERKS__ */
|
|
1009 |
/****************************************************************************/
|
|
1010 |
/*
|
|
1011 |
* kDSReadMemory
|
|
1012 |
*
|
|
1013 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS &&
|
|
1014 |
* (header.options & DS_MSG_MEMORYEXTENDED) == 0
|
|
1015 |
*
|
|
1016 |
* ui8 command - (1) MessageCommandID
|
|
1017 |
* ui8 options - (1) One of DS_MSG_MEMORY_* below
|
|
1018 |
* ui16 length - (2) memory data length
|
|
1019 |
* ui32 start - (4) memory start address
|
|
1020 |
*
|
|
1021 |
*
|
|
1022 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS &&
|
|
1023 |
* (header.options & DS_MSG_MEMORYEXTENDED) != 0
|
|
1024 |
*
|
|
1025 |
* ui8 command - (1) MessageCommandID
|
|
1026 |
* ui8 options - (1) One of DS_MSG_MEMORY_* below
|
|
1027 |
* ui16 length - (2) memory data length
|
|
1028 |
* ui32 startHigh - (4) memory start high-order address
|
|
1029 |
* ui32 startLow - (4) memory start low-order address
|
|
1030 |
* <12> total
|
|
1031 |
*
|
|
1032 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS &&
|
|
1033 |
* (header.options & DS_MSG_MEMORYEXTENDED) == 0
|
|
1034 |
*
|
|
1035 |
* ui8 command - (1) MessageCommandID
|
|
1036 |
* ui8 options - (1) One of DS_MSG_MEMORY_* below
|
|
1037 |
* ui16 length - (2) memory data length
|
|
1038 |
* ui32 start - (4) memory start address
|
|
1039 |
* ui32 processID - (4) unique process ID
|
|
1040 |
* ui32 threadID - (4) unique thread ID
|
|
1041 |
* <16> total
|
|
1042 |
*
|
|
1043 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS &&
|
|
1044 |
* (header.options & DS_MSG_MEMORYEXTENDED) != 0
|
|
1045 |
*
|
|
1046 |
* ui8 command - (1) MessageCommandID
|
|
1047 |
* ui8 options - (1) One of DS_MSG_MEMORY_* below
|
|
1048 |
* ui16 length - (2) memory data length
|
|
1049 |
* ui32 startHigh - (4) memory start high-order address
|
|
1050 |
* ui32 startLow - (4) memory start low-order address
|
|
1051 |
* ui32 processID - (4) unique process ID
|
|
1052 |
* ui32 threadID - (4) unique thread ID
|
|
1053 |
* <20> total
|
|
1054 |
*
|
|
1055 |
* Reply:
|
|
1056 |
*
|
|
1057 |
* ui8 command - (1) ack/nak MessageCommandID
|
|
1058 |
* ui8 error - (1) CWDS error value
|
|
1059 |
* ui16 length - (2) amount that was read
|
|
1060 |
* ui8 data[] - (0 to 2048) data
|
|
1061 |
* <4 + length> total
|
|
1062 |
*
|
|
1063 |
* Sent by the host, returns the requested memory contents. The TRK
|
|
1064 |
* will attempt to catch and handle any memory access exceptions that
|
|
1065 |
* occur during this operation.
|
|
1066 |
*
|
|
1067 |
* This command can only be used on a stopped system (protocol level 2)
|
|
1068 |
* or stopped thread (protocol level 3).
|
|
1069 |
*/
|
|
1070 |
/****************************************************************************/
|
|
1071 |
|
|
1072 |
|
|
1073 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1074 |
#define DS_MIN_MSG_READMEMORY_LENGTH (DS_MIN_MSG_LENGTH + 15)
|
|
1075 |
#else
|
|
1076 |
#define DS_MIN_MSG_READMEMORY_LENGTH (DS_MIN_MSG_LENGTH + 7)
|
|
1077 |
#endif
|
|
1078 |
#define DS_MIN_REPLY_READMEMORY_LENGTH (DS_MIN_REPLY_LENGTH + 2)
|
|
1079 |
|
|
1080 |
#if __MWERKS__
|
|
1081 |
#pragma mark WriteMemory
|
|
1082 |
#endif /* __MWERKS__ */
|
|
1083 |
/****************************************************************************/
|
|
1084 |
/*
|
|
1085 |
* kDSWriteMemory
|
|
1086 |
*
|
|
1087 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS &&
|
|
1088 |
* (header.options & DS_MSG_MEMORYEXTENDED) == 0
|
|
1089 |
*
|
|
1090 |
* ui8 command - (1) MessageCommandID
|
|
1091 |
* ui8 options - (1) One of DS_MSG_MEMORY_* below
|
|
1092 |
* ui16 length - (2) memory data length in bytes
|
|
1093 |
* ui32 start - (4) memory start address
|
|
1094 |
* ui8 data[] - (0 to 2048) data
|
|
1095 |
* <8 + length> total
|
|
1096 |
*
|
|
1097 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS &&
|
|
1098 |
* (header.options & DS_MSG_MEMORYEXTENDED) != 0
|
|
1099 |
*
|
|
1100 |
* ui8 command - (1) MessageCommandID
|
|
1101 |
* ui8 options - (1) One of DS_MSG_MEMORY_* below
|
|
1102 |
* ui16 length - (2) memory data length in bytes
|
|
1103 |
* ui32 startHigh - (4) memory start high-order address
|
|
1104 |
* ui32 startLow - (4) memory start low-order address
|
|
1105 |
* ui8 data[] - (0 to 2048) data
|
|
1106 |
* <12 + length> total
|
|
1107 |
*
|
|
1108 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS &&
|
|
1109 |
* (header.options & DS_MSG_MEMORYEXTENDED) == 0
|
|
1110 |
*
|
|
1111 |
* ui8 command - (1) MessageCommandID
|
|
1112 |
* ui8 options - (1) One of DS_MSG_MEMORY_* below
|
|
1113 |
* ui16 length - (2) memory data length in bytes
|
|
1114 |
* ui32 start - (4) memory start address
|
|
1115 |
* ui32 processID - (4) unique process ID
|
|
1116 |
* ui32 threadID - (4) unique thread ID
|
|
1117 |
* ui8 data[] - (0 to 2048) data
|
|
1118 |
* <16 + length> total
|
|
1119 |
*
|
|
1120 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS &&
|
|
1121 |
* (header.options & DS_MSG_MEMORYEXTENDED) != 0
|
|
1122 |
*
|
|
1123 |
* ui8 command - (1) MessageCommandID
|
|
1124 |
* ui8 options - (1) One of DS_MSG_MEMORY_* below
|
|
1125 |
* ui16 length - (2) memory data length in bytes
|
|
1126 |
* ui32 startHigh - (4) memory start high-order address
|
|
1127 |
* ui32 startLow - (4) memory start low-order address
|
|
1128 |
* ui32 processID - (4) unique process ID
|
|
1129 |
* ui32 threadID - (4) unique thread ID
|
|
1130 |
* ui8 data[] - (0 to 2048) data
|
|
1131 |
* <20 + length> total
|
|
1132 |
*
|
|
1133 |
* Reply:
|
|
1134 |
*
|
|
1135 |
* ui8 command - (1) ack/nak MessageCommandID
|
|
1136 |
* ui8 error - (1) CWDS error value
|
|
1137 |
* ui16 length - (2) amount that was written in bytes
|
|
1138 |
* <4> total
|
|
1139 |
*
|
|
1140 |
* Sent by the host, writes the specified values to target memory The TRK
|
|
1141 |
* will attempt to catch and handle any memory access exceptions that
|
|
1142 |
* occur during this operation.
|
|
1143 |
*
|
|
1144 |
* This command can only be used on a stopped system (protocol level 2)
|
|
1145 |
* or stopped thread (protocol level 3).
|
|
1146 |
*/
|
|
1147 |
/****************************************************************************/
|
|
1148 |
|
|
1149 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1150 |
#define DS_MIN_MSG_WRITEMEMORY_LENGTH (DS_MIN_MSG_LENGTH + 15)
|
|
1151 |
#else
|
|
1152 |
#define DS_MIN_MSG_WRITEMEMORY_LENGTH (DS_MIN_MSG_LENGTH + 7)
|
|
1153 |
#endif
|
|
1154 |
#define DS_MIN_REPLY_WRITEMEMORY_LENGTH (DS_MIN_REPLY_LENGTH + 2)
|
|
1155 |
|
|
1156 |
#if __MWERKS__
|
|
1157 |
#pragma mark FillMemory
|
|
1158 |
#endif /* __MWERKS__ */
|
|
1159 |
/****************************************************************************/
|
|
1160 |
/*
|
|
1161 |
* kDSFillMemory
|
|
1162 |
*
|
|
1163 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS
|
|
1164 |
*
|
|
1165 |
* ui8 command - (1) MessageCommandID
|
|
1166 |
* ui8 options - (1) One of DS_MSG_MEMORY_* below
|
|
1167 |
* ui8 fillValue - (1) value with which to fill memory
|
|
1168 |
* ui32 length - (4) data length in bytes
|
|
1169 |
* ui32 start - (4) memory start address
|
|
1170 |
* <11> total
|
|
1171 |
*
|
|
1172 |
*
|
|
1173 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1174 |
*
|
|
1175 |
* ui8 command - (1) MessageCommandID
|
|
1176 |
* ui8 options - (1) One of DS_MSG_MEMORY_* below
|
|
1177 |
* ui8 fillValue - (1) value with which to fill memory
|
|
1178 |
* ui32 length - (4) data length in bytes
|
|
1179 |
* ui32 start - (4) memory start address
|
|
1180 |
* ui32 processID - (4) unique process ID
|
|
1181 |
* ui32 threadID - (4) unique thread ID
|
|
1182 |
* <19> total
|
|
1183 |
*
|
|
1184 |
* Reply - Basic Reply
|
|
1185 |
*
|
|
1186 |
* Sent by the host, fills the specified memory range with the given
|
|
1187 |
* fillValue. The TRK will attempt to catch and handle any memory
|
|
1188 |
* access exceptions that occur during this operation.
|
|
1189 |
*
|
|
1190 |
* This command can only be used on a stopped system (protocol level 2)
|
|
1191 |
* or stopped thread (protocol level 3).
|
|
1192 |
*/
|
|
1193 |
/****************************************************************************/
|
|
1194 |
|
|
1195 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1196 |
#define DS_MIN_MSG_FILLMEMORY_LENGTH (DS_MIN_MSG_LENGTH + 18)
|
|
1197 |
#else
|
|
1198 |
#define DS_MIN_MSG_FILLMEMORY_LENGTH (DS_MIN_MSG_LENGTH + 10)
|
|
1199 |
#endif
|
|
1200 |
#define DS_MIN_REPLY_FILLMEMORY_LENGTH (DS_MIN_REPLY_LENGTH)
|
|
1201 |
|
|
1202 |
#if __MWERKS__
|
|
1203 |
#pragma mark CopyMemory
|
|
1204 |
#endif /* __MWERKS__ */
|
|
1205 |
/****************************************************************************/
|
|
1206 |
/*
|
|
1207 |
* kDSCopyMemory
|
|
1208 |
*
|
|
1209 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS
|
|
1210 |
*
|
|
1211 |
* ui8 command - (1) MessageCommandID
|
|
1212 |
* ui8 options - (1) One of DS_MSG_MEMORY_* below
|
|
1213 |
* ui32 length - (4) data length in bytes
|
|
1214 |
* ui32 source - (4) source memory start address
|
|
1215 |
* ui32 destination - (4) destination memory start address
|
|
1216 |
* <14> total
|
|
1217 |
*
|
|
1218 |
*
|
|
1219 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1220 |
*
|
|
1221 |
* ui8 command - (1) MessageCommandID
|
|
1222 |
* ui8 options - (1) One of DS_MSG_MEMORY_* below
|
|
1223 |
* ui32 length - (4) data length in bytes
|
|
1224 |
* ui32 source - (4) source memory start address
|
|
1225 |
* ui32 destination - (4) destination memory start address
|
|
1226 |
* ui32 processID - (4) unique process ID
|
|
1227 |
* ui32 threadID - (4) unique thread ID
|
|
1228 |
* <22> total
|
|
1229 |
*
|
|
1230 |
* Reply - Basic Reply
|
|
1231 |
*
|
|
1232 |
* Sent by the host, copies a block of memory with the specified
|
|
1233 |
* size from the source address to the destination address. This
|
|
1234 |
* operation will function correctly even if the source and
|
|
1235 |
* destination memory ranges overlap. The TRK will attempt to
|
|
1236 |
* catch and handle any memory access exceptions that occur during
|
|
1237 |
* this operation.
|
|
1238 |
*
|
|
1239 |
* This command can only be used on a stopped system (protocol level 2)
|
|
1240 |
* or stopped thread (protocol level 3).
|
|
1241 |
*/
|
|
1242 |
/****************************************************************************/
|
|
1243 |
|
|
1244 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1245 |
#define DS_MIN_MSG_COPYMEMORY_LENGTH (DS_MIN_MSG_LENGTH + 21)
|
|
1246 |
#else
|
|
1247 |
#define DS_MIN_MSG_COPYMEMORY_LENGTH (DS_MIN_MSG_LENGTH + 13)
|
|
1248 |
#endif
|
|
1249 |
#define DS_MIN_REPLY_COPYMEMORY_LENGTH (DS_MIN_REPLY_LENGTH)
|
|
1250 |
|
|
1251 |
/* option flags in DSMessage.options */
|
|
1252 |
#define DS_MSG_MEMORY_SEGMENTED 0x01 /* non-flat addr space */
|
|
1253 |
#define DS_MSG_MEMORY_EXTENDED 0x02 /* > 32-bit data addr */
|
|
1254 |
#define DS_MSG_MEMORY_PROTECTED 0x04 /* non-user memory */
|
|
1255 |
#define DS_MSG_MEMORY_USERVIEW 0x08 /* breakpoints are invisible */
|
|
1256 |
|
|
1257 |
/*
|
|
1258 |
** The desired memory space can be specified using one of
|
|
1259 |
** the following options. It can be logically OR'ed with
|
|
1260 |
** the flags defined above.
|
|
1261 |
*/
|
|
1262 |
|
|
1263 |
#define DS_MSG_MEMORY_SPACE_PROGRAM 0x00
|
|
1264 |
#define DS_MSG_MEMORY_SPACE_DATA 0x40
|
|
1265 |
#define DS_MSG_MEMORY_SPACE_IO 0x80
|
|
1266 |
|
|
1267 |
/*
|
|
1268 |
** Use this mask to extract the memory space specifier
|
|
1269 |
** from the options field. The specifier occupies the
|
|
1270 |
** 2 most significant bits.
|
|
1271 |
*/
|
|
1272 |
|
|
1273 |
#define DS_MSG_MEMORY_SPACE_MASK 0xc0
|
|
1274 |
|
|
1275 |
#define DS_MAXREADWRITELENGTH 0x0800 /* 2K data portion */
|
|
1276 |
#define DS_MAXMESSAGESIZE (DS_MAXREADWRITELENGTH + 0x80)
|
|
1277 |
/* max size of all message including cmd hdr */
|
|
1278 |
#define MAXMESSAGESIZE DS_MAXMESSAGESIZE
|
|
1279 |
|
|
1280 |
#define DS_MAXREADWRITELENGTH_V2 0x0716 /* for some comms API, packet len needs bet less 2K */
|
|
1281 |
#define DS_MAXMESSAGESIZE_V2 (DS_MAXREADWRITELENGTH_V2 + 0x80)
|
|
1282 |
|
|
1283 |
// With USB connection, transferring big chunks of data seems to be cause problems.
|
|
1284 |
// So reduce the size of each data transfer by almost half.
|
|
1285 |
#define DS_MAXFILEWRITELENGTH 0x0400
|
|
1286 |
|
|
1287 |
#define MAXMESSAGESIZE_V2 DS_MAXMESSAGESIZE_V2
|
|
1288 |
|
|
1289 |
|
|
1290 |
|
|
1291 |
#if __MWERKS__
|
|
1292 |
#pragma mark FlushCache
|
|
1293 |
#endif /* __MWERKS__ */
|
|
1294 |
/****************************************************************************/
|
|
1295 |
/*
|
|
1296 |
* kDSFlushCache
|
|
1297 |
*
|
|
1298 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS
|
|
1299 |
*
|
|
1300 |
* ui8 command - (1) MessageCommandID
|
|
1301 |
* ui8 options - (1) DS_MSG_CACHE_* (see below)
|
|
1302 |
* ui32 start - (4) start of mem region for which to clear cache
|
|
1303 |
* ui32 end - (4) end of mem region for which to clear cache
|
|
1304 |
* <10> total
|
|
1305 |
*
|
|
1306 |
* Reply - Basic Reply
|
|
1307 |
*
|
|
1308 |
* Sent by the host, flushes all cache entries corresponding to the
|
|
1309 |
* given memory range, at least. Additional cache entries may
|
|
1310 |
* be flushed as well, depending on the target implementation.
|
|
1311 |
*
|
|
1312 |
* This command can only be used on a stopped system.
|
|
1313 |
*/
|
|
1314 |
/****************************************************************************/
|
|
1315 |
|
|
1316 |
#define DS_MIN_MSG_FLUSHCACHE_LENGTH (DS_MIN_MSG_LENGTH + 9)
|
|
1317 |
#define DS_MIN_REPLY_FLUSHCACHE_LENGTH (DS_MIN_REPLY_LENGTH)
|
|
1318 |
|
|
1319 |
/*
|
|
1320 |
** The following values may be logically OR'ed together in the
|
|
1321 |
** options field of the kDSFlushCache command to specify
|
|
1322 |
** the cache types to be flushed.
|
|
1323 |
*/
|
|
1324 |
|
|
1325 |
#define DS_MSG_CACHE_TYPE_INSTRUCTION 0x01
|
|
1326 |
#define DS_MSG_CACHE_TYPE_DATA 0x02
|
|
1327 |
#define DS_MSG_CACHE_TYPE_SECONDARY 0x04
|
|
1328 |
|
|
1329 |
|
|
1330 |
#if __MWERKS__
|
|
1331 |
#pragma mark ReadRegisters
|
|
1332 |
#endif /* __MWERKS__ */
|
|
1333 |
/****************************************************************************/
|
|
1334 |
/*
|
|
1335 |
* kDSReadRegisters
|
|
1336 |
*
|
|
1337 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS
|
|
1338 |
*
|
|
1339 |
* ui8 command - (1) MessageCommandID
|
|
1340 |
* ui8 options - (1) DSMessageRegisterOptions
|
|
1341 |
* ui16 firstRegister - (2) first register ID
|
|
1342 |
* ui16 lastRegister - (2) last register ID
|
|
1343 |
* <6>
|
|
1344 |
*
|
|
1345 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1346 |
*
|
|
1347 |
* ui8 command - (1) MessageCommandID
|
|
1348 |
* ui8 options - (1) DSMessageRegisterOptions
|
|
1349 |
* ui16 firstRegister - (2) first register ID
|
|
1350 |
* ui16 lastRegister - (2) last register ID
|
|
1351 |
* ui32 processID - (4) unique process ID
|
|
1352 |
* ui32 threadID - (4) unique thread ID
|
|
1353 |
* <14>
|
|
1354 |
*
|
|
1355 |
* Reply:
|
|
1356 |
*
|
|
1357 |
* ui8 command - (1) ack/nak MessageCommandID
|
|
1358 |
* ui8 error - (1) CWDS error value
|
|
1359 |
* register data - (0-2048)
|
|
1360 |
* <2 + register data>
|
|
1361 |
*
|
|
1362 |
* Sent by the host, reads the requested register contents. The TRK
|
|
1363 |
* will attempt to catch and handle any access exceptions that
|
|
1364 |
* occur during this operation.
|
|
1365 |
*
|
|
1366 |
* This command can only be used on a stopped system (protocol level 2)
|
|
1367 |
* or stopped thread (protocol level 3).
|
|
1368 |
*/
|
|
1369 |
/****************************************************************************/
|
|
1370 |
|
|
1371 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1372 |
#define DS_MIN_MSG_READREGISTERS_LENGTH (DS_MIN_MSG_LENGTH + 13)
|
|
1373 |
#else
|
|
1374 |
#define DS_MIN_MSG_READREGISTERS_LENGTH (DS_MIN_MSG_LENGTH + 5)
|
|
1375 |
#endif
|
|
1376 |
#define DS_MIN_REPLY_READREGISTERS_LENGTH DS_MIN_REPLY_LENGTH
|
|
1377 |
|
|
1378 |
#if __MWERKS__
|
|
1379 |
#pragma mark WriteRegisters
|
|
1380 |
#endif /* __MWERKS__ */
|
|
1381 |
/****************************************************************************/
|
|
1382 |
/*
|
|
1383 |
* kDSWriteRegisters
|
|
1384 |
*
|
|
1385 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS
|
|
1386 |
*
|
|
1387 |
* ui8 command - (1) MessageCommandID
|
|
1388 |
* ui8 options - (1) DSMessageRegisterOptions
|
|
1389 |
* ui16 firstRegister - (2) first register ID
|
|
1390 |
* ui16 lastRegister - (2) last register ID
|
|
1391 |
* register data - (0-2048)
|
|
1392 |
* <6 + register data>
|
|
1393 |
*
|
|
1394 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1395 |
*
|
|
1396 |
* ui8 command - (1) MessageCommandID
|
|
1397 |
* ui8 options - (1) DSMessageRegisterOptions
|
|
1398 |
* ui16 firstRegister - (2) first register ID
|
|
1399 |
* ui16 lastRegister - (2) last register ID
|
|
1400 |
* ui32 processID - (4) unique process ID
|
|
1401 |
* ui32 threadID - (4) unique thread ID
|
|
1402 |
* register data - (0-2048)
|
|
1403 |
* <14 + register data>
|
|
1404 |
*
|
|
1405 |
* Reply:
|
|
1406 |
*
|
|
1407 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
1408 |
* <header> total
|
|
1409 |
*
|
|
1410 |
* Sent by the host, writes the specified values to target registers.
|
|
1411 |
* The TRK will attempt to catch and handle any access exceptions that
|
|
1412 |
* occur during this operation.
|
|
1413 |
*
|
|
1414 |
* This command can only be used on a stopped system (protocol level 2)
|
|
1415 |
* or stopped thread (protocol level 3).
|
|
1416 |
*/
|
|
1417 |
/****************************************************************************/
|
|
1418 |
|
|
1419 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1420 |
#define DS_MIN_MSG_WRITEREGISTERS_LENGTH (DS_MIN_MSG_LENGTH + 13)
|
|
1421 |
#else
|
|
1422 |
#define DS_MIN_MSG_WRITEREGISTERS_LENGTH (DS_MIN_MSG_LENGTH + 5)
|
|
1423 |
#endif
|
|
1424 |
#define DS_MIN_REPLY_WRITEREGISTERS_LENGTH DS_MIN_REPLY_LENGTH
|
|
1425 |
|
|
1426 |
/* option flags for reading registers */
|
|
1427 |
|
|
1428 |
#define DS_MSG_REGISTERS_TYPE_MASK 0x07 /* "register type" mask */
|
|
1429 |
#define DS_MSG_REGISTERS_TYPE_SHIFT 0 /* # bits to shift mask from lsb. */
|
|
1430 |
#define DS_MSG_REGISTERS_TYPE(_x_) ((_x_ & DS_MSG_REGISTERS_TYPE_MASK) << DS_MSG_REGISTERS_TYPE_SHIFT)
|
|
1431 |
|
|
1432 |
/*
|
|
1433 |
* kDSReadRegisters & kDSWriteRegister options
|
|
1434 |
*/
|
|
1435 |
|
|
1436 |
typedef enum DSMessageRegisterOptions {
|
|
1437 |
kDSRegistersDefault = 0x0, /* Default register block */
|
|
1438 |
kDSRegistersFP = 0x1, /* floating point registers */
|
|
1439 |
kDSRegistersExtended1 = 0x2, /* Extended register set 1 */
|
|
1440 |
kDSRegistersExtended2 = 0x3 /* Extended register set 2 */
|
|
1441 |
} DSMessageRegisterOptions;
|
|
1442 |
|
|
1443 |
|
|
1444 |
#if __MWERKS__
|
|
1445 |
#pragma mark Continue
|
|
1446 |
#endif /* __MWERKS__ */
|
|
1447 |
/****************************************************************************/
|
|
1448 |
/*
|
|
1449 |
* kDSContinue
|
|
1450 |
*
|
|
1451 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS
|
|
1452 |
*
|
|
1453 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
1454 |
* <header> total
|
|
1455 |
*
|
|
1456 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1457 |
*
|
|
1458 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
1459 |
* ui32 processID - (4) unique process ID
|
|
1460 |
* ui32 threadID - (4) unique thread ID
|
|
1461 |
* <header + 8> total
|
|
1462 |
*
|
|
1463 |
* Reply:
|
|
1464 |
*
|
|
1465 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
1466 |
* <header> total
|
|
1467 |
*
|
|
1468 |
*
|
|
1469 |
* Sent by the host. Begins execution on the target at the current PC.
|
|
1470 |
*
|
|
1471 |
* Replies with an ACK before execution starts. Once execution begins,
|
|
1472 |
* most commands which access that process or thread will not be
|
|
1473 |
* accepted. For DS_PROTOCOL values of 1 or 2, this means that it
|
|
1474 |
* will not respond to any of the state or execution commands
|
|
1475 |
* except kDSStop. It will respond to meta-commands. For
|
|
1476 |
* a DS_PROTOCOL value of 3, it will not accept any commands
|
|
1477 |
* specifying that process or thread except kDSStop or
|
|
1478 |
* kDSOSDeleteItem.
|
|
1479 |
*
|
|
1480 |
* The host should wait for a NotifyStopped or NotifyException command
|
|
1481 |
* and reply with a corresponding ACK. Once that process and thread
|
|
1482 |
* have stopped again, MetroTRK will once again accept other commands
|
|
1483 |
* which access them.
|
|
1484 |
*
|
|
1485 |
* This command can only be used on a stopped system (protocol level 2)
|
|
1486 |
* or stopped thread (protocol level 3).
|
|
1487 |
*/
|
|
1488 |
/****************************************************************************/
|
|
1489 |
|
|
1490 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1491 |
#define DS_MIN_MSG_CONTINUE_LENGTH (DS_MIN_MSG_LENGTH + 8)
|
|
1492 |
#else
|
|
1493 |
#define DS_MIN_MSG_CONTINUE_LENGTH DS_MIN_MSG_LENGTH
|
|
1494 |
#endif
|
|
1495 |
#define DS_MIN_REPLY_CONTINUE_LENGTH DS_MIN_REPLY_LENGTH
|
|
1496 |
|
|
1497 |
#if __MWERKS__
|
|
1498 |
#pragma mark Step
|
|
1499 |
#endif /* __MWERKS__ */
|
|
1500 |
/****************************************************************************/
|
|
1501 |
/*
|
|
1502 |
* kDSStep
|
|
1503 |
*
|
|
1504 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS &&
|
|
1505 |
* (options == kDSStepIntoCount || options == kDSStepOverCount)
|
|
1506 |
*
|
|
1507 |
* ui8 command - (1) MessageCommandID
|
|
1508 |
* ui8 options - (1) DSMessageStepOptions
|
|
1509 |
* ui8 count - (1) # of instructions
|
|
1510 |
* <3>
|
|
1511 |
*
|
|
1512 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS &&
|
|
1513 |
* (options == kDSStepIntoCount || options == kDSStepOverCount)
|
|
1514 |
*
|
|
1515 |
* ui8 command - (1) MessageCommandID
|
|
1516 |
* ui8 options - (1) DSMessageStepOptions
|
|
1517 |
* ui8 count - (1) # of instructions
|
|
1518 |
* ui32 processID - (4) unique process ID
|
|
1519 |
* ui32 threadID - (4) unique thread ID
|
|
1520 |
* <11>
|
|
1521 |
*
|
|
1522 |
* Sent by the host. Steps over the specified number of instructions.
|
|
1523 |
*
|
|
1524 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS &&
|
|
1525 |
* (options == kDSStepIntoRange || options == kDSStepOverRange)
|
|
1526 |
*
|
|
1527 |
* ui8 command - (1) MessageCommandID
|
|
1528 |
* ui8 options - (1) DSMessageStepOptions
|
|
1529 |
* ui32 rangeStart - (4) Start address of memory range
|
|
1530 |
* ui32 rangeEnd - (4) End address of memory range
|
|
1531 |
* <10>
|
|
1532 |
*
|
|
1533 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS &&
|
|
1534 |
* (options == kDSStepIntoRange || options == kDSStepOverRange)
|
|
1535 |
*
|
|
1536 |
* ui8 command - (1) MessageCommandID
|
|
1537 |
* ui8 options - (1) DSMessageStepOptions
|
|
1538 |
* ui32 rangeStart - (4) Start address of memory range
|
|
1539 |
* ui32 rangeEnd - (4) End address of memory range
|
|
1540 |
* ui32 processID - (4) unique process ID
|
|
1541 |
* ui32 threadID - (4) unique thread ID
|
|
1542 |
* <18>
|
|
1543 |
*
|
|
1544 |
* Reply:
|
|
1545 |
*
|
|
1546 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
1547 |
* <header> total
|
|
1548 |
*
|
|
1549 |
* Sent by the host. Steps until the PC is outside of the specified
|
|
1550 |
* range.
|
|
1551 |
*
|
|
1552 |
* Replies with an ACK before execution starts. Once execution begins,
|
|
1553 |
* most commands which access that process or thread will not be
|
|
1554 |
* accepted. For DS_PROTOCOL values of 1 or 2, this means that it
|
|
1555 |
* will not respond to any of the state or execution commands
|
|
1556 |
* except kDSStop. It will respond to meta-commands. For
|
|
1557 |
* a DS_PROTOCOL value of 3, it will not accept any commands
|
|
1558 |
* specifying that process or thread except kDSStop or
|
|
1559 |
* kDSOSDeleteItem.
|
|
1560 |
*
|
|
1561 |
* The host should wait for a NotifyStopped or NotifyException command
|
|
1562 |
* and reply with a corresponding ACK. Once that process and thread
|
|
1563 |
* have stopped again, MetroTRK will once again accept other commands
|
|
1564 |
* which access them.
|
|
1565 |
*
|
|
1566 |
* This command can only be used on a stopped system (protocol level 2)
|
|
1567 |
* or stopped thread (protocol level 3).
|
|
1568 |
*/
|
|
1569 |
/****************************************************************************/
|
|
1570 |
|
|
1571 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1572 |
#define DS_MIN_MSG_STEP_COUNT_LENGTH (DS_MIN_MSG_LENGTH + 10)
|
|
1573 |
#define DS_MIN_MSG_STEP_RANGE_LENGTH (DS_MIN_MSG_LENGTH + 17)
|
|
1574 |
#else
|
|
1575 |
#define DS_MIN_MSG_STEP_COUNT_LENGTH (DS_MIN_MSG_LENGTH + 2)
|
|
1576 |
#define DS_MIN_MSG_STEP_RANGE_LENGTH (DS_MIN_MSG_LENGTH + 9)
|
|
1577 |
#endif
|
|
1578 |
#define DS_MIN_MSG_STEP_LENGTH (DS_MIN_MSG_STEP_COUNT_LENGTH)
|
|
1579 |
#define DS_MIN_REPLY_STEP_LENGTH DS_MIN_REPLY_LENGTH
|
|
1580 |
|
|
1581 |
/*
|
|
1582 |
** The following option values are predefined. Desired
|
|
1583 |
** target-specific options can be added to the
|
|
1584 |
** DSTargMessageStepOptions enum (see msgtarg.h).
|
|
1585 |
*/
|
|
1586 |
|
|
1587 |
typedef enum {
|
|
1588 |
kDSStepIntoCount = 0x00, /* Exec count instructions & stop */
|
|
1589 |
kDSStepIntoRange = 0x01, /* Exec until PC is out of specified range */
|
|
1590 |
kDSStepOverCount = 0x10, /* Step over 1*count instructions & stop */
|
|
1591 |
kDSStepOverRange = 0x11 /* Step over until PC is out of specified range */
|
|
1592 |
} DSMessageStepOptions;
|
|
1593 |
|
|
1594 |
|
|
1595 |
#if __MWERKS__
|
|
1596 |
#pragma mark Stop
|
|
1597 |
#endif /* __MWERKS__ */
|
|
1598 |
/****************************************************************************/
|
|
1599 |
/*
|
|
1600 |
* kDSStop
|
|
1601 |
*
|
|
1602 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS
|
|
1603 |
*
|
|
1604 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
1605 |
* <header> total
|
|
1606 |
*
|
|
1607 |
*
|
|
1608 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS &&
|
|
1609 |
* (options == kDSStopSystem)
|
|
1610 |
*
|
|
1611 |
* ui8 command - (1) MessageCommandID
|
|
1612 |
* ui8 options - (1) DSMessageStopOptions
|
|
1613 |
* <2>
|
|
1614 |
*
|
|
1615 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS &&
|
|
1616 |
* (options == kDSStopProcess)
|
|
1617 |
*
|
|
1618 |
* ui8 command - (1) MessageCommandID
|
|
1619 |
* ui8 options - (1) DSMessageStopOptions
|
|
1620 |
* ui32 processID - (4) unique process ID
|
|
1621 |
* <6>
|
|
1622 |
*
|
|
1623 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS &&
|
|
1624 |
* (options == kDSStopThread)
|
|
1625 |
*
|
|
1626 |
* ui8 command - (1) MessageCommandID
|
|
1627 |
* ui8 options - (1) DSMessageStopOptions
|
|
1628 |
* ui32 processID - (4) unique process ID
|
|
1629 |
* ui32 threadID - (4) unique thread ID
|
|
1630 |
* <10>
|
|
1631 |
*
|
|
1632 |
* Sent by the host. Forces the target system/process/thread to stop.
|
|
1633 |
* Replies with an ACK.
|
|
1634 |
*
|
|
1635 |
* Reply:
|
|
1636 |
*
|
|
1637 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
1638 |
* <header> total
|
|
1639 |
*
|
|
1640 |
*/
|
|
1641 |
/****************************************************************************/
|
|
1642 |
|
|
1643 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1644 |
#define DS_MIN_MSG_STOP_LENGTH (DS_MIN_MSG_LENGTH + 3)
|
|
1645 |
#else
|
|
1646 |
#define DS_MIN_MSG_STOP_LENGTH (DS_MIN_MSG_LENGTH + 2)
|
|
1647 |
#endif
|
|
1648 |
#define DS_MIN_REPLY_STOP_LENGTH DS_MIN_REPLY_LENGTH
|
|
1649 |
|
|
1650 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1651 |
|
|
1652 |
/*
|
|
1653 |
** The following option values are predefined. Desired
|
|
1654 |
** target-specific options can be added to the
|
|
1655 |
** DSTargMessageStopOptions enum (see msgtarg.h).
|
|
1656 |
*/
|
|
1657 |
|
|
1658 |
typedef enum {
|
|
1659 |
kDSStopSystem = 0x0, /* Stop the entire system */
|
|
1660 |
kDSStopProcess = 0x1, /* Stop all threads in a specific process */
|
|
1661 |
kDSStopThread = 0x2 /* Stop a specific thread in a specific process */
|
|
1662 |
} DSMessageStopOptions;
|
|
1663 |
|
|
1664 |
#endif
|
|
1665 |
|
|
1666 |
#if __MWERKS__
|
|
1667 |
#pragma mark SetBreak
|
|
1668 |
#endif /* __MWERKS__ */
|
|
1669 |
/****************************************************************************/
|
|
1670 |
/*
|
|
1671 |
* kDSSetBreak
|
|
1672 |
*
|
|
1673 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS
|
|
1674 |
*
|
|
1675 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
1676 |
* ui8 options - (1) DSMessageBreakOptions
|
|
1677 |
* ui8 targetOptions - (1) target-defined
|
|
1678 |
* ui32 address - (4) Start of breakpoint memory range
|
|
1679 |
* ui32 length - (4) Length of breakpoint memory range
|
|
1680 |
* ui32 count - (4) Only stop after triggered this many times (currently not used, set to 0)
|
|
1681 |
* <14 + header> total
|
|
1682 |
*
|
|
1683 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1684 |
*
|
|
1685 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
1686 |
* ui8 options - (1) DSMessageBreakOptions
|
|
1687 |
* ui8 targetOptions - (1) target-defined
|
|
1688 |
* ui32 address - (4) Start of breakpoint memory range
|
|
1689 |
* ui32 length - (4) Length of breakpoint memory range
|
|
1690 |
* ui32 processID - (4) unique process ID
|
|
1691 |
* ui32 threadID - (4) unique thread ID
|
|
1692 |
* ui32 count - (4) Only stop after triggered this many times (currently not used, set to 0)
|
|
1693 |
* <22 + header> total
|
|
1694 |
*
|
|
1695 |
* Reply:
|
|
1696 |
*
|
|
1697 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
1698 |
* ui32 id - (4) ID of the new breakpoint
|
|
1699 |
* <4 + header> total
|
|
1700 |
* Sent by the host. Sets a breakpoint at the specified location.
|
|
1701 |
* Replies with an ACK.
|
|
1702 |
*
|
|
1703 |
* For software execution breakpoints, the length field should be 1.
|
|
1704 |
*
|
|
1705 |
* Note: This command should not be implemented unless there is a
|
|
1706 |
* compelling reason to do so. In most cases, both software and
|
|
1707 |
* hardware breakpoints can be implemented via memory and register reads
|
|
1708 |
* and writes.
|
|
1709 |
*
|
|
1710 |
*
|
|
1711 |
*/
|
|
1712 |
/****************************************************************************/
|
|
1713 |
#define TRK_MSG_REPLY_HEADER_LENGTH (1 + TRK_MSG_HEADER_LENGTH) /* 1 addl bytes */
|
|
1714 |
#define TRK_MSG_REPLY_HEADER_COUNT (1 + TRK_MSG_HEADER_COUNT) /* 1 addl fields */
|
|
1715 |
|
|
1716 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
1717 |
|
|
1718 |
DESCDECL TrkMsgDesc gTrkMsgSetBreak
|
|
1719 |
#ifdef TRK_MSGCMD_INIT
|
|
1720 |
= {
|
|
1721 |
__debug_only_parm( "Set Breakpoint" )
|
|
1722 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
1723 |
22, /* # of addl bytes */
|
|
1724 |
7, /* # of addl fields */
|
|
1725 |
{ /* addl field descriptors: */
|
|
1726 |
__trk_msg_field( "options", 1 ),
|
|
1727 |
__trk_msg_field( "target options", 1 ),
|
|
1728 |
__trk_msg_field( "address", 4 ),
|
|
1729 |
__trk_msg_field( "length", 4 ),
|
|
1730 |
__trk_msg_field( "count", 4 ),
|
|
1731 |
__trk_msg_field( "process ID", 4 ),
|
|
1732 |
__trk_msg_field( "thread ID", 4 ),
|
|
1733 |
}
|
|
1734 |
}
|
|
1735 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
1736 |
;
|
|
1737 |
|
|
1738 |
#else /* #if DS_PROTOCOL == DS_PROTOCOL_RTOS */
|
|
1739 |
|
|
1740 |
DESCDECL TrkMsgDesc gTrkMsgSetBreak
|
|
1741 |
#ifdef TRK_MSGCMD_INIT
|
|
1742 |
= {
|
|
1743 |
__debug_only_parm( "Set Breakpoint" )
|
|
1744 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
1745 |
14, /* # of addl bytes */
|
|
1746 |
5, /* # of addl fields */
|
|
1747 |
{ /* addl field descriptors: */
|
|
1748 |
__trk_msg_field( "options", 1 ),
|
|
1749 |
__trk_msg_field( "target options", 1 ),
|
|
1750 |
__trk_msg_field( "address", 4 ),
|
|
1751 |
__trk_msg_field( "length", 4 ),
|
|
1752 |
__trk_msg_field( "count", 4 )
|
|
1753 |
}
|
|
1754 |
}
|
|
1755 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
1756 |
;
|
|
1757 |
|
|
1758 |
#endif /* #if DS_PROTOCOL == DS_PROTOCOL_RTOS */
|
|
1759 |
|
|
1760 |
/* field indices */
|
|
1761 |
#define TRK_MSG_SETBREAK_OPTIONS_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
1762 |
#define TRK_MSG_SETBREAK_TOPTIONS_INDEX (1 + TRK_MSG_HEADER_COUNT)
|
|
1763 |
#define TRK_MSG_SETBREAK_ADDRESS_INDEX (2 + TRK_MSG_HEADER_COUNT)
|
|
1764 |
#define TRK_MSG_SETBREAK_LENGTH_INDEX (3 + TRK_MSG_HEADER_COUNT)
|
|
1765 |
#define TRK_MSG_SETBREAK_COUNT_INDEX (4 + TRK_MSG_HEADER_COUNT)
|
|
1766 |
#define TRK_MSG_SETBREAK_PID_INDEX (5 + TRK_MSG_HEADER_COUNT)
|
|
1767 |
#define TRK_MSG_SETBREAK_TID_INDEX (6 + TRK_MSG_HEADER_COUNT)
|
|
1768 |
|
|
1769 |
DESCDECL TrkMsgDesc gTrkMsgSetBreakReply
|
|
1770 |
#ifdef TRK_MSGCMD_INIT
|
|
1771 |
= {
|
|
1772 |
__debug_only_parm( "Set Breakpoint Reply" )
|
|
1773 |
&gTrkMsgReplyHeader, /* previous fragment/header */
|
|
1774 |
4, /* # of addl bytes */
|
|
1775 |
1, /* # of addl fields */
|
|
1776 |
{ /* addl field descriptors: */
|
|
1777 |
__trk_msg_field( "breakpoint ID", 4 ),
|
|
1778 |
}
|
|
1779 |
}
|
|
1780 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
1781 |
;
|
|
1782 |
|
|
1783 |
/* "Index" of fields. Take # of header fields into account. */
|
|
1784 |
#define TRK_MSG_SETBREAKREPLY_BID_INDEX (0 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
1785 |
|
|
1786 |
#if __MWERKS__
|
|
1787 |
#pragma mark ClearBreak
|
|
1788 |
#endif /* __MWERKS__ */
|
|
1789 |
/****************************************************************************/
|
|
1790 |
/*
|
|
1791 |
* kDSClearBreak
|
|
1792 |
*
|
|
1793 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
1794 |
* ui32 id - (4) ID of the breakpoint to clear
|
|
1795 |
* <4 + header> total
|
|
1796 |
*
|
|
1797 |
* Reply:
|
|
1798 |
*
|
|
1799 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
1800 |
* <header> total
|
|
1801 |
*
|
|
1802 |
* Sent by the host. Clears the specified breakpoint. If the specified
|
|
1803 |
* id is DS_MSG_BREAK_ID_ALL, clears all breakpoints.
|
|
1804 |
*
|
|
1805 |
*/
|
|
1806 |
/****************************************************************************/
|
|
1807 |
DESCDECL TrkMsgDesc gTrkMsgClearBreak
|
|
1808 |
#ifdef TRK_MSGCMD_INIT
|
|
1809 |
= {
|
|
1810 |
__debug_only_parm( "Clear Breakpoint" )
|
|
1811 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
1812 |
8, /* # of addl bytes */
|
|
1813 |
2, /* # of addl fields */
|
|
1814 |
{ /* addl field descriptors: */
|
|
1815 |
__trk_msg_field( "breakpoint ID", 4 ),
|
|
1816 |
__trk_msg_field( "breakpoint Address", 4)
|
|
1817 |
}
|
|
1818 |
}
|
|
1819 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
1820 |
;
|
|
1821 |
|
|
1822 |
/* "Index" of fields. Take # of header fields into account. */
|
|
1823 |
#define TRK_MSG_CLEARBREAK_BID_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
1824 |
#define TRK_MSG_CLEARBREAK_BADDR_INDEX (1 + TRK_MSG_HEADER_COUNT)
|
|
1825 |
|
|
1826 |
/*
|
|
1827 |
** The following values should be logically OR'ed with one
|
|
1828 |
** of the DSMessageBreakOptions values to specify the
|
|
1829 |
** type of access which will cause the target program to
|
|
1830 |
** stop. More than one stop type can be specified.
|
|
1831 |
** the kDSSetBreak command will fail if one of the specified
|
|
1832 |
** conditions is not supported on the target, but there is
|
|
1833 |
** one exception:
|
|
1834 |
**
|
|
1835 |
** NOTE: If both the write and modify conditions are
|
|
1836 |
** specified, the kDSSetBreak command will succeed if
|
|
1837 |
** one of the two is supported.
|
|
1838 |
**
|
|
1839 |
*/
|
|
1840 |
|
|
1841 |
#define DS_MSG_BREAK_CONDITION_READ 0x10 /* stop on read access */
|
|
1842 |
#define DS_MSG_BREAK_CONDITION_WRITE 0x20 /* stop on write access */
|
|
1843 |
#define DS_MSG_BREAK_CONDITION_MODIFY 0x40 /* stop on modify access */
|
|
1844 |
#define DS_MSG_BREAK_CONDITION_EXECUTE 0x80 /* stop on execution */
|
|
1845 |
|
|
1846 |
/*
|
|
1847 |
** Use the following mask to extract the breakpoint condition flags
|
|
1848 |
** from the options.
|
|
1849 |
*/
|
|
1850 |
|
|
1851 |
#define DS_MSG_BREAK_CONDITION_MASK 0xf0
|
|
1852 |
|
|
1853 |
/*
|
|
1854 |
** The following option values are predefined. Desired
|
|
1855 |
** target-specific options can be added to the
|
|
1856 |
** DSTargMessageBreakOptions enum (see msgtarg.h).
|
|
1857 |
*/
|
|
1858 |
|
|
1859 |
typedef enum {
|
|
1860 |
kDSBreakSoftware = 0x00, /* Set a software breakpoint */
|
|
1861 |
kDSBreakHardware = 0x01, /* Set a hardware breakpoint */
|
|
1862 |
kDSBreakAuto = 0x02 /* Set a SW BP if possible, otherwise HW */
|
|
1863 |
} DSMessageBreakOptions;
|
|
1864 |
|
|
1865 |
/*
|
|
1866 |
** If the following is provided as the breakpoint ID in the kDSClearBreak
|
|
1867 |
** command, all breakpoints will be cleared.
|
|
1868 |
*/
|
|
1869 |
|
|
1870 |
#define DS_MSG_BREAK_ID_ALL 0xffffffff
|
|
1871 |
|
|
1872 |
/*
|
|
1873 |
** If the following is provided as the thread ID in the kDSSetBreak
|
|
1874 |
** command, the operation will apply to all threads in the process.
|
|
1875 |
*/
|
|
1876 |
|
|
1877 |
#define DS_MSG_BREAK_THREAD_ID_ALL 0xffffffff
|
|
1878 |
|
|
1879 |
#if __MWERKS__
|
|
1880 |
#pragma mark ModifyBreakThread
|
|
1881 |
#endif /* __MWERKS__ */
|
|
1882 |
/****************************************************************************/
|
|
1883 |
/*
|
|
1884 |
* kDSModifyBreakThread
|
|
1885 |
*
|
|
1886 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
1887 |
* ui32 id - (4) ID of the breakpoint to modify
|
|
1888 |
* ui32 threadID - (4) new thread ID
|
|
1889 |
* <8 + header> total
|
|
1890 |
*
|
|
1891 |
* Reply:
|
|
1892 |
*
|
|
1893 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
1894 |
* <header> total
|
|
1895 |
*
|
|
1896 |
* Sent by the host. Associates an existing breakpoint with the
|
|
1897 |
* specified thread. The thread ID can be for a specific thread or
|
|
1898 |
* it can be DS_MSG_BREAK_THREAD_ID_ALL.
|
|
1899 |
*
|
|
1900 |
* This command is only valid if DS_PROTOCOL == DS_PROTOCOL_RTOS.
|
|
1901 |
*
|
|
1902 |
*/
|
|
1903 |
/****************************************************************************/
|
|
1904 |
DESCDECL TrkMsgDesc gTrkMsgModifyBreakThread
|
|
1905 |
#ifdef TRK_MSGCMD_INIT
|
|
1906 |
= {
|
|
1907 |
__debug_only_parm( "Modify Breakpoint Thread" )
|
|
1908 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
1909 |
8, /* # of addl bytes */
|
|
1910 |
2, /* # of addl fields */
|
|
1911 |
{ /* addl field descriptors: */
|
|
1912 |
__trk_msg_field( "breakpoint ID", 4 ),
|
|
1913 |
__trk_msg_field( "thread ID", 4 )
|
|
1914 |
}
|
|
1915 |
}
|
|
1916 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
1917 |
;
|
|
1918 |
|
|
1919 |
/* "Index" of fields. Take # of header fields into account. */
|
|
1920 |
#define TRK_MSG_MBT_BID_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
1921 |
#define TRK_MSG_MBT_TID_INDEX (1 + TRK_MSG_HEADER_COUNT)
|
|
1922 |
|
|
1923 |
|
|
1924 |
#if __MWERKS__
|
|
1925 |
#pragma mark Download
|
|
1926 |
#endif /* __MWERKS__ */
|
|
1927 |
/****************************************************************************/
|
|
1928 |
/*
|
|
1929 |
* kDSDownload
|
|
1930 |
*
|
|
1931 |
* Send: if (DSMessageDownloadOptions == kDSMessageDownloadTFTP)
|
|
1932 |
*
|
|
1933 |
* ui8 command - (1) MessageCommandID
|
|
1934 |
* ui8 options - (1) DSMessageDownloadOptions (see below)
|
|
1935 |
* ui32 IP address - (4) IP address of the target system
|
|
1936 |
* ui32 TFTP address - (4) IP address of the TFTP server
|
|
1937 |
* ui32 length - (4) file size in bytes
|
|
1938 |
* ui32 start address - (4) load address of the file
|
|
1939 |
* ui16 name_length - (2) length of file name in bytes
|
|
1940 |
* ui8[] file name (0 - 2048) name of the file to download
|
|
1941 |
* <20 + name_length>
|
|
1942 |
*
|
|
1943 |
* Reply:
|
|
1944 |
*
|
|
1945 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
1946 |
* <header> total
|
|
1947 |
*
|
|
1948 |
* Sent by the host. Downloads a file to the target system according
|
|
1949 |
* to the specified parameters. This command is intended to allow
|
|
1950 |
* downloading via communication channels other than the TRK's command
|
|
1951 |
* channel.
|
|
1952 |
* Replies with an ACK.
|
|
1953 |
*
|
|
1954 |
*/
|
|
1955 |
/****************************************************************************/
|
|
1956 |
|
|
1957 |
#define DS_MIN_MSG_DOWNLOAD_LENGTH (DS_MIN_MSG_LENGTH + 19)
|
|
1958 |
#define DS_MIN_REPLY_CLEARBREAK_LENGTH DS_MIN_REPLY_LENGTH
|
|
1959 |
|
|
1960 |
/*
|
|
1961 |
** The following option values are predefined. Desired
|
|
1962 |
** target-specific options can be added to the
|
|
1963 |
** DSTargMessageDownloadOptions enum (see msgtarg.h).
|
|
1964 |
*/
|
|
1965 |
|
|
1966 |
typedef enum {
|
|
1967 |
kDSMessageDownloadTFTP = 0x0
|
|
1968 |
} DSMessageDownloadOptions;
|
|
1969 |
|
|
1970 |
#if __MWERKS__
|
|
1971 |
#pragma mark NotifyStopped
|
|
1972 |
#endif /* __MWERKS__ */
|
|
1973 |
/****************************************************************************/
|
|
1974 |
/*
|
|
1975 |
* kDSNotifyStopped
|
|
1976 |
*
|
|
1977 |
* Send:
|
|
1978 |
*
|
|
1979 |
* ui8 command - (1) MessageCommandID
|
|
1980 |
* target-defined info (PC, instr @PC, exception word)
|
|
1981 |
* <1 + target info> total
|
|
1982 |
*
|
|
1983 |
* Reply:
|
|
1984 |
*
|
|
1985 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
1986 |
* <header> total
|
|
1987 |
*
|
|
1988 |
* Sent by the target. This message will only be sent when the target
|
|
1989 |
* is executing (after a kDSContinue or kDSStep command). It indicates
|
|
1990 |
* that the target stopped running. On a bare-board system (no OS), this
|
|
1991 |
* typically means the target stopped due to an exception. The
|
|
1992 |
* target-defind info should provide additional details about why
|
|
1993 |
* the target stopped.
|
|
1994 |
* Expects an ACK in response.
|
|
1995 |
*
|
|
1996 |
*/
|
|
1997 |
/****************************************************************************/
|
|
1998 |
|
|
1999 |
#define DS_MIN_MSG_NOTIFYSTOPPED_LENGTH DS_MIN_MSG_LENGTH
|
|
2000 |
#define DS_MIN_REPLY_NOTIFYSTOPPED_LENGTH DS_MIN_REPLY_LENGTH
|
|
2001 |
|
|
2002 |
#if __MWERKS__
|
|
2003 |
#pragma mark NotifyInternalError
|
|
2004 |
#endif /* __MWERKS__ */
|
|
2005 |
/****************************************************************************/
|
|
2006 |
/*
|
|
2007 |
* kDSNotifyInternalError
|
|
2008 |
*
|
|
2009 |
* Send:
|
|
2010 |
*
|
|
2011 |
* ui8 command - (1) MessageCommandID
|
|
2012 |
* ui8 error code - (1) DSInternalError
|
|
2013 |
* <2> total
|
|
2014 |
*
|
|
2015 |
* Reply:
|
|
2016 |
*
|
|
2017 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
2018 |
* <header> total
|
|
2019 |
*
|
|
2020 |
* Sent by the target. It indicates that an internal error occurred
|
|
2021 |
* in MetroTRK.
|
|
2022 |
* Expects an ACK in response.
|
|
2023 |
*
|
|
2024 |
*/
|
|
2025 |
/****************************************************************************/
|
|
2026 |
|
|
2027 |
#define DS_MIN_MSG_NOTIFYINTERNALERROR_LENGTH (DS_MIN_MSG_LENGTH + 1)
|
|
2028 |
#define DS_MIN_REPLY_NOTIFYINTERNALERROR_LENGTH DS_MIN_REPLY_LENGTH
|
|
2029 |
|
|
2030 |
#if __MWERKS__
|
|
2031 |
#pragma mark OSNotifyCreated / OSNotifyDeleted
|
|
2032 |
#endif /* __MWERKS__ */
|
|
2033 |
/****************************************************************************/
|
|
2034 |
/*
|
|
2035 |
* kDSOSNotifyCreated / kDSOSNotifyDeleted
|
|
2036 |
*
|
|
2037 |
* Send:
|
|
2038 |
*
|
|
2039 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2040 |
* ui16 itemType - (2) DSOSItemTypes
|
|
2041 |
* target-defined info (e.g., process ID for kDSOSDLLItem)
|
|
2042 |
* <2 + header + target info> total
|
|
2043 |
*
|
|
2044 |
* Reply:
|
|
2045 |
*
|
|
2046 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
2047 |
* target-defined info (e.g., code & data offset for
|
|
2048 |
* kDSOSProcessItem)
|
|
2049 |
* <header + target info> total
|
|
2050 |
*
|
|
2051 |
* Sent by the target. This message indicates that an item of the
|
|
2052 |
* given type has been created/deleted.
|
|
2053 |
* Expects an ACK in response.
|
|
2054 |
*
|
|
2055 |
*/
|
|
2056 |
/****************************************************************************/
|
|
2057 |
|
|
2058 |
#if __MWERKS__
|
|
2059 |
#pragma mark OSCreateItem / OSDeleteItem Header
|
|
2060 |
#endif /* __MWERKS__ */
|
|
2061 |
/****************************************************************************/
|
|
2062 |
/*
|
|
2063 |
* kDSOSCreateItem / kDSOSDeleteItem
|
|
2064 |
*
|
|
2065 |
* Send:
|
|
2066 |
*
|
|
2067 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2068 |
* ui16 itemType - (2) DSOSItemTypes
|
|
2069 |
* target-defined info (e.g., DLL name for kDSOSDLLItem)
|
|
2070 |
* <2 + header + target info> total
|
|
2071 |
*
|
|
2072 |
* Reply
|
|
2073 |
*
|
|
2074 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
2075 |
* target-defined info (e.g., code & data offset for
|
|
2076 |
* kDSOSProcessItem)
|
|
2077 |
* <header + target info> total
|
|
2078 |
*
|
|
2079 |
* Sent by the host. Creates/deletes an item of the specified type in
|
|
2080 |
* the system. It allows the host to create/delete processes (load),
|
|
2081 |
* threads, DLL's, and any other system resources. This command may
|
|
2082 |
* either operate synchronously or asynchronously. The behavior may be
|
|
2083 |
* differ on an item-by-item basis. The two scenarios:
|
|
2084 |
*
|
|
2085 |
* synchronous: The host sends a OSCreateItem/OSDeleteItem command.
|
|
2086 |
* The target system creates the item and then replies with an
|
|
2087 |
* ACK containing specific information about the
|
|
2088 |
* created/deleted item.
|
|
2089 |
*
|
|
2090 |
* asynchronous: The host sends a OSCreateItem/OSDeleteItem command.
|
|
2091 |
* The target system queues the request and replies with
|
|
2092 |
* an ACK. At some later time, when the item is
|
|
2093 |
* actually created/deleted, the target system sends an
|
|
2094 |
* OSNotifyCreated/OSNotifyDeleted message to the host
|
|
2095 |
* containing specific information about the created/deleted
|
|
2096 |
* item.
|
|
2097 |
*
|
|
2098 |
* Expects an ACK in response. The reply may contain specific
|
|
2099 |
* information about the created/deleted item, such as code and data
|
|
2100 |
* offsets for relocatable processes (if the operation is
|
|
2101 |
* synchronous).
|
|
2102 |
*
|
|
2103 |
*/
|
|
2104 |
/****************************************************************************/
|
|
2105 |
|
|
2106 |
#define TRK_MSG_ITEM_HEADER_LENGTH (2 + TRK_MSG_HEADER_LENGTH) /* 2 addl bytes */
|
|
2107 |
#define TRK_MSG_ITEM_HEADER_COUNT (1 + TRK_MSG_HEADER_COUNT) /* 1 addl fields */
|
|
2108 |
|
|
2109 |
DESCDECL TrkMsgDesc gTrkMsgItemHeader
|
|
2110 |
#ifdef TRK_MSGCMD_INIT
|
|
2111 |
= {
|
|
2112 |
__debug_only_parm( "Item Header" )
|
|
2113 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
2114 |
2, /* # of addl bytes */
|
|
2115 |
1, /* # of addl fields */
|
|
2116 |
{ /* addl field descriptors: */
|
|
2117 |
__trk_msg_field( "item type", 2 )
|
|
2118 |
}
|
|
2119 |
}
|
|
2120 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2121 |
;
|
|
2122 |
|
|
2123 |
#define TRK_MSG_ITEM_HEADER_TYPE_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
2124 |
|
|
2125 |
|
|
2126 |
/*
|
|
2127 |
** The following option values are predefined. Desired
|
|
2128 |
** target-specific options can be added to the
|
|
2129 |
** DSTargOSItemTypes enum (see msgtarg.h).
|
|
2130 |
*/
|
|
2131 |
|
|
2132 |
typedef enum {
|
|
2133 |
kDSOSProcessItem = 0x0000,
|
|
2134 |
kDSOSThreadItem = 0x0001,
|
|
2135 |
kDSOSDLLItem = 0x0002,
|
|
2136 |
kDSOSAppItem = 0x0003,
|
|
2137 |
kDSOSMemBlockItem = 0x0004,
|
|
2138 |
kDSOSProcAttachItem = 0x0005,
|
|
2139 |
kDSOSThreadAttachItem = 0x0006,
|
|
2140 |
kDSOSProcAttach2Item = 0x0007,
|
|
2141 |
kDSOSProcRunItem = 0x0008,
|
|
2142 |
kDSOSProcAttach3Item = 0x0009
|
|
2143 |
/* 0x0009 - 0x00ff reserved for general expansion */
|
|
2144 |
/* 0x0100 - 0xffff available for target-specific use */
|
|
2145 |
} DSOSItemTypes;
|
|
2146 |
|
|
2147 |
#if __MWERKS__
|
|
2148 |
#pragma mark OSReadInfo / OSWriteInfo Header
|
|
2149 |
#endif /* __MWERKS__ */
|
|
2150 |
/****************************************************************************/
|
|
2151 |
/*
|
|
2152 |
* kDSOSReadInfo / KDSOSWriteInfo (Common Header)
|
|
2153 |
*
|
|
2154 |
* Send:
|
|
2155 |
*
|
|
2156 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2157 |
* ui16 infoType - (2) DSOSInfoTypes
|
|
2158 |
* target-defined info (e.g., process ID for
|
|
2159 |
* kDSOSProcessStateInfo)
|
|
2160 |
* <2 + header + target info> total
|
|
2161 |
*
|
|
2162 |
* Reply
|
|
2163 |
*
|
|
2164 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
2165 |
* target-defined info (e.g., process state for
|
|
2166 |
* kDSOSProcessStateInfo)
|
|
2167 |
* <header + target info> total
|
|
2168 |
*
|
|
2169 |
* Sent by the host. Reads/writes the requested info from/to the
|
|
2170 |
* target system. It allows the host to get/set information about the
|
|
2171 |
* internal system state. For ReadInfo, there are additional fields
|
|
2172 |
* specified in a secondary header (see below).
|
|
2173 |
*
|
|
2174 |
*/
|
|
2175 |
/****************************************************************************/
|
|
2176 |
|
|
2177 |
#define TRK_MSG_INFO_HEADER_LENGTH (2 + TRK_MSG_HEADER_LENGTH) /* 2 addl bytes */
|
|
2178 |
#define TRK_MSG_INFO_HEADER_COUNT (1 + TRK_MSG_HEADER_COUNT) /* 1 addl fields */
|
|
2179 |
|
|
2180 |
DESCDECL TrkMsgDesc gTrkMsgInfoHeader
|
|
2181 |
#ifdef TRK_MSGCMD_INIT
|
|
2182 |
= {
|
|
2183 |
__debug_only_parm( "Info Header" )
|
|
2184 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
2185 |
2, /* # of addl bytes */
|
|
2186 |
1, /* # of addl fields */
|
|
2187 |
{ /* addl field descriptors: */
|
|
2188 |
__trk_msg_field( "info type", 2 )
|
|
2189 |
}
|
|
2190 |
}
|
|
2191 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2192 |
;
|
|
2193 |
|
|
2194 |
#define TRK_MSG_INFO_HEADER_TYPE_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
2195 |
|
|
2196 |
/*
|
|
2197 |
** The following option values are predefined. Desired
|
|
2198 |
** target-specific options can be added to the
|
|
2199 |
** DSTargOSInfoTypes enum (see msgtarg.h).
|
|
2200 |
*/
|
|
2201 |
|
|
2202 |
typedef enum {
|
|
2203 |
kDSOSProcessList = 0x0000,
|
|
2204 |
kDSOSProcessState = 0x0001,
|
|
2205 |
kDSOSThreadList = 0x0002,
|
|
2206 |
kDSOSThreadState = 0x0003,
|
|
2207 |
kDSOSDLLList = 0x0004,
|
|
2208 |
kDSOSDLLState = 0x0005,
|
|
2209 |
kDSOSDLLInfo = 0x0006,
|
|
2210 |
kDSOSProcessInfo = 0x0007,
|
|
2211 |
/* 0x0008 - 0x00ff reserved for expansion */
|
|
2212 |
/* 0x0100 - 0xffff available for target-specific use */
|
|
2213 |
} DSOSInfoTypes;
|
|
2214 |
|
|
2215 |
#if __MWERKS__
|
|
2216 |
#pragma mark OSReadInfo Header
|
|
2217 |
#endif /* __MWERKS__ */
|
|
2218 |
/****************************************************************************/
|
|
2219 |
/*
|
|
2220 |
* kDSOSReadInfo (header)
|
|
2221 |
*
|
|
2222 |
* Send:
|
|
2223 |
*
|
|
2224 |
* .... <Info Header> ... (see gTrkMsgInfoHeader)
|
|
2225 |
* ui32 startIndex - (4) starting index of returned info
|
|
2226 |
* target-defined info (e.g., process ID for
|
|
2227 |
* kDSOSProcessStateInfo)
|
|
2228 |
* <4 + header + target info> total
|
|
2229 |
*
|
|
2230 |
* Reply:
|
|
2231 |
*
|
|
2232 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
2233 |
* ui32 returnedCount - (4) # of items in this reply
|
|
2234 |
* ui32 totalCount - (4) total # of items in complete response
|
|
2235 |
* target-defined info (e.g., process state for
|
|
2236 |
* kDSOSProcessStateInfo)
|
|
2237 |
* <8 + header + target info> total
|
|
2238 |
*
|
|
2239 |
*
|
|
2240 |
* This is the header to be used by all kDSReadInfo requests. The
|
|
2241 |
* complete info may not fit in a single MetroTRK message, so it is
|
|
2242 |
* possible to read the info in segments. When reading the info, the
|
|
2243 |
* startIndex should be 0 the first time. If, in the reply,
|
|
2244 |
* totalCount > (startIndex + returnedCount), then the next segment of
|
|
2245 |
* the info can be read by sending another request with the new
|
|
2246 |
* startIndex set to the previous (startIndex + returnedCount).
|
|
2247 |
*
|
|
2248 |
* startIndex, returnedCount, and totalCount all refer to the number of
|
|
2249 |
* "items" (the definition of which depends on the info type), not
|
|
2250 |
* necessarily the number of bytes.
|
|
2251 |
*
|
|
2252 |
*/
|
|
2253 |
/****************************************************************************/
|
|
2254 |
#define TRK_MSG_RI_HEADER_LENGTH (4 + TRK_MSG_INFO_HEADER_LENGTH) /* 4 addl bytes */
|
|
2255 |
#define TRK_MSG_RI_HEADER_COUNT (1 + TRK_MSG_INFO_HEADER_COUNT) /* 1 addl fields */
|
|
2256 |
|
|
2257 |
|
|
2258 |
DESCDECL TrkMsgDesc gTrkMsgReadInfoHeader
|
|
2259 |
#ifdef TRK_MSGCMD_INIT
|
|
2260 |
= {
|
|
2261 |
__debug_only_parm( "Read Info Header" )
|
|
2262 |
&gTrkMsgInfoHeader, /* previous fragment/header */
|
|
2263 |
4, /* # of addl bytes */
|
|
2264 |
1, /* # of addl fields */
|
|
2265 |
{ /* addl field descriptors: */
|
|
2266 |
__trk_msg_field( "start index", 4 )
|
|
2267 |
}
|
|
2268 |
}
|
|
2269 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2270 |
;
|
|
2271 |
|
|
2272 |
/* "Index" of fields. Take # of header fields into account. */
|
|
2273 |
#define TRK_MSG_RI_HEADER_START_INDEX (0 + TRK_MSG_INFO_HEADER_COUNT)
|
|
2274 |
|
|
2275 |
|
|
2276 |
#define TRK_MSG_RIR_HEADER_LENGTH (8 + TRK_MSG_REPLY_HEADER_LENGTH) /* 4 addl bytes */
|
|
2277 |
#define TRK_MSG_RIR_HEADER_COUNT (2 + TRK_MSG_REPLY_HEADER_COUNT) /* 1 addl fields */
|
|
2278 |
|
|
2279 |
DESCDECL TrkMsgDesc gTrkMsgReadInfoReplyHeader
|
|
2280 |
#ifdef TRK_MSGCMD_INIT
|
|
2281 |
= {
|
|
2282 |
__debug_only_parm( "Read Info Reply Header" )
|
|
2283 |
&gTrkMsgReplyHeader, /* previous fragment/header */
|
|
2284 |
8, /* # of addl bytes */
|
|
2285 |
2, /* # of addl fields */
|
|
2286 |
{ /* addl field descriptors: */
|
|
2287 |
__trk_msg_field( "returned count", 4 ),
|
|
2288 |
__trk_msg_field( "total count", 4 )
|
|
2289 |
}
|
|
2290 |
}
|
|
2291 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2292 |
;
|
|
2293 |
|
|
2294 |
/* "Index" of fields. Take # of header fields into account. */
|
|
2295 |
#define TRK_MSG_RIR_HEADER_RETURNED_INDEX (0 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
2296 |
#define TRK_MSG_RIR_HEADER_TOTAL_INDEX (1 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
2297 |
|
|
2298 |
|
|
2299 |
#if __MWERKS__
|
|
2300 |
#pragma mark WriteFile
|
|
2301 |
#endif /* __MWERKS__ */
|
|
2302 |
/****************************************************************************/
|
|
2303 |
/*
|
|
2304 |
* kDSWriteFile
|
|
2305 |
*
|
|
2306 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS
|
|
2307 |
*
|
|
2308 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2309 |
* ui32 file_handle - (4) DSFileHandles (see below)
|
|
2310 |
* ui16 length - (2) file data length in bytes
|
|
2311 |
* file data - (0 to 2048)
|
|
2312 |
* <6 + length + header> total
|
|
2313 |
*
|
|
2314 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
2315 |
*
|
|
2316 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2317 |
* ui32 file_handle - (4) DSFileHandles (see below)
|
|
2318 |
* ui16 length - (2) file data length in bytes
|
|
2319 |
* ui32 processID - (4) unique process ID
|
|
2320 |
* ui32 threadID - (4) unique thread ID
|
|
2321 |
* file data - (0 to 2048)
|
|
2322 |
* <14 + length + header> total
|
|
2323 |
*
|
|
2324 |
* Reply:
|
|
2325 |
*
|
|
2326 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
2327 |
* ui8 io_result - (1) DSIOResult (see below)
|
|
2328 |
* ui16 length - (2) amount that was written in bytes
|
|
2329 |
* <3 + header> total
|
|
2330 |
*
|
|
2331 |
* kDSWriteFile: Sent by the target. Instructs the host to write the
|
|
2332 |
* specified data to the file with the given handle. Assumes that stdout
|
|
2333 |
* and stderr are always open for writing.
|
|
2334 |
* Expects a reply from the host in the above format.
|
|
2335 |
*
|
|
2336 |
* Note: The startup welcome message is sent as a kDSWriteFile
|
|
2337 |
* message, but it is a special case and does not require a reply.
|
|
2338 |
*
|
|
2339 |
*/
|
|
2340 |
/****************************************************************************/
|
|
2341 |
|
|
2342 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
2343 |
#define DS_MIN_MSG_WRITEFILE_LENGTH (DS_MIN_MSG_LENGTH + 14)
|
|
2344 |
#else
|
|
2345 |
#define DS_MIN_MSG_WRITEFILE_LENGTH (DS_MIN_MSG_LENGTH + 6)
|
|
2346 |
#endif
|
|
2347 |
#define DS_MIN_REPLY_WRITEFILE_LENGTH (DS_MIN_REPLY_LENGTH + 3)
|
|
2348 |
|
|
2349 |
#if __MWERKS__
|
|
2350 |
#pragma mark ReadFile
|
|
2351 |
#endif /* __MWERKS__ */
|
|
2352 |
/****************************************************************************/
|
|
2353 |
/*
|
|
2354 |
* kDSReadFile
|
|
2355 |
*
|
|
2356 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS
|
|
2357 |
*
|
|
2358 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2359 |
* ui32 file_handle - (4) DSFileHandles (see below)
|
|
2360 |
* ui16 length - (2) file data length in bytes
|
|
2361 |
* <6 + header> total
|
|
2362 |
*
|
|
2363 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
2364 |
*
|
|
2365 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2366 |
* ui32 file_handle - (4) DSFileHandles (see below)
|
|
2367 |
* ui16 length - (2) file data length in bytes
|
|
2368 |
* ui32 processID - (4) unique process ID
|
|
2369 |
* ui32 threadID - (4) unique thread ID
|
|
2370 |
* <14 + header> total
|
|
2371 |
*
|
|
2372 |
* Reply:
|
|
2373 |
*
|
|
2374 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
2375 |
* ui8 io_result - (1) DSIOResult (see below)
|
|
2376 |
* ui16 length - (2) amount that was read in bytes
|
|
2377 |
* file data - (0 to 2048)
|
|
2378 |
* <3 + length + header> total
|
|
2379 |
*
|
|
2380 |
* Sent by the target. Instructs the host to read the specified
|
|
2381 |
* amount of data from the file with the given handle. Assumes
|
|
2382 |
* that stdin is always open for reading.
|
|
2383 |
* Expects a reply from the host in the above format.
|
|
2384 |
*/
|
|
2385 |
/****************************************************************************/
|
|
2386 |
|
|
2387 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
2388 |
#define DS_MIN_MSG_READFILE_LENGTH (DS_MIN_MSG_LENGTH + 14)
|
|
2389 |
#else
|
|
2390 |
#define DS_MIN_MSG_READFILE_LENGTH (DS_MIN_MSG_LENGTH + 6)
|
|
2391 |
#endif
|
|
2392 |
#define DS_MIN_REPLY_READFILE_LENGTH (DS_MIN_REPLY_LENGTH + 3)
|
|
2393 |
|
|
2394 |
#if __MWERKS__
|
|
2395 |
#pragma mark NotifyFileInput
|
|
2396 |
#endif /* __MWERKS__ */
|
|
2397 |
/****************************************************************************/
|
|
2398 |
/*
|
|
2399 |
* kDSNotifyFileInput
|
|
2400 |
*
|
|
2401 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS
|
|
2402 |
*
|
|
2403 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2404 |
* ui32 file_handle - (4) DSFileHandles (see below)
|
|
2405 |
* <4 + header> total
|
|
2406 |
*
|
|
2407 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
2408 |
*
|
|
2409 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2410 |
* ui32 file_handle - (4) DSFileHandles (see below)
|
|
2411 |
* ui32 processID - (4) unique process ID
|
|
2412 |
* ui32 threadID - (4) unique thread ID
|
|
2413 |
* <12 + header> total
|
|
2414 |
*
|
|
2415 |
* Reply:
|
|
2416 |
*
|
|
2417 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
2418 |
* <header> total
|
|
2419 |
*
|
|
2420 |
* Sent by the host. Notifies MetroTRK that new input is available for
|
|
2421 |
* the given file. This is intended to be used for stdin, but can be
|
|
2422 |
* used for other files as well.
|
|
2423 |
*
|
|
2424 |
*/
|
|
2425 |
/****************************************************************************/
|
|
2426 |
|
|
2427 |
/*** kDSNotifyFileInput ***/
|
|
2428 |
|
|
2429 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
2430 |
|
|
2431 |
DESCDECL TrkMsgDesc gTrkMsgNotifyFileInput
|
|
2432 |
#ifdef TRK_MSGCMD_INIT
|
|
2433 |
= {
|
|
2434 |
__debug_only_parm( "Notify File Input" )
|
|
2435 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
2436 |
12, /* # of addl bytes */
|
|
2437 |
3, /* # of addl fields */
|
|
2438 |
{ /* addl field descriptors: */
|
|
2439 |
__trk_msg_field( "file handle", 4 ),
|
|
2440 |
__trk_msg_field( "process ID", 4 ),
|
|
2441 |
__trk_msg_field( "thread ID", 4 )
|
|
2442 |
}
|
|
2443 |
}
|
|
2444 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2445 |
;
|
|
2446 |
|
|
2447 |
#else /* #if DS_PROTOCOL == DS_PROTOCOL_RTOS */
|
|
2448 |
|
|
2449 |
DESCDECL TrkMsgDesc gTrkMsgNotifyFileInput
|
|
2450 |
#ifdef TRK_MSGCMD_INIT
|
|
2451 |
= {
|
|
2452 |
__debug_only_parm( "Notify File Input" )
|
|
2453 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
2454 |
4, /* # of addl bytes */
|
|
2455 |
1, /* # of addl fields */
|
|
2456 |
{ /* addl field descriptors: */
|
|
2457 |
__trk_msg_field( "file handle", 4 )
|
|
2458 |
}
|
|
2459 |
}
|
|
2460 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2461 |
;
|
|
2462 |
|
|
2463 |
#endif /* #if DS_PROTOCOL == DS_PROTOCOL_RTOS */
|
|
2464 |
|
|
2465 |
/* "Index" of fields. Take # of header fields into account. */
|
|
2466 |
#define TRK_MSG_NFI_HANDLE_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
2467 |
#define TRK_MSG_NFI_PID_INDEX (1 + TRK_MSG_HEADER_COUNT)
|
|
2468 |
#define TRK_MSG_NFI_TID_INDEX (2 + TRK_MSG_HEADER_COUNT)
|
|
2469 |
|
|
2470 |
|
|
2471 |
#if __MWERKS__
|
|
2472 |
#pragma mark BlockFileIo
|
|
2473 |
#endif /* __MWERKS__ */
|
|
2474 |
/****************************************************************************/
|
|
2475 |
/*
|
|
2476 |
* kDSBlockFileIo
|
|
2477 |
*
|
|
2478 |
* Send:
|
|
2479 |
*
|
|
2480 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2481 |
* ui8 block - (1) if 0, OK to send file IO requests, otherwise no
|
|
2482 |
* <1 + header> total
|
|
2483 |
*
|
|
2484 |
* Reply:
|
|
2485 |
*
|
|
2486 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
2487 |
* <header> total
|
|
2488 |
*
|
|
2489 |
* Sent by the host. Blocks/unblocks all file IO requests from the target.
|
|
2490 |
* If the host becomes overwhelmed with file IO processing, it can send this
|
|
2491 |
* message with a block value of 1. When it is able to handle more file IO
|
|
2492 |
* requests it can send this message again with a block value of 0. This
|
|
2493 |
* affects target->host IO requests from all files on all processes and threads.
|
|
2494 |
*
|
|
2495 |
*/
|
|
2496 |
/****************************************************************************/
|
|
2497 |
|
|
2498 |
/*** kDSBlockFileIo ***/
|
|
2499 |
|
|
2500 |
DESCDECL TrkMsgDesc gTrkMsgBlockFileIo
|
|
2501 |
#ifdef TRK_MSGCMD_INIT
|
|
2502 |
= {
|
|
2503 |
__debug_only_parm( "Block File IO" )
|
|
2504 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
2505 |
1, /* # of addl bytes */
|
|
2506 |
1, /* # of addl fields */
|
|
2507 |
{ /* addl field descriptors: */
|
|
2508 |
__trk_msg_field( "block", 1 )
|
|
2509 |
}
|
|
2510 |
}
|
|
2511 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2512 |
;
|
|
2513 |
|
|
2514 |
|
|
2515 |
/* "Index" of fields. Take # of header fields into account. */
|
|
2516 |
#define TRK_MSG_BFIO_BLOCK_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
2517 |
|
|
2518 |
|
|
2519 |
#if __MWERKS__
|
|
2520 |
#pragma mark OpenFile
|
|
2521 |
#endif /* __MWERKS__ */
|
|
2522 |
/****************************************************************************/
|
|
2523 |
/*
|
|
2524 |
* kDSOpenFile
|
|
2525 |
*
|
|
2526 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS
|
|
2527 |
*
|
|
2528 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2529 |
* ui8 modes - (1) DSFileOpenModes (see below)
|
|
2530 |
* ui16 name_length - (2) file name length in bytes
|
|
2531 |
* ui8[] file_name - (0 to 2048) file name (no string
|
|
2532 |
* terminator)
|
|
2533 |
* <3 + name_length + header> total
|
|
2534 |
*
|
|
2535 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
2536 |
*
|
|
2537 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2538 |
* ui8 modes - (1) DSFileOpenModes (see below)
|
|
2539 |
* ui16 name_length - (2) file name length in bytes
|
|
2540 |
* ui32 processID - (4) unique process ID
|
|
2541 |
* ui32 threadID - (4) unique thread ID
|
|
2542 |
* ui8[] file_name - (0 to 2048) file name (no string
|
|
2543 |
* terminator)
|
|
2544 |
* <11 + name_length + header> total
|
|
2545 |
*
|
|
2546 |
* Reply:
|
|
2547 |
*
|
|
2548 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
2549 |
* ui8 io_result - (1) DSIOResult (see below)
|
|
2550 |
* ui32 file_handle - (4) handle of the newly opened file
|
|
2551 |
* ui32 timestamp - (4) timestamp of file on open (replyer-dependent format)
|
|
2552 |
* <9 + header> total
|
|
2553 |
*
|
|
2554 |
* Sent by the target. Instructs the host to open a file with the
|
|
2555 |
* given name and modes. The resulting file_handle can then be
|
|
2556 |
* used by kDSWriteFile, kDSReadFile, kDSCloseFile, and kDSPositionFile.
|
|
2557 |
* Expects a reply from the host in the above format.
|
|
2558 |
*
|
|
2559 |
*/
|
|
2560 |
/****************************************************************************/
|
|
2561 |
|
|
2562 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
2563 |
#define DS_MIN_MSG_OPENFILE_LENGTH (DS_MIN_MSG_LENGTH + 11)
|
|
2564 |
#else
|
|
2565 |
#define DS_MIN_MSG_OPENFILE_LENGTH (DS_MIN_MSG_LENGTH + 3)
|
|
2566 |
#endif
|
|
2567 |
#define DS_MIN_REPLY_OPENFILE_LENGTH (DS_MIN_REPLY_LENGTH + 5)
|
|
2568 |
|
|
2569 |
#if __MWERKS__
|
|
2570 |
#pragma mark CloseFile
|
|
2571 |
#endif /* __MWERKS__ */
|
|
2572 |
/****************************************************************************/
|
|
2573 |
/*
|
|
2574 |
* kDSCloseFile
|
|
2575 |
*
|
|
2576 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS
|
|
2577 |
*
|
|
2578 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2579 |
* ui32 file_handle - (4) handle of the file to be closed
|
|
2580 |
* ui32 timestamp - (4) new timestamp value to be set for the file (receiver-dependent format)
|
|
2581 |
* <8 + header> total
|
|
2582 |
*
|
|
2583 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
2584 |
*
|
|
2585 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2586 |
* ui32 file_handle - (4) handle of the file to be closed
|
|
2587 |
* ui32 timestamp - (4) new timestamp value to be set for the file (receiver-dependent format)
|
|
2588 |
* ui32 processID - (4) unique process ID
|
|
2589 |
* ui32 threadID - (4) unique thread ID
|
|
2590 |
* <16 + header> total
|
|
2591 |
*
|
|
2592 |
* Reply:
|
|
2593 |
*
|
|
2594 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
2595 |
* ui8 io_result - (1) DSIOResult (see below)
|
|
2596 |
* <1 + header> total
|
|
2597 |
*
|
|
2598 |
* Sent by the target. Instructs the host to close the file with the
|
|
2599 |
* specified file_handle. Note: the timestamp value will only affect
|
|
2600 |
* the file if it was opened in write mode.
|
|
2601 |
* Expects a reply from the host in the above format.
|
|
2602 |
*
|
|
2603 |
*/
|
|
2604 |
/****************************************************************************/
|
|
2605 |
|
|
2606 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
2607 |
#define DS_MIN_MSG_CLOSEFILE_LENGTH (DS_MIN_MSG_LENGTH + 16)
|
|
2608 |
#else
|
|
2609 |
#define DS_MIN_MSG_CLOSEFILE_LENGTH (DS_MIN_MSG_LENGTH + 8)
|
|
2610 |
#endif
|
|
2611 |
#define DS_MIN_REPLY_CLOSEFILE_LENGTH (DS_MIN_REPLY_LENGTH + 1)
|
|
2612 |
|
|
2613 |
#if __MWERKS__
|
|
2614 |
#pragma mark PositionFile
|
|
2615 |
#endif /* __MWERKS__ */
|
|
2616 |
/****************************************************************************/
|
|
2617 |
/*
|
|
2618 |
* kDSPositionFile
|
|
2619 |
*
|
|
2620 |
* Send: if DS_PROTOCOL < DS_PROTOCOL_RTOS
|
|
2621 |
*
|
|
2622 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2623 |
* ui8 mode - (1) DSFilePositionModes (see below)
|
|
2624 |
* ui32 file_handle - (4) handle of the file to be positioned
|
|
2625 |
* ui32 offset - (4) position offset
|
|
2626 |
* <9 + header> total
|
|
2627 |
*
|
|
2628 |
* Send: if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
2629 |
*
|
|
2630 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
2631 |
* ui8 mode - (1) DSFilePositionModes (see below)
|
|
2632 |
* ui32 file_handle - (4) handle of the file to be positioned
|
|
2633 |
* ui32 offset - (4) position offset
|
|
2634 |
* ui32 processID - (4) unique process ID
|
|
2635 |
* ui32 threadID - (4) unique thread ID
|
|
2636 |
* <17 + header> total
|
|
2637 |
*
|
|
2638 |
* Reply:
|
|
2639 |
*
|
|
2640 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
2641 |
* ui8 io_result - (1) DSIOResult (see below)
|
|
2642 |
* <1 + header> total
|
|
2643 |
*
|
|
2644 |
* Sent by the target. Instructs the host to set the file position
|
|
2645 |
* of the specified file. The new position will be at the specified
|
|
2646 |
* offset from one of three reference points in the file, as specified
|
|
2647 |
* by the mode.
|
|
2648 |
* Expects a reply from the host in the above format.
|
|
2649 |
*
|
|
2650 |
*/
|
|
2651 |
/****************************************************************************/
|
|
2652 |
|
|
2653 |
#if DS_PROTOCOL == DS_PROTOCOL_RTOS
|
|
2654 |
#define DS_MIN_MSG_POSITIONFILE_LENGTH (DS_MIN_MSG_LENGTH + 13)
|
|
2655 |
#else
|
|
2656 |
#define DS_MIN_MSG_POSITIONFILE_LENGTH (DS_MIN_MSG_LENGTH + 5)
|
|
2657 |
#endif
|
|
2658 |
#define DS_MIN_REPLY_POSITIONFILE_LENGTH (DS_MIN_REPLY_LENGTH + 1)
|
|
2659 |
|
|
2660 |
/*
|
|
2661 |
** These are the predefined file handles. Additional files may
|
|
2662 |
** be opened via the kDSOpenFile command. New file handles
|
|
2663 |
** returned by that command may be used in addition to the
|
|
2664 |
** ones defined here.
|
|
2665 |
*/
|
|
2666 |
|
|
2667 |
typedef enum DSFileHandle
|
|
2668 |
{
|
|
2669 |
kDSStdin = 0x00,
|
|
2670 |
kDSStdout = 0x01,
|
|
2671 |
kDSStderr = 0x02
|
|
2672 |
} DSFileHandle;
|
|
2673 |
|
|
2674 |
/*
|
|
2675 |
** The result of an I/O command can be any one of the following.
|
|
2676 |
*/
|
|
2677 |
|
|
2678 |
typedef enum DSIOResult
|
|
2679 |
{
|
|
2680 |
kDSIONoError = 0x00,
|
|
2681 |
kDSIOError = 0x01,
|
|
2682 |
kDSIOEOF = 0x02
|
|
2683 |
} DSIOResult;
|
|
2684 |
|
|
2685 |
/*
|
|
2686 |
** When opening a file, the following values can be OR'ed together
|
|
2687 |
** to specify the desired open modes. The following table shows
|
|
2688 |
** the correlation between the various modes and the standard mode
|
|
2689 |
** option for fopen:
|
|
2690 |
**
|
|
2691 |
** read write append binary create fopen mode
|
|
2692 |
** -------------------------------------------------------
|
|
2693 |
** yes "r"
|
|
2694 |
** yes* yes "w"
|
|
2695 |
** yes* yes yes "a"
|
|
2696 |
** yes yes "r+"
|
|
2697 |
** yes yes* yes "w+"
|
|
2698 |
** yes yes* yes yes "a+"
|
|
2699 |
** yes yes "rb"
|
|
2700 |
** yes* yes yes "wb"
|
|
2701 |
** yes* yes yes yes "ab"
|
|
2702 |
** yes yes yes "r+b"
|
|
2703 |
** yes yes* yes yes "w+b"
|
|
2704 |
** yes yes* yes yes yes "a+b"
|
|
2705 |
**
|
|
2706 |
**
|
|
2707 |
** * Note that when the append or create modes are specified,
|
|
2708 |
** the write mode is always assumed.
|
|
2709 |
**
|
|
2710 |
** If the exec mode is specified, the resulting file will
|
|
2711 |
** be created as an executable file (with execute permissions).
|
|
2712 |
** This is only meaningful if the create mode is also specified.
|
|
2713 |
*/
|
|
2714 |
|
|
2715 |
typedef enum DSFileOpenModes
|
|
2716 |
{
|
|
2717 |
kDSFileOpenRead = 0x01,
|
|
2718 |
kDSFileOpenWrite = 0x02,
|
|
2719 |
kDSFileOpenAppend = 0x04,
|
|
2720 |
kDSFileOpenBinary = 0x08,
|
|
2721 |
kDSFileOpenCreate = 0x10,
|
|
2722 |
kDSFileOpenExec = 0x20
|
|
2723 |
} DSFileOpenModes;
|
|
2724 |
|
|
2725 |
/*
|
|
2726 |
** Use one of the following values to specify a file positioning mode.
|
|
2727 |
*/
|
|
2728 |
|
|
2729 |
typedef enum DSFilePositionModes
|
|
2730 |
{
|
|
2731 |
kDSFileSeekSet = 0x00, /* Position is offset from file start */
|
|
2732 |
kDSFileSeekCur = 0x01, /* Position is offset from current pos. */
|
|
2733 |
kDSFileSeekEnd = 0x02 /* Position is offset from file end */
|
|
2734 |
} DSFilePositionModes;
|
|
2735 |
|
|
2736 |
#if __MWERKS__
|
|
2737 |
#pragma mark OS File Operations
|
|
2738 |
#endif /* __MWERKS__ */
|
|
2739 |
/****************************************************************************/
|
|
2740 |
/*
|
|
2741 |
* kDSOSWriteFile
|
|
2742 |
* kDSOSReadFile
|
|
2743 |
* kDSOSOpenFile
|
|
2744 |
* kDSOSCloseFile
|
|
2745 |
* kDSOSPositionFile
|
|
2746 |
* kDSOSInstallFile
|
|
2747 |
* kDSOSInstallFile2
|
|
2748 |
*
|
|
2749 |
* The format and function of these commands is identical to
|
|
2750 |
* that of the kDSWriteFile, kDSReadFile, kDSOpenFile,
|
|
2751 |
* kDSCloseFile, and kDSPositionFile commands described above.
|
|
2752 |
*
|
|
2753 |
* The difference is that these commands are sent from the host to
|
|
2754 |
* the target, they operate on files on the target system, and they
|
|
2755 |
* do not include the processId and threadId fields (i.e., they are
|
|
2756 |
* formatted as described above as if DS_PROTOCOL < DS_PROTOCOL_RTOS).
|
|
2757 |
*/
|
|
2758 |
/****************************************************************************/
|
|
2759 |
|
|
2760 |
/*** kDSOSWriteFile ***/
|
|
2761 |
DESCDECL TrkMsgDesc gTrkMsgOsWriteFile
|
|
2762 |
#ifdef TRK_MSGCMD_INIT
|
|
2763 |
= {
|
|
2764 |
__debug_only_parm( "OS Write File" )
|
|
2765 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
2766 |
6, /* # of addl bytes */
|
|
2767 |
2, /* # of addl fields */
|
|
2768 |
{ /* addl field descriptors (data handled separately): */
|
|
2769 |
__trk_msg_field( "file handle", 4 ),
|
|
2770 |
__trk_msg_field( "length", 2 )
|
|
2771 |
}
|
|
2772 |
}
|
|
2773 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2774 |
;
|
|
2775 |
|
|
2776 |
/* "Index" of fields. Take # of header fields into account. */
|
|
2777 |
#define TRK_MSG_OWF_HANDLE_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
2778 |
#define TRK_MSG_OWF_LENGTH_INDEX (1 + TRK_MSG_HEADER_COUNT)
|
|
2779 |
|
|
2780 |
DESCDECL TrkMsgDesc gTrkMsgOsWriteFileReply
|
|
2781 |
#ifdef TRK_MSGCMD_INIT
|
|
2782 |
= {
|
|
2783 |
__debug_only_parm( "OS Write File Reply" )
|
|
2784 |
&gTrkMsgReplyHeader, /* previous fragment/header */
|
|
2785 |
3, /* # of addl bytes */
|
|
2786 |
2, /* # of addl fields */
|
|
2787 |
{ /* addl field descriptors (data handled separately): */
|
|
2788 |
__trk_msg_field( "io result", 1 ),
|
|
2789 |
__trk_msg_field( "length", 2 )
|
|
2790 |
}
|
|
2791 |
}
|
|
2792 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2793 |
;
|
|
2794 |
|
|
2795 |
/* "Index" of fields. Take # of header fields into account. */
|
|
2796 |
#define TRK_MSG_OWFR_IORESULT_INDEX (0 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
2797 |
#define TRK_MSG_OWFR_LENGTH_INDEX (1 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
2798 |
|
|
2799 |
|
|
2800 |
/*** kDSOSReadFile ***/
|
|
2801 |
DESCDECL TrkMsgDesc gTrkMsgOsReadFile
|
|
2802 |
#ifdef TRK_MSGCMD_INIT
|
|
2803 |
= {
|
|
2804 |
__debug_only_parm( "OS Read File" )
|
|
2805 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
2806 |
6, /* # of addl bytes */
|
|
2807 |
2, /* # of addl fields */
|
|
2808 |
{ /* addl field descriptors: */
|
|
2809 |
__trk_msg_field( "file handle", 4 ),
|
|
2810 |
__trk_msg_field( "length", 2 )
|
|
2811 |
}
|
|
2812 |
}
|
|
2813 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2814 |
;
|
|
2815 |
|
|
2816 |
/* "Index" of fields. Take # of header fields into account. */
|
|
2817 |
#define TRK_MSG_ORF_HANDLE_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
2818 |
#define TRK_MSG_ORF_LENGTH_INDEX (1 + TRK_MSG_HEADER_COUNT)
|
|
2819 |
|
|
2820 |
DESCDECL TrkMsgDesc gTrkMsgOsReadFileReply
|
|
2821 |
#ifdef TRK_MSGCMD_INIT
|
|
2822 |
= {
|
|
2823 |
__debug_only_parm( "OS Read File Reply" )
|
|
2824 |
&gTrkMsgReplyHeader, /* previous fragment/header */
|
|
2825 |
3, /* # of addl bytes */
|
|
2826 |
2, /* # of addl fields */
|
|
2827 |
{ /* addl field descriptors (data handled separately): */
|
|
2828 |
__trk_msg_field( "IO result", 1 ),
|
|
2829 |
__trk_msg_field( "length", 2 )
|
|
2830 |
}
|
|
2831 |
}
|
|
2832 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2833 |
;
|
|
2834 |
|
|
2835 |
/* "Index" of fields. Take # of header fields into account. */
|
|
2836 |
#define TRK_MSG_ORFR_IORESULT_INDEX (0 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
2837 |
#define TRK_MSG_ORFR_LENGTH_INDEX (1 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
2838 |
|
|
2839 |
|
|
2840 |
/*** kDSOSOpenFile ***/
|
|
2841 |
DESCDECL TrkMsgDesc gTrkMsgOsOpenFile
|
|
2842 |
#ifdef TRK_MSGCMD_INIT
|
|
2843 |
= {
|
|
2844 |
__debug_only_parm( "OS Open File" )
|
|
2845 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
2846 |
3, /* # of addl bytes */
|
|
2847 |
2, /* # of addl fields */
|
|
2848 |
{ /* addl field descriptors (file_name handled separately): */
|
|
2849 |
__trk_msg_field( "modes", 1 ),
|
|
2850 |
__trk_msg_field( "name length", 2 )
|
|
2851 |
}
|
|
2852 |
}
|
|
2853 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2854 |
;
|
|
2855 |
|
|
2856 |
/* "Index" of fields. Take # of header fields into account. */
|
|
2857 |
#define TRK_MSG_OOF_MODES_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
2858 |
#define TRK_MSG_OOF_LENGTH_INDEX (1 + TRK_MSG_HEADER_COUNT)
|
|
2859 |
|
|
2860 |
DESCDECL TrkMsgDesc gTrkMsgOsOpenFileReply
|
|
2861 |
#ifdef TRK_MSGCMD_INIT
|
|
2862 |
= {
|
|
2863 |
__debug_only_parm( "OS Open File Reply" )
|
|
2864 |
&gTrkMsgReplyHeader, /* previous fragment/header */
|
|
2865 |
9, /* # of addl bytes */
|
|
2866 |
3, /* # of addl fields */
|
|
2867 |
{ /* addl field descriptors: */
|
|
2868 |
__trk_msg_field( "IO result", 1 ),
|
|
2869 |
__trk_msg_field( "file handle", 4 ),
|
|
2870 |
__trk_msg_field( "timestamp", 4 )
|
|
2871 |
}
|
|
2872 |
}
|
|
2873 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2874 |
;
|
|
2875 |
|
|
2876 |
/* "Index" of fields. Take # of header fields into account. */
|
|
2877 |
#define TRK_MSG_OOFR_IORESULT_INDEX (0 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
2878 |
#define TRK_MSG_OOFR_HANDLE_INDEX (1 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
2879 |
#define TRK_MSG_OOFR_TIMESTAMP_INDEX (2 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
2880 |
|
|
2881 |
|
|
2882 |
/*** kDSOSCloseFile ***/
|
|
2883 |
DESCDECL TrkMsgDesc gTrkMsgOsCloseFile
|
|
2884 |
#ifdef TRK_MSGCMD_INIT
|
|
2885 |
= {
|
|
2886 |
__debug_only_parm( "OS Close File" )
|
|
2887 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
2888 |
8, /* # of addl bytes */
|
|
2889 |
2, /* # of addl fields */
|
|
2890 |
{ /* addl field descriptors: */
|
|
2891 |
__trk_msg_field( "file handle", 4 ),
|
|
2892 |
__trk_msg_field( "timestamp", 4 )
|
|
2893 |
}
|
|
2894 |
}
|
|
2895 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2896 |
;
|
|
2897 |
|
|
2898 |
/* "Index" of fields. Take # of header fields into account. */
|
|
2899 |
#define TRK_MSG_OCF_HANDLE_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
2900 |
#define TRK_MSG_OCF_TIMESTAMP_INDEX (1 + TRK_MSG_HEADER_COUNT)
|
|
2901 |
|
|
2902 |
DESCDECL TrkMsgDesc gTrkMsgOsCloseFileReply
|
|
2903 |
#ifdef TRK_MSGCMD_INIT
|
|
2904 |
= {
|
|
2905 |
__debug_only_parm( "OS Close File Reply" )
|
|
2906 |
&gTrkMsgReplyHeader, /* previous fragment/header */
|
|
2907 |
1, /* # of addl bytes */
|
|
2908 |
1, /* # of addl fields */
|
|
2909 |
{ /* addl field descriptors: */
|
|
2910 |
__trk_msg_field( "IO result", 1 )
|
|
2911 |
}
|
|
2912 |
}
|
|
2913 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2914 |
;
|
|
2915 |
|
|
2916 |
/* "Index" of fields. Take # of header fields into account. */
|
|
2917 |
#define TRK_MSG_OCFR_IORESULT_INDEX (0 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
2918 |
|
|
2919 |
|
|
2920 |
/*** kDSOSPositionFile ***/
|
|
2921 |
DESCDECL TrkMsgDesc gTrkMsgOsPositionFile
|
|
2922 |
#ifdef TRK_MSGCMD_INIT
|
|
2923 |
= {
|
|
2924 |
__debug_only_parm( "OS Position File" )
|
|
2925 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
2926 |
9, /* # of addl bytes */
|
|
2927 |
3, /* # of addl fields */
|
|
2928 |
{ /* addl field descriptors: */
|
|
2929 |
__trk_msg_field( "modes", 1 ),
|
|
2930 |
__trk_msg_field( "file handle", 4 ),
|
|
2931 |
__trk_msg_field( "offset", 4 )
|
|
2932 |
}
|
|
2933 |
}
|
|
2934 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2935 |
;
|
|
2936 |
|
|
2937 |
/* "Index" of fields. Take # of header fields into account. */
|
|
2938 |
#define TRK_MSG_OPF_MODES_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
2939 |
#define TRK_MSG_OPF_HANDLE_INDEX (1 + TRK_MSG_HEADER_COUNT)
|
|
2940 |
#define TRK_MSG_OPF_OFFSET_INDEX (2 + TRK_MSG_HEADER_COUNT)
|
|
2941 |
|
|
2942 |
DESCDECL TrkMsgDesc gTrkMsgOsPositionFileReply
|
|
2943 |
#ifdef TRK_MSGCMD_INIT
|
|
2944 |
= {
|
|
2945 |
__debug_only_parm( "OS Position File Reply" )
|
|
2946 |
&gTrkMsgReplyHeader, /* previous fragment/header */
|
|
2947 |
1, /* # of addl bytes */
|
|
2948 |
1, /* # of addl fields */
|
|
2949 |
{ /* addl field descriptors: */
|
|
2950 |
__trk_msg_field( "IO result", 1 )
|
|
2951 |
}
|
|
2952 |
}
|
|
2953 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2954 |
;
|
|
2955 |
|
|
2956 |
/* "Index" of fields. Take # of header fields into account. */
|
|
2957 |
#define TRK_MSG_OPFR_IORESULT_INDEX (0 + TRK_MSG_REPLY_HEADER_COUNT)
|
|
2958 |
|
|
2959 |
|
|
2960 |
/*** kDSOSInstallFile ***/
|
|
2961 |
DESCDECL TrkMsgDesc gTrkMsgOsInstallFile
|
|
2962 |
#ifdef TRK_MSGCMD_INIT
|
|
2963 |
= {
|
|
2964 |
__debug_only_parm( "OS Install File" )
|
|
2965 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
2966 |
3, /* # of addl bytes */
|
|
2967 |
2, /* # of addl fields */
|
|
2968 |
{ /* addl field descriptors (file_name handled separately): */
|
|
2969 |
__trk_msg_field( "drive", 1 ),
|
|
2970 |
__trk_msg_field( "name length", 2 )
|
|
2971 |
}
|
|
2972 |
}
|
|
2973 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2974 |
;
|
|
2975 |
|
|
2976 |
/* "Index" of fields. Take # of header fields into account. */
|
|
2977 |
#define TRK_MSG_OIF_DRIVE_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
2978 |
#define TRK_MSG_OIF_LENGTH_INDEX (1 + TRK_MSG_HEADER_COUNT)
|
|
2979 |
|
|
2980 |
DESCDECL TrkMsgDesc gTrkMsgOsInstallFileReply
|
|
2981 |
#ifdef TRK_MSGCMD_INIT
|
|
2982 |
= {
|
|
2983 |
__debug_only_parm( "OS Install File Reply" )
|
|
2984 |
&gTrkMsgReplyHeader, /* previous fragment/header */
|
|
2985 |
1, /* # of addl bytes */
|
|
2986 |
1, /* # of addl fields */
|
|
2987 |
{ /* addl field descriptors: */
|
|
2988 |
__trk_msg_field( "IO result", 1 )
|
|
2989 |
}
|
|
2990 |
}
|
|
2991 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
2992 |
;
|
|
2993 |
|
|
2994 |
/*** kDSOSInstallFile2 ***/
|
|
2995 |
DESCDECL TrkMsgDesc gTrkMsgOsInstallFile2
|
|
2996 |
#ifdef TRK_MSGCMD_INIT
|
|
2997 |
= {
|
|
2998 |
__debug_only_parm( "OS Install File2" )
|
|
2999 |
&gTrkMsgHeader, /* previous fragment/header */
|
|
3000 |
2, /* # of addl bytes */
|
|
3001 |
1, /* # of addl fields */
|
|
3002 |
{ /* addl field descriptors (file_name handled separately): */
|
|
3003 |
__trk_msg_field( "name length", 2 )
|
|
3004 |
}
|
|
3005 |
}
|
|
3006 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
3007 |
;
|
|
3008 |
|
|
3009 |
/* "Index" of fields. Take # of header fields into account. */
|
|
3010 |
#define TRK_MSG_OIF2_LENGTH_INDEX (0 + TRK_MSG_HEADER_COUNT)
|
|
3011 |
|
|
3012 |
DESCDECL TrkMsgDesc gTrkMsgOsInstallFile2Reply
|
|
3013 |
#ifdef TRK_MSGCMD_INIT
|
|
3014 |
= {
|
|
3015 |
__debug_only_parm( "OS Install File2 Reply" )
|
|
3016 |
&gTrkMsgReplyHeader, /* previous fragment/header */
|
|
3017 |
1, /* # of addl bytes */
|
|
3018 |
1, /* # of addl fields */
|
|
3019 |
{ /* addl field descriptors: */
|
|
3020 |
__trk_msg_field( "IO result", 1 )
|
|
3021 |
}
|
|
3022 |
}
|
|
3023 |
#endif /* #ifdef TRK_MSGCMD_INIT */
|
|
3024 |
;
|
|
3025 |
|
|
3026 |
/****************************************************************************/
|
|
3027 |
/*
|
|
3028 |
* kDSOSPhoneSWVersion
|
|
3029 |
*
|
|
3030 |
* Send:
|
|
3031 |
*
|
|
3032 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
3033 |
* <header> total
|
|
3034 |
*
|
|
3035 |
* Reply:
|
|
3036 |
*
|
|
3037 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
3038 |
* ui16 version string len - (2)
|
|
3039 |
* string sw version string
|
|
3040 |
*
|
|
3041 |
*
|
|
3042 |
*/
|
|
3043 |
/****************************************************************************/
|
|
3044 |
#define DS_MIN_MSG_PHONESWVERSION_LENGTH DS_MIN_MSG_LENGTH
|
|
3045 |
|
|
3046 |
DESCDECL TrkMsgDesc gTrkMsgPhoneSWVersionReply
|
|
3047 |
#ifdef TRK_MSGCMD_INIT
|
|
3048 |
= {
|
|
3049 |
__debug_only_parm( "Phone SW Version Reply" )
|
|
3050 |
&gTrkMsgReplyHeader, /* previous fragment/header */
|
|
3051 |
x, /* # of addl bytes */
|
|
3052 |
x, /* # of addl fields */
|
|
3053 |
{ /* addl field descriptors: */
|
|
3054 |
__trk_msg_field( "version string len", 2 ),
|
|
3055 |
__trk_msg_field( "version string", x )
|
|
3056 |
}
|
|
3057 |
}
|
|
3058 |
#endif
|
|
3059 |
;
|
|
3060 |
/****************************************************************************/
|
|
3061 |
/*
|
|
3062 |
* kDSOSPhoneName
|
|
3063 |
*
|
|
3064 |
* Send:
|
|
3065 |
*
|
|
3066 |
* .... <Message Header> ... (see gTrkMsgHeader)
|
|
3067 |
* <header> total
|
|
3068 |
*
|
|
3069 |
* Reply:
|
|
3070 |
*
|
|
3071 |
* .... <Reply Header> ... (see gTrkMsgReplyHeader)
|
|
3072 |
* ui16 phone name len - (2)
|
|
3073 |
* string phone name string
|
|
3074 |
*
|
|
3075 |
*
|
|
3076 |
*/
|
|
3077 |
/****************************************************************************/
|
|
3078 |
#define DS_MIN_MSG_PHONENAME_LENGTH DS_MIN_MSG_LENGTH
|
|
3079 |
|
|
3080 |
DESCDECL TrkMsgDesc gTrkMsgPhoneNameReply
|
|
3081 |
#ifdef TRK_MSGCMD_INIT
|
|
3082 |
= {
|
|
3083 |
__debug_only_parm( "Phone Name Reply" )
|
|
3084 |
&gTrkMsgReplyHeader, /* previous fragment/header */
|
|
3085 |
x, /* # of addl bytes */
|
|
3086 |
x, /* # of addl fields */
|
|
3087 |
{ /* addl field descriptors: */
|
|
3088 |
__trk_msg_field( "phone name string len", 2 ),
|
|
3089 |
__trk_msg_field( "phone name string", x )
|
|
3090 |
}
|
|
3091 |
}
|
|
3092 |
#endif
|
|
3093 |
;
|
|
3094 |
|
|
3095 |
#if __MWERKS__
|
|
3096 |
#pragma mark Message Error Values
|
|
3097 |
#endif /* __MWERKS__ */
|
|
3098 |
/****************************************************************************/
|
|
3099 |
/*
|
|
3100 |
* Error values returned in ACK/NAK packets
|
|
3101 |
*/
|
|
3102 |
/****************************************************************************/
|
|
3103 |
typedef enum {
|
|
3104 |
kDSReplyNoError = 0x00, /* no error */
|
|
3105 |
kDSReplyError = 0x01, /* generic error in CWDS message */
|
|
3106 |
kDSReplyPacketSizeError = 0x02, /* unexpected pkt size in send msg */
|
|
3107 |
kDSReplyCWDSError = 0x03, /* internal error occurred in CWDS */
|
|
3108 |
kDSReplyEscapeError = 0x04, /* escape followed by frame flag */
|
|
3109 |
kDSReplyBadFCS = 0x05, /* bad FCS in packet */
|
|
3110 |
kDSReplyOverflow = 0x06, /* packet too long */
|
|
3111 |
kDSReplySequenceMissing = 0x07, /* sequence ID != expected (gap in sequence) */
|
|
3112 |
|
|
3113 |
kDSReplyUnsupportedCommandError = 0x10, /* command not supported */
|
|
3114 |
kDSReplyParameterError = 0x11, /* command param out of range */
|
|
3115 |
kDSReplyUnsupportedOptionError = 0x12, /* an option was not supported */
|
|
3116 |
kDSReplyInvalidMemoryRange = 0x13, /* read/write to invalid memory */
|
|
3117 |
kDSReplyInvalidRegisterRange = 0x14, /* read/write invalid registers */
|
|
3118 |
kDSReplyCWDSException = 0x15, /* exception occurred in CWDS */
|
|
3119 |
kDSReplyNotStopped = 0x16, /* targeted system or thread is running */
|
|
3120 |
kDSReplyBreakpointsFull = 0x17, /* bp resources (HW or SW) exhausted */
|
|
3121 |
kDSReplyBreakpointConflict = 0x18, /* requested bp conflicts w/existing bp */
|
|
3122 |
|
|
3123 |
kDSReplyOsError = 0x20, /* general OS-related error */
|
|
3124 |
kDSReplyInvalidProcessId = 0x21, /* request specified invalid process */
|
|
3125 |
kDSReplyInvalidThreadId = 0x22, /* request specified invalid thread */
|
|
3126 |
|
|
3127 |
kDSDebugSecurityError = 0x23 /* security error from DSS */
|
|
3128 |
|
|
3129 |
} DSReplyError;
|
|
3130 |
|
|
3131 |
|
|
3132 |
#endif /* __MSGCMD_H__ */
|