1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
|
/******************************************************************************
*
* Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
* All rights reserved.
*
* File: SystemPkt.h
*
* Description:
* Structure of System Packets for the Serial Link Manager. These
* packets are used by the Debugger, Console, and Remote UI modules
* for communication with the host computer.
*
* History:
* 6/26/95 RM - Created by Ron Marianetti
*
*****************************************************************************/
#ifndef __SYSTEM_PKT_H__
#define __SYSTEM_PKT_H__
#include <SerialLinkMgr.h>
//*************************************************************************
// Constants for System Packets
//
//*************************************************************************
// Max # of bytes we can read/write at a time with the ReadMem and WriteMem
// commands;
#define sysPktMaxMemChunk 256
// Maximum body size for System Packets. This is big enough to have
// 256 bytes of data for the Read and Write Mem command plus whatever other
// parameters are in the body for these commands.
#define sysPktMaxBodySize (sysPktMaxMemChunk+16)
// Default nitial timeout value for packet receive routines in ticks
#define sysPktInitialTimeout (sysTicksPerSecond*10)
//*************************************************************************
// Packet Body Structure
//*************************************************************************
// Common fields at the start of every body
#define _sysPktBodyCommon \
UInt8 command; \
UInt8 _filler
// Generic System Packet Body
typedef struct SysPktBodyType {
_sysPktBodyCommon;
UInt8 data[sysPktMaxBodySize-2];
} SysPktBodyType;
typedef SysPktBodyType* SysPktBodyPtr;
//*************************************************************************
// The max size of the array of SlkWriteDataTypes used by System Packet
// assembly routines in order to minimize stack usage.
//*************************************************************************
#define sysPktMaxBodyChunks 3
//*************************************************************************
// packet commands
//*************************************************************************
//--------------------------------------------------------------------
// get state command
//--------------------------------------------------------------------
#define sysPktStateCmd 0x00
#define sysPktStateRsp 0x80
//--------------------------------------------------------------------
// read memory command
//--------------------------------------------------------------------
#define sysPktReadMemCmd 0x01
#define sysPktReadMemRsp 0x81
typedef struct SysPktReadMemCmdType {
_sysPktBodyCommon; // Common Body header
void* address; // Address to read
UInt16 numBytes; // # of bytes to read
} SysPktReadMemCmdType;
typedef SysPktReadMemCmdType* SysPktReadMemCmdPtr;
typedef struct SysPktReadMemRspType {
_sysPktBodyCommon; // Common Body header
// UInt8 data[?]; // variable size
} SysPktReadMemRspType;
typedef SysPktReadMemRspType* SysPktReadMemRspPtr;
//--------------------------------------------------------------------
// write memory command
//--------------------------------------------------------------------
#define sysPktWriteMemCmd 0x02
#define sysPktWriteMemRsp 0x82
typedef struct SysPktWriteMemCmdType {
_sysPktBodyCommon; // Common Body header
void* address; // Address to write
UInt16 numBytes; // # of bytes to write
// UInt8 data[?]; // variable size data
} SysPktWriteMemCmdType;
typedef SysPktWriteMemCmdType* SysPktWriteMemCmdPtr;
typedef struct SysPktWriteMemRspType {
_sysPktBodyCommon; // Common Body header
} SysPktWriteMemRspType;
typedef SysPktWriteMemRspType* SysPktWriteMemRspPtr;
//--------------------------------------------------------------------
// single-step command
//--------------------------------------------------------------------
#define sysPktSingleStepCmd 0x03
// no response
//--------------------------------------------------------------------
// get routine name command
//--------------------------------------------------------------------
#define sysPktGetRtnNameCmd 0x04
#define sysPktGetRtnNameRsp 0x84
//--------------------------------------------------------------------
// read registers command
//--------------------------------------------------------------------
#define sysPktReadRegsCmd 0x05
#define sysPktReadRegsRsp 0x85
//--------------------------------------------------------------------
// write registers command
//--------------------------------------------------------------------
#define sysPktWriteRegsCmd 0x06
#define sysPktWriteRegsRsp 0x86
//--------------------------------------------------------------------
// continue command
//--------------------------------------------------------------------
#define sysPktContinueCmd 0x07
// no response
//--------------------------------------------------------------------
// Remote Procedure call
//--------------------------------------------------------------------
#define sysPktRPCCmd 0x0A
#define sysPktRPCRsp 0x8A
typedef struct SysPktRPCParamInfo {
UInt8 byRef; // true if param is by reference
UInt8 size; // # of Bytes of paramData (must be even)
UInt16 data[1]; // variable length array of paramData
} SysPktRPCParamType;
typedef struct SysPktRPCType {
_sysPktBodyCommon; // Common Body header
UInt16 trapWord; // which trap to execute
UInt32 resultD0; // result from D0 placed here
UInt32 resultA0; // result from A0 placed here
UInt16 numParams; // how many parameters follow
// Following is a variable length array ofSlkRPCParamInfo's
SysPktRPCParamType param[1];
} SysPktRPCType;
//--------------------------------------------------------------------
// Set/Get breakpoints
//--------------------------------------------------------------------
#define sysPktGetBreakpointsCmd 0x0B
#define sysPktGetBreakpointsRsp 0x8B
#define sysPktSetBreakpointsCmd 0x0C
#define sysPktSetBreakpointsRsp 0x8C
//--------------------------------------------------------------------
// Remote UI Support - These packets are used by the screen driver
// and event manager to support remote viewing and control of a Pilot
// over the serial port.
//--------------------------------------------------------------------
#define sysPktRemoteUIUpdCmd 0x0C
typedef struct SysPktRemoteUIUpdCmdType {
_sysPktBodyCommon; // Common Body header
// These parameters are sent from traget to host after drawing operations
UInt16 rowBytes; // rowbytes of update area
UInt16 fromY; // top of update rect
UInt16 fromX; // left of update rect
UInt16 toY; // top of screen rect
UInt16 toX; // left of screen rect
UInt16 height; // bottom of update rect
UInt16 width; // right of update rect
// The actual pixels of the update area follow
UInt16 pixels; // variable length...
} SysPktRemoteUIUpdCmdType;
#define sysPktRemoteEvtCmd 0x0D
typedef struct SysPktRemoteEvtCmdType {
_sysPktBodyCommon; // Common Body header
// These parameters are sent from host to target to feed pen and keyboard
// events. They do not require a response.
Boolean penDown; // true if pen down
UInt8 padding1;
Int16 penX; // X location of pen
Int16 penY; // Y location of pen
Boolean keyPress; // true if key event follows
UInt8 padding2;
UInt16 keyModifiers; // keyboard modifiers
WChar keyAscii; // key ascii code
UInt16 keyCode; // key virtual code
} SysPktRemoteEvtCmdType;
//--------------------------------------------------------------------
// Enable/Disable DbgBreak's command
//--------------------------------------------------------------------
#define sysPktDbgBreakToggleCmd 0x0D
#define sysPktDbgBreakToggleRsp 0x8D
//--------------------------------------------------------------------
// Program Flash command - programs one sector of the FLASH ram
// If numBytes is 0, this routine returns info on the flash in:
// manuf - manufacturer code
// device - device code
//--------------------------------------------------------------------
#define sysPktFlashCmd 0x0E // OBSOLETE AS OF 3.0! SEE BELOW!
#define sysPktFlashRsp 0x8E // OSBOLETE AS OF 3.0! SEE BELOW!
//--------------------------------------------------------------------
// Get/Set communication parameters
//--------------------------------------------------------------------
#define sysPktCommCmd 0x0F
#define sysPktCommRsp 0x8F
typedef struct SysPktCommCmdType {
_sysPktBodyCommon; // Common Body header
Boolean set; // true to change parameters
UInt8 padding;
UInt32 baudRate; // new baud rate
UInt32 flags; // new flags
} SysPktCommCmdType;
typedef SysPktCommCmdType *SysPktCommCmdPtr;
typedef struct SysPktCommRspType {
_sysPktBodyCommon; // Common Body header
UInt32 baudRate; // current baud rate
UInt32 flags; // current flags
} SysPktCommRspType;
typedef SysPktCommRspType *SysPktCommRspPtr;
//--------------------------------------------------------------------
// Get/Set Trap Breaks
//--------------------------------------------------------------------
#define sysPktGetTrapBreaksCmd 0x10
#define sysPktGetTrapBreaksRsp 0x90
#define sysPktSetTrapBreaksCmd 0x11
#define sysPktSetTrapBreaksRsp 0x91
//--------------------------------------------------------------------
// Gremlins Support - These packets are used by the screen driver
// and event manager to support remote viewing and control of a Pilot
// over the serial port.
//--------------------------------------------------------------------
#define sysPktGremlinsCmd 0x12
typedef struct SysPktGremlinsCmdType {
_sysPktBodyCommon; // Common Body header
// These parameters are sent from target to host to send Gremlins stuff
UInt16 action;
UInt8 data[32];
} SysPktGremlinsCmdType;
// Gremlins action codes
#define sysPktGremlinsIdle 1
#define sysPktGremlinsEvent 2
//--------------------------------------------------------------------
// Find data - searches a range of addresses for data
//--------------------------------------------------------------------
#define sysPktFindCmd 0x13
#define sysPktFindRsp (sysPktFindCmd | 0x80)
typedef struct SysPktFindCmdType {
_sysPktBodyCommon; // Common Body header
UInt32 firstAddr; // first address to search
UInt32 lastAddr; // last address to begin searching
UInt16 numBytes; // number of data bytes to match
Boolean caseInsensitive; // if true, perform a case-insensitive search
UInt8 padding;
} SysPktFindCmdType;
typedef SysPktFindCmdType* SysPktFindCmdPtr;
typedef struct SysPktFindRspType {
_sysPktBodyCommon; // Common Body header
UInt32 addr; // address where data was found
Boolean found; // true if data was found
UInt8 padding;
} SysPktFindRspType;
typedef SysPktFindRspType* SysPktFindRspPtr;
//--------------------------------------------------------------------
// Get/Set Trap Conditionals. These are used to tell the debugger
// to conditionally break on a trap depending on the value of the
// first word on the stack. They are used when setting a-traps on
// library calls. This is a 3.0 feature.
//--------------------------------------------------------------------
#define sysPktGetTrapConditionsCmd 0x14
#define sysPktGetTrapConditionsRsp 0x94
#define sysPktSetTrapConditionsCmd 0x15
#define sysPktSetTrapConditionsRsp 0x95
//--------------------------------------------------------------------
// Checksum data - checksums a range of memory.
// This is a (late) 3.0 feature.
//--------------------------------------------------------------------
#define sysPktChecksumCmd 0x16
#define sysPktChecksumRsp (sysPktChecksumCmd | 0x80)
typedef struct SysPktChecksumType {
_sysPktBodyCommon; // Common Body header
UInt32 firstAddr; // -> first address to checksum
UInt16 numBytes; // -> number of bytes to checksum
UInt16 seed; // -> initial checksum value
UInt16 checksum; // <- checksum result
} SysPktChecksumType;
typedef SysPktChecksumType* SysPktChecksumPtr;
//--------------------------------------------------------------------
// NEW Program Flash command - programs one sector of the FLASH ram
// If numBytes is 0, this routine returns address to store flash code.
// Supercedes Obsolete 1.0 and 2.0 sysPktFlashCmd call above in the 3.0 ROM
//--------------------------------------------------------------------
#define sysPktExecFlashCmd 0x17
#define sysPktExecFlashRsp (sysPktExecFlashCmd | 0x80)
//--------------------------------------------------------------------
// message from remote unit
//--------------------------------------------------------------------
#define sysPktRemoteMsgCmd 0x7f
//--------------------------------------------------------------------
// sysPktRemoteMsg
// Send a text message
//--------------------------------------------------------------------
typedef struct SysPktRemoteMsgCmdType {
_sysPktBodyCommon; // Common Body header
//UInt8 text; // variable length text goes here
} SysPktRemoteMsgCmdType;
typedef SysPktRemoteMsgCmdType *SysPktRemoteMsgCmdPtr;
/*******************************************************************
* Prototypes
*******************************************************************/
#ifdef REMOVE_FOR_EMULATOR
#ifdef __cplusplus
extern "C" {
#endif
//================================================================
//
// Host Only Routines.
//
//================================================================
#if (EMULATION_LEVEL != EMULATION_NONE)
//-------------------------------------------------------------------
// RPC
//------------------------------------------------------------------
// Init preparate on an RPC packet header and body.
Err SlkRPCInitPacket(SlkPktHeaderType *headerP, UInt16 dstSocket,
SysPktRPCType *bodyP, UInt16 trapWord);
// Stuff a parameter into an RPC packet body
void * SlkRPCStuffParam(SysPktRPCType *bodyP, const void *dataP,
Int16 dataSize, Boolean byRef);
// Send RPC packet and wait for response.
Err SlkRPCExecute(SlkPktHeaderPtr headerP, SysPktRPCType *bodyP,
Boolean async);
#endif // (EMULATION_LEVEL != EMULATION_NONE)
#ifdef __cplusplus
}
#endif
#endif
#endif //__SYSTEM_PKT_H__
|