#ifndef __WINCEINC_H__
#define __WINCEINC_H__
+#define WINCE_ALTERNATE_ARG_BASE 1
+
#pragma pack(1)
// Edbg BOOTME packet structures
-typedef struct
+typedef struct
{
- unsigned int id; // Protocol identifier ("EDBG" on the wire)
+ unsigned int id; // Protocol identifier ("EDBG" on the wire)
unsigned char service; // Service identifier
unsigned char flags; // Flags (see defs below)
unsigned char seqNum; // For detection of dropped packets
unsigned char cmd; // For administrative messages
- unsigned char data[1]; // Cmd specific data starts here (format is determined by
- // Cmd, len is determined by UDP packet size)
-}
-eth_dbg_hdr;
+ unsigned char data[1]; // Cmd specific data starts here (format is determined by
+ // Cmd, len is determined by UDP packet size)
+} eth_dbg_hdr;
-#define OFFSETOF(s,m) ((unsigned int)&(((s*)0)->m))
-#define EDBG_DATA_OFFSET (OFFSETOF(eth_dbg_hdr, data))
+#define OFFSETOF(s,m) ((unsigned int)&(((s*)0)->m))
+#define EDBG_DATA_OFFSET (OFFSETOF(eth_dbg_hdr, data))
-typedef struct
+typedef struct
{
- unsigned char versionMajor; // Bootloader version
- unsigned char versionMinor; // Bootloader version
- unsigned short macAddr[3]; // Ether address of device (net byte order)
- unsigned int ipAddr; // IP address of device (net byte order)
- char platformId[17]; // Platform Id string (NULL terminated)
- char deviceName[17]; // Device name string (NULL terminated). Should include
- // platform and number based on Ether address (e.g. Odo42, CEPCLS2346, etc)
- unsigned char cpuId; // CPU identifier (upper nibble = type)
- // The following fields were added in CE 3.0 Platform Builder release
- unsigned char bootmeVer; // BOOTME Version. Must be in the range 2 -> EDBG_CURRENT_BOOTME_VERSION, or
- // remaining fields will be ignored by Eshell and defaults will be used.
- unsigned int bootFlags; // Boot Flags
- unsigned short downloadPort; // Download Port (net byte order) (0 -> EDBG_DOWNLOAD_PORT)
- unsigned short svcPort; // Service Port (net byte order) (0 -> EDBG_SVC_PORT)
-
+ unsigned char versionMajor; // Bootloader version
+ unsigned char versionMinor; // Bootloader version
+ unsigned short macAddr[3]; // Ether address of device (net byte order)
+ unsigned int ipAddr; // IP address of device (net byte order)
+ char platformId[17]; // Platform Id string (NULL terminated)
+ char deviceName[17]; // Device name string (NULL terminated). Should include
+ // platform and number based on Ether address (e.g. Odo42, CEPCLS2346, etc)
+ unsigned char cpuId; // CPU identifier (upper nibble = type)
+ // The following fields were added in CE 3.0 Platform Builder release
+ unsigned char bootmeVer; // BOOTME Version.
+ // Must be in the range 2 -> EDBG_CURRENT_BOOTME_VERSION, or
+ // remaining fields will be ignored by Eshell and defaults will be used.
+ unsigned int bootFlags; // Boot Flags
+ unsigned short downloadPort; // Download Port (net byte order) (0 -> EDBG_DOWNLOAD_PORT)
+ unsigned short svcPort; // Service Port (net byte order) (0 -> EDBG_SVC_PORT)
} edbg_bootme_data;
// Packet size
-
-#define BOOTME_PKT_SIZE (EDBG_DATA_OFFSET + sizeof(edbg_bootme_data))
+#define BOOTME_PKT_SIZE (EDBG_DATA_OFFSET + sizeof(edbg_bootme_data))
// WinCE .BIN file format signature
-
-#define CE_BIN_SIGN "B000FF\x0A"
+#define CE_BIN_SIGN "B000FF\x0A"
#define CE_BIN_SIGN_LEN 7
-
typedef struct
{
- unsigned char sign[ CE_BIN_SIGN_LEN ];
+ unsigned char sign[CE_BIN_SIGN_LEN];
unsigned int rtiPhysAddr;
unsigned int rtiPhysLen;
-}
-ce_bin_hdr;
+} ce_bin_hdr;
typedef struct
{
unsigned int physAddr;
unsigned int physLen;
unsigned int chkSum;
- unsigned char data[ 1 ];
-}
-ce_bin_entry;
+ unsigned char data[1];
+} ce_bin_entry;
// CE ROM image structures
-
-#define ROM_SIGNATURE_OFFSET 0x40 // Offset from the image's physfirst address to the ROM signature.
-#define ROM_SIGNATURE 0x43454345 // Signature
-#define ROM_TOC_POINTER_OFFSET 0x44 // Offset from the image's physfirst address to the TOC pointer.
-#define ROM_TOC_OFFSET_OFFSET 0x48 // Offset from the image's physfirst address to the TOC offset (from physfirst).
+#define ROM_SIGNATURE_OFFSET 0x40 // Offset from the image's physfirst address to the ROM signature.
+#define ROM_SIGNATURE 0x43454345 // Signature
+#define ROM_TOC_POINTER_OFFSET 0x44 // Offset from the image's physfirst address to the TOC pointer.
+#define ROM_TOC_OFFSET_OFFSET 0x48 // Offset from the image's physfirst address to the TOC offset (from physfirst).
typedef struct
{
- unsigned int dllfirst; // first DLL address
- unsigned int dlllast; // last DLL address
- unsigned int physfirst; // first physical address
- unsigned int physlast; // highest physical address
- unsigned int nummods; // number of TOCentry's
- unsigned int ramStart; // start of RAM
- unsigned int ramFree; // start of RAM free space
- unsigned int ramEnd; // end of RAM
- unsigned int copyEntries; // number of copy section entries
- unsigned int copyOffset; // offset to copy section
- unsigned int profileLen; // length of PROFentries RAM
- unsigned int profileOffset; // offset to PROFentries
- unsigned int numfiles; // number of FILES
- unsigned int kernelFlags; // optional kernel flags from ROMFLAGS .bib config option
- unsigned int fsRamPercent; // Percentage of RAM used for filesystem
- // from FSRAMPERCENT .bib config option
- // byte 0 = #4K chunks/Mbyte of RAM for filesystem 0-2Mbytes 0-255
- // byte 1 = #4K chunks/Mbyte of RAM for filesystem 2-4Mbytes 0-255
- // byte 2 = #4K chunks/Mbyte of RAM for filesystem 4-6Mbytes 0-255
- // byte 3 = #4K chunks/Mbyte of RAM for filesystem > 6Mbytes 0-255
-
- unsigned int drivglobStart; // device driver global starting address
- unsigned int drivglobLen; // device driver global length
- unsigned short cpuType; // CPU (machine) Type
- unsigned short miscFlags; // Miscellaneous flags
- void* extensions; // pointer to ROM Header extensions
- unsigned int trackingStart; // tracking memory starting address
- unsigned int trackingLen; // tracking memory ending address
-}
-ce_rom_hdr;
+ unsigned int dllfirst; // first DLL address
+ unsigned int dlllast; // last DLL address
+ unsigned int physfirst; // first physical address
+ unsigned int physlast; // highest physical address
+ unsigned int nummods; // number of TOCentry's
+ unsigned int ramStart; // start of RAM
+ unsigned int ramFree; // start of RAM free space
+ unsigned int ramEnd; // end of RAM
+ unsigned int copyEntries; // number of copy section entries
+ unsigned int copyOffset; // offset to copy section
+ unsigned int profileLen; // length of PROFentries RAM
+ unsigned int profileOffset; // offset to PROFentries
+ unsigned int numfiles; // number of FILES
+ unsigned int kernelFlags; // optional kernel flags from ROMFLAGS .bib config option
+ unsigned int fsRamPercent; // Percentage of RAM used for filesystem
+ // from FSRAMPERCENT .bib config option
+ // byte 0 = #4K chunks/Mbyte of RAM for filesystem 0-2Mbytes 0-255
+ // byte 1 = #4K chunks/Mbyte of RAM for filesystem 2-4Mbytes 0-255
+ // byte 2 = #4K chunks/Mbyte of RAM for filesystem 4-6Mbytes 0-255
+ // byte 3 = #4K chunks/Mbyte of RAM for filesystem > 6Mbytes 0-255
+
+ unsigned int drivglobStart; // device driver global starting address
+ unsigned int drivglobLen; // device driver global length
+ unsigned short cpuType; // CPU (machine) Type
+ unsigned short miscFlags; // Miscellaneous flags
+ void* extensions; // pointer to ROM Header extensions
+ unsigned int trackingStart; // tracking memory starting address
+ unsigned int trackingLen; // tracking memory ending address
+} ce_rom_hdr;
// Win32 FILETIME strcuture
{
unsigned int loDateTime;
unsigned int hiDateTime;
-}
-ce_file_time;
+} ce_file_time;
// Table Of Contents entry structure
typedef struct
-{
+{
unsigned int fileAttributes;
ce_file_time fileTime;
unsigned int fileSize;
unsigned int e32Offset; // Offset to E32 structure
unsigned int o32Offset; // Offset to O32 structure
unsigned int loadOffset; // MODULE load buffer offset
-}
-ce_toc_entry;
+} ce_toc_entry;
-typedef struct
+typedef struct
{ /* Extra information header block */
unsigned int rva; /* Virtual relative address of info */
unsigned int size; /* Size of information block */
-}
-e32_info;
+} e32_info;
#define ROM_EXTRA 9
unsigned int e32_timestamp; /* Time EXE/DLL was created/modified */
e32_info e32_unit[ ROM_EXTRA ]; /* Array of extra info units */
unsigned short e32_subsys; /* The subsystem type */
-}
-e32_rom;
-
-#pragma pack()
-
+} e32_rom;
#pragma pack(1)
-
-// OS config msg
-
+// OS config msg
#define EDBG_FL_DBGMSG 0x01 // Debug messages
#define EDBG_FL_PPSH 0x02 // Text shell
#define EDBG_FL_KDBG 0x04 // Kernel debugger
typedef struct
{
- unsigned char flags; // Flags that will be used to determine what features are
- // enabled over ethernet (saved in driver globals by bootloader)
- unsigned char kitlTransport; // Tells KITL which transport to start
+ unsigned char flags; // Flags that will be used to determine what features are
+ // enabled over ethernet (saved in driver globals by bootloader)
+ unsigned char kitlTransport; // Tells KITL which transport to start
+
+ // The following specify addressing info, only valid if the corresponding
+ // flag is set in the Flags field.
- // The following specify addressing info, only valid if the corresponding
- // flag is set in the Flags field.
-
unsigned int dbgMsgIPAddr;
- unsigned short dbgMsgPort;
- unsigned int ppshIPAddr;
- unsigned short ppshPort;
- unsigned int kdbgIPAddr;
- unsigned short kdbgPort;
-
+ unsigned short dbgMsgPort;
+ unsigned int ppshIPAddr;
+ unsigned short ppshPort;
+ unsigned int kdbgIPAddr;
+ unsigned short kdbgPort;
} edbg_os_config_data;
-
// Driver globals structure
// Used to pass driver globals info from RedBoot to WinCE core
-#define DRV_GLB_SIGNATURE 0x424C4744 // "DGLB"
+#define DRV_GLB_SIGNATURE 0x424C4744 // "DGLB"
+#define ALT_DRV_GLB_SIGNATURE 0x53475241 // "ARGS"
typedef struct
{
- unsigned int signature; // Signature
- unsigned int flags; // Misc flags
- unsigned int ipAddr; // IP address of device (net byte order)
- unsigned int ipGate; // IP address of gateway (net byte order)
- unsigned int ipMask; // Subnet mask
- unsigned short macAddr[3]; // Ether address of device (net byte order)
+ unsigned int signature; // Signature
+ unsigned int flags; // Misc flags
+ unsigned int ipAddr; // IP address of device (net byte order)
+ unsigned int ipGate; // IP address of gateway (net byte order)
+ unsigned int ipMask; // Subnet mask
+ unsigned short macAddr[3]; // Ether address of device (net byte order)
edbg_os_config_data edbgConfig; // EDBG services info
+} ce_driver_globals;
-#ifdef CYGPKG_HAL_ARM_XSCALE_TRITON270_EQT32
+#pragma pack(4)
- unsigned int contrastDefault;
- unsigned int contrastBand;
- unsigned int backlight;
- unsigned int backlightOffset;
+typedef struct {
+ unsigned long signature;
+ unsigned short oalVersion;
+ unsigned short bspVersion;
+} OAL_ARGS_HEADER;
-#endif
+typedef struct _DEVICE_LOCATION
+{
+ unsigned long IfcType;
+ unsigned long BusNumber;
+ unsigned long LogicalLoc;
+ void *PhysicalLoc;
+ unsigned long Pin;
+} DEVICE_LOCATION;
+
+typedef struct
+{
+ unsigned long flags;
+ DEVICE_LOCATION devLoc;
+ union {
+ struct {
+ unsigned long baudRate;
+ unsigned long dataBits;
+ unsigned long stopBits;
+ unsigned long parity;
+ };
+ struct {
+ unsigned short mac[3];
+ unsigned long ipAddress;
+ unsigned long ipMask;
+ unsigned long ipRoute;
+ };
+ };
+} OAL_KITL_ARGS;
+
+typedef struct
+{
+ OAL_ARGS_HEADER header;
+ char deviceId[16]; // Device identification
+ OAL_KITL_ARGS kitl;
}
-ce_driver_globals;
+ce_alt_driver_globals;
+externC ce_alt_driver_globals _KARO_CECFG_START;
+externC char _KARO_MAGIC[8];
+externC unsigned long _KARO_STRUCT_SIZE;
#pragma pack()
-
// Default UDP ports used for Ethernet download and EDBG messages. May be overriden
// by device in BOOTME message.
-#define EDBG_DOWNLOAD_PORT 980 // For downloading images to bootloader via TFTP
-#define EDBG_SVC_PORT 981 // Other types of transfers
+#define EDBG_DOWNLOAD_PORT 980 // For downloading images to bootloader via TFTP
+#define EDBG_SVC_PORT 981 // Other types of transfers
// Byte string for Id field (note - must not conflict with valid TFTP
// opcodes (0-5), as we share the download port with TFTP)
-#define EDBG_ID 0x47424445 // "EDBG"
+#define EDBG_ID 0x47424445 // "EDBG"
// Defs for reserved values of the Service field
-#define EDBG_SVC_DBGMSG 0 // Debug messages
-#define EDBG_SVC_PPSH 1 // Text shell and PPFS file system
-#define EDBG_SVC_KDBG 2 // Kernel debugger
-#define EDBG_SVC_ADMIN 0xFF // Administrative messages
+#define EDBG_SVC_DBGMSG 0 // Debug messages
+#define EDBG_SVC_PPSH 1 // Text shell and PPFS file system
+#define EDBG_SVC_KDBG 2 // Kernel debugger
+#define EDBG_SVC_ADMIN 0xFF // Administrative messages
// Commands
-#define EDBG_CMD_READ_REQ 1 // Read request
-#define EDBG_CMD_WRITE_REQ 2 // Write request
-#define EDBG_CMD_WRITE 3 // Host ack
-#define EDBG_CMD_WRITE_ACK 4 // Target ack
-#define EDBG_CMD_ERROR 5 // Error
+#define EDBG_CMD_READ_REQ 1 // Read request
+#define EDBG_CMD_WRITE_REQ 2 // Write request
+#define EDBG_CMD_WRITE 3 // Host ack
+#define EDBG_CMD_WRITE_ACK 4 // Target ack
+#define EDBG_CMD_ERROR 5 // Error
// Service Ids from 3-FE are used for user apps
-#define NUM_DFLT_EDBG_SERVICES 3
+#define NUM_DFLT_EDBG_SERVICES 3
// Size of send and receive windows (except for stop and wait mode)
-#define EDBG_WINDOW_SIZE 8
+#define EDBG_WINDOW_SIZE 8
// The window size can be negotiated up to this amount if a client provides
// enough memory.
-#define EDBG_MAX_WINDOW_SIZE 16
+#define EDBG_MAX_WINDOW_SIZE 16
// Max size for an EDBG frame. Based on ethernet MTU - protocol overhead.
// Limited to one MTU because we don't do IP fragmentation on device.
// Definitions for Cmd field (used for administrative messages)
// Msgs from device
-#define EDBG_CMD_BOOTME 0 // Initial bootup message from device
-
+#define EDBG_CMD_BOOTME 0 // Initial bootup message from device
// Msgs from PC
-
-#define EDBG_CMD_SETDEBUG 1 // Used to set debug zones on device (TBD)
-#define EDBG_CMD_JUMPIMG 2 // Command to tell bootloader to jump to existing
- // flash or RAM image. Data is same as CMD_OS_CONFIG.
-#define EDBG_CMD_OS_CONFIG 3 // Configure OS for debug ethernet services
-#define EDBG_CMD_QUERYINFO 4 // "Ping" device, and return information (same fmt as bootme)
-#define EDBG_CMD_RESET 5 // Command to have platform perform SW reset (e.g. so it
- // can be reprogrammed). Support for this command is
- // processor dependant, and may not be implemented
- // on all platforms (requires HW mods for Odo).
-
-// Msgs from device or PC
-
-#define EDBG_CMD_SVC_CONFIG 6
-#define EDBG_CMD_SVC_DATA 7
-
-#define EDBG_CMD_DEBUGBREAK 8 // Break into debugger
+#define EDBG_CMD_SETDEBUG 1 // Used to set debug zones on device (TBD)
+#define EDBG_CMD_JUMPIMG 2 // Command to tell bootloader to jump to existing
+ // flash or RAM image. Data is same as CMD_OS_CONFIG.
+#define EDBG_CMD_OS_CONFIG 3 // Configure OS for debug ethernet services
+#define EDBG_CMD_QUERYINFO 4 // "Ping" device, and return information (same fmt as bootme)
+#define EDBG_CMD_RESET 5 // Command to have platform perform SW reset (e.g. so it
+ // can be reprogrammed). Support for this command is
+ // processor dependant, and may not be implemented
+ // on all platforms (requires HW mods for Odo).
+// Msgs from device or PC
+#define EDBG_CMD_SVC_CONFIG 6
+#define EDBG_CMD_SVC_DATA 7
+#define EDBG_CMD_DEBUGBREAK 8 // Break into debugger
// Structures for Data portion of EDBG packets
-
-#define EDBG_MAX_DEV_NAMELEN 16
+#define EDBG_MAX_DEV_NAMELEN 16
// BOOTME message - Devices broadcast this message when booted to request configuration
-
-#define EDBG_CURRENT_BOOTME_VERSION 2
+#define EDBG_CURRENT_BOOTME_VERSION 2
//
// Capability and boot Flags for dwBootFlags in EDBG_BOOTME_DATA
//
// Always download image
-
-#define EDBG_BOOTFLAG_FORCE_DOWNLOAD 0x00000001
+#define EDBG_BOOTFLAG_FORCE_DOWNLOAD 0x00000001
// Support passive-kitl
-
-#define EDBG_CAPS_PASSIVEKITL 0x00010000
+#define EDBG_CAPS_PASSIVEKITL 0x00010000
// Defs for CPUId
-
-#define EDBG_CPU_TYPE_SHX 0x10
-#define EDBG_CPU_TYPE_MIPS 0x20
-#define EDBG_CPU_TYPE_X86 0x30
-#define EDBG_CPU_TYPE_ARM 0x40
-#define EDBG_CPU_TYPE_PPC 0x50
-#define EDBG_CPU_TYPE_THUMB 0x60
-
-#define EDBG_CPU_SH3 (EDBG_CPU_TYPE_SHX | 0)
-#define EDBG_CPU_SH4 (EDBG_CPU_TYPE_SHX | 1)
-#define EDBG_CPU_R3000 (EDBG_CPU_TYPE_MIPS | 0)
-#define EDBG_CPU_R4101 (EDBG_CPU_TYPE_MIPS | 1)
-#define EDBG_CPU_R4102 (EDBG_CPU_TYPE_MIPS | 2)
-#define EDBG_CPU_R4111 (EDBG_CPU_TYPE_MIPS | 3)
-#define EDBG_CPU_R4200 (EDBG_CPU_TYPE_MIPS | 4)
-#define EDBG_CPU_R4300 (EDBG_CPU_TYPE_MIPS | 5)
-#define EDBG_CPU_R5230 (EDBG_CPU_TYPE_MIPS | 6)
-#define EDBG_CPU_R5432 (EDBG_CPU_TYPE_MIPS | 7)
-#define EDBG_CPU_i486 (EDBG_CPU_TYPE_X86 | 0)
-#define EDBG_CPU_SA1100 (EDBG_CPU_TYPE_ARM | 0)
-#define EDBG_CPU_ARM720 (EDBG_CPU_TYPE_ARM | 1)
-#define EDBG_CPU_PPC821 (EDBG_CPU_TYPE_PPC | 0)
-#define EDBG_CPU_PPC403 (EDBG_CPU_TYPE_PPC | 1)
-#define EDBG_CPU_THUMB720 (EDBG_CPU_TYPE_THUMB | 0)
+#define EDBG_CPU_TYPE_SHX 0x10
+#define EDBG_CPU_TYPE_MIPS 0x20
+#define EDBG_CPU_TYPE_X86 0x30
+#define EDBG_CPU_TYPE_ARM 0x40
+#define EDBG_CPU_TYPE_PPC 0x50
+#define EDBG_CPU_TYPE_THUMB 0x60
+
+#define EDBG_CPU_SH3 (EDBG_CPU_TYPE_SHX | 0)
+#define EDBG_CPU_SH4 (EDBG_CPU_TYPE_SHX | 1)
+#define EDBG_CPU_R3000 (EDBG_CPU_TYPE_MIPS | 0)
+#define EDBG_CPU_R4101 (EDBG_CPU_TYPE_MIPS | 1)
+#define EDBG_CPU_R4102 (EDBG_CPU_TYPE_MIPS | 2)
+#define EDBG_CPU_R4111 (EDBG_CPU_TYPE_MIPS | 3)
+#define EDBG_CPU_R4200 (EDBG_CPU_TYPE_MIPS | 4)
+#define EDBG_CPU_R4300 (EDBG_CPU_TYPE_MIPS | 5)
+#define EDBG_CPU_R5230 (EDBG_CPU_TYPE_MIPS | 6)
+#define EDBG_CPU_R5432 (EDBG_CPU_TYPE_MIPS | 7)
+#define EDBG_CPU_i486 (EDBG_CPU_TYPE_X86 | 0)
+#define EDBG_CPU_SA1100 (EDBG_CPU_TYPE_ARM | 0)
+#define EDBG_CPU_ARM720 (EDBG_CPU_TYPE_ARM | 1)
+#define EDBG_CPU_PPC821 (EDBG_CPU_TYPE_PPC | 0)
+#define EDBG_CPU_PPC403 (EDBG_CPU_TYPE_PPC | 1)
+#define EDBG_CPU_THUMB720 (EDBG_CPU_TYPE_THUMB | 0)
#endif