4 #define WINCE_ALTERNATE_ARG_BASE 1
8 // Edbg BOOTME packet structures
12 unsigned int id; // Protocol identifier ("EDBG" on the wire)
13 unsigned char service; // Service identifier
14 unsigned char flags; // Flags (see defs below)
15 unsigned char seqNum; // For detection of dropped packets
16 unsigned char cmd; // For administrative messages
17 unsigned char data[1]; // Cmd specific data starts here (format is determined by
18 // Cmd, len is determined by UDP packet size)
21 #define OFFSETOF(s,m) ((unsigned int)&(((s*)0)->m))
22 #define EDBG_DATA_OFFSET (OFFSETOF(eth_dbg_hdr, data))
26 unsigned char versionMajor; // Bootloader version
27 unsigned char versionMinor; // Bootloader version
28 unsigned short macAddr[3]; // Ether address of device (net byte order)
29 unsigned int ipAddr; // IP address of device (net byte order)
30 char platformId[17]; // Platform Id string (NULL terminated)
31 char deviceName[17]; // Device name string (NULL terminated). Should include
32 // platform and number based on Ether address (e.g. Odo42, CEPCLS2346, etc)
33 unsigned char cpuId; // CPU identifier (upper nibble = type)
34 // The following fields were added in CE 3.0 Platform Builder release
35 unsigned char bootmeVer; // BOOTME Version.
36 // Must be in the range 2 -> EDBG_CURRENT_BOOTME_VERSION, or
37 // remaining fields will be ignored by Eshell and defaults will be used.
38 unsigned int bootFlags; // Boot Flags
39 unsigned short downloadPort; // Download Port (net byte order) (0 -> EDBG_DOWNLOAD_PORT)
40 unsigned short svcPort; // Service Port (net byte order) (0 -> EDBG_SVC_PORT)
44 #define BOOTME_PKT_SIZE (EDBG_DATA_OFFSET + sizeof(edbg_bootme_data))
46 // WinCE .BIN file format signature
47 #define CE_BIN_SIGN "B000FF\x0A"
48 #define CE_BIN_SIGN_LEN 7
52 unsigned char sign[CE_BIN_SIGN_LEN];
53 unsigned int rtiPhysAddr;
54 unsigned int rtiPhysLen;
59 unsigned int physAddr;
62 unsigned char data[1];
65 // CE ROM image structures
66 #define ROM_SIGNATURE_OFFSET 0x40 // Offset from the image's physfirst address to the ROM signature.
67 #define ROM_SIGNATURE 0x43454345 // Signature
68 #define ROM_TOC_POINTER_OFFSET 0x44 // Offset from the image's physfirst address to the TOC pointer.
69 #define ROM_TOC_OFFSET_OFFSET 0x48 // Offset from the image's physfirst address to the TOC offset (from physfirst).
73 unsigned int dllfirst; // first DLL address
74 unsigned int dlllast; // last DLL address
75 unsigned int physfirst; // first physical address
76 unsigned int physlast; // highest physical address
77 unsigned int nummods; // number of TOCentry's
78 unsigned int ramStart; // start of RAM
79 unsigned int ramFree; // start of RAM free space
80 unsigned int ramEnd; // end of RAM
81 unsigned int copyEntries; // number of copy section entries
82 unsigned int copyOffset; // offset to copy section
83 unsigned int profileLen; // length of PROFentries RAM
84 unsigned int profileOffset; // offset to PROFentries
85 unsigned int numfiles; // number of FILES
86 unsigned int kernelFlags; // optional kernel flags from ROMFLAGS .bib config option
87 unsigned int fsRamPercent; // Percentage of RAM used for filesystem
88 // from FSRAMPERCENT .bib config option
89 // byte 0 = #4K chunks/Mbyte of RAM for filesystem 0-2Mbytes 0-255
90 // byte 1 = #4K chunks/Mbyte of RAM for filesystem 2-4Mbytes 0-255
91 // byte 2 = #4K chunks/Mbyte of RAM for filesystem 4-6Mbytes 0-255
92 // byte 3 = #4K chunks/Mbyte of RAM for filesystem > 6Mbytes 0-255
94 unsigned int drivglobStart; // device driver global starting address
95 unsigned int drivglobLen; // device driver global length
96 unsigned short cpuType; // CPU (machine) Type
97 unsigned short miscFlags; // Miscellaneous flags
98 void* extensions; // pointer to ROM Header extensions
99 unsigned int trackingStart; // tracking memory starting address
100 unsigned int trackingLen; // tracking memory ending address
103 // Win32 FILETIME strcuture
107 unsigned int loDateTime;
108 unsigned int hiDateTime;
111 // Table Of Contents entry structure
115 unsigned int fileAttributes;
116 ce_file_time fileTime;
117 unsigned int fileSize;
119 unsigned int e32Offset; // Offset to E32 structure
120 unsigned int o32Offset; // Offset to O32 structure
121 unsigned int loadOffset; // MODULE load buffer offset
125 { /* Extra information header block */
126 unsigned int rva; /* Virtual relative address of info */
127 unsigned int size; /* Size of information block */
134 unsigned short e32_objcnt; /* Number of memory objects */
135 unsigned short e32_imageflags; /* Image flags */
136 unsigned int e32_entryrva; /* Relative virt. addr. of entry point */
137 unsigned int e32_vbase; /* Virtual base address of module */
138 unsigned short e32_subsysmajor;/* The subsystem major version number */
139 unsigned short e32_subsysminor;/* The subsystem minor version number */
140 unsigned int e32_stackmax; /* Maximum stack size */
141 unsigned int e32_vsize; /* Virtual size of the entire image */
142 unsigned int e32_sect14rva; /* section 14 rva */
143 unsigned int e32_sect14size; /* section 14 size */
144 unsigned int e32_timestamp; /* Time EXE/DLL was created/modified */
145 e32_info e32_unit[ ROM_EXTRA ]; /* Array of extra info units */
146 unsigned short e32_subsys; /* The subsystem type */
152 #define EDBG_FL_DBGMSG 0x01 // Debug messages
153 #define EDBG_FL_PPSH 0x02 // Text shell
154 #define EDBG_FL_KDBG 0x04 // Kernel debugger
155 #define EDBG_FL_CLEANBOOT 0x08 // Force a clean boot
159 unsigned char flags; // Flags that will be used to determine what features are
160 // enabled over ethernet (saved in driver globals by bootloader)
161 unsigned char kitlTransport; // Tells KITL which transport to start
163 // The following specify addressing info, only valid if the corresponding
164 // flag is set in the Flags field.
166 unsigned int dbgMsgIPAddr;
167 unsigned short dbgMsgPort;
168 unsigned int ppshIPAddr;
169 unsigned short ppshPort;
170 unsigned int kdbgIPAddr;
171 unsigned short kdbgPort;
172 } edbg_os_config_data;
175 // Driver globals structure
176 // Used to pass driver globals info from RedBoot to WinCE core
178 #define DRV_GLB_SIGNATURE 0x424C4744 // "DGLB"
179 #define ALT_DRV_GLB_SIGNATURE 0x53475241 // "ARGS"
183 unsigned int signature; // Signature
184 unsigned int flags; // Misc flags
185 unsigned int ipAddr; // IP address of device (net byte order)
186 unsigned int ipGate; // IP address of gateway (net byte order)
187 unsigned int ipMask; // Subnet mask
188 unsigned short macAddr[3]; // Ether address of device (net byte order)
189 edbg_os_config_data edbgConfig; // EDBG services info
195 unsigned long signature;
196 unsigned short oalVersion;
197 unsigned short bspVersion;
200 typedef struct _DEVICE_LOCATION
202 unsigned long IfcType;
203 unsigned long BusNumber;
204 unsigned long LogicalLoc;
212 DEVICE_LOCATION devLoc;
215 unsigned long baudRate;
216 unsigned long dataBits;
217 unsigned long stopBits;
218 unsigned long parity;
221 unsigned short mac[3];
222 unsigned long ipAddress;
223 unsigned long ipMask;
224 unsigned long ipRoute;
231 OAL_ARGS_HEADER header;
232 char deviceId[16]; // Device identification
235 ce_alt_driver_globals;
237 externC ce_alt_driver_globals _KARO_CECFG_START;
238 externC char _KARO_MAGIC[8];
239 externC unsigned long _KARO_STRUCT_SIZE;
243 // Default UDP ports used for Ethernet download and EDBG messages. May be overriden
244 // by device in BOOTME message.
246 #define EDBG_DOWNLOAD_PORT 980 // For downloading images to bootloader via TFTP
247 #define EDBG_SVC_PORT 981 // Other types of transfers
249 // Byte string for Id field (note - must not conflict with valid TFTP
250 // opcodes (0-5), as we share the download port with TFTP)
252 #define EDBG_ID 0x47424445 // "EDBG"
254 // Defs for reserved values of the Service field
256 #define EDBG_SVC_DBGMSG 0 // Debug messages
257 #define EDBG_SVC_PPSH 1 // Text shell and PPFS file system
258 #define EDBG_SVC_KDBG 2 // Kernel debugger
259 #define EDBG_SVC_ADMIN 0xFF // Administrative messages
263 #define EDBG_CMD_READ_REQ 1 // Read request
264 #define EDBG_CMD_WRITE_REQ 2 // Write request
265 #define EDBG_CMD_WRITE 3 // Host ack
266 #define EDBG_CMD_WRITE_ACK 4 // Target ack
267 #define EDBG_CMD_ERROR 5 // Error
269 // Service Ids from 3-FE are used for user apps
271 #define NUM_DFLT_EDBG_SERVICES 3
273 // Size of send and receive windows (except for stop and wait mode)
275 #define EDBG_WINDOW_SIZE 8
277 // The window size can be negotiated up to this amount if a client provides
279 #define EDBG_MAX_WINDOW_SIZE 16
281 // Max size for an EDBG frame. Based on ethernet MTU - protocol overhead.
282 // Limited to one MTU because we don't do IP fragmentation on device.
284 #define EDBG_MAX_DATA_SIZE 1446
286 // Defs for Flags field.
287 #define EDBG_FL_FROM_DEV 0x01 // Set if message is from the device
288 #define EDBG_FL_NACK 0x02 // Set if frame is a nack
289 #define EDBG_FL_ACK 0x04 // Set if frame is an ack
290 #define EDBG_FL_SYNC 0x08 // Can be used to reset sequence # to 0
291 #define EDBG_FL_ADMIN_RESP 0x10 // For admin messages, indicate whether this is a response
293 // Definitions for Cmd field (used for administrative messages)
296 #define EDBG_CMD_BOOTME 0 // Initial bootup message from device
298 #define EDBG_CMD_SETDEBUG 1 // Used to set debug zones on device (TBD)
299 #define EDBG_CMD_JUMPIMG 2 // Command to tell bootloader to jump to existing
300 // flash or RAM image. Data is same as CMD_OS_CONFIG.
301 #define EDBG_CMD_OS_CONFIG 3 // Configure OS for debug ethernet services
302 #define EDBG_CMD_QUERYINFO 4 // "Ping" device, and return information (same fmt as bootme)
303 #define EDBG_CMD_RESET 5 // Command to have platform perform SW reset (e.g. so it
304 // can be reprogrammed). Support for this command is
305 // processor dependant, and may not be implemented
306 // on all platforms (requires HW mods for Odo).
307 // Msgs from device or PC
308 #define EDBG_CMD_SVC_CONFIG 6
309 #define EDBG_CMD_SVC_DATA 7
310 #define EDBG_CMD_DEBUGBREAK 8 // Break into debugger
312 // Structures for Data portion of EDBG packets
313 #define EDBG_MAX_DEV_NAMELEN 16
315 // BOOTME message - Devices broadcast this message when booted to request configuration
316 #define EDBG_CURRENT_BOOTME_VERSION 2
319 // Capability and boot Flags for dwBootFlags in EDBG_BOOTME_DATA
320 // LOWORD for boot flags, HIWORD for capability flags
323 // Always download image
324 #define EDBG_BOOTFLAG_FORCE_DOWNLOAD 0x00000001
326 // Support passive-kitl
327 #define EDBG_CAPS_PASSIVEKITL 0x00010000
330 #define EDBG_CPU_TYPE_SHX 0x10
331 #define EDBG_CPU_TYPE_MIPS 0x20
332 #define EDBG_CPU_TYPE_X86 0x30
333 #define EDBG_CPU_TYPE_ARM 0x40
334 #define EDBG_CPU_TYPE_PPC 0x50
335 #define EDBG_CPU_TYPE_THUMB 0x60
337 #define EDBG_CPU_SH3 (EDBG_CPU_TYPE_SHX | 0)
338 #define EDBG_CPU_SH4 (EDBG_CPU_TYPE_SHX | 1)
339 #define EDBG_CPU_R3000 (EDBG_CPU_TYPE_MIPS | 0)
340 #define EDBG_CPU_R4101 (EDBG_CPU_TYPE_MIPS | 1)
341 #define EDBG_CPU_R4102 (EDBG_CPU_TYPE_MIPS | 2)
342 #define EDBG_CPU_R4111 (EDBG_CPU_TYPE_MIPS | 3)
343 #define EDBG_CPU_R4200 (EDBG_CPU_TYPE_MIPS | 4)
344 #define EDBG_CPU_R4300 (EDBG_CPU_TYPE_MIPS | 5)
345 #define EDBG_CPU_R5230 (EDBG_CPU_TYPE_MIPS | 6)
346 #define EDBG_CPU_R5432 (EDBG_CPU_TYPE_MIPS | 7)
347 #define EDBG_CPU_i486 (EDBG_CPU_TYPE_X86 | 0)
348 #define EDBG_CPU_SA1100 (EDBG_CPU_TYPE_ARM | 0)
349 #define EDBG_CPU_ARM720 (EDBG_CPU_TYPE_ARM | 1)
350 #define EDBG_CPU_PPC821 (EDBG_CPU_TYPE_PPC | 0)
351 #define EDBG_CPU_PPC403 (EDBG_CPU_TYPE_PPC | 1)
352 #define EDBG_CPU_THUMB720 (EDBG_CPU_TYPE_THUMB | 0)