aboutsummaryrefslogtreecommitdiff
path: root/SrcShared/Palm/Platform
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbarenblat@gmail.com>2021-11-23 23:13:26 -0500
committerGravatar Benjamin Barenblat <bbarenblat@gmail.com>2021-11-23 23:13:26 -0500
commite5df1aafb6d1346207343ccb858fa373e6b86301 (patch)
treefb26f0091dda7dd69d48d6b06169ea618332b99e /SrcShared/Palm/Platform
Palm OS Emulator v3.5HEADmain
Check in the Palm OS Emulator, version 3.5 (2001). These files come from the tarball present in the Debian archives [1]. The SHA-256 digest of the tarball, c5e0d23424e88525bfba0ecdf0a432a8d93c885d04740df06a9eeee44e5f25e4, matches the digest preserved in the FreeBSD ports tree [2], giving further confidence that these files are as distributed by upstream. [1] http://archive.debian.org/debian/pool/contrib/p/pose/ [2] https://svnweb.freebsd.org/ports/head/palm/pose/distinfo?revision=271305&view=markup&pathrev=282162
Diffstat (limited to 'SrcShared/Palm/Platform')
-rw-r--r--SrcShared/Palm/Platform/Core/Hardware/IncsPrv/Hardware.h156
-rw-r--r--SrcShared/Palm/Platform/Core/Hardware/IncsPrv/HwrROMToken.h136
-rw-r--r--SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68328Hwr.h644
-rw-r--r--SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68EZ328Hwr.h708
-rw-r--r--SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68SZ328Hwr.h1078
-rw-r--r--SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68VZ328Hwr.h844
-rw-r--r--SrcShared/Palm/Platform/Core/System/IncsPrv/DataPrv.h308
-rw-r--r--SrcShared/Palm/Platform/Core/System/IncsPrv/DebugPrv.h439
-rw-r--r--SrcShared/Palm/Platform/Core/System/IncsPrv/Globals.h574
-rw-r--r--SrcShared/Palm/Platform/Core/System/IncsPrv/MemoryPrv.h603
-rw-r--r--SrcShared/Palm/Platform/Core/System/IncsPrv/SerialLinkPrv.h90
-rw-r--r--SrcShared/Palm/Platform/Core/System/IncsPrv/SysEvtPrv.h227
-rw-r--r--SrcShared/Palm/Platform/Core/System/IncsPrv/SystemPrv.h474
-rw-r--r--SrcShared/Palm/Platform/Core/System/Src/Crc.c257
-rw-r--r--SrcShared/Palm/Platform/Incs/BuildDefaults.h309
-rw-r--r--SrcShared/Palm/Platform/Incs/BuildDefines.h159
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/CoreTraps.h1505
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/Hardware/HAL.h99
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/Hardware/HwrMiscFlags.h220
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/Hardware/M68KHwr.h113
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Bitmap.h151
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/CharAttr.h129
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Chars.h411
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Crc.h63
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/DLCommon.h2433
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/DLServer.h418
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/DataMgr.h540
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/DateTime.h283
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/ErrorBase.h294
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/FeatureMgr.h89
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Font.h150
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/IntlMgr.h113
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/KeyMgr.h76
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/LocaleMgr.h230
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Localize.h54
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/MemoryMgr.h341
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/NetBitUtils.h135
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/NetMgr.h1515
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/OverlayMgr.h214
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/PalmLocale.h1258
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/PenMgr.h98
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Preferences.h428
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Rect.h83
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SerialLinkMgr.h437
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SerialMgr.h371
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SoundMgr.h317
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SysEvent.h204
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SysEvtMgr.h252
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SystemMgr.h1191
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SystemPkt.h430
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SystemResources.h346
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/TextMgr.h411
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Window.h559
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/UI/AttentionMgr.h209
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/UI/Control.h188
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/UI/Event.h347
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/UI/FatalAlert.h43
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/UI/Field.h275
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/UI/Find.h124
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/UI/Form.h510
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/UI/InsPoint.h60
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/UI/List.h134
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/UI/ScrollBar.h77
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/UI/Table.h319
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/UI/UIResources.h322
-rw-r--r--SrcShared/Palm/Platform/Incs/Libraries/LibTraps.h43
-rw-r--r--SrcShared/Palm/Platform/Incs/PalmTypes.h303
67 files changed, 25921 insertions, 0 deletions
diff --git a/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/Hardware.h b/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/Hardware.h
new file mode 100644
index 0000000..bf620c4
--- /dev/null
+++ b/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/Hardware.h
@@ -0,0 +1,156 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Hardware.h
+ *
+ * Description:
+ * General Hardware Equates. This header file
+ * contains general hardware configuration equates that are not dependent on
+ * the version of the hardware we're running on. Equates specific to
+ * a certain component like the 68328, etc. are contained in separate
+ * header files.
+ *
+ * History:
+ * 4/27/95 RM Created by Ron Marianetti
+ * 6/12/98 jhl Updated definitions for hwrNVPrefSet/Get
+ * 6/17/98 jhl added 'mbtx' ROM token def
+ * 8/17/98 SCL Synchronized HwrMiscFlags between Sumo/Eleven
+ * 9/14/98 jfs Added PrvKeyBootKeys def (see ROMBoot.c for info)
+ * 10/06/98 jfs Added software-only hardware ID and features detection defs
+ * 10/07/98 jfs Cleaned up hardware ID bit defs and made unused combos obvious
+ * 10/07/98 Bob Up max depth support to 8 bits per pixel
+ * 01/18/99 kwk Added Sumo TSM button heights.
+ * 05/27/99 lyl Added hwrROMTokenBoot7 and hwrROMTokenBoot8
+ * 06/14/99 SCL Split out most pieces to separate Hwr*.h files
+ * 07/14/99 kwk Addded HwrGetSilkscreenID.
+ *
+ *****************************************************************************/
+
+#ifdef NON_PORTABLE // So app's don't mistakenly include this
+
+#ifndef __HARDWARE_H__
+#define __HARDWARE_H__
+
+#include <CoreTraps.h>
+#include <HAL.h> // NOTE: needs to be reflected in Makefiles
+
+
+// Define # of card slots
+#if EMULATION_LEVEL == EMULATION_NONE
+#define hwrNumCardSlots 1 // 1 card slot
+#else
+#define hwrNumCardSlots 2 // 2 card slots for emulation
+#endif
+
+
+// HwrLCDGetDepth requests
+#define hwrLCDGetCurrentDepth 0 // Get depth display is currently set to
+
+// HwrGetSilkscreenID results
+// DOLATER kwk - should these go here or in UICommon.h?
+// DOLATER kwk - does Austin have a different layout?
+#define silkscreenOriginal 10000
+#define silkscreenPalmV 10001 // Screen is slightly narrower at bottom.
+
+#define silkscreenCustom 19000 // First id for custom silkscreens
+
+/**************************************************************************
+ * Prototypes of functions used only when running on the real hardware
+ ***************************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ // HAL routines installed into system traps from ROMHardwareXXX.c:
+ void HwrPreDebugInit(UInt32 cardHeaderAddr)
+ HAL_CALL(sysTrapHwrPreDebugInit);
+
+ void HwrResetNMI(void)
+ HAL_CALL(sysTrapHwrResetNMI);
+
+ void HwrResetPWM(void)
+ HAL_CALL(sysTrapHwrResetPWM);
+
+ UInt32 HwrMemWritable(void *addr)
+ HAL_CALL(sysTrapHwrMemWritable);
+
+ UInt32 HwrMemReadable(void *addr)
+ HAL_CALL(sysTrapHwrMemReadable);
+
+ Boolean HwrEnableDataWrites(void)
+ HAL_CALL(sysTrapHwrEnableDataWrites);
+
+ void HwrDisableDataWrites(void)
+ HAL_CALL(sysTrapHwrDisableDataWrites);
+
+
+ // HAL routines NOT installed into system traps from ROMHardwareXXX.c:
+ void PrvShutDownPLL(void);
+
+
+ // HAL routines installed into system traps from ROMHiHardwareXXX.c:
+ void HwrDoze(Boolean onlyNMI)
+ HAL_CALL(sysTrapHwrDoze);
+
+ Err HwrSetSystemClock(UInt32 *freqP)
+ HAL_CALL(sysTrapHwrSetSystemClock);
+
+ Err HwrSetCPUDutyCycle(UInt16 *dutyP)
+ HAL_CALL(sysTrapHwrSetCPUDutyCycle);
+
+ void HwrGetRAMMapping(void * /*CardInfoPtr*/ cardInfoP, UInt16 *numBlocksP,
+ UInt32 *physBlockInfoP, UInt32 *logBlockInfoP)
+ HAL_CALL(sysTrapHwrGetRAMMapping);
+
+ void HwrSleep(Boolean untilReset, Boolean emergency)
+ HAL_CALL(sysTrapHwrSleep);
+
+ Err HwrWake(void)
+ HAL_CALL(sysTrapHwrWake);
+
+ void HwrPostDebugInit(void)
+ HAL_CALL(sysTrapHwrPostDebugInit);
+
+ void HwrIdentifyFeatures(void)
+ HAL_CALL(sysTrapHwrIdentifyFeatures);
+
+ void HwrModelSpecificInit(void)
+ HAL_CALL(sysTrapHwrModelSpecificInit);
+
+ void HwrModelInitStage2(void)
+ HAL_CALL(sysTrapHwrModelInitStage2);
+
+
+ // Other routines:
+
+ UInt16 HwrGetSilkscreenID(void)
+ HAL_CALL(sysTrapHwrGetSilkscreenID);
+
+ void HwrWakeupIntHandler(void);
+
+/*
+ void PrvExecuteROMToken1(void);
+
+
+ void HwrRadioShutdown(void);
+*/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+/************************************************************
+ * Assembly Function Prototypes
+ *************************************************************/
+#define _HwrWake \
+ ASM_SYS_TRAP(sysTrapHwrWake)
+
+
+#endif //__HARDWARE_H__
+
+#endif // NON_PORTABLE
diff --git a/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/HwrROMToken.h b/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/HwrROMToken.h
new file mode 100644
index 0000000..cfa3d7d
--- /dev/null
+++ b/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/HwrROMToken.h
@@ -0,0 +1,136 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: HwrROMToken.h
+ *
+ * Description:
+ * Hardware ROM Token Equates.
+ *
+ * History:
+ * 5/31/99 SCL Created by Steve Lemke, extracted from <Hardware.h>
+ *
+ *****************************************************************************/
+
+#ifdef NON_PORTABLE // So app's don't mistakenly include this
+
+#ifndef __HWR_ROM_TOKEN_H__
+#define __HWR_ROM_TOKEN_H__
+
+
+
+//--------------------------------------------------------------------
+// Layout of the A to D convertor calibration ROM token.
+// This data is calculated for each unit during production, and burnt
+// into the ROM. It consists of 2 precise voltages which are
+// applied to the A to D convertor, as well as their respective outputs
+// from the A/D convertor. Because of manufacturing tolerances in the
+// convertor, its important that the conversion of the output (0-255)
+// into centivolts is tailored to each device during manufacturing.
+//--------------------------------------------------------------------
+typedef struct {
+ UInt16 lowCentivolts;
+ UInt16 lowAToDOutput;
+ UInt16 highCentivolts;
+ UInt16 highAToDOutput;
+} SysAToDCalibrationTokenType;
+
+
+
+#define hwrROMTokenSnum 'snum' // MUST be the first token, should be 12 bytes long
+ // Snum == Memory Card Flash ID (serial number)
+#define hwrROMTokenIrda 'irda' // present ONLY on memory card w/IrDA (Gordon)
+#define hwrROMTokenFlex 'flex' // present ONLY on memory card w/Flex pager (Cessna)
+#define hwrROMTokenBrst 'brst' // present ONLY when Sharp PSRAM is used (triggers PrvHwrBurstRefresh)
+#define hwrROMTokenBoot1 'cd01' // boot time code plug-in #1 (See RomBoot.c and HwrROMToken.c)
+#define hwrROMTokenBoot2 'cd02' // boot time code plug-in #2 (See RomBoot.c)
+#define hwrROMTokenBoot3 'cd03' // boot time code plug-in #3 (See RomBoot.c)
+#define hwrROMTokenBoot4 'cd04' // boot time code plug-in #4 (See RomBoot.c)
+#define hwrROMTokenBoot5 'cd05' // boot time code plug-in #5 (See HwrDisplayBootTD1.c)
+#define hwrROMTokenBoot6 'cd06' // boot time code plug-in #6 (See KeyMgrTD1.c)
+#define hwrROMTokenBoot7 'cd07' // boot time code plug-in #7 (See ROMHardwareEZ.c)
+#define hwrROMTokenBoot8 'cd08' // boot time code plug-in #8 (See ROMHardwareEZ.c)
+#define hwrROMTokenAToD 'adcc' // Data for the A to D Convertor calibration
+// 6/17/98 jhl
+#define hwrROMTokenMobitex 'mbtx' // Mobitex calibration and serial number
+#define hwrROMTokenAlkCal 'calk' // alkaline calibration value
+#define hwrROMTokenNicadCal 'cncd' // nicad calibration value
+
+
+// 3/2/99 SCL
+// The following defines are for the first ("manufacturer") digit of the 'snum' token.
+#define hwrManu
+typedef enum {
+ hwrSnumManu3Com1 = '1',
+ hwrSnumManuTRG = '4',
+ hwrSnumManu3Com5 = '5',
+ hwrSnumManu3Com6 = '6',
+ hwrSnumManuMotorola = '7',
+ hwrSnumManuSymbol = '8',
+ hwrSnumManuQualcomm = '9',
+ hwrSnumManu3ComE = 'E'
+ } HwrSnumManufacturerEnum;
+
+
+// 10/06/98 jfs
+// The following structure describes the format of the data field of the hwrROMTokenHardwareID ROM token.
+// Note the featureIDs field is a variable length structure in which the OEM can place any number
+// of IDs representing features of THEIR particular hardware. Only the oemID and productID fields
+// are mandatory, the values of which are assigned to the OEM partner by Palm Computing.
+typedef struct {
+ UInt32 oemID;
+ UInt32 productID;
+ UInt32 featureIDs[1]; // OEM-specific variable length data goes here (0 or more DWords)
+} HwrIDRec, *HwrIDRecP;
+
+// The following ROM token activates the software-only hardware ID and features detection code.
+// See HwrIdentifyFeatures for details.
+#define hwrROMTokenHardwareID 'hwid'
+
+// GHwrMiscFlags ROM tokens (each has a corresponding hwrMiscFlagXXX bit definition)
+#define hwrROMTokenHasBacklight 'hbkl'
+#define hwrROMTokenHasMbdIrDA 'hirm'
+#define hwrROMTokenHasCardIrDA 'hirc'
+#define hwrROMTokenHasBurrBrown 'hbbd'
+#define hwrROMTokenHasJerryHW 'hjrm'
+#define hwrROMTokenNoRTCBug 'hrtc'
+#define hwrROMTokenHas3vRef 'h3vr'
+#define hwrROMTokenHasAntennaSw 'hant'
+
+#define hwrROMTokenHasCradleDetect 'hcrd'
+#define hwrROMTokenHasSWContrast 'hswc'
+#define hwrROMTokenInvertLCDForBL 'hibl'
+#define hwrROMTokenHasMiscFlagExt 'hmfe'
+
+// GHwrMiscFlagsExt ROM tokens (each has a corresponding hwrMiscFlagExtXXX bit definition)
+#define hwrROMTokenExtHasLiIon 'hbli'
+#define hwrROMTokenExtHasRailIO 'hrio'
+
+// NOTE: The following (flash) tokens should never be used; they're ignored by HwrIdentifyFeatures
+//#define hwrROMTokenExtHasFlash 'hflr'
+//#define hwrROMTokenExtHasFParms 'hfpr'
+
+#define hwrROMTokenExt115KIrOK 'h115'
+
+
+
+/**************************************************************************
+ * Prototypes of functions used only when running on the real hardware
+ ***************************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+Err HwrGetROMToken (UInt16 cardNo, UInt32 token, UInt8 **dataP, UInt16 * sizeP )
+ HAL_CALL(sysTrapHwrGetROMToken);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif //__HWR_ROM_TOKEN_H__
+
+#endif // NON_PORTABLE
diff --git a/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68328Hwr.h b/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68328Hwr.h
new file mode 100644
index 0000000..730dcfe
--- /dev/null
+++ b/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68328Hwr.h
@@ -0,0 +1,644 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: M68328Hwr.h
+ *
+ * Description:
+ * Hardware Equates for the Motorola 68328 Dragonball chip
+ *
+ * History:
+ * 4/19/95 RM - Created by Ron Marianetti
+ * 5/15/95 VMK - Added macros for RTC bits
+ * 6/12/98 jhl - Added define for chip select readonly bit
+ * 10/8/98 jhl - Imported chip ID stuff from EZ defs
+ * (not applicable to some earlier devices)
+ * 5/31/99 SCL - Moved hwr68328Base into this file from <HardwarePrv.h>
+ *
+ *****************************************************************************/
+
+#ifdef NON_PORTABLE // So apps don't include this...
+
+
+#ifndef __M68328HWR_H__
+#define __M68328HWR_H__
+
+
+#include <PalmTypes.h> // Touchdown includes
+
+
+// Define location of the 68328 Dragonball chip
+#define hwr68328Base 0xFFFFF000L // Base address of 68328
+
+
+/***********************************************************************
+ * Motorola 68328 registers
+ ***********************************************************************/
+struct HwrM68328Type {
+
+ UInt8 scr; // $000: System Control Register
+ UInt8 ___filler0[0x004-0x001];
+
+ // The following ID stuff is not present on earlier chips (before ??)
+ UInt8 chipID; // $004: Chip ID Register
+ UInt8 maskID; // $005: Mask ID Register
+ UInt16 swID; // $006: Software ID Register
+ UInt8 ___filler1[0x100-0x008];
+
+ UInt16 csAGroupBase; // $100: Chip Select Group A Base Register
+ UInt16 csBGroupBase; // $102: Chip Select Group B Base Register
+ UInt16 csCGroupBase; // $104: Chip Select Group C Base Register
+ UInt16 csDGroupBase; // $106: Chip Select Group D Base Register
+
+ UInt16 csAGroupMask; // $108: Chip Select Group A Mask Register
+ UInt16 csBGroupMask; // $10A: Chip Select Group B Mask Register
+ UInt16 csCGroupMask; // $10C: Chip Select Group C Mask Register
+ UInt16 csDGroupMask; // $10E: Chip Select Group D Mask Register
+
+ UInt32 csASelect0; // $110: Group A Chip Select 0 Register
+ UInt32 csASelect1; // $114: Group A Chip Select 1 Register
+ UInt32 csASelect2; // $118: Group A Chip Select 2 Register
+ UInt32 csASelect3; // $11C: Group A Chip Select 3 Register
+
+ UInt32 csBSelect0; // $120: Group B Chip Select 0 Register
+ UInt32 csBSelect1; // $124: Group B Chip Select 1 Register
+ UInt32 csBSelect2; // $128: Group B Chip Select 2 Register
+ UInt32 csBSelect3; // $12C: Group B Chip Select 3 Register
+
+ UInt32 csCSelect0; // $130: Group C Chip Select 0 Register
+ UInt32 csCSelect1; // $134: Group C Chip Select 1 Register
+ UInt32 csCSelect2; // $138: Group C Chip Select 2 Register
+ UInt32 csCSelect3; // $13C: Group C Chip Select 3 Register
+
+ UInt32 csDSelect0; // $140: Group D Chip Select 0 Register
+ UInt32 csDSelect1; // $144: Group D Chip Select 1 Register
+ UInt32 csDSelect2; // $148: Group D Chip Select 2 Register
+ UInt32 csDSelect3; // $14C: Group D Chip Select 3 Register
+
+ UInt16 csDebug; // $150: Chip Select debug register
+ UInt8 ___filler2[0x200-0x152];
+
+ UInt16 pllControl; // $200: PLL Control Register
+ UInt16 pllFreqSel; // $202: PLL Frequency Select Register
+ UInt16 pllTest; // $204: PLL Test Register
+ UInt8 __filler44;
+ UInt8 pwrControl; // $207: Power Control Register
+
+ UInt8 ___filler3[0x300-0x208];
+
+ UInt8 intVector; // $300: Interrupt Vector Register
+ UInt8 ___filler4;
+ UInt16 intControl; // $302: Interrupt Control Register
+ UInt16 intMaskHi; // $304: Interrupt Mask Register/HIGH word
+ UInt16 intMaskLo; // $306: Interrupt Mask Register/LOW word
+ UInt16 intWakeupEnHi; // $308: Interrupt Wakeup Enable Register
+ UInt16 intWakeupEnLo; // $30A: Interrupt Wakeup Enable Register
+ UInt16 intStatusHi; // $30C: Interrupt Status Register/HIGH word
+ UInt16 intStatusLo; // $30E: Interrupt Status Register/LOW word
+ UInt16 intPendingHi; // $310: Interrupt Pending Register
+ UInt16 intPendingLo; // $312: Interrupt Pending Register
+
+ UInt8 ___filler4a[0x400-0x314];
+
+ UInt8 portADir; // $400: Port A Direction Register
+ UInt8 portAData; // $401: Port A Data Register
+ UInt8 ___filler5;
+ UInt8 portASelect; // $403: Port A Select Register
+
+ UInt8 ___filler6[4];
+
+ UInt8 portBDir; // $408: Port B Direction Register
+ UInt8 portBData; // $409: Port B Data Register
+ UInt8 ___filler7;
+ UInt8 portBSelect; // $40B: Port B Select Register
+
+ UInt8 ___filler8[4];
+
+ UInt8 portCDir; // $410: Port C Direction Register
+ UInt8 portCData; // $411: Port C Data Register
+ UInt8 ___filler9;
+ UInt8 portCSelect; // $413: Port C Select Register
+
+ UInt8 ___filler10[4];
+
+ UInt8 portDDir; // $418: Port D Direction Register
+ UInt8 portDData; // $419: Port D Data Register
+ UInt8 portDPullupEn; // $41A: Port D Pull-up Enable
+ UInt8 ___filler11;
+ UInt8 portDPolarity; // $41C: Port D Polarity Register
+ UInt8 portDIntReqEn; // $41D: Port D Interrupt Request Enable
+ UInt8 ___filler12;
+ UInt8 portDIntEdge; // $41F: Port D IRQ Edge Register
+
+ UInt8 portEDir; // $420: Port E Direction Register
+ UInt8 portEData; // $421: Port E Data Register
+ UInt8 portEPullupEn; // $422: Port E Pull-up Enable
+ UInt8 portESelect; // $423: Port E Select Register
+
+ UInt8 ___filler14[4];
+
+ UInt8 portFDir; // $428: Port F Direction Register
+ UInt8 portFData; // $429: Port F Data Register
+ UInt8 portFPullupEn; // $42A: Port F Pull-up Enable
+ UInt8 portFSelect; // $42B: Port F Select Register
+
+ UInt8 ___filler16[4];
+
+ UInt8 portGDir; // $430: Port G Direction Register
+ UInt8 portGData; // $431: Port G Data Register
+ UInt8 portGPullupEn; // $432: Port G Pull-up Enable
+ UInt8 portGSelect; // $433: Port G Select Register
+
+ UInt8 ___filler18[4];
+
+ UInt8 portJDir; // $438: Port J Direction Register
+ UInt8 portJData; // $439: Port J Data Register
+ UInt8 ___filler19;
+ UInt8 portJSelect; // $43B: Port J Select Register
+
+ UInt8 ___filler19a[4];
+
+ UInt8 portKDir; // $440: Port K Direction Register
+ UInt8 portKData; // $441: Port K Data Register
+ UInt8 portKPullupEn; // $442: Port K Pull-up Enable
+ UInt8 portKSelect; // $443: Port K Select Register
+
+ UInt8 ___filler21[4];
+
+ UInt8 portMDir; // $448: Port M Direction Register
+ UInt8 portMData; // $449: Port M Data Register
+ UInt8 portMPullupEn; // $44A: Port M Pull-up Enable Register
+ UInt8 portMSelect; // $44B: Port M Select Register
+
+ UInt8 ___filler22[4];
+
+ UInt8 ___filler23[0x500-0x450];
+
+ UInt16 pwmControl; // $500: PWM Control Register
+ UInt16 pwmPeriod; // $502: PWM Period Register
+ UInt16 pwmWidth; // $504: PWM Width Register
+ UInt16 pwmCounter; // $506: PWM Counter
+
+ UInt8 ___filler24[0x600-0x508];
+
+ UInt16 tmr1Control; // $600: Timer 1 Control Register
+ UInt16 tmr1Prescaler; // $602: Timer 1 Prescaler Register
+ UInt16 tmr1Compare; // $604: Timer 1 Compare Register
+ UInt16 tmr1Capture; // $606: Timer 1 Capture Register
+ UInt16 tmr1Counter; // $608: Timer 1 Counter Register
+ UInt16 tmr1Status; // $60A: Timer 1 Status Register
+
+ UInt16 tmr2Control; // $60C: Timer 2 Control Register
+ UInt16 tmr2Prescaler; // $60E: Timer 2 Prescaler Register
+ UInt16 tmr2Compare; // $610: Timer 2 Compare Register
+ UInt16 tmr2Capture; // $612: Timer 2 Capture Register
+ UInt16 tmr2Counter; // $614: Timer 2 Counter Register
+ UInt16 tmr2Status; // $616: Timer 2 Status Register
+
+ UInt16 wdControl; // $618: Watchdog Control Register
+ UInt16 wdReference; // $61A: Watchdog Reference Register
+ UInt16 wdCounter; // $61C: Watchdog Counter
+
+ UInt8 ___filler25[0x700-0x61E];
+
+ UInt16 spiSlave; // $700: SPI Slave Register
+
+ UInt8 ___filler26[0x800-0x702];
+
+ UInt16 spiMasterData; // $800: SPI Master Data Register
+ UInt16 spiMasterControl; // $802: SPI Master Control Register
+
+ UInt8 ___filler27[0x900-0x804];
+
+ UInt16 uControl; // $900: Uart Control Register
+ UInt16 uBaud; // $902: Uart Baud Control Register
+ UInt16 uReceive; // $904: Uart Receive Register
+ UInt16 uTransmit; // $906: Uart Transmit Register
+ UInt16 uMisc; // $908: Uart Miscellaneous Register
+
+ UInt8 ___filler28[0xA00-0x90A];
+
+ UInt32 lcdStartAddr; // $A00: Screen Starting Address Register
+ UInt8 ___filler29;
+ UInt8 lcdPageWidth; // $A05: Virtual Page Width Register
+ UInt8 ___filler30[2];
+ UInt16 lcdScreenWidth; // $A08: Screen Width Register
+ UInt16 lcdScreenHeight; // $A0A: Screen Height Register
+ UInt8 ___filler31[0xA18-0xA0C];
+ UInt16 lcdCursorXPos; // $A18: Cursor X Position
+ UInt16 lcdCursorYPos; // $A1A: Cursor Y Position
+ UInt16 lcdCursorWidthHeight; // $A1C: Cursor Width and Height
+ UInt8 ___filler32;
+ UInt8 lcdBlinkControl; // $A1F: Blink Control Register
+ UInt8 lcdPanelControl; // $A20: Panel Interface Control Register
+ UInt8 lcdPolarity; // $A21: Polarity Config Register
+ UInt8 ___filler33;
+ UInt8 lcdACDRate; // $A23: ACD (M) Rate Control Register
+ UInt8 ___filler34;
+ UInt8 lcdPixelClock; // $A25: Pixel Clock Divider Register
+ UInt8 ___filler35;
+ UInt8 lcdClockControl; // $A27: Clocking Control Register
+ UInt8 ___filler36;
+ UInt8 lcdLastBufferAddr; // $A29: Last Buffer Address Register
+ UInt8 ___filler37;
+ UInt8 lcdOctetTermCount; // $A2B: Octet Terminal Count Register
+ UInt8 ___filler38;
+ UInt8 lcdPanningOffset; // $A2D: Panning Offset Register
+ UInt8 ___filler39[3];
+ UInt8 lcdFrameRate; // $A31: Frame Rate Control Modulation Register
+ UInt16 lcdGrayPalette; // $A32: Gray Palette Mapping Register
+ UInt8 lcdReserved; // $A34: Reserved
+
+ UInt8 ___filler40[0xB00-0xA35];
+
+ UInt32 rtcHourMinSec; // $B00: RTC Hours, Minutes, Seconds Register
+ UInt32 rtcAlarm; // $B04: RTC Alarm Register
+ UInt32 rtcReserved; // $B08: RTC Reserved
+ UInt16 rtcControl; // $B0C: RTC Control Register
+ UInt16 rtcIntStatus; // $B0E: RTC Interrupt Status Register
+ UInt16 rtcIntEnable; // $B10: RTC Interrupt Enable Register
+ UInt16 stopWatch; // $B12: Stopwatch Minutes
+};
+
+typedef volatile struct HwrM68328Type* HwrM68328Ptr;
+
+#define HwrDBallType HwrM68328Type
+#define HwrDBallPtr HwrM68328Ptr
+
+/************************************************************************
+ * Chip Select Bits
+ ************************************************************************/
+#define hwr328ChipSelectReadonly 0x00000008
+
+/************************************************************************
+ * LCD Controller Bits
+ ************************************************************************/
+#define hwr328LcdCursorXPosCtlMask 0xC000
+ #define hwr328LcdCursorXPosCtlTrans 0x0000
+ #define hwr328LcdCursorXPosCtlBlack 0x4000
+ #define hwr328LcdCursorXPosCtlReverse 0x8000
+
+#define hwr328LcdBlinkControlEnable 0x80
+
+#define hwr328LcdPanelControlBusMask 0x06
+ #define hwr328LcdPanelControlBus1Bit 0x00
+ #define hwr328LcdPanelControlBus2Bit 0x02
+ #define hwr328LcdPanelControlBus4Bit 0x04
+#define hwr328LcdPanelControlGrayScale 0x01
+
+#define hwr328LcdPolarityShiftClock 0x08
+#define hwr328LcdPolarityFLM 0x04
+#define hwr328LcdPolarityLP 0x02
+#define hwr328LcdPolarityPixel 0x01
+
+#define hwr328LcdClockControlEnable 0x80
+#define hwr328LcdClockControl16WordBursts 0x40
+#define hwr328LcdClockControlBurstRateMask 0x30
+
+// New dragonball allows up to 16 clocks/word
+#define hwr328LcdClockControlBurstRate1 0x00
+#define hwr328LcdClockControlBurstRate2 0x04
+#define hwr328LcdClockControlBurstRate3 0x08
+#define hwr328LcdClockControlBurstRate4 0x0C
+#define hwr328LcdClockControlBurstRate5 0x10
+#define hwr328LcdClockControlBurstRate6 0x14
+#define hwr328LcdClockControlBurstRate7 0x18
+#define hwr328LcdClockControlBurstRate8 0x1C
+#define hwr328LcdClockControlBurstRate9 0x20
+#define hwr328LcdClockControlBurstRate10 0x24
+#define hwr328LcdClockControlBurstRate11 0x28
+#define hwr328LcdClockControlBurstRate12 0x2C
+#define hwr328LcdClockControlBurstRate13 0x30
+#define hwr328LcdClockControlBurstRate14 0x34
+#define hwr328LcdClockControlBurstRate15 0x38
+#define hwr328LcdClockControlBurstRate16 0x3C
+
+#define hwr328LcdClockControl8BitBus 0x02
+#define hwr328LcdClockControlPixelClkSrc 0x01
+
+
+/************************************************************************
+ * Interrupt Controller Bits
+ ************************************************************************/
+// intMaskHi bits
+// NOTE: Due to a bug in early rev's of the DragonBall, the clear bits for
+// IRQ[1236] on those early chips were different than the indicator bits
+// (the order was reversed). So some older code uses the OR of the IRQ1 and
+// IRQ6 bits for either, and the OR of the IRQ2 and IRQ3 bits for either.
+#define hwr328IntHiNMI 0x0080
+#define hwr328IntHiTimer1 0x0040
+#define hwr328IntHiSPIS 0x0020
+#define hwr328IntHiPen 0x0010
+#define hwr328IntHiIRQ6 0x0008
+#define hwr328IntHiIRQ3 0x0004
+#define hwr328IntHiIRQ2 0x0002
+#define hwr328IntHiIRQ1 0x0001
+
+//NOTE: Due to a bug in early rev's of the DragonBall, the clear bits for
+/// IRQ1,2,3,6 are different than the indicator bits
+#define hwr328IntHiIRQ6Clr 0x0001
+#define hwr328IntHiIRQ3Clr 0x0002
+#define hwr328IntHiIRQ2Clr 0x0004
+#define hwr328IntHiIRQ1Clr 0x0008
+
+// intMaskLo bits
+#define hwr328IntLoInt7 0x8000
+#define hwr328IntLoInt6 0x4000
+#define hwr328IntLoInt5 0x2000
+#define hwr328IntLoInt4 0x1000
+#define hwr328IntLoInt3 0x0800
+#define hwr328IntLoInt2 0x0400
+#define hwr328IntLoInt1 0x0200
+#define hwr328IntLoInt0 0x0100
+#define hwr328IntLoAllKeys 0xFF00
+#define hwr328IntLoInt0Bit 8
+#define hwr328IntLoPWM 0x0080
+#define hwr328IntLoPWMBit 7
+#define hwr328IntLoKbd 0x0040
+#define hwr328IntLoLCDC 0x0020
+#define hwr328IntLoRTC 0x0010
+#define hwr328IntLoRTCBit 4
+#define hwr328IntLoWDT 0x0008
+#define hwr328IntLoUART 0x0004
+#define hwr328IntLoUARTBit 2
+#define hwr328IntLoTimer2 0x0002
+#define hwr328IntLoTimer2Bit 1
+#define hwr328IntLoSPIM 0x0001
+
+// intControl bits
+// NOTE: These are different (at least in version 0G58E) that documented in the
+// User's manual
+#define hwr328IntCtlEdge1 0x0800
+#define hwr328IntCtlEdge2 0x0400
+#define hwr328IntCtlEdge3 0x0200
+#define hwr328IntCtlEdge6 0x0100
+#define hwr328IntCtlPol1 0x8000
+#define hwr328IntCtlPol2 0x4000
+#define hwr328IntCtlPol3 0x2000
+#define hwr328IntCtlPol6 0x1000
+
+
+/************************************************************************
+ * Timer bits
+ ************************************************************************/
+#define hwr328TmrControlUnused 0xFE00
+#define hwr328TmrControlFreeRun 0x0100
+#define hwr328TmrControlCaptureEdgeMask 0x00C0
+ #define hwr328TmrControlCaptureEdgeNone 0x0000
+ #define hwr328TmrControlCaptureEdgeRising 0x0040
+ #define hwr328TmrControlCaptureEdgeFalling 0x0080
+ #define hwr328TmrControlCaptureEdgeBoth 0x00C0
+#define hwr328TmrControlOutputModeToggle 0x0020
+#define hwr328TmrControlEnInterrupt 0x0010
+#define hwr328TmrControlClkSrcMask 0x000E
+ #define hwr328TmrControlClkSrcStop 0x0000
+ #define hwr328TmrControlClkSrcSys 0x0002
+ #define hwr328TmrControlClkSrcSysBy16 0x0004
+ #define hwr328TmrControlClkSrcTIN 0x0006
+ #define hwr328TmrControlClkSrc32KHz 0x0008
+#define hwr328TmrControlEnable 0x0001
+
+#define hwr328TmrStatusCapture 0x0002
+#define hwr328TmrStatusCaptureBit 1
+#define hwr328TmrStatusCompare 0x0001
+#define hwr328TmrStatusCompareBit 0
+
+
+/************************************************************************
+ * 68328 Serial Port Register Bits
+ ************************************************************************/
+// uControl Register
+#define hwr328UControlUARTEnable 0x8000
+#define hwr328UControlRxEnable 0x4000
+#define hwr328UControlTxEnable 0x2000
+#define hwr328UControlRxClock1x 0x1000
+#define hwr328UControlParityEn 0x0800
+#define hwr328UControlParityOdd 0x0400
+#define hwr328UControlStopBits2 0x0200
+#define hwr328UControlDataBits8 0x0100
+#define hwr328UControlGPIODeltaEn 0x0080
+#define hwr328UControlCTSDeltaEn 0x0040
+#define hwr328UControlRxFullEn 0x0020
+#define hwr328UControlRxHalfEn 0x0010
+#define hwr328UControlRxRdyEn 0x0008
+#define hwr328UControlTxEmptyEn 0x0004
+#define hwr328UControlTxHalfEn 0x0002
+#define hwr328UControlTxAvailEn 0x0001
+
+#define hwr328UControlEnableAll (hwr328UControlUARTEnable | \
+ hwr328UControlRxEnable | \
+ hwr328UControlTxEnable)
+
+// uBaud Register
+#define hwr328UBaudGPIODelta 0x8000
+#define hwr328UBaudGPIOData 0x4000
+#define hwr328UBaudGPIODirOut 0x2000
+#define hwr328UBaudGPIOSrcBaudGen 0x1000
+#define hwr328UBaudBaudSrcGPIO 0x0800
+#define hwr328UBaudDivider 0x0700
+#define hwr328UBaudPrescaler 0x003F
+
+#define hwr328UBaudDivideBitOffset 8
+
+
+// uReceive Register
+#define hwr328UReceiveFIFOFull 0x8000
+#define hwr328UReceiveFIFOHalf 0x4000
+#define hwr328UReceiveDataRdy 0x2000
+#define hwr328UReceiveDataRdyBit 13
+#define hwr328UReceiveOverrunErr 0x0800
+#define hwr328UReceiveOverrunErrBit 11
+#define hwr328UReceiveFrameErr 0x0400
+#define hwr328UReceiveFrameErrBit 10
+#define hwr328UReceiveBreakErr 0x0200
+#define hwr328UReceiveBreakErrBit 9
+#define hwr328UReceiveParityErr 0x0100
+#define hwr328UReceiveParityErrBit 8
+#define hwr328UReceiveData 0x00FF
+
+#define hwr328UReceiveErrsMask (hwr328UReceiveOverrunErr | \
+ hwr328UReceiveFrameErr | \
+ hwr328UReceiveBreakErr | \
+ hwr328UReceiveParityErr)
+
+// uTransmit Register
+#define hwr328UTransmitFIFOEmpty 0x8000
+#define hwr328UTransmitFIFOHalf 0x4000
+#define hwr328UTransmitTxAvail 0x2000
+#define hwr328UTransmitSendBreak 0x1000
+#define hwr328UTransmitIgnoreCTS 0x0800
+#define hwr328UTransmitCTSStatus 0x0200
+#define hwr328UTransmitCTSDelta 0x0100
+#define hwr328UTransmitData 0x00FF
+
+// uMisc Register
+#define hwr328UMiscClkSrcGPIO 0x4000
+#define hwr328UMiscForceParityErr 0x2000
+#define hwr328UMiscLoopback 0x1000
+#define hwr328UMiscReservedMask 0x8F00
+#define hwr328UMiscRTSThruFIFO 0x0080
+#define hwr328UMiscRTSOut 0x0040
+#define hwr328UMiscIRDAEn 0x0020
+#define hwr328UMiscLoopIRDA 0x0010
+#define hwr328UMiscUnused 0x000F
+
+
+
+/************************************************************************
+ * PWM Bits
+ ************************************************************************/
+// PWM register bits of interest
+#define hwr328PWMControlEnable 0x0010
+#define hwr328PWMControlEnableBit 4
+#define hwr328PWMControlEnableIRQ 0x4000
+#define hwr328PWMControlLoad 0x0100
+#define hwr328PWMIRQStatus 0x8000
+// PWM divider chain output selectors
+#define hwr328PWMControlDivMask 0x0007
+#define hwr328PWMControlDivBy2 0x0
+#define hwr328PWMControlDivBy4 0x1
+#define hwr328PWMControlDivBy8 0x2
+#define hwr328PWMControlDivBy16 0x3
+#define hwr328PWMControlDivBy32 0x4
+#define hwr328PWMControlDivBy64 0x5
+#define hwr328PWMControlDivBy128 0x6
+#define hwr328PWMControlDivBy256 0x7
+
+
+/************************************************************************
+ * PLL Bits
+ ************************************************************************/
+#define hwr328PLLControlDisable 0x0008
+#define hwr328PLLControlClkEn 0x0010
+
+#define hwr328PLLControlSysVCODiv2 0x0000
+#define hwr328PLLControlSysVCODiv4 0x0100
+#define hwr328PLLControlSysVCODiv8 0x0200
+#define hwr328PLLControlSysVCODiv16 0x0300
+#define hwr328PLLControlSysVCODiv1 0x0400
+
+#define hwr328PLLControlPixVCODiv2 0x0000
+#define hwr328PLLControlPixVCODiv4 0x080
+#define hwr328PLLControlPixVCODiv8 0x1000
+#define hwr328PLLControlPixVCODiv16 0x1800
+#define hwr328PLLControlPixVCODiv1 0x2000
+
+/************************************************************************
+ * Real Time Clock (RTC) Bits
+ ************************************************************************/
+
+// RTC Control Register (RTCCTL) bits
+#define hwr328RTCControlRTCEnable 0x80
+#define hwr328RTCControlRefSelMask 0x20
+#define hwr328RTCControlRefSel38400 0x20 // 38.4 kHz reference frequency
+#define hwr328RTCControlRefSel32768 0x00 // 32.768 kHz reference frequency
+
+// RTC Interrupt Enable Register (RTCIENR) bits
+#define hwr328RTCIntEnableSec 0x10
+#define hwr328RTCIntEnable24Hr 0x08
+#define hwr328RTCIntEnableAlarm 0x04
+#define hwr328RTCIntEnableMinute 0x02
+#define hwr328RTCIntEnableStopWatch 0x01
+
+// RTC Interrupt Status Register bits
+#define hwr328RTCIntStatusSec 0x10
+#define hwr328RTCIntStatus24Hr 0x08
+#define hwr328RTCIntStatusAlarm 0x04
+#define hwr328RTCIntStatusMinute 0x02
+#define hwr328RTCIntStatusStopWatch 0x01
+
+// RTC Alarm register (RTCALRM) masks and offsets
+#define hwr328RTCAlarmSecondsMask 0x0000003fL
+#define hwr328RTCAlarmSecondsOffset 0
+#define hwr328RTCAlarmMinutesMask 0x003f0000L
+#define hwr328RTCAlarmMinutesOffset 16
+#define hwr328RTCAlarmHoursMask 0x1f000000L
+#define hwr328RTCAlarmHoursOffset 24
+
+// RTC hours/minutes/seconds register (RTCHMS) masks and offsets
+#define hwr328RTCHourMinSecSecondsMask 0x0000003fL
+#define hwr328RTCHourMinSecSecondsOffset 0
+#define hwr328RTCHourMinSecMinutesMask 0x003f0000L
+#define hwr328RTCHourMinSecMinutesOffset 16
+#define hwr328RTCHourMinSecHoursMask 0x1f000000L
+#define hwr328RTCHourMinSecHoursOffset 24
+
+
+/************************************************************************
+ * SPI Master bits
+ ************************************************************************/
+#define hwr328SPIMControlRateMask 0xE000
+ #define hwr328SPIMControlRateDiv4 0x0000
+ #define hwr328SPIMControlRateDiv8 0x2000
+ #define hwr328SPIMControlRateDiv16 0x4000
+ #define hwr328SPIMControlRateDiv32 0x6000
+ #define hwr328SPIMControlRateDiv64 0x8000
+ #define hwr328SPIMControlRateDiv128 0xA000
+ #define hwr328SPIMControlRateDiv256 0xC000
+ #define hwr328SPIMControlRateDiv512 0xE000
+#define hwr328SPIMControlEnable 0x0200
+#define hwr328SPIMControlExchange 0x0100
+#define hwr328SPIMControlIntStatus 0x0080
+#define hwr328SPIMControlIntEnable 0x0040
+#define hwr328SPIMControlOppPhase 0x0020
+#define hwr328SPIMControlInvPolarity 0x0010
+#define hwr328SPIMControlBitsMask 0x000F
+
+
+/************************************************************************
+ * I/O Port C pins
+ ************************************************************************/
+#define hwr328PortCMOClk 0x01
+#define hwr328PortCUDS 0x02
+#define hwr328PortCLDS 0x04
+#define hwr328PortCNMI 0x10
+#define hwr328PortCDTack 0x20
+#define hwr328PortCPcmciaWE 0x40
+
+
+/************************************************************************
+ * I/O Port G pins
+ ************************************************************************/
+#define hwr328PortGUartTxD 0x01
+#define hwr328PortGUartRxD 0x02
+#define hwr328PortGPwmOut 0x04
+#define hwr328PortGTOut2 0x08
+#define hwr328PortGTIn2 0x10
+#define hwr328PortGTOut1 0x20
+#define hwr328PortGTIn1 0x40
+#define hwr328PortGRtcOut 0x80
+
+
+/************************************************************************
+ * I/O Port K pins
+ ************************************************************************/
+#define hwr328PortKSpimTxD 0x01
+#define hwr328PortKSpimRxD 0x02
+#define hwr328PortKSpimClkO 0x04
+#define hwr328PortKSpisEn 0x08
+#define hwr328PortKSpisRxD 0x10
+#define hwr328PortKSpisClkI 0x20
+#define hwr328PortKPcmciaCE2 0x40
+#define hwr328PortKPcmciaCE1 0x80
+
+
+/************************************************************************
+ * I/O Port M pins
+ ************************************************************************/
+#define hwr328PortMCTS 0x01
+#define hwr328PortMRTS 0x02
+#define hwr328PortMIRQ6 0x04
+#define hwr328PortMIRQ3 0x08
+#define hwr328PortMIRQ2 0x10
+#define hwr328PortMIRQ1 0x20
+#define hwr328PortMPenIRQ 0x40
+#define hwr328PortMUnused7 0x80
+
+
+
+
+
+#endif // __M68328_H__
+
+#endif // NON_PORTABLE
diff --git a/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68EZ328Hwr.h b/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68EZ328Hwr.h
new file mode 100644
index 0000000..0645d09
--- /dev/null
+++ b/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68EZ328Hwr.h
@@ -0,0 +1,708 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: M68EZ328Hwr.h
+ *
+ * Description:
+ * Hardware Equates for the Motorola 68EZ328 Dragonball-EZ chip
+ *
+ * History:
+ * 11/13/97 srj Created from M68328Hwr.h
+ * 3/30/99 jrb Added JerryEZ pld defines
+ * 4/ 5/99 jrb Added JerryEZ pld shadow register bit defines
+ * 5/31/99 SCL Moved hwr68328Base into this file from <HardwarePrv.h>
+ *
+ *****************************************************************************/
+
+#ifdef NON_PORTABLE // So apps don't include this...
+
+
+#ifndef __M68EZ328HWR_H__
+#define __M68EZ328HWR_H__
+
+
+#include <PalmTypes.h> // Touchdown includes
+
+
+// Define location of the 68328 Dragonball chip
+#define hwr68328Base 0xFFFFF000L // Base address of 68328
+
+
+/***********************************************************************
+ * Motorola 68328 registers
+ ***********************************************************************/
+struct HwrM68EZ328Type {
+
+ UInt8 scr; // $000: System Control Register
+ UInt8 ___filler0[0x004-0x001];
+ UInt8 chipID; // $004: Chip ID Register
+ UInt8 maskID; // $005: Mask ID Register
+ UInt16 swID; // $006: Software ID Register
+ UInt8 ___filler1[0x100-0x008];
+
+ UInt16 csAGroupBase; // $100: Chip Select Group A Base Register
+ UInt16 csBGroupBase; // $102: Chip Select Group B Base Register
+ UInt16 csCGroupBase; // $104: Chip Select Group C Base Register
+ UInt16 csDGroupBase; // $106: Chip Select Group D Base Register
+
+ UInt8 ___filler6[0x110-0x108];
+
+ UInt16 csASelect; // $110: Group A Chip Select Register
+ UInt16 csBSelect; // $112: Group B Chip Select Register
+ UInt16 csCSelect; // $114: Group C Chip Select Register
+ UInt16 csDSelect; // $116: Group D Chip Select Register
+
+ UInt16 emuCS; // $118: EMU Chip Select Register
+
+ UInt8 ___filler2[0x200-0x11A];
+
+ UInt16 pllControl; // $200: PLL Control Register
+ UInt16 pllFreqSel; // $202: PLL Frequency Select Register
+ UInt16 pllTest; // $204: PLL Test Register (do not access)
+ UInt8 ___filler44;
+ UInt8 pwrControl; // $207: Power Control Register
+
+ UInt8 ___filler3[0x300-0x208];
+
+ UInt8 intVector; // $300: Interrupt Vector Register
+ UInt8 ___filler4;
+ UInt16 intControl; // $302: Interrupt Control Register
+ UInt16 intMaskHi; // $304: Interrupt Mask Register/HIGH word
+ UInt16 intMaskLo; // $306: Interrupt Mask Register/LOW word
+ UInt8 ___filler7[0x30c-0x308];
+ UInt16 intStatusHi; // $30C: Interrupt Status Register/HIGH word
+ UInt16 intStatusLo; // $30E: Interrupt Status Register/LOW word
+ UInt16 intPendingHi; // $310: Interrupt Pending Register
+ UInt16 intPendingLo; // $312: Interrupt Pending Register
+
+ UInt8 ___filler4a[0x400-0x314];
+
+ UInt8 portADir; // $400: Port A Direction Register
+ UInt8 portAData; // $401: Port A Data Register
+ UInt8 portAPullupEn; // $402: Port A Pullup Enable (similar to Select on DB)
+ UInt8 ___filler8[5];
+
+ UInt8 portBDir; // $408: Port B Direction Register
+ UInt8 portBData; // $409: Port B Data Register
+ UInt8 portBPullupEn; // $40A: Port B Pullup Enable
+ UInt8 portBSelect; // $40B: Port B Select Register
+
+ UInt8 ___filler9[4];
+
+ UInt8 portCDir; // $410: Port C Direction Register
+ UInt8 portCData; // $411: Port C Data Register
+ UInt8 portCPulldnEn; // $412: Port C Pulldown Enable
+ UInt8 portCSelect; // $413: Port C Select Register
+
+ UInt8 ___filler10[4];
+
+ UInt8 portDDir; // $418: Port D Direction Register
+ UInt8 portDData; // $419: Port D Data Register
+ UInt8 portDPullupEn; // $41A: Port D Pull-up Enable
+ UInt8 portDSelect; // $41B: Port D Select Register
+ UInt8 portDPolarity; // $41C: Port D Polarity Register
+ UInt8 portDIntReqEn; // $41D: Port D Interrupt Request Enable
+ UInt8 portDKbdIntEn; // $41E: Port D Keyboard Interrupt Enable
+ UInt8 portDIntEdge; // $41F: Port D IRQ Edge Register
+
+ UInt8 portEDir; // $420: Port E Direction Register
+ UInt8 portEData; // $421: Port E Data Register
+ UInt8 portEPullupEn; // $422: Port E Pull-up Enable
+ UInt8 portESelect; // $423: Port E Select Register
+
+ UInt8 ___filler14[4];
+
+ UInt8 portFDir; // $428: Port F Direction Register
+ UInt8 portFData; // $429: Port F Data Register
+ UInt8 portFPullupdnEn; // $42A: Port F Pull-up/down Enable
+ UInt8 portFSelect; // $42B: Port F Select Register
+
+ UInt8 ___filler16[4];
+
+ UInt8 portGDir; // $430: Port G Direction Register
+ UInt8 portGData; // $431: Port G Data Register
+ UInt8 portGPullupEn; // $432: Port G Pull-up Enable
+ UInt8 portGSelect; // $433: Port G Select Register
+
+ UInt8 ___filler2000[0x500-0x434];
+
+ UInt16 pwmControl; // $500: PWM Control Register
+ UInt8 pwmSampleHi; // $502: PWM Sample - high byte
+ UInt8 pwmSampleLo; // $503: PWM Sample - low byte
+ UInt8 pwmPeriod; // $504: PWM Period
+ UInt8 pwmCounter; // $505: PWM Counter
+
+ UInt8 ___filler24[0x600-0x506];
+
+ UInt16 tmr1Control; // $600: Timer 1 Control Register
+ UInt16 tmr1Prescaler; // $602: Timer 1 Prescaler Register
+ UInt16 tmr1Compare; // $604: Timer 1 Compare Register
+ UInt16 tmr1Capture; // $606: Timer 1 Capture Register
+ UInt16 tmr1Counter; // $608: Timer 1 Counter Register
+ UInt16 tmr1Status; // $60A: Timer 1 Status Register
+
+ UInt8 ___filler25[0x800-0x60C];
+
+ UInt16 spiMasterData; // $800: SPI Master Data Register
+ UInt16 spiMasterControl; // $802: SPI Master Control Register
+
+ UInt8 ___filler27[0x900-0x804];
+
+ UInt16 uControl; // $900: Uart Control Register
+ UInt16 uBaud; // $902: Uart Baud Control Register
+ UInt16 uReceive; // $904: Uart Receive Register
+ UInt16 uTransmit; // $906: Uart Transmit Register
+ UInt16 uMisc; // $908: Uart Miscellaneous Register
+ UInt16 uNonIntPresc; // $90A: Uart IRDA Non-Integer Prescaler
+
+ UInt8 ___filler28[0xA00-0x90C];
+
+ UInt32 lcdStartAddr; // $A00: Screen Starting Address Register
+ UInt8 ___filler29;
+ UInt8 lcdPageWidth; // $A05: Virtual Page Width Register
+ UInt8 ___filler30[2];
+ UInt16 lcdScreenWidth; // $A08: Screen Width Register
+ UInt16 lcdScreenHeight; // $A0A: Screen Height Register
+ UInt8 ___filler31[0xA18-0xA0C];
+ UInt16 lcdCursorXPos; // $A18: Cursor X Position
+ UInt16 lcdCursorYPos; // $A1A: Cursor Y Position
+ UInt16 lcdCursorWidthHeight; // $A1C: Cursor Width and Height
+ UInt8 ___filler32;
+ UInt8 lcdBlinkControl; // $A1F: Blink Control Register
+ UInt8 lcdPanelControl; // $A20: Panel Interface Control Register
+ UInt8 lcdPolarity; // $A21: Polarity Config Register
+ UInt8 ___filler33;
+ UInt8 lcdACDRate; // $A23: ACD (M) Rate Control Register
+ UInt8 ___filler34;
+ UInt8 lcdPixelClock; // $A25: Pixel Clock Divider Register
+ UInt8 ___filler35;
+ UInt8 lcdClockControl; // $A27: Clocking Control Register
+ UInt8 ___filler36;
+ UInt8 lcdRefreshRateAdj; // $A29: Refresh Rate Adjustment Register
+ UInt8 ___filler2003[0xA2D-0xA2A];
+ UInt8 lcdPanningOffset; // $A2D: Panning Offset Register
+
+ UInt8 ___filler37[0xA31-0xA2E];
+
+ UInt8 lcdFrameRate; // $A31: Frame Rate Control Modulation Register
+ UInt8 ___filler2004;
+ UInt8 lcdGrayPalette; // $A33: Gray Palette Mapping Register
+ UInt8 lcdReserved; // $A34: Reserved
+ UInt8 ___filler2005;
+ UInt16 lcdContrastControlPWM; // $A36: Contrast Control
+
+ UInt8 ___filler40[0xB00-0xA38];
+
+ UInt32 rtcHourMinSec; // $B00: RTC Hours, Minutes, Seconds Register
+ UInt32 rtcAlarm; // $B04: RTC Alarm Register
+ UInt8 ___filler2001[0xB0A-0xB08];
+ UInt16 rtcWatchDog; // $B0A: RTC Watchdog Timer
+ UInt16 rtcControl; // $B0C: RTC Control Register
+ UInt16 rtcIntStatus; // $B0E: RTC Interrupt Status Register
+ UInt16 rtcIntEnable; // $B10: RTC Interrupt Enable Register
+ UInt16 stopWatch; // $B12: Stopwatch Minutes
+ UInt8 ___filler2002[0xB1A-0xB14];
+ UInt16 rtcDay; // $B1A: RTC Day
+ UInt16 rtcDayAlarm; // $B1C: RTC Day Alarm
+
+ UInt8 ___filler41[0xC00-0xB1E];
+
+ UInt16 dramConfig; // $C00: DRAM Memory Config Register
+ UInt16 dramControl; // $C02: DRAM Control Register
+
+ UInt8 ___filler42[0xD00-0xC04];
+
+ UInt32 emuAddrCompare; // $D00: Emulation Address Compare Register
+ UInt32 emuAddrMask; // $D04: Emulation Address Mask Register
+ UInt16 emuControlCompare; // $D08: Emulation Control Compare Register
+ UInt16 emuControlMask; // $D0A: Emulation Control Mask Register
+ UInt16 emuControl; // $DOC: Emulation Control Register
+ UInt16 emuStatus; // $D0E: Emulation Status Register
+};
+
+typedef volatile struct HwrM68EZ328Type* HwrM68EZ328Ptr;
+
+#define HwrDBallType HwrM68EZ328Type
+#define HwrDBallPtr HwrM68EZ328Ptr
+
+
+/************************************************************************
+ * Jerry EZ cost reduction PLD I/O register
+ ***********************************************************************/
+typedef struct HwrJerryPLDType {
+
+ UInt8 dspOn; // pld output turn dsp on/off
+ UInt8 unused1;
+ UInt8 chargeOn; // pld output turn charger on/off
+ UInt8 unused2;
+ UInt8 refOn; // pld output turn 3.0 volt reference on/off
+ UInt8 unused3;
+ UInt8 pipaBiasEnable; // pld output turn PA bias on/off
+ UInt8 unused4;
+ UInt8 dspReset; // pld output control dsp reset pin up/down
+ UInt8 unused5;
+ UInt8 ezToDsl; // pld output comm. pin to dsp
+ UInt8 unused6;
+ UInt8 rs232Shdn; // pld output control rs232 interface chip on/off
+ UInt8 unused7;
+ UInt8 spareOut; // pld output not used
+ UInt8 unused8;
+ UInt16 dTo3Sln; // pld input comm. from dsp
+ UInt16 iXtrnl2; // pld input cradle connector pin
+} HwrJerryPLDType;
+
+typedef volatile HwrJerryPLDType* HwrJerryPldPtr;
+
+/************************************************************************
+ * Jerry EZ cost reduction. PLD settings
+ ***********************************************************************/
+#define hwrJerryPld232Enable 0x80
+#define hwrJerryPld232Disable 0
+#define hwrJerryPldChargerOn 0x80
+#define hwrJerryPldChargerOff 0
+#define hwrJerryPldPaBiasEnable 0x80
+#define hwrJerryPldPaBiasDisable 0
+#define hwrJerryPldRefOn 0x80
+#define hwrJerryPldRefOff 0
+#define hwrJerryPldDspSelect 0x80
+#define hwrJerryPldDspDeselect 0
+#define hwrJerryPldDspResetAssert 0x80
+#define hwrJerryPldDspResetDeassert 0
+#define hwrJerryPldDspPowerOn 0x80
+#define hwrJerryPldDspPowerOff 0
+
+/************************************************************************
+ * Jerry EZ cost reduction. PLD shadow settings
+ ***********************************************************************/
+#define hwrJerryPldDspOnBit 0x0001
+#define hwrJerryPldChargeOnBit 0x0002
+#define hwrJerryPldRefOnBit 0x0004
+#define hwrJerryPldPaBiasEnableBit 0x0008
+#define hwrJerryPldDspResetBit 0x0010
+#define hwrJerryPldEzToDslBit 0x0020
+#define hwrJerryPldRs232Bit 0x0040
+
+/************************************************************************
+ * Chip ID register for EZ
+ ***********************************************************************/
+ #define hwrEZ328chipIDEZ 0x45
+
+/************************************************************************
+ * Mask ID register for EZ
+ ***********************************************************************/
+#define hwrEZ328maskID0H31J 0x01
+#define hwrEZ328maskID0J75C 0x02
+#define hwrEZ328maskID1J75C 0x03
+#define hwrEZ328maskID0J83G 0x04
+
+/************************************************************************
+ * LCD Controller Bits
+ ************************************************************************/
+// lcdCursorXPos Register
+#define hwrEZ328LcdCursorXPosCtlMask 0xC000
+ #define hwrEZ328LcdCursorXPosCtlTrans 0x0000
+ #define hwrEZ328LcdCursorXPosCtlBlack 0x4000
+ #define hwrEZ328LcdCursorXPosCtlReverse 0x8000
+ #define hwrEZ328LcdCursorXPosCtlWhite 0xC000
+#define hwrEZ328LcdCursorXPosValueMask 0x1FF
+#define hwrEZ328LcdCursorYPosValueMask 0x1FF
+
+#define hwrEZ328LcdCursorWidthMask 0x1F
+ #define hwrEZ328LcdCursorWidthOffset 0x8
+#define hwrEZ328LcdCursorHeightMask 0x1F
+
+// lcdBlinkControl Register
+#define hwrEZ328LcdBlinkControlEnable 0x80
+#define hwrEZ328LcdBlinkDivisorMask 0x7F
+
+// lcdPanelControl Register
+#define hwrEZ328LcdPanelControlBusMask 0x0C
+ #define hwrEZ328LcdPanelControlBus1Bit 0x00
+ #define hwrEZ328LcdPanelControlBus2Bit 0x04
+ #define hwrEZ328LcdPanelControlBus4Bit 0x08
+#define hwrEZ328LcdPanelControlGrayScale 0x01
+#define hwrEZ328LcdPanelControl4BitGrayScale 0x02
+
+// lcdPolarity Register
+#define hwrEZ328LcdPolarityShiftClock 0x08
+#define hwrEZ328LcdPolarityFLM 0x04
+#define hwrEZ328LcdPolarityLP 0x02
+#define hwrEZ328LcdPolarityPixel 0x01
+
+// lcdClockControl Register
+#define hwrEZ328LcdClockControlEnable 0x80
+#define hwrEZ328LcdClockControl8BitBus 0x40
+
+#define hwrEZ328LcdClockControlBurstRateMask 0x0F
+#define hwrEZ328LcdClockControlBurstRate1 0x00
+#define hwrEZ328LcdClockControlBurstRate2 0x01
+#define hwrEZ328LcdClockControlBurstRate3 0x02
+#define hwrEZ328LcdClockControlBurstRate4 0x03
+#define hwrEZ328LcdClockControlBurstRate5 0x04
+#define hwrEZ328LcdClockControlBurstRate6 0x05
+#define hwrEZ328LcdClockControlBurstRate7 0x06
+#define hwrEZ328LcdClockControlBurstRate8 0x07
+#define hwrEZ328LcdClockControlBurstRate9 0x08
+#define hwrEZ328LcdClockControlBurstRate10 0x09
+#define hwrEZ328LcdClockControlBurstRate11 0x0A
+#define hwrEZ328LcdClockControlBurstRate12 0x0B
+#define hwrEZ328LcdClockControlBurstRate13 0x0C
+#define hwrEZ328LcdClockControlBurstRate14 0x0D
+#define hwrEZ328LcdClockControlBurstRate15 0x0E
+#define hwrEZ328LcdClockControlBurstRate16 0x0F
+
+#define hwrEZ328LcdContrastPWMWidthMask 0x00FF
+#define hwrEZ328LcdContrastEnable 0x0100
+
+
+
+/************************************************************************
+ * Interrupt Controller Bits
+ ************************************************************************/
+// intMaskHi bits
+// NOTE: Due to a bug in early rev's of the DragonBall, the clear bits for
+// IRQ[1236] on those early chips were different than the indicator bits
+// (the order was reversed). So some older code uses the OR of the IRQ1 and
+// IRQ6 bits for either, and the OR of the IRQ2 and IRQ3 bits for either.
+#define hwrEZ328IntHiEMU 0x0080
+#define hwrEZ328IntHiSampleTimer 0x0040
+#define hwrEZ328IntHiPen 0x0010
+#define hwrEZ328IntHiIRQ6 0x0008
+#define hwrEZ328IntHiIRQ3 0x0004
+#define hwrEZ328IntHiIRQ2 0x0002
+#define hwrEZ328IntHiIRQ1 0x0001
+
+// intMaskLo bits
+#define hwrEZ328IntLoInt3 0x0800
+#define hwrEZ328IntLoInt2 0x0400
+#define hwrEZ328IntLoInt1 0x0200
+#define hwrEZ328IntLoInt0 0x0100
+#define hwrEZ328IntLoAllKeys 0x0F00
+#define hwrEZ328IntLoInt0Bit 8
+#define hwrEZ328IntLoPWM 0x0080
+#define hwrEZ328IntLoPWMBit 7
+#define hwrEZ328IntLoKbd 0x0040
+#define hwrEZ328IntLoRTC 0x0010
+#define hwrEZ328IntLoRTCBit 4
+#define hwrEZ328IntLoWDT 0x0008
+#define hwrEZ328IntLoUART 0x0004
+#define hwrEZ328IntLoUARTBit 2
+#define hwrEZ328IntLoTimer 0x0002
+#define hwrEZ328IntLoTimerBit 1
+#define hwrEZ328IntLoSPIM 0x0001
+
+// intControl bits
+// NOTE: These are different than that documented in the User's manual
+// for the DragonBall (see erratas). The DragonBall is the same as the EZ.
+#define hwrEZ328IntCtlEdge1 0x0800
+#define hwrEZ328IntCtlEdge2 0x0400
+#define hwrEZ328IntCtlEdge3 0x0200
+#define hwrEZ328IntCtlEdge6 0x0100
+#define hwrEZ328IntCtlPol1 0x8000
+#define hwrEZ328IntCtlPol2 0x4000
+#define hwrEZ328IntCtlPol3 0x2000
+#define hwrEZ328IntCtlPol6 0x1000
+#define hwrEZ328IntCtlPol5 0x0080
+
+/************************************************************************
+ * DRAM Controller Bits bits
+ * Not all the bits are defined here-- some are pretty bad to muck with
+ * in anything but initial setup of the DRAM.
+ ************************************************************************/
+#define hwrEZ328dramControlEnable 0x8000
+#define hwrEZ328dramControlSelfRefreshEn 0x4000
+#define hwrEZ328dramControlLightSleep 0x0010
+#define hwrEZ328dramControlLowPowerRefreshEn 0x0004
+#define hwrEZ328dramControlDWEEnable 0x0001
+
+
+/************************************************************************
+ * Timer bits
+ ************************************************************************/
+#define hwrEZ328TmrControlUnused 0xFC00
+#define hwrEZ328TmrControlTIOOutput 0x0200
+#define hwrEZ328TmrControlFreeRun 0x0100
+#define hwrEZ328TmrControlCaptureEdgeMask 0x00C0
+ #define hwrEZ328TmrControlCaptureEdgeNone 0x0000
+ #define hwrEZ328TmrControlCaptureEdgeRising 0x0040
+ #define hwrEZ328TmrControlCaptureEdgeFalling 0x0080
+ #define hwrEZ328TmrControlCaptureEdgeBoth 0x00C0
+#define hwrEZ328TmrControlOutputModeToggle 0x0020
+#define hwrEZ328TmrControlEnInterrupt 0x0010
+#define hwrEZ328TmrControlClkSrcMask 0x000E
+ #define hwrEZ328TmrControlClkSrcStop 0x0000
+ #define hwrEZ328TmrControlClkSrcSys 0x0002
+ #define hwrEZ328TmrControlClkSrcSysBy16 0x0004
+ #define hwrEZ328TmrControlClkSrcTIN 0x0006
+ #define hwrEZ328TmrControlClkSrc32KHz 0x0008
+#define hwrEZ328TmrControlEnable 0x0001
+
+#define hwrEZ328TmrStatusCapture 0x0002
+#define hwrEZ328TmrStatusCaptureBit 1
+#define hwrEZ328TmrStatusCompare 0x0001
+#define hwrEZ328TmrStatusCompareBit 0
+
+
+/************************************************************************
+ * 68EZ328 Serial Port Register Bits
+ ************************************************************************/
+// uControl Register
+#define hwrEZ328UControlUARTEnable 0x8000
+#define hwrEZ328UControlRxEnable 0x4000
+#define hwrEZ328UControlTxEnable 0x2000
+#define hwrEZ328UControlRxClock1xSync 0x1000
+#define hwrEZ328UControlParityEn 0x0800
+#define hwrEZ328UControlParityOdd 0x0400
+#define hwrEZ328UControlStopBits2 0x0200
+#define hwrEZ328UControlDataBits8 0x0100
+#define hwrEZ328UControlOldDataEn 0x0080
+#define hwrEZ328UControlCTSDeltaEn 0x0040
+#define hwrEZ328UControlRxFullEn 0x0020
+#define hwrEZ328UControlRxHalfEn 0x0010
+#define hwrEZ328UControlRxRdyEn 0x0008
+#define hwrEZ328UControlTxEmptyEn 0x0004
+#define hwrEZ328UControlTxHalfEn 0x0002
+#define hwrEZ328UControlTxAvailEn 0x0001
+
+#define hwrEZ328UControlEnableAll (hwrEZ328UControlUARTEnable | \
+ hwrEZ328UControlRxEnable | \
+ hwrEZ328UControlTxEnable)
+
+// uBaud Register
+// UCLK output requires PE3 Select to be 0
+#define hwrEZ328UBaudUCLKDirOut 0x2000
+#define hwrEZ328UBaudBaudSrcUCLK 0x0800
+#define hwrEZ328UBaudDivider 0x0700
+#define hwrEZ328UBaudPrescaler 0x003F
+
+#define hwrEZ328UBaudDivideBitOffset 8
+
+
+// uReceive Register
+#define hwrEZ328UReceiveFIFOFull 0x8000
+#define hwrEZ328UReceiveFIFOHalf 0x4000
+#define hwrEZ328UReceiveDataRdy 0x2000
+#define hwrEZ328UReceiveDataRdyBit 13
+#define hwrEZ328UReceiveOldData 0x1000
+#define hwrEZ328UReceiveOverrunErr 0x0800
+#define hwrEZ328UReceiveOverrunErrBit 11
+#define hwrEZ328UReceiveFrameErr 0x0400
+#define hwrEZ328UReceiveFrameErrBit 10
+#define hwrEZ328UReceiveBreakErr 0x0200
+#define hwrEZ328UReceiveBreakErrBit 9
+#define hwrEZ328UReceiveParityErr 0x0100
+#define hwrEZ328UReceiveParityErrBit 8
+#define hwrEZ328UReceiveData 0x00FF
+
+#define hwrEZ328UReceiveErrsMask (hwrEZ328UReceiveOverrunErr | \
+ hwrEZ328UReceiveFrameErr | \
+ hwrEZ328UReceiveBreakErr | \
+ hwrEZ328UReceiveParityErr)
+
+// uTransmit Register
+#define hwrEZ328UTransmitFIFOEmpty 0x8000
+#define hwrEZ328UTransmitFIFOHalf 0x4000
+#define hwrEZ328UTransmitTxAvail 0x2000
+#define hwrEZ328UTransmitSendBreak 0x1000
+#define hwrEZ328UTransmitIgnoreCTS 0x0800
+#define hwrEZ328UTransmitBusy 0x0400
+#define hwrEZ328UTransmitCTSStatus 0x0200
+#define hwrEZ328UTransmitCTSDelta 0x0100
+#define hwrEZ328UTransmitData 0x00FF
+
+// uMisc Register
+#define hwrEZ328UMiscBaudTest 0x8000
+#define hwrEZ328UMiscClkSrcUCLK 0x4000
+#define hwrEZ328UMiscForceParityErr 0x2000
+#define hwrEZ328UMiscLoopback 0x1000
+#define hwrEZ328UMiscBaudReset 0x0800
+#define hwrEZ328UMiscIRTestEn 0x0400
+#define hwrEZ328UMiscReservedMask 0x0300
+#define hwrEZ328UMiscRTSThruFIFO 0x0080
+#define hwrEZ328UMiscRTSOut 0x0040
+#define hwrEZ328UMiscIRDAEn 0x0020
+#define hwrEZ328UMiscLoopIRDA 0x0010
+#define hwrEZ328UMiscRXPolarityInv 0x0008
+#define hwrEZ328UMiscTXPolarityInv 0x0004
+#define hwrEZ328UMiscUnused 0x0003
+
+// uNonIntPresc Register
+#define hwrEZ328UNonIntPrescSrcIntPresc 0x0000
+#define hwrEZ328UNonIntPrescSrcNonIntPresc 0x8000
+
+#define hwrEZ328UNonIntPrescSelDiv128 0x0000
+#define hwrEZ328UNonIntPrescSelDiv64 0x0100
+#define hwrEZ328UNonIntPrescSelDiv32 0x0200
+#define hwrEZ328UNonIntPrescSelDiv16 0x0300
+#define hwrEZ328UNonIntPrescSelDiv8 0x0400
+#define hwrEZ328UNonIntPrescSelDiv4 0x0500
+#define hwrEZ328UNonIntPrescSelDiv2 0x0600
+#define hwrEZ328UNonIntPrescSelDiv1 0x0700
+
+#define hwrEZ328UNonIntPrescStepMask 0x00FF
+#define hwrEZ328UNonIntPrescSelOffset 8
+
+// see EZ docs for explanation of the following. This provides the correct
+// pulse width for IRDA, and is just a statement in the docs. The values don't
+// appear to make sense, but I just push the buttons.
+
+// This has been deprecated in favor of a prv function in the serial driver and
+// the SerialMgr (depending on whether you have Bond or not) that calculates
+// the value of this register based on the clock frequency you're running on.
+// There was a bug when running EZ at 20MHz that caused the IrDA pulsewidth to
+// get too short.
+
+#if 0
+#define hwrEZ328UNonIntPrescIRDAMode (hwrEZ328UNonIntPrescSrcIntPresc \
+ | hwrEZ328UNonIntPrescSelDiv32 \
+ | (hwrEZ328UNonIntPrescStepMask & 0x20))
+#endif
+
+/************************************************************************
+ * PWM Bits
+ ************************************************************************/
+// PWM register bits of interest
+#define hwrEZ328PWMControlEnable 0x0010
+#define hwrEZ328PWMControlEnableBit 4
+#define hwrEZ328PWMControlEnableIRQ 0x0040
+#define hwrEZ328PWMIRQStatus 0x0080
+// PWM divider chain output selectors
+#define hwrEZ328PWMControlDivMask 0x0003
+#define hwrEZ328PWMControlDivBy2 0x0
+#define hwrEZ328PWMControlDivBy4 0x1
+#define hwrEZ328PWMControlDivBy8 0x2
+#define hwrEZ328PWMControlDivBy16 0x3
+// PWM Repeat Counts
+#define hwrEZ328PWMRepeatSample1x 0x0
+#define hwrEZ328PWMRepeatSample2x 0x4
+#define hwrEZ328PWMRepeatSample4x 0x8
+#define hwrEZ328PWMRepeatSample8x 0xC
+// PWM hardware constraints
+#define hwrEZ328PWMFifoSizeInBytes 4
+#define hwrEZ328PWMPrescalerMask 0x7F00
+#define hwrEZ328PWMPrescalerOffset 8
+
+/************************************************************************
+ * PLL Bits
+ * note that these do not follow the '328 spec-- however, they seem to
+ * follow the 'EZ328 spec, so maybe Motorola is behind in their tech pubs
+ * department?? (Naah.)
+ ************************************************************************/
+#define hwrEZ328PLLControlDisable 0x0008
+#define hwrEZ328PLLControlClkEn 0x0010
+
+#define hwrEZ328PLLControlSysDMADiv2 0x0000
+#define hwrEZ328PLLControlSysDMADiv4 0x0100
+#define hwrEZ328PLLControlSysDMADiv8 0x0200
+#define hwrEZ328PLLControlSysDMADiv16 0x0300
+#define hwrEZ328PLLControlSysDMADiv1 0x0400
+
+#define hwrEZ328PLLControlPixDMADiv2 0x0000
+#define hwrEZ328PLLControlPixDMADiv4 0x0800
+#define hwrEZ328PLLControlPixDMADiv8 0x1000
+#define hwrEZ328PLLControlPixDMADiv16 0x1800
+#define hwrEZ328PLLControlPixDMADiv1 0x2000
+
+#define hwrEZ328PLLControlDMAVCODiv2 0x0000
+#define hwrEZ328PLLControlDMAVCODiv4 0x0020
+#define hwrEZ328PLLControlDMAVCODiv8 0x0040
+#define hwrEZ328PLLControlDMAVCODiv16 0x0060
+#define hwrEZ328PLLControlDMAVCODiv1 0x0080
+
+#define hwrEZ328PLLFreqSelCLK32 0x8000
+
+/************************************************************************
+ * Real Time Clock (RTC) Bits
+ ************************************************************************/
+
+// RTC Control Register (RTCCTL) bits
+#define hwrEZ328RTCControlRTCEnable 0x80
+#define hwrEZ328RTCControlRefSelMask 0x20
+#define hwrEZ328RTCControlRefSel38400 0x20 // 38.4 kHz reference frequency
+#define hwrEZ328RTCControlRefSel32768 0x00 // 32.768 kHz reference frequency
+
+// RTC Interrupt Enable Register (RTCIENR) bits
+#define hwrEZ328RTCIntEnableSample7 0x8000
+#define hwrEZ328RTCIntEnableSample6 0x4000
+#define hwrEZ328RTCIntEnableSample5 0x2000
+#define hwrEZ328RTCIntEnableSample4 0x1000
+#define hwrEZ328RTCIntEnableSample3 0x0800
+#define hwrEZ328RTCIntEnableSample2 0x0400
+#define hwrEZ328RTCIntEnableSample1 0x0200
+#define hwrEZ328RTCIntEnableSample0 0x0100
+#define hwrEZ328RTCIntEnableHour 0x0020
+#define hwrEZ328RTCIntEnableSec 0x0010
+#define hwrEZ328RTCIntEnable24Hr 0x0008
+#define hwrEZ328RTCIntEnableAlarm 0x0004
+#define hwrEZ328RTCIntEnableMinute 0x0002
+#define hwrEZ328RTCIntEnableStopWatch 0x0001
+
+// RTC Interrupt Status Register bits
+#define hwrEZ328RTCIntStatusSample7 0x8000
+#define hwrEZ328RTCIntStatusSample6 0x4000
+#define hwrEZ328RTCIntStatusSample5 0x2000
+#define hwrEZ328RTCIntStatusSample4 0x1000
+#define hwrEZ328RTCIntStatusSample3 0x0800
+#define hwrEZ328RTCIntStatusSample2 0x0400
+#define hwrEZ328RTCIntStatusSample1 0x0200
+#define hwrEZ328RTCIntStatusSample0 0x0100
+#define hwrEZ328RTCIntStatusHour 0x0020
+#define hwrEZ328RTCIntStatusSec 0x0010
+#define hwrEZ328RTCIntStatus24Hr 0x0008
+#define hwrEZ328RTCIntStatusAlarm 0x0004
+#define hwrEZ328RTCIntStatusMinute 0x0002
+#define hwrEZ328RTCIntStatusStopWatch 0x0001
+
+// RTC Alarm register (RTCALRM) masks and offsets
+#define hwrEZ328RTCAlarmSecondsMask 0x0000003fL
+#define hwrEZ328RTCAlarmSecondsOffset 0
+#define hwrEZ328RTCAlarmMinutesMask 0x003f0000L
+#define hwrEZ328RTCAlarmMinutesOffset 16
+#define hwrEZ328RTCAlarmHoursMask 0x1f000000L
+#define hwrEZ328RTCAlarmHoursOffset 24
+
+// RTC hours/minutes/seconds register (RTCHMS) masks and offsets
+#define hwrEZ328RTCHourMinSecSecondsMask 0x0000003fL
+#define hwrEZ328RTCHourMinSecSecondsOffset 0
+#define hwrEZ328RTCHourMinSecMinutesMask 0x003f0000L
+#define hwrEZ328RTCHourMinSecMinutesOffset 16
+#define hwrEZ328RTCHourMinSecHoursMask 0x1f000000L
+#define hwrEZ328RTCHourMinSecHoursOffset 24
+
+// RTC Day register masks/offsets
+#define hwrEZ328RTCDayDayMask 0x01FF
+#define hwrEZ328RTCDayDayOffset 0
+
+// RTC Watchdog Timer masks/offsets
+#define hwrEZ328RTCWatchdogEnable 0x0001
+#define hwrEZ328RTCWatchdogIntSel 0x0002
+#define hwrEZ328RTCWatchdogIntStatus 0x0080
+#define hwrEZ328RTCWatchdogCountMask 0x0300
+#define hwrEZ328RTCWatchdogCountOffset 8
+
+/************************************************************************
+ * SPI Master bits
+ ************************************************************************/
+#define hwrEZ328SPIMControlRateMask 0xE000
+ #define hwrEZ328SPIMControlRateDiv4 0x0000
+ #define hwrEZ328SPIMControlRateDiv8 0x2000
+ #define hwrEZ328SPIMControlRateDiv16 0x4000
+ #define hwrEZ328SPIMControlRateDiv32 0x6000
+ #define hwrEZ328SPIMControlRateDiv64 0x8000
+ #define hwrEZ328SPIMControlRateDiv128 0xA000
+ #define hwrEZ328SPIMControlRateDiv256 0xC000
+ #define hwrEZ328SPIMControlRateDiv512 0xE000
+#define hwrEZ328SPIMControlEnable 0x0200
+#define hwrEZ328SPIMControlExchange 0x0100
+#define hwrEZ328SPIMControlIntStatus 0x0080
+#define hwrEZ328SPIMControlIntEnable 0x0040
+#define hwrEZ328SPIMControlOppPhase 0x0020
+#define hwrEZ328SPIMControlInvPolarity 0x0010
+#define hwrEZ328SPIMControlBitsMask 0x000F
+
+
+#endif // __M68EZ328_H__
+
+#endif // NON_PORTABLE
diff --git a/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68SZ328Hwr.h b/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68SZ328Hwr.h
new file mode 100644
index 0000000..bfabe11
--- /dev/null
+++ b/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68SZ328Hwr.h
@@ -0,0 +1,1078 @@
+/*******************************************************************
+ * Pilot Software
+ *
+ * Copyright(c) 1995-1999, Palm Computing Inc., All Rights Reserved
+ *
+ *-------------------------------------------------------------------
+ * FileName:
+ * M68SZ328Hwr.h
+ *
+ * Description:
+ * Hardware Equates for the Motorola 68SZ328 Dragonball-SZ chip
+ *
+ * History:
+ * 07/05/99 TJC Created; integrated from M68VZ328Hwr.h
+ *
+ *******************************************************************/
+
+#ifdef NON_PORTABLE // So apps don't include this...
+
+
+#ifndef __M68SZ328HWR_H__
+#define __M68SZ328HWR_H__
+
+#if INCLUDE_SECRET_STUFF
+
+
+#include <PalmTypes.h> // Touchdown includes
+
+
+// Define location of the 68328 Dragonball chip
+// Note: this is not the same as kMemoryStart in this chip
+#define hwr68328Base 0xFFFFF000L // Base address of 68328
+
+
+/***********************************************************************
+ * Motorola 68SZ328 registers
+ ***********************************************************************/
+struct HwrM68SZ328Type
+{
+ UInt16 dmaControl; // $00000: DMA Control Register
+ UInt16 dmaInterruptStatus; // $00002: DMA Interrupt Status Register
+ UInt16 dmaInterruptMask; // $00004: DMA Interrupt Mask Register
+ UInt16 dmaBurstTimeOutStatus; // $00006: DMA Burst Time-Out Status Register
+ UInt16 dmaRequestTimeOutStatus; // $00008: DMA Request Time-Out Status Register
+
+ // Note, the spaces around the minus sign are
+ // necessary. Without them, a proper compiler
+ // like gcc 3.0 thinks that the expression
+ // is an invalid scientific notion number.
+ UInt8 ___filler00[0x00E - 0x00A];
+
+ UInt16 dmaBurstTimeOutControl; // $0000E: DMA Burst Time-Out Control Register
+
+ UInt8 ___filler01[0x040-0x010];
+
+ UInt32 mem0SourceAddress; // $00040: Memory Channel 0 Source Address Register
+ UInt32 mem0DestAddress; // $00044: Memory Channel 0 Destination Address Register
+ UInt32 mem0Count; // $00048: Memory Channel 0 Count Register
+ UInt16 mem0Control; // $0004C: Memory Channel 0 Control Register
+ UInt16 mem0BurstLength; // $0004E: Memory Channel 0 Burst Length Register
+ UInt16 mem0BusUtilizationControl; // $00050: Memory Channel 0 Bus Utilization Control Register
+ UInt16 mem0BlockLength; // $00052: Memory Channel 0 Block Length Register
+ UInt16 mem0BlockSeparationDist; // $00054: Memory Channel 0 Block Separation Distance Register
+ UInt16 mem0DMARequestTimeOut; // $00056: Memory Channel 0 DMA Request Time Out Register
+
+ UInt8 ___filler02[0x080-0x058];
+
+ UInt32 mem1SourceAddress; // $00080: Memory Channel 1 Source Address Register
+ UInt32 mem1DestAddress; // $00084: Memory Channel 1 Destination Address Register
+ UInt32 mem1Count; // $00088: Memory Channel 1 Count Register
+ UInt16 mem1Control; // $0008C: Memory Channel 1 Control Register
+ UInt16 mem1BurstLength; // $0008E: Memory Channel 1 Burst Length Register
+ UInt16 mem1BusUtilizationControl; // $00090: Memory Channel 1 Bus Utilization Control Register
+ UInt16 mem1BlockLength; // $00092: Memory Channel 1 Block Length Register
+ UInt16 mem1BlockSeparationDist; // $00094: Memory Channel 1 Block Separation Distance Register
+ UInt16 mem1DMARequestTimeOut; // $00096: Memory Channel 1 DMA Request Time Out Register
+
+ UInt8 ___filler03[0x0C0-0x098];
+
+ UInt32 io2MemoryAddress; // $000C0: I/O Channel 2 Memory Address Register
+ UInt32 io2PeripheralAddress; // $000C4: I/O Channel 2 Peripheral Address Register
+ UInt32 io2CountRegister; // $000C8: I/O Channel 2 Count Register
+ UInt16 io2Control; // $000CC: I/O Channel 2 Control Register
+ UInt16 io2RequestSourceSelect; // $000CE: I/O Channel 2 Request Source Select Register
+ UInt16 io2BurstLength; // $000D0: I/O Channel 2 Burst Length Register
+ UInt16 io2DMARequestTimeOut; // $000D2: I/O Channel 2 DMA Request Time-Out Register
+
+ UInt8 ___filler04[0x100-0x0D4];
+
+ UInt32 io3MemoryAddress; // $00100: I/O Channel 3 Memory Address Register
+ UInt32 io3PeripheralAddress; // $00104: I/O Channel 3 Peripheral Address Register
+ UInt32 io3CountRegister; // $00108: I/O Channel 3 Count Register
+ UInt16 io3Control; // $0010C: I/O Channel 3 Control Register
+ UInt16 io3RequestSourceSelect; // $0010E: I/O Channel 3 Request Source Select Register
+ UInt16 io3BurstLength; // $00110: I/O Channel 3 Burst Length Register
+ UInt16 io3DMARequestTimeOut; // $00112: I/O Channel 3 DMA Request Time-Out Register
+
+ UInt8 ___filler05[0x140-0x114];
+
+ UInt32 io4MemoryAddress; // $00140: I/O Channel 4 Memory Address Register
+ UInt32 io4PeripheralAddress; // $00144: I/O Channel 4 Peripheral Address Register
+ UInt32 io4CountRegister; // $00148: I/O Channel 4 Count Register
+ UInt16 io4Control; // $0014C: I/O Channel 4 Control Register
+ UInt16 io4RequestSourceSelect; // $0014E: I/O Channel 4 Request Source Select Register
+ UInt16 io4BurstLength; // $00150: I/O Channel 4 Burst Length Register
+ UInt16 io4DMARequestTimeOut; // $00152: I/O Channel 4 DMA Request Time-Out Register
+
+ UInt8 ___filler06[0x180-0x154];
+
+ UInt32 io5MemoryAddress; // $00180: I/O Channel 5 Memory Address Register
+ UInt32 io5PeripheralAddress; // $00184: I/O Channel 5 Peripheral Address Register
+ UInt32 io5CountRegister; // $00188: I/O Channel 5 Count Register
+ UInt16 io5Control; // $0018C: I/O Channel 5 Control Register
+ UInt16 io5RequestSourceSelect; // $0018E: I/O Channel 5 Request Source Select Register
+ UInt16 io5BurstLength; // $00190: I/O Channel 5 Burst Length Register
+ UInt16 io5DMARequestTimeOut; // $00192: I/O Channel 5 DMA Request Time-Out Register
+
+ UInt8 ___filler07[0x200-0x194];
+
+ UInt16 adcPenSampleFifo; // $00200: ADC Pen Sample FIFO
+
+ UInt8 ___filler08[0x210-0x202];
+
+ UInt32 adcControl; // $00210: ADC Control Register
+ UInt16 adcPenADSampleRateControl; // $00214: ADC Pen A/D Sample Rate Control Register
+
+ UInt8 ___filler09[0x218-0x216];
+
+ UInt16 adcInterruptControl; // $00218: ADC Interrupt Control Register
+ UInt16 adcInterruptErrorStatus; // $0021A: ADC Interrupt/Error Status Register
+
+ UInt8 ___filler10[0x22C-0x21C];
+
+ UInt16 adcClockDivide; // $0022C: ADC Clock Divide Register
+
+ UInt8 ___filler11[0x230-0x22E];
+
+ UInt32 adcCompareControl; // $00230: ADC Compare Control Register
+
+ UInt8 ___filler12[0x300-0x234];
+
+ UInt16 mmcClockControl; // $00300: MMC Clock Control Register
+
+ UInt8 ___filler13[0x304-0x302];
+
+ UInt16 mmcStatus; // $00304: MMC Status Register
+
+ UInt8 ___filler14[0x308-0x306];
+
+ UInt16 mmcClockRate; // $00308: MMC Clock Rate Register
+
+ UInt8 ___filler15[0x310-0x30A];
+
+ UInt16 mmcCommandDataControl; // $00310: MMC Command and Data Control Register
+
+ UInt8 ___filler16[0x314-0x312];
+
+ UInt16 mmcResponseTimeOut; // $00314: MMC Response Time Out Register
+
+ UInt8 ___filler17[0x318-0x316];
+
+ UInt16 mmcReadTimeOut; // $00318: MMC Read Time Out Register
+
+ UInt8 ___filler18[0x31C-0x31A];
+
+ UInt16 mmcBlockLength; // $0031C: MMC Block Length Register
+
+ UInt8 ___filler19[0x320-0x31E];
+
+ UInt16 mmcNumberOfBlocks; // $00320: MMC Number of Blocks Register
+
+ UInt8 ___filler20[0x324-0x322];
+
+ UInt16 mmcRevisionNumber; // $00324: MMC Revision Number Register
+
+ UInt16 mmcIOPort; // $00326: MMC IO Port Register
+ UInt16 mmcInterruptMask; // $00328: MMC Interrupt Mask Register
+
+ UInt8 ___filler21[0x32C-0x32A];
+
+ UInt16 mmcCommandNumber; // $0032C: MMC Command Number Register
+
+ UInt8 ___filler22[0x330-0x32E];
+
+ UInt16 mmcHigherArgument; // $00330: MMC HIGHER Argument Register
+ UInt16 mmcLowerArgument; // $00332: MMC LOWER Argument Register
+ UInt16 mmcResponseFifo; // $00334: MMC Response FIFO Register;
+
+ UInt8 ___filler23[0x338-0x336];
+
+ UInt16 mmcBufferAccess; // $00338: MMC Buffer Access Register
+
+ UInt8 ___filler24[0x33C-0x33A];
+
+ UInt16 mmcBufferPartFull; // $0033C: MMC Buffer Part Full Register
+
+ UInt8 ___filler25[0x400-0x33E];
+
+ UInt32 usbFrameNumberMatch; // $00400: USB Frame Number and Match
+ UInt32 usbSpecificationRelease; // $00404: USB Specification/Release Number
+ UInt32 usbStatus; // $00408: USB Status
+ UInt32 usbControl; // $0040C: USB Control
+ UInt32 usbConfigurationStatus; // $00410: USB Configuration Status
+ UInt32 usbEndpointBufferData; // $00414: USB Endpoint Buffer Data
+ UInt32 usbGeneralInterruptStatus; // $00418: USB General Interrupt Status Register
+ UInt32 usbInterruptMask; // $0041C: USB Interrupt Mask
+
+ UInt8 ___filler26[0x424-0x420];
+
+ UInt32 usbEnable; // $00424: USB Enable
+ UInt32 usbInterruptStatus; // $00428: USB Interrupt Status Register
+
+ UInt8 ___filler27[0x430-0x42C];
+
+ UInt32 usbEP0StatusControl; // $00430: USB Endpoint 0 Status/Control
+ UInt32 usbEP0InterruptStatus; // $00434: USB Endpoint 0 Interrupt Status
+ UInt32 usbEP0InterruptMask; // $00438: USB Endpoint 0 Interrupt Mask
+ UInt16 usbEP0FifoData; // $0043C: USB Endpoint 0 FIFO Data
+
+ UInt8 ___filler28[0x440-0x43E];
+
+ UInt32 usbEP0FifoStatus; // $00440: USB Endpoint 0 FIFO Status
+ UInt32 usbEP0FifoControl; // $00444: USB Endpoint 0 FIFO Control
+ UInt32 usbEP0LastReadFramePointer; // $00448: USB Endpoint 0 FIFO Last Read Frame Pointer
+ UInt32 usbEP0LastWriteFramePointer; // $0044C: USB Endpoint 0 FIFO Last Write Frame Pointer
+ UInt32 usbEP0FifoAlarm; // $00450: USB Endpoint 0 FIFO Alarm
+ UInt32 usbEP0FifoReadPointer; // $00454: USB Endpoint 0 FIFO Read Pointer
+ UInt32 usbEP0FifoWritePointer; // $00458: USB Endpoint 0 FIFO Write Pointer
+
+ UInt8 ___filler29[0x460-0x45C];
+
+ UInt32 usbEP1StatusControl; // $00460: USB Endpoint 1 Status/Control
+ UInt32 usbEP1InterruptStatus; // $00464: USB Endpoint 1 Interrupt Status
+ UInt32 usbEP1InterruptMask; // $00468: USB Endpoint 1 Interrupt Mask
+ UInt16 usbEP1FifoData; // $0046C: USB Endpoint 1 FIFO Data
+
+ UInt8 ___filler30[0x470-0x46E];
+
+ UInt32 usbEP1FifoStatus; // $00470: USB Endpoint 1 FIFO Status
+ UInt32 usbEP1FifoControl; // $00474: USB Endpoint 1 FIFO Control
+ UInt32 usbEP1LastReadFramePointer; // $00478: USB Endpoint 1 FIFO Last Read Frame Pointer
+ UInt32 usbEP1LastWriteFramePointer; // $0047C: USB Endpoint 1 FIFO Last Write Frame Pointer
+ UInt32 usbEP1FifoAlarm; // $00480: USB Endpoint 1 FIFO Alarm
+ UInt32 usbEP1FifoReadPointer; // $00484: USB Endpoint 1 FIFO Read Pointer
+ UInt32 usbEP1FifoWritePointer; // $00488: USB Endpoint 1 FIFO Write Pointer
+
+ UInt8 ___filler31[0x490-0x48C];
+
+ UInt32 usbEP2StatusControl; // $00490: USB Endpoint 2 Status/Control
+ UInt32 usbEP2InterruptStatus; // $00494: USB Endpoint 2 Interrupt Status
+ UInt32 usbEP2InterruptMask; // $00498: USB Endpoint 2 Interrupt Mask
+ UInt16 usbEP2FifoData; // $0049C: USB Endpoint 2 FIFO Data
+
+ UInt8 ___filler32[0x4A0-0x49E];
+
+ UInt32 usbEP2FifoStatus; // $004A0: USB Endpoint 2 FIFO Status
+ UInt32 usbEP2FifoControl; // $004A4: USB Endpoint 2 FIFO Control
+ UInt32 usbEP2LastReadFramePointer; // $004A8: USB Endpoint 2 FIFO Last Read Frame Pointer
+ UInt32 usbEP2LastWriteFramePointer; // $004AC: USB Endpoint 2 FIFO Last Write Frame Pointer
+ UInt32 usbEP2FifoAlarm; // $004B0: USB Endpoint 2 FIFO Alarm
+ UInt32 usbEP2FifoReadPointer; // $004B4: USB Endpoint 2 FIFO Read Pointer
+ UInt32 usbEP2FifoWritePointer; // $004B8: USB Endpoint 2 FIFO Write Pointer
+
+ UInt8 ___filler33[0x4C0-0x4BC];
+
+ UInt32 usbEP3StatusControl; // $004C0: USB Endpoint 3 Status/Control
+ UInt32 usbEP3InterruptStatus; // $004C4: USB Endpoint 3 Interrupt Status
+ UInt32 usbEP3InterruptMask; // $004C8: USB Endpoint 3 Interrupt Mask
+ UInt16 usbEP3FifoData; // $004CC: USB Endpoint 3 FIFO Data
+
+ UInt8 ___filler34[0x4D0-0x4CE];
+
+ UInt32 usbEP3FifoStatus; // $004D0: USB Endpoint 3 FIFO Status
+ UInt32 usbEP3FifoControl; // $004D4: USB Endpoint 3 FIFO Control
+ UInt32 usbEP3LastReadFramePointer; // $004D8: USB Endpoint 3 FIFO Last Read Frame Pointer
+ UInt32 usbEP3LastWriteFramePointer; // $004DC: USB Endpoint 3 FIFO Last Write Frame Pointer
+ UInt32 usbEP3FifoAlarm; // $004E0: USB Endpoint 3 FIFO Alarm
+ UInt32 usbEP3FifoReadPointer; // $004E4: USB Endpoint 3 FIFO Read Pointer
+ UInt32 usbEP3FifoWritePointer; // $004E8: USB Endpoint 3 FIFO Write Pointer
+
+ UInt8 ___filler35[0x4F0-0x4EC];
+
+ UInt32 usbEP4StatusControl; // $004F0: USB Endpoint 4 Status/Control
+ UInt32 usbEP4InterruptStatus; // $004F4: USB Endpoint 4 Interrupt Status
+ UInt32 usbEP4InterruptMask; // $004F8: USB Endpoint 4 Interrupt Mask
+ UInt16 usbEP4FifoData; // $004FC: USB Endpoint 4 FIFO Data
+
+ UInt8 ___filler36[0x500-0x4FE];
+
+ UInt32 usbEP4FifoStatus; // $00500: USB Endpoint 4 FIFO Status
+ UInt32 usbEP4FifoControl; // $00504: USB Endpoint 4 FIFO Control
+ UInt32 usbEP4LastReadFramePointer; // $00508: USB Endpoint 4 FIFO Last Read Frame Pointer
+ UInt32 usbEP4LastWriteFramePointer; // $0050C: USB Endpoint 4 FIFO Last Write Frame Pointer
+ UInt32 usbEP4FifoAlarm; // $00510: USB Endpoint 4 FIFO Alarm
+ UInt32 usbEP4FifoReadPointer; // $00514: USB Endpoint 4 FIFO Read Pointer
+ UInt32 usbEP4FifoWritePointer; // $00518: USB Endpoint 4 FIFO Write Pointer
+
+ UInt8 ___filler37[0x800-0x51C];
+
+ UInt32 lcdStartAddr; // $00800: LCD Screen Starting Address Register
+ UInt16 lcdScreenSize; // $00804: LCD Screen Size Register
+ UInt16 lcdPageWidth; // $00806: LCD Virtual Page Width Register
+ UInt16 lcdCursorXPos; // $00808: LCD Cursor X Position
+ UInt16 lcdCursorYPos; // $0080A: LCD Cursor Y Position
+ UInt16 lcdCursorSize; // $0080C: LCD Cursor Size
+ UInt16 lcdBlinkControl; // $0080E: LCD Blink Control Register
+ UInt16 lcdColorCursorMapping; // $00810: LCD Color Cursor Mapping Register
+ UInt16 lcdPanelControl0; // $00812: LCD Panel Configuration Register 0
+ UInt16 lcdPanelControl1; // $00814: LCD Panel Configuration Register 1
+ UInt16 lcdHorizontalConfig0; // $00816: LCD Horizontal Configuration Register 0
+ UInt16 lcdHorizontalConfig1; // $00818: LCD Horizontal Configuration Register 1
+ UInt16 lcdVerticalConfig0; // $0081A: LCD Vertical Configuration Register 0
+ UInt16 lcdVerticalConfig1; // $0081C: LCD Vertical Configuration Register 1
+ UInt16 lcdPanningOffset; // $0081E: LCD Panning Offset Register
+ UInt16 lcdGrayPalette; // $00820: LCD Gray Palette Mapping Register
+ UInt16 lcdPWMContrastControl; // $00822: LCD PWM Contrast Control Register
+ UInt16 lcdDMAControl; // $00824: LCD DMA Control Register
+ UInt16 lcdRefreshModeControl; // $00826: LCD Refresh Mode Control Register
+ UInt16 lcdInterruptConfiguration; // $00828: LCD Interrupt Configuration
+ UInt16 lcdInterruptStatus; // $0082A: LCD Interrupt Status
+
+ UInt8 ___filler38[0x1F000-0x0082C];
+
+ UInt8 scr; // $10000: System Control Register
+
+ UInt8 ___filler39[0x003-0x001];
+
+ UInt8 pcr; // $10003: Peripheral Control Register
+ UInt8 chipID; // $10004: Chip ID Register
+ UInt8 maskID; // $10005: Mask ID Register
+ UInt16 swID; // $10006: Software ID Register
+ UInt16 ioDriveControl; // $10008: I/O Drive Control Register
+
+ UInt8 ___filler40[0x100-0x00A];
+
+ UInt16 csAGroupBase; // $10100: Chip Select Group A Base Register
+ UInt16 csBGroupBase; // $10102: Chip Select Group B Base Register
+ UInt16 csCGroupBase; // $10104: Chip Select Group C Base Register
+ UInt16 csDGroupBase; // $10106: Chip Select Group D Base Register
+
+ UInt8 ___filler41[0x10c-0x108];
+
+ UInt16 csControl2; // $1010C: Chip Select Control Register 2
+
+ UInt8 ___filler42[0x110-0x10e];
+
+ UInt16 csASelect; // $10110: Group A Chip Select Register
+ UInt16 csBSelect; // $10112: Group B Chip Select Register
+ UInt16 csCSelect; // $10114: Group C Chip Select Register
+ UInt16 csDSelect; // $10116: Group D Chip Select Register
+
+ UInt16 emuCS; // $10118: EMU Chip Select Register
+
+ UInt8 ___filler43[0x150-0x11A];
+
+ UInt16 csControl3; // $10150: Chip Select Control Register 3
+
+ UInt8 ___filler43a[0x180-0x152];
+
+ UInt16 csEGroupBase; // $10180: Chip Select Group E Base Register
+ UInt16 csFGroupBase; // $10182: Chip Select Group F Base Register
+ UInt16 csGGroupBase; // $10184: Chip Select Group G Base Register
+
+ UInt8 ___filler44[0x18A-0x186];
+
+ UInt16 csControl1; // $1018A: Chip Select Control Register 1
+
+ UInt8 ___filler45[0x190-0x18C];
+
+ UInt16 csESelect; // $10190: Group E Chip Select Register
+ UInt16 csFSelect; // $10192: Group F Chip Select Register
+ UInt16 csGSelect; // $10194: Group G Chip Select Register
+
+ UInt8 ___filler46[0x200-0x196];
+
+ UInt16 pllControl; // $10200: PLL Control Register
+ UInt16 pllFreqSel0; // $10202: MCU PLL Frequency Select Register 0
+ UInt16 pllFreqSel1; // $10204: MCU PLL Frequency Select Register 1
+
+ UInt8 ___filler47;
+
+ UInt8 pwrControl; // $10207: CPU Power Control Register
+
+ UInt16 usbpllFreqSel0; // $10208: USBPLL Frequency Select Register 0
+ UInt16 usbpllFreqSel1; // $1020A: USBPLL Frequency Select Register 1
+
+ UInt16 clockSrcCtl; // $1020C: Clock Source Control Register
+
+ UInt8 ___filler48[0x300-0x20E];
+
+ UInt8 intVector; // $10300: Interrupt Vector Register
+
+ UInt8 ___filler49;
+
+ UInt16 intControl; // $10302: Interrupt Control Register
+ UInt16 intMaskHi; // $10304: Interrupt Mask Register (high word)
+ UInt16 intMaskLo; // $10306: Interrupt Mask Register (low word)
+
+ UInt8 ___filler50[0x30C-0x308];
+
+ UInt16 intStatusHi; // $1030C: Interrupt Status Register (high word)
+ UInt16 intStatusLo; // $1030E: Interrupt Status Register (low word)
+ UInt16 intPendingHi; // $10310: Interrupt Pending Register (high word)
+ UInt16 intPendingLo; // $10312: Interrupt Pending Register (low word)
+ UInt16 intLevelControl; // $10314: Interrupt Level Control Register
+ UInt16 intLevelControl2; // $10316: Interrupt Level Control Register 2
+ UInt16 intLevelControl3; // $10318: Interrupt Level Control Register 3
+ UInt16 intLevelControl4; // $1031A: Interrupt Level Control Register 4
+ UInt16 intLevelControl5; // $1031C: Interrupt Level Control Register 5
+ UInt16 intLevelControl6; // $1031E: Interrupt Level Control Register 6
+ UInt16 intLevelControl7; // $10320: Interrupt Level Control Register 7
+
+ UInt8 ___filler51[0x400-0x322];
+
+ UInt8 portADir; // $10400: Port A Direction Register
+ UInt8 portAData; // $10401: Port A Data Register
+ UInt8 portAPullupEn; // $10402: Port A Pullup Enable
+
+ UInt8 ___filler52[0x408-0x403];
+
+ UInt8 portBDir; // $10408: Port B Direction Register
+ UInt8 portBData; // $10409: Port B Data Register
+ UInt8 portBPullupEn; // $1040A: Port B Pullup Enable
+ UInt8 portBSelect; // $1040B: Port B Select Register
+
+ UInt8 ___filler53[0x410-0x40C];
+
+ UInt8 portCDir; // $10410: Port C Direction Register
+ UInt8 portCData; // $10411: Port C Data Register
+ UInt8 portCPulldnEn; // $10412: Port C Pulldown Enable
+ UInt8 portCSelect; // $10413: Port C Select Register
+
+ UInt8 ___filler54[0x418-0x414];
+
+ UInt8 portDDir; // $10418: Port D Direction Register
+ UInt8 portDData; // $10419: Port D Data Register
+ UInt8 portDPullupEn; // $1041A: Port D Pull-up Enable
+ UInt8 portDSelect; // $1041B: Port D Select Register
+ UInt8 portDIntMask; // $1041C: Port D Interrupt Mask Register
+ UInt8 portDIntStatus; // $1041D: Port D Interrupt Status Register
+ UInt8 portDIntEdge; // $1041E: Port D Interrupt Edge Register
+ UInt8 portDIntPolarity; // $1041F: Port D Interrupt Polarity Register
+
+ UInt8 portEDir; // $10420: Port E Direction Register
+ UInt8 portEData; // $10421: Port E Data Register
+ UInt8 portEPullupEn; // $10422: Port E Pull-up Enable
+ UInt8 portESelect; // $10423: Port E Select Register
+ UInt8 portEIntMask; // $10424: Port E Interrupt Mask Register
+ UInt8 portEIntStatus; // $10425: Port E Interrupt Status Register
+ UInt8 portEIntEdge; // $10426: Port E Interrupt Edge Register
+ UInt8 portEIntPolarity; // $10427: Port E Interrupt Polarity Register
+
+ UInt8 portFDir; // $10428: Port F Direction Register
+ UInt8 portFData; // $10429: Port F Data Register
+ UInt8 portFPullupdnEn; // $1042A: Port F Pull-up/down Enable
+ UInt8 portFSelect; // $1042B: Port F Select Register
+ UInt8 portFIntMask; // $1042C: Port F Interrupt Mask Register
+ UInt8 portFIntStatus; // $1042D: Port F Interrupt Status Register
+ UInt8 portFIntEdge; // $1042E: Port F Interrupt Edge Register
+ UInt8 portFIntPolarity; // $1042F: Port F Interrupt Polarity Register
+
+ UInt8 portGDir; // $10430: Port G Direction Register
+ UInt8 portGData; // $10431: Port G Data Register
+ UInt8 portGPullupEn; // $10432: Port G Pull-up Enable
+ UInt8 portGSelect; // $10433: Port G Select Register
+ UInt8 portGIntMask; // $10434: Port G Interrupt Mask Register
+ UInt8 portGIntStatus; // $10435: Port G Interrupt Status Register
+ UInt8 portGIntEdge; // $10436: Port G Interrupt Edge Register
+ UInt8 portGIntPolarity; // $10437: Port G Interrupt Polarity Register
+
+ UInt8 portJDir; // $10438: Port J Direction Register
+ UInt8 portJData; // $10439: Port J Data Register
+ UInt8 portJPullupEn; // $1043A: Port J Pull-up Enable
+ UInt8 portJSelect; // $1043B: Port J Select Register
+ UInt8 portJIntMask; // $1043C: Port J Interrupt Mask Register
+ UInt8 portJIntStatus; // $1043D: Port J Interrupt Status Register
+ UInt8 portJIntEdge; // $1043E: Port J Interrupt Edge Register
+ UInt8 portJIntPolarity; // $1043F: Port J Interrupt Polarity Register
+
+ UInt8 portKDir; // $10440: Port K Direction Register
+ UInt8 portKData; // $10441: Port K Data Register
+ UInt8 portKPullupdnEn; // $10442: Port K Pull-up/down Enable
+ UInt8 portKSelect; // $10443: Port K Select Register
+ UInt8 portKIntMask; // $10444: Port K Interrupt Mask Register
+ UInt8 portKIntStatus; // $10445: Port K Interrupt Status Register
+ UInt8 portKIntEdge; // $10446: Port K Interrupt Edge Register
+ UInt8 portKIntPolarity; // $10447: Port K Interrupt Polarity Register
+
+ UInt8 portMDir; // $10448: Port M Direction Register
+ UInt8 portMData; // $10449: Port M Data Register
+ UInt8 portMPullupdnEn; // $1044A: Port M Pull-up/down Enable
+ UInt8 portMSelect; // $1044B: Port M Select Register
+ UInt8 portMIntMask; // $1044C: Port M Interrupt Mask Register
+ UInt8 portMIntStatus; // $1044D: Port M Interrupt Status Register
+ UInt8 portMIntEdge; // $1044E: Port M Interrupt Edge Register
+ UInt8 portMIntPolarity; // $1044F: Port M Interrupt Polarity Register
+
+ UInt8 portNDir; // $10450: Port N Direction Register
+ UInt8 portNData; // $10451: Port N Data Register
+ UInt8 portNPullupdnEn; // $10452: Port N Pull-up/down Enable
+ UInt8 portNSelect; // $10453: Port N Select Register
+ UInt8 portNIntMask; // $10454: Port N Interrupt Mask Register
+ UInt8 portNIntStatus; // $10455: Port N Interrupt Status Register
+ UInt8 portNIntEdge; // $10456: Port N Interrupt Edge Register
+ UInt8 portNIntPolarity; // $10457: Port N Interrupt Polarity Register
+
+ UInt8 portPDir; // $10458: Port P Direction Register
+ UInt8 portPData; // $10459: Port P Data Register
+ UInt8 portPPullupdnEn; // $1045A: Port P Pull-up/down Enable
+ UInt8 portPSelect; // $1045B: Port P Select Register
+ UInt8 portPIntMask; // $1045C: Port P Interrupt Mask Register
+ UInt8 portPIntStatus; // $1045D: Port P Interrupt Status Register
+ UInt8 portPIntEdge; // $1045E: Port P Interrupt Edge Register
+ UInt8 portPIntPolarity; // $1045F: Port P Interrupt Polarity Register
+
+ UInt8 portRDir; // $10460: Port R Direction Register
+ UInt8 portRData; // $10461: Port R Data Register
+ UInt8 portRPullupdnEn; // $10462: Port R Pull-up/down Enable
+ UInt8 portRSelect; // $10463: Port R Select Register
+ UInt8 portRIntMask; // $10464: Port R Interrupt Mask Register
+ UInt8 portRIntStatus; // $10465: Port R Interrupt Status Register
+ UInt8 portRIntEdge; // $10466: Port R Interrupt Edge Register
+ UInt8 portRIntPolarity; // $10467: Port R Interrupt Polarity Register
+
+ UInt8 ___filler55[0x500-0x468];
+
+ UInt16 pwmControl; // $10500: PWM 1 Control Register (PWM 1 is the same as the single PWM in EZ)
+ UInt8 pwmSampleHi; // $10502: PWM 1 Sample - high byte
+ UInt8 pwmSampleLo; // $10503: PWM 1 Sample - low byte
+ UInt8 pwmPeriod; // $10504: PWM 1 Period
+ UInt8 pwmCounter; // $10505: PWM 1 Counter
+
+ UInt8 ___filler56[0x510-0x506];
+
+ UInt16 pwm2Control; // $10510: PWM 2 Control Register
+ UInt16 pwm2Period; // $10512: PWM 2 Period
+ UInt16 pwm2Width; // $10514: PWM 2 Width
+ UInt16 pwm2Counter; // $10516: PWM 2 Counter
+
+ UInt8 ___filler57[0x600-0x518];
+
+ UInt16 tmr1Control; // $10600: Timer 1 Control Register
+ UInt16 tmr1Prescaler; // $10602: Timer 1 Prescaler Register
+ UInt16 tmr1Compare; // $10604: Timer 1 Compare Register
+ UInt16 tmr1Capture; // $10606: Timer 1 Capture Register
+ UInt16 tmr1Counter; // $10608: Timer 1 Counter Register
+ UInt16 tmr1Status; // $1060A: Timer 1 Status Register
+
+ UInt8 ___filler58[0x610-0x60C];
+
+ UInt16 tmr2Control; // $10610: Timer 2 Control Register
+ UInt16 tmr2Prescaler; // $10612: Timer 2 Prescaler Register
+ UInt16 tmr2Compare; // $10614: Timer 2 Compare Register
+ UInt16 tmr2Capture; // $10616: Timer 2 Capture Register
+ UInt16 tmr2Counter; // $10618: Timer 2 Counter Register
+ UInt16 tmr2Status; // $1061A: Timer 2 Status Register
+
+ UInt8 ___filler59[0x700-0x61C];
+
+ UInt16 spiRxD; // $10700: SPI Unit 1 Receive Data Register
+ UInt16 spiTxD; // $10702: SPI Unit 1 Transmit Data Register
+ UInt16 spiCont1; // $10704: SPI Unit 1 Control/Status Register
+ UInt16 spiIntCS; // $10706: SPI Unit 1 Interrupt control/Status Register
+ UInt16 spiTest; // $10708: SPI Unit 1 Test Register
+ UInt16 spiSpc; // $1070A: SPI Unit 1 Sample period counter register
+
+ UInt8 ___filler60[0x800-0x70C];
+
+ UInt8 i2cAddress; // $10800: I2C Address Register
+
+ UInt8 ___filler61[0x804-0x801];
+
+ UInt8 i2cFreqDiv; // $10804: I2C Frequency Divider Register
+
+ UInt8 ___filler62[0x808-0x805];
+
+ UInt8 i2cControl; // $10808: I2C Control Register
+
+ UInt8 ___filler63[0x80C-0x809];
+
+ UInt8 i2cStatus; // $1080C: I2C Status Register
+
+ UInt8 ___filler64[0x810-0x80D];
+
+ UInt8 i2cDataIO; // $10810: I2C Data I/O Register
+
+ UInt8 ___filler65[0x900-0x811];
+
+ UInt16 uControl; // $10900: Uart 1 Status/Control Register (Uart 1 is the same as the single Uart in EZ)
+ UInt16 uBaud; // $10902: Uart 1 Baud Control Register
+ UInt16 uReceive; // $10904: Uart 1 Receive Register
+ UInt16 uTransmit; // $10906: Uart 1 Transmit Register
+ UInt16 uMisc; // $10908: Uart 1 Miscellaneous Register
+ UInt16 uNonIntPresc; // $1090A: Uart 1 Non-Integer Prescaler
+ UInt16 uFIFOHMark; // $1090C: Uart 1 Half Mark FIFO Register
+
+ UInt8 ___filler66[0x910-0x90E];
+
+ UInt16 u2Control; // $10910: Uart 2 Status/Control Register
+ UInt16 u2Baud; // $10912: Uart 2 Baud Control Register
+ UInt16 u2Receive; // $10914: Uart 2 Receiver Register
+ UInt16 u2Transmit; // $10916: Uart 2 Transmitter Register
+ UInt16 u2Misc; // $10918: Uart 2 Miscellaneous Register
+ UInt16 u2NonIntPresc; // $1091A: Uart 2 Non-Integer Prescaler Register
+ UInt16 u2FIFOHMark; // $1091C: Uart 2 Half Mark FIFO Register
+
+ UInt8 ___filler67[0xB00-0x91E];
+
+ UInt32 rtcHourMinSec; // $10B00: RTC Hours, Minutes, Seconds Register
+ UInt32 rtcAlarm; // $10B04: RTC Alarm Register
+
+ UInt8 ___filler68[0xB0A-0xB08];
+
+ UInt16 rtcWatchDog; // $10B0A: RTC Watchdog Timer
+ UInt16 rtcControl; // $10B0C: RTC Control Register
+ UInt16 rtcIntStatus; // $10B0E: RTC Interrupt Status Register
+ UInt16 rtcIntEnable; // $10B10: RTC Interrupt Enable Register
+ UInt16 stopWatch; // $10B12: Stopwatch Minutes
+
+ UInt8 ___filler69[0xB1A-0xB14];
+
+ UInt16 rtcDay; // $10B1A: RTC Day
+ UInt16 rtcDayAlarm; // $10B1C: RTC Day Alarm
+
+ UInt8 ___filler70[0xC00-0xB1E];
+
+ UInt32 sdramControlE; // $10C00: SDRAM Control Register for Chip Select E
+ UInt32 sdramControlF; // $10C04: SDRAM Control Register for Chip Select F
+ UInt32 edoControlE; // $10C08: EDO Control Register for Chip Select E
+ UInt32 edoControlF; // $10C0C: EDO Control Register for Chip Select F
+ UInt16 secondaryControl; // $10C10: Secondary Control Register
+
+ UInt8 ___filler71[0xD00-0xC12];
+
+ UInt32 emuAddrCompare; // $10D00: Emulation Address Compare Register
+ UInt32 emuAddrMask; // $10D04: Emulation Address Mask Register
+ UInt16 emuControlCompare; // $10D08: Emulation Control Compare Register
+ UInt16 emuControlMask; // $10D0A: Emulation Control Mask Register
+ UInt16 emuControl; // $10DOC: Emulation Control Register
+ UInt16 emuStatus; // $10D0E: Emulation Status Register
+};
+
+typedef volatile struct HwrM68SZ328Type* HwrM68SZ328Ptr;
+
+#define HwrDBallType HwrM68SZ328Type
+#define HwrDBallPtr HwrM68SZ328Ptr
+
+/************************************************************************
+ * ADC / ASP register for SZ
+ ***********************************************************************/
+#define hwrSZ328adcLowPowerOffEnable 0x04000000
+#define hwrSZ328adcVoiceEnable 0x00000004
+#define hwrSZ328adcPenEnable 0x00000002
+
+#define hwrSZ328adcIntEnable 0x00000097
+
+
+/************************************************************************
+ * Chip ID register for SZ
+ ***********************************************************************/
+ #define hwrSZ328chipIDSZ 0x45
+
+/************************************************************************
+ * Mask ID register for SZ
+ ***********************************************************************/
+#define hwrSZ328maskID0H31J 0x01
+#define hwrSZ328maskID0J75C 0x02
+#define hwrSZ328maskID1J75C 0x03
+#define hwrSZ328maskID0J83G 0x04
+
+/************************************************************************
+ * LCD Controller Bits
+ ************************************************************************/
+// lcdCursorXPos Register
+#define hwrSZ328LcdCursorXPosCtlMask 0xC000
+ #define hwrSZ328LcdCursorXPosCtlTrans 0x0000
+ #define hwrSZ328LcdCursorXPosCtlBlack 0x4000
+ #define hwrSZ328LcdCursorXPosCtlReverse 0x8000
+ #define hwrSZ328LcdCursorXPosCtlWhite 0xC000
+#define hwrSZ328LcdCursorXPosValueMask 0x1FF
+// lcdCursorYPos Register
+#define hwrSZ328LcdCursorYPosValueMask 0x1FF
+
+// lcdCursorSize Register
+#define hwrSZ328LcdCursorWidthMask 0x3F
+ #define hwrSZ328LcdCursorWidthOffset 0x8
+#define hwrSZ328LcdCursorHeightMask 0x3F
+
+// lcdBlinkControl Register
+#define hwrSZ328LcdBlinkDivisorMask 0xFF
+
+// lcdPanelControl1 Register
+#define hwrSZ328LcdPanelControlBusMask 0x3000
+ #define hwrSZ328LcdPanelControlBus1Bit 0x0000
+ #define hwrSZ328LcdPanelControlBus2Bit 0x1000
+ #define hwrSZ328LcdPanelControlBus4Bit 0x2000
+#define hwrSZ328LcdPanelControlGrayScale 0x4000
+#define hwrSZ328LcdPanelControl4BitGrayScale 0x0200
+
+// lcdPWMContrastControl Register
+#define hwrSZ328LcdContrastPWMWidthMask 0x00FF
+#define hwrSZ328LcdContrastEnable 0x0100
+#define hwrSZ328LcdLDMask 0x8000
+
+
+
+/************************************************************************
+ * Interrupt Controller Bits
+ ************************************************************************/
+
+// intMaskHi bits
+// NOTE: Due to a bug in early rev's of the DragonBall, the clear bits for
+// IRQ[1236] on those early chips were different than the indicator bits
+// (the order was reversed). So some older code uses the OR of the IRQ1 and
+// IRQ6 bits for either, and the OR of the IRQ2 and IRQ3 bits for either.
+#define hwrSZ328IntHiUSB 0x8000
+#define hwrSZ328IntHiI2C 0x4000
+#define hwrSZ328IntHiMMC 0x2000
+#define hwrSZ328IntHiPortK 0x1000
+#define hwrSZ328IntHiPortM 0x0800
+#define hwrSZ328IntHiPortN 0x0400
+#define hwrSZ328IntHiPortP 0x0200
+#define hwrSZ328IntHiADC 0x0100
+#define hwrSZ328IntHiEMU 0x0080
+#define hwrSZ328IntHiSampleTimer 0x0040
+#define hwrSZ328IntHiCSPI 0x0020
+#define hwrSZ328IntHiPortR 0x0010
+#define hwrSZ328IntHiIRQ6 0x0008
+#define hwrSZ328IntHiIRQ3 0x0004
+#define hwrSZ328IntHiIRQ2 0x0002
+#define hwrSZ328IntHiIRQ1 0x0001
+
+// intMaskLo bits
+#define hwrSZ328IntLoDMA1 0x8000
+#define hwrSZ328IntLoDMA2 0x4000
+#define hwrSZ328IntLoPWM2 0x2000
+#define hwrSZ328IntLoPWM2Bit 13
+#define hwrSZ328IntLoUART2 0x1000
+#define hwrSZ328IntLoUART2Bit 12
+#define hwrSZ328IntLoPortD 0x0800
+#define hwrSZ328IntLoPortE 0x0400
+#define hwrSZ328IntLoPortF 0x0200
+#define hwrSZ328IntLoPortG 0x0100
+#define hwrSZ328IntLoAllKeys 0x0F00
+#define hwrSZ328IntLoInt0Bit 8
+#define hwrSZ328IntLoPWM 0x0080
+#define hwrSZ328IntLoPWMBit 7
+#define hwrSZ328IntLoPortJ 0x0040
+#define hwrSZ328IntLoTimer2 0x0020
+#define hwrSZ328IntLoTimer2Bit 5
+#define hwrSZ328IntLoRTC 0x0010
+#define hwrSZ328IntLoRTCBit 4
+#define hwrSZ328IntLoWDT 0x0008
+#define hwrSZ328IntLoUART 0x0004
+#define hwrSZ328IntLoUARTBit 2
+#define hwrSZ328IntLoTimer 0x0002
+#define hwrSZ328IntLoTimerBit 1
+#define hwrSZ328IntLoLCDC 0x0001
+
+// intControl bits
+// NOTE: These are different than that documented in the User's manual
+// for the DragonBall (see erratas). The DragonBall is the same as the EZ.
+// Note 2: I am going to assume that these have not changed, since the SZ
+// manual is the same as the VZ's (even thought the manual is not followed) [TJC]
+#define hwrSZ328IntCtlEdge1 0x0800
+#define hwrSZ328IntCtlEdge2 0x0400
+#define hwrSZ328IntCtlEdge3 0x0200
+#define hwrSZ328IntCtlEdge6 0x0100
+#define hwrSZ328IntCtlPol1 0x8000
+#define hwrSZ328IntCtlPol2 0x4000
+#define hwrSZ328IntCtlPol3 0x2000
+#define hwrSZ328IntCtlPol6 0x1000
+#define hwrSZ328IntCtlPol5 0x0080
+
+
+/************************************************************************
+ * SDRAM Controller Bits bits
+ * Not all the bits are defined here-- some are pretty bad to muck with
+ * in anything but initial setup of the SDRAM.
+ ************************************************************************/
+// sdramControl[E,F] bits
+#define hwrSZ328SdramControlEnable 0x80000000
+#define hwrSZ328SdramControlOperatingMode 0x70000000
+ // rsvd
+#define hwrSZ328SdramControlIAM 0x00800000
+ // rsvd
+ // rsvd
+ // rsvd
+#define hwrSZ328SdramControlCASLatency 0x00000300
+
+// edoControl[E,F] bits
+#define hwrSZ328EdoControlEnable 0x80000000
+
+
+/************************************************************************
+ * Timer bits
+ ************************************************************************/
+#define hwrSZ328TmrControlUnused 0xFC00
+#define hwrSZ328TmrControlTIOOutput 0x0200
+#define hwrSZ328TmrControlFreeRun 0x0100
+#define hwrSZ328TmrControlCaptureEdgeMask 0x00C0
+ #define hwrSZ328TmrControlCaptureEdgeNone 0x0000
+ #define hwrSZ328TmrControlCaptureEdgeRising 0x0040
+ #define hwrSZ328TmrControlCaptureEdgeFalling 0x0080
+ #define hwrSZ328TmrControlCaptureEdgeBoth 0x00C0
+#define hwrSZ328TmrControlOutputModeToggle 0x0020
+#define hwrSZ328TmrControlEnInterrupt 0x0010
+#define hwrSZ328TmrControlClkSrcMask 0x000E
+ #define hwrSZ328TmrControlClkSrcStop 0x0000
+ #define hwrSZ328TmrControlClkSrcSys 0x0002
+ #define hwrSZ328TmrControlClkSrcSysBy16 0x0004
+ #define hwrSZ328TmrControlClkSrcTIN 0x0006
+ #define hwrSZ328TmrControlClkSrc32KHz 0x0008
+#define hwrSZ328TmrControlEnable 0x0001
+
+#define hwrSZ328TmrStatusCapture 0x0002
+#define hwrSZ328TmrStatusCaptureBit 1
+#define hwrSZ328TmrStatusCompare 0x0001
+#define hwrSZ328TmrStatusCompareBit 0
+
+
+/************************************************************************
+ * 68SZ328 Serial Port Register Bits
+ ************************************************************************/
+// uControl Register
+#define hwrSZ328UControlUARTEnable 0x8000
+#define hwrSZ328UControlRxEnable 0x4000
+#define hwrSZ328UControlTxEnable 0x2000
+#define hwrSZ328UControlRxClock1xSync 0x1000
+#define hwrSZ328UControlParityEn 0x0800
+#define hwrSZ328UControlParityOdd 0x0400
+#define hwrSZ328UControlStopBits2 0x0200
+#define hwrSZ328UControlDataBits8 0x0100
+#define hwrSZ328UControlOldDataEn 0x0080
+#define hwrSZ328UControlCTSDeltaEn 0x0040
+#define hwrSZ328UControlRxFullEn 0x0020
+#define hwrSZ328UControlRxHalfEn 0x0010
+#define hwrSZ328UControlRxRdyEn 0x0008
+#define hwrSZ328UControlTxEmptyEn 0x0004
+#define hwrSZ328UControlTxHalfEn 0x0002
+#define hwrSZ328UControlTxAvailEn 0x0001
+
+#define hwrSZ328UControlEnableAll (hwrSZ328UControlUARTEnable | \
+ hwrSZ328UControlRxEnable | \
+ hwrSZ328UControlTxEnable)
+
+// uBaud Register
+// UCLK output requires PE3 Select to be 0
+#define hwrSZ328UBaudUCLKDirOut 0x2000
+#define hwrSZ328UBaudBaudSrcUCLK 0x0800
+#define hwrSZ328UBaudDivider 0x0700
+#define hwrSZ328UBaudPrescaler 0x003F
+
+#define hwrSZ328UBaudDivideBitOffset 8
+
+
+// uReceive Register
+#define hwrSZ328UReceiveFIFOFull 0x8000
+#define hwrSZ328UReceiveFIFOHalf 0x4000
+#define hwrSZ328UReceiveDataRdy 0x2000
+#define hwrSZ328UReceiveDataRdyBit 13
+#define hwrSZ328UReceiveOldData 0x1000
+#define hwrSZ328UReceiveOverrunErr 0x0800
+#define hwrSZ328UReceiveOverrunErrBit 11
+#define hwrSZ328UReceiveFrameErr 0x0400
+#define hwrSZ328UReceiveFrameErrBit 10
+#define hwrSZ328UReceiveBreakErr 0x0200
+#define hwrSZ328UReceiveBreakErrBit 9
+#define hwrSZ328UReceiveParityErr 0x0100
+#define hwrSZ328UReceiveParityErrBit 8
+#define hwrSZ328UReceiveData 0x00FF
+
+#define hwrSZ328UReceiveErrsMask (hwrSZ328UReceiveOverrunErr | \
+ hwrSZ328UReceiveFrameErr | \
+ hwrSZ328UReceiveBreakErr | \
+ hwrSZ328UReceiveParityErr)
+
+// uTransmit Register
+#define hwrSZ328UTransmitFIFOEmpty 0x8000
+#define hwrSZ328UTransmitFIFOHalf 0x4000
+#define hwrSZ328UTransmitTxAvail 0x2000
+#define hwrSZ328UTransmitSendBreak 0x1000
+#define hwrSZ328UTransmitIgnoreCTS 0x0800
+#define hwrSZ328UTransmitBusy 0x0400
+#define hwrSZ328UTransmitCTSStatus 0x0200
+#define hwrSZ328UTransmitCTSDelta 0x0100
+#define hwrSZ328UTransmitData 0x00FF
+
+// uMisc Register
+#define hwrSZ328UMiscBaudTest 0x8000
+#define hwrSZ328UMiscClkSrcUCLK 0x4000
+#define hwrSZ328UMiscForceParityErr 0x2000
+#define hwrSZ328UMiscLoopback 0x1000
+#define hwrSZ328UMiscBaudReset 0x0800
+#define hwrSZ328UMiscIRTestEn 0x0400
+#define hwrSZ328UMiscReservedMask 0x0300
+#define hwrSZ328UMiscRTSThruFIFO 0x0080
+#define hwrSZ328UMiscRTSOut 0x0040
+#define hwrSZ328UMiscIRDAEn 0x0020
+#define hwrSZ328UMiscLoopIRDA 0x0010
+#define hwrSZ328UMiscRXPolarityInv 0x0008
+#define hwrSZ328UMiscTXPolarityInv 0x0004
+#define hwrSZ328UMiscErrorIntStatus 0x0002
+#define hwrSZ328UMiscErrorIntEnable 0x0001
+#define hwrSZ328UMiscUnused 0x0000
+
+// uNonIntPresc Register
+#define hwrSZ328UNonIntPrescSrcIntPresc 0x0000
+#define hwrSZ328UNonIntPrescSrcNonIntPresc 0x8000
+
+#define hwrSZ328UNonIntPrescSelDiv128 0x0000
+#define hwrSZ328UNonIntPrescSelDiv64 0x0100
+#define hwrSZ328UNonIntPrescSelDiv32 0x0200
+#define hwrSZ328UNonIntPrescSelDiv16 0x0300
+#define hwrSZ328UNonIntPrescSelDiv8 0x0400
+#define hwrSZ328UNonIntPrescSelDiv4 0x0500
+#define hwrSZ328UNonIntPrescSelDiv2 0x0600
+#define hwrSZ328UNonIntPrescSelDiv1 0x0700
+
+#define hwrSZ328UNonIntPrescStepMask 0x00FF
+#define hwrSZ328UNonIntPrescSelOffset 8
+
+// see SZ docs for explanation of the following. This provides the correct
+// pulse width for IRDA, and is just a statement in the docs. The values don't
+// appear to make sense, but I just push the buttons.
+
+// This has been deprecated in favor of a prv function in the serial driver and
+// the SerialMgr (depending on whether you have Bond or not) that calculates
+// the value of this register based on the clock frequency you're running on.
+// There was a bug when running EZ at 20MHz that caused the IrDA pulsewidth to
+// get too short.
+
+#if 0
+#define hwrSZ328UNonIntPrescIRDAMode (hwrSZ328UNonIntPrescSrcIntPresc \
+ | hwrSZ328UNonIntPrescSelDiv32 \
+ | (hwrSZ328UNonIntPrescStepMask & 0x20))
+#endif
+
+/************************************************************************
+ * PWM Bits
+ ************************************************************************/
+// PWM register bits of interest
+#define hwrSZ328PWMControlEnable 0x0010
+#define hwrSZ328PWMControlEnableBit 4
+#define hwrSZ328PWMControlEnableIRQ 0x0040
+#define hwrSZ328PWMIRQStatus 0x0080
+// PWM divider chain output selectors
+#define hwrSZ328PWMControlDivMask 0x0003
+#define hwrSZ328PWMControlDivBy2 0x0
+#define hwrSZ328PWMControlDivBy4 0x1
+#define hwrSZ328PWMControlDivBy8 0x2
+#define hwrSZ328PWMControlDivBy16 0x3
+// PWM Repeat Counts
+#define hwrSZ328PWMRepeatSample1x 0x0
+#define hwrSZ328PWMRepeatSample2x 0x4
+#define hwrSZ328PWMRepeatSample4x 0x8
+#define hwrSZ328PWMRepeatSample8x 0xC
+// PWM hardware constraints
+#define hwrSZ328PWMFifoSizeInBytes 4
+#define hwrSZ328PWMPrescalerMask 0x7F00
+#define hwrSZ328PWMPrescalerOffset 8
+
+/************************************************************************
+ * PLL Bits
+ ************************************************************************/
+#define hwrSZ328PLLControlMCURestart 0x8000
+#define hwrSZ328PLLControlUSBRestart 0x4000
+#define hwrSZ328PLLControlClkEnable 0x0010
+#define hwrSZ328PLLControlMCUDisable 0x0008
+#define hwrSZ328PLLControlUSBDisable 0x0004
+
+#define hwrSZ328PLLControlSysDMADiv2 0x0000
+#define hwrSZ328PLLControlSysDMADiv4 0x0100
+#define hwrSZ328PLLControlSysDMADiv8 0x0200
+#define hwrSZ328PLLControlSysDMADiv16 0x0300
+#define hwrSZ328PLLControlSysDMADiv1 0x0400
+
+#define hwrSZ328PLLControlPixDMADiv2 0x0000
+#define hwrSZ328PLLControlPixDMADiv4 0x0800
+#define hwrSZ328PLLControlPixDMADiv8 0x1000
+#define hwrSZ328PLLControlPixDMADiv16 0x1800
+#define hwrSZ328PLLControlPixDMADiv1 0x2000
+
+
+/************************************************************************
+ * Real Time Clock (RTC) Bits
+ ************************************************************************/
+
+// RTC Control Register (RTCCTL / rtcControl) bits
+#define hwrSZ328RTCControlRTCEnable 0x0080
+
+// RTC Interrupt Enable Register (RTCIENR / rtcIntEnable) bits
+#define hwrSZ328RTCIntEnableSample7 0x8000
+#define hwrSZ328RTCIntEnableSample6 0x4000
+#define hwrSZ328RTCIntEnableSample5 0x2000
+#define hwrSZ328RTCIntEnableSample4 0x1000
+#define hwrSZ328RTCIntEnableSample3 0x0800
+#define hwrSZ328RTCIntEnableSample2 0x0400
+#define hwrSZ328RTCIntEnableSample1 0x0200
+#define hwrSZ328RTCIntEnableSample0 0x0100
+#define hwrSZ328RTCIntEnableHour 0x0020
+#define hwrSZ328RTCIntEnableSec 0x0010
+#define hwrSZ328RTCIntEnable24Hr 0x0008
+#define hwrSZ328RTCIntEnableAlarm 0x0004
+#define hwrSZ328RTCIntEnableMinute 0x0002
+#define hwrSZ328RTCIntEnableStopWatch 0x0001
+
+// RTC Interrupt Status Register bits (rtcIntStatus)
+#define hwrSZ328RTCIntStatusSample7 0x8000
+#define hwrSZ328RTCIntStatusSample6 0x4000
+#define hwrSZ328RTCIntStatusSample5 0x2000
+#define hwrSZ328RTCIntStatusSample4 0x1000
+#define hwrSZ328RTCIntStatusSample3 0x0800
+#define hwrSZ328RTCIntStatusSample2 0x0400
+#define hwrSZ328RTCIntStatusSample1 0x0200
+#define hwrSZ328RTCIntStatusSample0 0x0100
+#define hwrSZ328RTCIntStatusHour 0x0020
+#define hwrSZ328RTCIntStatusSec 0x0010
+#define hwrSZ328RTCIntStatus24Hr 0x0008
+#define hwrSZ328RTCIntStatusAlarm 0x0004
+#define hwrSZ328RTCIntStatusMinute 0x0002
+#define hwrSZ328RTCIntStatusStopWatch 0x0001
+
+// RTC Alarm register (RTCALRM / rtcAlarm) masks and offsets
+#define hwrSZ328RTCAlarmSecondsMask 0x0000003fL
+#define hwrSZ328RTCAlarmSecondsOffset 0
+#define hwrSZ328RTCAlarmMinutesMask 0x003f0000L
+#define hwrSZ328RTCAlarmMinutesOffset 16
+#define hwrSZ328RTCAlarmHoursMask 0x1f000000L
+#define hwrSZ328RTCAlarmHoursOffset 24
+
+// RTC hours/minutes/seconds register (RTCHMS / rtcHourMinSec) masks and offsets
+#define hwrSZ328RTCHourMinSecSecondsMask 0x0000003fL
+#define hwrSZ328RTCHourMinSecSecondsOffset 0
+#define hwrSZ328RTCHourMinSecMinutesMask 0x003f0000L
+#define hwrSZ328RTCHourMinSecMinutesOffset 16
+#define hwrSZ328RTCHourMinSecHoursMask 0x1f000000L
+#define hwrSZ328RTCHourMinSecHoursOffset 24
+
+// RTC Day register masks/offsets
+#define hwrSZ328RTCDayDayMask 0x01FF
+#define hwrSZ328RTCDayDayOffset 0
+
+// RTC Watchdog Timer masks/offsets
+#define hwrSZ328RTCWatchdogEnable 0x0001
+#define hwrSZ328RTCWatchdogIntSel 0x0002
+#define hwrSZ328RTCWatchdogIntStatus 0x0080
+#define hwrSZ328RTCWatchdogCountMask 0x0300
+#define hwrSZ328RTCWatchdogCountOffset 8
+
+/************************************************************************
+ * SPI Master bits
+ ************************************************************************/
+
+// spiCont1 Register
+#define hwrSZ328SPIMControlRateMask 0xE000
+ #define hwrSZ328SPIMControlRateDiv4 0x0000
+ #define hwrSZ328SPIMControlRateDiv8 0x2000
+ #define hwrSZ328SPIMControlRateDiv16 0x4000
+ #define hwrSZ328SPIMControlRateDiv32 0x6000
+ #define hwrSZ328SPIMControlRateDiv64 0x8000
+ #define hwrSZ328SPIMControlRateDiv128 0xA000
+ #define hwrSZ328SPIMControlRateDiv256 0xC000
+ #define hwrSZ328SPIMControlRateDiv512 0xE000
+#define hwrSZ328SPIMControlEnable 0x0200
+#define hwrSZ328SPIMControlExchange 0x0100
+#define hwrSZ328SPIMControlIntStatus 0x0080
+#define hwrSZ328SPIMControlIntEnable 0x0040
+#define hwrSZ328SPIMControlOppPhase 0x0020
+#define hwrSZ328SPIMControlInvPolarity 0x0010
+#define hwrSZ328SPIMControlBitsMask 0x000F
+
+
+#endif // INCLUDE_SECRET_STUFF
+
+#endif // __M68SZ328_H__
+
+#endif // NON_PORTABLE
diff --git a/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68VZ328Hwr.h b/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68VZ328Hwr.h
new file mode 100644
index 0000000..323b8c1
--- /dev/null
+++ b/SrcShared/Palm/Platform/Core/Hardware/IncsPrv/M68VZ328Hwr.h
@@ -0,0 +1,844 @@
+/*******************************************************************
+ * Pilot Software
+ *
+ * Copyright(c) 1995-1999, Palm Computing Inc., All Rights Reserved
+ *
+ *-------------------------------------------------------------------
+ * FileName:
+ * M68VZ328Hwr.h
+ *
+ * Description:
+ * Hardware Equates for the Motorola 68VZ328 Dragonball-VZ chip
+ *
+ * History:
+ * 11/19/99 EBE Created; integrated from M68EZ328Hwr.h
+ * 11/22/99 EBE Added Port Defs for J, K, & M
+ * 12/03/99 EBE Fixed up fillers @ 0x00A & 0x518
+ *
+ *******************************************************************/
+
+#ifdef NON_PORTABLE // So apps don't include this...
+
+
+#ifndef __M68VZ328HWR_H__
+#define __M68VZ328HWR_H__
+
+
+#include <PalmTypes.h> // Touchdown includes
+
+
+// Define location of the 68VZ328 Dragonball chip
+#define hwr68328Base 0xFFFFF000L // Base address of 68328
+
+
+/***********************************************************************
+ * Motorola 68VZ328 registers
+ ***********************************************************************/
+struct HwrM68VZ328Type {
+
+ UInt8 scr; // $000: System Control Register
+ UInt8 ___filler0[0x003-0x001];
+ UInt8 pcr; // $003: Peripheral Control Register
+ UInt8 chipID; // $004: Chip ID Register
+ UInt8 maskID; // $005: Mask ID Register
+ UInt16 swID; // $006: Software ID Register
+ UInt16 ioDriveControl; // $008: I/O Drive Control Register
+ UInt8 ___filler1[0x100-0x00A];
+
+ UInt16 csAGroupBase; // $100: Chip Select Group A Base Register
+ UInt16 csBGroupBase; // $102: Chip Select Group B Base Register
+ UInt16 csCGroupBase; // $104: Chip Select Group C Base Register
+ UInt16 csDGroupBase; // $106: Chip Select Group D Base Register
+
+ UInt16 csUGroupBase; // $108: Chip Select Upper Group Base Register
+
+ UInt16 csControl1; // $10A: Chip Select Control Register
+ UInt16 csControl2; // $10C: Chip Select Control Register
+
+ UInt8 ___filler2[0x110-0x10E];
+
+ UInt16 csASelect; // $110: Group A Chip Select Register
+ UInt16 csBSelect; // $112: Group B Chip Select Register
+ UInt16 csCSelect; // $114: Group C Chip Select Register
+ UInt16 csDSelect; // $116: Group D Chip Select Register
+
+ UInt16 emuCS; // $118: EMU Chip Select Register
+
+ UInt8 ___filler3[0x150-0x11A];
+
+ UInt16 csControl3; // $150: Chip Select Control Register
+
+ UInt8 ___filler3a[0x200-0x152];
+
+ UInt16 pllControl; // $200: PLL Control Register
+ UInt16 pllFreqSel; // $202: CGM Frequency Select Register
+
+ UInt8 ___filler4[0x207-0x204];
+
+ UInt8 pwrControl; // $207: Power Control Register
+
+ UInt8 ___filler5[0x300-0x208];
+
+ UInt8 intVector; // $300: Interrupt Vector Register
+ UInt8 ___filler6;
+ UInt16 intControl; // $302: Interrupt Control Register
+ UInt16 intMaskHi; // $304: Interrupt Mask Register/HIGH word
+ UInt16 intMaskLo; // $306: Interrupt Mask Register/LOW word
+ UInt8 ___filler7[0x30c-0x308];
+ UInt16 intStatusHi; // $30C: Interrupt Status Register/HIGH word
+ UInt16 intStatusLo; // $30E: Interrupt Status Register/LOW word
+ UInt16 intPendingHi; // $310: Interrupt Pending Register/HIGH word
+ UInt16 intPendingLo; // $312: Interrupt Pending Register/LOW word
+ UInt16 intLevelControl; // $314: Interrupt Level Control Register
+
+ UInt8 ___filler4a[0x400-0x316];
+
+ UInt8 portADir; // $400: Port A Direction Register
+ UInt8 portAData; // $401: Port A Data Register
+ UInt8 portAPullupEn; // $402: Port A Pullup Enable
+ UInt8 ___filler8[5];
+
+ UInt8 portBDir; // $408: Port B Direction Register
+ UInt8 portBData; // $409: Port B Data Register
+ UInt8 portBPullupEn; // $40A: Port B Pullup Enable
+ UInt8 portBSelect; // $40B: Port B Select Register
+
+ UInt8 ___filler9[4];
+
+ UInt8 portCDir; // $410: Port C Direction Register
+ UInt8 portCData; // $411: Port C Data Register
+ UInt8 portCPulldnEn; // $412: Port C Pulldown Enable
+ UInt8 portCSelect; // $413: Port C Select Register
+
+ UInt8 ___filler10[4];
+
+ UInt8 portDDir; // $418: Port D Direction Register
+ UInt8 portDData; // $419: Port D Data Register
+ UInt8 portDPullupEn; // $41A: Port D Pull-up Enable
+ UInt8 portDSelect; // $41B: Port D Select Register
+ UInt8 portDPolarity; // $41C: Port D Polarity Register
+ UInt8 portDIntReqEn; // $41D: Port D Interrupt Request Enable
+ UInt8 portDKbdIntEn; // $41E: Port D Keyboard Interrupt Enable
+ UInt8 portDIntEdge; // $41F: Port D IRQ Edge Register
+
+ UInt8 portEDir; // $420: Port E Direction Register
+ UInt8 portEData; // $421: Port E Data Register
+ UInt8 portEPullupEn; // $422: Port E Pull-up Enable
+ UInt8 portESelect; // $423: Port E Select Register
+
+ UInt8 ___filler14[4];
+
+ UInt8 portFDir; // $428: Port F Direction Register
+ UInt8 portFData; // $429: Port F Data Register
+ UInt8 portFPullupdnEn; // $42A: Port F Pull-up/down Enable
+ UInt8 portFSelect; // $42B: Port F Select Register
+
+ UInt8 ___filler16[4];
+
+ UInt8 portGDir; // $430: Port G Direction Register
+ UInt8 portGData; // $431: Port G Data Register
+ UInt8 portGPullupEn; // $432: Port G Pull-up Enable
+ UInt8 portGSelect; // $433: Port G Select Register
+
+ UInt8 ___filler17[0x438-0x434];
+
+ UInt8 portJDir; // $438: Port J Direction Register
+ UInt8 portJData; // $439: Port J Data Register
+ UInt8 portJPullupEn; // $43A: Port J Pull-up Enable
+ UInt8 portJSelect; // $43B: Port J Select Register
+
+ UInt8 ___filler18[0x440-0x43C];
+
+ UInt8 portKDir; // $440: Port K Direction Register
+ UInt8 portKData; // $441: Port K Data Register
+ UInt8 portKPullupdnEn; // $442: Port K Pull-up/down Enable
+ UInt8 portKSelect; // $443: Port K Select Register
+
+ UInt8 ___filler19[0x448-0x444];
+
+ UInt8 portMDir; // $448: Port M Direction Register
+ UInt8 portMData; // $449: Port M Data Register
+ UInt8 portMPullupdnEn; // $44A: Port M Pull-up/down Enable
+ UInt8 portMSelect; // $44B: Port M Select Register
+
+ UInt8 ___filler20[0x500-0x44C];
+
+ UInt16 pwmControl; // $500: PWM 1 Control Register (PWM 1 is the same as the single PWM in EZ)
+ UInt8 pwmSampleHi; // $502: PWM 1 Sample - high byte
+ UInt8 pwmSampleLo; // $503: PWM 1 Sample - low byte
+ UInt8 pwmPeriod; // $504: PWM 1 Period
+ UInt8 pwmCounter; // $505: PWM 1 Counter
+
+ UInt8 ___filler22[0x510-0x506];
+
+ UInt16 pwm2Control; // $510: PWM 2 Control Register
+ UInt16 pwm2Period; // $512: PWM 2 Period
+ UInt16 pwm2Width; // $514: PWM 2 Width
+ UInt16 pwm2Counter; // $516: PWM 2 Counter
+
+ UInt8 ___filler23[0x600-0x518];
+
+ UInt16 tmr1Control; // $600: Timer 1 Control Register
+ UInt16 tmr1Prescaler; // $602: Timer 1 Prescaler Register
+ UInt16 tmr1Compare; // $604: Timer 1 Compare Register
+ UInt16 tmr1Capture; // $606: Timer 1 Capture Register
+ UInt16 tmr1Counter; // $608: Timer 1 Counter Register
+ UInt16 tmr1Status; // $60A: Timer 1 Status Register
+
+ UInt8 ___filler24[0x610-0x60C];
+
+ UInt16 tmr2Control; // $610: Timer 2 Control Register
+ UInt16 tmr2Prescaler; // $612: Timer 2 Prescaler Register
+ UInt16 tmr2Compare; // $614: Timer 2 Compare Register
+ UInt16 tmr2Capture; // $616: Timer 2 Capture Register
+ UInt16 tmr2Counter; // $618: Timer 2 Counter Register
+ UInt16 tmr2Status; // $61A: Timer 2 Status Register
+
+ UInt8 ___filler25[0x700-0x61C];
+
+ UInt16 spiRxD; // $700: SPI Unit 1 Receive Data Register
+ UInt16 spiTxD; // $702: SPI Unit 1 Transmit Data Register
+ UInt16 spiCont1; // $704: SPI Unit 1 Control/Status Register
+ UInt16 spiIntCS; // $706: SPI Unit 1 Interrupt control/Status Register
+ UInt16 spiTest; // $708: SPI Unit 1 Test Register
+ UInt16 spiSpc; // $70A: SPI Unit 1 Sample period counter register
+
+ UInt8 ___filler26[0x800-0x70C];
+
+ UInt16 spiMasterData; // $800: SPI Unit 2 Data Register (SPI 2 is the same as the single SPI Master in EZ)
+ UInt16 spiMasterControl; // $802: SPI Unit 2 Control/Status Register
+
+ UInt8 ___filler27[0x900-0x804];
+
+ UInt16 uControl; // $900: Uart 1 Status/Control Register (Uart 1 is the same as the single Uart in EZ)
+ UInt16 uBaud; // $902: Uart 1 Baud Control Register
+ UInt16 uReceive; // $904: Uart 1 Receive Register
+ UInt16 uTransmit; // $906: Uart 1 Transmit Register
+ UInt16 uMisc; // $908: Uart 1 Miscellaneous Register
+ UInt16 uNonIntPresc; // $90A: Uart 1 Non-Integer Prescaler
+
+ UInt8 ___filler28[0x910-0x90C];
+
+ UInt16 u2Control; // $910: Uart 2 Status/Control Register
+ UInt16 u2Baud; // $912: Uart 2 Baud Control Register
+ UInt16 u2Receive; // $914: Uart 2 Receiver Register
+ UInt16 u2Transmit; // $916: Uart 2 Transmitter Register
+ UInt16 u2Misc; // $918: Uart 2 Miscellaneous Register
+ UInt16 u2NonIntPresc; // $91A: Uart 2 Non-Integer Prescaler
+ UInt16 u2FIFOHMark; // $91C: Uart 2 Half Mark FIFO Register
+
+ UInt8 ___filler28a[0xA00-0x91E];
+
+ UInt32 lcdStartAddr; // $A00: Screen Starting Address Register
+ UInt8 ___filler29;
+ UInt8 lcdPageWidth; // $A05: Virtual Page Width Register
+ UInt8 ___filler30[2];
+ UInt16 lcdScreenWidth; // $A08: Screen Width Register
+ UInt16 lcdScreenHeight; // $A0A: Screen Height Register
+ UInt8 ___filler31[0xA18-0xA0C];
+ UInt16 lcdCursorXPos; // $A18: Cursor X Position
+ UInt16 lcdCursorYPos; // $A1A: Cursor Y Position
+ UInt16 lcdCursorWidthHeight; // $A1C: Cursor Width and Height
+ UInt8 ___filler32;
+ UInt8 lcdBlinkControl; // $A1F: Blink Control Register
+ UInt8 lcdPanelControl; // $A20: Panel Interface Configuration Register
+ UInt8 lcdPolarity; // $A21: Polarity Config Register
+ UInt8 ___filler33;
+ UInt8 lcdACDRate; // $A23: ACD (M) Rate Control Register
+ UInt8 ___filler34;
+ UInt8 lcdPixelClock; // $A25: Pixel Clock Divider Register
+ UInt8 ___filler35;
+ UInt8 lcdClockControl; // $A27: Clocking Control Register
+// UInt8 ___filler36;
+ UInt16 lcdRefreshRateAdj; // $A28: Refresh Rate Adjustment Register
+ UInt8 ___filler37;
+ UInt8 lcdReserved1; // $A2B: Reserved
+ UInt8 ___filler38;
+ UInt8 lcdPanningOffset; // $A2D: Panning Offset Register
+
+ UInt8 ___filler39[0xA31-0xA2E];
+
+ UInt8 lcdFrameRate; // $A31: Frame Rate Control Modulation Register
+ UInt8 ___filler2004;
+ UInt8 lcdGrayPalette; // $A33: Gray Palette Mapping Register
+ UInt8 lcdReserved2; // $A34: Reserved
+ UInt8 ___filler2005;
+ UInt16 lcdContrastControlPWM; // $A36: Contrast Control
+ UInt8 lcdRefreshModeControl; // $A38: Refresh Mode Control Register
+ UInt8 lcdDMAControl; // $A39: DMA Control Register
+
+ UInt8 ___filler40[0xB00-0xA3a];
+
+ UInt32 rtcHourMinSec; // $B00: RTC Hours, Minutes, Seconds Register
+ UInt32 rtcAlarm; // $B04: RTC Alarm Register
+ UInt8 ___filler2001[0xB0A-0xB08];
+ UInt16 rtcWatchDog; // $B0A: RTC Watchdog Timer
+ UInt16 rtcControl; // $B0C: RTC Control Register
+ UInt16 rtcIntStatus; // $B0E: RTC Interrupt Status Register
+ UInt16 rtcIntEnable; // $B10: RTC Interrupt Enable Register
+ UInt16 stopWatch; // $B12: Stopwatch Minutes
+ UInt8 ___filler2002[0xB1A-0xB14];
+ UInt16 rtcDay; // $B1A: RTC Day
+ UInt16 rtcDayAlarm; // $B1C: RTC Day Alarm
+
+ UInt8 ___filler41[0xC00-0xB1E];
+
+ UInt16 dramConfig; // $C00: DRAM Memory Config Register
+ UInt16 dramControl; // $C02: DRAM Control Register
+ UInt16 sdramControl; // $C04: SDRAM Control Register
+ UInt16 sdramPwDn; // $C06: SDRAM Power Down Register
+
+ UInt8 ___filler42[0xD00-0xC08];
+
+ UInt32 emuAddrCompare; // $D00: Emulation Address Compare Register
+ UInt32 emuAddrMask; // $D04: Emulation Address Mask Register
+ UInt16 emuControlCompare; // $D08: Emulation Control Compare Register
+ UInt16 emuControlMask; // $D0A: Emulation Control Mask Register
+ UInt16 emuControl; // $DOC: Emulation Control Register
+ UInt16 emuStatus; // $D0E: Emulation Status Register
+};
+
+typedef volatile struct HwrM68VZ328Type* HwrM68VZ328Ptr;
+
+#define HwrDBallType HwrM68VZ328Type
+#define HwrDBallPtr HwrM68VZ328Ptr
+
+
+#if 0 // Take this out for Poser; it conflicts with the one in M68EZ328Hwr.h
+
+/************************************************************************
+ * Jerry EZ cost reduction PLD I/O register
+ ***********************************************************************/
+typedef volatile struct HwrJerryPLDType {
+
+ UInt8 dspOn; // pld output turn dsp on/off
+ UInt8 unused1;
+ UInt8 chargeOn; // pld output turn charger on/off
+ UInt8 unused2;
+ UInt8 refOn; // pld output turn 3.0 volt reference on/off
+ UInt8 unused3;
+ UInt8 pipaBiasEnable; // pld output turn PA bias on/off
+ UInt8 unused4;
+ UInt8 dspReset; // pld output control dsp reset pin up/down
+ UInt8 unused5;
+ UInt8 ezToDsl; // pld output comm. pin to dsp
+ UInt8 unused6;
+ UInt8 rs232Shdn; // pld output control rs232 interface chip on/off
+ UInt8 unused7;
+ UInt8 spareOut; // pld output not used
+ UInt8 unused8;
+ UInt16 dTo3Sln; // pld input comm. from dsp
+ UInt16 iXtrnl2; // pld input cradle connector pin
+} HwrJerryPLDType;
+
+typedef HwrJerryPLDType* HwrJerryPldPtr;
+
+/************************************************************************
+ * Jerry EZ cost reduction. PLD settings
+ ***********************************************************************/
+#define hwrJerryPld232Enable 0x80
+#define hwrJerryPld232Disable 0
+#define hwrJerryPldChargerOn 0x80
+#define hwrJerryPldChargerOff 0
+#define hwrJerryPldPaBiasEnable 0x80
+#define hwrJerryPldPaBiasDisable 0
+#define hwrJerryPldRefOn 0x80
+#define hwrJerryPldRefOff 0
+#define hwrJerryPldDspSelect 0x80
+#define hwrJerryPldDspDeselect 0
+#define hwrJerryPldDspResetAssert 0x80
+#define hwrJerryPldDspResetDeassert 0
+#define hwrJerryPldDspPowerOn 0x80
+#define hwrJerryPldDspPowerOff 0
+
+/************************************************************************
+ * Jerry EZ cost reduction. PLD shadow settings
+ ***********************************************************************/
+#define hwrJerryPldDspOnBit 0x0001
+#define hwrJerryPldChargeOnBit 0x0002
+#define hwrJerryPldRefOnBit 0x0004
+#define hwrJerryPldPaBiasEnableBit 0x0008
+#define hwrJerryPldDspResetBit 0x0010
+#define hwrJerryPldEzToDslBit 0x0020
+#define hwrJerryPldRs232Bit 0x0040
+#endif
+
+/************************************************************************
+ * Chip ID register for VZ
+ ***********************************************************************/
+ #define hwrVZ328chipIDVZ 0x45
+
+/************************************************************************
+ * Mask ID register for VZ
+ ***********************************************************************/
+#define hwrVZ328maskID0H31J 0x01
+#define hwrVZ328maskID0J75C 0x02
+#define hwrVZ328maskID1J75C 0x03
+#define hwrVZ328maskID0J83G 0x04
+
+/************************************************************************
+ * LCD Controller Bits
+ ************************************************************************/
+// lcdCursorXPos Register
+#define hwrVZ328LcdCursorXPosCtlMask 0xC000
+ #define hwrVZ328LcdCursorXPosCtlTrans 0x0000
+ #define hwrVZ328LcdCursorXPosCtlBlack 0x4000
+ #define hwrVZ328LcdCursorXPosCtlReverse 0x8000
+ #define hwrVZ328LcdCursorXPosCtlWhite 0xC000
+#define hwrVZ328LcdCursorXPosValueMask 0x1FF
+#define hwrVZ328LcdCursorYPosValueMask 0x1FF
+
+#define hwrVZ328LcdCursorWidthMask 0x1F
+ #define hwrVZ328LcdCursorWidthOffset 0x8
+#define hwrVZ328LcdCursorHeightMask 0x1F
+
+// lcdBlinkControl Register
+#define hwrVZ328LcdBlinkControlEnable 0x80
+#define hwrVZ328LcdBlinkDivisorMask 0x7F
+
+// lcdPanelControl Register
+#define hwrVZ328LcdPanelControlBusMask 0x0C
+ #define hwrVZ328LcdPanelControlBus1Bit 0x00
+ #define hwrVZ328LcdPanelControlBus2Bit 0x04
+ #define hwrVZ328LcdPanelControlBus4Bit 0x08
+#define hwrVZ328LcdPanelControlGrayScale 0x01
+#define hwrVZ328LcdPanelControl4BitGrayScale 0x02
+
+// lcdPolarity Register
+#define hwrVZ328LcdPolarityShiftClock 0x08
+#define hwrVZ328LcdPolarityFLM 0x04
+#define hwrVZ328LcdPolarityLP 0x02
+#define hwrVZ328LcdPolarityPixel 0x01
+
+// lcdClockControl Register
+#define hwrVZ328LcdClockControlEnable 0x80
+#define hwrVZ328LcdClockControl8BitBus 0x40
+
+#define hwrVZ328LcdClockControlBurstRateMask 0x0F
+#define hwrVZ328LcdClockControlBurstRate1 0x00
+#define hwrVZ328LcdClockControlBurstRate2 0x01
+#define hwrVZ328LcdClockControlBurstRate3 0x02
+#define hwrVZ328LcdClockControlBurstRate4 0x03
+#define hwrVZ328LcdClockControlBurstRate5 0x04
+#define hwrVZ328LcdClockControlBurstRate6 0x05
+#define hwrVZ328LcdClockControlBurstRate7 0x06
+#define hwrVZ328LcdClockControlBurstRate8 0x07
+#define hwrVZ328LcdClockControlBurstRate9 0x08
+#define hwrVZ328LcdClockControlBurstRate10 0x09
+#define hwrVZ328LcdClockControlBurstRate11 0x0A
+#define hwrVZ328LcdClockControlBurstRate12 0x0B
+#define hwrVZ328LcdClockControlBurstRate13 0x0C
+#define hwrVZ328LcdClockControlBurstRate14 0x0D
+#define hwrVZ328LcdClockControlBurstRate15 0x0E
+#define hwrVZ328LcdClockControlBurstRate16 0x0F
+
+#define hwrVZ328LcdContrastPWMWidthMask 0x00FF
+#define hwrVZ328LcdContrastEnable 0x0100
+
+
+
+/************************************************************************
+ * Interrupt Controller Bits
+ ************************************************************************/
+// intMaskHi bits
+// NOTE: Due to a bug in early rev's of the DragonBall, the clear bits for
+// IRQ[1236] on those early chips were different than the indicator bits
+// (the order was reversed). So some older code uses the OR of the IRQ1 and
+// IRQ6 bits for either, and the OR of the IRQ2 and IRQ3 bits for either.
+#define hwrVZ328IntHiEMU 0x0080
+#define hwrVZ328IntHiSampleTimer 0x0040
+#define hwrVZ328IntHiPen 0x0010
+#define hwrVZ328IntHiIRQ6 0x0008
+#define hwrVZ328IntHiIRQ3 0x0004
+#define hwrVZ328IntHiIRQ2 0x0002
+#define hwrVZ328IntHiIRQ1 0x0001
+
+// intMaskLo bits
+#define hwrVZ328IntLoPWM2 0x2000
+#define hwrVZ328IntLoPWM2Bit 13
+#define hwrVZ328IntLoUART2 0x1000
+#define hwrVZ328IntLoUART2Bit 12
+#define hwrVZ328IntLoInt3 0x0800
+#define hwrVZ328IntLoInt2 0x0400
+#define hwrVZ328IntLoInt1 0x0200
+#define hwrVZ328IntLoInt0 0x0100
+#define hwrVZ328IntLoAllKeys 0x0F00
+#define hwrVZ328IntLoInt0Bit 8
+#define hwrVZ328IntLoPWM 0x0080
+#define hwrVZ328IntLoPWMBit 7
+#define hwrVZ328IntLoKbd 0x0040
+#define hwrVZ328IntLoTimer2 0x0020
+#define hwrVZ328IntLoTimer2Bit 5
+#define hwrVZ328IntLoRTC 0x0010
+#define hwrVZ328IntLoRTCBit 4
+#define hwrVZ328IntLoWDT 0x0008
+#define hwrVZ328IntLoUART 0x0004
+#define hwrVZ328IntLoUARTBit 2
+#define hwrVZ328IntLoTimer 0x0002
+#define hwrVZ328IntLoTimerBit 1
+#define hwrVZ328IntLoSPIM 0x0001
+
+// intControl bits
+// NOTE: These are different than that documented in the User's manual
+// for the DragonBall (see erratas). The DragonBall is the same as the EZ.
+#define hwrVZ328IntCtlEdge1 0x0800
+#define hwrVZ328IntCtlEdge2 0x0400
+#define hwrVZ328IntCtlEdge3 0x0200
+#define hwrVZ328IntCtlEdge6 0x0100
+#define hwrVZ328IntCtlPol1 0x8000
+#define hwrVZ328IntCtlPol2 0x4000
+#define hwrVZ328IntCtlPol3 0x2000
+#define hwrVZ328IntCtlPol6 0x1000
+#define hwrVZ328IntCtlPol5 0x0080
+
+/************************************************************************
+ * DRAM Controller Bits bits
+ * Not all the bits are defined here-- some are pretty bad to muck with
+ * in anything but initial setup of the DRAM.
+ ************************************************************************/
+#define hwrVZ328dramControlEnable 0x8000
+#define hwrVZ328dramControlSelfRefreshEn 0x4000
+#define hwrVZ328dramControlEDOEn 0x0400
+#define hwrVZ328dramControlLightSleep 0x0010
+#define hwrVZ328dramControlLowPowerRefreshEn 0x0004
+#define hwrVZ328dramControlDWEEnable 0x0001
+
+
+/************************************************************************
+ * SDRAM Controller Bits bits
+ * Not all the bits are defined here-- some are pretty bad to muck with
+ * in anything but initial setup of the SDRAM.
+ ************************************************************************/
+// SdramControl bits
+#define hwrVZ328SdramControlEnable 0x8000
+#define hwrVZ328SdramControlContPgModeEn 0x4000
+ // rsvd
+#define hwrVZ328SdramControlRefreshEn 0x1000
+#define hwrVZ328SdramControlInitPreChg 0x0800
+#define hwrVZ328SdramControlInitModeReg 0x0400
+ // rsvd
+ // rsvd
+ // rsvd
+#define hwrVZ328SdramControlSColOpt 0x0040
+ // BnkAddH[1:0]
+ // BnkAddL[1:0]
+#define hwrVZ328SdramControlCASLatency 0x0002
+#define hwrVZ328SdramControlRefrActCmdLatency 0x0001
+
+// SdramPwDn bits
+#define hwrVZ328SdramPwDnAPEn 0x8000
+#define hwrVZ328SdramPwDnPDEn 0x4000
+ // rsvd
+ // rsvd
+ // PDTOUT[3:0]
+ // rsvd
+ // rsvd
+ // rsvd
+ // rsvd
+ // rsvd
+ // rsvd
+ // rsvd
+ // rsvd
+
+
+/************************************************************************
+ * Timer bits
+ ************************************************************************/
+#define hwrVZ328TmrControlUnused 0xFC00
+#define hwrVZ328TmrControlTIOOutput 0x0200
+#define hwrVZ328TmrControlFreeRun 0x0100
+#define hwrVZ328TmrControlCaptureEdgeMask 0x00C0
+ #define hwrVZ328TmrControlCaptureEdgeNone 0x0000
+ #define hwrVZ328TmrControlCaptureEdgeRising 0x0040
+ #define hwrVZ328TmrControlCaptureEdgeFalling 0x0080
+ #define hwrVZ328TmrControlCaptureEdgeBoth 0x00C0
+#define hwrVZ328TmrControlOutputModeToggle 0x0020
+#define hwrVZ328TmrControlEnInterrupt 0x0010
+#define hwrVZ328TmrControlClkSrcMask 0x000E
+ #define hwrVZ328TmrControlClkSrcStop 0x0000
+ #define hwrVZ328TmrControlClkSrcSys 0x0002
+ #define hwrVZ328TmrControlClkSrcSysBy16 0x0004
+ #define hwrVZ328TmrControlClkSrcTIN 0x0006
+ #define hwrVZ328TmrControlClkSrc32KHz 0x0008
+#define hwrVZ328TmrControlEnable 0x0001
+
+#define hwrVZ328TmrStatusCapture 0x0002
+#define hwrVZ328TmrStatusCaptureBit 1
+#define hwrVZ328TmrStatusCompare 0x0001
+#define hwrVZ328TmrStatusCompareBit 0
+
+
+/************************************************************************
+ * 68VZ328 Serial Port Register Bits
+ ************************************************************************/
+// uControl Register
+#define hwrVZ328UControlUARTEnable 0x8000
+#define hwrVZ328UControlRxEnable 0x4000
+#define hwrVZ328UControlTxEnable 0x2000
+#define hwrVZ328UControlRxClock1xSync 0x1000
+#define hwrVZ328UControlParityEn 0x0800
+#define hwrVZ328UControlParityOdd 0x0400
+#define hwrVZ328UControlStopBits2 0x0200
+#define hwrVZ328UControlDataBits8 0x0100
+#define hwrVZ328UControlOldDataEn 0x0080
+#define hwrVZ328UControlCTSDeltaEn 0x0040
+#define hwrVZ328UControlRxFullEn 0x0020
+#define hwrVZ328UControlRxHalfEn 0x0010
+#define hwrVZ328UControlRxRdyEn 0x0008
+#define hwrVZ328UControlTxEmptyEn 0x0004
+#define hwrVZ328UControlTxHalfEn 0x0002
+#define hwrVZ328UControlTxAvailEn 0x0001
+
+#define hwrVZ328UControlEnableAll (hwrVZ328UControlUARTEnable | \
+ hwrVZ328UControlRxEnable | \
+ hwrVZ328UControlTxEnable)
+
+// uBaud Register
+// UCLK output requires PE3 Select to be 0
+#define hwrVZ328UBaudUCLKDirOut 0x2000
+#define hwrVZ328UBaudBaudSrcUCLK 0x0800
+#define hwrVZ328UBaudDivider 0x0700
+#define hwrVZ328UBaudPrescaler 0x003F
+
+#define hwrVZ328UBaudDivideBitOffset 8
+
+
+// uReceive Register
+#define hwrVZ328UReceiveFIFOFull 0x8000
+#define hwrVZ328UReceiveFIFOHalf 0x4000
+#define hwrVZ328UReceiveDataRdy 0x2000
+#define hwrVZ328UReceiveDataRdyBit 13
+#define hwrVZ328UReceiveOldData 0x1000
+#define hwrVZ328UReceiveOverrunErr 0x0800
+#define hwrVZ328UReceiveOverrunErrBit 11
+#define hwrVZ328UReceiveFrameErr 0x0400
+#define hwrVZ328UReceiveFrameErrBit 10
+#define hwrVZ328UReceiveBreakErr 0x0200
+#define hwrVZ328UReceiveBreakErrBit 9
+#define hwrVZ328UReceiveParityErr 0x0100
+#define hwrVZ328UReceiveParityErrBit 8
+#define hwrVZ328UReceiveData 0x00FF
+
+#define hwrVZ328UReceiveErrsMask (hwrVZ328UReceiveOverrunErr | \
+ hwrVZ328UReceiveFrameErr | \
+ hwrVZ328UReceiveBreakErr | \
+ hwrVZ328UReceiveParityErr)
+
+// uTransmit Register
+#define hwrVZ328UTransmitFIFOEmpty 0x8000
+#define hwrVZ328UTransmitFIFOHalf 0x4000
+#define hwrVZ328UTransmitTxAvail 0x2000
+#define hwrVZ328UTransmitSendBreak 0x1000
+#define hwrVZ328UTransmitIgnoreCTS 0x0800
+#define hwrVZ328UTransmitBusy 0x0400
+#define hwrVZ328UTransmitCTSStatus 0x0200
+#define hwrVZ328UTransmitCTSDelta 0x0100
+#define hwrVZ328UTransmitData 0x00FF
+
+// uMisc Register
+#define hwrVZ328UMiscBaudTest 0x8000
+#define hwrVZ328UMiscClkSrcUCLK 0x4000
+#define hwrVZ328UMiscForceParityErr 0x2000
+#define hwrVZ328UMiscLoopback 0x1000
+#define hwrVZ328UMiscBaudReset 0x0800
+#define hwrVZ328UMiscIRTestEn 0x0400
+#define hwrVZ328UMiscReservedMask 0x0300
+#define hwrVZ328UMiscRTSThruFIFO 0x0080
+#define hwrVZ328UMiscRTSOut 0x0040
+#define hwrVZ328UMiscIRDAEn 0x0020
+#define hwrVZ328UMiscLoopIRDA 0x0010
+#define hwrVZ328UMiscRXPolarityInv 0x0008
+#define hwrVZ328UMiscTXPolarityInv 0x0004
+#define hwrVZ328UMiscUnused 0x0003
+
+// uNonIntPresc Register
+#define hwrVZ328UNonIntPrescSrcIntPresc 0x0000
+#define hwrVZ328UNonIntPrescSrcNonIntPresc 0x8000
+
+#define hwrVZ328UNonIntPrescSelDiv128 0x0000
+#define hwrVZ328UNonIntPrescSelDiv64 0x0100
+#define hwrVZ328UNonIntPrescSelDiv32 0x0200
+#define hwrVZ328UNonIntPrescSelDiv16 0x0300
+#define hwrVZ328UNonIntPrescSelDiv8 0x0400
+#define hwrVZ328UNonIntPrescSelDiv4 0x0500
+#define hwrVZ328UNonIntPrescSelDiv2 0x0600
+#define hwrVZ328UNonIntPrescSelDiv1 0x0700
+
+#define hwrVZ328UNonIntPrescStepMask 0x00FF
+#define hwrVZ328UNonIntPrescSelOffset 8
+
+// see VZ docs for explanation of the following. This provides the correct
+// pulse width for IRDA, and is just a statement in the docs. The values don't
+// appear to make sense, but I just push the buttons.
+
+// This has been deprecated in favor of a prv function in the serial driver and
+// the SerialMgr (depending on whether you have Bond or not) that calculates
+// the value of this register based on the clock frequency you're running on.
+// There was a bug when running EZ at 20MHz that caused the IrDA pulsewidth to
+// get too short.
+
+#if 0
+#define hwrVZ328UNonIntPrescIRDAMode (hwrVZ328UNonIntPrescSrcIntPresc \
+ | hwrVZ328UNonIntPrescSelDiv32 \
+ | (hwrVZ328UNonIntPrescStepMask & 0x20))
+#endif
+
+/************************************************************************
+ * PWM Bits
+ ************************************************************************/
+// PWM register bits of interest
+#define hwrVZ328PWMControlEnable 0x0010
+#define hwrVZ328PWMControlEnableBit 4
+#define hwrVZ328PWMControlEnableIRQ 0x0040
+#define hwrVZ328PWMIRQStatus 0x0080
+// PWM divider chain output selectors
+#define hwrVZ328PWMControlDivMask 0x0003
+#define hwrVZ328PWMControlDivBy2 0x0
+#define hwrVZ328PWMControlDivBy4 0x1
+#define hwrVZ328PWMControlDivBy8 0x2
+#define hwrVZ328PWMControlDivBy16 0x3
+// PWM Repeat Counts
+#define hwrVZ328PWMRepeatSample1x 0x0
+#define hwrVZ328PWMRepeatSample2x 0x4
+#define hwrVZ328PWMRepeatSample4x 0x8
+#define hwrVZ328PWMRepeatSample8x 0xC
+// PWM hardware constraints
+#define hwrVZ328PWMFifoSizeInBytes 4
+#define hwrVZ328PWMPrescalerMask 0x7F00
+#define hwrVZ328PWMPrescalerOffset 8
+
+/************************************************************************
+ * PLL Bits
+ ************************************************************************/
+#define hwrVZ328PLLControlDisable 0x0008
+#define hwrVZ328PLLControlClkDisable 0x0010
+
+#define hwrVZ328PLLControlSysDMADiv2 0x0000
+#define hwrVZ328PLLControlSysDMADiv4 0x0100
+#define hwrVZ328PLLControlSysDMADiv8 0x0200
+#define hwrVZ328PLLControlSysDMADiv16 0x0300
+#define hwrVZ328PLLControlSysDMADiv1 0x0400
+
+#define hwrVZ328PLLControlPixDMADiv2 0x0000
+#define hwrVZ328PLLControlPixDMADiv4 0x0800
+#define hwrVZ328PLLControlPixDMADiv8 0x1000
+#define hwrVZ328PLLControlPixDMADiv16 0x1800
+#define hwrVZ328PLLControlPixDMADiv1 0x2000
+
+#define hwrVZ328PLLControlPreSc1Div2 0x0080
+#define hwrVZ328PLLControlPreSc1Div1 0x0000
+
+#define hwrVZ328PLLControlPreSc2Div2 0x0020
+#define hwrVZ328PLLControlPreSc2Div1 0x0000
+
+#define hwrCZ328PLLControl32Periods 0x0000
+#define hwrCZ328PLLControl48Periods 0x0001
+#define hwrCZ328PLLControl64Periods 0x0002
+#define hwrCZ328PLLControl96Periods 0x0003
+
+#define hwrVZ328PLLFreqSelCLK32 0x8000
+
+/************************************************************************
+ * Real Time Clock (RTC) Bits
+ ************************************************************************/
+
+// RTC Control Register (RTCCTL) bits
+#define hwrVZ328RTCControlRTCEnable 0x80
+#define hwrVZ328RTCControlRefSelMask 0x20
+#define hwrVZ328RTCControlRefSel38400 0x20 // 38.4 kHz reference frequency
+#define hwrVZ328RTCControlRefSel32768 0x00 // 32.768 kHz reference frequency
+
+// RTC Interrupt Enable Register (RTCIENR) bits
+#define hwrVZ328RTCIntEnableSample7 0x8000
+#define hwrVZ328RTCIntEnableSample6 0x4000
+#define hwrVZ328RTCIntEnableSample5 0x2000
+#define hwrVZ328RTCIntEnableSample4 0x1000
+#define hwrVZ328RTCIntEnableSample3 0x0800
+#define hwrVZ328RTCIntEnableSample2 0x0400
+#define hwrVZ328RTCIntEnableSample1 0x0200
+#define hwrVZ328RTCIntEnableSample0 0x0100
+#define hwrVZ328RTCIntEnableHour 0x0020
+#define hwrVZ328RTCIntEnableSec 0x0010
+#define hwrVZ328RTCIntEnable24Hr 0x0008
+#define hwrVZ328RTCIntEnableAlarm 0x0004
+#define hwrVZ328RTCIntEnableMinute 0x0002
+#define hwrVZ328RTCIntEnableStopWatch 0x0001
+
+// RTC Interrupt Status Register bits
+#define hwrVZ328RTCIntStatusSample7 0x8000
+#define hwrVZ328RTCIntStatusSample6 0x4000
+#define hwrVZ328RTCIntStatusSample5 0x2000
+#define hwrVZ328RTCIntStatusSample4 0x1000
+#define hwrVZ328RTCIntStatusSample3 0x0800
+#define hwrVZ328RTCIntStatusSample2 0x0400
+#define hwrVZ328RTCIntStatusSample1 0x0200
+#define hwrVZ328RTCIntStatusSample0 0x0100
+#define hwrVZ328RTCIntStatusHour 0x0020
+#define hwrVZ328RTCIntStatusSec 0x0010
+#define hwrVZ328RTCIntStatus24Hr 0x0008
+#define hwrVZ328RTCIntStatusAlarm 0x0004
+#define hwrVZ328RTCIntStatusMinute 0x0002
+#define hwrVZ328RTCIntStatusStopWatch 0x0001
+
+// RTC Alarm register (RTCALRM) masks and offsets
+#define hwrVZ328RTCAlarmSecondsMask 0x0000003fL
+#define hwrVZ328RTCAlarmSecondsOffset 0
+#define hwrVZ328RTCAlarmMinutesMask 0x003f0000L
+#define hwrVZ328RTCAlarmMinutesOffset 16
+#define hwrVZ328RTCAlarmHoursMask 0x1f000000L
+#define hwrVZ328RTCAlarmHoursOffset 24
+
+// RTC hours/minutes/seconds register (RTCHMS) masks and offsets
+#define hwrVZ328RTCHourMinSecSecondsMask 0x0000003fL
+#define hwrVZ328RTCHourMinSecSecondsOffset 0
+#define hwrVZ328RTCHourMinSecMinutesMask 0x003f0000L
+#define hwrVZ328RTCHourMinSecMinutesOffset 16
+#define hwrVZ328RTCHourMinSecHoursMask 0x1f000000L
+#define hwrVZ328RTCHourMinSecHoursOffset 24
+
+// RTC Day register masks/offsets
+#define hwrVZ328RTCDayDayMask 0x01FF
+#define hwrVZ328RTCDayDayOffset 0
+
+// RTC Watchdog Timer masks/offsets
+#define hwrVZ328RTCWatchdogEnable 0x0001
+#define hwrVZ328RTCWatchdogIntSel 0x0002
+#define hwrVZ328RTCWatchdogIntStatus 0x0080
+#define hwrVZ328RTCWatchdogCountMask 0x0300
+#define hwrVZ328RTCWatchdogCountOffset 8
+
+/************************************************************************
+ * SPI Master bits
+ ************************************************************************/
+#define hwrVZ328SPIMControlRateMask 0xE000
+ #define hwrVZ328SPIMControlRateDiv4 0x0000
+ #define hwrVZ328SPIMControlRateDiv8 0x2000
+ #define hwrVZ328SPIMControlRateDiv16 0x4000
+ #define hwrVZ328SPIMControlRateDiv32 0x6000
+ #define hwrVZ328SPIMControlRateDiv64 0x8000
+ #define hwrVZ328SPIMControlRateDiv128 0xA000
+ #define hwrVZ328SPIMControlRateDiv256 0xC000
+ #define hwrVZ328SPIMControlRateDiv512 0xE000
+#define hwrVZ328SPIMControlEnable 0x0200
+#define hwrVZ328SPIMControlExchange 0x0100
+#define hwrVZ328SPIMControlIntStatus 0x0080
+#define hwrVZ328SPIMControlIntEnable 0x0040
+#define hwrVZ328SPIMControlOppPhase 0x0020
+#define hwrVZ328SPIMControlInvPolarity 0x0010
+#define hwrVZ328SPIMControlBitsMask 0x000F
+
+
+#endif // __M68VZ328_H__
+
+#endif // NON_PORTABLE
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SrcShared/Palm/Platform/Core/System/IncsPrv/DataPrv.h b/SrcShared/Palm/Platform/Core/System/IncsPrv/DataPrv.h
new file mode 100644
index 0000000..87884f8
--- /dev/null
+++ b/SrcShared/Palm/Platform/Core/System/IncsPrv/DataPrv.h
@@ -0,0 +1,308 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: DataPrv.h
+ *
+ * Description:
+ * Private Header for the Data Manager
+ *
+ * History:
+ * 08/10/95 RM Created by Ron Marianetti
+ * 10/26/99 kwk Backed out overlay cache modifications, and added
+ * constants for RAM vs. ROM store ids.
+ *
+ *****************************************************************************/
+
+#ifdef NON_PORTABLE
+#ifndef __DATAPRV_H__
+#define __DATAPRV_H__
+
+// DOLATER kwk - find out if the decision was made to use nested includes,
+// or do I need to go through and hit all of the source files that include
+// DataPrv.h to also include OverlayMgr.h (or add OverlayMgr.h to SysAll.h)
+
+#include <OverlayMgr.h>
+
+/************************************************************
+ * Ways that a database can be open.
+ *************************************************************/
+#define openTypeRegular 0 // Nothing special.
+#define openTypeBase (openTypeRegular+1) // Rsc db opened as base.
+#define openTypeOverlay (openTypeRegular+2) // Rsc db opened as overlay.
+
+
+/************************************************************
+ * Structure of a Record entry
+ *************************************************************/
+typedef struct {
+ LocalID localChunkID; // local chunkID of a record
+ UInt8 attributes; // record attributes;
+ UInt8 uniqueID[3]; // unique ID of record; should
+ // not be 0 for a legal record.
+ } RecordEntryType;
+typedef RecordEntryType* RecordEntryPtr;
+
+
+
+/************************************************************
+ * Structure of a Resource entry
+ *************************************************************/
+typedef struct {
+ UInt32 type; // resource type
+ UInt16 id; // resource id
+ LocalID localChunkID; // resource data chunk ID
+ } RsrcEntryType;
+typedef RsrcEntryType* RsrcEntryPtr;
+
+// Attributes field
+#define dmRsrcAttrUnused 0x0000 // to be defined...
+
+
+
+/************************************************************
+ * Structure of a record list extension. This is used if all
+ * the database record/resource entries of a database can't fit into
+ * the database header.
+ *************************************************************/
+typedef struct {
+ LocalID nextRecordListID; // local chunkID of next list
+ UInt16 numRecords; // number of records in this list
+ UInt16 firstEntry; // array of Record/Rsrc entries
+ // starts here
+ } RecordListType;
+typedef RecordListType* RecordListPtr;
+
+
+
+
+/************************************************************
+ * Structure of a Database Header
+ *************************************************************/
+typedef struct {
+ UInt8 name[dmDBNameLength]; // name of database
+ UInt16 attributes; // database attributes
+ UInt16 version; // version of database
+
+ UInt32 creationDate; // creation date of database
+ UInt32 modificationDate; // latest modification date
+ UInt32 lastBackupDate; // latest backup date
+ UInt32 modificationNumber; // modification number of database
+
+ LocalID appInfoID; // application specific info
+ LocalID sortInfoID; // app specific sorting info
+
+ UInt32 type; // database type
+ UInt32 creator; // database creator
+
+ UInt32 uniqueIDSeed; // used to generate unique IDs.
+ // Note that only the low order
+ // 3 bytes of this is used (in
+ // RecordEntryType.uniqueID).
+ // We are keeping 4 bytes for
+ // alignment purposes.
+
+ RecordListType recordList; // first record list
+ } DatabaseHdrType;
+
+typedef DatabaseHdrType* DatabaseHdrPtr;
+
+
+
+
+
+/************************************************************
+ * Directory of all available databases - maintained by the
+ * Database Manager. This directory also includes resource
+ * databases. There is one of these directories for each store
+ * (either RAM or ROM store) in a memory card. The ROM store
+ * list gets copied into the RAM store list at DmInit time.
+ *************************************************************/
+
+typedef struct {
+ LocalID baseID;
+ } DatabaseDirEntryType;
+
+typedef struct {
+ LocalID nextDatabaseListID; // continuation list, if any
+ UInt16 numDatabases; // # of database ID's in this list
+ DatabaseDirEntryType databaseID[1]; // one entry per database
+ } DatabaseDirType;
+
+typedef DatabaseDirType* DatabaseDirPtr;
+
+
+
+
+/************************************************************
+ * This structure is used to hold information on an open database
+ * It gets allocated as a non-movable chunk in the dynamic heap
+ * when a database is opened and caches database information that
+ * helps speed up performance.
+ *************************************************************/
+typedef struct {
+ void * next; // MemPtr to next access structure
+ UInt16 openCount; // incremented every time it's opened
+ UInt32 ownerTaskID; // taskID of owner
+ UInt16 exclusive : 1; // true if opened with exclusive access
+ UInt16 writeAccess : 1; // true if opened with write access
+ UInt16 resDB : 1; // true if resource database
+ LocalID hdrID; // local ID of database header
+ MemHandle hdrH; // Database header handle
+ DatabaseHdrPtr hdrP; // Database header MemPtr for faster access
+ UInt16 cardNo; // card number of database
+ UInt16 numRecords; // cached here for better performance
+ MemPtr hdrMasterP; // master MemPtr to header if ROM based
+ MemPtr* handleTableP; // pointer to block of ROM handles
+ } DmOpenInfoType;
+
+typedef DmOpenInfoType* DmOpenInfoPtr;
+
+
+/************************************************************
+ * This structure is used to hold client specific information for
+ * an open database. There is one of these allocated every time
+ * a database is opened, even if it's already open. This structure
+ * holds the open mode of the client and a pointer to the DmOpenInfoType
+ * of the database which contains the common database info for all
+ * clients. The SysAppInfoPtr, referenced off of the current A5,
+ * has a pointer to the first DmAccessType in the linked list.
+ *************************************************************/
+typedef struct DmAccessType {
+ struct DmAccessType* next; // MemPtr to next access structure
+ UInt16 mode; // mode it was opened in
+ DmOpenInfoPtr openP; // MemPtr to DmOpenInfoType for database
+
+ // NEW FOR PalmOS v3.0
+ UInt32 savedModNum; // saved modification number of database
+ // at the time of opening
+
+ // NEW FOR PalmOS 3.5
+ UInt8 openType; // Regular, base, or overlay
+ UInt8 reserved;
+ } DmAccessType;
+
+typedef DmAccessType* DmAccessPtr;
+
+
+
+/************************************************************
+ * This structure is used to hold the results of a search
+ * in DmGetNextDatabaseByTypeCreator. It is the "real" structure
+ * of the generic type DmSearchStateType used by applications.
+ *************************************************************/
+#if EMULATION_LEVEL == EMULATION_NONE
+#define MAX_CARDS 1
+#else
+#define MAX_CARDS 2
+#endif
+#define MAX_STORES_PER_CARD 2
+#define MAX_STORES (MAX_CARDS * MAX_STORES_PER_CARD)
+
+typedef struct {
+ UInt16 indexes[MAX_STORES];
+ UInt16 cardNos[MAX_STORES]; // cardNo for each store
+ UInt32 latestVersionCandidateType; // saved type of latest version candidate
+ UInt32 latestVersionCandidateCreator; // saved creator of latest version candidate
+ Int16 latestVersionCandidateStore; // saved store for latest versions
+ } DmPrvSearchStateType;
+typedef DmPrvSearchStateType* DmPrvSearchStatePtr;
+
+
+/************************************************************
+ * This structure is used to keep track of protected databases. These
+ * are databases which have been protected through the DmDatabaseProtect()
+ * call. A handle to an array of these structures is stored in the
+ * low memory global GDmProtectListH. The number of entries in the array
+ * must be calculated by taking the size of the handle and dividing
+ * by sizeof (DmProtectEntryType)
+ *************************************************************/
+typedef struct {
+ UInt8 protectCount;
+ UInt8 cardNo;
+ LocalID dbID;
+ } DmProtectEntryType, *DmProtectEntryPtr;
+
+
+/************************************************************
+ * This structure is used to cache data about applications and
+ * launchable data databases in the system Launch Database.
+ * This is the record structure for the database.
+ *************************************************************/
+#define dmMaxVersionStrLength 16
+
+typedef struct {
+ // Cached database info:
+ UInt32 type; // type of database
+ UInt32 creator; // creator of database
+ LocalID dbID; // LocalID of database
+ UInt16 cardNo; // card number of database
+ UInt16 dbAttrs; // database attributes
+ UInt16 version; // version of database
+ UInt8 dbName[dmDBNameLength]; // database name
+
+ // Launcher info:
+ UInt16 lgIconOffset; // offset in bytes from beginning of record to bitmap for large icon
+ UInt16 smIconOffset; // offset in bytes from beginning of record to bitmap for small icon
+ UInt8 iconName[dmDBNameLength]; // application icon name (from tain resource)
+ Char versionStr[dmMaxVersionStrLength]; // version string to display in Launcher
+ UInt8 flags; // launch flags, defined below
+ UInt8 reserved;
+
+ // Small & Large bitmaps for the database are stored
+ // at the end of the record, and are 4-byte aligned.
+
+ } DmLaunchDBRecordType, *DmLaunchDBRecordPtr;
+
+// Constants for the 'flags' field in DmLaunchDBRecordType
+#define dmLaunchFlagDirty 0x01 // Used to tell the launcher to update
+ // the category & launcher info,
+#define dmLaunchFlagOrphaned 0x02 // Used during boot in PrvSyncLaunchDatabase()
+ // to remove superfluous entries.
+#define dmLaunchFlagLaunchable 0x04 // Used during boot in PrvSyncLaunchDatabase()
+ // to remove superfluous entries.
+#define dmLaunchFlagResetCategory 0x08 // Used to force the launcher to move the
+ // entity into its default category.
+
+
+// Type & creator for the launch database:
+#define dmLaunchDatabaseType 'lnch'
+#define dmLaunchDatabaseCreator sysFileCSystem
+#define dmLaunchDatabaseVersion 1
+#define dmLaunchDatabaseName "psysLaunchDB"
+
+// For private database searching routine
+typedef Int16 (*DmSearchFuncPtr) (void const * searchData, void const * dbData, Int32 other);
+
+/************************************************************
+ * The owner ID of chunks allocated by the Database Manager
+ *************************************************************/
+#define dmDynOwnerID 0x00 // Dynamic heap chunks
+#define dmMgrOwnerID 0x01 // Management chunks
+#define dmRecOwnerID 0x02 // Record chunks
+#define dmOrphanOwnerID 0x03 // Orphaned record chunks
+
+
+/************************************************************
+ * Private Data Manager procedures
+ *************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+Err DmMoveOpenDBContext(DmAccessPtr* listHeadP, DmAccessPtr dbP)
+ SYS_TRAP(sysTrapDmMoveOpenDBContext);
+
+DmOpenRef DmOpenDBWithLocale(UInt16 cardNo, LocalID dbID, UInt16 mode, const OmLocaleType* localeP)
+ SYS_TRAP(sysTrapDmOpenDBWithLocale);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif // __DATAPRV_H__
+#endif //NON_PORTABLE
diff --git a/SrcShared/Palm/Platform/Core/System/IncsPrv/DebugPrv.h b/SrcShared/Palm/Platform/Core/System/IncsPrv/DebugPrv.h
new file mode 100644
index 0000000..727ae6a
--- /dev/null
+++ b/SrcShared/Palm/Platform/Core/System/IncsPrv/DebugPrv.h
@@ -0,0 +1,439 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: DebugPrv.h
+ *
+ * Description:
+ * Privat«Debugging functions
+ *
+ * History:
+ * 8/10/95 RM - Created by Ron Marianetti
+ *
+ *****************************************************************************/
+
+#ifdef NON_PORTABLE
+#ifndef __DEBUGPRV_H__
+#define __DEBUGPRV_H__
+
+
+/***********************************************************************
+ * Debugger Constants
+ ***********************************************************************/
+#define dbgLoopsPerTick 0x0800
+#define dbgStackSize 0x0380 // DOLATER -- resize???
+
+#define dbgNormalBreakpoints 5
+#define dbgTempBPIndex dbgNormalBreakpoints
+#define dbgTotalBreakpoints (dbgTempBPIndex+1)
+
+#define dbgFlashCodeSpace sysInitStack // where we copy flash code
+#define dbgFlashCodeSize 0x200 // size of flash code
+
+#define dbgTotalTrapBreaks 5 // up to this many trap breaks at a time
+
+
+
+
+/***********************************************************************
+ * Structure of Debugger Breakpoints
+ ***********************************************************************/
+typedef struct BreakpointType {
+ MemPtr addr; // address of breakpoint
+ Boolean enabled; // true if enabled
+ Boolean installed; // for alignment
+ } BreakpointType;
+
+
+
+
+
+/***********************************************************************
+ * Structure of Debugger Specific System Packet Type Bodies.
+ ***********************************************************************/
+
+#define sysPktMaxNameLen 32 // Max length of a routine name
+
+//--------------------------------------------------------------
+// sysPktStateCmd
+// - get processor state
+//------------------------------------------------------------------
+// number of remote code words to send in the 'state response' packet
+#define sysPktStateRspInstWords 15
+
+
+typedef struct SysPktStateCmdType {
+ _sysPktBodyCommon; // Common Body header
+ } SysPktStateCmdCmdType;
+typedef SysPktStateCmdCmdType* SysPktStateCmdCmdPtr;
+
+
+// Packet Body structure for the state command response packet
+typedef struct SysPktStateRspType {
+ _sysPktBodyCommon; // Common Body header
+ Boolean resetted; // true if target has just reset
+ UInt8 reserved1;
+ UInt16 exceptionId; // exception which caused the
+ // debugger to be entered.
+ M68KRegsType reg; // current remote registers.
+ UInt16 inst[sysPktStateRspInstWords];
+ // instruction buffer for
+ // code beginning at PC.
+ BreakpointType bp[dbgTotalBreakpoints]; // current breakpoints
+
+ void *startAddr; // start address of routine
+ void *endAddr; // end address of routine
+ char name[sysPktMaxNameLen];
+ // routine name (0 or more chars,
+ // no null), immediately
+ // follows the address range.
+ UInt8 trapTableRev; // rev of trap table. Used to determine
+ // when host's trap table cache is invalid
+ UInt8 reserved2;
+ } SysPktStateRspType;
+typedef SysPktStateRspType* SysPktStateRspPtr;
+
+//--------------------------------------------------------------------
+// sysPktGetRtnNameCmd
+// - get routine name
+//--------------------------------------------------------------------
+// The response packet body will contain start address(4 bytes),
+// end address(4 bytes), followed by 0 or more bytes of the routine
+// name (no null byte).
+typedef struct SysPktRtnNameCmdType {
+ _sysPktBodyCommon; // Common Body header
+ void *address; // -> address to query on
+ } SysPktRtnNameCmdType;
+typedef SysPktRtnNameCmdType* SysPktRtnNameCmdPtr;
+
+typedef struct SysPktRtnNameRspType {
+ _sysPktBodyCommon; // Common Body header
+ void *address; // -> address to query on
+ void *startAddr; // <- start address of routine
+ void *endAddr; // <- end address of routine
+ char name[sysPktMaxNameLen]; // <- routine name, if any immediately
+ // follows the address range.
+ // The balance need not be sent.
+ } SysPktRtnNameRspType;
+typedef SysPktRtnNameRspType* SysPktRtnNameRspPtr;
+
+
+//--------------------------------------------------------------------
+// sysPktReadRegsCmd
+// - read registers
+//--------------------------------------------------------------------
+// Packet Body structure for the read regs command response packet
+typedef struct SysPktReadRegsCmdType {
+ _sysPktBodyCommon; // Common Body header
+ } SysPktReadRegsCmdType;
+typedef SysPktReadRegsCmdType * SysPktReadRegsCmdPtr;
+
+typedef struct SysPktReadRegsRspType {
+ _sysPktBodyCommon; // Common Body header
+ //M68KRegsType reg; // <- return registers
+ } SysPktReadRegsRspType;
+typedef SysPktReadRegsRspType * SysPktReadRegsRspPtr;
+
+
+
+//--------------------------------------------------------------------
+// sysPktWriteRegsCmd
+// - write registers
+//--------------------------------------------------------------------
+// Packet Body structure for the write regs command packet
+typedef struct SysPktWriteRegsCmdType {
+ _sysPktBodyCommon; // Common Body header
+ M68KRegsType reg; // -> registers to write
+ } SysPktWriteRegsCmdType;
+typedef SysPktWriteRegsCmdType * SysPktWriteRegsCmdPtr;
+
+
+// Packet Body structure for the write regs command packet
+typedef struct SysPktWriteRegsRspType {
+ _sysPktBodyCommon; // Common Body header
+ } SysPktWriteRegsRspType;
+typedef SysPktWriteRegsRspType * SysPktWriteRegsRspPtr;
+
+
+//--------------------------------------------------------------------
+// sysPktContinueCmd
+// - continue
+//--------------------------------------------------------------------
+// Packet Body structure for the continue command packet
+typedef struct SysPktContinueCmdType {
+ _sysPktBodyCommon; // Common Body header
+ M68KRegsType regs; // registers
+ Boolean stepSpy; // set true to do step spy
+ UInt8 reserved;
+ UInt32 ssAddr; // step spy address
+ UInt32 ssCount; // # of bytes
+ UInt32 ssCheckSum; // checksum
+ } SysPktContinueCmdType;
+
+typedef SysPktContinueCmdType *SysPktContinueCmdPtr;
+
+
+//--------------------------------------------------------------------
+// sysPktGetBreakPointsCmd
+//
+// - Get breakpoints
+//--------------------------------------------------------------------
+typedef struct SysPktGetBreakpointsCmdType {
+ _sysPktBodyCommon; // Common Body header
+ } SysPktGetBreakpointsCmdType;
+typedef SysPktGetBreakpointsCmdType* SysPktGetBreakpointsCmdPtr;
+
+typedef struct SysPktGetBreakpointsRspType {
+ _sysPktBodyCommon; // Common Body header
+ //BreakpointType bp[dbgTotalBreakpoints];
+ } SysPktGetBreakpointsRspType;
+typedef SysPktGetBreakpointsRspType* SysPktGetBreakpointsRspPtr;
+
+
+//--------------------------------------------------------------------
+// sysPktSetBreakPointsCmd
+//
+// - Set breakpoints
+//--------------------------------------------------------------------
+typedef struct SysPktSetBreakpointsCmdType {
+ _sysPktBodyCommon; // Common Body header
+ //BreakpointType bp[dbgTotalBreakpoints];
+ } SysPktSetBreakpointsCmdType;
+typedef SysPktSetBreakpointsCmdType* SysPktSetBreakpointsCmdPtr;
+
+typedef struct SysPktSetBreakpointsRspType {
+ _sysPktBodyCommon; // Common Body header
+ } SysPktSetBreakpointsRspType;
+typedef SysPktSetBreakpointsRspType* SysPktSetBreakpointsRspPtr;
+
+
+
+
+//--------------------------------------------------------------------
+// sysPktDbgBreakToggleCmd
+// - Enable/Disable DbgBreak's command
+//--------------------------------------------------------------------
+typedef struct SysPktDbgBreakToggleCmdType {
+ _sysPktBodyCommon; // Common Body header
+ } SysPktDbgBreakToggleCmdType;
+typedef SysPktDbgBreakToggleCmdType* SysPktDbgBreakToggleCmdPtr;
+
+typedef struct SysPktDbgBreakToggleRspType {
+ _sysPktBodyCommon; // Common Body header
+ Boolean newState;
+ UInt8 reserved;
+ } SysPktDbgBreakToggleRspType;
+typedef SysPktDbgBreakToggleRspType* SysPktDbgBreakToggleRspPtr;
+
+
+//--------------------------------------------------------------------
+// sysPktFlashCmd - OBSOLETE AS OF 3.0! SEE sysPktExecFlashCmd BELOW!
+// 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
+// width - width of FLASH
+// ramSpaceP - buffer in RAM for flash sector
+//--------------------------------------------------------------------
+typedef struct SysPktFlashWriteType {
+ _sysPktBodyCommon; // Common Body header
+ UInt16 numBytes; // -> # of bytes in sector
+ UInt32 flashBase; // -> base address of FLASH, or 0 for default
+ UInt32 srcAddr; // -> source address of new data
+ UInt32 dstAddr; // -> dest address in flash memory
+ UInt8 manuf; // <- manufacturer
+ UInt8 device; // <- device
+ UInt8 width; // <- Flash memory width
+ UInt8 filler;
+ UInt32 ramSpaceP; // <- available space in RAM for sector
+ } SysPktFlashWriteType;
+typedef SysPktFlashWriteType *SysPktFlashWritePtr;
+
+
+//--------------------------------------------------------------------
+// sysPktExecFlashCmd
+// NEW Program Flash command - executes flash ident/write code
+// If codeAddr is 0, this routine returns address to write flash code.
+// Replaces 1.0 and 2.0 sysPktFlashCmd call above in the 3.0 ROM
+//--------------------------------------------------------------------
+typedef struct sysPktExecFlashType {
+ _sysPktBodyCommon; // Common Body header
+ UInt16 numBytes; // -> # of bytes in sector
+ UInt32 flashBase; // -> base address of FLASH
+ UInt32 srcAddr; // -> source address of new data
+ UInt32 dstAddr; // -> dest address in flash memory
+ UInt32 codeAddr; // <-> address of flash code
+ UInt16 flashResID; // <- resource ID of flash write code
+ UInt8 manuf; // <- manufacturer
+ UInt8 device; // <- device
+ UInt8 devInfo; // <- device info
+ UInt8 remoteCmd; // -> remote command (e.g.: flash/erase/both)
+ UInt8 response; // <- response from flash/ident code
+ UInt8 spareByte; // <-> filler (byte for word alignment)
+ UInt32 spareDWord; // <-> spare
+ } sysPktExecFlashType;
+typedef sysPktExecFlashType *sysPktExecFlashPtr;
+
+// remoteCmd values sent to flash code:
+#define remoteCmdErase 0x01 // tells flash code to erase block(s)
+#define remoteCmdFlash 0x02 // tells flash code to flash block(s)
+#define remoteCmdROMSig 0x04 // tells flash code to write ROM signature
+#define remoteCmdUnlocked 0x08 // tells flash code to check block lock status
+
+// response values returned by flash write/identify code:
+#define respNoErr 0 // no error
+#define respNoFlashBase 1 // flashBase not specified
+#define respIdentFailed 2 // can't identify flash part
+#define respNoBytes 3 // numBytes not specified
+#define respPartialBlock 4 // numBytes not multiple of flash sub-block size
+#define respTooManyBytes 5 // numBytes too high
+#define respEraseFailed 6 // erase command failed
+#define respNotErased 7 // erase verification failed
+#define respFlashFailed 8 // flash command failed
+#define respInvalidFlashDeviceID 9 // unrecognized device code
+#define respBlockLocked 10 // block is locked
+#define respBadCommand 11 // remoteCmd not supported
+
+//--------------------------------------------------------------------
+// sysPktGetTrapBreaksCmd
+//
+// - Get Trap Breaks
+//--------------------------------------------------------------------
+typedef struct SysPktGetTrapBreaksCmdType {
+ _sysPktBodyCommon; // Common Body header
+ } SysPktGetTrapBreaksCmdType;
+typedef SysPktGetTrapBreaksCmdType* SysPktGetTrapBreaksCmdPtr;
+
+typedef struct SysPktGetTrapBreaksRspType {
+ _sysPktBodyCommon; // Common Body header
+ //UInt16 trapBP[dbgTotalTrapBreaks];
+ } SysPktGetTrapBreaksRspType;
+typedef SysPktGetTrapBreaksRspType* SysPktGetTrapBreaksRspPtr;
+
+
+//--------------------------------------------------------------------
+// sysPktSetTrapBreaksCmd
+//
+// - Set Trap Breaks
+//--------------------------------------------------------------------
+typedef struct SysPktSetTrapBreaksCmdType {
+ _sysPktBodyCommon; // Common Body header
+ //UInt16 trapBP[dbgTotalTrapBreaks];
+ } SysPktSetTrapBreaksCmdType;
+typedef SysPktSetTrapBreaksCmdType* SysPktSetTrapBreaksCmdPtr;
+
+typedef struct SysPktSetTrapBreaksRspType {
+ _sysPktBodyCommon; // Common Body header
+ } SysPktSetTrapBreaksRspType;
+typedef SysPktSetTrapBreaksRspType* SysPktSetTrapBreaksRspPtr;
+
+
+
+//--------------------------------------------------------------------
+// sysPktGetTrapConditionsCmd
+//
+// Get 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.
+//--------------------------------------------------------------------
+typedef struct SysPktGetTrapConditionsCmdType {
+ _sysPktBodyCommon; // Common Body header
+ } SysPktGetTrapConditionsCmdType;
+typedef SysPktGetTrapConditionsCmdType* SysPktGetTrapConditionsCmdPtr;
+
+typedef struct SysPktGetTrapConditionsRspType {
+ _sysPktBodyCommon; // Common Body header
+ //UInt16 trapParam[dbgTotalTrapBreaks];
+ } SysPktGetTrapConditionsRspType;
+typedef SysPktGetTrapConditionsRspType* SysPktGetTrapConditionsRspPtr;
+
+
+//--------------------------------------------------------------------
+// sysPktSetTrapConditionsCmd
+//
+// 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.
+//--------------------------------------------------------------------
+typedef struct SysPktSetTrapConditionsCmdType {
+ _sysPktBodyCommon; // Common Body header
+ //UInt16 trapParam[dbgTotalTrapBreaks];
+ } SysPktSetTrapConditionsCmdType;
+typedef SysPktSetTrapConditionsCmdType* SysPktSetTrapConditionsCmdPtr;
+
+typedef struct SysPktSetTrapConditionsRspType {
+ _sysPktBodyCommon; // Common Body header
+ } SysPktSetTrapConditionsRspType;
+typedef SysPktSetTrapConditionsRspType* SysPktSetTrapConditionsRspPtr;
+
+
+
+
+
+// The following indicates how much space in debugger globals we've reserved for
+// the SerialLibrary globals for the Debugger. Reserve 8 extra bytes for
+// patching.
+//
+// ADH 12/21/99 Increased to 64 to allow for buffering space to be added
+// to the serial debug globals.
+#define dbgSerRsvGlobalsSize 64
+
+
+
+/***********************************************************************
+ * Stucture of Debugger Globals
+ ***********************************************************************/
+struct DbgGlobalsType {
+ // Saved registers
+ M68KRegsType reg;
+
+ // Breakpoints and saved opcodes behind each one
+ Boolean romBP;
+ Boolean stepOverBP; // true if single-stepping over a BP
+ BreakpointType bp[dbgTotalBreakpoints];
+ UInt16 bpOpcode[dbgTotalBreakpoints];
+
+ // Current trap breaks
+ UInt16 trapBreak[dbgTotalTrapBreaks];
+ UInt16 trapParam[dbgTotalTrapBreaks];
+ UInt32 oldDispatcher; // saved trap dispatcher
+ Boolean breakingOnATrap; // set by debugger trap dispatcher
+
+ // Mode settings
+ Boolean ignoreDbgBreaks; // if true, ignore DbgBreak's
+ Boolean commOpened; // if true, comm library and socket have been
+ // opened.
+
+ // Step spy support
+ Boolean stepSpy; // true if step spying.
+ UInt32 ssAddr; // address to step spy on
+ UInt32 ssValue; // saved value
+
+ // Exception type
+ UInt16 excType; // why we entered debugger
+ UInt8 reEntered; // true if we re-entered
+ UInt8 firstEntrance; // true first time we enter debugger
+
+ // Debugger Serial Library globals
+ UInt8 serGlobals[dbgSerRsvGlobalsSize]; // Debugger Serial globals
+
+ // Saved bus error exception info
+ UInt32 busErrStack[2]; // first 2 long words of bus error stack frame
+
+ // Debugger Stack
+ UInt8 stack[dbgStackSize]; // Debugger stack
+ UInt16 stackEnd; // End of stack
+
+ };
+
+typedef struct DbgGlobalsType DbgGlobalsType;
+
+typedef DbgGlobalsType* DbgGlobalsPtr;
+
+
+
+#endif // __DEBUGMGR_H__
+#endif // NON_PORTABLE
diff --git a/SrcShared/Palm/Platform/Core/System/IncsPrv/Globals.h b/SrcShared/Palm/Platform/Core/System/IncsPrv/Globals.h
new file mode 100644
index 0000000..e45c95c
--- /dev/null
+++ b/SrcShared/Palm/Platform/Core/System/IncsPrv/Globals.h
@@ -0,0 +1,574 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Globals.h
+ *
+ * Description:
+ * Structure definition of Pilot globals
+ *
+ * History:
+ * 10/26/94 RM Created by Ron Marianetti
+ * 4/13/95 VMK Added Sound Manager globals
+ * 8/15/97 vmk Reused padGlobalsP for sndOffTicks
+ * 1/18/98 scl Removed lastActionCodeAppInfoP, added irq globals.
+ * 3/13/98 srj Added new battery subsystem
+ * 6/22/98 srj Added new global for software shutdown
+ * 8/17/98 SCL Synchronized globals between Sumo/Eleven
+ * 8/26/98 kwk Deleted unused FEP globals pointer.
+ * 8/28/98 SCL Synchronized globals between Sumo/Eleven
+ * 9/15/98 jfs Added two new UInt32 globals exclusively for OEM use
+ * 10/28/98 SCL Synchronized globals between Sumo/Eleven
+ * 04/05/99 jrb Added UInt16 for Jerry PLD shadow register.
+ * 04/13/99 jhl Added RadioMgr globals pointer
+ * 07/12/99 kwk Added fatal alert template ptr/btn width.
+ * 07/14/99 kwk Added silkscreen info pointer.
+ * 10/29/99 SCL REMOVED dbgHalDispatchP since it was never released.
+ *
+ *****************************************************************************/
+
+#ifdef NON_PORTABLE // So app's don't mistakenly include this
+
+#ifndef __GLOBALS_H__
+#define __GLOBALS_H__
+
+#include <M68KHwr.h>
+
+// The following indicates how much space in low memory we've reserved for
+// the UI globals. The UI initialization code makes sure that we don't
+// overrun this space by comparing the size of the structure UIGlobalsType
+// with this constant.
+
+// Changing this will cause globals after uiGlobals to move including flpSoftFPSCR.
+// See note below regarding flpSoftFPSCR and __SoftFPSCR__ in mc68ksfpe.s.
+#define sysUIRsvGlobalsSize 0xB0
+
+
+
+/************************************************************
+ * Structure of Fixed System Globals
+ *************************************************************/
+typedef struct FixedGlobalsType {
+
+ // Memory Manager Globals
+ UInt8 memCardSlots; // number of memory card slots
+ UInt8 dbgWasEntered; // set true the first time debugger is entered
+ void * memCardInfoP; // pointer to array of CardInfoTypes stored
+ UInt32 memSemaphoreID; // Memory Manager semaphore
+ UInt16 memDebugMode; // Current debug mode of Memory Manager
+
+ // Data Manager Globals
+ void * dmOpenList; // Linked list of open databases (DmOpenInfoPtr)
+
+ // Debugger/System Shared globals
+ UInt8 dbgInDebugger; // true if in debugger
+ UInt8 dbgTracing; // tracing in debugger
+ void * dbgGlobalsP; // pointer to dbgGlobals
+ void * dbgSerGlobalsP; // pointer to Debugger Serial globals
+
+
+ // System Manager Globals
+ void * sysAppInfoP; // pointer to SysAppInfoType for system
+ void * sysKernelDataP; // pointer to Kernel data
+ void ** sysDispatchTableP; // pointer to dispatch table
+ UInt32 sysOwnerIDsInUse; // 1 bit for each owner ID in use
+ void * sysAMXAppInfoP; // SysAppInfoType for AMX app.
+ UInt32 sysClockFreq; // processor clock frequency
+ UInt32 * sysHardKeyCreators; // ptr to array of App Creator types
+
+ Int16 sysBatteryCheckTimer; // # of ticks left before we check battery again
+ UInt8 sysBatteryMinThreshold; // System will shut down if battery falls below this
+ UInt8 hwrBatteryLevel; // current battery level
+ Int16 sysNextBatteryAlertTimer; // # of ticks till next battery warning (OBSOLETE, See Below)
+ UInt8 sysBatteryWarnThreshold; // If battery below this level, post low battery keyboard event
+
+ UInt8 sysDispatchTableRev; // incremented every time a trap is patched. Used
+ // by host debugger to invalidate it's cache.
+ UInt16 sysDispatchTableSize; // # of entries in dispatch table
+ void * sysLibTableP; // (SysLibTblEntryPtr) pointer to Library entries
+ UInt16 sysLibTableEntries; // size of library table
+ void * sysConsoleStackChunkP; // pointer to console task stack chunk
+ void * sysUIShellAppInfoP; // AppInfoPtr for UIAppShell
+
+ UInt32 sysTimerID; // TimerID of timer used for periodic system stuff
+ UInt32 sysAutoOffEvtTicks; // Ticks of last event - used to support auto-off
+ UInt16 sysAutoOffSeconds; // Auto-sleep timeout in seconds.
+
+ Int32 sysRandomSeed; // Random # seed
+
+
+
+ // Other Manager's globals
+ void * slkGlobalsP; // pointer to serial link globals
+ void * serGlobalsP; // pointer to serial manager globals
+ void * scrGlobalsP; // pointer to screen driver globals
+ void * fplGlobalsP; // pointer to Floating Point Library globals
+ void * penGlobalsP; // Pen manager globals ptr
+ void * sysEvtMgrGlobalsP; // System Event Manager Globals
+ void * sndGlobalsP; // Sound Manager globals
+ void * timGlobalsP; // Time Manager globals
+ void * almGlobalsP; // Alarm Manager globals
+ void * ftrGlobalsP; // pointer to feature manager globals
+ void * grfGlobalsP; // pointer to Graffiti globals
+ void * keyGlobalsP; // Key manager globals
+
+ // UI Globals
+ UInt8 uiGlobals[sysUIRsvGlobalsSize]; // Basic UI Globals
+ void * uiExtensionsP; // for future use...
+
+
+ // Globals used by UIAppShell in order to manage the launching of UI Apps.
+#if EMULATION_LEVEL != EMULATION_NONE
+ void * curUIAppInfoP; // SysAppInfoPtr of current UI App or
+ // last action code
+#else
+ void * unusedPtr;
+#endif
+
+ UInt32 nextUIAppDBID; // Database LocalID of next UI App to launch
+ UInt16 nextUIAppCmd; // Cmd for next UI App
+ void * nextUIAppCmdPBP; // Cmd ParamBlock Pointer for next UI App
+ UInt8 nextUIAppCardNo; // Card number of next UI App to launch
+
+
+ // Hardware Manager Globals
+ Int8 memDataWELevel; // if > 0, Data area is write enabled
+ UInt16 hwrWakeUp; // Bit mask of which peripherals need to be
+ // enabled when system wakes
+ UInt8 hwrCPUDutyCycle; // Desired Duty cycle of CPU in 31ths.
+ UInt8 hwrPenDown; // last state of pen-down (zero = up
+ // non-zero = down, number of ticks 'till next sample)
+ UInt32 hwrCurTicks; // Current hardware tickCount -
+ // maintained separately from AMX ticks for performance reasons.
+ UInt32 hwrTotalRAMSize; // total RAM Size, used by HwrMemWritable
+ UInt32 hwrDozeSubTicks; // # of subTicks we've dozed for since reset
+ // a sub-tick is 1/4096 seconds.
+
+ // Sound Manager "sound off" ticks
+ // WAS: Pad server globals pointer
+ // WAS: void * padGlobalsP; // PAD Server globals
+ UInt32 sndOffTicks; // # of ticks til disabling the PWM (0 = do nothing)
+
+ // New System globals
+ UInt8 sysResetFlags; // Reset flags sysResetFlagXXXX
+ UInt8 sysBatteryKind; // SysBatteryKind enumerated type
+
+ // New Memory Manager global for recording minimum heap free - used for debugging only
+ UInt32 memMinDynHeapFree; // Minimum free space in dynamic heap
+
+
+ // System Preferences flags
+ UInt16 sysPrefFlags; // System Pref flags: sysPrefFlagXXXX
+
+
+ // This is a pointer to the System Manager variable size globals
+ void * sysGlobalsP; // pointer to System Globals
+
+ // Miscellaneous System flags
+ UInt16 sysMiscFlags; // System Misc flags: sysMiscFlagXXX
+
+
+ //-----------------------------------------------------------------------
+ // New Globals added for the 2.0 release...
+ //-----------------------------------------------------------------------
+ UInt16 sysLibNet; // refnum of TCP/IP library
+ void * netPktFreeQ; // global needed by Net Library
+
+
+ // EventGroupID used by the System Event Manager for blocking on user input
+ // and by the Net Library for implementing NetLibSelect()
+ UInt32 sysEvGroupID; // AMX EventGroup ID.
+
+
+ void * irq3GlobalsP; // IRQ3 handler globals
+
+ // Tick count last time we displayed a low battery warning. This is used by
+ // the system timer procedure in AMXHardwareTD1.c to insure that it doesn't
+ // display low battery warnings more than once/minute.
+ UInt32 sysLastBatteryWarning; // tickcount of last warning.
+
+ // Checksum of exception vector area of low memory. Used when ROM built for full
+ // error checking to make sure no apps overwrite low memory by using null pointers.
+ UInt32 sysLowMemChecksum; // checksum of low memory.
+
+ // Hardware rev. This is determined during bootup time. The first shipping rev
+ // is 1.
+ UInt16 hwrHardwareRev; // hardware rev.
+
+
+ // MemHandle to list of protected databases
+ MemHandle dmProtectListH; // handle to array of protected
+ // databases (DmProtectEntryType)
+ // Miscellaneous hardware flags
+ UInt16 hwrMiscFlags; // Hardware Misc Flags: hwrMiscFlagXXX
+
+ // Support for profiling
+ UInt32 sysProfileRefcon; // Refcon value for profiler function
+ void * sysProfileProcP; // Profiler procedure, called if non-zero
+ // during tick interrupt (100/sec).
+
+ // NewFloatMgr's MWSFPE (MetroWerks Software Floating Point Emulator)
+ // needs a global to keep track of its status and control.
+ // This global (__SoftFPSCR__) is referenced by the 68K code located at
+ // :Libraries:NewFloatMgr:mc68ksfpe.s
+ UInt32 flpSoftFPSCR;
+
+
+ //-----------------------------------------------------------------------
+ // New Globals added for the 3.0 release...
+ //-----------------------------------------------------------------------
+ void * irLibGlobalsP; // Ir Library globals pointer
+ UInt16 exgActiveLib; // active Exchange library
+
+ UInt16 uiBusyCount; // UI busy counter
+
+ void * irq1GlobalsP; // IRQ1 handler globals
+ void * irq2GlobalsP; // IRQ2 handler globals
+ void * irq6GlobalsP; // IRQ6 handler globals
+
+
+ //-----------------------------------------------------------------------
+ // New Globals added for the 3.1 release...
+ //-----------------------------------------------------------------------
+
+ // Globals for Language support.
+ void * intlMgrGlobalsP; // Int16'l Manager globals
+
+ // Globals for Field inline Text Services
+ UInt16 inlineStart; // Starting position of the inline text
+ UInt16 inlineEnd; // Ending position of the inline text
+ Boolean inlineActive; // True if inline text support is active.
+ UInt8 inlineDefTerm; // True if deferred termination
+ // (inlineDefChecksum/inlineDefField are valid)
+ void * tsmFepLibStatusP; // Pointer to FEP status record.
+ UInt16 tsmFepLibRefNum; // Text Services Library Reference number
+ UInt16 inlineHighlightLen; // Length of highlighted inline text
+
+ // <chg 3/13/98 srj> Added for the battery subsystem
+ void * sysBatteryDataP; // pointer to current battery data
+ void * sysBatteryValidKindsP; // pointer to list of valid batteries
+
+ // <chg 6/22/98 srj> Added for the battery subsystem
+ Boolean sysInShutdown; // True: We are in lockout (Sumo)
+ UInt8 sysMinWakeupThreshold; // System can wake up once we're over this voltage
+
+ // <chg 7/8/98 srj> More miscellaneous hardware flags
+ UInt32 hwrMiscFlagsExt; // Hardware Misc Flags: hwrMiscFlagExtXXX
+
+ // <chg 8/15/98 srj> Added to provide critical warning timer
+ Boolean sysUseCritWarnTimer;
+ Boolean sysCritWarnTimerRunning;
+ Int16 sysCritWarnRTCDayStarted;
+ Int32 sysCritWarnTickTimer;
+ UInt32 sysCritWarnLastTick;
+ Boolean sysCharging;
+ Boolean sysUpdateVoltageLevel;
+
+ // Notification Manager globals:
+ MemHandle notifyGlobalsH; // handle to NotifyMgr globals
+
+ // Some globals reserved for future use (only available in 3.1 or later):
+ UInt32 sysReserved31DWord1;
+ UInt32 sysReserved31DWord2;
+ UInt32 sysReserved31DWord3;
+ UInt32 sysReserved31DWord4;
+
+
+ //-----------------------------------------------------------------------
+ // New Globals added for the 3.2 release...
+ //-----------------------------------------------------------------------
+
+ // <chg 1-28-98 RM> Added for the RAM Mobitex Network Interface
+ void * ramGlobalsP; // For Jerry radio
+
+ // <chg 4-1-98 RM> New global for the HwrBattery() call
+ void * hwrBatteryGlobalsP; // used to hold charging state, etc.
+
+ // <chg 7-10-98 JB> New global for Battery Percent
+ UInt8 hwrBatteryPercent;
+
+ // <chg 10/9/98 SOE> New global with flags indicating various types of background communications activity
+ // Used to hold off form alerts and other activities (beaming) that might screw up comm transfers
+ UInt8 commActivityFlags;
+
+ // For the new serial mgr, the 328 serial plugin needs its own global space
+ // since there is no global for the irq4 line.
+ void * uart328GlobalsP;
+
+
+ // 9/15/98 jfs New Globals added for Licensees, Partners, OEMs, etc.
+ UInt32 sysOEMGlobal1; // 4 bytes for OEM use only!
+ UInt32 sysOEMGlobal2; // 4 bytes for OEM use only!
+
+ // soe added 10/11/98 - many routines think this is constant across platforms
+ // but it was 78 on old pilots (3.3v reference) and is now 85 (3.0v reference on new pilots)
+ // The #defines in hardware.h are now specific by reference
+ UInt16 hwrBatteryStepsPerVolt;
+
+ // <chg 11/19/98 TLW> New global to maintain a list of appInfo blocks
+ // that reference the stack used by a task so both the appInfo block
+ // and the stack can be deleted after task termination is complete.
+ // The stack can't be deleted before terminating the task because the
+ // task delete call is using the stack. The appInfo block is deleted
+ // later because already has a taskId reference and a pointer to the stack.
+ void * sysPendingStackFrees;
+
+
+ //-----------------------------------------------------------------------
+ // New Globals added for the 3.3 release...
+ //-----------------------------------------------------------------------
+
+ // jed 1/18-99 Software day counter for the time-based critical warnings
+ UInt16 sysDayCounter;
+
+ // jed 1/15/99 New Global added during the Sumo merge
+ // jfs 4/26/99 Changed from unsigned to signed Int16
+ Int16 sysBatteryCheckPeriod;
+
+ // jrb 4/5/99 Shadow register for Jerry EZ PLD
+ UInt16 hwrJerryPldShadow;
+
+ // jhl 4/13/99 RadioMgr globals pointer
+ void * radioGlobalsP;
+
+
+ //-----------------------------------------------------------------------
+ // New Globals added for the 3.5 release...
+ //-----------------------------------------------------------------------
+
+ // kwk 07/12/99 Info used by SysFatalAlert to display localizable alert.
+ void * fatalAlertTemplateP;
+ UInt16 fatalAlertBtnWidth;
+
+ // kwk 07/14/99 Ptr to silkscreen/button list information.
+ void * silkscreenInfoP;
+
+ // kwk 08/04/99 Deferred inline termination globals.
+ UInt16 inlineDefChecksum;
+ void * inlineDefField;
+
+ // Are there any pending deferred broadcasts for the NotifyMgr to handle?
+ Boolean notifyBroadcastPending;
+
+ UInt8 sysReserved35Byte1;
+
+ // SCL 10/29/99 Globals in which to store OEM/Device/HAL identification info.
+ UInt32 hwrOEMCompanyID;
+ UInt32 hwrOEMDeviceID;
+ UInt32 hwrOEMHALID;
+
+ // mchen 11/11/99 Global used by system update patches.
+ void * sysUpdateGlobalsP;
+
+ // SCL 11/15/99 Global used to identify which SmallROM booted the OS.
+ UInt16 smallROMChecksum;
+
+ //-----------------------------------------------------------------------
+ // Put New globals here...
+ //-----------------------------------------------------------------------
+ // type newGlobal;
+
+ } FixedGlobalsType;
+
+
+/************************************************************
+ * This structure defines the start of the Low Memory Area.
+ * The complete structure of LowMemory is defined in SystemPrv.h
+ * and includes this low memory header followed by some variable
+ * size globals that may change from rev to rev of the System Software.
+ *
+ * When emulating under Windows, this structure ends up at some random
+ * place in memory and the global variable GlobalsP points to it.
+ *
+ * When running in the native environment, this structure starts at
+ * address sysGlobalsOffset.
+ *
+ * In order to simplify the source code, macros are defined for
+ * accessing commonly used globals in the optimim manner for
+ * each environment.
+ *************************************************************/
+typedef struct LowMemHdrType {
+ //---------------------------------------------------------------------------
+ // Processor exception table
+ //---------------------------------------------------------------------------
+ M68KExcTableType vectors; // Exception vectors,
+ // or Card header for RAM only cards
+
+ //---------------------------------------------------------------------------
+ // System Globals
+ //---------------------------------------------------------------------------
+ FixedGlobalsType globals; // System Globals
+
+ } LowMemHdrType;
+
+
+
+#if EMULATION_LEVEL == EMULATION_NONE
+ #define PilotGlobalsP 0
+#else
+ #ifdef __cplusplus
+ extern "C" void *PilotGlobalsP; // pointer to start of Memory card 0
+ #else
+ extern void *PilotGlobalsP; // pointer to start of Memory card 0
+ #endif
+#endif
+
+
+
+
+
+/************************************************************
+ * Macros for accessing globals.
+ * When emulating, the globals are allocated in a memory chunk and our
+ * global variable Card0P points to this chunk.
+ * In native mode, Card0P is defined to be 0 at all times.
+ *************************************************************/
+#define GMemCardSlots (((LowMemHdrType*)PilotGlobalsP)->globals.memCardSlots)
+#define GMemCardInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.memCardInfoP)
+#define GMemSemaphoreID (((LowMemHdrType*)PilotGlobalsP)->globals.memSemaphoreID)
+#define GMemDebugMode (((LowMemHdrType*)PilotGlobalsP)->globals.memDebugMode)
+#define GMemMinDynHeapFree (((LowMemHdrType*)PilotGlobalsP)->globals.memMinDynHeapFree)
+
+#define GDmOpenList (((LowMemHdrType*)PilotGlobalsP)->globals.dmOpenList)
+#define GDmProtectListH (((LowMemHdrType*)PilotGlobalsP)->globals.dmProtectListH)
+
+#define GDbgWasEntered (((LowMemHdrType*)PilotGlobalsP)->globals.dbgWasEntered)
+#define GDbgInDebugger (((LowMemHdrType*)PilotGlobalsP)->globals.dbgInDebugger)
+#define GDbgTracing (((LowMemHdrType*)PilotGlobalsP)->globals.dbgTracing)
+#define GDbgGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.dbgGlobalsP)
+
+#define GSysAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.sysAppInfoP)
+#define GSysKernelDataP (((LowMemHdrType*)PilotGlobalsP)->globals.sysKernelDataP)
+#define GSysDispatchTableP (((LowMemHdrType*)PilotGlobalsP)->globals.sysDispatchTableP)
+#define GSysDispatchTableSize (((LowMemHdrType*)PilotGlobalsP)->globals.sysDispatchTableSize)
+#define GSysDispatchTableRev (((LowMemHdrType*)PilotGlobalsP)->globals.sysDispatchTableRev)
+#define GSysOwnerIDsInUse (((LowMemHdrType*)PilotGlobalsP)->globals.sysOwnerIDsInUse)
+#define GSysAMXAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.sysAMXAppInfoP)
+#define GSysClockFreq (((LowMemHdrType*)PilotGlobalsP)->globals.sysClockFreq)
+#define GSysHardKeyCreators (((LowMemHdrType*)PilotGlobalsP)->globals.sysHardKeyCreators)
+#define GSysNextBatteryAlertTimer (((LowMemHdrType*)PilotGlobalsP)->globals.sysNextBatteryAlertTimer)
+#define GSysBatteryCheckTimer (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryCheckTimer)
+#define GSysBatteryWarnThreshold (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryWarnThreshold)
+#define GHwrBatteryLevel (((LowMemHdrType*)PilotGlobalsP)->globals.hwrBatteryLevel)
+#define GSysBatteryMinThreshold (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryMinThreshold)
+#define GSysBatteryKind (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryKind)
+#define GSysConsoleStackChunkP (((LowMemHdrType*)PilotGlobalsP)->globals.sysConsoleStackChunkP)
+#define GSysUIShellAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.sysUIShellAppInfoP)
+#define GSysTimerID (((LowMemHdrType*)PilotGlobalsP)->globals.sysTimerID)
+#define GSysAutoOffEvtTicks (((LowMemHdrType*)PilotGlobalsP)->globals.sysAutoOffEvtTicks)
+#define GSysAutoOffSeconds (((LowMemHdrType*)PilotGlobalsP)->globals.sysAutoOffSeconds)
+#define GSysRandomSeed (((LowMemHdrType*)PilotGlobalsP)->globals.sysRandomSeed)
+#define GSysResetFlags (((LowMemHdrType*)PilotGlobalsP)->globals.sysResetFlags)
+#define GSysPrefFlags (((LowMemHdrType*)PilotGlobalsP)->globals.sysPrefFlags)
+#define GSysMiscFlags (((LowMemHdrType*)PilotGlobalsP)->globals.sysMiscFlags)
+#define GSysGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.sysGlobalsP)
+#define GSysLibNet (((LowMemHdrType*)PilotGlobalsP)->globals.sysLibNet)
+#define GSysEvGroupID (((LowMemHdrType*)PilotGlobalsP)->globals.sysEvGroupID)
+#define GSysLastBatteryWarning (((LowMemHdrType*)PilotGlobalsP)->globals.sysLastBatteryWarning)
+#define GSysLowMemChecksum (((LowMemHdrType*)PilotGlobalsP)->globals.sysLowMemChecksum)
+#define GSysProfileRefcon (((LowMemHdrType*)PilotGlobalsP)->globals.sysProfileRefcon)
+#define GSysProfileProcP (((LowMemHdrType*)PilotGlobalsP)->globals.sysProfileProcP)
+
+#define GNetPktFreeQ (((LowMemHdrType*)PilotGlobalsP)->globals.netPktFreeQ)
+
+#define GMemDataWELevel (((LowMemHdrType*)PilotGlobalsP)->globals.memDataWELevel)
+
+#define GSlkGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.slkGlobalsP)
+#define GSerGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.serGlobalsP)
+#define GSer681GlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.irq3GlobalsP)
+#define GScrGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.scrGlobalsP)
+#define GFplGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.fplGlobalsP)
+#define GPenGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.penGlobalsP)
+#define GSysEvtMgrGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.sysEvtMgrGlobalsP)
+#define GSndGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.sndGlobalsP)
+#define GTimGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.timGlobalsP)
+#define GAlmGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.almGlobalsP)
+#define GFtrGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.ftrGlobalsP)
+#define GGrfGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.grfGlobalsP)
+#define GKeyGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.keyGlobalsP)
+//#define GPADGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.padGlobalsP) // not used vmk 8/15/97
+
+#define GSndOffTicks (((LowMemHdrType*)PilotGlobalsP)->globals.sndOffTicks)
+
+#define GUIGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.uiGlobals)
+
+#define GNextUIAppDBID (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppDBID)
+#define GNextUIAppCardNo (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppCardNo)
+#define GNextUIAppCmd (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppCmd)
+#define GNextUIAppCmdPBP (((LowMemHdrType*)PilotGlobalsP)->globals.nextUIAppCmdPBP)
+
+#if EMULATION_LEVEL != EMULATION_NONE
+#define GCurUIAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.curUIAppInfoP)
+#endif
+
+#define GSysLibTableP (((LowMemHdrType*)PilotGlobalsP)->globals.sysLibTableP)
+#define GSysLibTableEntries (((LowMemHdrType*)PilotGlobalsP)->globals.sysLibTableEntries)
+#define GDbgSerGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.dbgSerGlobalsP)
+
+#define GIrLibGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.irLibGlobalsP)
+#define GExgActiveLib (((LowMemHdrType*)PilotGlobalsP)->globals.exgActiveLib)
+#define GSysUIBusyCount (((LowMemHdrType*)PilotGlobalsP)->globals.uiBusyCount)
+
+#define GIrq1GlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.irq1GlobalsP)
+#define GIrq2GlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.irq2GlobalsP)
+#define GIrq3GlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.irq3GlobalsP)
+#define GIrq6GlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.irq6GlobalsP)
+#define GUart328GlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.uart328GlobalsP)
+#define GSysOEMGlobal1 (((LowMemHdrType*)PilotGlobalsP)->globals.sysOEMGlobal1)
+#define GSysOEMGlobal2 (((LowMemHdrType*)PilotGlobalsP)->globals.sysOEMGlobal2)
+
+#define GIntlMgrGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.intlMgrGlobalsP)
+
+#define GInlineStart (((LowMemHdrType*)PilotGlobalsP)->globals.inlineStart)
+#define GInlineEnd (((LowMemHdrType*)PilotGlobalsP)->globals.inlineEnd)
+#define GInlineActive (((LowMemHdrType*)PilotGlobalsP)->globals.inlineActive)
+#define GInlineDefTerm (((LowMemHdrType*)PilotGlobalsP)->globals.inlineDefTerm)
+#define GInlineHighlightLen (((LowMemHdrType*)PilotGlobalsP)->globals.inlineHighlightLen)
+#define GInlineDefChecksum (((LowMemHdrType*)PilotGlobalsP)->globals.inlineDefChecksum)
+#define GInlineDefField (((LowMemHdrType*)PilotGlobalsP)->globals.inlineDefField)
+#define GTsmFepLibStatusP (((LowMemHdrType*)PilotGlobalsP)->globals.tsmFepLibStatusP)
+#define GTsmFepLibRefNum (((LowMemHdrType*)PilotGlobalsP)->globals.tsmFepLibRefNum)
+
+#define GSysBatteryDataP (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryDataP)
+#define GSysBatteryValidKindsP (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryValidKindsP)
+#define GSysInShutdown (((LowMemHdrType*)PilotGlobalsP)->globals.sysInShutdown)
+#define GSysMinWakeupThreshold (((LowMemHdrType*)PilotGlobalsP)->globals.sysMinWakeupThreshold)
+
+#define GSysUseCritWarnTimer (((LowMemHdrType*)PilotGlobalsP)->globals.sysUseCritWarnTimer)
+#define GSysCritWarnTimerRunning (((LowMemHdrType*)PilotGlobalsP)->globals.sysCritWarnTimerRunning)
+#define GSysCritWarnRTCDayStarted (((LowMemHdrType*)PilotGlobalsP)->globals.sysCritWarnRTCDayStarted)
+#define GSysCritWarnTickTimer (((LowMemHdrType*)PilotGlobalsP)->globals.sysCritWarnTickTimer)
+#define GSysCritWarnLastTick (((LowMemHdrType*)PilotGlobalsP)->globals.sysCritWarnLastTick)
+#define GSysCharging (((LowMemHdrType*)PilotGlobalsP)->globals.sysCharging)
+#define GSysUpdateVoltageLevel (((LowMemHdrType*)PilotGlobalsP)->globals.sysUpdateVoltageLevel)
+
+#define GSysNotifyGlobalsH (((LowMemHdrType*)PilotGlobalsP)->globals.notifyGlobalsH)
+#define GSysNotifyBroadcastPending (((LowMemHdrType*)PilotGlobalsP)->globals.notifyBroadcastPending)
+
+#define GRAMGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.ramGlobalsP)
+#define GCommActivityFlags (((LowMemHdrType*)PilotGlobalsP)->globals.commActivityFlags)
+#define GSysPendingStackFrees (((LowMemHdrType*)PilotGlobalsP)->globals.sysPendingStackFrees)
+
+#define GSysBatteryCheckPeriod (((LowMemHdrType*)PilotGlobalsP)->globals.sysBatteryCheckPeriod)
+#define GSysDayCounter (((LowMemHdrType*)PilotGlobalsP)->globals.sysDayCounter)
+
+#define GSysJerryPldShadow (((LowMemHdrType*)PilotGlobalsP)->globals.hwrJerryPldShadow)
+
+#define GRadioGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.radioGlobalsP)
+
+#define GFatalAlertTemplateP (((LowMemHdrType*)PilotGlobalsP)->globals.fatalAlertTemplateP)
+#define GFatalAlertBtnWidth (((LowMemHdrType*)PilotGlobalsP)->globals.fatalAlertBtnWidth)
+
+#define GSilkscreenInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.silkscreenInfoP)
+
+#define GHwrOEMCompanyID (((LowMemHdrType*)PilotGlobalsP)->globals.hwrOEMCompanyID)
+#define GHwrOEMDeviceID (((LowMemHdrType*)PilotGlobalsP)->globals.hwrOEMDeviceID)
+#define GHwrOEMHALID (((LowMemHdrType*)PilotGlobalsP)->globals.hwrOEMHALID)
+
+#define GSysUpdateGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.sysUpdateGlobalsP)
+#define GSmallROMChecksum (((LowMemHdrType*)PilotGlobalsP)->globals.smallROMChecksum)
+
+#endif //__GLOBALS_H__
+
+#endif // NON_PORTABLE
diff --git a/SrcShared/Palm/Platform/Core/System/IncsPrv/MemoryPrv.h b/SrcShared/Palm/Platform/Core/System/IncsPrv/MemoryPrv.h
new file mode 100644
index 0000000..668a707
--- /dev/null
+++ b/SrcShared/Palm/Platform/Core/System/IncsPrv/MemoryPrv.h
@@ -0,0 +1,603 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: MemoryPrv.h
+ *
+ * Description:
+ * Private includes for Memory Manager.
+ *
+ * History:
+ * 11/11/96 RM Re-written to allow heaps > 64K in size.
+ * 10/26/99 kwk Added memRomStoreNum & memRamStoreNum defines.
+ *
+ *****************************************************************************/
+
+#ifdef NON_PORTABLE
+
+// SystemPrv.h must be included before this header file. SystemPrv.h will
+// then in turn include this header.
+#ifndef __SYSTEMPRV_H__
+#include "SystemPrv.h"
+#endif
+
+#ifndef __MEMORYPRV_H__
+#define __MEMORYPRV_H__
+
+
+//#include <ErrorMgr.h>
+
+#include "PalmOptErrorCheckLevel.h"
+
+/************************************************************
+ * Private Flags accepted as parameter for MemNewChunk.
+ *************************************************************/
+#define memNewChunkFlagAllowLarge 0x1000 // allow >64K allocations
+
+
+/************************************************************
+ * Store numbers for MemStoreInfo.
+ *************************************************************/
+#define memRomStoreNum 0
+#define memRamStoreNum 1
+
+
+/********************************************************************
+ * Structure of a version 2 Master Pointer Table chunk.
+ * The first master pointer chunk is always immediately following the
+ * heap header. As more movable chunks are created, new master
+ * pointer chunks are allocated dynamically and linked together through
+ * the nextTblOffset field and prevTblOffset field.
+ ********************************************************************/
+typedef struct {
+ UInt16 numEntries; // number of master pointer entries
+ UInt32 nextTblOffset; // offset from start of heap to next table
+ //void * mstrP[numEntries]; // array of pointers to movable chunks
+ } MemMstrPtrTableType;
+typedef MemMstrPtrTableType* MemMstrPtrTablePtr;
+
+
+/********************************************************************
+ * Structure of a version 1 Master Pointer Table chunk.
+ * This is included for use by the Palm Debugger so that it can do
+ * heap dumps of devices that use the version 1 Memory Manager.
+ ********************************************************************/
+typedef struct {
+ UInt16 numEntries; // number of master pointer entries
+ UInt16 nextTblOffset; // offset from start of heap to next table
+ //void * mstrP[numEntries]; // array of pointers to movable chunks
+ } Mem1MstrPtrTableType;
+typedef Mem1MstrPtrTableType* Mem1MstrPtrTablePtr;
+
+
+
+/********************************************************************
+ * Structure of a version 2 Memory Manager Chunk Header.
+ ********************************************************************/
+#if CPU_ENDIAN == CPU_ENDIAN_BIG
+
+typedef struct {
+ UInt32 free :1; // set if free chunk
+ UInt32 moved :1; // used by MemHeapScramble
+ UInt32 unused2 :1; // unused
+ UInt32 unused3 :1; // unused
+ UInt32 sizeAdj :4; // size adjustment
+ UInt32 size :24; // actual size of chunk
+
+ UInt32 lockCount :4; // lock count
+ UInt32 owner :4; // owner ID
+ Int32 hOffset :24; // signed MemHandle offset/2
+ // used in free chunks to point to next free chunk
+ } MemChunkHeaderType;
+
+#else
+
+// Since this is an internal structure, I rearranged the fields.
+// There were two reasons: the size and hOffset fields are accessed
+// more efficiently (no shifting needed) and the flags macros still
+// return the flags as defined by the API (memChunkFlagsXXXX), without
+// requiring a lot of bit manipulation.
+// But, the size field needs to be in the first DWord because the
+// MemHeapTerminatorType is assumed to be in the same position as size.
+typedef struct {
+ UInt32 size :24; // actual size of chunk
+ UInt32 sizeAdj :4; // size adjustment
+ UInt32 unused3 :1; // unused
+ UInt32 unused2 :1; // unused
+ UInt32 moved :1; // used by MemHeapScramble
+ UInt32 free :1; // set if free chunk
+
+ Int32 hOffset :24; // signed MemHandle offset/2
+ // used in free chunks to point to next free chunk
+ UInt32 owner :4; // owner ID
+ UInt32 lockCount :4; // lock count
+ } MemChunkHeaderType;
+
+#endif
+
+typedef MemChunkHeaderType * MemChunkHeaderPtr;
+
+// The MemHeapTerminatorType is stored at the end of every heap and
+// is pointed to by the last real chunk in the heap
+typedef UInt32 MemHeapTerminatorType;
+
+// This macro is a quicker way of clearing a chunk header than
+// MemSet...
+#define memClearChunkHeader(p) { *((UInt32 *)p) = 0; *(((UInt32 *)p)+1) = 0;}
+
+// This macro is used to initialize a freeChunk header
+#define memInitFreeChunkHeader(p, size, hOffset) \
+ { *((UInt32*)p) = (0x80000000 | (size)); *(((UInt32*)p)+1) = (hOffset); }
+
+// This macro returns the data portion of a chunk given a pointer to the header
+#define memChunkData(chunkP) (void *)(((MemChunkHeaderPtr)(chunkP)) + 1)
+
+// This macro returns the memChunkHeader given a pointer to the start of the data
+#define memChunkHeader(dataP) (((MemChunkHeaderPtr)(dataP)) - 1)
+
+#if CPU_ENDIAN == CPU_ENDIAN_BIG
+
+// This macro is used to grab all the flags at once and place them into
+// a byte
+#define memChunkFlags(p) (*((UInt8 *)p) & 0xF0)
+
+// This macro is used to clear all the flags at once
+#define memChunkFlagsClear(p) ((*((UInt8 *)p)) &= 0x0F)
+
+#else
+
+// This macro is used to grab all the flags at once and place them into
+// a byte
+#define memChunkFlags(p) (*(((UInt8 *)p)+3) & 0xF0)
+
+// This macro is used to clear all the flags at once
+#define memChunkFlagsClear(p) (*(((UInt8 *)p)+3) &= 0x0F)
+
+#endif
+
+// When flags are returned by the API (by MemPtrFlags, etc.)
+#define memChunkFlagFree 0x80 // free bit
+#define memChunkFlagUnused1 0x40 // unused
+#define memChunkFlagUnused2 0x20 // unused
+#define memChunkFlagUnused3 0x10 // unused
+
+// A lockcount of memPtrLockCount means a permanently unmovable chunk
+#define memPtrLockCount 15
+
+// A ownerID of 15 is used for master pointer chunks
+#define memOwnerMasterPtrTbl 15
+
+
+// This equate returns the name of the ChunkHeaderType. This was created
+// so that we can change the name of the CHunkHeaderType (as we did for V2 of
+// the Memory Manager) and souce code won't know the difference
+#define memChunkHeaderTypeName MemChunkHeaderType
+
+
+/********************************************************************
+ * Structure of a version 1 Memory Manager Chunk Header.
+ * This is included for use by the Palm Debugger so that it can do
+ * heap dumps of devices that use the version 1 Memory Manager.
+ ********************************************************************/
+typedef struct {
+ UInt16 size; // size of block in bytes, including header
+ UInt8 lockOwner; // lock count in high nibble, owner in low
+ UInt8 flags; // flags, size adj in low nibble
+ Int16 hOffset; // offset/2 to MemHandle for movables
+ } Mem1ChunkHeaderType;
+typedef Mem1ChunkHeaderType* Mem1ChunkHeaderPtr;
+
+#define mem1ChunkFlagSizeAdj 0x0F // mask for size adjustment
+
+// A non-movable chunk has 0xF as the lock count
+#define mem1ChunkLockMask 0xF0
+#define mem1ChunkOwnerMask 0x0F
+
+
+/********************************************************************
+ * Structure of a Heap
+ *
+ * A heap starts with a HeapHeader
+ * Followed by the offset table (numHandles)
+ * Followed by movable chunks
+ * Followed by non-movable chunks
+ ********************************************************************/
+
+/********************************************************************
+ * Structure of a version 3 Memory Heap Header.
+ ********************************************************************/
+typedef struct {
+ UInt16 flags; // heap flags;
+ UInt32 size; // size of heap
+ UInt32 firstFreeChunkOffset;// offset/2 to first free chunk
+ MemMstrPtrTableType mstrPtrTbl; // Master pointer table
+ } MemHeapHeaderType;
+typedef MemHeapHeaderType * MemHeapHeaderPtr;
+
+
+// Flags Field
+#define memHeapFlagReadOnly 0x0001 // heap is read-only (ROM based)
+#define memHeapFlagVers2 0x8000 // version 2 heap (> 64K)
+#define memHeapFlagVers3 0x4000 // version 3 heap (has free list)
+#define memHeapFlagVers4 0x2000 // version 4 heap (has free master pointer table entry list)
+
+#define memMstrPtrTableGrowBy 50 // # of entries to grow master pointer tables by
+#define memMstrPtrTableInitSizeD 200 // # of entries to allocate initially for dynamic heap(s)
+#define memMstrPtrTableInitSizeS 200 // # of entries to allocate initially for storage heap(s)
+
+
+
+/********************************************************************
+ * Structure of a version 1 Memory Heap Header.
+ * This is included for use by the Palm Debugger so that it can do
+ * heap dumps of devices that use the version 1 Memory Manager.
+ ********************************************************************/
+typedef struct {
+ UInt16 flags; // heap flags;
+ UInt16 size; // size of heap - 0 means 64K;
+ Mem1MstrPtrTableType mstrPtrTbl; // Master pointer table
+ } Mem1HeapHeaderType;
+typedef Mem1HeapHeaderType * Mem1HeapHeaderPtr;
+
+
+/********************************************************************
+ * Structure of a version 2 Memory Heap Header.
+ * This is included for use by the Palm Debugger so that it can do
+ * heap dumps of devices that use the version 1 Memory Manager.
+ ********************************************************************/
+typedef struct {
+ UInt16 flags; // heap flags;
+ UInt32 size; // size of heap
+ MemMstrPtrTableType mstrPtrTbl; // Master pointer table
+ } Mem2HeapHeaderType;
+typedef Mem2HeapHeaderType * Mem2HeapHeaderPtr;
+
+
+/********************************************************************
+ * These macros pave the way for the version 2 Memory Manager that
+ * supports >64K chunks.
+ *
+ * They are a general way to get info out of a Chunk header and Heap header
+ * whether it be a version 1 or version 2 header. They are used almost
+ * exclusively by the Palm Debugger and Simulator Heap Dump utility
+ * since it must be able to do heap dumps of both versions of the Palm
+ * Memory Manager.
+ *
+ * The 'ver' parameter to these macros is either 1 for version 1 or
+ * 2 for version 2 and the 'p' parameter is the chunk header pointer.
+ ********************************************************************/
+// This structure is big enough to read in a version 1 or version 2
+// Master Pointer Table into
+typedef struct {
+ union {
+ MemMstrPtrTableType ver2;
+ Mem1MstrPtrTableType ver1;
+ } header;
+ } MemMstrPtrTableUnionType;
+
+#define memUSizeOfMstrPtrTable(ver) \
+ (ver>1 ? sizeof(MemMstrPtrTableType) : sizeof(Mem1MstrPtrTableType))
+
+#define memUMstrPtrTableNextTblOffset(p,ver) \
+ (ver>1 ? ((MemMstrPtrTablePtr)p)->nextTblOffset : ((Mem1MstrPtrTablePtr)p)->nextTblOffset)
+
+#define memUMstrPtrTableNumEntries(p,ver) \
+ (ver>1 ? ((MemMstrPtrTablePtr)p)->numEntries : ((Mem1MstrPtrTablePtr)p)->numEntries)
+
+
+// This structure is big enough to read in a version 1, version 2, or version 3
+// heap header into
+typedef struct {
+ union {
+ MemHeapHeaderType ver3;
+ Mem2HeapHeaderType ver2;
+ Mem1HeapHeaderType ver1;
+ } header;
+ } MemHeapHeaderUnionType;
+
+#define memUHeapVer(p) \
+ (memUHeapFlags((p)) & memHeapFlagVers4 ? 4 : \
+ (memUHeapFlags((p)) & memHeapFlagVers3 ? 3 : \
+ (memUHeapFlags((p)) & memHeapFlagVers2 ? 2 : 1)))
+
+#define memUSizeOfHeapHeader(ver) \
+ (ver>2 ? sizeof (MemHeapHeaderType) : (ver>1 ? sizeof(Mem2HeapHeaderType) : sizeof(Mem1HeapHeaderType)))
+
+#define memUHeapSize(p,ver) \
+ (ver>2 ? ((MemHeapHeaderPtr)p)->size : (ver>1 ? ((Mem2HeapHeaderPtr)p)->size : ((Mem1HeapHeaderPtr)p)->size))
+
+#define memUHeapFlags(p) \
+ (((MemHeapHeaderPtr)p)->flags)
+
+#define memUHeapMstrPtrEntries(p,ver) \
+ (ver>2 ? ((MemHeapHeaderPtr)p)->mstrPtrTbl.numEntries : (ver>1 ? ((Mem2HeapHeaderPtr)p)->mstrPtrTbl.numEntries : ((Mem1HeapHeaderPtr)p)->mstrPtrTbl.numEntries))
+
+#define memUHeapMstrPtrAddr(p,ver) \
+ (ver>2 ? (void *)&((MemHeapHeaderPtr)p)->mstrPtrTbl : (ver>1 ? (void *)&((Mem2HeapHeaderPtr)p)->mstrPtrTbl : (void *)&((Mem1HeapHeaderPtr)p)->mstrPtrTbl))
+
+
+
+// This structure is big enough to read in a version 1 or version 2
+// chunk header into.
+typedef struct {
+ union {
+ MemChunkHeaderType ver2;
+ Mem1ChunkHeaderType ver1;
+ } header;
+ } MemChunkHeaderUnionType;
+
+#define memUSizeOfHeapTerminator(ver) \
+ (ver>1 ? sizeof(MemHeapTerminatorType) : sizeof(UInt16))
+
+#define memUSizeOfChunkHeader(ver) \
+ (ver>1 ? sizeof(MemChunkHeaderType) : sizeof(Mem1ChunkHeaderType))
+
+#define memUChunkSize(p,ver) \
+ (ver>1 ? ((MemChunkHeaderPtr)p)->size : ((Mem1ChunkHeaderPtr)p)->size)
+
+#define memUChunkFlags(p,ver) \
+ (ver>1 ? memChunkFlags(p) : ((Mem1ChunkHeaderPtr)p)->flags & 0xF0)
+
+#define memUChunkSizeAdj(p,ver) \
+ (ver>1 ? ((MemChunkHeaderPtr)p)->sizeAdj : ((Mem1ChunkHeaderPtr)p)->flags & mem1ChunkFlagSizeAdj)
+
+#define memUChunkLockCount(p,ver) \
+ (ver>1 ? ((MemChunkHeaderPtr)p)->lockCount : ((Mem1ChunkHeaderPtr)p)->lockOwner >> 4)
+
+#define memUChunkOwner(p,ver) \
+ (ver>1 ? ((MemChunkHeaderPtr)p)->owner : ((Mem1ChunkHeaderPtr)p)->lockOwner & mem1ChunkOwnerMask)
+
+#define memUChunkHOffset(p,ver) \
+ (ver>1 ? ((MemChunkHeaderPtr)p)->hOffset : ((Mem1ChunkHeaderPtr)p)->hOffset)
+
+
+
+
+/************************************************************
+ * Structure of a Card Header.
+ * There is 1 card header for in every card that has ROM. The
+ * card header is stored at sysCardHeaderOffset into the card.
+ *
+ * RAM only cards will not have a card header
+ *************************************************************/
+#define memMaxNameLen 32 // size of name and manuf fields including null
+typedef struct CardHeaderType {
+ UInt32 initStack; // initial stack pointer (v4: offset to code in RomBoot)
+ UInt32 resetVector; // reset vector
+ UInt32 signature; // must be sysCardSignature
+ UInt16 hdrVersion; // header version
+ UInt16 flags; // card flags;
+ UInt8 name[memMaxNameLen]; // card name
+ UInt8 manuf[memMaxNameLen]; // card manufacturer's name
+ UInt16 version; // card version
+ UInt32 creationDate; // card creation date
+ UInt16 numRAMBlocks; // number of RAM blocks on card
+ UInt32 blockListOffset; // offset to RAM block list
+ UInt32 readWriteParmsOffset; // v2: offset from CardBase to r/w system data if any (in ROM)
+ UInt32 readWriteParmsSize; // v2: size of read/write system data if any (in ROM)
+ UInt32 readOnlyParmsOffset; // v2: offset from CardBase to read-only system data (in ROM)
+ UInt32 bigROMOffset; // v2: in SmallROM header: where SmallROM expects bigROM to live
+ // in BigROM header: where BigROM expects itself to live
+ UInt32 checksumBytes; // v2: size of card image in bytes (for checksum)
+ UInt16 checksumValue; // v2: checksum of card image (from Crc16CalcBlock)
+
+ UInt32 readWriteWorkingOffset; // v3: offset from CardBase to r/w working area if any (in ROM)
+ UInt32 readWriteWorkingSize; // v3: size of read/write working area if any (in ROM)
+
+ UInt32 halCodeOffset; // v4: offset from CardHeader to HAL code
+
+ UInt8 reserved[130]; // to bring us to 0x100 alignment
+ } CardHeaderType;
+typedef CardHeaderType* CardHeaderPtr;
+
+#define memCardHeaderFlagRAMOnly 0x0001 // RAM only card
+#define memCardHeaderFlag328 0x0010 // ROM Supports 68328 processor
+#define memCardHeaderFlagEZ 0x0020 // ROM SUpports 68EZ328 processor
+#define memCardHeaderFlag230K 0x1000 // SmallROM supports 230Kbps
+
+
+
+/************************************************************
+ * Structure of a Storage Header.
+ * There is 1 of these for every "store" on a memory card. A
+ * "store" can be all the RAM on a card or all the ROM on a card.
+ *
+ * The RAM storage header is stored at sysRAMHeader offset into the
+ * card. and the ROM storage header is stored at sysROMHeader offset
+ * into the card.
+ *************************************************************/
+typedef struct {
+ UInt32 signature; // must be sysStoreSignature
+ UInt16 version; // version of header
+ UInt16 flags; // flags
+ UInt8 name[memMaxNameLen]; // name of store
+ UInt32 creationDate; // creation date
+ UInt32 backupDate; // last backup date
+ UInt32 heapListOffset; // offset to heap list for store
+ UInt32 initCodeOffset1; // init code for store, if any
+ UInt32 initCodeOffset2; // second init code for store, if any
+ LocalID databaseDirID; // local ID of database dir.
+ UInt32 rsvSpace; // where first heap starts.
+ UInt32 dynHeapSpace; // how big the dynamic heap area is
+ // (always 0 for ROM stores)
+ UInt32 firstRAMBlockSize; // Copy of firstRAMBlock size from cardinfo
+ // Used to determine if we're rebooting
+ // with a different amount of RAM.
+
+ // The following fields are used to store non-volatile information that
+ // must be accessed by the system but that is not convenient to store
+ // in a database due to access time or frequency. It is only valid
+ // in the RAM STORE ON CARD #0! Though some initialization values for
+ // the card 0 RAM store come from the ROM store's nvParams field.
+ SysNVParamsType nvParams;
+
+ // Filler bytes - reserved for future use. Size adjusted to
+ // keep total size of storage header at 0x100 bytes.
+ UInt8 reserved[176-sizeof(SysNVParamsType)];
+
+ // CRC value
+ UInt32 crc; // crc to check validity
+ } StorageHeaderType;
+typedef StorageHeaderType* StorageHeaderPtr;
+
+#define memStoreHeaderFlagRAMOnly 0x0001 // RAM store
+
+
+// A Heap list for each store on a card (either RAM or ROM) gives a list of
+// heaps' starting offsets for that store
+typedef struct {
+ UInt16 numHeaps; // Number of heaps in store
+ UInt32 heapOffset[1]; // offset to heap
+ } HeapListType;
+
+
+
+/********************************************************************
+ * CardInfo structure
+ * The Palm globals has a pointer to an array of CardInfo structures.
+ *
+ * This array is initialized by the Boot code before the Memory Manager
+ * starts up. Among other things, it tells the Memory Manager where
+ * every card is and the size of each card.
+ ********************************************************************/
+typedef struct CardInfoType {
+
+ // These fields are filled in by the boot code BEFORE
+ // MemInit() is called.
+ UInt8 *baseP; // base address of card
+ UInt32 size; // address range of card
+ UInt32 firstRAMBlockSize; // size of RAM block at offset 0
+ UInt32 targetROMShift; // used only under Emulation mode, must be
+ // added to emulated ROM pointers when calculating
+ // a LocalID for use in the device ROM.
+
+
+ UInt32 cardHeaderOffset; // offset to card header (usually in ROM)
+ // = 0 if RAM only card
+
+ UInt32 rsvSpace; // reserve space in RAM before first heap
+ UInt32 dynHeapSpace; // how much space to reserve for dynamic heap(s)
+ StorageHeaderPtr ramStoreP; // pointer to RAM store header
+ // This location depends on how much space
+ // was reserved on the card for the dynamic
+ // heap.
+
+ // These fields are copies of information in the card and storage headers
+ // they are cached here for quicker access by the Memory Manager. They
+ // are filled in by the Memory Manager during MemInit.
+ UInt16 numRAMHeaps; // Number of RAM heaps - for quick access
+ UInt32 *ramHeapOffsetsP; // Table of RAM heap offsets - for quick access
+ UInt16 numROMHeaps; // Number of RAM heaps - for quick access
+ UInt32 *romHeapOffsetsP; // Table of RAM heap offsets - for quick access
+
+ // This field was added for Palm OS v3.5. The HAL fills this in so the OS
+ // no longer has to use a #define'd value which can differ from device to device.
+ UInt32 cardOffsetMask; // converts a pointer to a card offset
+
+ } CardInfoType;
+typedef CardInfoType* CardInfoPtr;
+
+// The constant hwrNumCardSlots, defined in Hardware.h defines the maximum number
+// of cards supported by the hardware.
+
+
+
+
+/************************************************************
+ * Private Memory Manager Constants
+ *************************************************************/
+// Private constant - # of dynamic heaps
+#define memDynamicHeaps 1
+
+// Private constant - maximum chunk size allowed (0xFFFFFFFFL = up to available memory)
+// We're presently limiting the maximum chunk allocation because the current HotSync cannot
+// transfer records/resources larger than (0x0FFFF - 30) bytes. This restriction will
+// be removed when HotSync is extended to MemHandle larger transfers.
+#define memMaxChunkAllocSize ((UInt32)(0x0FFFFUL - 30UL))
+
+
+
+/************************************************************
+ * Private Memory Manager Macros. These macros are not
+ * guaranteed to be compatible in the future and should
+ * only be used in system code, not applications.
+ *
+ * To use these, define NON_PORTABLE at the top of your
+ * source code module.
+ *
+ * WARNING: This macro must only be used on Locked chunks!!!
+ * When running with error checking, it will verify
+ * that the chunk is locked before it dereferences it.
+ *************************************************************/
+
+#if MEMORY_FORCE_LOCK == MEMORY_FORCE_LOCK_ON
+ #define memHandleProtect(h) \
+ ((MemHandle)((UInt32)h | 0x80000000))
+ #define memHandleUnProtect(h) \
+ ((void **)((UInt32)h & 0x7FFFFFFF))
+#else
+ #define memHandleProtect(h) (h)
+ #define memHandleUnProtect(h) (h)
+#endif
+
+
+#if MEMORY_TYPE == MEMORY_LOCAL
+ #if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL
+ #define MemDeref(h) \
+ ((MemHandleLockCount(h)==0 ? (*((void **)0x80000000)) : (*memHandleUnProtect(h))))
+ #else
+ #define MemDeref(h) \
+ (*(memHandleUnProtect(h)))
+ #endif
+
+#else
+ #if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL
+ #define MemDeref(h) \
+ ((MemHandleLockCount(h)==0 ? (*((void **)0x80000000)) : ((void *)ShlDWord(h))) )
+ #else
+ #define MemDeref(h) \
+ ((void *)ShlDWord(memHandleUnProtect(h)))
+ #endif
+#endif
+
+
+
+
+// Typecast access to the MemCardInfo MemPtr
+#define memCardInfoP(cardNo) \
+ ( ((CardInfoPtr) ((LowMemHdrType*)PilotGlobalsP)->globals.memCardInfoP) + cardNo)
+
+
+
+/********************************************************************
+ * Memory Manager Private Routines
+ * These are used only by internal System code
+ ********************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void * MemHeapPtr(UInt16 heapID)
+ SYS_TRAP(sysTrapMemHeapPtr);
+
+Err MemStoreSearch(void *startP, UInt32 range, StorageHeaderPtr *storePP)
+ SYS_TRAP(sysTrapMemStoreSearch);
+
+Err MemStoreInit(UInt32 firstHeapSize, UInt16 firstHeapMstrPtrs,
+ UInt16 cardNo, UInt16 numBlocks, UInt32 *blockInfoP,
+ StorageHeaderPtr storeP, UInt16 numMstrPtrs)
+ SYS_TRAP(sysTrapMemStoreInit);
+
+Err MemNVParams(Boolean set, SysNVParamsPtr paramsP)
+ SYS_TRAP(sysTrapMemNVParams);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif // __MEMORYPRV_H__
+#endif // NON_PORTABLE
diff --git a/SrcShared/Palm/Platform/Core/System/IncsPrv/SerialLinkPrv.h b/SrcShared/Palm/Platform/Core/System/IncsPrv/SerialLinkPrv.h
new file mode 100644
index 0000000..b40614e
--- /dev/null
+++ b/SrcShared/Palm/Platform/Core/System/IncsPrv/SerialLinkPrv.h
@@ -0,0 +1,90 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SerialLinkPrv.h
+ *
+ * Description:
+ * Private Serial Link includes
+ *
+ * History:
+ * 2/6/95 replaces DSerial.h from Debugger
+ *
+ *****************************************************************************/
+
+#ifdef NON_PORTABLE
+
+#ifndef __SERIALLINKPRV_H
+#define __SERIALLINKPRV_H
+
+#include <SerialLinkMgr.h>
+
+
+//*************************************************************************
+// Misc Constants
+//*************************************************************************
+// Default timeout value once into receiving a packet in ticks
+#define slkDefaultInPktTimeout (sysTicksPerSecond*2)
+
+
+
+
+/*******************************************************************
+ * Serial Link Globals
+ *
+ *******************************************************************/
+#define slkMaxSockets 6 // max # of sockets
+#define slkMaxRefNums slkMaxSockets // max # of refNums in use at any one time
+#define slkAnySocket 0xFF
+
+#define slkEmptyRefNum 0xFF // used to track empty refInfos
+#define slkSendBufferSize 252
+
+// We keep an array of these (slkMaxSockets in size) to track which
+// librarie's we've received packet headers for. Since we can have up
+// to slkMaxSockets unique refNums in use at any one time, we must make
+// the array at least that size.
+typedef struct SlkRefInfoType {
+ UInt16 refNum; // refNum of library, or 0xFF if empty
+ Int8 destID; // dest socketID, or -1 if none
+ UInt8 padding;
+ } SlkRefInfoType;
+typedef SlkRefInfoType *SlkRefInfoPtr;
+
+typedef struct SlkGlobalsType {
+ UInt16 openCount;
+
+ UInt16 socketRefNum[slkMaxSockets];
+ Boolean socketOpen[slkMaxSockets];
+ SlkSocketListenPtr socketListenP[slkMaxSockets];
+ UInt16 socketTimeout[slkMaxSockets]; // inPacket timeout
+
+
+ // We can keep track of packets coming in for up to slkMaxRefNums libraries.
+ // This array holds the destination socket ID for packets received from
+ // each library.
+ SlkRefInfoType refInfo[slkMaxRefNums];
+
+ UInt8 transId; // next transaction ID
+ UInt8 padding;
+ UInt32 xmitSemaphoreID; // Semaphore ID for transmitting
+ UInt16 numReceived; // # of packets received since serial link
+ // was opened.
+ // New fields to buffer sends to prevent
+ // the header, body and checksum from being
+ // sent out as three distinct send requests.
+ Boolean socketWantsBuffering[slkMaxSockets];
+
+ UInt8 *sendBufferP; // Send buffer
+ UInt16 sendBufferSize; // Size of the allocated send buffer
+
+ } SlkGlobalsType;
+
+typedef SlkGlobalsType* SlkGlobalsPtr;
+
+
+
+#endif //__SERIALLINKPRV_H
+
+#endif //NON_PORTABLE
diff --git a/SrcShared/Palm/Platform/Core/System/IncsPrv/SysEvtPrv.h b/SrcShared/Palm/Platform/Core/System/IncsPrv/SysEvtPrv.h
new file mode 100644
index 0000000..a7fb95a
--- /dev/null
+++ b/SrcShared/Palm/Platform/Core/System/IncsPrv/SysEvtPrv.h
@@ -0,0 +1,227 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SysEvtPrv.h
+ *
+ * Description:
+ * Private Header for the System Event Manager
+ *
+ * History:
+ * 08/10/95 RM Created by Ron Marianetti
+ * 07/14/99 kwk Added silkscreen area info structures.
+ * 09/13/99 kwk Moved evtKeyStringEscape to SysEvtMgr.c, since
+ * that's the only file using it.
+ * 11/12/99 kwk Moved EvtGetPenBtnList and EvtGetSilkscreenAreaList
+ * to SysEvtMgr.h, since they're now public, as well
+ * as associated data structures.
+ *
+ *****************************************************************************/
+
+#ifdef NON_PORTABLE
+#ifndef __SYSEVTPRV_H__
+#define __SYSEVTPRV_H__
+
+#include <SysEvtMgr.h> // SilkscreenAreaType & PenBtnListType
+
+
+/************************************************************
+ * Structure of a Pen Capture Queue
+ *
+ * This structure is used to hold one or more pen strokes
+ * and is filled by the digitizer interrupt routine and emptied
+ * by application level code.
+ *
+ * A default size queue is allocated by the system and used to capture
+ * strokes for subsequent processing by the Graffiti recognizer
+ * or the hard icon recognizer. This queue pointer is stored in
+ * the System Event Manager Globals.
+ *
+ * Optionally, applications can replace the system pen queue with
+ * one of their own if it they need to hold larger strokes
+ * or more of them.
+ *
+ *
+ * Stroke data is stored in compressed form in this queue - refer
+ * to the comments on the routine EvtEnqueuPenPoint for the format
+ * of the queue data.
+ *************************************************************/
+typedef struct PenQueueType {
+ Int16 start; // start byte offset
+ Int16 end; // end byte offset
+ Int16 size; // size of queue in bytes
+
+ UInt16 strokeCount; // # of complete strokes currently in pen queue
+ Boolean returnedPenDown; // set after we return a pen-down event for
+ // the next stroke in the queue. Cleared after
+ // we return the pen-up for the stroke.
+
+ UInt8 reserved;
+
+ PointType addLast; // last point captured
+ Int16 addStrokeStart; // offset in queue to start of stroke
+ // currently being added to queue
+ // -1 : no stroke being captured
+
+
+ UInt16 strokesRemoved; // running count: # of strokes removed from queue.
+ UInt16 strokesAdded; // running count: # of strokes added to queue.
+
+ Int16 rmvStrokeStage; // -1 : not started
+ // 0 : returned stroke info
+ // 1 : returned start point
+
+ PointType rmvLast; // last point dequeued
+ PointType rmvStartPt; // copy of start point of stroke currently
+ // being removed.
+
+ UInt8 data[2]; // 'size' bytes of data
+ } PenQueueType;
+typedef PenQueueType* PenQueuePtr;
+
+
+
+/************************************************************
+ * Structure of the Key Queue
+ *
+ * This structure is used to hold one or more keystrokes
+ * and is filled by numerous places including the low level
+ * hardware key interrupt routine, the Graffiti recognizer, and
+ * the digitizer buttons recognizer.
+ *
+ * A default size queue is allocated by the system.
+ * This queue pointer is stored in the System Event Manager globals.
+ *
+ * Optionally, applications can replace the system key queue with
+ * one of their own if it they need to hold more keys in the queue
+ * at one time. This may be necessary when processing large macro
+ * strings from Graffiti.
+ *
+ * Key data is stored in compressed form in this queue. Refer to
+ * the comments for the function EvtEnqueueKeyString for the format
+ * of the compressed data.
+ *
+ *************************************************************/
+typedef struct KeyQueueType {
+ UInt16 start; // start byte offset
+ UInt16 end; // end byte offset
+ UInt16 size; // size of queue in bytes
+
+ UInt8 data[2]; // 'size' bytes of data
+ } KeyQueueType;
+typedef KeyQueueType* KeyQueuePtr;
+
+
+/************************************************************
+ * Structure of the silk resource in system overlay DBs. Note,
+ * this structure must mirror the structure of the sysResTSilkscreen
+ * resource as defined in PalmTypes.r.
+ *************************************************************/
+
+// Version of the SilkscreenInfoType structure.
+#define sysSilkscreenVers 1
+
+// Structure of the silkscreen resource (sysResTSilkscreen)
+typedef struct SilkscreenInfoType {
+ UInt16 version; // version of structure.
+
+ // The next three fields aren't used to locate the silkscreen,
+ // but help identify different silkscreen layouts.
+ UInt32 vendorCreator; // creator assigned to vendor
+ // (psys for 3Com)
+ UInt16 localeLanguage; // language for locale
+ UInt16 localeCountry; // country for locale.
+
+ UInt16 numAreas; // Count of number of silkscreen areas.
+ SilkscreenAreaType areas[1]; // Placeholder for one or more areas.
+
+ PenBtnListType buttonList; // Count + list of buttons.
+ } SilkscreenInfoType;
+
+
+/************************************************************
+ * Key constants
+ *************************************************************/
+
+#define evtDefaultPenQSize 0x100
+#define evtDefaultKeyQSize 0x40
+
+#define evtEffectiveKeyQStorage (evtDefaultKeyQSize - sizeof(KeyQueueType))
+
+
+// gremlinsFlags
+#define grmGremlinsOn 0x01
+#define grmEventTraceOn 0x02
+#define grmGremlinsIdle 0x04
+
+/************************************************************
+ * Structure of System Event Manager Globals
+ *************************************************************/
+typedef struct SysEvtMgrGlobalsType {
+ Boolean sendNullEvent; // set by EvtWakeup
+ Boolean enableGraffiti; // If true, enable Graffiti translation
+ Boolean enableSoftKeys; // If true, enable digitizer button translation
+
+
+ Boolean removeTopStroke; // if true, remove top stroke from queue
+ // next time EvtGetSysEvent is called;
+ PenQueuePtr penQP; // pointer to current pen queue
+ UInt16 penQStrokesRemoved; // saved value of penQP->strokesRemoved. Used to
+ // determine if app removed stroke from penUp
+ // event or not.
+
+ KeyQueuePtr keyQP; // pointer to current key queue
+
+ RectangleType writingR; // enclosing rect for writing area
+ UInt16 appAreaBottom; // bottom coordinate of application area.
+
+ Int16 penX; // current pen location and state
+ Int16 penY;
+ Boolean penDown;
+ Boolean displayingBatteryAlert; // to avoid re-entering battery dialog
+
+ Int16 lastPenX; // last pen location and state
+ Int16 lastPenY;
+ Boolean lastPenDown;
+
+ // This boolean is set by the Remote Screen Driver timer procedure periodically
+ // to force the event manager to call ScrSendUpdateArea which will send the update
+ // area of the screen to the host.
+ Boolean needRemoteScrUpdate; // If true, call ScrSendUpdateArea
+
+
+ UInt8 gremlinsFlags; // flag to indicate if gremlins is running and
+ // if we'er doing an event trace.
+
+ Boolean idle; // DOLATER ron - Who put this here?? What is it for???
+
+ // The following flag is used to better support background wakeup jobs.
+ // See the comments on the new EvtGotUserEvent() for details
+ Boolean gotUserEvent; // Cleared when going to sleep, set as soon as
+ // we get a user event (key press, app alarm, etc).
+
+ UInt8 reserved;
+ } SysEvtMgrGlobalsType;
+
+typedef SysEvtMgrGlobalsType* SysEvtMgrGlobalsPtr;
+
+
+
+/************************************************************
+ * System Event Manager procedures
+ *************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif //__SYSEVTPRV_H__
+
+#endif // NON_PORTABLE
diff --git a/SrcShared/Palm/Platform/Core/System/IncsPrv/SystemPrv.h b/SrcShared/Palm/Platform/Core/System/IncsPrv/SystemPrv.h
new file mode 100644
index 0000000..b9bee33
--- /dev/null
+++ b/SrcShared/Palm/Platform/Core/System/IncsPrv/SystemPrv.h
@@ -0,0 +1,474 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SystemPrv.h
+ *
+ * Description:
+ * Private Pilot system equates
+ *
+ * History:
+ * 08/09/95 RM Created by Ron Marianetti
+ * 01/28/98 SCL Added HotSync port "hint" for SerialHWMgr
+ * 02/04/98 srj Added HW_TARGET_EZ in appropriate places.
+ * HW_TARGET_TD1 in this file means "any
+ * handheld", not non-EZ platforms.
+ * 04/05/99 jrb bumped sysLowMemSize
+ * 04/13/99 kwk Bumped sysLowMemSize to 15B0.
+ * 05/21/99 kwk Bumped sysLowMemSize to 1700.
+ * 06/24/99 kwk Added four locale-related fields to SysNVParamsType.
+ * 07/01/99 kwk Added SysExtPrefsType structure & version/flag defs.
+ * 07/13/99 kwk Bumped sysLowMemSize to 1800.
+ * 11/01/99 kwk Moved SysWantEvent here from SystemMgr.h
+ * 12/03/99 SCL Moved SysAppInfoType, SysAppStartup, and SysAppExit
+ * to SystemMgr.h (for StartupCode/Runtime)
+ * 01/21/00 ADH Bumped sysLowMemSize to 1880
+ * 03/30/00 jmp Bumped sysLowMemSize to 1900 for the device and to 2000
+ * for the Simulator.
+ *
+ *****************************************************************************/
+
+#ifdef NON_PORTABLE
+
+#ifndef __SYSTEMPRV_H__
+#define __SYSTEMPRV_H__
+
+#include <DataMgr.h>
+#include <Event.h>
+#include <SystemMgr.h> // for SysAppInfoType
+
+// Include fixed global type
+#include "Globals.h"
+#include "SerialMgr.h" // for serPortLocalHotSync define
+
+
+/************************************************************
+ * Common Equates between Native and Emulation mode
+ *************************************************************/
+#define sysCardSignature 0xFEEDBEEFL // card signature long word
+#define sysStoreSignature 0xFEEDFACEL // store signature long word
+
+
+// This should be set to sizeof(LowMemType) for the final version, but
+// until then we'll make it bigger than LowMemType so that we can
+// add more globals without having to re-format memory cards.
+//
+// Note: sysLowMemSize needs to be an even multiple of 0x1000 in the Simulator
+// so that MemStoreSearch() will be able to find the sysStoreSignature.
+//
+#if EMULATION_LEVEL == EMULATION_NONE
+#define sysLowMemSize 0x1900 // size of Low Memory Area
+#else
+#define sysLowMemSize 0x2000 // size of Low Memory Area
+#endif
+#define sysInitStack (sysLowMemSize+0x1000) // stack ptr during boot
+
+
+
+// The location of the Card Header (start of ROM) is plugged in at run
+// time to the global variable GSysCardHeaderOffset. This MUST be done
+// by the startup code. We make this a run-time variable so that the same
+// executable ROM image can be run from ROM or RAM.
+// #define sysCardHeaderOffset someConstant
+#define sysRAMOnlyCardHeaderOffset 0x0000000L // RAM only card header created here
+#define sysCardHeaderSize 0x0100 // size of card header
+
+
+// Offset to ROM storage header from card header
+#define sysROMStoreRelOffset sysCardHeaderSize
+#define sysStoreHeaderSize 0x0100 // size of storage header
+
+
+// This equate tells us how large of a heap info table to reserve in the
+// globals for each card
+#define sysMaxHeapsPerCard 128 // max # of heaps per card
+
+
+// This equtes tells us the initial size of the Library table as held in
+// the Low Memory area. The table is allocated in the dynamic heap by
+// the first call to SysLibInstall(), in SystemMgr.c.
+#define sysDefaultLibraries DEFAULT_LIB_ENTRIES // default size of library table
+
+
+// The default port number and baud rate for the serial port
+// (send "HotSync" port hint for SerialHWMgr)
+#define sysDefaultSerPort serPortLocalHotSync // Use port #0
+#define sysDefaultSerBaud 57600 // baud rate
+
+/************************************************************
+ * Structure of the pref=0 resource in applications. Note, this
+ * structure must mirror the structure of the sysResTAppPrefs
+ * resource as defined in SystemResourcesPrv.h.
+ *************************************************************/
+typedef struct SysAppPrefs {
+ UInt16 priority; // task priority
+ UInt32 stackSize; // required stack space
+ UInt32 minHeapSpace; // minimum heap space required
+ } SysAppPrefsType;
+typedef SysAppPrefsType *SysAppPrefsPtr;
+
+
+// Extra stack space allocated for each app to
+// account for increased stack usage by the system.
+#define sysAppStackSpaceFudgeFactor 0xD0
+
+/************************************************************
+ * Structure of the xprf=0 resource in resource DBs. Note, this
+ * structure must mirror the structure of the sysResTExtPrefs
+ * resource as defined in SystemResourcesPrv.h. Also, fields can only
+ * be added (at the end), never removed or changed.
+ *************************************************************/
+
+#define sysExtPrefsVers 1
+
+// Flags defined for SysExtPrefsType.flags
+#define sysExtPrefsNoOverlayFlag 0x00000001
+
+typedef struct SysExtPrefsType {
+ UInt16 version; // version of structure.
+ UInt32 flags; // 32 boolean flags.
+ } SysExtPrefsType;
+
+/************************************************************
+ * Structure of the user info in the TCB of a task. This structure
+ * is stored in the xtcbuser fields of the AMX TCB for a task and
+ * must not exceed 4 DWords in length (the size reserved by AMX for
+ * user info).
+ *************************************************************/
+typedef struct SysTCBUserInfoType {
+ SysAppInfoPtr tmpAppInfoP; // used to pass appInfo to nested launches
+ SysAppInfoPtr rootAppInfoP; // App info for the root application on this task
+ UInt32 initialA5; // Inital value for A5 globals MemPtr
+ } SysTCBUserInfoType;
+typedef SysTCBUserInfoType *SysTCBUserInfoPtr;
+
+
+/************************************************************
+ * An alternate use of the user info area in the TCB of a task.
+ * This is used to pass info back to the kernel when a task is
+ * being deleted. When the termination proc is called it can
+ * fill in the field stackInUseByP field to point to a taskID
+ * field. This field will be cleared by the TaskDelete routine
+ * when it is safe to delete the tasks stack.
+ *************************************************************/
+typedef struct SysExitingTaskInfoType {
+ UInt32 * stackInUseByP; // points to taskid of task using this stack
+ } SysExitingTaskInfoType;
+typedef SysExitingTaskInfoType *SysExitingTaskInfoPtr;
+
+
+//*****************************************************************
+// Structure of ParamBlock for the SysKernelInfo call
+//*****************************************************************
+
+// Selector codes
+typedef enum {
+ sysKernelInfoSelCurTaskInfo,
+ sysKernelInfoSelTaskInfo,
+ sysKernelInfoSelSemaphoreInfo,
+ sysKernelInfoSelTimerInfo
+ } SysKernelInfoSelector;
+
+typedef struct SysKernelInfoType {
+// SysKernelInfoSelector selector; // Which info to get
+ UInt8 selector; // Which info to get
+ UInt8 reserved;
+ UInt32 id; // which object to get info on
+
+ union {
+ struct {
+ UInt32 id; // ID of task
+ UInt32 nextID; // ID of next task
+
+ UInt32 tag; // task tag
+ UInt32 status; // task status
+ UInt32 timer; // # ticks left if task's timeout
+ UInt32 timeSlice; // task's time slice
+ Int16 priority; // task priority
+ UInt16 attributes; // task attributes
+ Int16 pendingCalls; // # of pending calls
+ UInt32 senderTaskID; // task ID of message sender
+ UInt32 msgExchangeID; // task's message exchange ID, if any
+
+ UInt32 tcbP; // pointer to TCB
+ UInt32 stackP; // stack pointer of task
+ UInt32 stackStart; // top of task stack (where it started).
+ UInt32 stackSize; // size of stack
+ } task;
+
+ struct {
+ UInt32 id;
+ UInt32 nextID; // ID of next semaphore
+
+ UInt32 tag; // semaphore tag
+ Int16 initValue; // semaphore initial value
+ // >= 0 for counting, -1 for resource
+ Int16 curValue; // semaphore current value
+ // >0 available
+ // 0 not available
+ // -n not available, n tasks waiting
+ Int16 nestLevel; // 0 for counting, >= 0 for resource
+ UInt32 ownerID; // owner ID
+ // 0 for counting or resource free
+ } semaphore;
+
+ struct {
+ UInt32 id;
+ UInt32 nextID; // ID of next timer
+
+ UInt32 tag; // timer tag
+ UInt32 ticksLeft; // ticks left till timer runs
+ UInt32 period; // timer period, if periodic
+ UInt32 proc; // timer procedure
+ } timer;
+ } param;
+
+ } SysKernelInfoType;
+
+
+typedef SysKernelInfoType* SysKernelInfoPtr;
+
+
+
+
+//-----------------------------------------------------------------
+// Bits for status field in task info parameter block
+//------------------------------------------------------------------
+#define sysTaskStatusTriggerWait 0x01 // (CJ_MATSWTR) Task idle (waiting for trigger)
+#define sysTaskStatusSuspended 0x02 // (CJ_MATSWSUS) Task suspended (waiting for resume)
+#define sysTaskStatusWaiting 0x04 // (CJ_MATSWAIT) Task waiting (see other bits)
+#define sysTaskStatusHalted 0x80 // (CJ_MATSWHLT) Task halted
+
+// If sysTaskStatusWaiting set, these bits tell why....
+#define sysTaskStatusWaitSemaphore 0x00100 // (CJ_MATSWSM) waiting on semaphore
+#define sysTaskStatusWaitEvent 0x00200 // (CJ_MATSWEV) waiting on event group
+#define sysTaskStatusWaitMailbox 0x00400 // (CJ_MATSWMB) waiting on mailbox
+#define sysTaskStatusWaitMsgExchange 0x00800 // (CJ_MATSWMX) waiting on message exchange
+#define sysTaskStatusWaitBuffer 0x01000 // (CJ_MATSWBUF) waiting on buffer
+#define sysTaskStatusWaitTimer 0x08000 // (CJ_MATSWTM) waiting on timer
+
+#define sysTaskStatusWaitMailboxAck 0x00010000L // (CJ_MATSWMBAK) mailbox ack
+#define sysTaskStatusWaitMsgXAck 0x00020000L // (CJ_MATSWMXAK) msg exchange ack
+#define sysTaskStatusWaitTaskSig 0x00040000L // (CJ_MATSWSIG) task signal wait
+
+//-----------------------------------------------------------------
+// Bits for attributes field in task info parameter block
+//------------------------------------------------------------------
+#define sysTaskAttrNoHalt 0x02 // (CJ_MATAHLT) Task cannot be halted
+#define sysTaskAttrMsgStack 0x08 // (CJ_MATAMSG) receives msgs on stack
+#define sysTaskAttrMsgByRef 0x10 // (CJ_MATAPBR) messages passed by reference
+#define sysTaskAttrMsgOnStack 0x4000 // (CJ_MATAMRDY) message ready on stack
+#define sysTaskAttrMsgSenderWaiting 0x8000 // (CJ_MATAMSW) msg sender waiting for ack
+
+
+
+/************************************************************
+ * This structure defines a section within the RAM storage header
+ * on Card#0 used to hold non-volatile System information. We store
+ * System information that can not be conveniently stored or accessed
+ * from a Database in this area because:
+ * 1.) it can be accessed earlier during the boot-up process and
+ * 2.) It can be accessed from an interrupt routine.
+ *************************************************************/
+typedef struct SysNVParamsType {
+ UInt32 rtcHours; // Real-Time clock hours - add to value
+ // in DragonBall RTC register to get
+ // actual date & time.
+ UInt32 rtcHourMinSecCopy; // Copy of latest value in rtcHourMinSec reg of
+ // DBall. Used as default RTC value on Reset.
+ UInt8 swrLCDContrastValue; // Contrast Value for LCD on EZ-based products
+ // that use the software contrast PWM (such as Sumo)
+ UInt8 swrLCDBrightnessValue; // Brightness value for screens with adjustable brightness.
+
+ // Note that in the ROM store, these next four fields contain the default
+ // settings for card 0's RAM store, when it has to be initialized.
+ void* splashScreenPtr; // MemPtr to splash screen bitmap
+ void* hardResetScreenPtr; // MemPtr to hard reset screen bitmap.
+ UInt16 localeLanguage; // Language for locale.
+ UInt16 localeCountry; // Country for locale.
+
+ // 11/15/99 SCL: New Globals added for Licensees, Partners, OEMs, etc.
+ // These storage locations are reserved for the HAL running on a given device.
+ UInt32 sysNVOEMStorage1; // 4 bytes for Device OEM use only!
+ UInt32 sysNVOEMStorage2; // 4 bytes for Device OEM use only!
+
+ } SysNVParamsType;
+typedef SysNVParamsType *SysNVParamsPtr;
+
+
+
+/************************************************************
+ * Structure of the System Globals. This is where we place
+ * variable size globals that the System Manager uses. This
+ * is currently not used but a pointer for it is reserved
+ * in the low memory globals
+ *************************************************************/
+/*
+typedef struct SysGlobalsType {
+ } SysGlobalsType;
+typedef SysGlobalsType *SysGlobalsPtr;
+*/
+
+
+
+/************************************************************
+ * Assignment of bits to the event group used for implementing the
+ * NetLibSelect() call. This event group is also used by the System
+ * Event Manager (SysEvtMgr.c) and includes a bit for "stdin"
+ * (pen & keyboard) besides the other bits used for Net Library socket refNums.
+ *************************************************************/
+#define sysFileDescNet (sysFileDescStdIn+1) // first available refNum for use by
+ // Net library.
+
+
+// Macro to generate a bitmask for the event group corresponding to a particular
+// refNum id and boolean indicating whether it's for input or output. The outputs
+// are in the upper 16 bits of the event group and the inputs are in the
+// lower 16 bits.
+#define sysEvtGroupMask(fd,output) \
+ (output ? (0x00010000 << (fd)) : (0x00000001 << (fd)) )
+
+
+/************************************************************
+ * This structure defines the entire the Low Memory Area
+ * and includes the low memory header defined in Globals.h,
+ * followed by some variable size globals that may change
+ * from rev to rev of the System Software.
+ *
+ * When emulating under Windows, this structure ends up at some random
+ * place in memory and the global variable GlobalsP points to it.
+ *
+ * When running in the native environment, this structure starts at
+ * address sysGlobalsOffset.
+ *
+ * In order to simplify the source code, macros are defined for
+ * accessing commonly used globals in the optimim manner for
+ * each environment.
+ *************************************************************/
+#include "SerialLinkPrv.h"
+#include "MemoryPrv.h"
+#include "SystemPkt.h"
+#include "DebugPrv.h"
+#include "Hardware.h"
+typedef struct LowMemType {
+
+
+ // Fixed size globals, defined in Globals.h
+ LowMemHdrType fixed;
+
+
+ //---------------------------------------------------------------------------
+ // These structures are always placed at the end of the LowMem area so
+ // that other globals don't generally have to move when their sizes change
+ //---------------------------------------------------------------------------
+ CardInfoType memCardInfo[hwrNumCardSlots]; // Memory Card Info Array
+
+ SlkGlobalsType slkGlobals; // Serial Link Mgr globals
+
+ DbgGlobalsType dbgGlobals; // Debugger globals
+
+ SysAppInfoType sysAppInfo; // SysAppInfoType for system
+
+ MemPtr sysDispatchTable[sysNumTraps]; // trap table
+
+ } LowMemType;
+
+
+// Access to variable size globals
+#define GMemCardInfo (((LowMemType*)PilotGlobalsP)->memCardInfo)
+#define GSlkGlobals (((LowMemType*)PilotGlobalsP)->slkGlobals)
+#define GDbgGlobals (((LowMemType*)PilotGlobalsP)->dbgGlobals)
+#define GSysAppInfo (((LowMemType*)PilotGlobalsP)->sysAppInfo)
+#define GSysLibTable (((LowMemType*)PilotGlobalsP)->sysLibTable)
+#define GSysDispatchTable (((LowMemType*)PilotGlobalsP)->sysDispatchTable)
+
+
+// Flags for the GSysResetFlags global
+#define sysResetFlagHardReset 0x01 // HardReset
+#define sysResetFlagCreateDefaultDBs 0x02 // create default databases
+#define sysResetFlagNoExtensions 0x04 // don't execute extensions
+#define sysResetFlagGoingToDebugger 0x08 // going into boot debugger
+// Flag to mark the boot start so that if we get into the loop:
+// busErr, sysReset, busErr, ... we can get out.
+#define sysResetFlagBootStarted 0x10
+
+
+
+// Flags for the GSysPrefFlags global
+#define sysPrefFlagTaxiDisable 0x0001 // Not used in >1.0 ROM.
+#define sysPrefFlagEnableEasterEggs 0x0002 // Enable easter eggs
+#define sysPrefFlagTaxiDisIdle 0x8000 // Disable Idle Taxi temporarily,
+ // (not saved in preferences)
+#define sysPrefFlagTaxiDisIdleTime 0x4000 // Copy of the 16th bit of the system
+ // time when sysPrefFlagTaxiDisIdle bit
+ // was set (not saved in preferences).
+
+
+// Flags for the GSysMiscFlags global
+#define sysMiscFlagInFatalAlert 0x0001 // Currently displaying fatal alert
+#define sysMiscFlagAlwaysSwitchApp 0x0002 // Inform UI App Shell to switch
+ // apps even if already running
+#define sysMiscFlagProfile 0x0004 // true when profiling code.
+#define sysMiscFlagGrfDisable 0x0008 // true when Graffiti is disabled
+#define sysMiscFlagInDemoAlert 0x0010 // true when Demo unit alert is displayed
+#define sysMiscFlagBacklightDisable 0x0020 // true if backlight is disabled
+#define sysMiscFlagUIInitialized 0x0040 // true after UI has been inited
+#define sysMiscFlagExgEvent 0x0080 // true when a library (Ir) has data
+
+
+// Flags for the GDbgWasEntered global
+
+// dbgEnteredFlagPseudoNMI: manually setting this flag in the GDbgWasEntered low mem global
+// causes the HotSync cradle button IRQ handler to enter the debugger. Have to
+// set each time because entering the debugger resets the flag. (this is a hack)
+#define dbgEnteredFlagPseudoNMI 0x80
+#define dbgEnteredFlagTrue 0x01
+
+// Flags for the GCommActivityFlags global
+#define sysCommActivityWlsSockOpen 0x01 // true when a wireless socket is open (Jerry Only)
+//#define sysCommActivityAntennaAlert 0x02 // true when an antenna down alert is on the screen
+#define sysCommActivityHotSync 0x04 // true when a hot sync is in progress
+//#define sysCommActivityDiscardAntKey 0x08 // true when a wireless app want antenna hard keys discarded
+
+
+/************************************************************
+ * Function Prototypes
+ *************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+SysTCBUserInfoPtr SysTaskUserInfoPtr(UInt32 taskID)
+ SYS_TRAP(sysTrapSysTaskUserInfoPtr);
+
+SysAppInfoPtr SysCurAppInfoPV20(void)
+ SYS_TRAP(sysTrapSysCurAppInfoPV20);
+
+SysAppInfoPtr SysGetAppInfo(SysAppInfoPtr *uiAppPP, SysAppInfoPtr *actionCodeAppPP)
+ SYS_TRAP(sysTrapSysGetAppInfo);
+
+Boolean SysWantEvent(EventType* eventP, Boolean *needsUI)
+ SYS_TRAP(sysTrapSysWantEvent);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+/************************************************************
+ * Assembly Function Prototypes
+ *************************************************************/
+#define _SysFatalAlert \
+ ASM_SYS_TRAP(sysTrapSysFatalAlert)
+
+#define _SysReset \
+ ASM_SYS_TRAP(sysTrapSysReset)
+
+
+
+#endif //__SYSTEMPRV_H__
+
+#endif // NON_PORTABLE
diff --git a/SrcShared/Palm/Platform/Core/System/Src/Crc.c b/SrcShared/Palm/Platform/Core/System/Src/Crc.c
new file mode 100644
index 0000000..3554e9d
--- /dev/null
+++ b/SrcShared/Palm/Platform/Core/System/Src/Crc.c
@@ -0,0 +1,257 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Crc.c
+ *
+ * Description:
+ * This file contains the CRC calculation routines for Pilot.
+ *
+ * History:
+ * May 10, 1995 Created by Vitaly Kruglikov
+ * 5/10/95 vmk Initial version.
+ * 5/11/95 vmk Added target CRC translation tables (asm),
+ * and deleted Crc16CalcChar() and Crc32CalcChar().
+ * 12/8/97 scl Added Crc16CalcBigBlock routine.
+ *
+ *****************************************************************************/
+
+/* Routines:
+ * Crc16CalcBlock
+ * Crc32CalcBlock
+ */
+
+#include <BuildDefines.h>
+#ifdef HAS_LOCAL_BUILD_DEFAULTS
+#include "LocalBuildDefaults.h"
+#endif
+#include <PalmTypes.h>
+
+// Include prototypes for this module
+#include "Crc.h"
+
+//=====================================================================
+// We are changing the CRC routines to do a simple checksum in order
+// to conserve ROM space....
+//===================================================================
+//
+// The emulation code can use the statically-defined CRC lookup tables.
+// The target code will need to store the tables in the system database.
+//
+//
+// This is the lookup table used when performing the 16-bit CRC calculation.
+//
+static const UInt16 crctt_16[ 256 ] =
+{
+ 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
+ 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
+ 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
+ 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
+ 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
+ 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
+ 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
+ 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
+ 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
+ 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
+ 0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
+ 0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
+ 0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
+ 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
+ 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
+ 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
+ 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
+ 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
+ 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
+ 0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
+ 0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
+ 0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
+ 0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
+ 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
+ 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
+ 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
+ 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
+ 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
+ 0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
+ 0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
+ 0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
+ 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
+};
+
+
+//
+// This is the lookup table used when performing the 32-bit CRC calculation.
+//
+/*
+static const UInt32 crctt_32[ 256 ] =
+{
+0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L,
+0x0edb8832L, 0x79dcb8a4L, 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, 0x90bf1d91L,
+0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L,
+0x136c9856L, 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, 0xfa0f3d63L, 0x8d080df5L,
+0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
+0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L,
+0x26d930acL, 0x51de003aL, 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, 0xb8bda50fL,
+0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL,
+0x76dc4190L, 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, 0x9fbfe4a5L, 0xe8b8d433L,
+0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
+0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L,
+0x65b0d9c6L, 0x12b7e950L, 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, 0xfbd44c65L,
+0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL,
+0x4369e96aL, 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, 0xaa0a4c5fL, 0xdd0d7cc9L,
+0x5005713cL, 0x270241aaL, 0xbe0b1010L, 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
+0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL,
+0xedb88320L, 0x9abfb3b6L, 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, 0x73dc1683L,
+0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L,
+0xf00f9344L, 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, 0x196c3671L, 0x6e6b06e7L,
+0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
+0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL,
+0xd80d2bdaL, 0xaf0a1b4cL, 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, 0x4669be79L,
+0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL,
+0xc5ba3bbeL, 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, 0x2cd99e8bL, 0x5bdeae1dL,
+0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
+0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L,
+0x86d3d2d4L, 0xf1d4e242L, 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, 0x18b74777L,
+0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L,
+0xa00ae278L, 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, 0x4969474dL, 0x3e6e77dbL,
+0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
+0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, 0xcdd70693L, 0x54de5729L, 0x23d967bfL,
+0xb3667a2eL, 0xc4614ab8L, 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, 0x2d02ef8dL
+};
+*/
+
+
+
+
+/************************************************************
+ * API
+ *-----------------------------------------------------------
+ *
+ * FUNCTION: Crc16CalcBlock
+ *
+ * DESCRIPTION: Calculate the 16-bit CRC of a data block using the table
+ * lookup method.
+ *
+ * PARAMETERS:
+ * bufP -- pointer to the data buffer;
+ * count -- the number of bytes in the buffer;
+ * crc -- the seed crc value;
+ *
+ * RETURNS:
+ * A 16-bit CRC for the data buffer.
+ *
+ * HISTORY:
+ * 05/10/95 vmk Created by Vitaly Kruglikov.
+ * 09/12/99 kwk bufP is a const void* parameter.
+ *
+ *************************************************************/
+UInt16 Crc16CalcBlock(const void* bufP, UInt16 count, UInt16 crc)
+{
+ register const UInt8 * byteP = (UInt8 *)bufP;
+ UInt16 * crctt = (UInt16 *)crctt_16; // CRC translation table
+
+ //
+ // Calculate the 16 bit CRC using the table lookup method.
+ //
+ if ( count )
+ {
+ do {
+ crc = (crc << 8) ^ crctt[ (UInt8)((crc >> 8) ^ *byteP++) ];
+ } while ( --count );
+ }
+
+ return( crc & 0xffff );
+}
+
+
+
+/************************************************************
+ * API
+ *-----------------------------------------------------------
+ *
+ * FUNCTION: Crc16CalcBigBlock
+ *
+ * DESCRIPTION: Calculate the 16-bit CRC of a data block using the table
+ * lookup method. Accepts 32-bit value for count
+ *
+ * PARAMETERS:
+ * bufP -- pointer to the data buffer;
+ * count -- the number of bytes in the (big) buffer;
+ * crc -- the seed crc value;
+ *
+ * RETURNS:
+ * A 16-bit CRC for the data buffer.
+ *
+ * CREATED: 12/8/97
+ *
+ * BY: SCL
+ *
+ * REVISION HISTORY
+ *
+ *************************************************************/
+UInt16 Crc16CalcBigBlock(void * bufP, UInt32 count, UInt16 crc)
+{
+ register UInt8 * byteP = (UInt8 *)bufP;
+ UInt16 * crctt = (UInt16 *)crctt_16; // CRC translation table
+
+ //
+ // Calculate the 16 bit CRC using the table lookup method.
+ //
+ if ( count )
+ {
+ do {
+ crc = (crc << 8) ^ crctt[ (UInt8)((crc >> 8) ^ *byteP++) ];
+ } while ( --count );
+ }
+
+ return( crc & 0xffff );
+}
+
+
+
+/************************************************************
+ * API
+ *-----------------------------------------------------------
+ *
+ * FUNCTION: Crc32CalcBlock
+ *
+ * DESCRIPTION: Calculate the 32-bit CRC of a data block using the table
+ * lookup method.
+ *
+ * PARAMETERS:
+ * bufP -- pointer to the data buffer;
+ * count -- the number of bytes in the buffer;
+ * crc -- the seed crc value;
+ *
+ * RETURNS:
+ * A 32-bit CRC for the data buffer.
+ *
+ * CREATED: 5/10/95
+ *
+ * BY: Vitaly Kruglikov
+ *
+ * REVISION HISTORY
+ *
+ *************************************************************/
+/*UInt32 Crc32CalcBlock(void * bufP, UInt16 count, UInt32 crc)
+{
+ register UInt8 * byteP = (UInt8 *)bufP;
+ UInt32 temp1;
+ UInt32 temp2;
+ UInt32 * crctt = (UInt32 *)crctt_32; // CRC translation table
+
+ //
+ // Calculate the 32 bit CRC using the table lookup method.
+ //
+ if ( count )
+ {
+ do {
+ temp1 = ( crc >> 8 ) & 0x00FFFFFFL;
+ temp2 = crctt[ ((Int16)crc ^ *byteP++) & 0xff ];
+ crc = temp1 ^ temp2;
+ } while ( --count );
+ }
+
+ return( crc );
+}
+*/
diff --git a/SrcShared/Palm/Platform/Incs/BuildDefaults.h b/SrcShared/Palm/Platform/Incs/BuildDefaults.h
new file mode 100644
index 0000000..4259731
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/BuildDefaults.h
@@ -0,0 +1,309 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: BuildDefaults.h
+ *
+ * Description:
+ * Build variable defaults for Palm OS.
+ *
+ * This file is included by <PalmTypes.h>.
+ * This file supercedes the old <BuildRules.h> file.
+ *
+ * History:
+ * 07/16/99 SCL So many changes the old history is obsolete.
+ * 07/29/99 kwk Deleted TEXT_SERVICES & INTERNATIONAL_MGR defines.
+ * 09/15/99 kwk Changed COUNTRY & LANGUAGE defines into #errors.
+ * 10/04/99 grant Added LOCALE define (defaults to #error).
+ * 10/05/99 kwk Added LOCALE_SUFFIX define (defaults to "").
+ *
+ *****************************************************************************/
+
+#ifndef __BUILDDEFAULTS_H__
+#define __BUILDDEFAULTS_H__
+
+#include <BuildDefines.h>
+
+// To override build options in a local component, include <BuildDefines.h>
+// first, then define switches as need, and then include <PalmTypes.h>.
+
+// Some projects used to have a local copy of a file called "AppBuildRules.h"
+// or "AppBuildRulesMSC.h", which was automatically included by <BuildRules.h>
+// to override certain system default compile-time switches. These local
+// "prefix" files can still be used. The project source files should be changed
+// to include <BuildDefines.h>, then "AppBuildRules.MSC.h", then <PalmTypes.h>
+// instead of the previous <Pilot.h>
+
+
+/************************************************************
+ * Include the following when running under the CodeWarrior
+ * IDE so that default build options can be overriden. The default
+ * version of this file is in the Incs: directory. If an app wishes
+ * to override the default options, it should create a copy of this
+ * include file in its own local directory. This include file
+ * is never used when building from MPW since MPW can specify compiler
+ * defines from the command line.
+ *
+ * Other environments can override all of these settings by simply
+ * pre-defining CMD_LINE_BUILD and any other desired settings.
+ *************************************************************/
+
+#ifndef CMD_LINE_BUILD // typically pre-defined only from MPW
+
+ #if !defined(__MWERKS__) && !defined(__PALMOS_TRAPS__) && !defined(_MSC_VER)
+
+ // assume other environments generally build only PalmOS executables
+ #define __PALMOS_TRAPS__ 1
+
+ #endif
+
+
+ #if __PALMOS_TRAPS__ // defined by CodeWarrior IDE or above
+
+ // Settings to build a PalmOS executable
+ #ifndef EMULATION_LEVEL
+ #define EMULATION_LEVEL EMULATION_NONE // building Palm OS executable
+ #endif
+
+ #ifndef USE_TRAPS
+ #define USE_TRAPS 1 // use Palm OS traps
+ #endif
+
+ #endif
+
+
+#endif
+
+
+
+/************************************************************
+ * Settings that can be overriden in the makefile (for MPW)
+ * OR (for CodeWarrior) in "AppBuildRules.h". If there is no
+ * local copy of "AppBuildRules.h" within the project directory,
+ * the one in the Incs directory will be used instead.
+ *************************************************************/
+// This default option is probably ok for now
+#ifndef EMULATION_LEVEL
+ #define EMULATION_LEVEL EMULATION_MAC
+#endif
+
+// This default option is probably ok for now
+#if EMULATION_LEVEL == EMULATION_NONE
+ #define MEMORY_TYPE MEMORY_LOCAL
+#endif
+
+// This default option is probably ok for now
+#ifndef MEMORY_TYPE
+ #define MEMORY_TYPE MEMORY_LOCAL
+#endif
+
+// This default option is probably ok for now
+#ifndef ENVIRONMENT
+ #define ENVIRONMENT ENVIRONMENT_CW
+#endif
+
+// This default option is probably ok to leave as a default
+#ifndef PLATFORM_TYPE
+ #define PLATFORM_TYPE PLATFORM_VIEWER
+#endif
+
+#ifndef ERROR_CHECK_LEVEL
+ #define ERROR_CHECK_LEVEL #error "ERROR_CHECK_LEVEL not defined; Try including ''PalmOptErrorCheckLevel.h''!"
+ // The following allows <PalmOptErrorCheckLevel.h> to redefine ERROR_CHECK_LEVEL
+ // without letting it change ERROR_CHECK_LEVEL if it was already defined,
+ // such as would be the case when using a project prefix file...
+ #define ERROR_CHECK_LEVEL_OK_TO_REDEFINE
+#endif
+
+// This default option is probably ok for now
+#ifndef PUBLIC_STUFF_STRIPPED
+#ifndef CPU_TYPE
+ #if defined(__INTEL__) || defined(__i386__)
+ #define CPU_TYPE CPU_x86
+ #elif defined(__POWERPC__) || defined(__powerpc__)
+ #define CPU_TYPE CPU_PPC
+ #elif defined(__arm__)
+ #define CPU_TYPE CPU_ARM
+ #else
+ #define CPU_TYPE CPU_68K
+ #endif
+#endif
+#else // PUBLIC_STUFF_STRIPPED
+#ifndef CPU_TYPE
+ #if defined(__INTEL__) || defined(__i386__)
+ #define CPU_TYPE CPU_x86
+ #else
+ #define CPU_TYPE CPU_68K
+ #endif
+#endif
+#endif // PUBLIC_STUFF_STRIPPED
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// This default option is probably ok for now
+#ifndef CPU_ENDIAN
+ #if (CPU_TYPE == CPU_x86) || (CPU_TYPE == CPU_ARM)
+ #define CPU_ENDIAN CPU_ENDIAN_LITTLE
+ #else
+ #define CPU_ENDIAN CPU_ENDIAN_BIG
+ #endif
+#endif
+#endif // PUBLIC_STUFF_STRIPPED
+
+#ifndef MODEL
+ #define MODEL #error "MODEL not defined; Try including ''PalmOptModel.h''!"
+#endif
+
+// This default option is probably ok to leave as a default
+#ifndef MEMORY_FORCE_LOCK
+ #define MEMORY_FORCE_LOCK MEMORY_FORCE_LOCK_ON
+#endif
+
+// Must be defined (-d or prefix file) before using. See comment in <BuildDefines.h>.
+#ifndef DEBUG_LEVEL
+ #define DEBUG_LEVEL #error "DEBUG_LEVEL must be defined before using!"
+#endif
+
+#ifndef DEFAULT_LIB_ENTRIES
+ #define DEFAULT_LIB_ENTRIES 12 // space for 12 libraries in library table
+#endif
+
+#ifndef USER_MODE
+ #define USER_MODE #error "USER_MODE not defined; Try including ''PalmOptUserMode.h''!"
+#endif
+
+#ifndef INTERNAL_COMMANDS
+ #define INTERNAL_COMMANDS #error "INTERNAL_COMMANDS must be defined before using!"
+#endif
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER - this option should be driven strictly by inclusion or exclusion of a PRC file.
+// jquinn - This was turned on in the old makefiles. It should be on by default.
+// SCL - We should remove all references to this build option and just assume it's "on".
+// Mandalay builds with it "on" in all cases, even in the OS; there's no longer an extension.
+#endif // PUBLIC_STUFF_STRIPPED
+#ifndef INCLUDE_DES
+ #define INCLUDE_DES INCLUDE_DES_ON
+#endif
+
+// Unless otherwise specified, assume CML_ENCODER is off
+#ifndef CML_ENCODER
+ #define CML_ENCODER CML_ENCODER_OFF
+#endif
+
+// Derive the path for resource files.
+#ifndef RESOURCE_FILE_PREFIX
+ #define RESOURCE_FILE_PREFIX ""
+#endif
+
+// LOCALE_SUFFIX is used for the name of merged resource files,
+// and also sys.tres.
+#ifndef LOCALE_SUFFIX
+ #define LOCALE_SUFFIX ""
+#endif
+
+#ifndef PUBLIC_STUFF_STRIPPED
+#ifndef LOCALE
+ #define LOCALE #error "LOCALE not defined; Try including ''PalmOptLocale.h''!"
+ // The following allows <PalmOptLocale.h> to redefine LOCALE
+ // without letting it change LOCALE if it was already defined,
+ // such as would be the case when using a project prefix file...
+ #define LOCALE_OK_TO_REDEFINE
+#endif
+#endif // PUBLIC_STUFF_STRIPPED
+
+
+// Set these according to which Shell commands you want to
+// link with. These are often overridden by other components
+// in a local "AppBuildRules.h" which is currently obsolete.
+#ifndef SHELL_COMMAND_DB
+ #define SHELL_COMMAND_DB 0 // Not Available
+#endif
+
+#ifndef SHELL_COMMAND_UI
+ #define SHELL_COMMAND_UI 1 // Available
+#endif
+
+#ifndef SHELL_COMMAND_APP
+ #define SHELL_COMMAND_APP 1 // Available
+#endif
+
+#ifndef SHELL_COMMAND_EMULATOR
+ #define SHELL_COMMAND_EMULATOR 1 // Available
+#endif
+
+// Obsolete option; this is left here to catch any stragglers (test code, etc.)...
+#ifndef DYN_MEM_SIZE_MAX
+ #define DYN_MEM_SIZE_MAX #error "DYN_MEM_SIZE_MAX is an obsolete build flag!"
+#endif
+
+// Obsolete option; this is left here to catch any stragglers (test code, etc.)...
+#ifndef SMALL_ROM_SIZE
+ #define SMALL_ROM_SIZE #error "SMALL_ROM_SIZE is an obsolete build flag!"
+#endif
+
+// Obsolete option; this is left here to catch any stragglers (test code, etc.)...
+#ifndef CONSOLE_SERIAL_LIB
+ #define CONSOLE_SERIAL_LIB #error "CONSOLE_SERIAL_LIB is an obsolete build flag!"
+#endif
+
+// Obsolete option; this is left here to catch any stragglers (test code, etc.)...
+#ifndef PILOT_SERIAL_MGR
+ // Palm OS 3.5 code now assumes PILOT_SERIAL_MGR == PILOT_SERIAL_MGR_NEW
+ #define PILOT_SERIAL_MGR #error "PILOT_SERIAL_MGR is an obsolete build flag!"
+#endif
+
+// Obsolete option; this is left here to catch any stragglers (test code, etc.)...
+#ifndef MEMORY_VERSION
+ // Palm OS 3.5 code now assumes MEMORY_VERSION == MEMORY_VERSION_2
+ #define MEMORY_VERSION #error "MEMORY_VERSION is an obsolete build flag!"
+#endif
+
+// Obsolete option; this is left here to catch any stragglers (test code, etc.)...
+#ifndef GRAPHICS_VERSION
+ // Palm OS 3.5 code now assumes GRAPHICS_VERSION == GRAPHICS_VERSION_2
+ #define GRAPHICS_VERSION #error "GRAPHICS_VERSION is an obsolete build flag!"
+#endif
+
+// Obsolete option; this is left here to catch any stragglers (test code, etc.)...
+#ifndef HW_TARGET
+ // Palm OS 3.5 is now hardware independent; HAL should handle this
+ #define HW_TARGET #error "HW_TARGET is an obsolete build flag!"
+#endif
+
+// Obsolete option; this is left here to catch any stragglers (test code, etc.)...
+#ifndef HW_REV
+ // Palm OS 3.5 is now hardware independent; HAL should handle this
+ #define HW_REV #error "HW_REV is an obsolete build flag!"
+#endif
+
+// Obsolete option; this is left here to catch any stragglers (test code, etc.)...
+#ifndef RMP_LIB_INCLUDE
+ #define RMP_LIB_INCLUDE #error "RMP_LIB_INCLUDE is an obsolete build flag!"
+#endif
+
+// Obsolete option; this is left here to catch any stragglers (test code, etc.)...
+#ifndef OEM_PRODUCT
+ #define OEM_PRODUCT #error "OEM_PRODUCT is an obsolete build flag!"
+#endif
+
+// Obsolete option; this is left here to catch any stragglers (test code, etc.)...
+// LANGUAGE/COUNTRY are no longer supported. If absolutely necessary, use LOCALE instead, but
+// build-time dependencies on the target LOCALE are a _really_ bad idea.
+#ifdef LANGUAGE
+ #undef LANGUAGE
+#endif
+#define LANGUAGE #error "LANGUAGE is now obsolete; use LOCALE and include PalmOptLocale.h"
+
+#ifndef COUNTRY
+ #undef COUNTRY
+#endif
+#define COUNTRY #error "COUNTRY is now obsolete; use LOCALE and include PalmOptLocale.h"
+
+// Moved to <PalmTypes.h>:
+//#if defined(__GNUC__) && defined(__UNIX__)
+// // Ensure that structure elements are 16-bit aligned
+// #pragma pack(2)
+//#endif
+
+#endif
diff --git a/SrcShared/Palm/Platform/Incs/BuildDefines.h b/SrcShared/Palm/Platform/Incs/BuildDefines.h
new file mode 100644
index 0000000..3f0f17d
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/BuildDefines.h
@@ -0,0 +1,159 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: BuildDefines.h
+ *
+ * Description:
+ * Build variable defines for Palm OS.
+ *
+ * This file is included by <BuildDefaults.h>.
+ * It should be included by any local component that wishes
+ * to override any system default compile-time switches.
+ * For more details, refer to <BuildDefaults.h>.
+ *
+ * This file supercedes the old <BuildRules.h> file.
+ *
+ * History:
+ * 07/16/99 SCL So many changes the old history is obsolete.
+ * 07/29/99 kwk Deleted TEXT_SERVICES & INTERNATIONAL_MGR & VENDOR.
+ * 10/04/99 grant Added LOCALE definitions.
+ *
+ *****************************************************************************/
+
+#ifndef __BUILDDEFINES_H__
+#define __BUILDDEFINES_H__
+
+
+/************************************************************
+ * Compilation Control Options
+ *************************************************************/
+
+// The makefile should set the define EMULATION_LEVEL to one of the following
+// constants:
+#define EMULATION_NONE 0 // native environment
+#define EMULATION_WINDOWS 1 // emulate on Windows
+#define EMULATION_DOS 2 // emulate on DOS
+#define EMULATION_MAC 3 // emulate on Macintosh
+#define EMULATION_UNIX 4 // emulate on Linux
+
+
+// If emulation is not EMULATION_NONE, the following define controls
+// whether we are talking to a touchdown device over the serial port,
+// or if we are emulating a memory card in local RAM.
+//
+// The makefile should set the define MEMORY_TYPE to one of the following
+// constants
+#define MEMORY_LOCAL 0 // Emulate using local memory card image
+#define MEMORY_REMOTE 1 // Pass calls through serial port to the device
+
+
+// The makefile should set the define ENVIRONMENT to one of the following:
+#define ENVIRONMENT_CW 0 // CodeWarrior compiler/linker (IDE or MPW)
+#define ENVIRONMENT_MPW 1 // Apple's MPW compiler/linker
+
+
+// The makefile should set the define PLATFORM_TYPE to one of the following
+// constants:
+#define PLATFORM_VIEWER 0 // PalmPilot Viewer
+#define PLATFORM_SERVER 1 // Server code
+
+
+// The makefile should set the define ERROR_CHECK_LEVEL to one of the
+// following constants:
+#define ERROR_CHECK_NONE 0 // compile no error checking code
+#define ERROR_CHECK_PARTIAL 1 // display for fatal errors only
+#define ERROR_CHECK_FULL 2 // display fatal or non-fatal errors
+
+
+// The makefile should set the define CPU_TYPE to one of the
+// following constants:
+#define CPU_68K 0 // Motorola 68K type
+#define CPU_x86 1 // Intel x86 type
+#ifndef PUBLIC_STUFF_STRIPPED
+#define CPU_PPC 2 // Motorola/IBM PowerPC type
+#define CPU_ARM 3 // ARM type
+#endif // PUBLIC_STUFF_STRIPPED
+
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// The makefile should set the define CPU_ENDIAN to one of the following:
+// Note: its not just a define because some processors support both.
+// If CPU_ENDIAN is not defined in the makefile then a default is set
+// based on the CPU_TYPE.
+#define CPU_ENDIAN_BIG 0 // Big endian
+#define CPU_ENDIAN_LITTLE 1 // Little endian
+#endif // PUBLIC_STUFF_STRIPPED
+
+
+// The makefile should set the define MODEL to one of the
+// following constants. This equate is currently only use by
+// special purpose applications like Setup that need to install different
+// files for each type of product. Normally, model dependent behavior
+// should be run-time based off of Features using FtrGet().
+#define MODEL_GENERIC 0 // Not one of the specific models that follow
+#define MODEL_ELEVEN 1 // Eleven (Palm Seven)
+#define MODEL_SUMO 2 // EZ product
+
+
+// The makefile should set the define MEMORY_FORCE_LOCK to one of the
+// following.
+#define MEMORY_FORCE_LOCK_OFF 0 // Don't force all handles to be locked
+#define MEMORY_FORCE_LOCK_ON 1 // Force all handles to be locked before usage
+
+
+// The makefile should set the define DEBUG_LEVEL to one of the
+// following. THIS DEFINE IS ONLY USED BY A COUPLE MODULES SO WE
+// DON'T GIVE IT A DEFAULT VALUE BELOW...
+// ANY MODULE THAT USES THIS DEFINE SHOULD VERIFY THAT IT IS DEFINED!!
+#define DEBUG_LEVEL_NONE 1 // None: Does not auto-launch Console or Debugger
+#define DEBUG_LEVEL_PARTIAL 2 // Partial: Auto-Launches Console but skips debugger
+#define DEBUG_LEVEL_FULL 3 // Full: Waits in debugger on reset
+
+
+// The makefile should set the define DEFAULT_DATA to one of the following:
+// Setting this define to USE_DEFAULT_DATA will cause the core apps to include default
+// data in the build.
+#define DO_NOT_USE_DEFAULT_DATA 0
+#define USE_DEFAULT_DATA 1
+
+
+// The makefile should set the define USER_MODE to one of the
+// following constants:
+#define USER_MODE_NORMAL 0 // normal operation
+#define USER_MODE_DEMO 1 // demo mode - Graffiti and pop-up keyboard disabled
+
+
+// The makefile should set the define INTERNAL_COMMANDS to one of the
+// following constants:
+#define INTERNAL_COMMANDS_EXCLUDE 0
+#define INTERNAL_COMMANDS_INCLUDE 1 // Include internal shell commands
+
+
+// The makefile should set the define INCLUDE_DES to one of the
+// following constants:
+#define INCLUDE_DES_OFF 0
+#define INCLUDE_DES_ON 1 // include it
+
+
+// Used by Net Library to link in the CML encoder
+#define CML_ENCODER_OFF 0
+#define CML_ENCODER_ON 1
+
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// The PalmOptLocale.h file defines LOCALE to be one of these.
+// WARNING!!! Use of LOCALE implies non-international code and/or builds,
+// which is a VERY BAD thing. LOCALE should ONLY be used as a last
+// resort!!!!
+#define LOCALE_enUS 0
+#define LOCALE_deDE 1
+#define LOCALE_esES 2
+#define LOCALE_frFR 3
+#define LOCALE_itIT 4
+#define LOCALE_jpJP 5
+#endif // PUBLIC_STUFF_STRIPPED
+
+
+#endif
diff --git a/SrcShared/Palm/Platform/Incs/Core/CoreTraps.h b/SrcShared/Palm/Platform/Incs/Core/CoreTraps.h
new file mode 100644
index 0000000..93139f4
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/CoreTraps.h
@@ -0,0 +1,1505 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: CoreTraps.h
+ *
+ * Release:
+ *
+ * Description:
+ * Palm OS core trap numbers
+ *
+ * History:
+ * 06/13/95 Created by Ron Marianetti
+ * 06/13/95 RM Created by Ron Marianetti
+ * ??/??/?? ??? Added Rocky changes
+ * 02/04/98 srj Added Hardware LCD Contrast Trap for Razor
+ * 05/05/98 art Reused sysTrapPsrInit, new name sysTrapIntlDispatch.
+ * 06/17/98 jhl mapped NVPrefs to FlashMgr stuff
+ * 07/03/98 kwk Added WinDrawChar, WinDrawTruncChars, and
+ * FntWidthToOffset for Instant Karma.
+ * 07/07/98 srj Added System LCD Contrast Trap for Razor
+ * 08/05/98 scl Cross-merged Razor's SysTraps with Main's
+ * 09/07/98 kwk Added SysWantEvent, EvtPeekEvent traps for
+ * Instant Karma/Razor.
+ * 09/18/98 scl Cross-merged Razor's SysTraps with Main's
+ * 10/13/98 kwk Removed EvtPeekEvent trap.
+ * 10/28/98 scl Cross-merged Razor's SysTraps with Main's
+ * 10/29/98 Bob Move FtrPtr* traps from 3.2 to 3.1
+ * 05/21/99 kwk Added TsmDispatch and OmDispatch traps.
+ * 06/30/99 CS Added DmOpenDBNoOverlay and ResLoadConstant traps.
+ * 07/01/99 kwk Added DmOpenDBWithLocale trap.
+ * 07/09/99 kwk Added HwrGetSilkscreenIID trap.
+ * 07/12/99 kwk Added SysFatalAlertInit trap.
+ * 07/15/99 kwk Added EvtGetSilkscreenAreaList trap.
+ * 07/15/99 bob Moved macros to PalmTypes.h, moved library stuff to LibTraps.h.
+ * 07/28/99 kwk Added DateTemplateToAscii trap.
+ * 09/14/99 gap Removed EvtGetTrapState.
+ * 09/14/99 jed Renamed NotifyMgr trap constants.
+ * 09/16/99 jmp Noted that old Floating Point traps are maintained for
+ * for backwards compatibility only -- i.e., FloatMgr.h now specifies
+ * the new Floating Point dispatched traps.
+ * 09/22/99 jmp Added MenuEraseMenu trap; we won't be creating any public headers
+ * for this routine in 3.5, but we needed to externalize the routine
+ * to fix 3.5-specific issues.
+ * 11/22/00 bob Added FldSetMaxVisibleLines trap
+ *
+ *****************************************************************************/
+
+ #ifndef __CORETRAPS_H_
+ #define __CORETRAPS_H_
+
+// Include elementary types
+#include <PalmTypes.h>
+
+#if CPU_TYPE == CPU_68K
+#include <M68KHwr.h>
+#endif
+
+// Regular traps start here and go up by 1's
+#define sysTrapBase 0xA000
+
+
+#define sysTrapMemInit 0xA000
+#define sysTrapMemInitHeapTable 0xA001
+#define sysTrapMemStoreInit 0xA002
+#define sysTrapMemCardFormat 0xA003
+#define sysTrapMemCardInfo 0xA004
+#define sysTrapMemStoreInfo 0xA005
+#define sysTrapMemStoreSetInfo 0xA006
+#define sysTrapMemNumHeaps 0xA007
+#define sysTrapMemNumRAMHeaps 0xA008
+#define sysTrapMemHeapID 0xA009
+#define sysTrapMemHeapPtr 0xA00A
+#define sysTrapMemHeapFreeBytes 0xA00B
+#define sysTrapMemHeapSize 0xA00C
+#define sysTrapMemHeapFlags 0xA00D
+#define sysTrapMemHeapCompact 0xA00E
+#define sysTrapMemHeapInit 0xA00F
+#define sysTrapMemHeapFreeByOwnerID 0xA010
+#define sysTrapMemChunkNew 0xA011
+#define sysTrapMemChunkFree 0xA012
+#define sysTrapMemPtrNew 0xA013
+#define sysTrapMemPtrRecoverHandle 0xA014
+#define sysTrapMemPtrFlags 0xA015
+#define sysTrapMemPtrSize 0xA016
+#define sysTrapMemPtrOwner 0xA017
+#define sysTrapMemPtrHeapID 0xA018
+#define sysTrapMemPtrCardNo 0xA019
+#define sysTrapMemPtrToLocalID 0xA01A
+#define sysTrapMemPtrSetOwner 0xA01B
+#define sysTrapMemPtrResize 0xA01C
+#define sysTrapMemPtrResetLock 0xA01D
+#define sysTrapMemHandleNew 0xA01E
+#define sysTrapMemHandleLockCount 0xA01F
+#define sysTrapMemHandleToLocalID 0xA020
+#define sysTrapMemHandleLock 0xA021
+#define sysTrapMemHandleUnlock 0xA022
+#define sysTrapMemLocalIDToGlobal 0xA023
+#define sysTrapMemLocalIDKind 0xA024
+#define sysTrapMemLocalIDToPtr 0xA025
+#define sysTrapMemMove 0xA026
+#define sysTrapMemSet 0xA027
+#define sysTrapMemStoreSearch 0xA028
+#define sysTrapSysReserved10Trap1 0xA029 /* "Reserved" trap in Palm OS 1.0 and later (was sysTrapMemPtrDataStorage) */
+
+#define sysTrapMemKernelInit 0xA02A
+#define sysTrapMemHandleFree 0xA02B
+#define sysTrapMemHandleFlags 0xA02C
+#define sysTrapMemHandleSize 0xA02D
+#define sysTrapMemHandleOwner 0xA02E
+#define sysTrapMemHandleHeapID 0xA02F
+#define sysTrapMemHandleDataStorage 0xA030
+#define sysTrapMemHandleCardNo 0xA031
+#define sysTrapMemHandleSetOwner 0xA032
+#define sysTrapMemHandleResize 0xA033
+#define sysTrapMemHandleResetLock 0xA034
+#define sysTrapMemPtrUnlock 0xA035
+#define sysTrapMemLocalIDToLockedPtr 0xA036
+#define sysTrapMemSetDebugMode 0xA037
+#define sysTrapMemHeapScramble 0xA038
+#define sysTrapMemHeapCheck 0xA039
+#define sysTrapMemNumCards 0xA03A
+#define sysTrapMemDebugMode 0xA03B
+#define sysTrapMemSemaphoreReserve 0xA03C
+#define sysTrapMemSemaphoreRelease 0xA03D
+#define sysTrapMemHeapDynamic 0xA03E
+#define sysTrapMemNVParams 0xA03F
+
+
+#define sysTrapDmInit 0xA040
+#define sysTrapDmCreateDatabase 0xA041
+#define sysTrapDmDeleteDatabase 0xA042
+#define sysTrapDmNumDatabases 0xA043
+#define sysTrapDmGetDatabase 0xA044
+#define sysTrapDmFindDatabase 0xA045
+#define sysTrapDmDatabaseInfo 0xA046
+#define sysTrapDmSetDatabaseInfo 0xA047
+#define sysTrapDmDatabaseSize 0xA048
+#define sysTrapDmOpenDatabase 0xA049
+#define sysTrapDmCloseDatabase 0xA04A
+#define sysTrapDmNextOpenDatabase 0xA04B
+#define sysTrapDmOpenDatabaseInfo 0xA04C
+#define sysTrapDmResetRecordStates 0xA04D
+#define sysTrapDmGetLastErr 0xA04E
+#define sysTrapDmNumRecords 0xA04F
+#define sysTrapDmRecordInfo 0xA050
+#define sysTrapDmSetRecordInfo 0xA051
+#define sysTrapDmAttachRecord 0xA052
+#define sysTrapDmDetachRecord 0xA053
+#define sysTrapDmMoveRecord 0xA054
+#define sysTrapDmNewRecord 0xA055
+#define sysTrapDmRemoveRecord 0xA056
+#define sysTrapDmDeleteRecord 0xA057
+#define sysTrapDmArchiveRecord 0xA058
+#define sysTrapDmNewHandle 0xA059
+#define sysTrapDmRemoveSecretRecords 0xA05A
+#define sysTrapDmQueryRecord 0xA05B
+#define sysTrapDmGetRecord 0xA05C
+#define sysTrapDmResizeRecord 0xA05D
+#define sysTrapDmReleaseRecord 0xA05E
+#define sysTrapDmGetResource 0xA05F
+#define sysTrapDmGet1Resource 0xA060
+#define sysTrapDmReleaseResource 0xA061
+#define sysTrapDmResizeResource 0xA062
+#define sysTrapDmNextOpenResDatabase 0xA063
+#define sysTrapDmFindResourceType 0xA064
+#define sysTrapDmFindResource 0xA065
+#define sysTrapDmSearchResource 0xA066
+#define sysTrapDmNumResources 0xA067
+#define sysTrapDmResourceInfo 0xA068
+#define sysTrapDmSetResourceInfo 0xA069
+#define sysTrapDmAttachResource 0xA06A
+#define sysTrapDmDetachResource 0xA06B
+#define sysTrapDmNewResource 0xA06C
+#define sysTrapDmRemoveResource 0xA06D
+#define sysTrapDmGetResourceIndex 0xA06E
+#define sysTrapDmQuickSort 0xA06F
+#define sysTrapDmQueryNextInCategory 0xA070
+#define sysTrapDmNumRecordsInCategory 0xA071
+#define sysTrapDmPositionInCategory 0xA072
+#define sysTrapDmSeekRecordInCategory 0xA073
+#define sysTrapDmMoveCategory 0xA074
+#define sysTrapDmOpenDatabaseByTypeCreator 0xA075
+#define sysTrapDmWrite 0xA076
+#define sysTrapDmStrCopy 0xA077
+#define sysTrapDmGetNextDatabaseByTypeCreator 0xA078
+#define sysTrapDmWriteCheck 0xA079
+#define sysTrapDmMoveOpenDBContext 0xA07A
+#define sysTrapDmFindRecordByID 0xA07B
+#define sysTrapDmGetAppInfoID 0xA07C
+#define sysTrapDmFindSortPositionV10 0xA07D
+#define sysTrapDmSet 0xA07E
+#define sysTrapDmCreateDatabaseFromImage 0xA07F
+
+
+#define sysTrapDbgSrcMessage 0xA080
+#define sysTrapDbgMessage 0xA081
+#define sysTrapDbgGetMessage 0xA082
+#define sysTrapDbgCommSettings 0xA083
+
+#define sysTrapErrDisplayFileLineMsg 0xA084
+#define sysTrapErrSetJump 0xA085
+#define sysTrapErrLongJump 0xA086
+#define sysTrapErrThrow 0xA087
+#define sysTrapErrExceptionList 0xA088
+
+#define sysTrapSysBroadcastActionCode 0xA089
+#define sysTrapSysUnimplemented 0xA08A
+#define sysTrapSysColdBoot 0xA08B
+#define sysTrapSysReset 0xA08C
+#define sysTrapSysDoze 0xA08D
+#define sysTrapSysAppLaunch 0xA08E
+#define sysTrapSysAppStartup 0xA08F
+#define sysTrapSysAppExit 0xA090
+#define sysTrapSysSetA5 0xA091
+#define sysTrapSysSetTrapAddress 0xA092
+#define sysTrapSysGetTrapAddress 0xA093
+#define sysTrapSysTranslateKernelErr 0xA094
+#define sysTrapSysSemaphoreCreate 0xA095
+#define sysTrapSysSemaphoreDelete 0xA096
+#define sysTrapSysSemaphoreWait 0xA097
+#define sysTrapSysSemaphoreSignal 0xA098
+#define sysTrapSysTimerCreate 0xA099
+#define sysTrapSysTimerWrite 0xA09A
+#define sysTrapSysTaskCreate 0xA09B
+#define sysTrapSysTaskDelete 0xA09C
+#define sysTrapSysTaskTrigger 0xA09D
+#define sysTrapSysTaskID 0xA09E
+#define sysTrapSysTaskUserInfoPtr 0xA09F
+#define sysTrapSysTaskDelay 0xA0A0
+#define sysTrapSysTaskSetTermProc 0xA0A1
+#define sysTrapSysUILaunch 0xA0A2
+#define sysTrapSysNewOwnerID 0xA0A3
+#define sysTrapSysSemaphoreSet 0xA0A4
+#define sysTrapSysDisableInts 0xA0A5
+#define sysTrapSysRestoreStatus 0xA0A6
+#define sysTrapSysUIAppSwitch 0xA0A7
+#define sysTrapSysCurAppInfoPV20 0xA0A8
+#define sysTrapSysHandleEvent 0xA0A9
+#define sysTrapSysInit 0xA0AA
+#define sysTrapSysQSort 0xA0AB
+#define sysTrapSysCurAppDatabase 0xA0AC
+#define sysTrapSysFatalAlert 0xA0AD
+#define sysTrapSysResSemaphoreCreate 0xA0AE
+#define sysTrapSysResSemaphoreDelete 0xA0AF
+#define sysTrapSysResSemaphoreReserve 0xA0B0
+#define sysTrapSysResSemaphoreRelease 0xA0B1
+#define sysTrapSysSleep 0xA0B2
+#define sysTrapSysKeyboardDialogV10 0xA0B3
+#define sysTrapSysAppLauncherDialog 0xA0B4
+#define sysTrapSysSetPerformance 0xA0B5
+#define sysTrapSysBatteryInfoV20 0xA0B6
+#define sysTrapSysLibInstall 0xA0B7
+#define sysTrapSysLibRemove 0xA0B8
+#define sysTrapSysLibTblEntry 0xA0B9
+#define sysTrapSysLibFind 0xA0BA
+#define sysTrapSysBatteryDialog 0xA0BB
+#define sysTrapSysCopyStringResource 0xA0BC
+#define sysTrapSysKernelInfo 0xA0BD
+#define sysTrapSysLaunchConsole 0xA0BE
+#define sysTrapSysTimerDelete 0xA0BF
+#define sysTrapSysSetAutoOffTime 0xA0C0
+#define sysTrapSysFormPointerArrayToStrings 0xA0C1
+#define sysTrapSysRandom 0xA0C2
+#define sysTrapSysTaskSwitching 0xA0C3
+#define sysTrapSysTimerRead 0xA0C4
+
+
+#define sysTrapStrCopy 0xA0C5
+#define sysTrapStrCat 0xA0C6
+#define sysTrapStrLen 0xA0C7
+#define sysTrapStrCompare 0xA0C8
+#define sysTrapStrIToA 0xA0C9
+#define sysTrapStrCaselessCompare 0xA0CA
+#define sysTrapStrIToH 0xA0CB
+#define sysTrapStrChr 0xA0CC
+#define sysTrapStrStr 0xA0CD
+#define sysTrapStrAToI 0xA0CE
+#define sysTrapStrToLower 0xA0CF
+
+#define sysTrapSerReceiveISP 0xA0D0
+
+#define sysTrapSlkOpen 0xA0D1
+#define sysTrapSlkClose 0xA0D2
+#define sysTrapSlkOpenSocket 0xA0D3
+#define sysTrapSlkCloseSocket 0xA0D4
+#define sysTrapSlkSocketRefNum 0xA0D5
+#define sysTrapSlkSocketSetTimeout 0xA0D6
+#define sysTrapSlkFlushSocket 0xA0D7
+#define sysTrapSlkSetSocketListener 0xA0D8
+#define sysTrapSlkSendPacket 0xA0D9
+#define sysTrapSlkReceivePacket 0xA0DA
+#define sysTrapSlkSysPktDefaultResponse 0xA0DB
+#define sysTrapSlkProcessRPC 0xA0DC
+
+
+#define sysTrapConPutS 0xA0DD
+#define sysTrapConGetS 0xA0DE
+
+#define sysTrapFplInit 0xA0DF /* Obsolete, here for compatibilty only! */
+#define sysTrapFplFree 0xA0E0 /* Obsolete, here for compatibilty only! */
+#define sysTrapFplFToA 0xA0E1 /* Obsolete, here for compatibilty only! */
+#define sysTrapFplAToF 0xA0E2 /* Obsolete, here for compatibilty only! */
+#define sysTrapFplBase10Info 0xA0E3 /* Obsolete, here for compatibilty only! */
+#define sysTrapFplLongToFloat 0xA0E4 /* Obsolete, here for compatibilty only! */
+#define sysTrapFplFloatToLong 0xA0E5 /* Obsolete, here for compatibilty only! */
+#define sysTrapFplFloatToULong 0xA0E6 /* Obsolete, here for compatibilty only! */
+#define sysTrapFplMul 0xA0E7 /* Obsolete, here for compatibilty only! */
+#define sysTrapFplAdd 0xA0E8 /* Obsolete, here for compatibilty only! */
+#define sysTrapFplSub 0xA0E9 /* Obsolete, here for compatibilty only! */
+#define sysTrapFplDiv 0xA0EA /* Obsolete, here for compatibilty only! */
+
+#define sysTrapWinScreenInit 0xA0EB /* was sysTrapScrInit */
+#define sysTrapScrCopyRectangle 0xA0EC
+#define sysTrapScrDrawChars 0xA0ED
+#define sysTrapScrLineRoutine 0xA0EE
+#define sysTrapScrRectangleRoutine 0xA0EF
+#define sysTrapScrScreenInfo 0xA0F0
+#define sysTrapScrDrawNotify 0xA0F1
+#define sysTrapScrSendUpdateArea 0xA0F2
+#define sysTrapScrCompressScanLine 0xA0F3
+#define sysTrapScrDeCompressScanLine 0xA0F4
+
+
+#define sysTrapTimGetSeconds 0xA0F5
+#define sysTrapTimSetSeconds 0xA0F6
+#define sysTrapTimGetTicks 0xA0F7
+#define sysTrapTimInit 0xA0F8
+#define sysTrapTimSetAlarm 0xA0F9
+#define sysTrapTimGetAlarm 0xA0FA
+#define sysTrapTimHandleInterrupt 0xA0FB
+#define sysTrapTimSecondsToDateTime 0xA0FC
+#define sysTrapTimDateTimeToSeconds 0xA0FD
+#define sysTrapTimAdjust 0xA0FE
+#define sysTrapTimSleep 0xA0FF
+#define sysTrapTimWake 0xA100
+
+#define sysTrapCategoryCreateListV10 0xA101
+#define sysTrapCategoryFreeListV10 0xA102
+#define sysTrapCategoryFind 0xA103
+#define sysTrapCategoryGetName 0xA104
+#define sysTrapCategoryEditV10 0xA105
+#define sysTrapCategorySelectV10 0xA106
+#define sysTrapCategoryGetNext 0xA107
+#define sysTrapCategorySetTriggerLabel 0xA108
+#define sysTrapCategoryTruncateName 0xA109
+
+#define sysTrapClipboardAddItem 0xA10A
+#define sysTrapClipboardCheckIfItemExist 0xA10B
+#define sysTrapClipboardGetItem 0xA10C
+
+#define sysTrapCtlDrawControl 0xA10D
+#define sysTrapCtlEraseControl 0xA10E
+#define sysTrapCtlHideControl 0xA10F
+#define sysTrapCtlShowControl 0xA110
+#define sysTrapCtlGetValue 0xA111
+#define sysTrapCtlSetValue 0xA112
+#define sysTrapCtlGetLabel 0xA113
+#define sysTrapCtlSetLabel 0xA114
+#define sysTrapCtlHandleEvent 0xA115
+#define sysTrapCtlHitControl 0xA116
+#define sysTrapCtlSetEnabled 0xA117
+#define sysTrapCtlSetUsable 0xA118
+#define sysTrapCtlEnabled 0xA119
+
+
+#define sysTrapEvtInitialize 0xA11A
+#define sysTrapEvtAddEventToQueue 0xA11B
+#define sysTrapEvtCopyEvent 0xA11C
+#define sysTrapEvtGetEvent 0xA11D
+#define sysTrapEvtGetPen 0xA11E
+#define sysTrapEvtSysInit 0xA11F
+#define sysTrapEvtGetSysEvent 0xA120
+#define sysTrapEvtProcessSoftKeyStroke 0xA121
+#define sysTrapEvtGetPenBtnList 0xA122
+#define sysTrapEvtSetPenQueuePtr 0xA123
+#define sysTrapEvtPenQueueSize 0xA124
+#define sysTrapEvtFlushPenQueue 0xA125
+#define sysTrapEvtEnqueuePenPoint 0xA126
+#define sysTrapEvtDequeuePenStrokeInfo 0xA127
+#define sysTrapEvtDequeuePenPoint 0xA128
+#define sysTrapEvtFlushNextPenStroke 0xA129
+#define sysTrapEvtSetKeyQueuePtr 0xA12A
+#define sysTrapEvtKeyQueueSize 0xA12B
+#define sysTrapEvtFlushKeyQueue 0xA12C
+#define sysTrapEvtEnqueueKey 0xA12D
+#define sysTrapEvtDequeueKeyEvent 0xA12E
+#define sysTrapEvtWakeup 0xA12F
+#define sysTrapEvtResetAutoOffTimer 0xA130
+#define sysTrapEvtKeyQueueEmpty 0xA131
+#define sysTrapEvtEnableGraffiti 0xA132
+
+
+#define sysTrapFldCopy 0xA133
+#define sysTrapFldCut 0xA134
+#define sysTrapFldDrawField 0xA135
+#define sysTrapFldEraseField 0xA136
+#define sysTrapFldFreeMemory 0xA137
+#define sysTrapFldGetBounds 0xA138
+#define sysTrapFldGetTextPtr 0xA139
+#define sysTrapFldGetSelection 0xA13A
+#define sysTrapFldHandleEvent 0xA13B
+#define sysTrapFldPaste 0xA13C
+#define sysTrapFldRecalculateField 0xA13D
+#define sysTrapFldSetBounds 0xA13E
+#define sysTrapFldSetText 0xA13F
+#define sysTrapFldGetFont 0xA140
+#define sysTrapFldSetFont 0xA141
+#define sysTrapFldSetSelection 0xA142
+#define sysTrapFldGrabFocus 0xA143
+#define sysTrapFldReleaseFocus 0xA144
+#define sysTrapFldGetInsPtPosition 0xA145
+#define sysTrapFldSetInsPtPosition 0xA146
+#define sysTrapFldSetScrollPosition 0xA147
+#define sysTrapFldGetScrollPosition 0xA148
+#define sysTrapFldGetTextHeight 0xA149
+#define sysTrapFldGetTextAllocatedSize 0xA14A
+#define sysTrapFldGetTextLength 0xA14B
+#define sysTrapFldScrollField 0xA14C
+#define sysTrapFldScrollable 0xA14D
+#define sysTrapFldGetVisibleLines 0xA14E
+#define sysTrapFldGetAttributes 0xA14F
+#define sysTrapFldSetAttributes 0xA150
+#define sysTrapFldSendChangeNotification 0xA151
+#define sysTrapFldCalcFieldHeight 0xA152
+#define sysTrapFldGetTextHandle 0xA153
+#define sysTrapFldCompactText 0xA154
+#define sysTrapFldDirty 0xA155
+#define sysTrapFldWordWrap 0xA156
+#define sysTrapFldSetTextAllocatedSize 0xA157
+#define sysTrapFldSetTextHandle 0xA158
+#define sysTrapFldSetTextPtr 0xA159
+#define sysTrapFldGetMaxChars 0xA15A
+#define sysTrapFldSetMaxChars 0xA15B
+#define sysTrapFldSetUsable 0xA15C
+#define sysTrapFldInsert 0xA15D
+#define sysTrapFldDelete 0xA15E
+#define sysTrapFldUndo 0xA15F
+#define sysTrapFldSetDirty 0xA160
+#define sysTrapFldSendHeightChangeNotification 0xA161
+#define sysTrapFldMakeFullyVisible 0xA162
+
+
+#define sysTrapFntGetFont 0xA163
+#define sysTrapFntSetFont 0xA164
+#define sysTrapFntGetFontPtr 0xA165
+#define sysTrapFntBaseLine 0xA166
+#define sysTrapFntCharHeight 0xA167
+#define sysTrapFntLineHeight 0xA168
+#define sysTrapFntAverageCharWidth 0xA169
+#define sysTrapFntCharWidth 0xA16A
+#define sysTrapFntCharsWidth 0xA16B
+#define sysTrapFntDescenderHeight 0xA16C
+#define sysTrapFntCharsInWidth 0xA16D
+#define sysTrapFntLineWidth 0xA16E
+
+
+#define sysTrapFrmInitForm 0xA16F
+#define sysTrapFrmDeleteForm 0xA170
+#define sysTrapFrmDrawForm 0xA171
+#define sysTrapFrmEraseForm 0xA172
+#define sysTrapFrmGetActiveForm 0xA173
+#define sysTrapFrmSetActiveForm 0xA174
+#define sysTrapFrmGetActiveFormID 0xA175
+#define sysTrapFrmGetUserModifiedState 0xA176
+#define sysTrapFrmSetNotUserModified 0xA177
+#define sysTrapFrmGetFocus 0xA178
+#define sysTrapFrmSetFocus 0xA179
+#define sysTrapFrmHandleEvent 0xA17A
+#define sysTrapFrmGetFormBounds 0xA17B
+#define sysTrapFrmGetWindowHandle 0xA17C
+#define sysTrapFrmGetFormId 0xA17D
+#define sysTrapFrmGetFormPtr 0xA17E
+#define sysTrapFrmGetNumberOfObjects 0xA17F
+#define sysTrapFrmGetObjectIndex 0xA180
+#define sysTrapFrmGetObjectId 0xA181
+#define sysTrapFrmGetObjectType 0xA182
+#define sysTrapFrmGetObjectPtr 0xA183
+#define sysTrapFrmHideObject 0xA184
+#define sysTrapFrmShowObject 0xA185
+#define sysTrapFrmGetObjectPosition 0xA186
+#define sysTrapFrmSetObjectPosition 0xA187
+#define sysTrapFrmGetControlValue 0xA188
+#define sysTrapFrmSetControlValue 0xA189
+#define sysTrapFrmGetControlGroupSelection 0xA18A
+#define sysTrapFrmSetControlGroupSelection 0xA18B
+#define sysTrapFrmCopyLabel 0xA18C
+#define sysTrapFrmSetLabel 0xA18D
+#define sysTrapFrmGetLabel 0xA18E
+#define sysTrapFrmSetCategoryLabel 0xA18F
+#define sysTrapFrmGetTitle 0xA190
+#define sysTrapFrmSetTitle 0xA191
+#define sysTrapFrmAlert 0xA192
+#define sysTrapFrmDoDialog 0xA193
+#define sysTrapFrmCustomAlert 0xA194
+#define sysTrapFrmHelp 0xA195
+#define sysTrapFrmUpdateScrollers 0xA196
+#define sysTrapFrmGetFirstForm 0xA197
+#define sysTrapFrmVisible 0xA198
+#define sysTrapFrmGetObjectBounds 0xA199
+#define sysTrapFrmCopyTitle 0xA19A
+#define sysTrapFrmGotoForm 0xA19B
+#define sysTrapFrmPopupForm 0xA19C
+#define sysTrapFrmUpdateForm 0xA19D
+#define sysTrapFrmReturnToForm 0xA19E
+#define sysTrapFrmSetEventHandler 0xA19F
+#define sysTrapFrmDispatchEvent 0xA1A0
+#define sysTrapFrmCloseAllForms 0xA1A1
+#define sysTrapFrmSaveAllForms 0xA1A2
+#define sysTrapFrmGetGadgetData 0xA1A3
+#define sysTrapFrmSetGadgetData 0xA1A4
+#define sysTrapFrmSetCategoryTrigger 0xA1A5
+
+
+#define sysTrapUIInitialize 0xA1A6
+#define sysTrapUIReset 0xA1A7
+
+#define sysTrapInsPtInitialize 0xA1A8
+#define sysTrapInsPtSetLocation 0xA1A9
+#define sysTrapInsPtGetLocation 0xA1AA
+#define sysTrapInsPtEnable 0xA1AB
+#define sysTrapInsPtEnabled 0xA1AC
+#define sysTrapInsPtSetHeight 0xA1AD
+#define sysTrapInsPtGetHeight 0xA1AE
+#define sysTrapInsPtCheckBlink 0xA1AF
+
+#define sysTrapLstSetDrawFunction 0xA1B0
+#define sysTrapLstDrawList 0xA1B1
+#define sysTrapLstEraseList 0xA1B2
+#define sysTrapLstGetSelection 0xA1B3
+#define sysTrapLstGetSelectionText 0xA1B4
+#define sysTrapLstHandleEvent 0xA1B5
+#define sysTrapLstSetHeight 0xA1B6
+#define sysTrapLstSetSelection 0xA1B7
+#define sysTrapLstSetListChoices 0xA1B8
+#define sysTrapLstMakeItemVisible 0xA1B9
+#define sysTrapLstGetNumberOfItems 0xA1BA
+#define sysTrapLstPopupList 0xA1BB
+#define sysTrapLstSetPosition 0xA1BC
+
+#define sysTrapMenuInit 0xA1BD
+#define sysTrapMenuDispose 0xA1BE
+#define sysTrapMenuHandleEvent 0xA1BF
+#define sysTrapMenuDrawMenu 0xA1C0
+#define sysTrapMenuEraseStatus 0xA1C1
+#define sysTrapMenuGetActiveMenu 0xA1C2
+#define sysTrapMenuSetActiveMenu 0xA1C3
+
+
+#define sysTrapRctSetRectangle 0xA1C4
+#define sysTrapRctCopyRectangle 0xA1C5
+#define sysTrapRctInsetRectangle 0xA1C6
+#define sysTrapRctOffsetRectangle 0xA1C7
+#define sysTrapRctPtInRectangle 0xA1C8
+#define sysTrapRctGetIntersection 0xA1C9
+
+
+#define sysTrapTblDrawTable 0xA1CA
+#define sysTrapTblEraseTable 0xA1CB
+#define sysTrapTblHandleEvent 0xA1CC
+#define sysTrapTblGetItemBounds 0xA1CD
+#define sysTrapTblSelectItem 0xA1CE
+#define sysTrapTblGetItemInt 0xA1CF
+#define sysTrapTblSetItemInt 0xA1D0
+#define sysTrapTblSetItemStyle 0xA1D1
+#define sysTrapTblUnhighlightSelection 0xA1D2
+#define sysTrapTblSetRowUsable 0xA1D3
+#define sysTrapTblGetNumberOfRows 0xA1D4
+#define sysTrapTblSetCustomDrawProcedure 0xA1D5
+#define sysTrapTblSetRowSelectable 0xA1D6
+#define sysTrapTblRowSelectable 0xA1D7
+#define sysTrapTblSetLoadDataProcedure 0xA1D8
+#define sysTrapTblSetSaveDataProcedure 0xA1D9
+#define sysTrapTblGetBounds 0xA1DA
+#define sysTrapTblSetRowHeight 0xA1DB
+#define sysTrapTblGetColumnWidth 0xA1DC
+#define sysTrapTblGetRowID 0xA1DD
+#define sysTrapTblSetRowID 0xA1DE
+#define sysTrapTblMarkRowInvalid 0xA1DF
+#define sysTrapTblMarkTableInvalid 0xA1E0
+#define sysTrapTblGetSelection 0xA1E1
+#define sysTrapTblInsertRow 0xA1E2
+#define sysTrapTblRemoveRow 0xA1E3
+#define sysTrapTblRowInvalid 0xA1E4
+#define sysTrapTblRedrawTable 0xA1E5
+#define sysTrapTblRowUsable 0xA1E6
+#define sysTrapTblReleaseFocus 0xA1E7
+#define sysTrapTblEditing 0xA1E8
+#define sysTrapTblGetCurrentField 0xA1E9
+#define sysTrapTblSetColumnUsable 0xA1EA
+#define sysTrapTblGetRowHeight 0xA1EB
+#define sysTrapTblSetColumnWidth 0xA1EC
+#define sysTrapTblGrabFocus 0xA1ED
+#define sysTrapTblSetItemPtr 0xA1EE
+#define sysTrapTblFindRowID 0xA1EF
+#define sysTrapTblGetLastUsableRow 0xA1F0
+#define sysTrapTblGetColumnSpacing 0xA1F1
+#define sysTrapTblFindRowData 0xA1F2
+#define sysTrapTblGetRowData 0xA1F3
+#define sysTrapTblSetRowData 0xA1F4
+#define sysTrapTblSetColumnSpacing 0xA1F5
+
+
+
+#define sysTrapWinCreateWindow 0xA1F6
+#define sysTrapWinCreateOffscreenWindow 0xA1F7
+#define sysTrapWinDeleteWindow 0xA1F8
+#define sysTrapWinInitializeWindow 0xA1F9
+#define sysTrapWinAddWindow 0xA1FA
+#define sysTrapWinRemoveWindow 0xA1FB
+#define sysTrapWinSetActiveWindow 0xA1FC
+#define sysTrapWinSetDrawWindow 0xA1FD
+#define sysTrapWinGetDrawWindow 0xA1FE
+#define sysTrapWinGetActiveWindow 0xA1FF
+#define sysTrapWinGetDisplayWindow 0xA200
+#define sysTrapWinGetFirstWindow 0xA201
+#define sysTrapWinEnableWindow 0xA202
+#define sysTrapWinDisableWindow 0xA203
+#define sysTrapWinGetWindowFrameRect 0xA204
+#define sysTrapWinDrawWindowFrame 0xA205
+#define sysTrapWinEraseWindow 0xA206
+#define sysTrapWinSaveBits 0xA207
+#define sysTrapWinRestoreBits 0xA208
+#define sysTrapWinCopyRectangle 0xA209
+#define sysTrapWinScrollRectangle 0xA20A
+#define sysTrapWinGetDisplayExtent 0xA20B
+#define sysTrapWinGetWindowExtent 0xA20C
+#define sysTrapWinDisplayToWindowPt 0xA20D
+#define sysTrapWinWindowToDisplayPt 0xA20E
+#define sysTrapWinGetClip 0xA20F
+#define sysTrapWinSetClip 0xA210
+#define sysTrapWinResetClip 0xA211
+#define sysTrapWinClipRectangle 0xA212
+#define sysTrapWinDrawLine 0xA213
+#define sysTrapWinDrawGrayLine 0xA214
+#define sysTrapWinEraseLine 0xA215
+#define sysTrapWinInvertLine 0xA216
+#define sysTrapWinFillLine 0xA217
+#define sysTrapWinDrawRectangle 0xA218
+#define sysTrapWinEraseRectangle 0xA219
+#define sysTrapWinInvertRectangle 0xA21A
+#define sysTrapWinDrawRectangleFrame 0xA21B
+#define sysTrapWinDrawGrayRectangleFrame 0xA21C
+#define sysTrapWinEraseRectangleFrame 0xA21D
+#define sysTrapWinInvertRectangleFrame 0xA21E
+#define sysTrapWinGetFramesRectangle 0xA21F
+#define sysTrapWinDrawChars 0xA220
+#define sysTrapWinEraseChars 0xA221
+#define sysTrapWinInvertChars 0xA222
+#define sysTrapWinGetPattern 0xA223
+#define sysTrapWinSetPattern 0xA224
+#define sysTrapWinSetUnderlineMode 0xA225
+#define sysTrapWinDrawBitmap 0xA226
+#define sysTrapWinModal 0xA227
+#define sysTrapWinGetDrawWindowBounds 0xA228
+#define sysTrapWinFillRectangle 0xA229
+#define sysTrapWinDrawInvertedChars 0xA22A
+
+
+
+#define sysTrapPrefOpenPreferenceDBV10 0xA22B
+#define sysTrapPrefGetPreferences 0xA22C
+#define sysTrapPrefSetPreferences 0xA22D
+#define sysTrapPrefGetAppPreferencesV10 0xA22E
+#define sysTrapPrefSetAppPreferencesV10 0xA22F
+
+
+#define sysTrapSndInit 0xA230
+#define sysTrapSndSetDefaultVolume 0xA231
+#define sysTrapSndGetDefaultVolume 0xA232
+#define sysTrapSndDoCmd 0xA233
+#define sysTrapSndPlaySystemSound 0xA234
+
+
+#define sysTrapAlmInit 0xA235
+#define sysTrapAlmCancelAll 0xA236
+#define sysTrapAlmAlarmCallback 0xA237
+#define sysTrapAlmSetAlarm 0xA238
+#define sysTrapAlmGetAlarm 0xA239
+#define sysTrapAlmDisplayAlarm 0xA23A
+#define sysTrapAlmEnableNotification 0xA23B
+
+
+#define sysTrapHwrGetRAMMapping 0xA23C
+#define sysTrapHwrMemWritable 0xA23D
+#define sysTrapHwrMemReadable 0xA23E
+#define sysTrapHwrDoze 0xA23F
+#define sysTrapHwrSleep 0xA240
+#define sysTrapHwrWake 0xA241
+#define sysTrapHwrSetSystemClock 0xA242
+#define sysTrapHwrSetCPUDutyCycle 0xA243
+#define sysTrapHwrDisplayInit 0xA244 /* Before OS 3.5, this trap a.k.a. sysTrapHwrLCDInit */
+#define sysTrapHwrDisplaySleep 0xA245 /* Before OS 3.5, this trap a.k.a. sysTrapHwrLCDSleep, */
+#define sysTrapHwrTimerInit 0xA246
+#define sysTrapHwrCursorV33 0xA247 /* This trap obsoleted for OS 3.5 and later */
+#define sysTrapHwrBatteryLevel 0xA248
+#define sysTrapHwrDelay 0xA249
+#define sysTrapHwrEnableDataWrites 0xA24A
+#define sysTrapHwrDisableDataWrites 0xA24B
+#define sysTrapHwrLCDBaseAddrV33 0xA24C /* This trap obsoleted for OS 3.5 and later */
+#define sysTrapHwrDisplayDrawBootScreen 0xA24D /* Before OS 3.5, this trap a.k.a. sysTrapHwrLCDDrawBitmap */
+#define sysTrapHwrTimerSleep 0xA24E
+#define sysTrapHwrTimerWake 0xA24F
+#define sysTrapHwrDisplayWake 0xA250 /* Before OS 3.5, this trap a.k.a. sysTrapHwrLCDWake */
+#define sysTrapHwrIRQ1Handler 0xA251
+#define sysTrapHwrIRQ2Handler 0xA252
+#define sysTrapHwrIRQ3Handler 0xA253
+#define sysTrapHwrIRQ4Handler 0xA254
+#define sysTrapHwrIRQ5Handler 0xA255
+#define sysTrapHwrIRQ6Handler 0xA256
+#define sysTrapHwrDockSignals 0xA257
+#define sysTrapHwrPluggedIn 0xA258
+
+
+#define sysTrapCrc16CalcBlock 0xA259
+
+
+#define sysTrapSelectDayV10 0xA25A
+#define sysTrapSelectTimeV33 0xA25B
+
+#define sysTrapDayDrawDaySelector 0xA25C
+#define sysTrapDayHandleEvent 0xA25D
+#define sysTrapDayDrawDays 0xA25E
+#define sysTrapDayOfWeek 0xA25F
+#define sysTrapDaysInMonth 0xA260
+#define sysTrapDayOfMonth 0xA261
+
+#define sysTrapDateDaysToDate 0xA262
+#define sysTrapDateToDays 0xA263
+#define sysTrapDateAdjust 0xA264
+#define sysTrapDateSecondsToDate 0xA265
+#define sysTrapDateToAscii 0xA266
+#define sysTrapDateToDOWDMFormat 0xA267
+#define sysTrapTimeToAscii 0xA268
+
+
+#define sysTrapFind 0xA269
+#define sysTrapFindStrInStr 0xA26A
+#define sysTrapFindSaveMatch 0xA26B
+#define sysTrapFindGetLineBounds 0xA26C
+#define sysTrapFindDrawHeader 0xA26D
+
+#define sysTrapPenOpen 0xA26E
+#define sysTrapPenClose 0xA26F
+#define sysTrapPenGetRawPen 0xA270
+#define sysTrapPenCalibrate 0xA271
+#define sysTrapPenRawToScreen 0xA272
+#define sysTrapPenScreenToRaw 0xA273
+#define sysTrapPenResetCalibration 0xA274
+#define sysTrapPenSleep 0xA275
+#define sysTrapPenWake 0xA276
+
+
+#define sysTrapResLoadForm 0xA277
+#define sysTrapResLoadMenu 0xA278
+
+#define sysTrapFtrInit 0xA279
+#define sysTrapFtrUnregister 0xA27A
+#define sysTrapFtrGet 0xA27B
+#define sysTrapFtrSet 0xA27C
+#define sysTrapFtrGetByIndex 0xA27D
+
+
+
+#define sysTrapGrfInit 0xA27E
+#define sysTrapGrfFree 0xA27F
+#define sysTrapGrfGetState 0xA280
+#define sysTrapGrfSetState 0xA281
+#define sysTrapGrfFlushPoints 0xA282
+#define sysTrapGrfAddPoint 0xA283
+#define sysTrapGrfInitState 0xA284
+#define sysTrapGrfCleanState 0xA285
+#define sysTrapGrfMatch 0xA286
+#define sysTrapGrfGetMacro 0xA287
+#define sysTrapGrfFilterPoints 0xA288
+#define sysTrapGrfGetNumPoints 0xA289
+#define sysTrapGrfGetPoint 0xA28A
+#define sysTrapGrfFindBranch 0xA28B
+#define sysTrapGrfMatchGlyph 0xA28C
+#define sysTrapGrfGetGlyphMapping 0xA28D
+#define sysTrapGrfGetMacroName 0xA28E
+#define sysTrapGrfDeleteMacro 0xA28F
+#define sysTrapGrfAddMacro 0xA290
+#define sysTrapGrfGetAndExpandMacro 0xA291
+#define sysTrapGrfProcessStroke 0xA292
+#define sysTrapGrfFieldChange 0xA293
+
+
+#define sysTrapGetCharSortValue 0xA294
+#define sysTrapGetCharAttr 0xA295
+#define sysTrapGetCharCaselessValue 0xA296
+
+
+#define sysTrapPwdExists 0xA297
+#define sysTrapPwdVerify 0xA298
+#define sysTrapPwdSet 0xA299
+#define sysTrapPwdRemove 0xA29A
+
+#define sysTrapGsiInitialize 0xA29B
+#define sysTrapGsiSetLocation 0xA29C
+#define sysTrapGsiEnable 0xA29D
+#define sysTrapGsiEnabled 0xA29E
+#define sysTrapGsiSetShiftState 0xA29F
+
+#define sysTrapKeyInit 0xA2A0
+#define sysTrapKeyHandleInterrupt 0xA2A1
+#define sysTrapKeyCurrentState 0xA2A2
+#define sysTrapKeyResetDoubleTap 0xA2A3
+#define sysTrapKeyRates 0xA2A4
+#define sysTrapKeySleep 0xA2A5
+#define sysTrapKeyWake 0xA2A6
+
+
+#define sysTrapDlkControl 0xA2A7 /* was sysTrapCmBroadcast */
+
+#define sysTrapDlkStartServer 0xA2A8
+#define sysTrapDlkGetSyncInfo 0xA2A9
+#define sysTrapDlkSetLogEntry 0xA2AA
+
+#define sysTrapIntlDispatch 0xA2AB /* REUSED IN v3.1 (was sysTrapPsrInit in 1.0, removed in 2.0) */
+#define sysTrapSysLibLoad 0xA2AC /* REUSED IN v2.0 (was sysTrapPsrClose) */
+#define sysTrapSndPlaySmf 0xA2AD /* REUSED IN v3.0 (was sysTrapPsrGetCommand in 1.0, removed in 2.0) */
+#define sysTrapSndCreateMidiList 0xA2AE /* REUSED IN v3.0 (was sysTrapPsrSendReply in 1.0, removed in 2.0) */
+
+#define sysTrapAbtShowAbout 0xA2AF
+
+#define sysTrapMdmDial 0xA2B0
+#define sysTrapMdmHangUp 0xA2B1
+
+#define sysTrapDmSearchRecord 0xA2B2
+
+#define sysTrapSysInsertionSort 0xA2B3
+#define sysTrapDmInsertionSort 0xA2B4
+
+#define sysTrapLstSetTopItem 0xA2B5
+
+
+// Palm OS 2.X traps Palm Pilot and 2.0 Upgrade Card
+
+#define sysTrapSclSetScrollBar 0xA2B6
+#define sysTrapSclDrawScrollBar 0xA2B7
+#define sysTrapSclHandleEvent 0xA2B8
+
+#define sysTrapSysMailboxCreate 0xA2B9
+#define sysTrapSysMailboxDelete 0xA2BA
+#define sysTrapSysMailboxFlush 0xA2BB
+#define sysTrapSysMailboxSend 0xA2BC
+#define sysTrapSysMailboxWait 0xA2BD
+
+#define sysTrapSysTaskWait 0xA2BE
+#define sysTrapSysTaskWake 0xA2BF
+#define sysTrapSysTaskWaitClr 0xA2C0
+#define sysTrapSysTaskSuspend 0xA2C1
+#define sysTrapSysTaskResume 0xA2C2
+
+#define sysTrapCategoryCreateList 0xA2C3
+#define sysTrapCategoryFreeList 0xA2C4
+#define sysTrapCategoryEditV20 0xA2C5
+#define sysTrapCategorySelect 0xA2C6
+
+#define sysTrapDmDeleteCategory 0xA2C7
+
+#define sysTrapSysEvGroupCreate 0xA2C8
+#define sysTrapSysEvGroupSignal 0xA2C9
+#define sysTrapSysEvGroupRead 0xA2CA
+#define sysTrapSysEvGroupWait 0xA2CB
+
+#define sysTrapEvtEventAvail 0xA2CC
+#define sysTrapEvtSysEventAvail 0xA2CD
+#define sysTrapStrNCopy 0xA2CE
+
+#define sysTrapKeySetMask 0xA2CF
+
+#define sysTrapSelectDay 0xA2D0
+
+#define sysTrapPrefGetPreference 0xA2D1
+#define sysTrapPrefSetPreference 0xA2D2
+#define sysTrapPrefGetAppPreferences 0xA2D3
+#define sysTrapPrefSetAppPreferences 0xA2D4
+
+#define sysTrapFrmPointInTitle 0xA2D5
+
+#define sysTrapStrNCat 0xA2D6
+
+#define sysTrapMemCmp 0xA2D7
+
+#define sysTrapTblSetColumnEditIndicator 0xA2D8
+
+#define sysTrapFntWordWrap 0xA2D9
+
+#define sysTrapFldGetScrollValues 0xA2DA
+
+#define sysTrapSysCreateDataBaseList 0xA2DB
+#define sysTrapSysCreatePanelList 0xA2DC
+
+#define sysTrapDlkDispatchRequest 0xA2DD
+
+#define sysTrapStrPrintF 0xA2DE
+#define sysTrapStrVPrintF 0xA2DF
+
+#define sysTrapPrefOpenPreferenceDB 0xA2E0
+
+#define sysTrapSysGraffitiReferenceDialog 0xA2E1
+
+#define sysTrapSysKeyboardDialog 0xA2E2
+
+#define sysTrapFntWordWrapReverseNLines 0xA2E3
+#define sysTrapFntGetScrollValues 0xA2E4
+
+#define sysTrapTblSetRowStaticHeight 0xA2E5
+#define sysTrapTblHasScrollBar 0xA2E6
+
+#define sysTrapSclGetScrollBar 0xA2E7
+
+#define sysTrapFldGetNumberOfBlankLines 0xA2E8
+
+#define sysTrapSysTicksPerSecond 0xA2E9
+#define sysTrapHwrBacklightV33 0xA2EA /* This trap obsoleted for OS 3.5 and later */
+#define sysTrapDmDatabaseProtect 0xA2EB
+
+#define sysTrapTblSetBounds 0xA2EC
+
+#define sysTrapStrNCompare 0xA2ED
+#define sysTrapStrNCaselessCompare 0xA2EE
+
+#define sysTrapPhoneNumberLookup 0xA2EF
+
+#define sysTrapFrmSetMenu 0xA2F0
+
+#define sysTrapEncDigestMD5 0xA2F1
+
+#define sysTrapDmFindSortPosition 0xA2F2
+
+#define sysTrapSysBinarySearch 0xA2F3
+#define sysTrapSysErrString 0xA2F4
+#define sysTrapSysStringByIndex 0xA2F5
+
+#define sysTrapEvtAddUniqueEventToQueue 0xA2F6
+
+#define sysTrapStrLocalizeNumber 0xA2F7
+#define sysTrapStrDelocalizeNumber 0xA2F8
+#define sysTrapLocGetNumberSeparators 0xA2F9
+
+#define sysTrapMenuSetActiveMenuRscID 0xA2FA
+
+#define sysTrapLstScrollList 0xA2FB
+
+#define sysTrapCategoryInitialize 0xA2FC
+
+#define sysTrapEncDigestMD4 0xA2FD
+#define sysTrapEncDES 0xA2FE
+
+#define sysTrapLstGetVisibleItems 0xA2FF
+
+#define sysTrapWinSetBounds 0xA300
+
+#define sysTrapCategorySetName 0xA301
+
+#define sysTrapFldSetInsertionPoint 0xA302
+
+#define sysTrapFrmSetObjectBounds 0xA303
+
+#define sysTrapWinSetColors 0xA304
+
+#define sysTrapFlpDispatch 0xA305
+#define sysTrapFlpEmDispatch 0xA306
+
+
+// Palm OS 3.0 traps Palm III and 3.0 Upgrade Card
+
+#define sysTrapExgInit 0xA307
+#define sysTrapExgConnect 0xA308
+#define sysTrapExgPut 0xA309
+#define sysTrapExgGet 0xA30A
+#define sysTrapExgAccept 0xA30B
+#define sysTrapExgDisconnect 0xA30C
+#define sysTrapExgSend 0xA30D
+#define sysTrapExgReceive 0xA30E
+#define sysTrapExgRegisterData 0xA30F
+#define sysTrapExgNotifyReceiveV35 0xA310
+#define sysTrapSysReserved30Trap2 0xA311 /* "Reserved" trap in Palm OS 3.0 and later (was sysTrapExgControl) */
+
+#define sysTrapPrgStartDialogV31 0xA312 /* Updated in v3.2 */
+#define sysTrapPrgStopDialog 0xA313
+#define sysTrapPrgUpdateDialog 0xA314
+#define sysTrapPrgHandleEvent 0xA315
+
+#define sysTrapImcReadFieldNoSemicolon 0xA316
+#define sysTrapImcReadFieldQuotablePrintable 0xA317
+#define sysTrapImcReadPropertyParameter 0xA318
+#define sysTrapImcSkipAllPropertyParameters 0xA319
+#define sysTrapImcReadWhiteSpace 0xA31A
+#define sysTrapImcWriteQuotedPrintable 0xA31B
+#define sysTrapImcWriteNoSemicolon 0xA31C
+#define sysTrapImcStringIsAscii 0xA31D
+
+#define sysTrapTblGetItemFont 0xA31E
+#define sysTrapTblSetItemFont 0xA31F
+
+#define sysTrapFontSelect 0xA320
+#define sysTrapFntDefineFont 0xA321
+
+#define sysTrapCategoryEdit 0xA322
+
+#define sysTrapSysGetOSVersionString 0xA323
+#define sysTrapSysBatteryInfo 0xA324
+#define sysTrapSysUIBusy 0xA325
+
+#define sysTrapWinValidateHandle 0xA326
+#define sysTrapFrmValidatePtr 0xA327
+#define sysTrapCtlValidatePointer 0xA328
+#define sysTrapWinMoveWindowAddr 0xA329
+#define sysTrapFrmAddSpaceForObject 0xA32A
+#define sysTrapFrmNewForm 0xA32B
+#define sysTrapCtlNewControl 0xA32C
+#define sysTrapFldNewField 0xA32D
+#define sysTrapLstNewList 0xA32E
+#define sysTrapFrmNewLabel 0xA32F
+#define sysTrapFrmNewBitmap 0xA330
+#define sysTrapFrmNewGadget 0xA331
+
+#define sysTrapFileOpen 0xA332
+#define sysTrapFileClose 0xA333
+#define sysTrapFileDelete 0xA334
+#define sysTrapFileReadLow 0xA335
+#define sysTrapFileWrite 0xA336
+#define sysTrapFileSeek 0xA337
+#define sysTrapFileTell 0xA338
+#define sysTrapFileTruncate 0xA339
+#define sysTrapFileControl 0xA33A
+
+#define sysTrapFrmActiveState 0xA33B
+
+#define sysTrapSysGetAppInfo 0xA33C
+#define sysTrapSysGetStackInfo 0xA33D
+
+#define sysTrapWinScreenMode 0xA33E /* was sysTrapScrDisplayMode */
+#define sysTrapHwrLCDGetDepthV33 0xA33F /* This trap obsoleted for OS 3.5 and later */
+#define sysTrapHwrGetROMToken 0xA340
+
+#define sysTrapDbgControl 0xA341
+
+#define sysTrapExgDBRead 0xA342
+#define sysTrapExgDBWrite 0xA343
+
+#define sysTrapHostControl 0xA344 /* Renamed from sysTrapSysGremlins, functionality generalized */
+#define sysTrapFrmRemoveObject 0xA345
+
+#define sysTrapSysReserved30Trap1 0xA346 /* "Reserved" trap in Palm OS 3.0 and later (was sysTrapSysReserved1) */
+
+// NOTE: The following two traps are reserved for future mgrs
+// that may or may not be present on any particular device.
+// They are NOT present by default; code must check first!
+#define sysTrapExpansionDispatch 0xA347 /* Reserved for ExpansionMgr (was sysTrapSysReserved2) */
+#define sysTrapFileSystemDispatch 0xA348 /* Reserved for FileSystemMgr (was sysTrapSysReserved3) */
+
+#define sysTrapOEMDispatch 0xA349 /* OEM trap in Palm OS 3.0 and later trap table (formerly sysTrapSysReserved4) */
+
+
+// Palm OS 3.1 traps Palm IIIx and Palm V
+
+#define sysTrapHwrLCDContrastV33 0xA34A /* This trap obsoleted for OS 3.5 and later */
+#define sysTrapSysLCDContrast 0xA34B
+#define sysTrapUIContrastAdjust 0xA34C /* Renamed from sysTrapContrastAdjust */
+#define sysTrapHwrDockStatus 0xA34D
+
+#define sysTrapFntWidthToOffset 0xA34E
+#define sysTrapSelectOneTime 0xA34F
+#define sysTrapWinDrawChar 0xA350
+#define sysTrapWinDrawTruncChars 0xA351
+
+#define sysTrapSysNotifyInit 0xA352 /* Notification Manager traps */
+#define sysTrapSysNotifyRegister 0xA353
+#define sysTrapSysNotifyUnregister 0xA354
+#define sysTrapSysNotifyBroadcast 0xA355
+#define sysTrapSysNotifyBroadcastDeferred 0xA356
+#define sysTrapSysNotifyDatabaseAdded 0xA357
+#define sysTrapSysNotifyDatabaseRemoved 0xA358
+
+#define sysTrapSysWantEvent 0xA359
+
+#define sysTrapFtrPtrNew 0xA35A
+#define sysTrapFtrPtrFree 0xA35B
+#define sysTrapFtrPtrResize 0xA35C
+
+#define sysTrapSysReserved31Trap1 0xA35D /* "Reserved" trap in Palm OS 3.1 and later (was sysTrapSysReserved5) */
+
+
+// Palm OS 3.2 & 3.3 traps Palm VII (3.2) and Fall '99 Palm OS Flash Update (3.3)
+
+#define sysTrapHwrNVPrefSet 0xA35E /* mapped to FlashParmsWrite */
+#define sysTrapHwrNVPrefGet 0xA35F /* mapped to FlashParmsRead */
+#define sysTrapFlashInit 0xA360
+#define sysTrapFlashCompress 0xA361
+#define sysTrapFlashErase 0xA362
+#define sysTrapFlashProgram 0xA363
+
+#define sysTrapAlmTimeChange 0xA364
+#define sysTrapErrAlertCustom 0xA365
+#define sysTrapPrgStartDialog 0xA366 /* New version of sysTrapPrgStartDialogV31 */
+
+#define sysTrapSerialDispatch 0xA367
+#define sysTrapHwrBattery 0xA368
+#define sysTrapDmGetDatabaseLockState 0xA369
+
+#define sysTrapCncGetProfileList 0xA36A
+#define sysTrapCncGetProfileInfo 0xA36B
+#define sysTrapCncAddProfile 0xA36C
+#define sysTrapCncDeleteProfile 0xA36D
+
+#define sysTrapSndPlaySmfResource 0xA36E
+
+#define sysTrapMemPtrDataStorage 0xA36F /* Never actually installed until now. */
+
+#define sysTrapClipboardAppendItem 0xA370
+
+#define sysTrapWiCmdV32 0xA371 /* Code moved to INetLib; trap obsolete */
+
+
+// Palm OS 3.5 traps Palm IIIc and other products
+
+// HAL Display-layer new traps
+#define sysTrapHwrDisplayAttributes 0xA372
+#define sysTrapHwrDisplayDoze 0xA373
+#define sysTrapHwrDisplayPalette 0xA374
+
+// Screen driver new traps
+#define sysTrapBltFindIndexes 0xA375
+#define sysTrapBmpGetBits 0xA376 /* was BltGetBitsAddr */
+#define sysTrapBltCopyRectangle 0xA377
+#define sysTrapBltDrawChars 0xA378
+#define sysTrapBltLineRoutine 0xA379
+#define sysTrapBltRectangleRoutine 0xA37A
+
+// ScrUtils new traps
+#define sysTrapScrCompress 0xA37B
+#define sysTrapScrDecompress 0xA37C
+
+// System Manager new traps
+#define sysTrapSysLCDBrightness 0xA37D
+
+// WindowColor new traps
+#define sysTrapWinPaintChar 0xA37E
+#define sysTrapWinPaintChars 0xA37F
+#define sysTrapWinPaintBitmap 0xA380
+#define sysTrapWinGetPixel 0xA381
+#define sysTrapWinPaintPixel 0xA382
+#define sysTrapWinDrawPixel 0xA383
+#define sysTrapWinErasePixel 0xA384
+#define sysTrapWinInvertPixel 0xA385
+#define sysTrapWinPaintPixels 0xA386
+#define sysTrapWinPaintLines 0xA387
+#define sysTrapWinPaintLine 0xA388
+#define sysTrapWinPaintRectangle 0xA389
+#define sysTrapWinPaintRectangleFrame 0xA38A
+#define sysTrapWinPaintPolygon 0xA38B
+#define sysTrapWinDrawPolygon 0xA38C
+#define sysTrapWinErasePolygon 0xA38D
+#define sysTrapWinInvertPolygon 0xA38E
+#define sysTrapWinFillPolygon 0xA38F
+#define sysTrapWinPaintArc 0xA390
+#define sysTrapWinDrawArc 0xA391
+#define sysTrapWinEraseArc 0xA392
+#define sysTrapWinInvertArc 0xA393
+#define sysTrapWinFillArc 0xA394
+#define sysTrapWinPushDrawState 0xA395
+#define sysTrapWinPopDrawState 0xA396
+#define sysTrapWinSetDrawMode 0xA397
+#define sysTrapWinSetForeColor 0xA398
+#define sysTrapWinSetBackColor 0xA399
+#define sysTrapWinSetTextColor 0xA39A
+#define sysTrapWinGetPatternType 0xA39B
+#define sysTrapWinSetPatternType 0xA39C
+#define sysTrapWinPalette 0xA39D
+#define sysTrapWinRGBToIndex 0xA39E
+#define sysTrapWinIndexToRGB 0xA39F
+#define sysTrapWinScreenLock 0xA3A0
+#define sysTrapWinScreenUnlock 0xA3A1
+#define sysTrapWinGetBitmap 0xA3A2
+
+// UIColor new traps
+#define sysTrapUIColorInit 0xA3A3
+#define sysTrapUIColorGetTableEntryIndex 0xA3A4
+#define sysTrapUIColorGetTableEntryRGB 0xA3A5
+#define sysTrapUIColorSetTableEntry 0xA3A6
+#define sysTrapUIColorPushTable 0xA3A7
+#define sysTrapUIColorPopTable 0xA3A8
+
+// misc cleanup and API additions
+
+#define sysTrapCtlNewGraphicControl 0xA3A9
+
+#define sysTrapTblGetItemPtr 0xA3AA
+
+#define sysTrapUIBrightnessAdjust 0xA3AB
+#define sysTrapUIPickColor 0xA3AC
+
+#define sysTrapEvtSetAutoOffTimer 0xA3AD
+
+// Misc int'l/overlay support.
+#define sysTrapTsmDispatch 0xA3AE
+#define sysTrapOmDispatch 0xA3AF
+#define sysTrapDmOpenDBNoOverlay 0xA3B0
+#define sysTrapDmOpenDBWithLocale 0xA3B1
+#define sysTrapResLoadConstant 0xA3B2
+
+// new boot-time SmallROM HAL additions
+#define sysTrapHwrPreDebugInit 0xA3B3
+#define sysTrapHwrResetNMI 0xA3B4
+#define sysTrapHwrResetPWM 0xA3B5
+
+#define sysTrapKeyBootKeys 0xA3B6
+
+#define sysTrapDbgSerDrvOpen 0xA3B7
+#define sysTrapDbgSerDrvClose 0xA3B8
+#define sysTrapDbgSerDrvControl 0xA3B9
+#define sysTrapDbgSerDrvStatus 0xA3BA
+#define sysTrapDbgSerDrvWriteChar 0xA3BB
+#define sysTrapDbgSerDrvReadChar 0xA3BC
+
+// new boot-time BigROM HAL additions
+#define sysTrapHwrPostDebugInit 0xA3BD
+#define sysTrapHwrIdentifyFeatures 0xA3BE
+#define sysTrapHwrModelSpecificInit 0xA3BF
+#define sysTrapHwrModelInitStage2 0xA3C0
+#define sysTrapHwrInterruptsInit 0xA3C1
+
+#define sysTrapHwrSoundOn 0xA3C2
+#define sysTrapHwrSoundOff 0xA3C3
+
+// Kernel clock tick routine
+#define sysTrapSysKernelClockTick 0xA3C4
+
+// MenuEraseMenu is exposed as of PalmOS 3.5, but there are
+// no public interfaces for it yet. Perhaps in a later release.
+#define sysTrapMenuEraseMenu 0xA3C5
+
+#define sysTrapSelectTime 0xA3C6
+
+// Menu Command Bar traps
+#define sysTrapMenuCmdBarAddButton 0xA3C7
+#define sysTrapMenuCmdBarGetButtonData 0xA3C8
+#define sysTrapMenuCmdBarDisplay 0xA3C9
+
+// Silkscreen info
+#define sysTrapHwrGetSilkscreenID 0xA3CA
+#define sysTrapEvtGetSilkscreenAreaList 0xA3CB
+
+#define sysTrapSysFatalAlertInit 0xA3CC
+#define sysTrapDateTemplateToAscii 0xA3CD
+
+// New traps dealing with masking private records
+#define sysTrapSecVerifyPW 0xA3CE
+#define sysTrapSecSelectViewStatus 0xA3CF
+#define sysTrapTblSetColumnMasked 0xA3D0
+#define sysTrapTblSetRowMasked 0xA3D1
+#define sysTrapTblRowMasked 0xA3D2
+
+// New form trap for dialogs with text entry field
+#define sysTrapFrmCustomResponseAlert 0xA3D3
+#define sysTrapFrmNewGsi 0xA3D4
+
+// New dynamic menu functions
+#define sysTrapMenuShowItem 0xA3D5
+#define sysTrapMenuHideItem 0xA3D6
+#define sysTrapMenuAddItem 0xA3D7
+
+// New form traps for "smart gadgets"
+#define sysTrapFrmSetGadgetHandler 0xA3D8
+
+// More new control functions
+#define sysTrapCtlSetGraphics 0xA3D9
+#define sysTrapCtlGetSliderValues 0xA3DA
+#define sysTrapCtlSetSliderValues 0xA3DB
+#define sysTrapCtlNewSliderControl 0xA3DC
+
+// Bitmap manager functions
+#define sysTrapBmpCreate 0xA3DD
+#define sysTrapBmpDelete 0xA3DE
+#define sysTrapBmpCompress 0xA3DF
+// sysTrapBmpGetBits defined in Screen driver traps
+#define sysTrapBmpGetColortable 0xA3E0
+#define sysTrapBmpSize 0xA3E1
+#define sysTrapBmpBitsSize 0xA3E2
+#define sysTrapBmpColortableSize 0xA3E3
+// extra window namager
+#define sysTrapWinCreateBitmapWindow 0xA3E4
+// Ask for a null event sooner (replaces a macro which Poser hated)
+#define sysTrapEvtSetNullEventTick 0xA3E5
+
+// Exchange manager call to allow apps to select destination categories
+#define sysTrapExgDoDialog 0xA3E6
+
+// this call will remove temporary UI like popup lists
+#define sysTrapSysUICleanup 0xA3E7
+
+// The following 4 traps were "Reserved" traps, present only in SOME post-release builds of Palm OS 3.5
+#define sysTrapWinSetForeColorRGB 0xA3E8
+#define sysTrapWinSetBackColorRGB 0xA3E9
+#define sysTrapWinSetTextColorRGB 0xA3EA
+#define sysTrapWinGetPixelRGB 0xA3EB
+
+// TRAPS ABOVE THIS POINT CAN NOT CHANGE BECAUSE THEY HAVE
+// BEEN RELEASED TO CUSTOMERS IN SHIPPING ROMS AND SDKS.
+// (MOVE THIS COMMENT DOWN WHENEVER THE "NEXT" RELEASE OCCURS.)
+
+// WARNING!! The following are new traps for 4.0. If this file is merged
+// with MAIN sources, new traps that are added for products that precede
+// 4.0 MUST insert their traps BEFORE this section.
+
+#define sysTrapSysReserved40Trap1 0xA3EC
+#define sysTrapSysReserved40Trap2 0xA3ED
+#define sysTrapSysReserved40Trap3 0xA3EE
+#define sysTrapSysReserved40Trap4 0xA3EF
+
+
+// DO NOT CHANGE TRAPS ABOVE THIS LINE
+// THESE TRAPS HAVE BEEN RELEASED IN THE 3.5 SDK
+// NEW TRAPS FOR PALM OS 4.0 CAN BE ADDED AFTER THIS
+// THE ORDER IS NOT IMPORTANT AND CAN BE CHANGED.
+
+// New Trap selector added for New Connection Mgr API
+#define sysTrapCncMgrDispatch 0xA3F0
+
+// new trap for notify from interrupt, implemented in SysEvtMgr.c
+#define sysTrapSysNotifyBroadcastFromInterrupt 0xA3F1
+
+// new trap for waking the UI without generating a null event
+#define sysTrapEvtWakeupWithoutNilEvent 0xA3F2
+
+// new trap for doing stable, fast, 7-bit string compare
+#define sysTrapStrCompareAscii 0xA3F3
+
+// New trap for accessors available thru PalmOS glue
+#define sysTrapAccessorDispatch 0xA3F4
+
+#define sysTrapBltGetPixel 0xA3F5
+#define sysTrapBltPaintPixel 0xA3F6
+#define sysTrapScrScreenInit 0xA3F7
+#define sysTrapScrUpdateScreenBitmap 0xA3F8
+#define sysTrapScrPalette 0xA3F9
+#define sysTrapScrGetColortable 0xA3FA
+#define sysTrapScrGetGrayPat 0xA3FB
+#define sysTrapScrScreenLock 0xA3FC
+#define sysTrapScrScreenUnlock 0xA3FD
+#define sysTrapFntPrvGetFontList 0xA3FE
+
+// Exchange manager functions
+#define sysTrapExgRegisterDatatype 0xA3FF
+#define sysTrapExgNotifyReceive 0xA400
+#define sysTrapExgNotifyGoto 0xA401
+#define sysTrapExgRequest 0xA402
+#define sysTrapExgSetDefaultApplication 0xA403
+#define sysTrapExgGetDefaultApplication 0xA404
+#define sysTrapExgGetTargetApplication 0xA405
+#define sysTrapExgGetRegisteredApplications 0xA406
+#define sysTrapExgGetRegisteredTypes 0xA407
+#define sysTrapExgNotifyPreview 0xA408
+#define sysTrapExgControl 0xA409
+
+// 04/30/00 CS - New Locale Manager handles access to region-specific info like date formats
+#define sysTrapLmDispatch 0xA40A
+
+// 05/10/00 kwk - New Memory Manager trap for retrieving ROM NVParam values (sys use only)
+#define sysTrapMemGetRomNVParams 0xA40B
+
+// 05/12/00 kwk - Safe character width Font Mgr call
+#define sysTrapFntWCharWidth 0xA40C
+
+// 05/17/00 kwk - Faster DmFindDatabase
+#define sysTrapDmFindDatabaseWithTypeCreator 0xA40D
+
+// New Trap selectors added for time zone picker API
+#define sysTrapSelectTimeZone 0xA40E
+#define sysTrapTimeZoneToAscii 0xA40F
+
+// 08/18/00 kwk - trap for doing stable, fast, 7-bit string compare.
+// 08/21/00 kwk - moved here in place of sysTrapSelectDaylightSavingAdjustment.
+#define sysTrapStrNCompareAscii 0xA410
+
+// New Trap selectors added for time zone conversion API
+#define sysTrapTimTimeZoneToUTC 0xA411
+#define sysTrapTimUTCToTimeZone 0xA412
+
+// New trap implemented in PhoneLookup.c
+#define sysTrapPhoneNumberLookupCustom 0xA413
+
+// new trap for selecting debugger path.
+#define sysTrapHwrDebugSelect 0xA414
+
+#define sysTrapBltRoundedRectangle 0xA415
+#define sysTrapBltRoundedRectangleFill 0xA416
+#define sysTrapWinPrvInitCanvas 0xA417
+
+#define sysTrapHwrCalcDynamicHeapSize 0xA418
+#define sysTrapHwrDebuggerEnter 0xA419
+#define sysTrapHwrDebuggerExit 0xA41A
+
+#define sysTrapLstGetTopItem 0xA41B
+
+#define sysTrapHwrModelInitStage3 0xA41C
+
+// 06/21/00 peter - New Attention Manager
+#define sysTrapAttnIndicatorAllow 0xA41D
+#define sysTrapAttnIndicatorAllowed 0xA41E
+#define sysTrapAttnIndicatorEnable 0xA41F
+#define sysTrapAttnIndicatorEnabled 0xA420
+#define sysTrapAttnIndicatorSetBlinkPattern 0xA421
+#define sysTrapAttnIndicatorGetBlinkPattern 0xA422
+#define sysTrapAttnIndicatorTicksTillNextBlink 0xA423
+#define sysTrapAttnIndicatorCheckBlink 0xA424
+#define sysTrapAttnInitialize 0xA425
+#define sysTrapAttnGetAttention 0xA426
+#define sysTrapAttnUpdate 0xA427
+#define sysTrapAttnForgetIt 0xA428
+#define sysTrapAttnGetCounts 0xA429
+#define sysTrapAttnListOpen 0xA42A
+#define sysTrapAttnHandleEvent 0xA42B
+#define sysTrapAttnEffectOfEvent 0xA42C
+#define sysTrapAttnIterate 0xA42D
+#define sysTrapAttnDoSpecialEffects 0xA42E
+#define sysTrapAttnDoEmergencySpecialEffects 0xA42F
+#define sysTrapAttnAllowClose 0xA430
+#define sysTrapAttnReopen 0xA431
+#define sysTrapAttnEnableNotification 0xA432
+#define sysTrapHwrLEDAttributes 0xA433
+#define sysTrapHwrVibrateAttributes 0xA434
+
+// Trap for getting and setting the device password hint.
+#define sysTrapSecGetPwdHint 0xA435
+#define sysTrapSecSetPwdHint 0xA436
+
+#define sysTrapHwrFlashWrite 0xA437
+
+#define sysTrapKeyboardStatusNew 0xA438
+#define sysTrapKeyboardStatusFree 0xA439
+#define sysTrapKbdSetLayout 0xA43A
+#define sysTrapKbdGetLayout 0xA43B
+#define sysTrapKbdSetPosition 0xA43C
+#define sysTrapKbdGetPosition 0xA43D
+#define sysTrapKbdSetShiftState 0xA43E
+#define sysTrapKbdGetShiftState 0xA43F
+#define sysTrapKbdDraw 0xA440
+#define sysTrapKbdErase 0xA441
+#define sysTrapKbdHandleEvent 0xA442
+
+#define sysTrapOEMDispatch2 0xA443
+#define sysTrapHwrCustom 0xA444
+
+// 08/28/00 kwk - Trap for getting form's active field.
+#define sysTrapFrmGetActiveField 0xA445
+
+// 9/18/00 rkr - Added for playing sounds regardless of interruptible flag
+#define sysTrapSndPlaySmfIrregardless 0xA446
+#define sysTrapSndPlaySmfResourceIrregardless 0xA447
+#define sysTrapSndInterruptSmfIrregardless 0xA448
+
+// 10/14/00 ABa: UDA manager
+#define sysTrapUdaMgrDispatch 0xA449
+
+// WK: private traps for PalmOS
+#define sysTrapPalmPrivate1 0xA44A
+#define sysTrapPalmPrivate2 0xA44B
+#define sysTrapPalmPrivate3 0xA44C
+#define sysTrapPalmPrivate4 0xA44D
+
+
+// 11/07/00 tlw: Added accessors
+#define sysTrapBmpGetDimensions 0xA44E
+#define sysTrapBmpGetBitDepth 0xA44F
+#define sysTrapBmpGetNextBitmap 0xA450
+#define sysTrapTblGetNumberOfColumns 0xA451
+#define sysTrapTblGetTopRow 0xA452
+#define sysTrapTblSetSelection 0xA453
+#define sysTrapFrmGetObjectIndexFromPtr 0xA454
+
+// 11/10/00 acs
+#define sysTrapBmpGetSizes 0xA455
+#define sysTrapWinGetBounds 0xA456
+
+
+#define sysTrapBltPaintPixels 0xA457
+
+// 11/22/00 bob
+#define sysTrapFldSetMaxVisibleLines 0xA458
+
+// 01/09/01 acs
+#define sysTrapScrDefaultPaletteState 0xA459
+
+// WARNING!! LEAVE THIS AT THE END AND ALWAYS ADD NEW TRAPS TO
+// THE END OF THE TRAP TABLE BUT RIGHT BEFORE THIS TRAP, AND THEN
+// RENUMBER THIS ONE TO ONE MORE THAN THE ONE RIGHT BEFORE IT!!!!!!!!!
+
+
+
+#define sysTrapLastTrapNumber 0xA45A
+
+
+
+#define sysNumTraps (sysTrapLastTrapNumber - sysTrapBase)
+
+
+
+#endif //__CORETRAPS_H_
diff --git a/SrcShared/Palm/Platform/Incs/Core/Hardware/HAL.h b/SrcShared/Palm/Platform/Incs/Core/Hardware/HAL.h
new file mode 100644
index 0000000..c8e0099
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/Hardware/HAL.h
@@ -0,0 +1,99 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: HAL.h
+ *
+ * Description:
+ * General HAL Equates. This header file contains function prototypes for
+ * HAL routines, and is used by both Palm OS and the HAL module.
+ *
+ * History:
+ * 5/31/99 SCL Created by Steve Lemke
+ *
+ *****************************************************************************/
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER ¥¥¥ Turned this off, because HAL calls *are* portable, right Steve?
+#endif // PUBLIC_STUFF_STRIPPED
+
+// #ifdef NON_PORTABLE // So app's don't mistakenly include this
+
+#ifndef __HAL_H__
+#define __HAL_H__
+
+#include <PalmOptErrorCheckLevel.h>
+
+
+/**************************************************************************
+ * HAL routine selectors
+ ***************************************************************************/
+/*
+#define halBootBase 0
+
+typedef enum {
+ halBootHwrPreDebugInit = halBootBase, // 0
+ halBootHwrInit, // 1
+ halBootHwrModelSpecificInit, // 2
+ halBootHwrEnableDataWrites, // 3
+ halBootHwrDisableDataWrites, // 4
+ halBootHwrMemReadable, // 5
+ halBootHwrMemWritable, // 6
+ halBootHwrResetNMI, // 7
+ halBootHwrResetPWM, // 8
+
+ halBootKeyBootKeys, // 9
+
+ halBootHwrDisplayCursor, // 10
+
+ halBootDrvOpen, // 11
+ halBootDrvClose, // 12
+ halBootDrvControl, // 13
+ halBootDrvStatus, // 14
+ halBootDrvWriteChar, // 15
+ halBootDrvReadChar, // 16
+
+ halBootLastSelector
+ } halBootSelector;
+*/
+
+/************************************************************
+ * New HAL function prototypes
+ *************************************************************/
+
+#if DISABLE_HAL_TRAPS
+ #define HAL_CALL(trapNum)
+#else
+ #define HAL_CALL(trapNum) \
+ _HAL_API(_CALL)(_HAL_TABLE, trapNum)
+#endif
+
+// HwrInit is passed as a parameter to InitStage1 in RomBoot.c
+typedef void (*HwrInitProcPtr)(void);
+
+
+/**************************************************************************
+ * Prototypes of functions used only when running on the real hardware
+ ***************************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ // These routines are "private" prototypes for the HAL code...
+
+ void HwrPreRAMInit(void);
+
+ void HwrInit(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif //__HAL_H__
+
+// #endif // NON_PORTABLE
diff --git a/SrcShared/Palm/Platform/Incs/Core/Hardware/HwrMiscFlags.h b/SrcShared/Palm/Platform/Incs/Core/Hardware/HwrMiscFlags.h
new file mode 100644
index 0000000..a6f72fc
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/Hardware/HwrMiscFlags.h
@@ -0,0 +1,220 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: HwrMiscFlags.h
+ *
+ * Description:
+ * Bit constants for the hardware MiscFlags
+ *
+ * History:
+ * 10/26/99 JED Created by Jesse Donaldson, extracted from <HwrGlobals.h>
+ *
+ *****************************************************************************/
+
+#ifdef NON_PORTABLE // So app's don't mistakenly include this
+
+#ifndef __HWR_MISCFLAGS_H__
+#define __HWR_MISCFLAGS_H__
+
+
+
+/**************************************************************************
+ * General Equates
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------
+// NOTE: In some ROMs between 3.0 and 3.3 (inclusive), OEMs may have
+// ROM tokens present in the ROM that were detected by the boot code
+// in order to set the various HwrMiscFlags and GHwrMiscFlagsExt
+// settings. That scheme is no longer relevant, since starting with
+// version 3.5 and later, it is now the responsibility of the HAL
+// to set these flags, using whatever means necessary to determine
+// what "features" the device has that the higher level OS may want
+// to know about.
+//
+// These flags are defined in this public header file since both
+// of these low memory globals are published as system features
+// (sysFtrNumHwrMiscFlags and sysFtrNumHwrMiscFlagsExt) in <SystemMgr.h>.
+// These features are for third party software that may (for whatever
+// reason) want to know about certain hardware differences without
+// having to read the low memory globals directly.
+//
+// Palm OS v3.1 was the first OS to publish sysFtrNumHwrMiscFlags as a feature.
+// Call FtrGet first; if the feature doesn't exist, check the OS version:
+// Palm OS v2.0 and 3.0 have GHwrMiscFlags defined as a low memory global.
+// Palm OS v1.0 did not have GHwrMiscFlags, so its contents are unpredictable.
+// Any devices running Palm OS v1.0 devices should assume zero for all flags.
+// ----------------------------------------------------------------------
+
+// Bits in the low memory global GHwrMiscFlags (UInt16)
+#define hwrMiscFlagHasBacklight 0x0001 // set if backlight is present
+#define hwrMiscFlagHasMbdIrDA 0x0002 // set if IrDA is present (on main board)
+#define hwrMiscFlagHasCardIrDA 0x0004 // set if IrDA is present (on memory card)
+#define hwrMiscFlagHasBurrBrown 0x0008 // set if BurrBrown A/D is present
+#define hwrMiscFlagHasJerryHW 0x0010 // set if Jerry Hardware is present
+#define hwrMiscFlagNoRTCBug 0x0020 // set if using rev of DragonBall (3G or later)
+ // that doesn't require the RealTimeClock
+ // bug work-around (see TimeMgr68328.c).
+ // <chg 3-27-98 RM>
+#define hwrMiscFlagHas3vRef 0x0040 // set if switchable 3v reference is present
+#define hwrMiscFlagHasAntennaSw 0x0080 // set if viewer has an antenna raised switch
+#define hwrMiscFlagHasCradleDetect 0x0100 // set if we have an A/D converter on hotsync port used for ID'ing the attached device
+#define hwrMiscFlagHasSWContrast 0x0200 // set if UI should support software contrast
+#define hwrMiscFlagInvertLCDForBL 0x0400 // set if we need to invert LCD w/Backlight
+#define hwrMiscFlagHasMiscFlagExt 0x0800 // set if we have new hwrMiscFlagsExt
+
+ // The following bit flags are set by HwrIdentifyFeatures.
+ // They allow software to read the hardware ID without poking at hardware.
+ // They also provide some isolation from different ID detection schemes
+ // such as if the ID detection mechanism should change with EZ...
+#define hwrMiscFlagID1 0x1000 // set if ID bit keyBitHard1 was set
+#define hwrMiscFlagID2 0x2000 // set if ID bit keyBitHard2 was set
+#define hwrMiscFlagID3 0x4000 // set if ID bit keyBitHard3 was set
+#define hwrMiscFlagID4 0x8000 // set if ID bit keyBitHard4 was set
+#define hwrMiscFlagIDMask 0xF000
+#define hwrMiscFlagIDOffset 12 // Bits to shift to get a numeric ID
+
+
+// NOTE: Currently, the '328 IDs don't overlap with the 'EZ IDs. This is NOT a requirement,
+// but is convenient for the time being as it makes it one step easier to identify a device.
+// If the spaces are forced to overlap, it will be necessary to first check the processor
+// type (328 or EZ) and then parse the product ID code. Fortunately, this scheme is rapidly
+// becoming obsolete since it was based on reading the keyboard I/O pins, and new products
+// are starting to move their keyboard I/O bits to new places. With the introduction of
+// different HAL modules, identifying the actual hardware is now something the HAL code
+// will do when the device boots. The HAL need only do whatever it needs to do to uniquely
+// tell the difference between those devices on which it is capable of operating. Once
+// the hardware is identified, the appropriate hwrMiscFlag and hwrMiscFlagExt bits can be
+// set to tell the OS what features are present, and the appropriate hardware ID information
+// can also be set so higher level software can uniquely identify the OEM/Device/HAL info.
+//
+// Changes
+// 3/16/99 SCL: Documented '328 and 'EZ IDs and how the space could overlap if necessary
+// 3/31/99 SRJ: hwrMiscFlagIDUndetermined created, used specifically during the boot sequence
+// before we have done HwrIdentifyFeatures().
+// 10/29/99 SCL: Renamed hwrMiscFlagIDOther to hwrMiscFlagIDCheckROMToken
+// 10/29/99 SCL: Assigned hwrMiscFlagIDUnused1 to hwrMiscFlagIDUndetermined for Palm OS 3.5
+// 10/29/99 SCL: Assigned hwrMiscFlagIDUnused2 to hwrMiscFlagIDCheckOEMFtrs for Palm OS 3.5
+#ifndef PUBLIC_STUFF_STRIPPED // remove unreleased product codenames for 3.5 SDK
+// 11/ 2/99 SCL: Assigned hwrMiscFlagIDUnused3 to hwrMiscFlagIDCobra2 for Palm OS 3.5
+#endif // PUBLIC_STUFF_STRIPPED
+
+
+// hwrMiscFlagIDCheckROMToken indicates that the actual device ID information
+// should be read from hwrROMTokenHardwareID using SysGetROMToken or HwrGetROMToken.
+// Attached to this token is the OEM ID and the OEM-specific Product ID.
+// This scheme was used in Palm OS releases prior to 3.5. See <HwrROMToken.h> for details.
+// This ID is also reported when booting on PalmPilot devices (aka 2.0 hardware).
+#define hwrMiscFlagIDCheckROMToken (0) // used to be hwrMiscFlagIDOther
+#define hwrMiscFlagIDPalmPilot (0) // since it was never explicitly set
+
+// hwrMiscFlagIDUndetermined is what the OS initializes the ID to when booting.
+// The HAL is responsible for setting the ID to something valid (and meaningful).
+#define hwrMiscFlagIDUndetermined (hwrMiscFlagID1) // used to be hwrMiscFlagIDUnused1
+
+// hwrMiscFlagIDCheckOEMFtrs indicates that the OEM/Device/HAL identification
+// information should be read from the new Palm OS 3.5 System Features
+// (sysFtrNumOEMCompanyID, sysFtrNumOEMDeviceID, and sysFtrNumOEMHALID)
+// or system globals (hwrOEMCompanyID, hwrOEMDeviceID, and hwrOEMHALID).
+// This method of hardware device ID is for HAL-based devices starting with Palm OS
+// 3.5, but some devices may continue to report valid old-style hwrMiscFlagIDxxx tags.
+#define hwrMiscFlagIDCheckOEMFtrs (hwrMiscFlagID2) // used to be hwrMiscFlagIDUnused2
+
+// Old-style Hardware IDs for DragonBall '328 based products
+#define hwrMiscFlagIDThumper (hwrMiscFlagID4 | hwrMiscFlagID2)
+#define hwrMiscFlagIDJerry (hwrMiscFlagID4 | hwrMiscFlagID3)
+#define hwrMiscFlagIDRocky (hwrMiscFlagID4 | hwrMiscFlagID3 | hwrMiscFlagID2)
+#define hwrMiscFlagIDTouchdown (hwrMiscFlagID4 | hwrMiscFlagID3 | hwrMiscFlagID2 | hwrMiscFlagID1)
+
+// Old-style Hardware IDs for DragonBall 'EZ based products
+#define hwrMiscFlagIDJerryEZ (hwrMiscFlagID3 | hwrMiscFlagID2)
+#define hwrMiscFlagIDSumo (hwrMiscFlagID4 | hwrMiscFlagID2 | hwrMiscFlagID1)
+#define hwrMiscFlagIDBrad (hwrMiscFlagID4 | hwrMiscFlagID3 | hwrMiscFlagID1)
+#ifndef PUBLIC_STUFF_STRIPPED // remove unreleased product codenames for 3.5 SDK
+#define hwrMiscFlagIDAustin (hwrMiscFlagID4 | hwrMiscFlagID1)
+#define hwrMiscFlagIDCobra2 (hwrMiscFlagID2 | hwrMiscFlagID1)
+#define hwrMiscFlagIDCalvin (hwrMiscFlagID2 | hwrMiscFlagID1)
+#endif // PUBLIC_STUFF_STRIPPED
+
+// Hardware SubIDs used to detect hardware type early in boot process
+#define hwrMiscFlagExtSubIDBrad 0x0
+#define hwrMiscFlagExtSubIDSumo 0x2
+#define hwrMiscFlagExtSubIDCobra 0x4
+#ifndef PUBLIC_STUFF_STRIPPED // remove unreleased product codenames for 3.5 SDK
+#define hwrMiscFlagExtSubIDCobra2_16 0x6
+#define hwrMiscFlagExtSubIDCobra2_20 0x7
+#endif // PUBLIC_STUFF_STRIPPED
+
+
+// Old-style Hardware IDs still unused
+#define hwrMiscFlagIDUnused4 (hwrMiscFlagID3)
+#define hwrMiscFlagIDUnused5 (hwrMiscFlagID3 | hwrMiscFlagID1)
+#define hwrMiscFlagIDUnused7 (hwrMiscFlagID3 | hwrMiscFlagID2 | hwrMiscFlagID1)
+#define hwrMiscFlagIDUnused8 (hwrMiscFlagID4)
+
+
+// Bits in the low memory global GHwrMiscFlagsExt (UInt32)
+#define hwrMiscFlagExtSubID1 0x00000001 // subtype ID (for feature select in device)
+#define hwrMiscFlagExtSubID2 0x00000002 // subtype ID (for feature select in device)
+#define hwrMiscFlagExtSubID3 0x00000004 // subtype ID (for feature select in device)
+#define hwrMiscFlagExtSubIDMask 0x00000007 // sybtype ID Mask
+
+#define hwrMiscFlagExtHasLiIon 0x00000010 // set if we have Lithium Ion battery rechargable in the cradle
+#define hwrMiscFlagExtHasRailIO 0x00000020 // set if we have Rail I/O hardware
+#define hwrMiscFlagExtHasFlash 0x00000040 // set (by OS or HAL) if we have Flash ROM
+#define hwrMiscFlagExtHasFParms 0x00000080 // set (by OS or HAL) if we have Flash parms area
+
+#define hwrMiscFlagExt115KIrOK 0x00000100 // device supports 115K IR transfers
+#define hwrMiscFlagExtHasExtLCD 0x00000200 // device has external LCD controller
+#define hwrMiscFlagExtHasSWBright 0x00000400 // device has software controlled brightness
+
+
+// Assigned values for hwrOEMCompanyID (aka sysFtrNumOEMCompanyID):
+// Values are assigned by the Palm Computing Platform Engineering group.
+//
+// Note: These values are different from the values that may be found in some
+// OEM devices which used HwrROMTokens on versions of Palm OS prior to 3.5.
+
+#define hwrOEMCompanyIDUnspecified 0x00000000 // hwrOEMCompanyID not specified by HAL
+#define hwrOEMHALIDUnspecified 0x00000000 // hwrOEMHALID not specified by HAL
+#define hwrOEMDeviceIDUnspecified 0x00000000 // hwrOEMDeviceID not specified by HAL
+
+#define hwrOEMCompanyIDPalmPlatform 'psys' // Reference Platforms made by Palm Computing
+#define hwrOEMCompanyIDPalmDevices 'palm' // Devices made by Palm Computing
+
+#define hwrOEMCompanyIDSymbol 'smbl' // Devices made by Symbol Technologies
+#define hwrOEMCompanyIDQualcomm 'qcom' // Devices made by Qualcomm
+#define hwrOEMCompanyIDTRG 'trgp' // Devices made by TRG Products
+#define hwrOEMCompanyIDHandspring 'hspr' // Devices made by Handspring
+
+
+// Note that values for hwrOEMDeviceID (aka sysFtrNumOEMDeviceID) and
+// hwrOEMHALID (aka sysFtrNumOEMHALID) are OEM vendor-specific, and not
+// necessarily tracked by this Palm OS header file, though it may be
+// worthwhile to include "known" values here for third party developers.
+//
+// It is recommended that OEM vendors choose values for these globals that
+// are four-digit human-readable ASCII values, rather than numeric codes,
+// though this is not a requirement.
+
+// HALs that belong to hwrOEMCompanyIDPalmPlatform
+#define hwrOEMHALIDEZRef 'eref' // (Mono) EZ Reference Platform (Palm Computing)
+#define hwrOEMHALIDEZRefColor 'cref' // Color EZ Reference Platform (Palm Computing)
+
+// HALs that belong to hwrOEMCompanyIDPalmDevices
+#define hwrOEMHALID328Jerry 'jery' // Pilot, PalmPilot, Palm III/VII HAL (Palm Computing)
+#define hwrOEMHALIDEZSumo 'sumo' // Palm IIIx/V/Vx HAL (Palm Computing)
+#ifndef PUBLIC_STUFF_STRIPPED // remove unreleased product codenames for 3.5 SDK
+#define hwrOEMHALIDEZAustin 'astn' // Austin HAL (Palm Computing)
+#endif // PUBLIC_STUFF_STRIPPED
+
+#ifndef PUBLIC_STUFF_STRIPPED
+#define hwrOEMHALIDEZCalvin 'clvn' // Calvin HAL (Palm Computing)
+#define hwrOEMHALIDEZBonanza 'bnza' // Bonanza HAL (Palm Computing)
+#endif // PUBLIC_STUFF_STRIPPED
+
+#endif //__HWR_MISCFLAGS_H__
+
+#endif // NON_PORTABLE
diff --git a/SrcShared/Palm/Platform/Incs/Core/Hardware/M68KHwr.h b/SrcShared/Palm/Platform/Incs/Core/Hardware/M68KHwr.h
new file mode 100644
index 0000000..8e27eb8
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/Hardware/M68KHwr.h
@@ -0,0 +1,113 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: M68KHwr.h
+ *
+ * Description:
+ * Pilot debugger remote hardware/system info
+ *
+ * History:
+ * 1/18/95 RM - Created by Ron Marianetti
+ *
+ *****************************************************************************/
+
+#ifndef __M68KHWR_H
+#define __M68KHWR_H
+
+// Pilot common definitions
+#include <PalmTypes.h>
+
+
+/***********************************************************************
+ * Breakpoint words we use
+ ***********************************************************************/
+#define m68kTrapInstr 0x4E40
+#define m68kTrapVectorMask 0x000F
+
+/***********************************************************************
+ * 68000 Exception Vector table
+ ***********************************************************************/
+typedef struct M68KExcTableType {
+ UInt32 initStack; // initial stack pointer
+ UInt32 initPC; // initial PC
+
+ UInt32 busErr; // 08
+ UInt32 addressErr; // 0C
+ UInt32 illegalInstr; // 10
+ UInt32 divideByZero; // 14
+ UInt32 chk; // 18
+ UInt32 trap; // 1C
+ UInt32 privilege; // 20
+ UInt32 trace; // 24
+ UInt32 aTrap; // 28
+ UInt32 fTrap; // 2C
+ UInt32 reserved12; // 30
+ UInt32 coproc; // 34
+ UInt32 formatErr; // 38
+ UInt32 unitializedInt; // 3C
+
+ UInt32 reserved[8]; // 40-5C
+
+ UInt32 spuriousInt; // 60
+ UInt32 autoVec1; // 64
+ UInt32 autoVec2; // 68
+ UInt32 autoVec3; // 6C
+ UInt32 autoVec4; // 70
+ UInt32 autoVec5; // 74
+ UInt32 autoVec6; // 78
+ UInt32 autoVec7; // 7C
+
+ UInt32 trapN[16]; // 80 - BC
+
+ UInt32 unassigned[16]; // C0 - FC
+ } M68KExcTableType;
+
+
+
+/**************************************************************************************
+ * structure for the Motorolla 68000 processor registers (variables).
+ *
+ * WARNING:
+ * This structure is used as the body of the 'read regs' command response
+ * packet. Any changes to it will require changes in the nub's code.
+ *
+ **************************************************************************************/
+typedef struct M68KRegsType {
+ UInt32 d[8]; /* data registers */
+ UInt32 a[7]; /* address registers */
+ UInt32 usp; /* user stack pointer */
+ UInt32 ssp; /* supervisor stack pointer */
+ UInt32 pc; /* program counter */
+ UInt16 sr; /* status register */
+} M68KRegsType;
+
+
+
+
+/**************************************************************************************
+ * bit masks for testing M68000 status register fields
+ **************************************************************************************/
+
+/* trace mode */
+#define m68kSrTraceMask 0x08000
+#define m68kSrTraceBit 15
+
+/* supervisor state */
+#define m68kSrSupervisorMask 0x02000
+
+/* interrupt mask */
+#define m68kSrInterruptMask 0x00700
+#define m68kSrInterruptOffset 8 /* offset for right-shifting interrupt mask */
+
+/* condition codes */
+#define m68kSrExtendMask 0x00010
+#define m68kSrNegativeMask 0x00008
+#define m68kSrZeroMask 0x00004
+#define m68kSrOverflowMask 0x00002
+#define m68kSrCarryMask 0x00001
+
+
+
+#endif //__M68KHWR_H
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Bitmap.h b/SrcShared/Palm/Platform/Incs/Core/System/Bitmap.h
new file mode 100644
index 0000000..37623d3
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Bitmap.h
@@ -0,0 +1,151 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Bitmap.h
+ *
+ * Description:
+ * This file defines bitmap structures and routines.
+ *
+ * History:
+ * September, 1999 Created by Bertrand Simon
+ * Name Date Description
+ * ---- ---- -----------
+ * BS 9/99 Create
+ * jmp 12/23/99 Fix <> vs. "" problem.
+ *
+ *****************************************************************************/
+
+#ifndef __BITMAP_H__
+#define __BITMAP_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+#include <PalmOptErrorCheckLevel.h> // #define ERROR_CHECK_LEVEL
+
+
+//-----------------------------------------------
+// The Bitmap Structure.
+//-----------------------------------------------
+
+// bitmap version numbers
+#define BitmapVersionZero 0
+#define BitmapVersionOne 1
+#define BitmapVersionTwo 2
+
+// Compression Types for BitMap BitmapVersionTwo.
+typedef enum {
+ BitmapCompressionTypeScanLine = 0,
+ BitmapCompressionTypeRLE,
+
+ BitmapCompressionTypeNone = 0xFF
+} BitmapCompressionType;
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER ¥¥¥Ê-- need to add #defines for each bit for endian portableness
+#endif // PUBLIC_STUFF_STRIPPED
+typedef struct BitmapFlagsType {
+ UInt16 compressed:1; // Data format: 0=raw; 1=compressed
+ UInt16 hasColorTable:1; // if true, color table stored before bits[]
+ UInt16 hasTransparency:1; // true if transparency is used
+ UInt16 indirect:1; // true if bits are stored indirectly
+ UInt16 forScreen:1; // system use only
+ UInt16 reserved:11;
+} BitmapFlagsType;
+
+// this definition correspond to the 'Tbmp' and 'tAIB' resource types
+typedef struct BitmapType {
+ Int16 width;
+ Int16 height;
+ UInt16 rowBytes;
+ BitmapFlagsType flags;
+ UInt8 pixelSize; // bits/pixel
+ UInt8 version; // version of bitmap. This is vers 2
+ UInt16 nextDepthOffset; // # of DWords to next BitmapType
+ // from beginnning of this one
+ UInt8 transparentIndex; // v2 only, if flags.hasTransparency is true,
+ // index number of transparent color
+ UInt8 compressionType; // v2 only, if flags.compressed is true, this is
+ // the type, see BitmapCompressionType
+
+ UInt16 reserved; // for future use, must be zero!
+
+ // [colorTableType] pixels | pixels*
+ // If hasColorTable != 0, we have:
+ // ColorTableType followed by pixels.
+ // If hasColorTable == 0:
+ // this is the start of the pixels
+ // if indirect != 0 bits are stored indirectly.
+ // the address of bits is stored here
+ // In some cases the ColorTableType will
+ // have 0 entries and be 2 bytes long.
+} BitmapType;
+
+typedef BitmapType *BitmapPtr;
+
+
+// This is the structure of a color table. It maps pixel values into
+// RGB colors. Each element in the table corresponds to the next
+// index, starting at 0.
+
+typedef struct RGBColorType {
+ UInt8 index; // index of color or best match to cur CLUT or unused.
+ UInt8 r; // amount of red, 0->255
+ UInt8 g; // amount of green, 0->255
+ UInt8 b; // amount of blue, 0->255
+} RGBColorType;
+
+
+typedef struct ColorTableType {
+ // high bits (numEntries > 256) reserved
+ UInt16 numEntries; // number of entries in table
+ // RGBColorType entry[]; // array 0..numEntries-1 of colors
+ // starts immediately after numEntries
+} ColorTableType;
+
+
+// get start of color table entries aray given pointer to ColorTableType
+#define ColorTableEntries(ctP) ((RGBColorType *)((ColorTableType *)(ctP)+1))
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//-----------------------------------------------
+// Routines relating to bitmap management
+//-----------------------------------------------
+
+extern BitmapType *BmpCreate (Coord width, Coord height, UInt8 depth,
+ ColorTableType *colortableP, UInt16 *error)
+ SYS_TRAP(sysTrapBmpCreate);
+
+extern Err BmpDelete (BitmapType *bitmapP)
+ SYS_TRAP(sysTrapBmpDelete);
+
+extern Err BmpCompress(BitmapType *bitmapP, BitmapCompressionType compType )
+ SYS_TRAP(sysTrapBmpCompress);
+
+extern void *BmpGetBits(BitmapType *bitmapP)
+ SYS_TRAP(sysTrapBmpGetBits);
+
+extern ColorTableType *BmpGetColortable(BitmapType *bitmapP)
+ SYS_TRAP(sysTrapBmpGetColortable);
+
+extern UInt16 BmpSize(BitmapType *bitmapP)
+ SYS_TRAP(sysTrapBmpSize);
+
+extern UInt16 BmpBitsSize(BitmapType *bitmapP)
+ SYS_TRAP(sysTrapBmpBitsSize);
+
+extern UInt16 BmpColortableSize(BitmapType *bitmapP)
+ SYS_TRAP(sysTrapBmpColortableSize);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif //__BITMAP_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/CharAttr.h b/SrcShared/Palm/Platform/Incs/Core/System/CharAttr.h
new file mode 100644
index 0000000..4797bdb
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/CharAttr.h
@@ -0,0 +1,129 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: CharAttr.h
+ *
+ * Description:
+ * This file defines character classification and character
+ * conversion macros
+ *
+ * History:
+ * April 21, 1995 Created by Art Lamb
+ *
+ *****************************************************************************/
+
+#ifndef __CHARATTR_H__
+#define __CHARATTR_H__
+
+// Include elementary types
+#include <PalmTypes.h> // Basic types
+#include <CoreTraps.h> // Trap Numbers.
+
+// Remember that sizeof(0x0D) == 2 because 0x0D is treated like an int. The
+// same is true of sizeof('a'), sizeof('\0'), and sizeof(chrNull). For this
+// reason it's safest to use the sizeOf7BitChar macro to document buffer size
+// and string length calcs. Note that this can only be used with low-ascii
+// characters, as anything else might be the high byte of a double-byte char.
+
+#define sizeOf7BitChar(c) 1
+
+#ifdef NON_INTERNATIONAL
+#define sizeofchar(c) sizeof((char) (c))
+#define lastAsciiChr 0x00FF
+#else
+#define sizeofchar(c) _Obsolete__use_sizeOf7BitChar
+#define lastAsciiChr _Obsolete__lastAsciiChr_does_not_work_for_Japanese
+#endif
+
+// Character attribute code bits.
+
+#define _XA 0x0200 // extra alphabetic
+#define _XS 0x0100 // extra space
+#define _BB 0x0080 // BEL, BS, etc.
+#define _CN 0x0040 // CR, FF, HT, NL, VT
+#define _DI 0x0020 // '0'-'9'
+#define _LO 0x0010 // 'a'-'z' and lowercase extended chars.
+#define _PU 0x0008 // punctuation
+#define _SP 0x0004 // space
+#define _UP 0x0002 // 'A'-'Z' and uppercase extended chars.
+#define _XD 0x0001 // '0'-'9', 'A'-'F', 'a'-'f'
+
+
+// These macros have all been deprecated and replaced by corresponding TxtCharXXXX
+// macros found in TextMgr.h. The main problem is that these all assume 8-bit character
+// codes, and thus won't work with Shift JIS and other multi-byte encodings.
+
+// Character classification macros.
+
+#ifdef NON_INTERNATIONAL
+#define IsAscii(c) (c <= 255)
+#define IsAlNum(attr,c) (attr[(UInt8)(c)] & (_DI|_LO|_UP|_XA))
+#define IsAlpha(attr,c) (attr[(UInt8)(c)] & (_LO|_UP|_XA))
+#define IsCntrl(attr,c) (attr[(UInt8)(c)] & (_BB|_CN))
+#define IsDigit(attr,c) (attr[(UInt8)(c)] & _DI)
+#define IsGraph(attr,c) (attr[(UInt8)(c)] & (_DI|_LO|_PU|_UP|_XA))
+#define IsLower(attr,c) (attr[(UInt8)(c)] & _LO)
+#define IsPrint(attr,c) (attr[(UInt8)(c)] & (_DI|_LO|_PU|_SP|_UP|_XA))
+#define IsPunct(attr,c) (attr[(UInt8)(c)] & _PU)
+#define IsSpace(attr,c) (attr[(UInt8)(c)] & (_CN|_SP|_XS))
+#define IsUpper(attr,c) (attr[(UInt8)(c)] & _UP)
+#define IsHex(attr,c) (attr[(UInt8)(c)] & _XD)
+#define IsDelim(attr,c) (attr[(UInt8)(c)] & _SP|_PU)
+#else
+#define IsAscii(c) _Obsolete__use_TxtCharIsValid
+#define IsAlNum(attr,c) _Obsolete__use_TxtCharIsAlNum
+#define IsAlpha(attr,c) _Obsolete__use_TxtCharIsAlpha
+#define IsCntrl(attr,c) _Obsolete__use_TxtCharIsCntrl
+#define IsDigit(attr,c) _Obsolete__use_TxtCharIsDigit
+#define IsGraph(attr,c) _Obsolete__use_TxtCharIsGraph
+#define IsLower(attr,c) _Obsolete__use_TxtCharIsLower
+#define IsPrint(attr,c) _Obsolete__use_TxtCharIsPrint
+#define IsPunct(attr,c) _Obsolete__use_TxtCharIsPunct
+#define IsSpace(attr,c) _Obsolete__use_TxtCharIsSpace
+#define IsUpper(attr,c) _Obsolete__use_TxtCharIsUpper
+#define IsHex(attr,c) _Obsolete__use_TxtCharIsHex
+#define IsDelim(attr,c) _Obsolete__use_TxtCharIsDelim
+#endif
+
+// This macro is deprecated because it relies on character code ranges, versus checking
+// to ensure that the keydown event has the command bit set in the modifiers field. Use
+// the TxtCharIsHardKey macro found in TextMgr.h.
+
+#ifdef NON_INTERNATIONAL
+#define ChrIsHardKey(c) ((((c) >= hardKeyMin) && ((c) <= hardKeyMax)) || ((c) == calcChr))
+#else
+#define ChrIsHardKey(c) _Obsolete__use_TxtCharIsHardKey
+#endif
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// In 3.1 and later versions of Palm OS, these routines have all been replaced by new
+// Text Manager routines found in TextMgr.h
+
+#ifdef NON_INTERNATIONAL
+const UInt16 *GetCharAttr (void)
+ SYS_TRAP(sysTrapGetCharAttr);
+
+const UInt8 *GetCharSortValue (void)
+ SYS_TRAP(sysTrapGetCharSortValue);
+
+const UInt8 *GetCharCaselessValue (void)
+ SYS_TRAP(sysTrapGetCharCaselessValue);
+#else
+#define GetCharAttr() _Obsolete__use_TxtCharIs_macros
+#define GetCharSortValue() _Obsolete__use_TxtCompare
+#define GetCharCaselessValue() _Obsolete__use_TxtCaselessCompare
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif /* __CHARATTR_H__ */
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Chars.h b/SrcShared/Palm/Platform/Incs/Core/System/Chars.h
new file mode 100644
index 0000000..ada116b
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Chars.h
@@ -0,0 +1,411 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Chars.h
+ *
+ * Description:
+ * This file defines the characters in fonts.
+ *
+ * History:
+ * November 3, 1994 Created by Roger Flores
+ * 11/03/94 rsf Created by Roger Flores.
+ * 04/21/99 JFS Added list of virtual command key ranges reserved
+ * for use by licensees.
+ * 09/13/99 kwk Added vchrTsmMode.
+ * 10/28/99 kwk Defined vchrPageUp and vchrPageDown.
+ *
+ *****************************************************************************/
+
+#ifndef __CHARS_H__
+#define __CHARS_H__
+
+// Standard Unicode 2.0 names for the ascii characters. These exist in
+// all of the text fonts, no matter what character encoding is being
+// used by PalmOS.
+
+#define chrNull 0x0000
+#define chrStartOfHeading 0x0001
+#define chrStartOfText 0x0002
+#define chrEndOfText 0x0003
+#define chrEndOfTransmission 0x0004
+#define chrEnquiry 0x0005
+#define chrAcknowledge 0x0006
+#define chrBell 0x0007
+#define chrBackspace 0x0008
+#define chrHorizontalTabulation 0x0009
+#define chrLineFeed 0x000A
+#define chrVerticalTabulation 0x000B
+#define chrFormFeed 0x000C
+#define chrCarriageReturn 0x000D
+#define chrShiftOut 0x000E
+#define chrShiftIn 0x000F
+#define chrDataLinkEscape 0x0010
+#define chrDeviceControlOne 0x0011
+#define chrDeviceControlTwo 0x0012
+#define chrDeviceControlThree 0x0013
+#define chrDeviceControlFour 0x0014
+#define chrNegativeAcknowledge 0x0015
+#define chrSynchronousIdle 0x0016
+#define chrEndOfTransmissionBlock 0x0017
+#define chrCancel 0x0018
+#define chrEndOfMedium 0x0019
+#define chrSubstitute 0x001A
+#define chrEscape 0x001B
+#define chrFileSeparator 0x001C
+#define chrGroupSeparator 0x001D
+#define chrRecordSeparator 0x001E
+#define chrUnitSeparator 0x001F
+#define chrSpace 0x0020
+#define chrExclamationMark 0x0021
+#define chrQuotationMark 0x0022
+#define chrNumberSign 0x0023
+#define chrDollarSign 0x0024
+#define chrPercentSign 0x0025
+#define chrAmpersand 0x0026
+#define chrApostrophe 0x0027
+#define chrLeftParenthesis 0x0028
+#define chrRightParenthesis 0x0029
+#define chrAsterisk 0x002A
+#define chrPlusSign 0x002B
+#define chrComma 0x002C
+#define chrHyphenMinus 0x002D
+#define chrFullStop 0x002E
+#define chrSolidus 0x002F
+#define chrDigitZero 0x0030
+#define chrDigitOne 0x0031
+#define chrDigitTwo 0x0032
+#define chrDigitThree 0x0033
+#define chrDigitFour 0x0034
+#define chrDigitFive 0x0035
+#define chrDigitSix 0x0036
+#define chrDigitSeven 0x0037
+#define chrDigitEight 0x0038
+#define chrDigitNine 0x0039
+#define chrColon 0x003A
+#define chrSemicolon 0x003B
+#define chrLessThanSign 0x003C
+#define chrEqualsSign 0x003D
+#define chrGreaterThanSign 0x003E
+#define chrQuestionMark 0x003F
+#define chrCommercialAt 0x0040
+#define chrCapital_A 0x0041
+#define chrCapital_B 0x0042
+#define chrCapital_C 0x0043
+#define chrCapital_D 0x0044
+#define chrCapital_E 0x0045
+#define chrCapital_F 0x0046
+#define chrCapital_G 0x0047
+#define chrCapital_H 0x0048
+#define chrCapital_I 0x0049
+#define chrCapital_J 0x004A
+#define chrCapital_K 0x004B
+#define chrCapital_L 0x004C
+#define chrCapital_M 0x004D
+#define chrCapital_N 0x004E
+#define chrCapital_O 0x004F
+#define chrCapital_P 0x0050
+#define chrCapital_Q 0x0051
+#define chrCapital_R 0x0052
+#define chrCapital_S 0x0053
+#define chrCapital_T 0x0054
+#define chrCapital_U 0x0055
+#define chrCapital_V 0x0056
+#define chrCapital_W 0x0057
+#define chrCapital_X 0x0058
+#define chrCapital_Y 0x0059
+#define chrCapital_Z 0x005A
+#define chrLeftSquareBracket 0x005B
+// #define chrReverseSolidus 0x005C (not in Japanese fonts)
+#define chrRightSquareBracket 0x005D
+#define chrCircumflexAccent 0x005E
+#define chrLowLine 0x005F
+#define chrGraveAccent 0x0060
+#define chrSmall_A 0x0061
+#define chrSmall_B 0x0062
+#define chrSmall_C 0x0063
+#define chrSmall_D 0x0064
+#define chrSmall_E 0x0065
+#define chrSmall_F 0x0066
+#define chrSmall_G 0x0067
+#define chrSmall_H 0x0068
+#define chrSmall_I 0x0069
+#define chrSmall_J 0x006A
+#define chrSmall_K 0x006B
+#define chrSmall_L 0x006C
+#define chrSmall_M 0x006D
+#define chrSmall_N 0x006E
+#define chrSmall_O 0x006F
+#define chrSmall_P 0x0070
+#define chrSmall_Q 0x0071
+#define chrSmall_R 0x0072
+#define chrSmall_S 0x0073
+#define chrSmall_T 0x0074
+#define chrSmall_U 0x0075
+#define chrSmall_V 0x0076
+#define chrSmall_W 0x0077
+#define chrSmall_X 0x0078
+#define chrSmall_Y 0x0079
+#define chrSmall_Z 0x007A
+#define chrLeftCurlyBracket 0x007B
+#define chrVerticalLine 0x007C
+#define chrRightCurlyBracket 0x007D
+#define chrTilde 0x007E
+#define chrDelete 0x007F
+
+
+// Special meanings given to characters by the PalmOS
+#define vchrPageUp chrVerticalTabulation // 0x000B
+#define vchrPageDown chrFormFeed // 0x000C
+#define chrOtaSecure chrDeviceControlFour // 0x0014
+#define chrOta chrNegativeAcknowledge // 0x0015
+#define chrCommandStroke chrSynchronousIdle // 0x0016
+#define chrShortcutStroke chrEndOfTransmissionBlock // 0x0017
+#define chrEllipsis chrCancel // 0x0018
+#define chrNumericSpace chrEndOfMedium // 0x0019
+#define chrLeftArrow chrFileSeparator // 0x001C
+#define chrRightArrow chrGroupSeparator // 0x001D
+#define chrUpArrow chrRecordSeparator // 0x001E
+#define chrDownArrow chrUnitSeparator // 0x001F
+
+
+// The following are key codes used for virtual events, like
+// low battery warnings, etc. These keyboard events MUST
+// have the commandKeyMask bit set in the modifiers in order
+// to be recognized.
+#define vchrLowBattery 0x0101 // Display low battery dialog
+#define vchrEnterDebugger 0x0102 // Enter Debugger
+#define vchrNextField 0x0103 // Go to next field in form
+#define vchrStartConsole 0x0104 // Startup console task
+#define vchrMenu 0x0105 // Ctl-A
+#define vchrCommand 0x0106 // Ctl-C
+#define vchrConfirm 0x0107 // Ctl-D
+#define vchrLaunch 0x0108 // Ctl-E
+#define vchrKeyboard 0x0109 // Ctl-F popup the keyboard in appropriate mode
+#define vchrFind 0x010A
+#define vchrCalc 0x010B
+#define vchrPrevField 0x010C
+#define vchrAlarm 0x010D // sent before displaying an alarm
+#define vchrRonamatic 0x010E // stroke from graffiti area to top half of screen
+#define vchrGraffitiReference 0x010F // popup the Graffiti reference
+#define vchrKeyboardAlpha 0x0110 // popup the keyboard in alpha mode
+#define vchrKeyboardNumeric 0x0111 // popup the keyboard in number mode
+#define vchrLock 0x0112 // switch to the Security app and lock the device
+#define vchrBacklight 0x0113 // toggle state of backlight
+#define vchrAutoOff 0x0114 // power off due to inactivity timer
+// Added for PalmOS 3.0
+#define vchrExgTest 0x0115 // put exchange Manager into test mode (&.t)
+#define vchrSendData 0x0116 // Send data if possible
+#define vchrIrReceive 0x0117 // Initiate an Ir receive manually (&.i)
+// Added for PalmOS 3.1
+#define vchrTsm1 0x0118 // Text Services silk-screen button
+#define vchrTsm2 0x0119 // Text Services silk-screen button
+#define vchrTsm3 0x011A // Text Services silk-screen button
+#define vchrTsm4 0x011B // Text Services silk-screen button
+// Added for PalmOS 3.2
+#define vchrRadioCoverageOK 0x011C // Radio coverage check successful
+#define vchrRadioCoverageFail 0x011D // Radio coverage check failure
+#define vchrPowerOff 0x011E // Posted after autoOffChr or hardPowerChr
+ // to put system to sleep with SysSleep.
+// Added for PalmOS 3.5
+#define vchrResumeSleep 0x011F // Posted by NotifyMgr clients after they
+ // have deferred a sleep request in order
+ // to resume it.
+#define vchrLateWakeup 0x0120 // Posted by the system after waking up
+ // to broadcast a late wakeup notification.
+ // FOR SYSTEM USE ONLY
+#define vchrTsmMode 0x0121 // Posted by TSM to trigger mode change.
+#define vchrBrightness 0x0122 // Activates brightness adjust dialog
+#define vchrContrast 0x0123 // Activates contrast adjust dialog
+#define vchrExgIntData 0x01FF // Exchange Manager wakeup event
+
+// The application launching buttons generate the following
+// key codes and will also set the commandKeyMask bit in the
+// modifiers field
+#define vchrHardKeyMin 0x0200
+#define vchrHardKeyMax 0x02FF // 256 hard keys
+
+#define vchrHard1 0x0204
+#define vchrHard2 0x0205
+#define vchrHard3 0x0206
+#define vchrHard4 0x0207
+#define vchrHardPower 0x0208
+#define vchrHardCradle 0x0209 // Button on cradle pressed
+#define vchrHardCradle2 0x020A // Button on cradle pressed and hwrDockInGeneric1
+ // input on dock asserted (low).
+#define vchrHardContrast 0x020B // Sumo's Contrast button
+#define vchrHardAntenna 0x020C // Eleven's Antenna switch
+#define vchrHardBrightness 0x020D // Hypothetical Brightness button
+
+
+
+// The following keycode RANGES are reserved for use by licensees.
+// All have the commandKeyMask bit set in the event's modifiers field.
+// Note that ranges include the Min and Max values themselves (i.e. key
+// codes >= min and <= max are assigned to the following licensees).
+//
+// Qualcomm
+#define vchrThumperMin 0x0300
+#define vchrThumperMax 0x03FF // 256 command keys
+
+// Motorola
+#define vchrCessnaMin 0x14CD
+#define vchrCessnaMax 0x14CD // 1 command key
+
+// TRG
+#define vchrCFlashMin 0x1500
+#define vchrCFlashMax 0x150F // 16 command keys
+
+// Symbol
+#define vchrSPTMin 0x15A0
+#define vchrSPTMax 0x15AF // 16 command keys
+
+// Handspring
+#define vchrSlinkyMin 0x1600
+#define vchrSlinkyMax 0x16FF // 256 command keys
+
+
+
+// Old names for some of the characters.
+#define nullChr chrNull // 0x0000
+#define backspaceChr chrBackspace // 0x0008
+#define tabChr chrHorizontalTabulation // 0x0009
+#define linefeedChr chrLineFeed // 0x000A
+#define pageUpChr vchrPageUp // 0x000B
+#define chrPageUp vchrPageUp // 0x000B
+#define pageDownChr vchrPageDown // 0x000C
+#define chrPageDown vchrPageDown // 0x000C
+#define crChr chrCarriageReturn // 0x000D
+#define returnChr chrCarriageReturn // 0x000D
+#define otaSecureChr chrOtaSecure // 0x0014
+#define otaChr chrOta // 0x0015
+
+#define escapeChr chrEscape // 0x001B
+#define leftArrowChr chrLeftArrow // 0x001C
+#define rightArrowChr chrRightArrow // 0x001D
+#define upArrowChr chrUpArrow // 0x001E
+#define downArrowChr chrDownArrow // 0x001F
+#define spaceChr chrSpace // 0x0020
+#define quoteChr chrQuotationMark // 0x0022 '"'
+#define commaChr chrComma // 0x002C ','
+#define periodChr chrFullStop // 0x002E '.'
+#define colonChr chrColon // 0x003A ':'
+#define lowBatteryChr vchrLowBattery // 0x0101
+#define enterDebuggerChr vchrEnterDebugger // 0x0102
+#define nextFieldChr vchrNextField // 0x0103
+#define startConsoleChr vchrStartConsole // 0x0104
+#define menuChr vchrMenu // 0x0105
+#define commandChr vchrCommand // 0x0106
+#define confirmChr vchrConfirm // 0x0107
+#define launchChr vchrLaunch // 0x0108
+#define keyboardChr vchrKeyboard // 0x0109
+#define findChr vchrFind // 0x010A
+#define calcChr vchrCalc // 0x010B
+#define prevFieldChr vchrPrevField // 0x010C
+#define alarmChr vchrAlarm // 0x010D
+#define ronamaticChr vchrRonamatic // 0x010E
+#define graffitiReferenceChr vchrGraffitiReference // 0x010F
+#define keyboardAlphaChr vchrKeyboardAlpha // 0x0110
+#define keyboardNumericChr vchrKeyboardNumeric // 0x0111
+#define lockChr vchrLock // 0x0112
+#define backlightChr vchrBacklight // 0x0113
+#define autoOffChr vchrAutoOff // 0x0114
+#define exgTestChr vchrExgTest // 0x0115
+#define sendDataChr vchrSendData // 0x0116
+#define irReceiveChr vchrIrReceive // 0x0117
+#define radioCoverageOKChr vchrRadioCoverageOK // 0x011C
+#define radioCoverageFailChr vchrRadioCoverageFail // 0x011D
+#define powerOffChr vchrPowerOff // 0x011E
+#define resumeSleepChr vchrResumeSleep // 0x011F
+#define lateWakeupChr vchrLateWakeup // 0x0120
+#define brightnessChr vchrBrightness // 0x0121
+#define contrastChr vchrContrast // 0x0122
+#define hardKeyMin vchrHardKeyMin // 0x0200
+#define hardKeyMax vchrHardKeyMax // 0x02FF
+#define hard1Chr vchrHard1 // 0x0204
+#define hard2Chr vchrHard2 // 0x0205
+#define hard3Chr vchrHard3 // 0x0206
+#define hard4Chr vchrHard4 // 0x0207
+#define hardPowerChr vchrHardPower // 0x0208
+#define hardCradleChr vchrHardCradle // 0x0209
+#define hardCradle2Chr vchrHardCradle2 // 0x020A
+#define hardContrastChr vchrHardContrast // 0x020B
+#define hardAntennaChr vchrHardAntenna // 0x020C
+#define hardBrightnessChr vchrHardBrightness // 0x020D
+
+// Macros to determine correct character code to use for drawing numeric space
+// and horizontal ellipsis.
+
+#define ChrNumericSpace(chP) \
+ do { \
+ UInt32 attribute; \
+ if ((FtrGet(sysFtrCreator, sysFtrNumROMVersion, &attribute) == 0) \
+ && (attribute >= sysMakeROMVersion(3, 1, 0, 0, 0))) { \
+ *(chP) = chrNumericSpace; \
+ } else { \
+ *(chP) = 0x80; \
+ } \
+ } while (0)
+
+#define ChrHorizEllipsis(chP) \
+ do { \
+ UInt32 attribute; \
+ if ((FtrGet(sysFtrCreator, sysFtrNumROMVersion, &attribute) == 0) \
+ && (attribute >= sysMakeROMVersion(3, 1, 0, 0, 0))) { \
+ *(chP) = chrEllipsis; \
+ } else { \
+ *(chP) = 0x85; \
+ } \
+ } while (0)
+
+// Characters in the 9 point symbol font. Resource ID 9003
+enum symbolChars {
+ symbolLeftArrow = 3,
+ symbolRightArrow,
+ symbolUpArrow,
+ symbolDownArrow,
+ symbolSmallDownArrow,
+ symbolSmallUpArrow,
+ symbolMemo = 9,
+ symbolHelp,
+ symbolNote,
+ symbolNoteSelected,
+ symbolCapsLock,
+ symbolNumLock,
+ symbolShiftUpper,
+ symbolShiftPunc,
+ symbolShiftExt,
+ symbolShiftNone,
+ symbolNoTime,
+ symbolAlarm,
+ symbolRepeat,
+ symbolCheckMark,
+ // These next four characters were moved from the 0x8D..0x90
+ // range in the main fonts to the 9pt Symbol font in PalmOS 3.1
+ symbolDiamondChr,
+ symbolClubChr,
+ symbolHeartChr,
+ symbolSpadeChr
+ };
+
+// Character in the 7 point symbol font. Resource ID 9005
+enum symbol7Chars {
+ symbol7ScrollUp = 1,
+ symbol7ScrollDown,
+ symbol7ScrollUpDisabled,
+ symbol7ScrollDownDisabled
+ };
+
+// Characters in the 11 point symbol font. Resource ID 9004
+enum symbol11Chars {
+ symbolCheckboxOff = 0,
+ symbolCheckboxOn,
+ symbol11LeftArrow,
+ symbol11RightArrow,
+ symbol11LeftArrowDisabled, // New for Palm OS v3.2
+ symbol11RightArrowDisabled // New for Palm OS v3.2
+ };
+
+
+#endif // __CHARS_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Crc.h b/SrcShared/Palm/Platform/Incs/Core/System/Crc.h
new file mode 100644
index 0000000..bd7c3e5
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Crc.h
@@ -0,0 +1,63 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Crc.h
+ *
+ * Description:
+ * This is the header file for the CRC calculation routines for Pilot.
+ *
+ * History:
+ * May 10, 1995 Created by Vitaly Kruglikov
+ * 05/10/95 vmk Created by Vitaly Kruglikov.
+ * 09/10/99 kwk Crc16CalcBlock takes a const void *.
+ *
+ *****************************************************************************/
+
+#ifndef __CRC_H__
+#define __CRC_H__
+
+
+// Include elementary types
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+
+
+
+/********************************************************************
+ * CRC Calculation Routines
+ * These are define as external calls only under emulation mode or
+ * under native mode from the module that actually installs the trap
+ * vectors
+ ********************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+
+//-------------------------------------------------------------------
+// API
+//-------------------------------------------------------------------
+
+
+// Crc16CalcBlock()
+//
+// Calculate the 16-bit CRC of a data block using the table lookup method.
+//
+UInt16 Crc16CalcBlock(const void *bufP, UInt16 count, UInt16 crc)
+ SYS_TRAP(sysTrapCrc16CalcBlock);
+
+UInt16 Crc16CalcBigBlock(void *bufP, UInt32 count, UInt16 crc);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#endif // __CRC_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/DLCommon.h b/SrcShared/Palm/Platform/Incs/Core/System/DLCommon.h
new file mode 100644
index 0000000..af8a449
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/DLCommon.h
@@ -0,0 +1,2433 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: DLCommon.h
+ *
+ * Description:
+ * Desktop Link Protocol(DLP) function id's, parameters, and frame
+ * structures.
+ *
+ * History:
+ * 6/7/95 vmk Created by Vitaly Marty Kruglikov
+ * 6/15/95 vmk Changed dlp/Read/Write/UserID to dlp/Read/Write/UserInfo and
+ * added the last sync PC id field to their arguments at Laura's request.
+ * 6/15/95 vmk Added option to dlpDeleteRecord to delete all records in DB.
+ *
+ *****************************************************************************/
+
+#ifndef __DLCOMMON_H__
+#define __DLCOMMON_H__
+
+#include <PalmTypes.h>
+
+/************************************************************
+ * DesktopLink function codes
+ *************************************************************/
+
+// DlpFuncID -- function id's used in request blocks sent to
+// the DesktopLink application on Pilot. The width of the function
+// id base is 7 bits. The high order bit(the 8th bit) is used to
+// distinguish requests from their responses -- it is cleared in request
+// blocks and is set in response blocks (i.e., the response to a particular
+// command will have the same function code base as the command and the
+// high order bit set). See dlpFuncRespFlag defined below.
+//
+typedef enum DlpFuncID {
+
+ dlpReservedFunc = 0x0F, // range reserved for internal use
+
+ // DLP 1.0 FUNCTIONS START HERE (PalmOS v1.0)
+ dlpReadUserInfo,
+
+ dlpWriteUserInfo,
+
+ dlpReadSysInfo,
+
+ dlpGetSysDateTime,
+
+ dlpSetSysDateTime,
+
+ dlpReadStorageInfo,
+
+ dlpReadDBList,
+
+ dlpOpenDB,
+
+ dlpCreateDB,
+
+ dlpCloseDB,
+
+ dlpDeleteDB,
+
+ dlpReadAppBlock,
+
+ dlpWriteAppBlock,
+
+ dlpReadSortBlock,
+
+ dlpWriteSortBlock,
+
+ dlpReadNextModifiedRec,
+
+ dlpReadRecord,
+
+ dlpWriteRecord,
+
+ dlpDeleteRecord,
+
+ dlpReadResource,
+
+ dlpWriteResource,
+
+ dlpDeleteResource,
+
+ dlpCleanUpDatabase,
+
+ dlpResetSyncFlags,
+
+ dlpCallApplication,
+
+ dlpResetSystem,
+
+ dlpAddSyncLogEntry,
+
+ dlpReadOpenDBInfo,
+
+ dlpMoveCategory,
+
+ dlpProcessRPC, // remote procedure calls interface
+
+ dlpOpenConduit, // this command is sent before each conduit is opened
+
+ dlpEndOfSync, // ends the sync session
+
+ dlpResetRecordIndex, // resets "modified record" index
+
+ dlpReadRecordIDList, // LAST 1.0 FUNCTION
+
+
+ // DLP 1.1 FUNCTIONS ADDED HERE (PalmOS v2.0 Personal, and Professional)
+ dlpReadNextRecInCategory, // iterate through all records in category
+
+ dlpReadNextModifiedRecInCategory, // iterate through modified records in category
+
+ dlpReadAppPreference, // read application preference
+
+ dlpWriteAppPreference, // write application preference
+
+ dlpReadNetSyncInfo, // read Network HotSync settings
+
+ dlpWriteNetSyncInfo, // write Network HotSync settings
+
+ dlpReadFeature, // read a feature from Feature Manager
+
+
+ // DLP 1.2 FUNCTIONS ADDED HERE (PalmOS v3.0)
+ dlpFindDB, // find a database given creator and type, or name, or
+ // get info on currently-open db
+ dlpSetDBInfo, // change database information (name, attributes, version,
+ // creation, modification, backup dates, type and creator
+
+
+
+
+ dlpLastFunc // ***ALWAYS KEEP LAST***
+
+ } DlpFuncID;
+
+#define dlpLastPilotV10FuncID dlpReadRecordIDList
+
+
+// Desktop Link function error codes returned in the response errorCode
+// field.
+typedef enum DlpRespErrorCode {
+ dlpRespErrNone = 0, // reserve 0 for no error
+ dlpRespErrSystem, // general Pilot system error
+ dlpRespErrIllegalReq, // unknown function ID
+ dlpRespErrMemory, // insufficient dynamic heap memory
+ dlpRespErrParam, // invalid parameter
+ dlpRespErrNotFound, // database, record, or resource not found
+ dlpRespErrNoneOpen, // there are no open databases
+ dlpRespErrDatabaseOpen, // database is open by someone else
+ dlpRespErrTooManyOpenDatabases, // there are too many open databases
+ dlpRespErrAlreadyExists, // DB already exists
+ dlpRespErrCantOpen, // couldn't open DB
+ dlpRespErrRecordDeleted, // record is deleted
+ dlpRespErrRecordBusy, // record is in use by someone else
+ dlpRespErrNotSupported, // the requested operation is not supported
+ // on the given database type(record or resource)
+ dlpRespErrUnused1, // was dlpRespErrROMBased
+ dlpRespErrReadOnly, // caller does not have write access(or DB is in ROM)
+ dlpRespErrNotEnoughSpace, // not enough space in data store for record/resource/etc.
+ dlpRespErrLimitExceeded, // size limit exceeded
+ dlpRespErrCancelSync, // cancel the sync
+
+ dlpRespErrBadWrapper, // bad arg wrapper(for debugging)
+ dlpRespErrArgMissing, // required arg not found(for debugging)
+ dlpRespErrArgSize, // invalid argument size
+
+ dlpRespErrLastReserved = 127 // last error code reserved for Palm
+ // *KEEP THIS ENTRY LAST*
+ } DlpRespErrorCode;
+
+
+// Database flags
+// NOTE: THESE *MUST* MATCH THE TOUCHDOWN DB ATTRIBUTES(AT LEAST IN THE FIRST VERSION).
+// ANY CHANGES MUST BE REFLECTED IN "READ DB LIST" AND
+#define dlpDBFlagResDB 0x0001 // resource DB if set; record DB if cleared
+
+#define dlpDBFlagReadOnly 0x0002 // DB is read only if set; read/write if cleared
+
+#define dlpDBFlagAppInfoDirty 0x0004 // Set if Application Info block is dirty
+ // Optionally supported by an App's conduit
+
+#define dlpDBFlagBackup 0x0008 // Set if database should be backed up to PC if
+ // no app-specific synchronization conduit has
+ // been supplied.
+
+#define dlpDBFlagOKToInstallNewer 0x0010 // This tells the backup conduit that it's OK
+ // for it to install a newer version of this database
+ // with a different name if the current database is
+ // open. This mechanism is used to update the
+ // Graffiti Shortcuts database, for example.
+
+#define dlpDBFlagResetAfterInstall 0x0020 // Device requires a reset after this database is
+ // installed.
+
+#define dlpDBFlagCopyPrevention 0x0040 // This database should not be copied to
+ // another deviced.
+
+#define dlpDBFlagOpen 0x8000 // DB is open
+
+
+
+
+// Database record attributes
+#define dlpRecAttrDeleted 0x80 // delete this record next sync
+#define dlpRecAttrDirty 0x40 // archive this record next sync
+#define dlpRecAttrBusy 0x20 // record currently in use
+#define dlpRecAttrSecret 0x10 // "secret" record - password protected
+#define dlpRecAttrArchived 0x08 // archived record
+
+
+// Date/time will be described in the following format
+// yr(2 bytes), mo(1 byte, 1-12), dy(1 byte, 1-31),
+// hr(1 byte, 0-23), min(1 byte, 0-59), sec(1 byte, 0-59),
+// unused(1 byte).
+
+typedef struct DlpDateTimeType { // OFFSET
+ UInt16 year; // 0; year (high, low)
+ UInt8 month; // 2; month: 1-12
+ UInt8 day; // 3; day: 1-31
+ UInt8 hour; // 4; hour: 0-23
+ UInt8 minute; // 5; minute: 0-59
+ UInt8 second; // 6; second: 0-59
+ UInt8 unused; // 7; unused -- set to null!
+ } DlpDateTimeType; // TOTAL: 8 bytes
+
+
+// Version structure
+typedef struct DlpVersionType {
+ // OFFSET
+ UInt16 wMajor; // 0; major version number (0 = ignore)
+ UInt16 wMinor; // 2; minor version number
+ // TOTAL: 4 bytes
+ } DlpVersionType;
+
+
+/************************************************************
+ * Request and Response headers.
+ *
+ * Each DLP request and response data block begins with the
+ * corresponding header structure which identifies the function
+ * id, argument count, and error code(responses only).
+ *************************************************************/
+
+// Request header:
+//
+typedef struct DlpReqHeaderType {
+ // OFFSET
+ UInt8 id; // 0; request function ID
+ UInt8 argc; // 2; count of args that follow this header
+ // TOTAL: 2 bytes
+ } DlpReqHeaderType;
+
+typedef DlpReqHeaderType* DlpReqHeaderPtr;
+
+typedef struct DlpReqType {
+ // OFFSET
+ DlpReqHeaderType header; // 0; request header
+ // FIXED SIZE: 2 bytes
+ UInt8 args[2]; // 2; request arguments -- var size
+ } DlpReqType;
+
+typedef DlpReqType* DlpReqPtr;
+
+// Response header:
+//
+typedef struct DlpRespHeaderType {
+ // OFFSET
+ UInt8 id; // 0; response function ID
+ UInt8 argc; // 1; count of arguments that follow this header
+ UInt16 errorCode; // 2; error code
+ // TOTAL: 4 bytes
+ } DlpRespHeaderType;
+
+typedef DlpRespHeaderType* DlpRespHeaderPtr;
+
+typedef struct DlpRespType {
+ // OFFSET
+ DlpRespHeaderType header; // 0; response header
+ // FIXED SIZE: 4 bytes
+ UInt8 args[2]; // 4; response arguments -- var size
+ } DlpRespType;
+
+typedef DlpRespType* DlpRespPtr;
+
+
+// Generic request/response body type(for utility routines)
+//
+typedef union DlpGenericBodyType {
+ UInt8 id; // request/response id
+ DlpReqType req; // request body
+ DlpRespType resp; // response body
+ } DlpGenericBodyType;
+
+typedef DlpGenericBodyType* DlpGenericBodyPtr;
+
+
+// dlpFuncRespFlag is used to form a function response ID from a
+// function ID by or'ing it with the function ID. For example: if
+// dlpFuncDeleteResource is the request ID, the correct response ID
+// must be (dlpFuncDeleteResource | dlpFuncRespFlag).
+//
+#define dlpFuncRespFlag 0x80
+
+// dlpFuncIDMask is used to mask out the function ID value
+#define dlpFuncIDMask 0x7f
+
+// dlpFirstArgID is the value of the first argument ID to be defined for
+// functions. Values below it are reserved.
+//
+#define dlpFirstArgID 0x20
+
+
+/************************************************************
+ *
+ * Argument headers used to "wrap" request and response arguments
+ *
+ * IMPORTANT: ARGUMENT WRAPPERS IN REQUESTS AND RESPONSES MUST
+ * ALWAYS START ON AN EVEN-BYTE BOUNDARY. The server
+ * implementation expects this to be the case.
+ *
+ *************************************************************/
+
+// dlpSmallArgFlag is used to identify "small" argument wrappers by
+// or'ing it with the argument id in argument header.
+//
+#define dlpSmallArgFlag 0x080
+
+// dlpShortArgIDMask is used to mask out the argument id value
+//
+#define dlpShortArgIDMask 0x7F
+
+
+// dlpLongArgFlag is used to identify "long" argument wrappers by
+// or'ing it with the argument id in argument header.
+//
+#define dlpLongArgFlag 0xC000
+
+// dlpLongArgIDMask is used to mask out the argument id value
+//
+#define dlpLongArgIDMask 0x3FFF
+
+
+//-------------------------------------------------------------------------
+// Int16 argument wrappers (v1.0-compatible)
+//-------------------------------------------------------------------------
+
+// Maximum Int16 argument size which can be "wrapped"
+#define dlpMaxTinyArgSize 0x000000FFL
+#define dlpMaxSmallArgSize 0x0000FFFFL
+#define dlpMaxShortArgSize dlpMaxSmallArgSize
+
+
+
+// Tiny argument header for data sizes up to 255 bytes(optimization)
+//
+typedef struct DlpTinyArgWrapperType {
+ // OFFSET
+ UInt8 bID; // 0; argument ID
+ UInt8 bSize; // 1; argument size (does NOT include this arg header)
+ // TOTAL: 2 bytes
+ } DlpTinyArgWrapperType;
+
+typedef struct DlpTinyArgType {
+ DlpTinyArgWrapperType wrapper; // 0; argument header
+ UInt8 data[2]; // 2; argument data -- var size
+ } DlpTinyArgType;
+
+
+// Small argument header for data sizes above 255 bytes(*may also be used for
+// smaller arguments when convenient*)
+//
+typedef struct DlpSmallArgWrapperType {
+ // OFFSET
+ UInt8 bID; // 0; argument ID
+ UInt8 unused; // 1; unused(for alignment) -- set to null!
+ UInt16 wSize; // 2; argument size (does NOT include this arg header)
+ // TOTAL: 4 bytes
+ } DlpSmallArgWrapperType;
+
+typedef struct DlpSmallArgType {
+ DlpSmallArgWrapperType wrapper; // 0; argument header
+ UInt8 data[2]; // 4; argument data -- var size
+ } DlpSmallArgType;
+
+// Unions of Int16 argument types
+typedef union DlpShortArgWrapperType {
+ UInt8 bID; // arg id
+ DlpTinyArgWrapperType tiny; // "tiny" arg wrapper
+ DlpSmallArgWrapperType small; // "tiny" arg wrapper
+ } DlpShortArgWrapperType;
+typedef DlpShortArgWrapperType* DlpShortArgWrapperPtr;
+
+typedef union DlpShortArgType {
+ UInt8 bID; // arg id
+ DlpTinyArgType tiny; // "tiny" arg
+ DlpSmallArgType small; // "small" arg
+ } DlpShortArgType;
+
+typedef DlpShortArgType* DlpShortArgPtr;
+
+
+
+//-------------------------------------------------------------------------
+// Int32 argument wrapper (v2.0 extension)
+//-------------------------------------------------------------------------
+// NOTE: Pilot v2.0 will implement the capability to parse long arguments
+// but will not originate them. This will assure backwards compatibility with
+// the 1.0 desktop as well as compatibility with the future version of the
+// desktop software which may originate the "long" argument wrappers.
+//
+// Int32 argument wrappers are identified by the dlpLongArgFlag bits set
+// in the argument id field.
+
+// Maximum long argument size which can be "wrapped"
+#define dlpMaxLongArgSize 0xFFFFFFFFL
+
+typedef struct DlpLongArgWrapperType {
+ // OFFSET
+ UInt16 wID; // 0; argument ID
+ UInt32 dwSize; // 2; argument size (does NOT include this arg header)
+ // TOTAL: 6 bytes
+ } DlpLongArgWrapperType;
+typedef DlpLongArgWrapperType* DlpLongArgWrapperPtr;
+
+typedef struct DlpLongArgType {
+ // OFFSET
+ DlpLongArgWrapperType wrapper; // 0; argument header
+ UInt8 data[2]; // 6; argument data -- var size
+ } DlpLongArgType;
+typedef DlpLongArgType* DlpLongArgPtr;
+
+
+//-------------------------------------------------------------------------
+// Unions of all argument and wrapper types
+//-------------------------------------------------------------------------
+
+// Union of all argument wrapper types
+typedef union DlpGenericArgWrapperType {
+ DlpShortArgWrapperType shortWrap; // "Int16" arg wrapper(tiny and small)
+ DlpLongArgWrapperType longWrap; // "long" arg wrapper
+ } DlpGenericArgWrapperType;
+typedef DlpGenericArgWrapperType* DlpGenericArgWrapperPtr;
+
+
+// Union of all argument types
+typedef union DlpGenericArgType {
+ DlpShortArgType shortArg; // "Int16" arg(tiny and small)
+ DlpLongArgType longArg; // "long" arg
+ } DlpGenericArgType;
+typedef DlpGenericArgType* DlpGenericArgPtr;
+
+
+/********************************************************************
+ * Desktop Link Protocol Parameters
+ ********************************************************************/
+
+// dlpCmdTimeoutSec -- this is the number of seconds to wait for a command
+// to begin coming in before timing out
+//
+#define dlpCmdTimeoutSec 30
+
+
+
+/************************************************************
+ * DLP function argument structures
+ *************************************************************/
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadUserInfo
+//////////////////////////////////////////////////////////////////////////
+// Request arguments: none
+//
+// Response arguments:
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory
+
+// Request argument structure:
+//
+// none.
+
+// Response argument structure:
+//
+#define dlpReadUserInfoRespArgID dlpFirstArgID
+
+typedef struct DlpReadUserInfoRespHdrType {
+ // OFFSET
+ UInt32 userID; // 0; user ID number (0 if none)
+ UInt32 viewerID; // 4; id assigned to viewer by the desktop
+ UInt32 lastSyncPC; // 8; last sync PC id (0 if none)
+ DlpDateTimeType succSyncDate; // 12; last successful sync (year = 0 if none)
+ DlpDateTimeType lastSyncDate; // 20; last sync date(year = 0 if none)
+ UInt8 userNameLen; // 28; length of user name field,
+ // including null (0 = no user name)
+ UInt8 passwordLen; // 29; length of encrypted password
+ // (0 = no password set)
+ // TOTAL: 30 bytes
+ } DlpReadUserInfoRespHdrType;
+
+typedef struct DlpReadUserInfoRespType {
+ // OFFSET
+ DlpReadUserInfoRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 30 bytes
+ UInt8 nameAndPassword[2]; // 30; user name -- var size
+ // User name begins at the nameAndPassword field and is null-terminated.
+ // The encrypted password follows the user name and is NOT null-terminated.
+ // The encrypted password may contain any byte values(0-255).
+ } DlpReadUserInfoRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpWriteUserInfo
+//////////////////////////////////////////////////////////////////////////
+// Request arguments:
+// user id (4 bytes)
+// last sync PC id(4 bytes)
+// user name
+//
+// Response arguments: none
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrNotEnoughSpace,
+// dlpRespErrParam
+
+// Request argument structure:
+//
+#define dlpWriteUserInfoReqArgID dlpFirstArgID
+
+#define dlpMaxUserNameSize 41 // max user name size, including null byte
+
+typedef struct DlpWriteUserInfoReqHdrType {
+ // OFFSET
+ UInt32 userID; // 0; user ID number
+ UInt32 viewerID; // 4; id assigned to viewer by the desktop
+ UInt32 lastSyncPC; // 8; last sync PC id
+ DlpDateTimeType lastSyncDate; // 12; last sync date(year = 0 if none)
+ UInt8 modFlags; // 20; flags indicating which values are being
+ // modified; see the dlpUserInfoMod...
+ // flags defined below
+ UInt8 userNameLen; // 21; user name length, including null
+ // TOTAL: 22 bytes
+ } DlpWriteUserInfoReqHdrType;
+
+// Flags indicating which values are being changed by the dlpWriteUserInfo
+// request. These flags are used in the modFlags field of DlpWriteUserInfoReqHdrType.
+// These flags are additive.
+//
+#define dlpUserInfoModUserID 0x80 // changing the user id
+#define dlpUserInfoModSyncPC 0x40 // changing the last sync PC id
+#define dlpUserInfoModSyncDate 0x20 // changing sync date
+#define dlpUserInfoModName 0x10 // changing user name
+#define dlpUserInfoModViewerID 0x08 // changing the viewer id
+
+typedef struct DlpWriteUserInfoReqType {
+ // OFFSET
+ DlpWriteUserInfoReqHdrType
+ header; // 0; fixed-size header
+ // FIXED SIZE: 22 bytes
+ UInt8 userName[2]; // 22; user name -- var size
+ // User name begins at the userName field and is null-terminated.
+ } DlpWriteUserInfoReqType;
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadSysInfo
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem
+//
+
+// Request argument structure:
+//
+// none. DLP v1.0 and v1.1
+
+enum {
+ // NEW FOR DLP v1.2:
+ dlpReadSysInfoReqArgID = dlpFirstArgID
+ };
+
+
+// dlpReadSysInfoReqArgID request arg structure
+//
+typedef struct DlpReadSysInfoReqType {
+ // OFFSET
+ DlpVersionType dlpVer; // 0; DLP version of the caller
+ // TOTAL: 4 bytes
+ } DlpReadSysInfoReqType;
+
+
+// Response argument structure:
+//
+// Both response arguments are returned in one reply
+enum {
+ dlpReadSysInfoRespArgID = dlpFirstArgID,
+
+ // NEW FOR DLP v1.2:
+ dlpReadSysInfoVerRespArgID
+ };
+
+// dlpReadSysInfoRespArgID response arg structure:
+//
+typedef struct DlpReadSysInfoRespType {
+ // OFFSET
+ UInt32 romSWVersion; // 0; ROM-based sys software version
+ UInt32 localizationID;// 4; localization ID
+ UInt8 unused; // 8; unused(for alignment) -- set to null!
+ UInt8 prodIDSize; // 9; size of productID/model field
+ UInt32 prodID; // 10; product id (was variable size)
+ // TOTAL: 14 bytes
+ } DlpReadSysInfoRespType;
+
+
+// dlpReadSysInfoVerRespArgID response arg structure:
+//
+typedef struct DlpReadSysInfoVerRespType {
+ // OFFSET
+ DlpVersionType dlpVer; // 0; DLP version of the device
+ DlpVersionType compVer; // 4; product compatibility version of the device
+ UInt32 dwMaxRecSize; // 8; maximum record/resource size that may be allocated on
+ // the device given that sufficient free memory exists
+ // (0xFFFFFFFF = up to available memory)
+ // TOTAL: 12 bytes
+ } DlpReadSysInfoVerRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpGetSysDateTime
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes: none
+
+// Request argument structure:
+//
+// none.
+
+// Response argument structure:
+//
+#define dlpGetSysDateTimeRespArgID dlpFirstArgID
+
+typedef struct DlpGetSysDateTimeRespType {
+ // OFFSET
+ DlpDateTimeType dateTime; // 0; system date/time
+ // TOTAL: 8 bytes
+ } DlpGetSysDateTimeRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpSetSysDateTime
+//////////////////////////////////////////////////////////////////////////
+// Request arguments:
+// new system date/time
+//
+// Response arguments: none
+//
+// Possible error codes
+// dlpRespErrParam
+
+// Request argument structure:
+//
+#define dlpSetSysDateTimeReqArgID dlpFirstArgID
+
+typedef struct DlpSetSysDateTimeReqType {
+ // OFFSET
+ DlpDateTimeType dateTime; // 0; new system date/time
+ // TOTAL: 8 bytes
+ } DlpSetSysDateTimeReqType;
+
+typedef DlpSetSysDateTimeReqType* DlpSetSysDateTimeReqPtr;
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadStorageInfo
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrNotFound
+
+// Request argument structure:
+//
+enum {
+ dlpReadStorageInfoReqArgID = dlpFirstArgID
+ };
+
+typedef struct DlpReadStorInfoReqType {
+ // OFFSET
+ UInt8 startCardNo; // 0; card number to start at
+ // (0 = first)
+ UInt8 unused; // 1; unused -- set to null!
+ // TOTAL: 2 bytes
+ } DlpReadStorInfoReqType;
+
+
+// Response argument structure:
+//
+enum {
+ dlpReadStorageInfoRespArgID = dlpFirstArgID,
+ dlpReadStorageInfoExRespArgID // v1.1 extension
+ };
+
+//
+// dlpReadStorageInfoRespArgID:
+//
+
+// Card info structure of variable size
+typedef struct DlpCardInfoHdrType {
+ // OFFSET
+ UInt8 totalSize; // 0; total size of this card info
+ // *ROUNDED UP TO EVEN SIZE*
+ UInt8 cardNo; // 1; card number
+ UInt16 cardVersion; // 2; card version
+ DlpDateTimeType crDate; // 4; creation date/time
+ UInt32 romSize; // 12; ROM size
+ UInt32 ramSize; // 16; RAM size
+ UInt32 freeRam; // 20; total free data store RAM - Fixed in DLP v1.2 to exclude
+ // dynamic heap RAM
+ UInt8 cardNameSize; // 24; size of card name string
+ UInt8 manufNameSize; // 25; size of manuf. name string
+ // TOTAL: 26 bytes;
+ } DlpCardInfoHdrType;
+
+typedef struct DlpCardInfoType {
+ // OFFSET
+ DlpCardInfoHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 26 bytes;
+ UInt8 cardNameAndManuf[2];
+ // 26; card name and manuf. text -- var size
+ // Card name is the cardNameSize bytes of text at cardNameAndManuf,
+ // followed immediately by manufNameSize bytes of manufacturer name.
+ } DlpCardInfoType;
+
+
+typedef struct DlpReadStorInfoRespHdrType {
+ // OFFSET
+ UInt8 lastCardNo; // 0; card number of last card retrieved
+ UInt8 more; // 1; non-zero if there are more cards
+ UInt8 unused; // 2; unused -- set to null!
+ UInt8 actCount; // 3; actual count of structures returned
+ // TOTAL: 4 bytes
+ } DlpReadStorInfoRespHdrType;
+
+typedef struct DlpReadStorInfoRespType {
+ // OFFSET
+ DlpReadStorInfoRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 4 bytes
+ DlpCardInfoType cardInfo[1]; // 4; actCount of card info structures -- var size
+ } DlpReadStorInfoRespType;
+
+
+//
+// EXTENDED ARGUMENTS(DL v1.1): dlpReadStorageInfoExRespArgID
+//
+typedef struct DlpReadStorInfoExRespType {
+ // OFFSET
+ UInt16 romDBCount; // 0; ROM database count
+ UInt16 ramDBCount; // 2; RAM database count
+ UInt32 dwReserved1; // 4; RESERVED -- SET TO NULL!
+ UInt32 dwReserved2; // 8; RESERVED -- SET TO NULL!
+ UInt32 dwReserved3; // 12; RESERVED -- SET TO NULL!
+ UInt32 dwReserved4; // 16; RESERVED -- SET TO NULL!
+ // TOTAL: 20 bytes
+ } DlpReadStorInfoExRespType;
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadDBList
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrNotFound
+
+// Request argument structure:
+//
+#define dlpReadDBListReqArgID dlpFirstArgID
+
+typedef struct DlpReadDBListReqType {
+ // OFFSET
+ UInt8 srchFlags; // 0; search flags
+ UInt8 cardNo; // 1; card number -- 0-based
+ UInt16 startIndex; // 2; DB index to start at
+ // (0 = from beginning)
+ // TOTAL: 4 bytes
+ } DlpReadDBListReqType;
+
+#define dlpReadDBListFlagRAM 0x80 // Search for RAM-based
+#define dlpReadDBListFlagROM 0x40 // Search for ROM-based
+#define dlpReadDBListFlagMultiple 0x20 // OK to return multiple entries (DEFINED FOR DLP v1.2)
+
+
+// Response argument structure:
+//
+#define dlpReadDBListRespArgID dlpFirstArgID
+
+// Database info structure of variable size
+typedef struct DlpDBInfoHdrType {
+ // OFFSET
+ UInt8 totalSize; // 0; total size of the DB info (DlpDBInfoHdrType + name)
+ // *ROUNDED UP TO EVEN SIZE*
+ UInt8 miscFlags; // 1; dlpDbInfoMiscFlag... flags(v1.1) -- set all unused bits to null!
+ UInt16 dbFlags; // 2; DB flags: dlpDBFlagReadOnly,
+ // dlpDBFlagResDB, dlpDBFlagAppInfoDirty, dlpDBFlagOpen,
+ // dlpDBFlagBackup, etc;
+ UInt32 type; // 4; database type
+ UInt32 creator; // 8; database creator
+ UInt16 version; // 12; database version
+ UInt32 modNum; // 14; modification number
+ DlpDateTimeType crDate; // 18; creation date
+ DlpDateTimeType modDate; // 26; latest modification date
+ DlpDateTimeType backupDate; // 34; latest backup date
+ UInt16 dbIndex; // 42; DB index (or dlpDbInfoUnknownDbIndex for dlpFindDB)
+ // TOTAL: 44 bytes;
+ } DlpDBInfoHdrType;
+
+// Flags for the miscFlags field of DlpDBInfoHdrType
+#define dlpDbInfoMiscFlagExcludeFromSync 0x80 // DEFINED FOR DLP v1.1
+#define dlpDbInfoMiscFlagRamBased 0x40 // DEFINED FOR DLP v1.2
+
+// Unknown index value for the dbIndex field of DlpDBInfoHdrType
+#define dlpDbInfoUnknownDbIndex 0xFFFF
+
+
+typedef struct DlpDBInfoType {
+ // OFFSET
+ DlpDBInfoHdrType header; // 0; fixed-size header
+ // FIXED SIZE: 44 bytes;
+ UInt8 name[2]; // 44; databse name text -- var size and
+ // null-terminated
+ } DlpDBInfoType;
+
+
+typedef struct DlpReadDBListRespHdrType {
+ // OFFSET
+ UInt16 lastIndex; // 0; DB index of last entry retrieved
+ UInt8 flags; // 2; flags: dlpReadDBListRespFlagMore
+ UInt8 actCount; // 3; actual count of structures returned
+ // TOTAL: 4 bytes
+ } DlpReadDBListRespHdrType;
+
+// dlpReadDBListRespFlagMore flag: if set, indicates that there are more
+// databases to list -- this enables the server to send the listing
+// incrementally, reducing server memory requirements if necessary
+#define dlpReadDBListRespFlagMore 0x80
+
+typedef struct DlpReadDBListRespType {
+ // OFFSET
+ DlpReadDBListRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 4 bytes
+ DlpDBInfoType dbInfo[1]; // 4; actCount of DB info structures -- var size
+ } DlpReadDBListRespType;
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpOpenDB
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrParam,
+// dlpRespErrNotFound
+// dlpRespErrTooManyOpenDatabases
+// dlpRespErrCantOpen
+
+// Request argument structure:
+//
+#define dlpOpenDBReqArgID dlpFirstArgID
+
+typedef struct DlpOpenDBReqHdrType {
+ // OFFSET
+ UInt8 cardNo; // 0; memory module number
+ UInt8 mode; // 1; open mode
+ // TOTAL: 2 bytes;
+ } DlpOpenDBReqHdrType;
+
+#define dlpOpenDBModeRead 0x80
+#define dlpOpenDBModeWrite 0x40
+#define dlpOpenDBModeExclusive 0x20
+#define dlpOpenDBModeShowSecret 0x10
+
+
+typedef struct DlpOpenDBReqType {
+ // OFFSET
+ DlpOpenDBReqHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 2 bytes;
+ UInt8 name[2]; // 2; databse name text -- var size
+ // zero-terminated
+ } DlpOpenDBReqType;
+
+typedef DlpOpenDBReqType* DlpOpenDBReqPtr;
+
+
+// Response argument structure:
+//
+#define dlpOpenDBRespArgID dlpFirstArgID
+//
+// The response argument is the 1-byte database ID to be passed in
+// subsequent read/write requests.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpCreateDB
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrParam,
+// dlpRespErrAlreadyExists,
+// dlpRespErrCantOpen,
+// dlpRespErrNotEnoughSpace,
+// dlpRespErrTooManyOpenDatabases
+
+// Request argument structure:
+//
+#define dlpCreateDBReqArgID dlpFirstArgID
+
+typedef struct DlpCreateDBReqHdrType {
+ // OFFSET
+ UInt32 creator; // 0; DB creator
+ UInt32 type; // 4; DB type
+ UInt8 cardNo; // 8; memory module number
+ UInt8 unused; // 9; unused -- set to null
+ UInt16 dbFlags; // 10; allowed flags: dlpDBFlagResDB,
+ // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer,
+ // dlpDBFlagResetAfterInstall
+ UInt16 version; // 12; DB version #
+ // TOTAL: 14 bytes;
+ } DlpCreateDBReqHdrType;
+
+typedef struct DlpCreateDBReqType {
+ // OFFSET
+ DlpCreateDBReqHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 12 bytes;
+ UInt8 name[2]; // 14; DB name text -- var size
+ // zero-terminated
+ } DlpCreateDBReqType;
+
+typedef DlpCreateDBReqType* DlpCreateDBReqPtr;
+
+
+// Response argument structure:
+//
+#define dlpCreateDBRespArgID dlpFirstArgID
+
+// The response argument is the 1-byte database ID to be passed in
+// subsequent read/write requests.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpCloseDB
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrParam,
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+typedef enum {
+ dlpCloseDBReqArgID = dlpFirstArgID, // close a specific database
+ dlpCloseDBAllReqArgID, // close all databases
+ dlpCloseDBExReqArgID // close a specific db and update backup
+ // and/or modification dates (PalmOS v3.0)
+ } DlpCloseDBReqArgID;
+
+// Argument structure to close a specific database(dlpCloseDBDBIDReqArgID):
+//
+// The request argument is the 1-byte database ID returned in open/create
+// DB responses.
+typedef UInt8 DlpCloseDBReqType;
+
+// Argument structure to close all databases(dlpCloseDBReqAllArgID):
+//
+// This request argument contains no data
+
+
+// Request type for dlpCloseDBExReqArgID (PalmOS v3.0):
+typedef struct DlpCloseDBExReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id to close
+ UInt8 bOptFlags; // 1; bitfield of dlpCloseDBExOptFlag... flags
+ // TOTAL: 2 bytes
+ } DlpCloseDBExReqType;
+
+// Option flags
+#define dlpCloseDBExOptFlagUpdateBackupDate 0x80 // Update the backup date after closing
+#define dlpCloseDBExOptFlagUpdateModDate 0x40 // Update the modification date after closing
+
+
+#define dlpCloseDBExOptAllFlags (dlpCloseDBExOptFlagUpdateBackupDate | dlpCloseDBExOptFlagUpdateModDate)
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpDeleteDB
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrNotFound,
+// dlpRespErrCantOpen,
+// dlpRespErrDatabaseOpen
+
+// Request argument structure:
+//
+#define dlpDeleteDBReqArgID dlpFirstArgID
+
+typedef struct DlpDeleteDBReqHdrType {
+ // OFFSET
+ UInt8 cardNo; // 0; memory module number
+ UInt8 unused; // 1; unused -- set to null!
+ // TOTAL: 2 bytes;
+ } DlpDeleteDBReqHdrType;
+
+
+typedef struct DlpDeleteDBReqType {
+ // OFFSET
+ DlpDeleteDBReqHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 2 bytes;
+ UInt8 name[2]; // 2; databse name text -- var size
+ // zero-terminated
+ } DlpDeleteDBReqType;
+
+typedef DlpDeleteDBReqType* DlpDeleteDBReqPtr;
+
+
+// Response argument structure:
+//
+// none.
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadOpenDBInfo
+//////////////////////////////////////////////////////////////////////////
+// Get information on an open database
+//
+// Possible error codes
+// dlpRespErrNoneOpen
+// dlpRespErrParam
+
+// Request argument structure:
+//
+#define dlpReadOpenDBInfoArgID dlpFirstArgID
+
+// The request argument is the 1-byte database ID returned in open/create
+// DB responses.
+
+
+// Response argument structure:
+//
+#define dlpReadOpenDBInfoRespArgID dlpFirstArgID
+
+
+typedef struct DlpReadOpenDBInfoRespType {
+ // OFFSET
+ UInt16 numRec; // 0; number of records or resources
+ // TOTAL: 2 bytes
+ } DlpReadOpenDBInfoRespType;
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpMoveCategory
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrNoneOpen
+// dlpRespErrParam
+// dlpRespErrNotSupported
+// dlpRespErrReadOnly
+
+// Request argument structure:
+//
+#define dlpMoveCategoryReqArgID dlpFirstArgID
+
+typedef struct DlpMoveCategoryReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 fromCategory; // 1; id of the "from" category
+ UInt8 toCategory; // 2; id of the "to" category
+ UInt8 unused; // 3; unused -- set to null!
+ // TOTAL: 4 bytes;
+ } DlpMoveCategoryReqType;
+
+
+// Response argument structure:
+//
+// none.
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadAppBlock
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrNotFound
+// dlpRespErrNoneOpen
+// dlpRespErrParam
+
+// Request argument structure:
+//
+#define dlpReadBlockReqArgID dlpFirstArgID
+
+typedef struct DlpReadBlockReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 unused; // 1; unused -- set to null!
+ UInt16 offset; // 2; offset into the block
+ UInt16 numBytes; // 4; number of bytes to read starting
+ // at offset(-1 = to the end)
+ // TOTAL: 6 bytes;
+ } DlpReadBlockReqType;
+
+
+// Response argument structure:
+//
+#define dlpReadBlockRespArgID dlpFirstArgID
+
+typedef struct DlpReadBlockRespHdrType {
+ // OFFSET
+ UInt16 blockSize; // 0; actual block size -- may be greater
+ // than the amount of data returned
+ // TOTAL: 2 bytes
+ } DlpReadBlockRespHdrType;
+
+typedef struct DlpReadBlockRespType {
+ // OFFSET
+ DlpReadBlockRespHdrType //
+ header; // 0; fixed size header
+ // FIXED SIZE: 2 bytes
+ UInt8 data[2]; // 2; block data -- var size
+ } DlpReadBlockRespType;
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpWriteAppBlock
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrReadOnly
+// dlpRespErrNotEnoughSpace
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+#define dlpWriteBlockReqArgID dlpFirstArgID
+
+typedef struct DlpWriteBlockReqHdrType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 unused; // 1; unused -- set to null!
+ UInt16 blockSize; // 2; total block size(0 = free existing block)
+ // TOTAL: 4 bytes;
+ } DlpWriteBlockReqHdrType;
+
+
+typedef struct DlpWriteBlockReqType {
+ // OFFSET
+ DlpWriteBlockReqHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 4 bytes;
+ UInt8 data[2]; // 4; block data -- var size
+ } DlpWriteBlockReqType;
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadSortBlock
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory
+// dlpRespErrNotFound
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+// see dlpReadAppBlock
+
+
+// Response argument structure:
+//
+// see dlpReadAppBlock
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpWriteSortBlock
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrParam,
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+// see dlpWriteAppBlock
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadNextModifiedRec
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// see dlpReadRecord
+//
+
+// Request argument structure:
+//
+#define dlpReadNextModRecReqArgID dlpFirstArgID
+// The request argument is the 1-byte database ID returned in open/create
+// DB responses.
+
+
+// Response argument structure:
+//
+// Response argument id = dlpReadRecordRespArgID
+
+// Response argument structure = DlpReadRecordRespType
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpResetRecordIndex
+//////////////////////////////////////////////////////////////////////////
+// Resets the "next modified record" index to the beginning
+//
+// Possible error codes
+// dlpRespErrParam
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+#define dlpResetRecordIndexReqArgID dlpFirstArgID
+
+// The request argument is the 1-byte database ID returned in open/create
+// DB responses.
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadRecord
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrNotSupported,
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrParam,
+// dlpRespErrNotFound,
+// dlpRespErrRecordBusy,
+// dlpRespErrNoneOpen
+
+typedef enum {
+ dlpReadRecordIdArgID = dlpFirstArgID,
+ dlpReadRecordIndexArgID
+ } DlpReadRecordReqArgID;
+
+// dlpReadRecordIdArgID request argument structure:
+//
+typedef struct DlpReadRecordByIDReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 unused; // 1; unused -- set to null!
+ UInt32 recordID; // 2; unique record id
+ UInt16 offset; // 6; offset into the record
+ UInt16 numBytes; // 8; number of bytes to read starting
+ // at the offset(-1 = "to the end")
+ // TOTAL: 10 bytes;
+ } DlpReadRecordByIDReqType;
+
+// dlpReadRecordIndexArgID request argument structure:
+//
+typedef struct DlpReadRecordByIndexReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 unused; // 1; unused -- set to null!
+ UInt16 index; // 2; record index
+ UInt16 offset; // 4; offset into the record
+ UInt16 numBytes; // 6; number of bytes to read starting
+ // at the offset(-1 = "to the end")
+ // TOTAL: 8 bytes;
+ } DlpReadRecordByIndexReqType;
+
+
+// Response argument structure:
+//
+#define dlpReadRecordRespArgID dlpFirstArgID
+
+typedef struct DlpReadRecordRespHdrType {
+ // OFFSET
+ UInt32 recordID; // 0; unique record id
+ UInt16 index; // 4; record index
+ UInt16 recSize; // 6; total record size in bytes
+ UInt8 attributes; // 8; record attributes
+ UInt8 category; // 9; record category index
+ // TOTAL: 10 bytes;
+ } DlpReadRecordRespHdrType;
+
+typedef struct DlpReadRecordRespType {
+ // OFFSET
+ DlpReadRecordRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 8 bytes;
+ UInt8 data[2]; // 8; record data -- var size
+ } DlpReadRecordRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadRecordIDList
+//////////////////////////////////////////////////////////////////////////
+// Returns a list of unique record id's. May need to call more than once
+// to get the entire list. dlpRespErrNotFound is returned when "start"
+// is out of bounds
+//
+// Possible error codes
+// dlpRespErrNotSupported,
+// dlpRespErrParam,
+// dlpRespErrNotFound,
+// dlpRespErrNoneOpen
+
+#define dlpReadRecordIDListReqArgID dlpFirstArgID
+
+// dlpReadRecordIDListReqArgID request argument structure:
+//
+typedef struct DlpReadRecordIDListReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 flags; // 1; request flags
+ UInt16 start; // 2; starting record index (0-based)
+ UInt16 maxEntries; // 4; maximum number of entries, or
+ // 0xFFFF to return as many as possible
+ // TOTAL: 6 bytes;
+ } DlpReadRecordIDListReqType;
+
+// dlpReadRecordIDListFlagSortDB: if set, DL Server will call the creator
+// application to resort the database before returning the list.
+#define dlpReadRecordIDListFlagSortDB 0x80
+
+
+// Response argument structure:
+//
+#define dlpReadRecordIDListRespArgID dlpFirstArgID
+
+typedef struct DlpReadRecordIDListRespHdrType {
+ // OFFSET
+ UInt16 numEntries; // 0; number of entries returned
+ // TOTAL: 2 bytes;
+ } DlpReadRecordIDListRespHdrType;
+
+typedef struct DlpReadRecordIDListRespType {
+ // OFFSET
+ DlpReadRecordIDListRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 2 bytes;
+ UInt32 recID[1]; // 8; list of record id's -- var size
+ } DlpReadRecordIDListRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpWriteRecord
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrNotFound
+// dlpRespErrNotEnoughSpace
+// dlpRespErrNotSupported
+// dlpRespErrReadOnly
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+#define dlpWriteRecordReqArgID dlpFirstArgID
+
+// dlpWriteRecordReqArgID -- required
+typedef struct DlpWriteRecordReqHdrType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 flags; // 1; set unused bits to null!
+ UInt32 recordID; // 2; unique record id or null
+ UInt8 attributes; // 6; record attributes -- only
+ // dlpRecAttrSecret is allowed here
+ // v1.1 extension:
+ // dlpRecAttrDeleted, dlpRecAttrArchived and
+ // dlpRecAttrDirty are also allowed.
+ UInt8 category; // 7; record category
+ // TOTAL: 8 bytes;
+ } DlpWriteRecordReqHdrType;
+
+#define dlpWriteRecordReqFlagDataIncluded 0x80 // original implementer of destop software always
+ // set this bit. Define it here for compatibility
+
+typedef struct DlpWriteRecordReqType {
+ // OFFSET
+ DlpWriteRecordReqHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 8 bytes;
+ UInt8 data[2]; // 8; record data -- var size
+ } DlpWriteRecordReqType;
+
+
+// Response argument structure:
+//
+#define dlpWriteRecordRespArgID dlpFirstArgID
+
+typedef struct DlpWriteRecordRespType {
+ // OFFSET
+ UInt32 recordID; // 0; record ID
+ // TOTAL: 4 bytes
+ } DlpWriteRecordRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpDeleteRecord
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrNotFound
+// dlpRespErrNotSupported
+// dlpRespErrReadOnly
+// dlpRespErrNoneOpen
+//
+
+// Request argument structure:
+//
+#define dlpDeleteRecordReqArgID dlpFirstArgID
+
+// Argument structure to delete by record ID(dlpDeleteRecordReqIDArgID):
+typedef struct DlpDeleteRecordReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 flags; // 1; flags (dlpDeleteRecFlagDeleteAll)
+ UInt32 recordID; // 2; unique record id (see flags)
+ // TOTAL: 6 bytes;
+ } DlpDeleteRecordReqType;
+
+// dlpDeleteRecFlagDeleteAll: if this flag is set, the reocordID field
+// is ignored and all database records will be deleted
+#define dlpDeleteRecFlagDeleteAll 0x80
+
+// dlpDeleteRecFlagByCategory: if this flag is set, the least significant byte
+// of the reocordID field contains the category id of records to be deleted (PalmOS 2.0)
+#define dlpDeleteRecFlagByCategory 0x40
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadResource
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrNotFound
+// dlpRespErrNoneOpen
+
+typedef enum {
+ dlpReadResourceIndexArgID = dlpFirstArgID,
+ dlpReadResourceTypeArgID
+ } DlpReadResourceReqArgID;
+
+// dlpReadResourceIndexArgID request argument structure:
+//
+typedef struct DlpReadResourceByIndexReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 unused; // 1; unused -- set to null!
+ UInt16 index; // 2; resource index
+ UInt16 offset; // 4; offset into the resource
+ UInt16 numBytes; // 6; number of bytes to read starting
+ // at the offset(-1 = "to the end")
+ // TOTAL: 8 bytes;
+ } DlpReadResourceByIndexReqType;
+
+// dlpReadResourceTypeArgID request argument structure:
+//
+typedef struct DlpReadResourceByTypeReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 unused; // 1; unused -- set to null!
+ UInt32 type; // 2; resource type
+ UInt16 id; // 6; resource id
+ UInt16 offset; // 8; offset into the resource
+ UInt16 numBytes; // 10; number of bytes to read starting
+ // at the offset(-1 = "to the end")
+ // TOTAL: 12 bytes;
+ } DlpReadResourceByTypeReqType;
+
+
+// Response argument structure:
+//
+#define dlpReadResourceRespArgID dlpFirstArgID
+
+typedef struct DlpReadResourceRespHdrType {
+ // OFFSET
+ UInt32 type; // 0; resource type
+ UInt16 id; // 4; resource id
+ UInt16 index; // 6; resource index
+ UInt16 resSize; // 8; total resource size in bytes
+ // TOTAL: 10 bytes;
+ } DlpReadResourceRespHdrType;
+
+typedef struct DlpReadResourceRespType {
+ // OFFSET
+ DlpReadResourceRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 6 bytes;
+ UInt8 resData[2]; // 6; resource data -- var size
+ } DlpReadResourceRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpWriteResource
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrNotEnoughSpace,
+// dlpRespErrParam,
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+#define dlpWriteResourceReqArgID dlpFirstArgID
+
+typedef struct DlpWriteResourceReqHdrType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 unused; // 1; inused -- set to null!
+ UInt32 type; // 2; resource type
+ UInt16 id; // 6; resource id
+ UInt16 resSize; // 8; total resource size
+ // TOTAL: 10 bytes;
+ } DlpWriteResourceReqHdrType;
+
+typedef struct DlpWriteResourceReqType {
+ // OFFSET
+ DlpWriteResourceReqHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 10 bytes;
+ UInt8 data[2]; // 10; resource data -- var size
+ } DlpWriteResourceReqType;
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpDeleteResource
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrNotFound
+// dlpRespErrNotSupported
+// dlpRespErrReadOnly
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+#define dlpDeleteResourceReqArgID dlpFirstArgID
+
+typedef struct DlpDeleteResourceReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 flags; // 1; flags (dlpDeleteResFlagDeleteAll)
+ UInt32 type; // 2; resource type
+ UInt16 id; // 6; resource id
+ // TOTAL: 8 bytes;
+ } DlpDeleteResourceReqType;
+
+// dlpDeleteResFlagDeleteAll: if set, all resources in the db will be deleted
+#define dlpDeleteResFlagDeleteAll 0x80
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpCleanUpDatabase
+//////////////////////////////////////////////////////////////////////////
+// Deletes all records which are marked as archived or deleted in the
+// record database
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrReadOnly,
+// dlpRespErrNotSupported
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+#define dlpCleanUpDatabaseReqArgID dlpFirstArgID
+
+// The request argument is the 1-byte database ID returned in open/create
+// DB responses.
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpResetSyncFlags
+//////////////////////////////////////////////////////////////////////////
+// For record databases, reset all dirty flags.
+// For both record and resource databases, set the last sync time to NOW
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam
+// dlpRespErrReadOnly,
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+#define dlpResetSyncFlagsReqArgID dlpFirstArgID
+
+// The request argument is the 1-byte database ID returned in open/create
+// DB responses.
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpCallApplication
+//////////////////////////////////////////////////////////////////////////
+// Call an application entry point via an action code
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrParam,
+// dlpRespErrNotFound
+
+// Request argument structure:
+//
+enum {
+ dlpCallApplicationReqArgIDV10 = dlpFirstArgID, // req id for Pilot v1.0
+ dlpCallAppReqArgID // req id for Pilot v2.0 and later
+ };
+
+// dlpCallApplicationReqArgIDV10:
+typedef struct DlpCallApplicationReqHdrTypeV10 {
+ // OFFSET
+ UInt32 creator; // 0; app DB creator id
+ UInt16 action; // 4; action code
+ UInt16 paramSize; // 6; custom param size
+ // TOTAL: 8 bytes
+ } DlpCallApplicationReqHdrTypeV10;
+
+typedef struct DlpCallApplicationReqTypeV10 {
+ // OFFSET
+ DlpCallApplicationReqHdrTypeV10 //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 8 bytes
+ UInt8 paramData[2]; // 8; custom param data -- var size
+ } DlpCallApplicationReqTypeV10;
+
+
+// dlpCallAppReqArgID (Pilot v2.0):
+typedef struct DlpCallAppReqHdrType {
+ // OFFSET
+ UInt32 creator; // 0; DB creator id of target executable
+ UInt32 type; // 4; DB type id of target executable
+ UInt16 action; // 8; action code
+ UInt32 dwParamSize; // 10; custom param size in number of bytes
+ UInt32 dwReserved1; // 14; RESERVED -- set to NULL!!!
+ UInt32 dwReserved2; // 18; RESERVED -- set to NULL!!!
+ // TOTAL: 22 bytes
+ } DlpCallAppReqHdrType;
+
+typedef struct DlpCallAppReqType {
+ // OFFSET
+ DlpCallAppReqHdrType //
+ hdr; // 0; fixed-size header
+ // FIXED SIZE: 22 bytes
+ UInt8 paramData[2]; // 22; custom param data -- var size
+ } DlpCallAppReqType;
+
+
+
+// Response argument structure:
+//
+enum {
+ dlpCallApplicationRespArgIDV10 = dlpFirstArgID, // resp id for Pilot v1.0
+ dlpCallAppRespArgID // resp id for Pilot v2.0 and later
+ };
+
+// dlpCallApplicationRespArgIDV10:
+typedef struct DlpCallApplicationRespHdrTypeV10 {
+ // OFFSET
+ UInt16 action; // 0; action code which was called
+ UInt16 resultCode; // 2; result error code returned by action
+ UInt16 resultSize; // 4; custom result data size
+ // TOTAL: 6 bytes
+ } DlpCallApplicationRespHdrTypeV10;
+
+typedef struct DlpCallApplicationRespTypeV10 {
+ // OFFSET
+ DlpCallApplicationRespHdrTypeV10 //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 6 bytes
+ UInt8 resultData[2]; // 6; custom result data -- var size
+ } DlpCallApplicationRespTypeV10;
+
+// dlpCallAppRespArgID:
+typedef struct DlpCallAppRespHdrType {
+ // OFFSET
+ UInt32 dwResultCode; // 0; result error code returned by handler
+ UInt32 dwResultSize; // 4; custom result data size
+ UInt32 dwReserved1; // 8; RESERVED -- SET TO NULL!!!
+ UInt32 dwReserved2; // 12; RESERVED -- SET TO NULL!!!
+ // TOTAL: 16 bytes
+ } DlpCallAppRespHdrType;
+
+typedef struct DlpCallAppRespType {
+ // OFFSET
+ DlpCallAppRespHdrType //
+ hdr; // 0; fixed-size header
+ // FIXED SIZE: 16 bytes
+ UInt8 resultData[2]; // 16; custom result data -- var size
+ } DlpCallAppRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpResetSystem
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem
+
+// Request argument structure:
+//
+// none.
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpAddSyncLogEntry
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrNotEnoughSpace,
+// dlpRespErrLimitExceeded,
+// dlpRespErrParam
+
+// Request argument structure:
+//
+#define dlpAddSyncLogEntryReqArgID dlpFirstArgID
+
+typedef struct DlpAddSyncLogEntryReqType {
+ // OFFSET
+ UInt8 text[2]; // 0; entry text -- var size and
+ // null-terminated
+ } DlpAddSyncLogEntryReqType;
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpProcessRPC
+//////////////////////////////////////////////////////////////////////////
+// Remote Procedure Call interface
+//
+// Request arguments:
+// RPC command block
+//
+// Response arguments:
+// RPC reply block
+//
+// Possible error codes
+// 0 on success; otherwise error code from the TouchDown
+// RPC executor
+//
+// NOTE: this is a low-level system command which does not use arg wrappers.
+
+// Request argument structure:
+//
+// Block of RPC command data (no arg wrapper)
+
+// Response argument structure:
+//
+// Block of RPC reply data of same length as command block(no arg wrapper)
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpOpenConduit
+//////////////////////////////////////////////////////////////////////////
+// This command is sent before each conduit is opened by the desktop.
+// If the viewer has a cancel pending, it will return dlpRespErrCancelSync
+// in the response header's errorCode field.
+//
+// Request arguments: none.
+//
+// Response arguments: none.
+//
+// Possible error codes
+// dlpRespErrCancelSync
+
+// Request argument structure:
+//
+// none.
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpEndOfSync
+//////////////////////////////////////////////////////////////////////////
+// This command is sent by the desktop to end the sync.
+//
+// Request arguments: termination code: 0 = normal termination;
+// otherwise the client is aborting the sync
+//
+// Possible error codes
+// 0
+
+// Request argument structure:
+//
+#define dlpEndOfSyncReqArgID dlpFirstArgID
+
+typedef enum DlpSyncTermCode {
+ dlpTermCodeNormal = 0, // normal termination
+ dlpTermCodeOutOfMemory, // termination due to low memory on TD
+ dlpTermCodeUserCan, // user cancelled from desktop
+ dlpTermCodeOther, // catch-all abnormal termination code
+ dlpTermCodeIncompatibleProducts // incompatibility between desktop and handheld hotsync products
+ } DlpSyncTermCode;
+
+
+typedef struct DlpEndOfSyncReqType {
+ // OFFSET
+ UInt16 termCode; // 0; termination code
+ // TOTAL: 2 bytes
+ } DlpEndOfSyncReqType;
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadNextRecInCategory
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// see dlpReadRecord
+
+#define dlpReadNextRecInCategoryReqArgID dlpFirstArgID
+
+// dlpReadNextRecInCategoryReqArgID request argument structure:
+//
+typedef struct DlpReadNextRecInCategoryReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 category; // 1; category id
+ // TOTAL: 2 bytes;
+ } DlpReadNextRecInCategoryReqType;
+
+
+// Response argument structure:
+//
+// Response argument id = dlpReadRecordRespArgID
+
+// Response argument structure = DlpReadRecordRespType
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadNextModifiedRecInCategory
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// see dlpReadNextRecInCategory
+
+// Request argument structure:
+//
+// same as dlpReadNextRecInCategory
+
+// Response argument structure:
+//
+// same as dlpReadNextRecInCategory
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadAppPreference
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrParam,
+// dlpRespErrNotFound,
+
+#define dlpReadAppPreferenceReqArgID dlpFirstArgID
+
+// dlpReadAppPreferenceReqArgID request argument structure:
+//
+typedef struct DlpReadAppPreferenceReqType {
+ // OFFSET
+ UInt32 creator; // 0; application creator type
+ UInt16 id; // 4; preference id
+ UInt16 reqBytes; // 6; max. number of preference bytes requested;
+ // pass 0xFFFF for actual size
+ UInt8 flags; // 8; command flags: dlpAppPrefReqFlagBackedUp - if set, use backed-up pref db
+ UInt8 unused; // 9; reserved/padding -- set to NUL!
+ // TOTAL: 10 bytes;
+ } DlpReadAppPreferenceReqType;
+
+#define dlpReadAppPrefActualSize 0xFFFF
+#define dlpAppPrefReqFlagBackedUp 0x80
+
+// Response argument structure:
+//
+#define dlpReadAppPreferenceRespArgID dlpFirstArgID
+
+typedef struct DlpReadAppPreferenceRespHdrType {
+ // OFFSET
+ UInt16 version; // 0; version number of the application
+ UInt16 actualSize; // 2; actual preference data size
+ UInt16 retBytes; // 4; number of preference bytes returned
+ // TOTAL: 6 bytes
+ } DlpReadAppPreferenceRespHdrType;
+
+typedef struct DlpReadAppPreferenceRespType {
+ // OFFSET
+ DlpReadAppPreferenceRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 6 bytes
+ UInt8 data[2]; // 6; custom result data -- var size
+ } DlpReadAppPreferenceRespType;
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpWriteAppPreference
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrNotEnoughSpace
+
+// Request argument structure:
+//
+#define dlpWriteAppPreferenceReqArgID dlpFirstArgID
+
+typedef struct DlpWriteAppPreferenceReqHdrType {
+ // OFFSET
+ UInt32 creator; // 0; application creator type
+ UInt16 id; // 4; preference id
+ UInt16 version; // 6; version number of the application
+ UInt16 prefSize; // 8; preference size(in number of bytes)
+ UInt8 flags; // 10; command flags: dlpAppPrefReqFlagBackedUp - if set, use backed-up pref db
+ UInt8 unused; // 11; reserved/padding -- set to NUL!
+ // TOTAL: 12 bytes;
+ } DlpWriteAppPreferenceReqHdrType;
+
+typedef struct DlpWriteAppPreferenceReqType {
+ // OFFSET
+ DlpWriteAppPreferenceReqHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 12 bytes;
+ UInt8 data[2]; // 12; record data -- var size
+ } DlpWriteAppPreferenceReqType;
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadNetSyncInfo
+//////////////////////////////////////////////////////////////////////////
+// Request arguments: none
+//
+// Response arguments:
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory
+
+// Request argument structure:
+//
+// none.
+
+// Response argument structure:
+//
+#define dlpReadNetSyncInfoRespArgID dlpFirstArgID
+
+typedef struct DlpReadNetSyncInfoRespHdrType {
+ // OFFSET
+ UInt8 lanSyncOn; // 0; non-zero if Lan Sync is enabled
+ UInt8 bReserved1; // 1; reserved -- SET TO NULL!
+ UInt32 dwReserved1; // 2; reserved -- SET TO NULL!
+ UInt32 dwReserved2; // 6; reserved -- SET TO NULL!
+ UInt32 dwReserved3; // 10; reserved -- SET TO NULL!
+ UInt32 dwReserved4; // 14; reserved -- SET TO NULL!
+ UInt16 syncPCNameSize;// 18; length of sync PC host name,
+ // including null (0 = no host name)
+ UInt16 syncPCAddrSize;// 20; length of sync PC address,
+ // including null (0 = no address)
+ UInt16 syncPCMaskSize;// 22; length of sync PC subnet mask,
+ // including null (0 = no mask)
+ // TOTAL: 24 bytes
+ } DlpReadNetSyncInfoRespHdrType;
+
+typedef struct DlpReadNetSyncInfoRespType {
+ // OFFSET
+ DlpReadNetSyncInfoRespHdrType //
+ hdr; // 0; fixed-size header
+ // FIXED SIZE: 24 bytes
+ UInt8 syncAddr[2]; // 24; sync IP address/host name -- var size,
+ // null-terminated
+ } DlpReadNetSyncInfoRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpWriteNetSyncInfo
+//////////////////////////////////////////////////////////////////////////
+// Request arguments:
+//
+// Response arguments: none
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrNotEnoughSpace,
+// dlpRespErrParam
+
+// Request argument structure:
+//
+#define dlpWriteNetSyncInfoReqArgID dlpFirstArgID
+
+#define dlpMaxHostAddrLength 255 // maximum PC host name length, not including NULL
+
+typedef struct DlpWriteNetSyncInfoReqHdrType {
+ // OFFSET
+ UInt8 modFlags; // 0; flags indicating which values are being
+ // modified; see the dlpNetSyncInfoMod...
+ // flags defined below
+ UInt8 lanSyncOn; // 1; non-zero if Lan Sync is enabled
+ UInt32 dwReserved1; // 2; reserved -- SET TO NULL!
+ UInt32 dwReserved2; // 6; reserved -- SET TO NULL!
+ UInt32 dwReserved3; // 10; reserved -- SET TO NULL!
+ UInt32 dwReserved4; // 14; reserved -- SET TO NULL!
+ UInt16 syncPCNameSize;// 18; length of sync PC host name,
+ // including null (0 = no address/host name)
+ UInt16 syncPCAddrSize;// 20; length of sync PC address,
+ // including null (0 = no address)
+ UInt16 syncPCMaskSize;// 22; length of sync PC subnet mask,
+ // including null (0 = no mask)
+ // TOTAL: 24 bytes
+ } DlpWriteNetSyncInfoReqHdrType;
+
+// Flags indicating which values are being changed by the dlpWriteNetSyncInfo
+// request. These flags are used in the modFlags field of DlpWriteNetSyncInfoReqHdrType.
+// These flags are additive.
+//
+#define dlpNetSyncInfoModLanSyncOn 0x80 // changing the "lan sync on" setting
+#define dlpNetSyncInfoModSyncPCName 0x40 // changing the sync PC host name
+#define dlpNetSyncInfoModSyncPCAddr 0x20 // changing the sync PC address
+#define dlpNetSyncInfoModSyncPCMask 0x10 // changing the sync PC subnet mask
+
+typedef struct DlpWriteNetSyncInfoReqType {
+ // OFFSET
+ DlpWriteNetSyncInfoReqHdrType
+ hdr; // 0; fixed-size header
+ // FIXED SIZE: 24 bytes
+ UInt8 syncAddr[2]; // 24; sync IP address/host name -- var size,
+ // null-terminated
+ } DlpWriteNetSyncInfoReqType;
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadFeature
+//////////////////////////////////////////////////////////////////////////
+// Request arguments:
+//
+// Response arguments:
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrNotFound,
+// dlpRespErrParam
+
+// Request argument structure:
+//
+#define dlpReadFeatureReqArgID dlpFirstArgID
+
+typedef struct DlpReadFeatureReqType {
+ // OFFSET
+ UInt32 dwFtrCreator; // 0; feature creator
+ UInt16 wFtrNum; // 4; feature number
+ // TOTAL: 6 bytes
+ } DlpReadFeatureReqType;
+
+
+// Response argument structure:
+//
+#define dlpReadFeatureRespArgID dlpFirstArgID
+
+typedef struct DlpReadFeatureRespType {
+ // OFFSET
+ UInt32 dwFeature; // 0; feature value
+ // TOTAL: 4 bytes
+ } DlpReadFeatureRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpFindDB
+//////////////////////////////////////////////////////////////////////////
+// Request arguments:
+//
+// Response arguments:
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrNotFound,
+// dlpRespErrParam
+
+// Request argument structure:
+//
+
+// dlpFindDBByNameReqArgID, dlpFindDBByTypeCreatorReqArgID and dlpFindDBByOpenHandleReqArgID
+// are mutually exclusive
+enum {
+ dlpFindDBByNameReqArgID = dlpFirstArgID, // req id for card + name based search
+ dlpFindDBByOpenHandleReqArgID, // req id for search given an open db handle
+ dlpFindDBByTypeCreatorReqArgID // req id for type + creator based iterative search
+ };
+
+// Option flags
+#define dlpFindDBOptFlagGetAttributes 0x80 // get database attributes -- this is
+ // an option to allow find operations to skip
+ // returning this data as a performance optimization
+
+#define dlpFindDBOptFlagGetSize 0x40 // get record count and data size also -- this is
+ // an option because the operation can take a long
+ // time, which we would rather avoid if it is not needed
+
+#define dlpFindDBOptFlagGetMaxRecSize 0x20 // get max rec/resource size -- this is
+ // an option because the operation can take a long
+ // time, which we would rather avoid if it is not needed
+ // (dlpFindDBOptFlagGetMaxRecSize is only supported for
+ // dlpFindDBByOpenHandleReqArgID)
+
+// Request type for dlpdlpFindDBByNameReqArgID:
+typedef struct DlpFindDBByNameReqHdrType {
+ // OFFSET
+ UInt8 bOptFlags; // 0; bitfield of dlpFindDBOptFlag... flags
+ UInt8 bCardNo; // 2; card number to search
+ // TOTAL: 4 bytes
+ } DlpFindDBByNameReqHdrType;
+
+typedef struct DlpFindDBByNameReqType {
+ // OFFSET
+ DlpFindDBByNameReqHdrType //
+ header; // 0; fixed size header
+ // FIXED SIZE: 4 bytes
+ UInt8 name[2]; // variable size -- zero-terminated database name string
+ } DlpFindDBByNameReqType;
+
+
+// Request type for dlpFindDBByOpenHandleReqArgID:
+typedef struct DlpFindDBByOpenHandleReqType {
+ // OFFSET
+ UInt8 bOptFlags; // 0; bitfield of dlpFindDBOptFlag... flags
+ UInt8 bDbID; // 1; database id returned by dlpOpenDB or dlpCreateDB
+ // TOTAL: 2 bytes
+ } DlpFindDBByOpenHandleReqType;
+
+
+// Request type for dlpFindDBByTypeCreatorReqArgID:
+typedef struct DlpFindDBByTypeCreatorReqType {
+ // OFFSET
+ UInt8 bOptFlags; // 0; bitfield of dlpFindDBOptFlag... flags
+ UInt8 bSrchFlags; // 1; bitfield of dlpFindDBSrchFlag... flags
+ UInt32 dwType; // 2; db type id (zero = wildcard)
+ UInt32 dwCreator; // 6; db creator id (zero = wildcard)
+ // TOTAL: 10 bytes
+ } DlpFindDBByTypeCreatorReqType;
+
+#define dlpFindDBSrchFlagNewSearch 0x80 // set to beging a new search
+#define dlpFindDBSrchFlagOnlyLatest 0x40 // set to search for the latest version
+
+
+
+// Response argument structures for dlpFindDBByNameReqArgID, dlpFindDBByOpenHandleReqArgID and
+// dlpFindDBByTypeCreatorReqArgID (if found):
+//
+enum {
+ dlpFindDBBasicRespArgID = dlpFirstArgID, // resp arg id for basic info
+ // (if dlpFindDBOptFlagGetAttributes is set)
+ dlpFindDBSizeRespArgID // resp arg id for size info
+ // (if dlpFindDBOptFlagGetSize or dlpFindDBOptFlagGetMaxRecSize
+ // are set)
+ };
+
+
+// dlpFindDBBasicRespArgID (returned only if dlpFindDBOptFlagGetAttributes is set):
+
+typedef struct DlpFindDBBasicRespHdrType {
+ // OFFSET
+ UInt8 bCardNo; // 0; card number of database
+ UInt8 bReserved; // 1; RESERVED -- SET TO NULL
+ UInt32 dwLocalID; // 2; local id of the database (for internal use)
+ UInt32 dwOpenRef; // 6; db open ref of the database if it is currently opened
+ // by the caller; zero otherwise (for internal use) can
+ // change after read record list
+ DlpDBInfoHdrType info; //10; database info (creator, type, flags, etc.) MUST BE LAST FIELD
+ // TOTAL: 54 bytes
+ } DlpFindDBBasicRespHdrType;
+
+typedef struct DlpFindDBBasicRespType {
+ // OFFSET
+ DlpFindDBBasicRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 54 bytes
+ UInt8 name[2]; // variable size -- zero-terminated database name string
+ } DlpFindDBBasicRespType;
+
+
+
+// dlpFindDBSizeRespArgID (returned only if dlpFindDBOptFlagGetSize or dlpFindDBOptFlagGetMaxRecSize is set):
+
+typedef struct DlpFindDBSizeRespType {
+ // OFFSET
+
+ // Returned if dlpFindDBOptFlagGetSize is set for all queries:
+ // (otherwise, fields are set to zero)
+ UInt32 dwNumRecords; // 0; record/resource count
+ UInt32 dwTotalBytes; // 4; total bytes used by db
+ UInt32 dwDataBytes; // 8; bytes used for data
+
+ // Returned if dlpFindDBOptFlagGetSize is set for dlpFindDBByOpenHandleReqArgID only:
+ // (otherwise, fields are set to zero)
+ UInt32 dwAppBlkSize; //12; size of app info block size (for
+ // dlpFindDBByOpenHandleReqArgID only)
+ UInt32 dwSortBlkSize; //16; size of sort info block size(for
+ // dlpFindDBByOpenHandleReqArgID only)
+ //
+ // Returned if dlpFindDBOptFlagGetMaxRecSize is set for dlpFindDBByOpenHandleReqArgID only:
+ // (otherwise, field is set to zero)
+ UInt32 dwMaxRecSize; //20; size of largest record or resource in the database (for
+ // dlpFindDBByOpenHandleReqArgID + dlpFindDBOptFlagGetMaxRecSize only)
+ // TOTAL: 24 bytes
+ } DlpFindDBSizeRespType;
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpSetDBInfo
+//////////////////////////////////////////////////////////////////////////
+// Request arguments:
+//
+// Response arguments:
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrNotFound
+// dlpRespErrNotEnoughSpace
+// dlpRespErrNotSupported
+// dlpRespErrReadOnly
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+
+enum {
+ dlpSetDBInfoReqArgID = dlpFirstArgID
+ };
+
+
+typedef struct DlpSetDBInfoReqHdrType {
+ // OFFSET
+ UInt8 dbID; // 0; database id returned by dlpOpenDB or dlpCreateDB
+ UInt8 bReserved; // 1; RESERVED -- SET TO NULL
+ UInt16 wClrDbFlags; // 2; flags to clear; allowed DB flags: dlpDBFlagAppInfoDirty,
+ // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer,
+ // dlpDBFlagResetAfterInstall, dlpDBFlagCopyPrevention;
+ // 0 = don't change
+ UInt16 wSetDbFlags; // 4; flags to set; allowed DB flags: dlpDBFlagAppInfoDirty,
+ // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer,
+ // dlpDBFlagResetAfterInstall, dlpDBFlagCopyPrevention;
+ // 0 = don't change
+ UInt16 wDbVersion; // 6; database version; dlpSetDBInfoNoVerChange = don't change
+ DlpDateTimeType crDate; // 8; creation date; zero year = don't change
+ DlpDateTimeType modDate; //16; modification date; zero year = don't change
+ DlpDateTimeType bckUpDate; //24; backup date; zero year = don't change
+ UInt32 dwType; //32; database type id; zero = don't change
+ UInt32 dwCreator; //36; database creator id; zero = don't change
+ // TOTAL: 40 bytes
+ } DlpSetDBInfoReqHdrType;
+
+#define dlpSetDBInfoNoVerChange 0xFFFF
+
+typedef struct DlpSetDBInfoReqType {
+ // OFFSET
+ DlpSetDBInfoReqHdrType //
+ header; // 0; fixed size header
+ // FIXED SIZE: 40 bytes
+ UInt8 name[2]; // variable size -- zero-terminated database name string
+ } DlpSetDBInfoReqType;
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+/************************************************************
+ * Macros
+ *************************************************************/
+
+
+#endif // __DLCOMMON_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/DLServer.h b/SrcShared/Palm/Platform/Incs/Core/System/DLServer.h
new file mode 100644
index 0000000..7412ea8
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/DLServer.h
@@ -0,0 +1,418 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: DLServer.h
+ *
+ * Description:
+ * Desktop Link Protocol(DLP) Server implementation definitions.
+ *
+ * History:
+ * vmk 7/12/95 Created by Vitaly Marty Kruglikov
+ * vmk 7/12/96 Converted to HTAL architecture
+ * jmp 12/23/99 Fix <> vs. "" problem.
+ *
+ *****************************************************************************/
+
+#ifndef __DL_SERVER_H__
+#define __DL_SERVER_H__
+
+// Pilot common definitions
+#include <PalmTypes.h>
+#include <DataMgr.h> // for DmOpenRef
+
+#include <PalmOptErrorCheckLevel.h>
+
+
+/************************************************************
+ * DLK result codes
+ * (dlkErrorClass is defined in SystemMgr.h)
+ *************************************************************/
+#pragma mark *Error Codes*
+
+#define dlkErrParam (dlkErrorClass | 1) // invalid parameter
+#define dlkErrMemory (dlkErrorClass | 2) // memory allocation error
+#define dlkErrNoSession (dlkErrorClass | 3) // could not establish a session
+
+#define dlkErrSizeErr (dlkErrorClass | 4) // reply length was too big
+
+#define dlkErrLostConnection (dlkErrorClass | 5) // lost connection
+#define dlkErrInterrupted (dlkErrorClass | 6) // sync was interrupted (see sync state)
+#define dlkErrUserCan (dlkErrorClass | 7) // cancelled by user
+
+
+
+/********************************************************************
+ * Desktop Link system preferences resource for user info
+ * id = sysResIDDlkUserInfo, defined in SystemResources.h
+ ********************************************************************/
+#pragma mark *User Info Preference*
+
+#define dlkMaxUserNameLength 40
+#define dlkUserNameBufSize (dlkMaxUserNameLength + 1)
+
+#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL
+#define dlkMaxLogSize (20 * 1024)
+#else
+#define dlkMaxLogSize (2 * 1024)
+#endif
+
+typedef enum DlkSyncStateType {
+ dlkSyncStateNeverSynced = 0, // never synced
+ dlkSyncStateInProgress, // sync is in progress
+ dlkSyncStateLostConnection, // connection lost during sync
+ dlkSyncStateLocalCan, // cancelled by local user on handheld
+ dlkSyncStateRemoteCan, // cancelled by user from desktop
+ dlkSyncStateLowMemoryOnTD, // sync ended due to low memory on handheld
+ dlkSyncStateAborted, // sync was aborted for some other reason
+ dlkSyncStateCompleted, // sync completed normally
+
+ // Added in PalmOS v3.0:
+ dlkSyncStateIncompatibleProducts // sync ended because desktop HotSync product
+ // is incompatible with this version
+ // of the handheld HotSync
+ } DlkSyncStateType;
+
+#define dlkUserInfoPrefVersion 0x0102 // current user info pref version: 1.2
+
+typedef struct DlkUserInfoHdrType {
+ UInt16 version; // pref version number
+ UInt32 userID; // user id
+ UInt32 viewerID; // id assigned to viewer by the desktop
+ UInt32 lastSyncPC; // last sync PC id
+ UInt32 succSyncDate; // last successful sync date
+ UInt32 lastSyncDate; // last sync date
+ DlkSyncStateType lastSyncState; // last sync status
+ UInt8 reserved1; // Explicitly account for 16-bit alignment padding
+ UInt16 lanSyncEnabled;// if non-zero, LAN Sync is enabled
+ UInt32 hsTcpPortNum; // TCP/IP port number of Desktop HotSync
+ UInt32 dwReserved1; // RESERVED -- set to NULL!
+ UInt32 dwReserved2; // RESERVED -- set to NULL!
+ UInt8 userNameLen; // length of name field(including null)
+ UInt8 reserved2; // Explicitly account for 16-bit alignment padding
+ UInt16 syncLogLen; // length of sync log(including null)
+ } DlkUserInfoHdrType;
+
+typedef struct DlkUserInfoType {
+ DlkUserInfoHdrType header; // fixed size header
+ Char nameAndLog[2]; // user name, followed by sync log;
+ // both null-terminated(for debugging)
+ } DlkUserInfoType;
+
+typedef DlkUserInfoType* DlkUserInfoPtr; // user info pointer
+
+
+/********************************************************************
+ * Desktop Link system preferences resource for the Conduit Filter Table
+ * id = sysResIDDlkCondFilterTab, defined in SystemResources.h
+ ********************************************************************/
+#pragma mark *Conduit Filter Preference*
+
+//
+// Table for specifying conduits to "filter out" during HotSync
+//
+
+// This table consists of DlkCondFilterTableHdrType header followed by a
+// variable number of DlkCondFilterEntryType entries
+
+typedef struct DlkCondFilterTableHdrType {
+ UInt16 entryCount;
+ } DlkCondFilterTableHdrType;
+typedef DlkCondFilterTableHdrType* DlkCondFilterTableHdrPtr;
+
+typedef struct DlkCondFilterEntryType {
+ UInt32 creator;
+ UInt32 type;
+ } DlkCondFilterEntryType;
+typedef DlkCondFilterEntryType* DlkCondFilterEntryPtr;
+
+typedef struct DlkCondFilterTableType {
+ DlkCondFilterTableHdrType
+ hdr; // table header
+ DlkCondFilterEntryType
+ entry[1]; // variable number of entries
+ } DlkCondFilterTableType;
+typedef DlkCondFilterTableType* DlkCondFilterTablePtr;
+
+
+
+/********************************************************************
+ * DLK Session Structures
+ ********************************************************************/
+#pragma mark *Session Structures*
+
+
+// DesktopLink event notification callback. If non-zero is returned,
+// sync will be cancelled as soon as a safe point is reached.
+typedef enum {
+ dlkEventOpeningConduit = 1, // conduit is being opened -- paramP
+ // is null;
+
+ dlkEventDatabaseOpened, // client has opened a database -- paramP
+ // points to DlkEventDatabaseOpenedType;
+
+ dlkEventCleaningUp, // last stage of sync -- cleaning up (notifying apps, etc) --
+ // paramP is null
+
+ dlkEventSystemResetRequested // system reset was requested by the desktop client
+ // (the normal action is to delay the reset until
+ // end of sync) -- paramP is null
+ } DlkEventType;
+
+// Prototype for the event notification callback
+typedef Int16 (*DlkEventProcPtr)(UInt32 eventRef, DlkEventType dlkEvent,
+ void * paramP);
+
+// Parameter structure for dlkEventDatabaseOpened
+// Added new fields for Pilot v2.0 vmk 12/24/96
+typedef struct DlkEventDatabaseOpenedType {
+ DmOpenRef dbR; // open database ref (v2.0)
+ Char * dbNameP; // database name
+ UInt32 dbType; // databse type (v2.0)
+ UInt32 dbCreator; // database creator
+ } DlkEventDatabaseOpenedType;
+
+
+// Prototype for the "user cancel" check callback function
+typedef Int16 (*DlkUserCanProcPtr)(UInt32 canRef);
+
+
+//
+// List of modified database creators maintained by DLP Server
+//
+typedef struct DlkDBCreatorList {
+ UInt16 count; // number of entries in the list
+ MemHandle listH; // chunk MemHandle of the creators list
+ } DlkDBCreatorList;
+
+
+//
+// Desktop Link Server state flags
+//
+#define dlkStateFlagVerExchanged 0x8000
+#define dlkStateFlagSyncDateSet 0x4000
+
+//
+// DLP Server session information
+//
+typedef struct DlkServerSessionType {
+ UInt16 htalLibRefNum; // HTAL library reference number - the library has a live connection
+ UInt32 maxHtalXferSize; // Maximum transfer block size
+
+ // Information supplied by user
+ DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc
+ UInt32 eventRef; // user reference value for event proc
+ DlkUserCanProcPtr canProcP; // ptr to user-cancel function
+ UInt32 canRef; // parameter for canProcP()
+ MemHandle condFilterH; // MemHandle of conduit filter table(DlkCondFilterTableHdrPtr) or 0 for none
+
+ // Current database information
+ UInt8 dlkDBID; // Desktop Link database MemHandle of the open database
+ UInt8 reserved1;
+ DmOpenRef dbR; // TouchDown database access pointer -- if null, no current db
+ UInt16 cardNo; // memory module number
+ UInt32 dbCreator; // creator id
+ Char dbName[dmDBNameLength]; // DB name
+ UInt16 dbOpenMode; // database open mode
+ Boolean created; // true if the current db was created
+ Boolean isResDB; // set to true if resource database
+ Boolean ramBased; // true if the db is in RAM storage
+ Boolean readOnly; // true if the db is read-only
+ LocalID dbLocalID; // TouchDown LocalID of the database
+ UInt32 initialModNum; // initial DB modification number
+ UInt32 curRecIndex; // current record index for enumeration functions
+ // (0=beginning)
+
+ // List of modified database creators maintained by DLP Server
+ DlkDBCreatorList creatorList;
+
+ // Session status information
+// DlkSyncStateType syncState; // current sync state;
+ UInt8 syncState; // current sync state;
+
+ Boolean complete; // set to true when completion request
+ // has been received
+
+ Boolean conduitOpened; // set to true after the first coduit
+ // is opened by remote
+
+ Boolean logCleared; // set to true after sync log has been
+ // cleared during the current session;
+ // The log will be cleared before any new entries are added or at
+ // the end of sync in case no new entries were added.
+ // (we do not clear the log at the beginning of sync in case the
+ // user cancels during the "identifying user" phase; in this
+ // event, the spec calls for preserving the original log)
+
+ Boolean resetPending; // set to true if system reset is pending;
+ // the reset will be carried out at end
+ // of sync
+
+ // Current request information
+ Boolean gotCommand; // set to true when got a request
+ UInt8 cmdTID; // current transaction ID
+ UInt8 reserved2;
+ UInt16 cmdLen; // size of data in request buffer
+ void * cmdP; // pointer to command
+ MemHandle cmdH; // MemHandle of command buffer
+
+ // Fields added in PalmOS v3.0
+ UInt16 wStateFlags; // bitfield of dlkStateFlag... bits
+ DmSearchStateType dbSearchState; // database search state for iterative
+ // searches using DmGetNextDatabaseByTypeCreator
+ } DlkServerSessionType;
+
+typedef DlkServerSessionType* DlkServerSessionPtr;
+
+
+/********************************************************************
+ * DLK Function Parameter Structures
+ ********************************************************************/
+#pragma mark *Function Parameter Structures*
+
+//
+// Parameter passed to DlkControl()
+//
+typedef enum DlkCtlEnum {
+ dlkCtlFirst = 0, // reserve 0
+
+ //
+ // Pilot v2.0 control codes:
+ //
+ dlkCtlGetPCHostName, // param1P = ptr to text buffer; (can be null if *(UInt16 *)param2P is 0)
+ // param2P = ptr to buffer size(UInt16);
+ // returns actual length, including null, in *(UInt16 *)param2P which may be bigger than # of bytes copied.
+
+ dlkCtlSetPCHostName, // param1P = ptr to host name(zero-terminated) or NULL if *param2 is 0
+ // param2P = ptr to length(UInt16), including NULL (if length is 0, the current name is deleted)
+
+ dlkCtlGetCondFilterTable, // param1P = ptr to destination buffer for filter table, or NULL if *param2 is 0
+ // param2P = on entry, ptr to size of buffer(UInt16) (the size may be 0)
+ // on return, size, in bytes, of the actual filter table
+
+ dlkCtlSetCondFilterTable, // param1P = ptr to to conduit filter table, or NULL if *param2 is 0
+ // param2P = ptr to size of filter table(UInt16) (if size is 0, the current table will be deleted)
+
+ dlkCtlGetLANSync, // param1P = ptr to store for the LANSync setting(UInt16): 0 = off, otherwise on
+ // param2P = not used, set to NULL
+
+ dlkCtlSetLANSync, // param1P = ptr to the LANSync setting(UInt16): 0 = off, otherwise on
+ // param2P = not used, set to NULL
+
+ dlkCtlGetHSTCPPort, // param1P = ptr to store for the Desktop HotSync TCP/IP port number(UInt32) -- zero if not set
+ // param2P = not used, set to NULL
+
+ dlkCtlSetHSTCPPort, // param1P = ptr to the Desktop HotSync TCP/IP port number(UInt32)
+ // param2P = not used, set to NULL
+
+ dlkCtlSendCallAppReply, // param1P = ptr to DlkCallAppReplyParamType structure
+ // param2P = not used, set to NULL
+ //
+ // RETURNS: send error code; use this error code
+ // as return value from the action code handler
+
+
+ dlkCtlGetPCHostAddr, // param1P = ptr to text buffer; (can be null if *(UInt16 *)param2P is 0)
+ // param2P = ptr to buffer size(UInt16);
+ // returns actual length, including null, in *(UInt16 *)param2P which may be bigger than # of bytes copied.
+
+ dlkCtlSetPCHostAddr, // param1P = ptr to host address string(zero-terminated) or NULL if *param2 is 0
+ // param2P = ptr to length(UInt16), including NULL (if length is 0, the current name is deleted)
+
+
+ dlkCtlGetPCHostMask, // param1P = ptr to text buffer; (can be null if *(UInt16 *)param2P is 0)
+ // param2P = ptr to buffer size(UInt16);
+ // returns actual length, including null, in *(UInt16 *)param2P which may be bigger than # of bytes copied.
+
+ dlkCtlSetPCHostMask, // param1P = ptr to subnet mask string(zero-terminated) or NULL if *param2 is 0
+ // param2P = ptr to length(UInt16), including NULL (if length is 0, the current name is deleted)
+
+
+ dlkCtlLAST // *KEEP THIS ENTRY LAST*
+
+} DlkCtlEnum;
+
+
+//
+// Parameter passed to DlkStartServer()
+//
+typedef struct DlkServerParamType {
+ UInt16 htalLibRefNum; // HTAL library reference number - the library has a live connection
+ DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc
+ UInt32 eventRef; // user reference value for event proc
+ UInt32 reserved1; // reserved - set to NULL
+ UInt32 reserved2; // reserved - set to NULL
+ MemHandle condFilterH; // MemHandle of conduit filter table(DlkCondFilterTableHdrPtr) or 0 for none
+ } DlkServerParamType;
+
+typedef DlkServerParamType* DlkServerParamPtr;
+
+
+
+//
+// Parameter passed with DlkControl()'s dlkCtlSendCallAppReply code
+//
+typedef struct DlkCallAppReplyParamType {
+ UInt16 pbSize; // size of this parameter block (set to sizeof(DlkCallAppReplyParamType))
+ UInt32 dwResultCode; // result code to be returned to remote caller
+ void * resultP; // ptr to result data
+ UInt32 dwResultSize; // size of reply data in number of bytes
+ void * dlRefP; // DesktopLink reference pointer from
+ // SysAppLaunchCmdHandleSyncCallAppType
+ UInt32 dwReserved1; // RESERVED -- set to null!!!
+ } DlkCallAppReplyParamType;
+
+
+/********************************************************************
+ * DesktopLink Server Routines
+ ********************************************************************/
+#pragma mark *Function Prototypes*
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//
+// SERVER API
+//
+
+// * RETURNED: 0 if session ended successfully; otherwise: dlkErrParam,
+// * dlkErrNoSession, dlkErrLostConnection, dlkErrMemory,
+// * dlkErrUserCan
+extern Err DlkStartServer(DlkServerParamPtr paramP)
+ SYS_TRAP(sysTrapDlkStartServer);
+
+extern Err DlkGetSyncInfo(UInt32 * succSyncDateP, UInt32 * lastSyncDateP,
+ DlkSyncStateType* syncStateP, Char * nameBufP,
+ Char * logBufP, Int32 * logLenP)
+ SYS_TRAP(sysTrapDlkGetSyncInfo);
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER... this is a temporary function for debugging modem manager.
+// remove it when done.
+#endif // PUBLIC_STUFF_STRIPPED
+extern void DlkSetLogEntry(const Char * textP, Int16 textLen, Boolean append)
+ SYS_TRAP(sysTrapDlkSetLogEntry);
+
+// Dispatch a DesktopLink request (exposed for patching)
+extern Err DlkDispatchRequest(DlkServerSessionPtr sessP)
+ SYS_TRAP(sysTrapDlkDispatchRequest);
+
+extern Err DlkControl(DlkCtlEnum op, void * param1P, void * param2P)
+ SYS_TRAP(sysTrapDlkControl);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+/********************************************************************
+ * DLK Macros
+ ********************************************************************/
+
+
+
+#endif // __DL_SERVER_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/DataMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/DataMgr.h
new file mode 100644
index 0000000..0381b29
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/DataMgr.h
@@ -0,0 +1,540 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: DataMgr.h
+ *
+ * Description:
+ * Header for the Data Manager
+ *
+ * History:
+ * 11/14/94 RM - Created by Ron Marianetti
+ *
+ *****************************************************************************/
+
+#ifndef __DATAMGR_H__
+#define __DATAMGR_H__
+
+
+// Include elementary types
+#include <PalmTypes.h> // Basic types
+#include <CoreTraps.h> // Trap Numbers.
+#include <ErrorBase.h> // Error numbers
+
+// Other headers we depend on
+#include <MemoryMgr.h>
+
+
+typedef UInt32 DmResType;
+typedef UInt16 DmResID;
+
+/************************************************************
+ * Category equates
+ *************************************************************/
+#define dmRecAttrCategoryMask 0x0F // mask for category #
+#define dmRecNumCategories 16 // number of categories
+#define dmCategoryLength 16 // 15 chars + 1 null terminator
+
+#define dmAllCategories 0xff
+#define dmUnfiledCategory 0
+
+#define dmMaxRecordIndex 0xffff
+
+
+
+// Record Attributes
+//
+// *** IMPORTANT:
+// ***
+// *** Any changes to record attributes must be reflected in dmAllRecAttrs and dmSysOnlyRecAttrs ***
+// ***
+// *** Only one nibble is available for record attributes
+//
+// *** ANY CHANGES MADE TO THESE ATTRIBUTES MUST BE REFLECTED IN DESKTOP LINK
+// *** SERVER CODE (DLCommon.h, DLServer.c)
+#define dmRecAttrDelete 0x80 // delete this record next sync
+#define dmRecAttrDirty 0x40 // archive this record next sync
+#define dmRecAttrBusy 0x20 // record currently in use
+#define dmRecAttrSecret 0x10 // "secret" record - password protected
+
+
+// All record atributes (for error-checking)
+#define dmAllRecAttrs ( dmRecAttrDelete | \
+ dmRecAttrDirty | \
+ dmRecAttrBusy | \
+ dmRecAttrSecret )
+
+// Record attributes which only the system is allowed to change (for error-checking)
+#define dmSysOnlyRecAttrs ( dmRecAttrBusy )
+
+
+/************************************************************
+ * Database Header equates
+ *************************************************************/
+#define dmDBNameLength 32 // 31 chars + 1 null terminator
+
+// Attributes of a Database
+//
+// *** IMPORTANT:
+// ***
+// *** Any changes to database attributes must be reflected in dmAllHdrAttrs and dmSysOnlyHdrAttrs ***
+// ***
+#define dmHdrAttrResDB 0x0001 // Resource database
+#define dmHdrAttrReadOnly 0x0002 // Read Only database
+#define dmHdrAttrAppInfoDirty 0x0004 // Set if Application Info block is dirty
+ // Optionally supported by an App's conduit
+#define dmHdrAttrBackup 0x0008 // Set if database should be backed up to PC if
+ // no app-specific synchronization conduit has
+ // been supplied.
+#define dmHdrAttrOKToInstallNewer 0x0010 // This tells the backup conduit that it's OK
+ // for it to install a newer version of this database
+ // with a different name if the current database is
+ // open. This mechanism is used to update the
+ // Graffiti Shortcuts database, for example.
+#define dmHdrAttrResetAfterInstall 0x0020 // Device requires a reset after this database is
+ // installed.
+#define dmHdrAttrCopyPrevention 0x0040 // This database should not be copied to
+
+#define dmHdrAttrStream 0x0080 // This database is used for file stream implementation.
+#define dmHdrAttrHidden 0x0100 // This database should generally be hidden from view
+ // used to hide some apps from the main view of the
+ // launcher for example.
+ // For data (non-resource) databases, this hides the record
+ // count within the launcher info screen.
+#define dmHdrAttrLaunchableData 0x0200 // This data database (not applicable for executables)
+ // can be "launched" by passing it's name to it's owner
+ // app ('appl' database with same creator) using
+ // the sysAppLaunchCmdOpenNamedDB action code.
+
+#define dmHdrAttrOpen 0x8000 // Database not closed properly
+
+
+// All database atributes (for error-checking)
+#define dmAllHdrAttrs ( dmHdrAttrResDB | \
+ dmHdrAttrReadOnly | \
+ dmHdrAttrAppInfoDirty | \
+ dmHdrAttrBackup | \
+ dmHdrAttrOKToInstallNewer | \
+ dmHdrAttrResetAfterInstall | \
+ dmHdrAttrCopyPrevention | \
+ dmHdrAttrStream | \
+ dmHdrAttrOpen )
+
+// Database attributes which only the system is allowed to change (for error-checking)
+#define dmSysOnlyHdrAttrs ( dmHdrAttrResDB | \
+ dmHdrAttrOpen )
+
+
+/************************************************************
+ * Unique ID equates
+ *************************************************************/
+#define dmRecordIDReservedRange 1 // The range of upper bits in the database's
+ // uniqueIDSeed from 0 to this number are
+ // reserved and not randomly picked when a
+ // database is created.
+#define dmDefaultRecordsID 0 // Records in a default database are copied
+ // with their uniqueIDSeeds set in this range.
+#define dmUnusedRecordID 0 // Record ID not allowed on the device
+
+
+/************************************************************
+ * Mode flags passed to DmOpenDatabase
+ *************************************************************/
+#define dmModeReadOnly 0x0001 // read access
+#define dmModeWrite 0x0002 // write access
+#define dmModeReadWrite 0x0003 // read & write access
+#define dmModeLeaveOpen 0x0004 // leave open when app quits
+#define dmModeExclusive 0x0008 // don't let anyone else open it
+#define dmModeShowSecret 0x0010 // force show of secret records
+
+// Generic type used to represent an open Database
+typedef void * DmOpenRef;
+
+
+/************************************************************
+ * Structure passed to DmGetNextDatabaseByTypeCreator and used
+ * to cache search information between multiple searches.
+ *************************************************************/
+typedef struct {
+ UInt32 info[8];
+ } DmSearchStateType;
+typedef DmSearchStateType* DmSearchStatePtr;
+
+
+
+/************************************************************
+ * Structures used by the sorting routines
+ *************************************************************/
+typedef struct {
+ UInt8 attributes; // record attributes;
+ UInt8 uniqueID[3]; // unique ID of record
+ } SortRecordInfoType;
+
+typedef SortRecordInfoType *SortRecordInfoPtr;
+
+typedef Int16 DmComparF (void *, void *, Int16 other, SortRecordInfoPtr,
+ SortRecordInfoPtr, MemHandle appInfoH);
+
+
+
+/************************************************************
+ * Database manager error codes
+ * the constant dmErrorClass is defined in ErrorBase.h
+ *************************************************************/
+#define dmErrMemError (dmErrorClass | 1)
+#define dmErrIndexOutOfRange (dmErrorClass | 2)
+#define dmErrInvalidParam (dmErrorClass | 3)
+#define dmErrReadOnly (dmErrorClass | 4)
+#define dmErrDatabaseOpen (dmErrorClass | 5)
+#define dmErrCantOpen (dmErrorClass | 6)
+#define dmErrCantFind (dmErrorClass | 7)
+#define dmErrRecordInWrongCard (dmErrorClass | 8)
+#define dmErrCorruptDatabase (dmErrorClass | 9)
+#define dmErrRecordDeleted (dmErrorClass | 10)
+#define dmErrRecordArchived (dmErrorClass | 11)
+#define dmErrNotRecordDB (dmErrorClass | 12)
+#define dmErrNotResourceDB (dmErrorClass | 13)
+#define dmErrROMBased (dmErrorClass | 14)
+#define dmErrRecordBusy (dmErrorClass | 15)
+#define dmErrResourceNotFound (dmErrorClass | 16)
+#define dmErrNoOpenDatabase (dmErrorClass | 17)
+#define dmErrInvalidCategory (dmErrorClass | 18)
+#define dmErrNotValidRecord (dmErrorClass | 19)
+#define dmErrWriteOutOfBounds (dmErrorClass | 20)
+#define dmErrSeekFailed (dmErrorClass | 21)
+#define dmErrAlreadyOpenForWrites (dmErrorClass | 22)
+#define dmErrOpenedByAnotherTask (dmErrorClass | 23)
+#define dmErrUniqueIDNotFound (dmErrorClass | 24)
+#define dmErrAlreadyExists (dmErrorClass | 25)
+#define dmErrInvalidDatabaseName (dmErrorClass | 26)
+#define dmErrDatabaseProtected (dmErrorClass | 27)
+#define dmErrDatabaseNotProtected (dmErrorClass | 28)
+
+/************************************************************
+ * Values for the direction parameter of DmSeekRecordInCategory
+ *************************************************************/
+#define dmSeekForward 1
+#define dmSeekBackward -1
+
+
+/************************************************************
+ * Data Manager procedures
+ *************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+// Initialization
+Err DmInit(void)
+ SYS_TRAP(sysTrapDmInit);
+
+
+// Directory Lists
+Err DmCreateDatabase(UInt16 cardNo, const Char *nameP,
+ UInt32 creator, UInt32 type, Boolean resDB)
+ SYS_TRAP(sysTrapDmCreateDatabase);
+
+Err DmCreateDatabaseFromImage(MemPtr bufferP)
+ SYS_TRAP(sysTrapDmCreateDatabaseFromImage);
+
+
+Err DmDeleteDatabase(UInt16 cardNo, LocalID dbID)
+ SYS_TRAP(sysTrapDmDeleteDatabase);
+
+UInt16 DmNumDatabases(UInt16 cardNo)
+ SYS_TRAP(sysTrapDmNumDatabases);
+
+LocalID DmGetDatabase(UInt16 cardNo, UInt16 index)
+ SYS_TRAP(sysTrapDmGetDatabase);
+
+LocalID DmFindDatabase(UInt16 cardNo, const Char *nameP)
+ SYS_TRAP(sysTrapDmFindDatabase);
+
+Err DmGetNextDatabaseByTypeCreator(Boolean newSearch, DmSearchStatePtr stateInfoP,
+ UInt32 type, UInt32 creator, Boolean onlyLatestVers,
+ UInt16 *cardNoP, LocalID *dbIDP)
+ SYS_TRAP(sysTrapDmGetNextDatabaseByTypeCreator);
+
+
+// Database info
+Err DmDatabaseInfo(UInt16 cardNo, LocalID dbID, Char *nameP,
+ UInt16 *attributesP, UInt16 *versionP, UInt32 *crDateP,
+ UInt32 * modDateP, UInt32 *bckUpDateP,
+ UInt32 * modNumP, LocalID *appInfoIDP,
+ LocalID *sortInfoIDP, UInt32 *typeP,
+ UInt32 *creatorP)
+ SYS_TRAP(sysTrapDmDatabaseInfo);
+
+Err DmSetDatabaseInfo(UInt16 cardNo, LocalID dbID, const Char *nameP,
+ UInt16 *attributesP, UInt16 *versionP, UInt32 *crDateP,
+ UInt32 * modDateP, UInt32 *bckUpDateP,
+ UInt32 * modNumP, LocalID *appInfoIDP,
+ LocalID *sortInfoIDP, UInt32 *typeP,
+ UInt32 *creatorP)
+ SYS_TRAP(sysTrapDmSetDatabaseInfo);
+
+Err DmDatabaseSize(UInt16 cardNo, LocalID dbID, UInt32 *numRecordsP,
+ UInt32 * totalBytesP, UInt32 *dataBytesP)
+ SYS_TRAP(sysTrapDmDatabaseSize);
+
+
+// This routine can be used to prevent a database from being deleted (by passing
+// true for 'protect'). It will increment the protect count if 'protect' is true
+// and decrement it if 'protect' is false. This is used by code that wants to
+// keep a particular record or resource in a database locked down but doesn't
+// want to keep the database open. This information is keep in the dynamic heap so
+// all databases are "unprotected" at system reset.
+Err DmDatabaseProtect(UInt16 cardNo, LocalID dbID, Boolean protect)
+ SYS_TRAP(sysTrapDmDatabaseProtect);
+
+
+// Open/close Databases
+DmOpenRef DmOpenDatabase(UInt16 cardNo, LocalID dbID, UInt16 mode)
+ SYS_TRAP(sysTrapDmOpenDatabase);
+
+DmOpenRef DmOpenDatabaseByTypeCreator(UInt32 type, UInt32 creator, UInt16 mode)
+ SYS_TRAP(sysTrapDmOpenDatabaseByTypeCreator);
+
+DmOpenRef DmOpenDBNoOverlay(UInt16 cardNo, LocalID dbID, UInt16 mode)
+ SYS_TRAP(sysTrapDmOpenDBNoOverlay);
+
+Err DmCloseDatabase(DmOpenRef dbP)
+ SYS_TRAP(sysTrapDmCloseDatabase);
+
+
+// Info on open databases
+DmOpenRef DmNextOpenDatabase(DmOpenRef currentP)
+ SYS_TRAP(sysTrapDmNextOpenDatabase);
+
+Err DmOpenDatabaseInfo(DmOpenRef dbP, LocalID *dbIDP,
+ UInt16 *openCountP, UInt16 *modeP, UInt16 *cardNoP,
+ Boolean *resDBP)
+ SYS_TRAP(sysTrapDmOpenDatabaseInfo);
+
+LocalID DmGetAppInfoID (DmOpenRef dbP)
+ SYS_TRAP(sysTrapDmGetAppInfoID);
+
+void DmGetDatabaseLockState(DmOpenRef dbR, UInt8 *highest, UInt32 *count, UInt32 *busy)
+ SYS_TRAP(sysTrapDmGetDatabaseLockState);
+
+// Utility to unlock all records and clear busy bits
+Err DmResetRecordStates(DmOpenRef dbP)
+ SYS_TRAP(sysTrapDmResetRecordStates);
+
+
+// Error Query
+Err DmGetLastErr(void)
+ SYS_TRAP(sysTrapDmGetLastErr);
+
+
+//------------------------------------------------------------
+// Record based access routines
+//------------------------------------------------------------
+
+// Record Info
+UInt16 DmNumRecords(DmOpenRef dbP)
+ SYS_TRAP(sysTrapDmNumRecords);
+
+UInt16 DmNumRecordsInCategory(DmOpenRef dbP, UInt16 category)
+ SYS_TRAP(sysTrapDmNumRecordsInCategory);
+
+Err DmRecordInfo(DmOpenRef dbP, UInt16 index,
+ UInt16 *attrP, UInt32 *uniqueIDP, LocalID *chunkIDP)
+ SYS_TRAP(sysTrapDmRecordInfo);
+
+Err DmSetRecordInfo(DmOpenRef dbP, UInt16 index,
+ UInt16 *attrP, UInt32 *uniqueIDP)
+ SYS_TRAP(sysTrapDmSetRecordInfo);
+
+
+
+// Record attaching and detaching
+Err DmAttachRecord(DmOpenRef dbP, UInt16 *atP,
+ MemHandle newH, MemHandle *oldHP)
+ SYS_TRAP(sysTrapDmAttachRecord);
+
+Err DmDetachRecord(DmOpenRef dbP, UInt16 index,
+ MemHandle *oldHP)
+ SYS_TRAP(sysTrapDmDetachRecord);
+
+Err DmMoveRecord(DmOpenRef dbP, UInt16 from, UInt16 to)
+ SYS_TRAP(sysTrapDmMoveRecord);
+
+
+
+// Record creation and deletion
+MemHandle DmNewRecord(DmOpenRef dbP, UInt16 *atP, UInt32 size)
+ SYS_TRAP(sysTrapDmNewRecord);
+
+Err DmRemoveRecord(DmOpenRef dbP, UInt16 index)
+ SYS_TRAP(sysTrapDmRemoveRecord);
+
+Err DmDeleteRecord(DmOpenRef dbP, UInt16 index)
+ SYS_TRAP(sysTrapDmDeleteRecord);
+
+Err DmArchiveRecord(DmOpenRef dbP, UInt16 index)
+ SYS_TRAP(sysTrapDmArchiveRecord);
+
+MemHandle DmNewHandle(DmOpenRef dbP, UInt32 size)
+ SYS_TRAP(sysTrapDmNewHandle);
+
+Err DmRemoveSecretRecords(DmOpenRef dbP)
+ SYS_TRAP(sysTrapDmRemoveSecretRecords);
+
+
+// Record viewing manipulation
+Err DmFindRecordByID(DmOpenRef dbP, UInt32 uniqueID, UInt16 *indexP)
+ SYS_TRAP(sysTrapDmFindRecordByID);
+
+MemHandle DmQueryRecord(DmOpenRef dbP, UInt16 index)
+ SYS_TRAP(sysTrapDmQueryRecord);
+
+MemHandle DmGetRecord(DmOpenRef dbP, UInt16 index)
+ SYS_TRAP(sysTrapDmGetRecord);
+
+MemHandle DmQueryNextInCategory(DmOpenRef dbP, UInt16 *indexP, UInt16 category)
+ SYS_TRAP(sysTrapDmQueryNextInCategory);
+
+UInt16 DmPositionInCategory (DmOpenRef dbP, UInt16 index, UInt16 category)
+ SYS_TRAP(sysTrapDmPositionInCategory);
+
+Err DmSeekRecordInCategory (DmOpenRef dbP, UInt16 *indexP, UInt16 offset,
+ Int16 direction, UInt16 category)
+ SYS_TRAP(sysTrapDmSeekRecordInCategory);
+
+
+MemHandle DmResizeRecord(DmOpenRef dbP, UInt16 index, UInt32 newSize)
+ SYS_TRAP(sysTrapDmResizeRecord);
+
+Err DmReleaseRecord(DmOpenRef dbP, UInt16 index, Boolean dirty)
+ SYS_TRAP(sysTrapDmReleaseRecord);
+
+UInt16 DmSearchRecord(MemHandle recH, DmOpenRef *dbPP)
+ SYS_TRAP(sysTrapDmSearchRecord);
+
+
+// Category manipulation
+Err DmMoveCategory (DmOpenRef dbP, UInt16 toCategory, UInt16 fromCategory, Boolean dirty)
+ SYS_TRAP(sysTrapDmMoveCategory);
+
+Err DmDeleteCategory (DmOpenRef dbR, UInt16 categoryNum)
+ SYS_TRAP(sysTrapDmDeleteCategory);
+
+
+// Validation for writing
+Err DmWriteCheck(void *recordP, UInt32 offset, UInt32 bytes)
+ SYS_TRAP(sysTrapDmWriteCheck);
+
+// Writing
+Err DmWrite(void *recordP, UInt32 offset, const void *srcP, UInt32 bytes)
+ SYS_TRAP(sysTrapDmWrite);
+
+Err DmStrCopy(void *recordP, UInt32 offset, const Char *srcP)
+ SYS_TRAP(sysTrapDmStrCopy);
+
+Err DmSet(void *recordP, UInt32 offset, UInt32 bytes, UInt8 value)
+ SYS_TRAP(sysTrapDmSet);
+
+
+
+
+//------------------------------------------------------------
+// Resource based access routines
+//------------------------------------------------------------
+
+// High level access routines
+MemHandle DmGetResource(DmResType type, DmResID resID)
+ SYS_TRAP(sysTrapDmGetResource);
+
+MemHandle DmGet1Resource(DmResType type, DmResID resID)
+ SYS_TRAP(sysTrapDmGet1Resource);
+
+Err DmReleaseResource(MemHandle resourceH)
+ SYS_TRAP(sysTrapDmReleaseResource);
+
+MemHandle DmResizeResource(MemHandle resourceH, UInt32 newSize)
+ SYS_TRAP(sysTrapDmResizeResource);
+
+
+// Searching resource databases
+DmOpenRef DmNextOpenResDatabase(DmOpenRef dbP)
+ SYS_TRAP(sysTrapDmNextOpenResDatabase);
+
+UInt16 DmFindResourceType(DmOpenRef dbP, DmResType resType, UInt16 typeIndex)
+ SYS_TRAP(sysTrapDmFindResourceType);
+
+UInt16 DmFindResource(DmOpenRef dbP, DmResType resType, DmResID resID,
+ MemHandle resH)
+ SYS_TRAP(sysTrapDmFindResource);
+
+UInt16 DmSearchResource(DmResType resType, DmResID resID,
+ MemHandle resH, DmOpenRef *dbPP)
+ SYS_TRAP(sysTrapDmSearchResource);
+
+
+// Resource Info
+UInt16 DmNumResources(DmOpenRef dbP)
+ SYS_TRAP(sysTrapDmNumResources);
+
+Err DmResourceInfo(DmOpenRef dbP, UInt16 index,
+ DmResType *resTypeP, DmResID *resIDP,
+ LocalID *chunkLocalIDP)
+ SYS_TRAP(sysTrapDmResourceInfo);
+
+Err DmSetResourceInfo(DmOpenRef dbP, UInt16 index,
+ DmResType *resTypeP, DmResID *resIDP)
+ SYS_TRAP(sysTrapDmSetResourceInfo);
+
+
+
+// Resource attaching and detaching
+Err DmAttachResource(DmOpenRef dbP, MemHandle newH,
+ DmResType resType, DmResID resID)
+ SYS_TRAP(sysTrapDmAttachResource);
+
+Err DmDetachResource(DmOpenRef dbP, UInt16 index,
+ MemHandle *oldHP)
+ SYS_TRAP(sysTrapDmDetachResource);
+
+
+
+// Resource creation and deletion
+MemHandle DmNewResource(DmOpenRef dbP, DmResType resType, DmResID resID,
+ UInt32 size)
+ SYS_TRAP(sysTrapDmNewResource);
+
+Err DmRemoveResource(DmOpenRef dbP, UInt16 index)
+ SYS_TRAP(sysTrapDmRemoveResource);
+
+
+
+// Resource manipulation
+MemHandle DmGetResourceIndex(DmOpenRef dbP, UInt16 index)
+ SYS_TRAP(sysTrapDmGetResourceIndex);
+
+
+
+// Record sorting
+Err DmQuickSort(DmOpenRef dbP, DmComparF *compar, Int16 other)
+ SYS_TRAP(sysTrapDmQuickSort);
+
+Err DmInsertionSort (DmOpenRef dbR, DmComparF *compar, Int16 other)
+ SYS_TRAP(sysTrapDmInsertionSort);
+
+UInt16 DmFindSortPosition(DmOpenRef dbP, void *newRecord,
+ SortRecordInfoPtr newRecordInfo, DmComparF *compar, Int16 other)
+ SYS_TRAP(sysTrapDmFindSortPosition);
+
+UInt16 DmFindSortPositionV10(DmOpenRef dbP, void *newRecord,
+ DmComparF *compar, Int16 other)
+ SYS_TRAP(sysTrapDmFindSortPositionV10);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif // __DATAMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/DateTime.h b/SrcShared/Palm/Platform/Incs/Core/System/DateTime.h
new file mode 100644
index 0000000..adc44d6
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/DateTime.h
@@ -0,0 +1,283 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: DateTime.h
+ *
+ * Description:
+ * Date and Time calculations
+ *
+ * History:
+ * 1/19/95 rsf - Created by Roger Flores
+ * 7/15/99 rsf - moved some types in from Preferences.h
+ * 12/23/99 jmp - eliminated bogus maxTime definition
+ *
+ *****************************************************************************/
+
+#ifndef __DATETIME_H__
+#define __DATETIME_H__
+
+#include <CoreTraps.h>
+
+typedef enum
+ {
+ tfColon,
+ tfColonAMPM, // 1:00 pm
+ tfColon24h, // 13:00
+ tfDot,
+ tfDotAMPM, // 1.00 pm
+ tfDot24h, // 13.00
+ tfHoursAMPM, // 1 pm
+ tfHours24h, // 13
+ tfComma24h // 13,00
+ } TimeFormatType;
+
+
+typedef enum {
+ dsNone, // Daylight Savings Time not observed
+ dsUSA, // United States Daylight Savings Time
+ dsAustralia, // Australian Daylight Savings Time
+ dsWesternEuropean, // Western European Daylight Savings Time
+ dsMiddleEuropean, // Middle European Daylight Savings Time
+ dsEasternEuropean, // Eastern European Daylight Savings Time
+ dsGreatBritain, // Great Britain and Eire Daylight Savings Time
+ dsRumania, // Rumanian Daylight Savings Time
+ dsTurkey, // Turkish Daylight Savings Time
+ dsAustraliaShifted // Australian Daylight Savings Time with shift in 1986
+ } DaylightSavingsTypes;
+
+
+// pass a TimeFormatType
+#define Use24HourFormat(t) ((t) == tfColon24h || (t) == tfDot24h || (t) == tfHours24h || (t) == tfComma24h)
+#define TimeSeparator(t) ((Char) ( t <= tfColon24h ? ':' : (t <= tfDot24h ? '.' : ',')))
+
+
+typedef enum {
+ dfMDYWithSlashes, // 12/31/95
+ dfDMYWithSlashes, // 31/12/95
+ dfDMYWithDots, // 31.12.95
+ dfDMYWithDashes, // 31-12-95
+ dfYMDWithSlashes, // 95/12/31
+ dfYMDWithDots, // 95.12.31
+ dfYMDWithDashes, // 95-12-31
+
+ dfMDYLongWithComma, // Dec 31, 1995
+ dfDMYLong, // 31 Dec 1995
+ dfDMYLongWithDot, // 31. Dec 1995
+ dfDMYLongNoDay, // Dec 1995
+ dfDMYLongWithComma, // 31 Dec, 1995
+ dfYMDLongWithDot, // 1995.12.31
+ dfYMDLongWithSpace, // 1995 Dec 31
+
+ dfMYMed, // Dec '95
+ dfMYMedNoPost // Dec 95 (added for French 2.0 ROM)
+ } DateFormatType;
+
+typedef struct {
+ Int16 second;
+ Int16 minute;
+ Int16 hour;
+ Int16 day;
+ Int16 month;
+ Int16 year;
+ Int16 weekDay; // Days since Sunday (0 to 6)
+ } DateTimeType;
+
+typedef DateTimeType *DateTimePtr;
+
+
+// This is the time format. Times are treated as words so don't
+// change the order of the members in this structure.
+//
+typedef struct {
+ UInt8 hours;
+ UInt8 minutes;
+} TimeType;
+
+typedef TimeType *TimePtr;
+
+#define noTime -1 // The entire TimeType is -1 if there isn't a time.
+
+
+// This is the date format. Dates are treated as words so don't
+// change the order of the members in this structure.
+//
+typedef struct {
+ UInt16 year :7; // years since 1904 (MAC format)
+ UInt16 month :4;
+ UInt16 day :5;
+} DateType;
+
+typedef DateType *DatePtr;
+
+
+/************************************************************
+ * Date Time Constants
+ *************************************************************/
+
+// Maximum lengths of strings return by the date and time formating
+// routine DateToAscii and TimeToAscii.
+#define timeStringLength 9
+#define dateStringLength 9
+#define longDateStrLength 15
+#define dowDateStringLength 19
+#define dowLongDateStrLength 25
+
+
+#define firstYear 1904
+#define numberOfYears 128
+#define lastYear (firstYear + numberOfYears - 1)
+
+
+
+// Constants for time calculations
+// Could change these from xIny to yPerX
+#define secondsInSeconds 1
+#define minutesInSeconds 60
+#define hoursInMinutes 60
+#define hoursInSeconds (hoursInMinutes * minutesInSeconds)
+#define hoursPerDay 24
+//#define daysInSeconds ((Int32)(hoursPerDay) * ((Int32)hoursInSeconds))
+#define daysInSeconds (0x15180) // cc bug
+
+#define daysInWeek 7
+#define daysInYear 365
+#define daysInLeapYear 366
+#define daysInFourYears (daysInLeapYear + 3 * daysInYear)
+
+#define monthsInYear 12
+
+#define maxDays ((UInt32) numberOfYears / 4 * daysInFourYears - 1)
+#define maxSeconds ((UInt32) maxDays * daysInSeconds)
+
+// Values returned by DayOfWeek routine.
+#define sunday 0
+#define monday 1
+#define tuesday 2
+#define wednesday 3
+#define thursday 4
+#define friday 5
+#define saturday 6
+
+// Months of the year
+#define january 1
+#define february 2
+#define march 3
+#define april 4
+#define may 5
+#define june 6
+#define july 7
+#define august 8
+#define september 9
+#define october 10
+#define november 11
+#define december 12
+
+
+// Values returned by DoyOfMonth routine.
+typedef enum {
+ dom1stSun, dom1stMon, dom1stTue, dom1stWen, dom1stThu, dom1stFri, dom1stSat,
+ dom2ndSun, dom2ndMon, dom2ndTue, dom2ndWen, dom2ndThu, dom2ndFri, dom2ndSat,
+ dom3rdSun, dom3rdMon, dom3rdTue, dom3rdWen, dom3rdThu, dom3rdFri, dom3rdSat,
+ dom4thSun, dom4thMon, dom4thTue, dom4thWen, dom4thThu, dom4thFri, dom4thSat,
+ domLastSun, domLastMon, domLastTue, domLastWen, domLastThu, domLastFri,
+ domLastSat
+ } DayOfWeekType;
+
+// Values used by DateTemplateToAscii routine.
+#define dateTemplateChar chrCircumflexAccent
+
+enum {
+ dateTemplateDayNum = '0',
+ dateTemplateDOWName,
+ dateTemplateMonthName,
+ dateTemplateMonthNum,
+ dateTemplateYearNum
+};
+
+#define dateTemplateShortModifier 's'
+#define dateTemplateRegularModifier 'r'
+#define dateTemplateLongModifier 'l'
+#define dateTemplateLeadZeroModifier 'z'
+
+//************************************************************
+//* Date and Time macros
+//***********************************************************
+
+// Convert a date in a DateType structure to an UInt16.
+ #define DateToInt(date) (*(UInt16 *) &date)
+
+
+// Convert a date in a DateType structure to a signed int.
+ #define TimeToInt(time) (*(Int16 *) &time)
+
+
+
+//************************************************************
+//* Date Time procedures
+//************************************************************
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void TimSecondsToDateTime(UInt32 seconds, DateTimePtr dateTimeP)
+ SYS_TRAP(sysTrapTimSecondsToDateTime);
+
+UInt32 TimDateTimeToSeconds(DateTimePtr dateTimeP)
+ SYS_TRAP(sysTrapTimDateTimeToSeconds);
+
+void TimAdjust(DateTimePtr dateTimeP, Int32 adjustment)
+ SYS_TRAP(sysTrapTimAdjust);
+
+void TimeToAscii(UInt8 hours, UInt8 minutes, TimeFormatType timeFormat,
+ Char *pString)
+ SYS_TRAP(sysTrapTimeToAscii);
+
+
+
+Int16 DaysInMonth(Int16 month, Int16 year)
+ SYS_TRAP(sysTrapDaysInMonth);
+
+Int16 DayOfWeek (Int16 month, Int16 day, Int16 year)
+ SYS_TRAP(sysTrapDayOfWeek);
+
+Int16 DayOfMonth (Int16 month, Int16 day, Int16 year)
+ SYS_TRAP(sysTrapDayOfMonth);
+
+
+
+// Date routines.
+void DateSecondsToDate (UInt32 seconds, DatePtr date)
+ SYS_TRAP(sysTrapDateSecondsToDate);
+
+void DateDaysToDate (UInt32 days, DatePtr date)
+ SYS_TRAP(sysTrapDateDaysToDate);
+
+UInt32 DateToDays (DateType date)
+ SYS_TRAP(sysTrapDateToDays);
+
+void DateAdjust (DatePtr dateP, Int32 adjustment)
+ SYS_TRAP(sysTrapDateAdjust);
+
+void DateToAscii(UInt8 months, UInt8 days, UInt16 years,
+ DateFormatType dateFormat, Char *pString)
+ SYS_TRAP(sysTrapDateToAscii);
+
+void DateToDOWDMFormat(UInt8 months, UInt8 days, UInt16 years,
+ DateFormatType dateFormat, Char *pString)
+ SYS_TRAP(sysTrapDateToDOWDMFormat);
+
+UInt16 DateTemplateToAscii(const Char *templateP, UInt8 months,
+ UInt8 days, UInt16 years, Char *stringP, Int16 stringLen)
+ SYS_TRAP(sysTrapDateTemplateToAscii);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif //__DATETIME_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/ErrorBase.h b/SrcShared/Palm/Platform/Incs/Core/System/ErrorBase.h
new file mode 100644
index 0000000..9417c42
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/ErrorBase.h
@@ -0,0 +1,294 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: ErrorBase.h
+ *
+ * Description:
+ * Include file for Error Management
+ *
+ * History:
+ * 10/25/94 RM Created by Ron Marianetti
+ * 10/09/98 Bob Fill in all macros, fix defns w/ do{}while(0)
+ * 08/05/99 kwk Added menuErrorClass from Gavin's Menu.c
+ *
+ *-----------------------------------------------------------------------
+ * Exception Handling
+ *
+ * This unit implements an exception handling mechanism that is similar
+ * to "real" C++ Exceptions. Our Exceptions are untyped, and there
+ * must be one and only one Catch block for each Try block.
+ *
+ * Try/Catch Syntax:
+ *
+ * ErrTry {
+ * // Do something which may fail.
+ * // Call ErrThrow() to signal failure and force jump
+ * // to the following Catch block.
+ * }
+ *
+ * ErrCatch(inErr) {
+ * // Recover or cleanup after a failure in the above Try block.
+ * // "inErr" is an ExceptionCode identifying the reason
+ * // for the failure.
+ *
+ * // You may call Throw() if you want to jump out to
+ * // the next Catch block.
+ *
+ * // The code in this Catch block does not execute if
+ * // the above Try block completes without a Throw.
+ *
+ * } ErrEndCatch
+ *
+ * You must structure your code exactly as above. You can't have a
+ * ErrTry { } without a ErrCatch { } ErrEndCatch, or vice versa.
+ *
+ *
+ * ErrThrow
+ *
+ * To signal failure, call ErrThrow() from within a Try block. The
+ * Throw can occur anywhere in the Try block, even within functions
+ * called from the Try block. A ErrThrow() will jump execution to the
+ * start of the nearest Catch block, even across function calls.
+ * Destructors for stack-based objects which go out of scope as
+ * a result of the ErrThrow() are called.
+ *
+ * You can call ErrThrow() from within a Catch block to "rethrow"
+ * the exception to the next nearest Catch block.
+ *
+ *
+ * Exception Codes
+ *
+ * An ExceptionCode is a 32-bit number. You will normally use
+ * Pilot error codes, which are 16-bit numbers. This allows
+ * plently of room for defining codes for your own kinds of errors.
+ *
+ *
+ * Limitations
+ *
+ * Try/Catch and Throw are based on setjmp/longjmp. At the
+ * beginning of a Try block, setjmp saves the machine registers.
+ * Throw calls longjmp, which restores the registers and jumps
+ * to the beginning of the Catch block. Therefore, any changes
+ * in the Try block to variables stored in registers will not
+ * be retained when entering the Catch block.
+ *
+ * The solution is to declare variables that you want to use
+ * in both the Try and Catch blocks as "volatile". For example:
+ *
+ * volatile long x = 1; // Declare volatile local variable
+ * ErrTry {
+ * x = 100; // Set local variable in Try
+ * ErrThrow(-1);
+ * }
+ *
+ * ErrCatch(inErr) {
+ * if (x > 1) { // Use local variable in Catch
+ * SysBeep(1);
+ * }
+ * } ErrEndCatch
+ *
+ *****************************************************************************/
+
+#ifndef __ERRORBASE_H__
+#define __ERRORBASE_H__
+
+// Include elementary types
+#include <PalmTypes.h> // Basic types
+#include <CoreTraps.h> // Trap Numbers.
+
+
+#if EMULATION_LEVEL != EMULATION_NONE
+#include <setjmp.h>
+#endif
+
+// Max message length supported by ErrCustomAlert
+#define errMaxMsgLength 511
+
+
+/************************************************************
+ * Error Classes for each manager
+ *************************************************************/
+#define errNone 0x0000 // No error
+
+#define memErrorClass 0x0100 // Memory Manager
+#define dmErrorClass 0x0200 // Data Manager
+#define serErrorClass 0x0300 // Serial Manager
+#define slkErrorClass 0x0400 // Serial Link Manager
+#define sysErrorClass 0x0500 // System Manager
+#define fplErrorClass 0x0600 // Floating Point Library
+#define flpErrorClass 0x0680 // New Floating Point Library
+#define evtErrorClass 0x0700 // System Event Manager
+#define sndErrorClass 0x0800 // Sound Manager
+#define almErrorClass 0x0900 // Alarm Manager
+#define timErrorClass 0x0A00 // Time Manager
+#define penErrorClass 0x0B00 // Pen Manager
+#define ftrErrorClass 0x0C00 // Feature Manager
+#define cmpErrorClass 0x0D00 // Connection Manager (HotSync)
+#define dlkErrorClass 0x0E00 // Desktop Link Manager
+#define padErrorClass 0x0F00 // PAD Manager
+#define grfErrorClass 0x1000 // Graffiti Manager
+#define mdmErrorClass 0x1100 // Modem Manager
+#define netErrorClass 0x1200 // Net Library
+#define htalErrorClass 0x1300 // HTAL Library
+#define inetErrorClass 0x1400 // INet Library
+#define exgErrorClass 0x1500 // Exg Manager
+#define fileErrorClass 0x1600 // File Stream Manager
+#define rfutErrorClass 0x1700 // RFUT Library
+#define txtErrorClass 0x1800 // Text Manager
+#define tsmErrorClass 0x1900 // Text Services Library
+#define webErrorClass 0x1A00 // Web Library
+#define secErrorClass 0x1B00 // Security Library
+#define emuErrorClass 0x1C00 // Emulator Control Manager
+#define flshErrorClass 0x1D00 // Flash Manager
+#define pwrErrorClass 0x1E00 // Power Manager
+#define cncErrorClass 0x1F00 // Connection Manager (Serial Communication)
+#define actvErrorClass 0x2000 // Activation application
+#define radioErrorClass 0x2100 // Radio Manager (Library)
+#define dispErrorClass 0x2200 // Display Driver Errors.
+#define bltErrorClass 0x2300 // Blitter Driver Errors.
+#define winErrorClass 0x2400 // Window manager.
+#define omErrorClass 0x2500 // Overlay Manager
+#define menuErrorClass 0x2600 // Menu Manager
+#define lz77ErrorClass 0x2700 // Lz77 Library
+#define smsErrorClass 0x2800 // Sms Library
+#define expErrorClass 0x2900 // Expansion Manager and Slot Driver Library
+#define vfsErrorClass 0x2A00 // Virtual Filesystem Manager and Filesystem library
+#define lmErrorClass 0x2B00 // Locale Manager
+#define intlErrorClass 0x2C00 // International Manager
+#define pdiErrorClass 0x2D00 // PDI Library
+#define attnErrorClass 0x2E00 // Attention Manager
+#define telErrorClass 0x2F00 // Telephony Manager
+#define hwrErrorClass 0x3000 // Hardware Manager (HAL)
+#define blthErrorClass 0x3100 // Bluetooth Library Error Class
+#define udaErrorClass 0x3200 // UDA Manager Error Class
+
+#define oemErrorClass 0x7000 // OEM/Licensee errors (0x7000-0x7EFF shared among ALL partners)
+#define errInfoClass 0x7F00 // special class shows information w/o error code
+#define appErrorClass 0x8000 // Application-defined errors
+
+
+
+/********************************************************************
+ * Try / Catch / Throw support
+ *
+ * ---------------------------------------------------------------------
+ * Exception Handler structure
+ *
+ * An ErrExceptionType object is created for each ErrTry & ErrCatch block.
+ * At any point in the program, there is a linked list of
+ * ErrExceptionType objects. GErrFirstException points to the
+ * most recently entered block. A ErrExceptionType blocks stores
+ * information about the state of the machine (register values)
+ * at the start of the Try block
+ ********************************************************************/
+
+#if EMULATION_LEVEL != EMULATION_NONE
+ #define ErrJumpBuf jmp_buf
+#else
+ typedef long* ErrJumpBuf[12]; // D3-D7,PC,A2-A7
+#endif
+
+// Structure used to store Try state.
+typedef struct ErrExceptionType {
+ struct ErrExceptionType* nextP; // next exception type
+ ErrJumpBuf state; // setjmp/longjmp storage
+ Int32 err; // Error code
+ } ErrExceptionType;
+typedef ErrExceptionType *ErrExceptionPtr;
+
+
+// Try & Catch macros
+#define ErrTry \
+ { \
+ ErrExceptionType _TryObject; \
+ _TryObject.err = 0; \
+ _TryObject.nextP = (ErrExceptionPtr)*ErrExceptionList(); \
+ *ErrExceptionList() = (MemPtr)&_TryObject; \
+ if (ErrSetJump(_TryObject.state) == 0) {
+
+
+// NOTE: All variables referenced in and after the ErrCatch must
+// be declared volatile. Here's how for variables and pointers:
+// volatile UInt16 oldMode;
+// ShlDBHdrTablePtr volatile hdrTabP = nil;
+// If you have many local variables after the ErrCatch you may
+// opt to put the ErrTry and ErrCatch in a separate enclosing function.
+#define ErrCatch(theErr) \
+ *ErrExceptionList() = (MemPtr)_TryObject.nextP; \
+ } \
+ else { \
+ Int32 theErr = _TryObject.err; \
+ *ErrExceptionList() = (MemPtr)_TryObject.nextP;
+
+
+#define ErrEndCatch \
+ } \
+ }
+
+
+
+/********************************************************************
+ * Error Manager Routines
+ ********************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if EMULATION_LEVEL != EMULATION_NONE
+ #define ErrSetJump(buf) setjmp(buf)
+ #define ErrLongJump(buf,res) longjmp(buf,res)
+
+#else
+ Int16 ErrSetJump(ErrJumpBuf buf)
+ SYS_TRAP(sysTrapErrSetJump);
+
+ void ErrLongJump(ErrJumpBuf buf, Int16 result)
+ SYS_TRAP(sysTrapErrLongJump);
+#endif
+
+MemPtr* ErrExceptionList(void)
+ SYS_TRAP(sysTrapErrExceptionList);
+
+void ErrThrow(Int32 err)
+ SYS_TRAP(sysTrapErrThrow);
+
+void ErrDisplayFileLineMsg(const Char * const filename, UInt16 lineNo,
+ const Char * const msg)
+ SYS_TRAP(sysTrapErrDisplayFileLineMsg);
+
+
+//---------------------------------------------------------------------
+// 2/25/98 - New routine for PalmOS >3.0 to display a UI alert for
+// run-time errors. This is most likely to be used by network applications
+// that are likely to encounter run-time errors like can't find the server,
+// network down, etc. etc.
+//
+// This routine will lookup the text associated with 'errCode' and display
+// it in an alert. If errMsgP is not NULL, then that text will be used
+// instead of the associated 'errCode' text. If 'preMsgP' or 'postMsgP'
+// is not null, then that text will be pre-pended or post-pended
+// respectively.
+//
+// Apps that don't use the extra parameters may want to just use the
+// macro below 'ErrAlert'
+//---------------------------------------------------------------------
+UInt16 ErrAlertCustom(Err errCode, Char *errMsgP, Char *preMsgP,
+ Char * postMsgP)
+ SYS_TRAP(sysTrapErrAlertCustom);
+
+#define ErrAlert(err) ErrAlertCustom(err, 0, 0, 0)
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+#endif // __ERRORBASE_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/FeatureMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/FeatureMgr.h
new file mode 100644
index 0000000..ff9b2e5
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/FeatureMgr.h
@@ -0,0 +1,89 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: FeatureMgr.h
+ *
+ * Description:
+ * Header for the Feature Manager
+ *
+ * History:
+ * 11/14/94 RM - Created by Ron Marianetti
+ *
+ *****************************************************************************/
+
+#ifndef __FEATUREMGR_H__
+#define __FEATUREMGR_H__
+
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+#include <ErrorBase.h>
+
+
+
+/************************************************************
+ * Feature manager error codes
+ * the constant ftrErrorClass is defined in ErrorBase.h
+ *************************************************************/
+#define ftrErrInvalidParam (ftrErrorClass | 1)
+#define ftrErrNoSuchFeature (ftrErrorClass | 2)
+#define ftrErrAlreadyExists (ftrErrorClass | 3)
+#define ftrErrROMBased (ftrErrorClass | 4)
+#define ftrErrInternalErr (ftrErrorClass | 5)
+
+
+/************************************************************
+ * Feature Manager procedures
+ *************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+// Init the feature Manager
+Err FtrInit(void)
+ SYS_TRAP(sysTrapFtrInit);
+
+
+// Get a feature
+Err FtrGet(UInt32 creator, UInt16 featureNum, UInt32 *valueP)
+ SYS_TRAP(sysTrapFtrGet);
+
+// Set/Create a feature.
+Err FtrSet(UInt32 creator, UInt16 featureNum, UInt32 newValue)
+ SYS_TRAP(sysTrapFtrSet);
+
+// Unregister a feature
+Err FtrUnregister(UInt32 creator, UInt16 featureNum)
+ SYS_TRAP(sysTrapFtrUnregister);
+
+// Get a feature by index
+Err FtrGetByIndex(UInt16 index, Boolean romTable,
+ UInt32 *creatorP, UInt16 *numP, UInt32 *valueP)
+ SYS_TRAP(sysTrapFtrGetByIndex);
+
+// Get temporary space from storage heap
+Err FtrPtrNew(UInt32 creator, UInt16 featureNum, UInt32 size,
+ void **newPtrP)
+ SYS_TRAP(sysTrapFtrPtrNew);
+
+// Release temporary space to storage heap
+Err FtrPtrFree(UInt32 creator, UInt16 featureNum)
+ SYS_TRAP(sysTrapFtrPtrFree);
+
+
+// Resize block of temporary storage
+Err FtrPtrResize(UInt32 creator, UInt16 featureNum, UInt32 newSize,
+ void **newPtrP)
+ SYS_TRAP(sysTrapFtrPtrResize);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif // __FEATUREMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Font.h b/SrcShared/Palm/Platform/Incs/Core/System/Font.h
new file mode 100644
index 0000000..1312a0a
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Font.h
@@ -0,0 +1,150 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Font.h
+ *
+ * Description:
+ * This file defines font structures and routines.
+ *
+ * History:
+ * September 13, 1994 Created by Art Lamb
+ * 05/05/98 art Add structures for font mapping table.
+ * 07/03/98 kwk Added FntWidthToOffset.
+ * 10/23/98 kwk Changed fontMapTable to 0xC000 (was 0xFFFF).
+ * 10/20/99 kwk Moved private values to FontPrv.h
+ *
+ *****************************************************************************/
+
+#ifndef __FONT_H__
+#define __FONT_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+// Pixel width of tab stops in fields
+#define fntTabChrWidth 20
+
+// Width of character missing from font.
+#define fntMissingChar -1
+
+typedef struct {
+ Int8 offset;
+ Int8 width;
+} FontCharInfoType, * FontCharInfoPtr;
+
+typedef struct {
+ Int16 fontType; // font type
+ Int16 firstChar; // ASCII code of first character
+ Int16 lastChar; // ASCII code of last character
+ Int16 maxWidth; // maximum character width
+ Int16 kernMax; // negative of maximum character kern
+ Int16 nDescent; // negative of descent
+ Int16 fRectWidth; // width of font rectangle
+ Int16 fRectHeight; // height of font rectangle
+ Int16 owTLoc; // offset to offset/width table
+ Int16 ascent; // ascent
+ Int16 descent; // descent
+ Int16 leading; // leading
+ Int16 rowWords; // row width of bit image / 2
+} FontType;
+
+typedef FontType *FontPtr;
+
+typedef FontPtr *FontTablePtr;
+
+enum fontID {
+ stdFont = 0x00, // Small font used for the user's writing. Shows a good amount
+ boldFont, // Small font. Bold for easier reading. Used often for ui.
+ largeFont, // Larger font for easier reading. Shows a lot less.
+ symbolFont, // Various ui images like check boxes and arrows
+ symbol11Font, // Larger various ui images
+ symbol7Font, // Smaller various ui images
+ ledFont, // Calculator specific font
+ largeBoldFont, // A thicker version of the large font. More readable.
+ fntAppFontCustomBase = 0x80 // First available application-defined font ID
+};
+
+typedef enum fontID FontID;
+
+#define checkboxFont symbol11Font
+
+#define FntIsAppDefined(fnt) (fnt >= fntAppFontCustomBase)
+
+
+
+//--------------------------------------------------------------------
+//
+// Font Function
+//
+//--------------------------------------------------------------------
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+FontID FntGetFont (void)
+ SYS_TRAP(sysTrapFntGetFont);
+
+FontID FntSetFont (FontID font)
+ SYS_TRAP(sysTrapFntSetFont);
+
+FontPtr FntGetFontPtr (void)
+ SYS_TRAP(sysTrapFntGetFontPtr);
+
+Int16 FntBaseLine (void)
+ SYS_TRAP(sysTrapFntBaseLine);
+
+Int16 FntCharHeight (void)
+ SYS_TRAP(sysTrapFntCharHeight);
+
+Int16 FntLineHeight (void)
+ SYS_TRAP(sysTrapFntLineHeight);
+
+Int16 FntAverageCharWidth (void)
+ SYS_TRAP(sysTrapFntAverageCharWidth);
+
+Int16 FntCharWidth (Char ch)
+ SYS_TRAP(sysTrapFntCharWidth);
+
+Int16 FntCharsWidth (Char const *chars, Int16 len)
+ SYS_TRAP(sysTrapFntCharsWidth);
+
+Int16 FntWidthToOffset (Char const *pChars, UInt16 length,
+ Int16 pixelWidth, Boolean *leadingEdge, Int16 *truncWidth)
+ SYS_TRAP(sysTrapFntWidthToOffset);
+
+void FntCharsInWidth (Char const *string,
+ Int16 *stringWidthP, Int16 *stringLengthP,
+ Boolean *fitWithinWidth)
+ SYS_TRAP(sysTrapFntCharsInWidth);
+
+Int16 FntDescenderHeight (void)
+ SYS_TRAP(sysTrapFntDescenderHeight);
+
+Int16 FntLineWidth (Char const *pChars, UInt16 length)
+ SYS_TRAP(sysTrapFntLineWidth);
+
+UInt16 FntWordWrap (Char const *chars, UInt16 maxWidth)
+ SYS_TRAP(sysTrapFntWordWrap);
+
+void FntWordWrapReverseNLines (Char const *const chars,
+ UInt16 maxWidth, UInt16 *linesToScrollP, UInt16 *scrollPosP)
+ SYS_TRAP(sysTrapFntWordWrapReverseNLines);
+
+void FntGetScrollValues (Char const *chars, UInt16 width,
+ UInt16 scrollPos, UInt16 *linesP, UInt16 *topLine)
+ SYS_TRAP(sysTrapFntGetScrollValues);
+
+Err FntDefineFont (FontID font, FontPtr fontP)
+ SYS_TRAP(sysTrapFntDefineFont);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif // __FONT_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/IntlMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/IntlMgr.h
new file mode 100644
index 0000000..0adaf43
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/IntlMgr.h
@@ -0,0 +1,113 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: IntlMgr.h
+ *
+ * Description:
+ * This file defines public Int'l Mgr structures and routines.
+ *
+ * History:
+ * 03/21/98 kwk Created by Ken Krugler.
+ * 10/14/98 kwk Added intlIntlGetRoutineAddress selector and
+ * IntlGetRoutineAddress routine declaration.
+ * 08/05/99 kwk Added intlIntlHandleEvent selector and the
+ * IntlHandleEvent routine declaration.
+ * 09/22/99 kwk Added intlTxtParamString selector.
+ * 10/20/99 kwk Moved private stuff to IntlPrv.h
+ *
+ *****************************************************************************/
+
+#ifndef __INTLMGR_H__
+#define __INTLMGR_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+// If nobody has explicitly specified that we should or should not
+// use our international trap dispatcher, set it based on the emulation
+// level.
+
+#ifndef USE_INTL_TRAPS
+ #if EMULATION_LEVEL == EMULATION_NONE
+ #define USE_INTL_TRAPS 1
+ #else
+ #define USE_INTL_TRAPS 0
+ #endif
+#endif
+
+/***********************************************************************
+ * Public constants
+ ***********************************************************************/
+
+// Bits set for the Intl Mgr feature.
+
+#define intlMgrExists 0x00000001
+
+// International Manager trap macros.
+
+#if USE_INTL_TRAPS
+ #define INTL_TRAP(sel) \
+ _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapIntlDispatch, sel)
+#else
+ #define INTL_TRAP(intlSelectorNum)
+#endif
+
+// Selectors for routines found in the international manager. The order
+// of these selectors MUST match the jump table in IntlDispatch.c.
+
+#define intlIntlInit 0
+#define intlTxtByteAttr 1
+#define intlTxtCharAttr 2
+#define intlTxtCharXAttr 3
+#define intlTxtCharSize 4
+#define intlTxtGetPreviousChar 5
+#define intlTxtGetNextChar 6
+#define intlTxtGetChar 7
+#define intlTxtSetNextChar 8
+#define intlTxtCharBounds 9
+#define intlTxtPrepFindString 10
+#define intlTxtFindString 11
+#define intlTxtReplaceStr 12
+#define intlTxtWordBounds 13
+#define intlTxtCharEncoding 14
+#define intlTxtStrEncoding 15
+#define intlTxtEncodingName 16
+#define intlTxtMaxEncoding 17
+#define intlTxtTransliterate 18
+#define intlTxtCharIsValid 19
+#define intlTxtCompare 20
+#define intlTxtCaselessCompare 21
+#define intlTxtCharWidth 22
+#define intlTxtGetTruncationOffset 23
+#define intlIntlGetRoutineAddress 24
+#define intlIntlHandleEvent 25 // New for Palm OS 3.5
+#define intlTxtParamString 26
+#define intlTxtConvertEncodingV35 27 // Patched for Palm OS 3.5.2
+#define intlTxtConvertEncoding 28 // New for Palm OS 4.0
+#define intlIntlSetRoutineAddress 29
+#define intlTxtGetWordWrapOffset 30
+#define intlTxtNameToEncoding 31
+#define intlIntlStrictChecks 32
+
+/***********************************************************************
+ * Public routines
+ ***********************************************************************/
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+// Return back the address of the routine indicated by <inSelector>. If
+// <inSelector> isn't a valid routine selector, return back NULL.
+void *IntlGetRoutineAddress(IntlSelector inSelector)
+ INTL_TRAP(intlIntlGetRoutineAddress);
+
+#ifdef __cplusplus
+ }
+#endif
+#endif
+
+#endif // __INTLMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/KeyMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/KeyMgr.h
new file mode 100644
index 0000000..5a81a6a
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/KeyMgr.h
@@ -0,0 +1,76 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: KeyMgr.h
+ *
+ * Description:
+ * Include file for Key manager
+ *
+ * History:
+ * 9/13/95 Created by Ron Marianetti
+ * 2/04/98 srj- added contrast key defines
+ * 8/23/98 SCL- Cross-merged 3.1 and 3.2
+ *
+ *****************************************************************************/
+
+#ifndef __KEYMGR_H__
+#define __KEYMGR_H__
+
+// Pilot common definitions
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+
+/********************************************************************
+ * Definition of bit field returned from KeyCurrentState
+ ********************************************************************/
+#define keyBitPower 0x0001 // Power key
+#define keyBitPageUp 0x0002 // Page-up
+#define keyBitPageDown 0x0004 // Page-down
+#define keyBitHard1 0x0008 // App #1
+#define keyBitHard2 0x0010 // App #2
+#define keyBitHard3 0x0020 // App #3
+#define keyBitHard4 0x0040 // App #4
+#define keyBitCradle 0x0080 // Button on cradle
+#define keyBitAntenna 0x0100 // Antenna "key" <chg 3-31-98 RM>
+#define keyBitContrast 0x0200 // Contrast key
+
+#define keyBitsAll 0xFFFFFFFF // all keys
+
+
+#define slowestKeyDelayRate 0xff
+#define slowestKeyPeriodRate 0xff
+
+
+/********************************************************************
+ * Key manager Routines
+ ********************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Set/Get the auto-key repeat rate
+Err KeyRates(Boolean set, UInt16 *initDelayP, UInt16 *periodP,
+ UInt16 *doubleTapDelayP, Boolean *queueAheadP)
+ SYS_TRAP(sysTrapKeyRates);
+
+// Get the current state of the hardware keys
+// This is now updated every tick, even when more than 1 key is held down.
+UInt32 KeyCurrentState(void)
+ SYS_TRAP(sysTrapKeyCurrentState);
+
+// Set the state of the hardware key mask which controls if the key
+// generates a keyDownEvent
+UInt32 KeySetMask(UInt32 keyMask)
+ SYS_TRAP(sysTrapKeySetMask);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif //__KEYMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/LocaleMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/LocaleMgr.h
new file mode 100644
index 0000000..0351640
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/LocaleMgr.h
@@ -0,0 +1,230 @@
+/******************************************************************************
+ *
+ * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: LocaleMgr.h
+ *
+ * Release:
+ *
+ * Description:
+ * Public header for routines that support locales (information specific
+ * to locales and regions).
+ *
+ * History:
+ * 04/28/00 CS Created by Chris Schneider.
+ * 05/16/00 CS LmCountryType/LmLanguageType are now back to
+ * CountryType/LanguageType.
+ * 05/31/00 CS Moved country and language codes to new Locale.h and removed
+ * kLanguageFirst, etc.
+ * 06/06/00 kwk Made _LmLocaleType's language & country fields be UInt16's,
+ * so that it's binary compatible with OmLocaleType.
+ * 07/28/00 CS Replaced lmChoiceMinutesWestOfGMT & lmChoiceDaylightSavings
+ * selectors with lmChoiceTimeZone.
+ * 08/08/00 CS Renamed LmGetLocaleSetting's <iMaxSize> parameter <iValueSize>
+ * to reflect the fact that the routine now checks to make sure
+ * that <oValue> is the correct size for all fixed-size settings.
+ * 09/29/00 CS Made iLocale parm of LmLocaleToIndex const.
+ * 11/17/00 CS Removed support for lmChoiceLanguage & lmChoiceCountry,
+ * since these guys were returning UInt8's, which probably
+ * won't cut it at some point in the future. Callers can use
+ * lmChoiceLocale, which returns an LmLocaleType struct that
+ * places the country and language into UInt16 fields.
+ * CS Defined lmAnyCountry & lmAnyLanguage, which can now be passed
+ * in LmLocaleToIndex's iLocale parameter (as wildcards).
+ *
+ *****************************************************************************/
+
+#ifndef __LOCALEMGR_H__
+#define __LOCALEMGR_H__
+
+/* Supporting lmChoiceLanguageName would add over 3K to the 'locs' resource.
+ DOLATER CS - either do it or punt.
+*/
+#define SUPPORT_LANGUAGE_NAME 0
+
+#include <CoreTraps.h>
+
+/***********************************************************************
+ * Locale Manager errors
+ **********************************************************************/
+
+/* Locale not found in 'locs' resource.
+*/
+#define lmErrUnknownLocale (lmErrorClass | 1)
+
+/* Locale index >= LmGetNumLocales().
+*/
+#define lmErrBadLocaleIndex (lmErrorClass | 2)
+
+/* LmLocaleSettingChoice out of bounds.
+*/
+#define lmErrBadLocaleSettingChoice (lmErrorClass | 3)
+
+/* Data for locale setting too big for destination.
+*/
+#define lmErrSettingDataOverflow (lmErrorClass | 4)
+
+/***********************************************************************
+ * Locale Manager settings (pass to LmGetLocaleSetting)
+ **********************************************************************/
+
+typedef UInt16 LmLocaleSettingChoice;
+
+/* LmLocaleType
+*/
+#define lmChoiceLocale ((LmLocaleSettingChoice)1)
+
+/* Char[kMaxLanguageNameLen+1] - Name of the language spoken there (localized)
+*/
+#if SUPPORT_LANGUAGE_NAME
+ #define lmChoiceLanguageName ((LmLocaleSettingChoice)4)
+#else
+ #define lmChoiceLanguageName #error lmChoiceLanguageName not supported
+#endif
+
+/* Char[kMaxCountryNameLen+1] - Name of the country (localized)
+*/
+#define lmChoiceCountryName ((LmLocaleSettingChoice)5)
+
+/* DateFormatType
+*/
+#define lmChoiceDateFormat ((LmLocaleSettingChoice)6)
+
+/* DateFormatType
+*/
+#define lmChoiceLongDateFormat ((LmLocaleSettingChoice)7)
+
+/* TimeFormatType
+*/
+#define lmChoiceTimeFormat ((LmLocaleSettingChoice)8)
+
+/* UInt16 - Weekday for calendar column 1 (sunday=0, monday=1, etc.)
+*/
+#define lmChoiceWeekStartDay ((LmLocaleSettingChoice)9)
+
+/* Int16 - Default GMT offset minutes, + for east of GMT, - for west
+*/
+#define lmChoiceTimeZone ((LmLocaleSettingChoice)10)
+
+/* NumberFormatType - Specifies decimal and thousands separator characters
+*/
+#define lmChoiceNumberFormat ((LmLocaleSettingChoice)11)
+
+/* Char[kMaxCurrencyNameLen+1] - Name of local currency (e.g., "US Dollar")
+*/
+#define lmChoiceCurrencyName ((LmLocaleSettingChoice)12)
+
+/* Char[kMaxCurrencySymbolLen+1] - Currency symbol (e.g., "$")
+*/
+#define lmChoiceCurrencySymbol ((LmLocaleSettingChoice)13)
+
+/* Char[kMaxCurrencySymbolLen+1] - Unique currency symbol (e.g., "US$")
+*/
+#define lmChoiceUniqueCurrencySymbol ((LmLocaleSettingChoice)14)
+
+/* UInt16 - Number of decimals for currency (e.g., 2 for $10.12)
+*/
+#define lmChoiceCurrencyDecimalPlaces ((LmLocaleSettingChoice)15)
+
+/* MeasurementSystemType - Metric, English, etc.
+*/
+#define lmChoiceMeasurementSystem ((LmLocaleSettingChoice)16)
+
+/***********************************************************************
+ * Locale Manager constants
+ **********************************************************************/
+#define lmAnyCountry 65535U // Pass LmLocaleToIndex's iLocale
+#define lmAnyLanguage 65535U // Pass LmLocaleToIndex's iLocale
+
+#define kMaxCountryNameLen 19
+#if SUPPORT_LANGUAGE_NAME
+ #define kMaxLanguageNameLen 19
+#endif
+#define kMaxCurrencyNameLen 19
+#define kMaxCurrencySymbolLen 5
+
+/***********************************************************************
+ * Selectors & macros used for calling Locale Manager routines
+ **********************************************************************/
+
+#ifndef DIRECT_LOCALE_CALLS
+ #define DIRECT_LOCALE_CALLS 0
+#endif
+#if DIRECT_LOCALE_CALLS
+ #define LMDISPATCH_TRAP(routineSelector)
+#else
+ #define LMDISPATCH_TRAP(routineSelector) \
+ _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, \
+ sysTrapLmDispatch, \
+ routineSelector)
+#endif
+
+/* Selectors used for getting to the right Locale Manager routine via
+the LmDispatch trap. */
+
+// DOLATER:jwm: remove me after fixing LocaleMgr.c:PrvSelectorError
+typedef UInt16 LmRoutineSelector;
+#define lmInit 0
+#define lmGetNumLocales 1
+#define lmLocaleToIndex 2
+#define lmGetLocaleSetting 3
+
+#define lmMaxRoutineSelector lmGetLocaleSetting
+
+/***********************************************************************
+ * Locale Manager types
+ **********************************************************************/
+
+typedef UInt8 LanguageType;
+typedef UInt8 CountryType;
+
+typedef struct _LmLocaleType LmLocaleType;
+struct _LmLocaleType
+{
+ UInt16 language; // Language spoken in locale (LanguageType)
+ UInt16 country; // Specifies "dialect" of language (CountryType)
+};
+
+/***********************************************************************
+ * Locale Manager routines
+ **********************************************************************/
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Return the number of known locales (maximum locale index + 1).
+*/
+UInt16
+LmGetNumLocales(void)
+ LMDISPATCH_TRAP(lmGetNumLocales);
+
+/* Convert <iLocale> to <oLocaleIndex> by locating it within the set of known
+locales.
+*/
+Err
+LmLocaleToIndex( const
+ LmLocaleType* iLocale,
+ UInt16* oLocaleIndex)
+ LMDISPATCH_TRAP(lmLocaleToIndex);
+
+/* Return in <oValue> the setting identified by <iChoice> which is appropriate for
+the locale identified by <iLocaleIndex>. Return lmErrSettingDataOverflow if the
+data for <iChoice> occupies more than <iValueSize> bytes. Display a non-fatal
+error if <iValueSize> is larger than the data for a fixed-size setting.
+*/
+Err
+LmGetLocaleSetting( UInt16 iLocaleIndex,
+ LmLocaleSettingChoice iChoice,
+ void* oValue,
+ UInt16 iValueSize)
+ LMDISPATCH_TRAP(lmGetLocaleSetting);
+
+#ifdef __cplusplus
+ }
+#endif
+#endif
+
+#endif
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Localize.h b/SrcShared/Palm/Platform/Incs/Core/System/Localize.h
new file mode 100644
index 0000000..6bf9e92
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Localize.h
@@ -0,0 +1,54 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Localize.h
+ *
+ * Description:
+ * Functions to localize data.
+ *
+ * History:
+ * 8/28/96 Roger - Initial version
+ *
+ *****************************************************************************/
+
+#ifndef __LOCALIZE_H__
+#define __LOCALIZE_H__
+
+
+// Include elementary types
+#include <PalmTypes.h> // Basic types
+#include <CoreTraps.h> // Trap Numbers.
+
+// The number format (thousands separator and decimal point). This defines
+// how numbers are formatted and not neccessarily currency numbers (i.e. Switzerland).
+typedef enum {
+ nfCommaPeriod,
+ nfPeriodComma,
+ nfSpaceComma,
+ nfApostrophePeriod,
+ nfApostropheComma
+ } NumberFormatType;
+
+
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void LocGetNumberSeparators(NumberFormatType numberFormat,
+ Char *thousandSeparator, Char *decimalSeparator)
+ SYS_TRAP(sysTrapLocGetNumberSeparators);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif // __LOCALIZE_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/MemoryMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/MemoryMgr.h
new file mode 100644
index 0000000..c0b7f6d
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/MemoryMgr.h
@@ -0,0 +1,341 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: MemoryMgr.h
+ *
+ * Description:
+ * Include file for Memory Manager
+ *
+ * History:
+ * 10/25/94 RM Created by Ron Marianetti
+ * 10/28/99 kwk Added memErrROMOnlyCard.
+ *
+ *****************************************************************************/
+
+#ifndef __MEMORYMGR_H__
+#define __MEMORYMGR_H__
+
+
+// Include elementary types
+#include <PalmTypes.h> // Basic types
+#include <CoreTraps.h> // Trap Numbers.
+#include <ErrorBase.h>
+
+
+/************************************************************
+ * Memory Manager Types
+ *************************************************************/
+typedef enum { memIDPtr, memIDHandle } LocalIDKind;
+
+
+/************************************************************
+ * Flags accepted as parameter for MemNewChunk.
+ *************************************************************/
+#define memNewChunkFlagPreLock 0x0100
+#define memNewChunkFlagNonMovable 0x0200
+#define memNewChunkFlagAtStart 0x0400 // force allocation at front of heap
+#define memNewChunkFlagAtEnd 0x0800 // force allocation at end of heap
+
+
+/************************************************************
+ * Memory Manager Debug settings for the MemSetDebugMode function
+ *************************************************************/
+#define memDebugModeCheckOnChange 0x0001
+#define memDebugModeCheckOnAll 0x0002
+#define memDebugModeScrambleOnChange 0x0004
+#define memDebugModeScrambleOnAll 0x0008
+#define memDebugModeFillFree 0x0010
+#define memDebugModeAllHeaps 0x0020
+#define memDebugModeRecordMinDynHeapFree 0x0040
+
+
+
+
+/************************************************************
+ * Memory Manager result codes
+ *************************************************************/
+#define memErrChunkLocked (memErrorClass | 1)
+#define memErrNotEnoughSpace (memErrorClass | 2)
+#define memErrInvalidParam (memErrorClass | 3) /* invalid param or requested size is too big */
+#define memErrChunkNotLocked (memErrorClass | 4)
+#define memErrCardNotPresent (memErrorClass | 5)
+#define memErrNoCardHeader (memErrorClass | 6)
+#define memErrInvalidStoreHeader (memErrorClass | 7)
+#define memErrRAMOnlyCard (memErrorClass | 8)
+#define memErrWriteProtect (memErrorClass | 9)
+#define memErrNoRAMOnCard (memErrorClass | 10)
+#define memErrNoStore (memErrorClass | 11)
+#define memErrROMOnlyCard (memErrorClass | 12)
+
+
+/********************************************************************
+ * Memory Manager Routines
+ * These are define as external calls only under emulation mode or
+ * under native mode from the module that actually installs the trap
+ * vectors
+ ********************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//-------------------------------------------------------------------
+// Initialization
+//-------------------------------------------------------------------
+Err MemInit(void)
+ SYS_TRAP(sysTrapMemInit);
+
+Err MemKernelInit(void)
+ SYS_TRAP(sysTrapMemKernelInit);
+
+Err MemInitHeapTable(UInt16 cardNo)
+ SYS_TRAP(sysTrapMemInitHeapTable);
+
+//-------------------------------------------------------------------
+// Card formatting and Info
+//-------------------------------------------------------------------
+UInt16 MemNumCards(void)
+ SYS_TRAP(sysTrapMemNumCards);
+
+Err MemCardFormat(UInt16 cardNo, Char *cardNameP,
+ Char *manufNameP, Char *ramStoreNameP)
+ SYS_TRAP(sysTrapMemCardFormat);
+
+Err MemCardInfo(UInt16 cardNo,
+ Char *cardNameP, Char *manufNameP,
+ UInt16 *versionP, UInt32 *crDateP,
+ UInt32 *romSizeP, UInt32 *ramSizeP,
+ UInt32 *freeBytesP)
+ SYS_TRAP(sysTrapMemCardInfo);
+
+
+//-------------------------------------------------------------------
+// Store Info
+//-------------------------------------------------------------------
+Err MemStoreInfo(UInt16 cardNo, UInt16 storeNumber,
+ UInt16 *versionP, UInt16 *flagsP, Char *nameP,
+ UInt32 * crDateP, UInt32 *bckUpDateP,
+ UInt32 * heapListOffsetP, UInt32 *initCodeOffset1P,
+ UInt32 *initCodeOffset2P, LocalID* databaseDirIDP)
+ SYS_TRAP(sysTrapMemStoreInfo);
+
+Err MemStoreSetInfo(UInt16 cardNo, UInt16 storeNumber,
+ UInt16 *versionP, UInt16 *flagsP, Char *nameP,
+ UInt32 *crDateP, UInt32 *bckUpDateP,
+ UInt32 *heapListOffsetP, UInt32 *initCodeOffset1P,
+ UInt32 *initCodeOffset2P, LocalID* databaseDirIDP)
+ SYS_TRAP(sysTrapMemStoreSetInfo);
+
+
+//-------------------------------------------------------------------
+// Heap Info & Utilities
+//-------------------------------------------------------------------
+UInt16 MemNumHeaps(UInt16 cardNo)
+ SYS_TRAP(sysTrapMemNumHeaps);
+
+UInt16 MemNumRAMHeaps(UInt16 cardNo)
+ SYS_TRAP(sysTrapMemNumRAMHeaps);
+
+UInt16 MemHeapID(UInt16 cardNo, UInt16 heapIndex)
+ SYS_TRAP(sysTrapMemHeapID);
+
+Boolean MemHeapDynamic(UInt16 heapID)
+ SYS_TRAP(sysTrapMemHeapDynamic);
+
+Err MemHeapFreeBytes(UInt16 heapID, UInt32 *freeP, UInt32 *maxP)
+ SYS_TRAP(sysTrapMemHeapFreeBytes);
+
+UInt32 MemHeapSize(UInt16 heapID)
+ SYS_TRAP(sysTrapMemHeapSize);
+
+UInt16 MemHeapFlags(UInt16 heapID)
+ SYS_TRAP(sysTrapMemHeapFlags);
+
+
+// Heap utilities
+Err MemHeapCompact(UInt16 heapID)
+ SYS_TRAP(sysTrapMemHeapCompact);
+
+Err MemHeapInit(UInt16 heapID, Int16 numHandles, Boolean initContents)
+ SYS_TRAP(sysTrapMemHeapInit);
+
+Err MemHeapFreeByOwnerID(UInt16 heapID, UInt16 ownerID)
+ SYS_TRAP(sysTrapMemHeapFreeByOwnerID);
+
+
+//-------------------------------------------------------------------
+// Low Level Allocation
+//-------------------------------------------------------------------
+MemPtr MemChunkNew(UInt16 heapID, UInt32 size, UInt16 attr)
+ SYS_TRAP(sysTrapMemChunkNew);
+
+Err MemChunkFree(MemPtr chunkDataP)
+ SYS_TRAP(sysTrapMemChunkFree);
+
+
+
+//-------------------------------------------------------------------
+// Pointer (Non-Movable) based Chunk Routines
+//-------------------------------------------------------------------
+MemPtr MemPtrNew(UInt32 size)
+ SYS_TRAP(sysTrapMemPtrNew);
+
+#define MemPtrFree( p) \
+ MemChunkFree(p)
+
+// Getting Attributes
+MemHandle MemPtrRecoverHandle(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrRecoverHandle);
+
+UInt16 MemPtrFlags(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrFlags);
+
+UInt32 MemPtrSize(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrSize);
+
+UInt16 MemPtrOwner(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrOwner);
+
+UInt16 MemPtrHeapID(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrHeapID);
+
+Boolean MemPtrDataStorage(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrDataStorage);
+
+UInt16 MemPtrCardNo(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrCardNo);
+
+LocalID MemPtrToLocalID(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrToLocalID);
+
+// Setting Attributes
+Err MemPtrSetOwner(MemPtr p, UInt16 owner)
+ SYS_TRAP(sysTrapMemPtrSetOwner);
+
+Err MemPtrResize(MemPtr p, UInt32 newSize)
+ SYS_TRAP(sysTrapMemPtrResize);
+
+Err MemPtrResetLock(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrResetLock);
+
+Err MemPtrUnlock(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrUnlock);
+
+
+//-------------------------------------------------------------------
+// MemHandle (Movable) based Chunk Routines
+//-------------------------------------------------------------------
+MemHandle MemHandleNew(UInt32 size)
+ SYS_TRAP(sysTrapMemHandleNew);
+
+Err MemHandleFree(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleFree);
+
+// Getting Attributes
+UInt16 MemHandleFlags(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleFlags);
+
+UInt32 MemHandleSize(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleSize);
+
+UInt16 MemHandleOwner(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleOwner);
+
+UInt16 MemHandleLockCount(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleLockCount);
+
+UInt16 MemHandleHeapID(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleHeapID);
+
+Boolean MemHandleDataStorage(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleDataStorage);
+
+UInt16 MemHandleCardNo(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleCardNo);
+
+LocalID MemHandleToLocalID(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleToLocalID);
+
+
+// Setting Attributes
+Err MemHandleSetOwner( MemHandle h, UInt16 owner)
+ SYS_TRAP(sysTrapMemHandleSetOwner);
+
+Err MemHandleResize(MemHandle h, UInt32 newSize)
+ SYS_TRAP(sysTrapMemHandleResize);
+
+MemPtr MemHandleLock(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleLock);
+
+Err MemHandleUnlock(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleUnlock);
+
+Err MemHandleResetLock(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleResetLock);
+
+
+
+
+//-------------------------------------------------------------------
+// Local ID based routines
+//-------------------------------------------------------------------
+MemPtr MemLocalIDToGlobal(LocalID local, UInt16 cardNo)
+ SYS_TRAP(sysTrapMemLocalIDToGlobal);
+
+LocalIDKind MemLocalIDKind(LocalID local)
+ SYS_TRAP(sysTrapMemLocalIDKind);
+
+MemPtr MemLocalIDToPtr(LocalID local, UInt16 cardNo)
+ SYS_TRAP(sysTrapMemLocalIDToPtr);
+
+MemPtr MemLocalIDToLockedPtr(LocalID local, UInt16 cardNo)
+ SYS_TRAP(sysTrapMemLocalIDToLockedPtr);
+
+
+//-------------------------------------------------------------------
+// Utilities
+//-------------------------------------------------------------------
+Err MemMove(void *dstP, const void *sP, Int32 numBytes)
+ SYS_TRAP(sysTrapMemMove);
+
+Err MemSet(void *dstP, Int32 numBytes, UInt8 value)
+ SYS_TRAP(sysTrapMemSet);
+
+Int16 MemCmp (const void *s1, const void *s2, Int32 numBytes)
+ SYS_TRAP(sysTrapMemCmp);
+
+Err MemSemaphoreReserve(Boolean writeAccess)
+ SYS_TRAP(sysTrapMemSemaphoreReserve);
+
+Err MemSemaphoreRelease(Boolean writeAccess)
+ SYS_TRAP(sysTrapMemSemaphoreRelease);
+
+//-------------------------------------------------------------------
+// Debugging Support
+//-------------------------------------------------------------------
+UInt16 MemDebugMode(void)
+ SYS_TRAP(sysTrapMemDebugMode);
+
+Err MemSetDebugMode(UInt16 flags)
+ SYS_TRAP(sysTrapMemSetDebugMode);
+
+Err MemHeapScramble(UInt16 heapID)
+ SYS_TRAP(sysTrapMemHeapScramble);
+
+Err MemHeapCheck(UInt16 heapID)
+ SYS_TRAP(sysTrapMemHeapCheck);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+
+#endif // __MEMORYMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/NetBitUtils.h b/SrcShared/Palm/Platform/Incs/Core/System/NetBitUtils.h
new file mode 100644
index 0000000..9eb9f15
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/NetBitUtils.h
@@ -0,0 +1,135 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1997-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: NetBitUtils.h
+ *
+ * Description:
+ * Header file for bit manipulation routines used primarily
+ * by wireless network protocols.
+ *
+ * These routines live in the NetLib but are broken out here into
+ * a separate header so that they can be more easily used by source
+ * files that don't need access to the other NetLib functions.
+ *
+ * History:
+ * 6/11/97 Created by Ron Marianetti
+ * Name Date Description
+ * ---- ---- -----------
+ * vmk 8/25/98 Defined bitVarIntMaxBits and bitVarIntMaxBytes
+ *
+ *****************************************************************************/
+
+#ifndef __NETBITUTILS_H__
+#define __NETBITUTILS_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+#include <NetMgr.h>
+
+// # of bits in a byte
+#define bitsInByte 8
+
+
+// Maximum size of variable-size ints in # of bits and bytes. This is based on
+// the largest variable size int, which is encoded as follows: 1111 Bit[32]
+#define bitVarIntMaxBits 36
+#define bitVarIntMaxBytes ((bitVarIntMaxBits + bitsInByte - 1) / bitsInByte)
+
+
+//=====================================================
+// BitXXX Macros
+//
+// The following macros are handy because they don't require that
+// the source code pass in the NetLib library refnum to every
+// call.
+//
+// When building server code or other emulation code where th
+// library trap dispatcher is not used, the libRefNUm is unused
+// and can be 0.
+//
+// When building for the viewer, the libRefNum must be the refNum
+// of the NetLib. For applications, this libRefNum must be put
+// into an application global named 'AppNetRefnum'.
+//
+//====================================================
+#if USE_TRAPS == 0
+ #define netPrvRefnum 0
+#else
+ #define netPrvRefnum AppNetRefnum
+#endif
+
+
+#define BitMove( dstP, dstBitOffsetP, srcP, srcBitOffsetP, numBits) \
+ NetLibBitMove(netPrvRefnum, dstP, dstBitOffsetP, srcP, srcBitOffsetP, numBits)
+
+#define BitPutFixed( dstP, dstBitOffsetP, value, numBits) \
+ NetLibBitPutFixed(netPrvRefnum, dstP, dstBitOffsetP, value, numBits)
+
+#define BitGetFixed(srcP, srcBitOffsetP, numBits) \
+ NetLibBitGetFixed(netPrvRefnum, srcP, srcBitOffsetP, numBits)
+
+#define BitPutUIntV(dstP, dstBitOffsetP, value) \
+ NetLibBitPutUIntV(netPrvRefnum, dstP, dstBitOffsetP, value)
+
+#define BitGetUIntV(srcP, srcBitOffsetP) \
+ NetLibBitGetUIntV(netPrvRefnum, srcP, srcBitOffsetP)
+
+#define BitPutIntV(dstP, dstBitOffsetP, value) \
+ NetLibBitPutIntV(netPrvRefnum, dstP, dstBitOffsetP, value)
+
+#define BitGetIntV(srcP, srcBitOffsetP) \
+ NetLibBitGetIntV(netPrvRefnum, srcP, srcBitOffsetP)
+
+
+
+
+//=====================================================
+// Functions
+//====================================================
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//--------------------------------------------------
+// Bit Moving functions. For "slim" bit packing protocols
+// used over wireless.
+//--------------------------------------------------
+void NetLibBitMove(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP,
+ UInt8 *srcP, UInt32 *srcBitOffsetP,
+ UInt32 numBits)
+ SYS_TRAP(netLibTrapBitMove);
+
+
+void NetLibBitPutFixed(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP,
+ UInt32 value, UInt16 numBits)
+ SYS_TRAP(netLibTrapBitPutFixed);
+
+UInt32 NetLibBitGetFixed(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP,
+ UInt16 numBits)
+ SYS_TRAP(netLibTrapBitGetFixed);
+
+void NetLibBitPutUIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP,
+ UInt32 value)
+ SYS_TRAP(netLibTrapBitPutUIntV);
+
+UInt32 NetLibBitGetUIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP)
+ SYS_TRAP(netLibTrapBitGetUIntV);
+
+void NetLibBitPutIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP,
+ Int32 value)
+ SYS_TRAP(netLibTrapBitPutUIntV);
+
+Int32 NetLibBitGetIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP)
+ SYS_TRAP(netLibTrapBitGetUIntV);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif // __NETBITUTILS_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/NetMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/NetMgr.h
new file mode 100644
index 0000000..ba0064e
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/NetMgr.h
@@ -0,0 +1,1515 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: NetMgr.h
+ *
+ * Description:
+ * This module contains the interface definition for the TCP/IP
+ * library on Pilot.
+ *
+ * History:
+ * 2/14/96 Created by Ron Marianetti
+ * Name Date Description
+ * ---- ---- -----------
+ * jrb 3/13/98 Removed NetIFSettings that are Mobitex specific.
+ * Added RadioStateEnum for the setting.
+ * Added NetIFSettingSpecificMobitex
+ * Added what are considered "generic" wirless settings.
+ * jaq 10/1/98 added netMaxIPAddrStrLen constant
+ * scl 3/ 5/99 integrated Eleven's changes into Main
+ *
+ *****************************************************************************/
+
+#ifndef __NETMGR_H__
+#define __NETMGR_H__
+
+#include <PalmTypes.h>
+#include <LibTraps.h>
+#include <SysEvent.h>
+
+// Get rid of warnings about unused pragmas when compiling with
+// Visual C
+#ifdef _MSC_VER
+#pragma warning( disable : 4068)
+#endif
+
+/********************************************************************
+ * Type and creator of Net Library database
+ ********************************************************************/
+
+// Creator. Used for both the database that contains the Net Library and
+// it's preferences database.
+#define netCreator 'netl' // Our Net Library creator
+
+// Feature Creators and numbers, for use with the FtrGet() call. This
+// feature can be obtained to get the current version of the Net Library
+#define netFtrCreator netCreator
+#define netFtrNumVersion 0 // get version of Net Library
+ // 0xMMmfsbbb, where MM is major version, m is minor version
+ // f is bug fix, s is stage: 3-release,2-beta,1-alpha,0-development,
+ // bbb is build number for non-releases
+ // V1.12b3 would be: 0x01122003
+ // V2.00a2 would be: 0x02001002
+ // V1.01 would be: 0x01013000
+
+
+// Types. Used to identify the Net Library from it's prefs.
+#define netLibType 'libr' // Our Net Code Resources Database type
+#define netPrefsType 'rsrc' // Our Net Preferences Database type
+
+
+// All Network interface's have the following type:
+#define netIFFileType 'neti' // The filetype of all Network Interfaces
+
+// Each Network interface has a unique creator:
+#define netIFCreatorLoop 'loop' // Loopback network interface creator.
+#define netIFCreatorSLIP 'slip' // SLIP network interface creator.
+#define netIFCreatorPPP 'ppp_' // PPP network interface creator.
+//<chg 1-28-98 RM>
+#define netIFCreatorRAM 'ram_' // Mobitex network interface creator
+
+
+// Special value for configIndex parameter to NetLibOpenConfig that tells it
+// to use the current settings - even if they are not the defined default settings
+// This is provided for testing purposes
+#define netConfigIndexCurSettings 0xFFFF
+
+// <SCL 3/5/99> Commented out netMaxNetIFs since Tim says it should NOT be here!!
+// Still need to fix (Eleven) code that currently depends on it...
+// Max # of interfaces that can be installed
+//#define netMaxNetIFs 4
+
+
+//-----------------------------------------------------------------------------
+// Misc. constants
+//-----------------------------------------------------------------------------
+#define netDrvrTypeNameLen 8 // Maximum driver type length
+#define netDrvrHWNameLen 16 // Maximum driver hardware name length
+#define netIFNameLen 10 // Maximum interface name (driver type + instance num)
+#define netIFMaxHWAddrLen 14 // Maximum size of a hardware address
+#define netMaxIPAddrStrLen 16 // Max length of an IP address string with null terminator (255.255.255.255)
+
+
+
+//-----------------------------------------------------------------------------
+// Names of built-in configuration aliases available through the
+// NetLibConfigXXX calls
+//-----------------------------------------------------------------------------
+#define netCfgNameDefault ".Default" // The default configuration
+#define netCfgNameDefWireline ".DefWireline" // The default wireline configuration
+#define netCfgNameDefWireless ".DefWireless" // The default wireless configuration
+#define netCfgNameCTPWireline ".CTPWireline" // Wireline through the Jerry Proxy
+#define netCfgNameCTPWireless ".CTPWireless" // Wireless through the Jerry Proxy
+
+
+//-----------------------------------------------------------------------------
+//Flags for the NetUWirelessAppHandleEvent() utility routine
+//-----------------------------------------------------------------------------
+#define netWLAppEventFlagCTPOnly 0x00000001 // using wireless radio for CTP protocol only
+#define netWLAppEventFlagDisplayErrs 0x00000002 // Show error alerts for any errors
+
+//-----------------------------------------------------------------------------
+// Option constants that can be passed to NetSocketOptionSet and NetSocketOptionGet
+// When an option is set or retrieved, both the level of the option and the
+// option number must be specified. The level refers to which layer the option
+// refers to, like the uppermost socket layer, for example.
+//-----------------------------------------------------------------------------
+
+// Socket level options
+typedef enum {
+ // IP Level options
+ netSocketOptIPOptions = 1, // options in IP header (IP_OPTIONS)
+
+ // TCP Level options
+ netSocketOptTCPNoDelay = 1, // don't delay send to coalesce packets
+ netSocketOptTCPMaxSeg = 2, // TCP maximum segment size (TCP_MAXSEG)
+
+ // Socket level options
+ netSocketOptSockDebug = 0x0001, // turn on debugging info recording
+ netSocketOptSockAcceptConn = 0x0002, // socket has had listen
+ netSocketOptSockReuseAddr = 0x0004, // allow local address reuse
+ netSocketOptSockKeepAlive = 0x0008, // keep connections alive
+ netSocketOptSockDontRoute = 0x0010, // just use interface addresses
+ netSocketOptSockBroadcast = 0x0020, // permit sending of broadcast msgs
+ netSocketOptSockUseLoopback = 0x0040, // bypass hardware when possible
+ netSocketOptSockLinger = 0x0080, // linger on close if data present
+ netSocketOptSockOOBInLine = 0x0100, // leave received OutOfBand data in line
+
+ netSocketOptSockSndBufSize = 0x1001, // send buffer size
+ netSocketOptSockRcvBufSize = 0x1002, // receive buffer size
+ netSocketOptSockSndLowWater = 0x1003, // send low-water mark
+ netSocketOptSockRcvLowWater = 0x1004, // receive low-water mark
+ netSocketOptSockSndTimeout = 0x1005, // send timeout
+ netSocketOptSockRcvTimeout = 0x1006, // receive timeout
+ netSocketOptSockErrorStatus= 0x1007, // get error status and clear
+ netSocketOptSockSocketType = 0x1008, // get socket type
+
+ // The following are Pilot specific options
+ netSocketOptSockNonBlocking = 0x2000, // set non-blocking mode on or off
+ netSocketOptSockRequireErrClear = 0x2001, // return error from all further calls to socket
+ // unless netSocketOptSockErrorStatus is cleared.
+ netSocketOptSockMultiPktAddr = 0x2002 // for SOCK_RDM (RMP) sockets. This is the
+ // fixed IP addr (i.e. Mobitex MAN #) to use
+ // for multiple packet requests.
+ } NetSocketOptEnum;
+
+
+
+
+// Option levels for SocketOptionSet and SocketOptionGet
+typedef enum {
+ netSocketOptLevelIP = 0, // IP level options (IPPROTO_IP)
+ netSocketOptLevelTCP = 6, // TCP level options (IPPROTO_TCP)
+ netSocketOptLevelSocket = 0xFFFF // Socket level options (SOL_SOCKET)
+ } NetSocketOptLevelEnum;
+
+
+// Structure used for manipulating the linger option
+typedef struct {
+ Int16 onOff; // option on/off
+ Int16 time; // linger time in seconds
+ } NetSocketLingerType;
+
+//-----------------------------------------------------------------------------
+// Enumeration of Socket domains and types passed to NetSocketOpen
+//-----------------------------------------------------------------------------
+typedef enum {
+ netSocketAddrRaw=0, // (AF_UNSPEC, AF_RAW)
+ netSocketAddrINET=2 // (AF_INET)
+ } NetSocketAddrEnum;
+
+typedef enum {
+ netSocketTypeStream=1, // (SOCK_STREAM)
+ netSocketTypeDatagram=2, // (SOCK_DGRAM)
+ netSocketTypeRaw=3, // (SOCK_RAW)
+ netSocketTypeReliableMsg=4, // (SOCK_RDM)
+ netSocketTypeLicensee=8 // Socket entry reserved for licensees.
+ } NetSocketTypeEnum;
+
+// Protocols, passed in the protocol parameter to NetLibSocketOpen
+#define netSocketProtoIPICMP 1 // IPPROTO_ICMP
+#define netSocketProtoIPTCP 6 // IPPROTO_TCP
+#define netSocketProtoIPUDP 17 // IPPROTO_UDP
+#define netSocketProtoIPRAW 255 // IPPROTO_RAW
+
+
+//-----------------------------------------------------------------------------
+// Enumeration of Socket direction, passed to NetSocketShutdown
+//-----------------------------------------------------------------------------
+typedef enum {
+ netSocketDirInput=0,
+ netSocketDirOutput=1,
+ netSocketDirBoth=2
+ } NetSocketDirEnum;
+
+
+//-----------------------------------------------------------------------------
+// Basic Types
+//-----------------------------------------------------------------------------
+// Socket refnum
+typedef Int16 NetSocketRef;
+
+// Type used to hold internet addresses
+typedef UInt32 NetIPAddr; // a 32-bit IP address.
+
+
+
+//-----------------------------------------------------------------------------
+// Structure used to hold an internet socket address. This includes the internet
+// address and the port number. This structure directly maps to the BSD unix
+// struct sockaddr_in.
+//-----------------------------------------------------------------------------
+typedef struct NetSocketAddrINType {
+ Int16 family; // Address family in HBO (Host UInt8 Order)
+ UInt16 port; // the UDP port in NBO (Network UInt8 Order)
+ NetIPAddr addr; // IP address in NBO (Network UInt8 Order)
+ } NetSocketAddrINType;
+
+// Constant that means "use the local machine's IP address"
+#define netIPAddrLocal 0 // Can be used in NetSockAddrINType.addr
+
+
+// Structure used to hold a generic socket address. This is a generic struct
+// designed to hold any type of address including internet addresses. This
+// structure directly maps to the BSD unix struct sockaddr.
+typedef struct NetSocketAddrType {
+ Int16 family; // Address family
+ UInt8 data[14]; // 14 bytes of address
+ } NetSocketAddrType;
+
+
+// Structure used to hold a raw socket address. When using the netSocketAddrRaw
+// protocol family, the caller must bind() the socket to an interface and
+// specifies the interface using this structure. IMPORTANT: NUMEROUS
+// ROUTINES IN NETLIB RELY ON THE FACT THAT THIS STRUCTURE IS THE SAME
+// SIZE AS A NetSocketAddrINType STRUCTURE.
+typedef struct NetSocketAddrRawType {
+ Int16 family; // Address family in HBO (Host UInt8 Order)
+ UInt16 ifInstance; // the interface instance number
+ UInt32 ifCreator; // the interface creator
+ } NetSocketAddrRawType;
+
+
+
+//-----------------------------------------------------------------------------
+// Structure used to hold information about data to be sent. This structure
+// is passed to NetLibSendMsg and contains the optional address to send to,
+// a scatter-write array of data to be sent, and optional access rights
+//-----------------------------------------------------------------------------
+
+// Scatter/Gather array type. A pointer to an array of these structs is
+// passed to the NetLibSendPB and NetLibRecvPB calls. It specifies where
+// data should go to or come from as a list of buffer addresses and sizes.
+typedef struct NetIOVecType {
+ UInt8 * bufP; // buffer address
+ UInt16 bufLen; // buffer length
+ } NetIOVecType, *NetIOVecPtr;
+
+#define netIOVecMaxLen 16 // max# of NetIOVecTypes in an array
+
+// Read/Write ParamBlock type. Passed directly to the SendPB and RecvPB calls.
+typedef struct {
+ UInt8 * addrP; // address - or 0 for default
+ UInt16 addrLen; // length of address
+ NetIOVecPtr iov; // scatter/gather array
+ UInt16 iovLen; // length of above array
+ UInt8 * accessRights; // access rights
+ UInt16 accessRightsLen; // length of accessrights
+ } NetIOParamType, *NetIOParamPtr;
+
+// Flags values for the NetLibSend, NetLibReceive calls
+#define netIOFlagOutOfBand 0x01 // process out-of-band data
+#define netIOFlagPeek 0x02 // peek at incoming message
+#define netIOFlagDontRoute 0x04 // send without using routing
+
+
+
+//-----------------------------------------------------------------------------
+// Structures used for looking up a host by name or address (NetLibGetHostByName)
+//-----------------------------------------------------------------------------
+
+// Equates for DNS names, from RFC-1035
+#define netDNSMaxDomainName 255
+#define netDNSMaxDomainLabel 63
+
+#define netDNSMaxAliases 1 // max # of aliases for a host
+#define netDNSMaxAddresses 4 // max # of addresses for a host
+
+
+// The actual results of NetLibGetHostByName() are returned in this structure.
+// This structure is designed to match the "struct hostent" structure in Unix.
+typedef struct {
+ Char * nameP; // official name of host
+ Char ** nameAliasesP; // array of alias's for the name
+ UInt16 addrType; // address type of return addresses
+ UInt16 addrLen; // the length, in bytes, of the addresses
+ UInt8 ** addrListP; // array of ptrs to addresses in HBO
+ } NetHostInfoType, *NetHostInfoPtr;
+
+
+// "Buffer" passed to call as a place to store the results
+typedef struct {
+ NetHostInfoType hostInfo; // high level results of call are here
+
+ // The following fields contain the variable length data that
+ // hostInfo points to
+ Char name[netDNSMaxDomainName+1]; // hostInfo->name
+
+ Char *aliasList[netDNSMaxAliases+1]; // +1 for 0 termination.
+ Char aliases[netDNSMaxAliases][netDNSMaxDomainName+1];
+
+ NetIPAddr* addressList[netDNSMaxAddresses];
+ NetIPAddr address[netDNSMaxAddresses];
+
+ } NetHostInfoBufType, *NetHostInfoBufPtr;
+
+
+//-----------------------------------------------------------------------------
+// Structures used for looking up a service (NetLibGetServByName)
+//-----------------------------------------------------------------------------
+
+// Equates for service names
+#define netServMaxName 15 // max # characters in service name
+#define netProtoMaxName 15 // max # characters in protocol name
+#define netServMaxAliases 1 // max # of aliases for a service
+
+
+// The actual results of NetLibGetServByName() are returned in this structure.
+// This structure is designed to match the "struct servent" structure in Unix.
+typedef struct {
+ Char * nameP; // official name of service
+ Char ** nameAliasesP; // array of alias's for the name
+ UInt16 port; // port number for this service
+ Char * protoP; // name of protocol to use
+ } NetServInfoType, *NetServInfoPtr;
+
+// "Buffer" passed to call as a place to store the results
+typedef struct {
+ NetServInfoType servInfo; // high level results of call are here
+
+ // The following fields contain the variable length data that
+ // servInfo points to
+ Char name[netServMaxName+1]; // hostInfo->name
+
+ Char * aliasList[netServMaxAliases+1]; // +1 for 0 termination.
+ Char aliases[netServMaxAliases][netServMaxName];
+ Char protoName[netProtoMaxName+1];
+
+ UInt8 reserved;
+ } NetServInfoBufType, *NetServInfoBufPtr;
+
+
+
+//--------------------------------------------------------------------
+// Structure of a configuration name. Used by NetLibConfigXXX calls
+// <chg 1-28-98 RM> added for the new Config calls.
+//---------------------------------------------------------------------
+#define netConfigNameSize 32
+typedef struct {
+ Char name[netConfigNameSize]; // name of configuration
+ } NetConfigNameType, *NetConfigNamePtr;
+
+
+
+/********************************************************************
+ * Tracing Flags. These flags are ORed together and passed as a UInt32
+ * in the netSettingTraceFlags setting and netIFSettingTraceFlags to
+ * enable/disable various trace options.
+ ********************************************************************/
+#define netTracingErrors 0x00000001 // record errors
+#define netTracingMsgs 0x00000002 // record messages
+#define netTracingPktIP 0x00000004 // record packets sent/received
+ // to/from interfaces at the IP layer
+ // NOTE: netTracingPktData40 & netTracingPktData
+ // will control how much data of each packet is
+ // recorded.
+#define netTracingFuncs 0x00000008 // record function flow
+#define netTracingAppMsgs 0x00000010 // record application messages
+ // (NetLibTracePrintF, NetLibTracePutS)
+#define netTracingPktData40 0x00000020 // record first 40 bytes of packets
+ // when netTracingPktsXX is also on.
+ // NOTE: Mutually exclusive with
+ // netTracingPktData and only applicable if
+ // one of the netTracingPktsXX bits is also set
+#define netTracingPktData 0x00000040 // record all bytes of IP packets
+ // sent/received to/from interfaces
+ // NOTE: Mutually exclusive with
+ // netTracingPkts & netTracingPktData64
+#define netTracingPktIFHi 0x00000080 // record packets sent/received at highest layer
+ // of interface (just below IP layer).
+ // NOTE: netTracingPktData40 & netTracingPktData
+ // will control how much data of each packet is
+ // recorded.
+#define netTracingPktIFMid 0x00000100 // record packets sent/received at mid layer
+ // of interface (just below IFHi layer).
+ // NOTE: netTracingPktData40 & netTracingPktData
+ // will control how much data of each packet is
+ // recorded.
+#define netTracingPktIFLow 0x00000200 // record packets sent/received at low layer
+ // of interface (just below IFMid layer).
+ // NOTE: netTracingPktData40 & netTracingPktData
+ // will control how much data of each packet is
+ // recorded.
+
+
+// OBSOLETE tracing bit, still used by Network Panel
+#define netTracingPkts netTracingPktIP
+
+
+/********************************************************************
+ * Command numbers and parameter blocks for the NetLibMaster() call.
+ * This call is used to put the Net library into certain debugging modes
+ * or for obtaining statistics from the Net Library.
+ *
+ ********************************************************************/
+#pragma mark Master
+typedef enum {
+ // These calls return info
+ netMasterInterfaceInfo,
+ netMasterInterfaceStats,
+ netMasterIPStats,
+ netMasterICMPStats,
+ netMasterUDPStats,
+ netMasterTCPStats,
+
+ // This call used to read the trace buffer.
+ netMasterTraceEventGet // get trace event by index
+
+ } NetMasterEnum;
+
+
+typedef struct NetMasterPBType {
+
+ // These fields are specific to each command
+ union {
+
+ //.............................................................
+ // InterfaceInfo command
+ //.............................................................
+ struct {
+ UInt16 index; // -> index of interface
+ UInt32 creator; // <- creator
+ UInt16 instance; // <- instance
+ void * netIFP; // <- net_if pointer
+
+ // driver level info
+ Char drvrName[netDrvrTypeNameLen]; // <- type of driver (SLIP,PPP, etc)
+ Char hwName[netDrvrHWNameLen]; // <- hardware name (Serial Library, etc)
+ UInt8 localNetHdrLen; // <- local net header length
+ UInt8 localNetTrailerLen; // <- local net trailer length
+ UInt16 localNetMaxFrame; // <- local net maximum frame size
+
+ // media layer info
+ Char ifName[netIFNameLen];// <- interface name w/instance
+ Boolean driverUp; // <- true if interface driver up
+ Boolean ifUp; // <- true if interface is up
+ UInt16 hwAddrLen; // <- length of hardware address
+ UInt8 hwAddr[netIFMaxHWAddrLen]; // <- hardware address
+ UInt16 mtu; // <- maximum transfer unit of interface
+ UInt32 speed; // <- speed in bits/sec.
+ UInt32 lastStateChange; // <- time in milliseconds of last state change
+
+ // Address info
+ NetIPAddr ipAddr; // Address of this interface
+ NetIPAddr subnetMask; // subnet mask of local network
+ NetIPAddr broadcast; // broadcast address of local network
+ } interfaceInfo;
+
+ //.............................................................
+ // InterfaceStats command
+ //.............................................................
+ struct {
+ UInt16 index; // -> index of interface
+ UInt32 inOctets; // <- ....
+ UInt32 inUcastPkts;
+ UInt32 inNUcastPkts;
+ UInt32 inDiscards;
+ UInt32 inErrors;
+ UInt32 inUnknownProtos;
+ UInt32 outOctets;
+ UInt32 outUcastPkts;
+ UInt32 outNUcastPkts;
+ UInt32 outDiscards;
+ UInt32 outErrors;
+ } interfaceStats;
+
+ //.............................................................
+ // IPStats command
+ //.............................................................
+ struct {
+ UInt32 ipInReceives;
+ UInt32 ipInHdrErrors;
+ UInt32 ipInAddrErrors;
+ UInt32 ipForwDatagrams;
+ UInt32 ipInUnknownProtos;
+ UInt32 ipInDiscards;
+ UInt32 ipInDelivers;
+ UInt32 ipOutRequests;
+ UInt32 ipOutDiscards;
+ UInt32 ipOutNoRoutes;
+ UInt32 ipReasmReqds;
+ UInt32 ipReasmOKs;
+ UInt32 ipReasmFails;
+ UInt32 ipFragOKs;
+ UInt32 ipFragFails;
+ UInt32 ipFragCreates;
+ UInt32 ipRoutingDiscards;
+ UInt32 ipDefaultTTL;
+ UInt32 ipReasmTimeout;
+ } ipStats;
+
+ //.............................................................
+ // ICMPStats command
+ //.............................................................
+ struct {
+ UInt32 icmpInMsgs;
+ UInt32 icmpInErrors;
+ UInt32 icmpInDestUnreachs;
+ UInt32 icmpInTimeExcds;
+ UInt32 icmpInParmProbs;
+ UInt32 icmpInSrcQuenchs;
+ UInt32 icmpInRedirects;
+ UInt32 icmpInEchos;
+ UInt32 icmpInEchoReps;
+ UInt32 icmpInTimestamps;
+ UInt32 icmpInTimestampReps;
+ UInt32 icmpInAddrMasks;
+ UInt32 icmpInAddrMaskReps;
+ UInt32 icmpOutMsgs;
+ UInt32 icmpOutErrors;
+ UInt32 icmpOutDestUnreachs;
+ UInt32 icmpOutTimeExcds;
+ UInt32 icmpOutParmProbs;
+ UInt32 icmpOutSrcQuenchs;
+ UInt32 icmpOutRedirects;
+ UInt32 icmpOutEchos;
+ UInt32 icmpOutEchoReps;
+ UInt32 icmpOutTimestamps;
+ UInt32 icmpOutTimestampReps;
+ UInt32 icmpOutAddrMasks;
+ UInt32 icmpOutAddrMaskReps;
+ } icmpStats;
+
+ //.............................................................
+ // UDPStats command
+ //.............................................................
+ struct {
+ UInt32 udpInDatagrams;
+ UInt32 udpNoPorts;
+ UInt32 udpInErrors;
+ UInt32 udpOutDatagrams;
+ } udpStats;
+
+ //.............................................................
+ // TCPStats command
+ //.............................................................
+ struct {
+ UInt32 tcpRtoAlgorithm;
+ UInt32 tcpRtoMin;
+ UInt32 tcpRtoMax;
+ UInt32 tcpMaxConn;
+ UInt32 tcpActiveOpens;
+ UInt32 tcpPassiveOpens;
+ UInt32 tcpAttemptFails;
+ UInt32 tcpEstabResets;
+ UInt32 tcpCurrEstab;
+ UInt32 tcpInSegs;
+ UInt32 tcpOutSegs;
+ UInt32 tcpRetransSegs;
+ UInt32 tcpInErrs;
+ UInt32 tcpOutRsts;
+ } tcpStats;
+
+ //.............................................................
+ // TraceEventGet command
+ //.............................................................
+ struct {
+ UInt16 index; // which event
+ Char * textP; // ptr to text string to return it in
+ } traceEventGet;
+
+ } param;
+
+ } NetMasterPBType, *NetMasterPBPtr;
+
+
+
+
+
+//-----------------------------------------------------------------------------
+// Enumeration of Net settings as passed to NetLibSettingGet/Set.
+//-----------------------------------------------------------------------------
+#pragma mark Settings
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+// Global environment settings common to all attached network interfaces,
+// passed to NetLibSettingGet/Set
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+typedef enum {
+ netSettingResetAll, // void, NetLibSettingSet only, resets all settings
+ // to their defaults.
+
+ netSettingPrimaryDNS, // UInt32, IP address of Primary DN Server
+ netSettingSecondaryDNS, // UInt32, IP address of Secondary DN Server
+ netSettingDefaultRouter, // UInt32, IP address of Default router
+ netSettingDefaultIFCreator, // UInt32, Creator type of default interface
+ netSettingDefaultIFInstance, // UInt16, Instance# of default interface
+ netSettingHostName, // Char[64], name of host (not including domain)
+ netSettingDomainName, // Char[256], domain name of hosts's domain
+ netSettingHostTbl, // Char[], host table
+ netSettingCloseWaitTime, // UInt32, time in milliseconds to stay in close-wait state
+ netSettingInitialTCPResendTime, // UInt32, time in milliseconds before TCP resends a packet.
+ // This is just the initial value, the timeout is adjusted
+ // from this initial value depending on history of ACK times.
+ // This is sometimes referred to as the RTO (Roundtrip Time Out)
+ // See RFC-1122 for additional information.
+
+
+ // The following settings are not used for configuration, but rather put the
+ // stack into various modes for debugging, etc.
+ netSettingTraceBits = 0x1000, // UInt32, enable/disable various trace flags (netTraceBitXXXX)
+ netSettingTraceSize, // UInt32, max trace buffer size in bytes. Default 0x800.
+ // Setting this will also clear the trace buffer.
+ netSettingTraceStart, // UInt32, for internal use ONLY!!
+ netSettingTraceRoll, // UInt8, if true, trace buffer will rollover after it fills.
+ // Default is true.
+
+ netSettingRTPrimaryDNS, // used internally by Network interfaces
+ // that dynamically obtain the DNS address
+ netSettingRTSecondaryDNS, // used internally by Network interfaces
+ // that dynamically obtain the DNS address
+
+ netSettingConfigTable // used internally by NetLib - NOT FOR USE BY
+ // APPLICATIONS!!
+
+ } NetSettingEnum;
+
+
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+// Settings for each Network Interface, passed to NetLibIFSettingGet/Set
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+typedef enum {
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // Reset all settings to defaults
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingResetAll, // void, NetLibIFSettingSet only, resets all settings
+ // to their defaults.
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // Status - read only
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingUp, // UInt8, true if interface is UP.
+ netIFSettingName, // Char[32], name of interface
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // Addressing
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingReqIPAddr, // UInt32, requested IP address of this interface
+ netIFSettingSubnetMask, // UInt32, subnet mask of this interface
+ netIFSettingBroadcast, // UInt32, broadcast address for this interface
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // User Info
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingUsername, // Char[], login script user name
+ // If 0 length, then user will be prompted for it
+ netIFSettingPassword, // Char[], login script user password
+ // If 0 length, then user will be prompted for it
+ netIFSettingDialbackUsername, // Char[], login script dialback user name.
+ // If 0 length, then netIFSettingUsername is used
+ netIFSettingDialbackPassword, // Char[], login script dialback user password.
+ // If 0 length, then user will be prompted for it
+ netIFSettingAuthUsername, // Char[], PAP/CHAP name.
+ // If 0 length, then netIFSettingUsername is used
+ netIFSettingAuthPassword, // Char[], PAP/CHAP password.
+ // If "$", then user will be prompted for it
+ // else If 0 length, then netIFSettingPassword or result
+ // of it's prompt (if it was empty) will be used
+ // else it is used as-is.
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // Connect Settings
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingServiceName, // Char[], name of service
+ netIFSettingLoginScript, // Char[], login script
+ netIFSettingConnectLog, // Char[], connect log
+ netIFSettingInactivityTimeout, // UInt16, # of seconds of inactivity allowed before
+ // interface is brought down. If 0 then
+ // no inactivity timeout enforced.
+ netIFSettingEstablishmentTimeout, // UInt16, max delay in seconds between connection
+ // establishment stages
+
+ // Serial based protocol options
+ netIFSettingDynamicIP, // UInt8, if true, get IP address from server
+ // N/A for SLIP
+ netIFSettingVJCompEnable, // UInt8, if true enable VJ Header compression
+ // Default is on for PPP, off for SLIP
+ netIFSettingVJCompSlots, // UInt8, # of slots to use for VJ compression.
+ // Default is 4 for PPP, 16 for SLIP
+ // (each slot uses 256 bytes of RAM).
+ netIFSettingMTU, // UInt16, maximum transmission unit in bytes
+ // ignored in current PPP and SLIP interfaces
+ netIFSettingAsyncCtlMap, // UInt32, bitmask of characters to escape
+ // ignored in current PPP interfaces
+
+ // Serial settings, used by serial based network interfaces
+ netIFSettingPortNum, // UInt16, port number to use
+ netIFSettingBaudRate, // UInt32, baud rate in bits/sec.
+ netIFSettingFlowControl, // UInt8, flow control setting bits. Set to 0x01 for
+ // hardware flow control, else set to 0x00.
+ netIFSettingStopBits, // UInt8, # of stop bits
+ netIFSettingParityOn, // UInt8, true if parity on
+ netIFSettingParityEven, // UInt8, true if parity even
+
+ // Modem settings, optionally used by serial based network interfaces
+ netIFSettingUseModem, // UInt8, if true dial-up through modem
+ netIFSettingPulseDial, // UInt8, if true use pulse dial, else tone
+ netIFSettingModemInit, // Char[], modem initialization string
+ netIFSettingModemPhone, // Char[], modem phone number string
+ netIFSettingRedialCount, // UInt16, # of times to redial
+
+
+ //---------------------------------------------------------------------------------
+ // New Settings as of PalmOS 3.0
+ // Power control, usually only implemented by wireless interfaces
+ //---------------------------------------------------------------------------------
+ netIFSettingPowerUp, // UInt8, true if this interface is powered up
+ // false if this interface is in power-down mode
+ // interfaces that don't support power modes should
+ // quietly ignore this setting.
+
+ // Wireless or Wireline, read-only, returns true for wireless interfaces. this
+ // setting is used by application level functions to determine which interface(s)
+ // to attach/detach given user preference and/or state of the antenna.
+ netIFSettingWireless, // UInt8, true if this interface is wireless
+
+
+
+ // Option to query server for address of DNS servers
+ netIFSettingDNSQuery, // UInt8, if true PPP queries for DNS address. Default true
+
+
+ //---------------------------------------------------------------------------------
+ // New Settings as of PalmOS 3.2
+ // Power control, usually only implemented by wireless interfaces
+ //---------------------------------------------------------------------------------
+
+ netIFSettingQuitOnTxFail, // BYTE W-only. Power down RF on tx fail
+ netIFSettingQueueSize, // UInt8 R-only. The size of the Tx queue in the RF interface
+ netIFSettingTxInQueue, // BYTE R-only. Packets remaining to be sent
+ netIFSettingTxSent, // BYTE R-only. Packets sent since SocketOpen
+ netIFSettingTxDiscard, // BYTE R-only. Packets discarded on SocketClose
+ netIFSettingRssi, // char R-only. signed value in dBm.
+ netIFSettingRssiAsPercent, // char R-only. signed value in percent, with 0 being no coverage and 100 being excellent.
+ netIFSettingRadioState, // enum R-only. current state of the radio
+ netIFSettingBase, // UInt32 R-only. Interface specific
+ netIFSettingRadioID, // UInt32[2] R-only, two 32-bit. interface specific
+ netIFSettingBattery, // UInt8, R-only. percentage of battery left
+ netIFSettingNetworkLoad, // UInt8, R-only. percent estimate of network loading
+
+ //---------------------------------------------------------------------------------
+ // New Settings as of PalmOS 3.3
+ //---------------------------------------------------------------------------------
+
+ netIFSettingConnectionName, // Char [] Connection Profile Name
+
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // The following settings are not used for configuration, but rather put the
+ // stack into various modes for debugging, etc.
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingTraceBits = 0x1000, // UInt32, enable/disable various trace flags (netTraceBitXXXX)
+ netIFSettingGlobalsPtr, // UInt32, (Read-Only) sinterface's globals ptr
+ netIFSettingActualIPAddr, // UInt32, (Read-Only) the actual IP address that the interface
+ // ends up using. The login script executor stores
+ // the result of the "g" script command here as does
+ // the PPP negotiations.
+ netIFSettingServerIPAddr, // UInt32, (Read-Only) the IP address of the PPP server
+ // we're connected to
+
+
+ // The following setting should be true if this network interface should be
+ // brought down when the Pilot is turned off.
+ netIFSettingBringDownOnPowerDown, // UInt8, if true interface will be brought down when
+ // Pilot is turned off.
+
+ // The following setting is used by the TCP/IP stack ONLY!! It tells the interface
+ // to pass all received packets as-is to the NetIFCallbacksPtr->raw_rcv() routine.
+ // This setting gets setup when an application creates a raw socket in the raw domain
+ netIFSettingRawMode, // UInt32, parameter to pass to raw_rcv() along with
+ // packet pointer.
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // 3rd party settings start here...
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingCustom = 0x8000
+
+ } NetIFSettingEnum;
+
+
+
+//=========================================================================================
+// Enums for the netIFSettingRadioState setting
+//
+// JB added for the radio state setting.
+// <chg 3-17-98 RM> fixed naming conventions.
+//=========================================================================================
+typedef enum {
+ netRadioStateOffNotConnected=0,
+ netRadioStateOnNotConnected, // scanning
+ netRadioStateOnConnected, // have channel
+ netRadioStateOffConnected
+ } NetRadioStateEnum;
+
+
+
+/************************************************************
+ * Net Library Macros
+ *************************************************************/
+// Return current time in milliseconds.
+#define NetNow() (TimGetTicks() * 1000L/sysTicksPerSecond)
+
+
+// File Descriptor macros used for the NetLibSelect() call
+typedef UInt32 NetFDSetType;
+#define netFDSetSize 32
+
+#define netFDSet(n,p) ((*p) |= (1L << n))
+#define netFDClr(n,p) ((*p) &= ~(1L << n))
+#define netFDIsSet(n,p) ((*p) & (1L << n))
+#define netFDZero(p) ((*p) = 0)
+
+
+
+//-----------------------------------------------------------------------------
+// Net error codes
+//-----------------------------------------------------------------------------
+#pragma mark ErrorCodes
+#define netErrAlreadyOpen (netErrorClass | 1)
+#define netErrNotOpen (netErrorClass | 2)
+#define netErrStillOpen (netErrorClass | 3)
+#define netErrParamErr (netErrorClass | 4)
+#define netErrNoMoreSockets (netErrorClass | 5)
+#define netErrOutOfResources (netErrorClass | 6)
+#define netErrOutOfMemory (netErrorClass | 7)
+#define netErrSocketNotOpen (netErrorClass | 8)
+#define netErrSocketBusy (netErrorClass | 9) //EINPROGRESS
+#define netErrMessageTooBig (netErrorClass | 10)
+#define netErrSocketNotConnected (netErrorClass | 11)
+#define netErrNoInterfaces (netErrorClass | 12) //ENETUNREACH
+#define netErrBufTooSmall (netErrorClass | 13)
+#define netErrUnimplemented (netErrorClass | 14)
+#define netErrPortInUse (netErrorClass | 15) //EADDRINUSE
+#define netErrQuietTimeNotElapsed (netErrorClass | 16) //EADDRINUSE
+#define netErrInternal (netErrorClass | 17)
+#define netErrTimeout (netErrorClass | 18) //ETIMEDOUT
+#define netErrSocketAlreadyConnected (netErrorClass | 19) //EISCONN
+#define netErrSocketClosedByRemote (netErrorClass | 20)
+#define netErrOutOfCmdBlocks (netErrorClass | 21)
+#define netErrWrongSocketType (netErrorClass | 22)
+#define netErrSocketNotListening (netErrorClass | 23)
+#define netErrUnknownSetting (netErrorClass | 24)
+#define netErrInvalidSettingSize (netErrorClass | 25)
+#define netErrPrefNotFound (netErrorClass | 26)
+#define netErrInvalidInterface (netErrorClass | 27)
+#define netErrInterfaceNotFound (netErrorClass | 28)
+#define netErrTooManyInterfaces (netErrorClass | 29)
+#define netErrBufWrongSize (netErrorClass | 30)
+#define netErrUserCancel (netErrorClass | 31)
+#define netErrBadScript (netErrorClass | 32)
+#define netErrNoSocket (netErrorClass | 33)
+#define netErrSocketRcvBufFull (netErrorClass | 34)
+#define netErrNoPendingConnect (netErrorClass | 35)
+#define netErrUnexpectedCmd (netErrorClass | 36)
+#define netErrNoTCB (netErrorClass | 37)
+#define netErrNilRemoteWindowSize (netErrorClass | 38)
+#define netErrNoTimerProc (netErrorClass | 39)
+#define netErrSocketInputShutdown (netErrorClass | 40) // EOF to sockets API
+#define netErrCmdBlockNotCheckedOut (netErrorClass | 41)
+#define netErrCmdNotDone (netErrorClass | 42)
+#define netErrUnknownProtocol (netErrorClass | 43)
+#define netErrUnknownService (netErrorClass | 44)
+#define netErrUnreachableDest (netErrorClass | 45)
+#define netErrReadOnlySetting (netErrorClass | 46)
+#define netErrWouldBlock (netErrorClass | 47) //EWOULDBLOCK
+#define netErrAlreadyInProgress (netErrorClass | 48) //EALREADY
+#define netErrPPPTimeout (netErrorClass | 49)
+#define netErrPPPBroughtDown (netErrorClass | 50)
+#define netErrAuthFailure (netErrorClass | 51)
+#define netErrPPPAddressRefused (netErrorClass | 52)
+// The following map into the Epilogue DNS errors declared in DNS.ep.h:
+// and MUST be kept in this order!!
+#define netErrDNSNameTooLong (netErrorClass | 53)
+#define netErrDNSBadName (netErrorClass | 54)
+#define netErrDNSBadArgs (netErrorClass | 55)
+#define netErrDNSLabelTooLong (netErrorClass | 56)
+#define netErrDNSAllocationFailure (netErrorClass | 57)
+#define netErrDNSTimeout (netErrorClass | 58)
+#define netErrDNSUnreachable (netErrorClass | 59)
+#define netErrDNSFormat (netErrorClass | 60)
+#define netErrDNSServerFailure (netErrorClass | 61)
+#define netErrDNSNonexistantName (netErrorClass | 62)
+#define netErrDNSNIY (netErrorClass | 63)
+#define netErrDNSRefused (netErrorClass | 64)
+#define netErrDNSImpossible (netErrorClass | 65)
+#define netErrDNSNoRRS (netErrorClass | 66)
+#define netErrDNSAborted (netErrorClass | 67)
+#define netErrDNSBadProtocol (netErrorClass | 68)
+#define netErrDNSTruncated (netErrorClass | 69)
+#define netErrDNSNoRecursion (netErrorClass | 70)
+#define netErrDNSIrrelevant (netErrorClass | 71)
+#define netErrDNSNotInLocalCache (netErrorClass | 72)
+#define netErrDNSNoPort (netErrorClass | 73)
+// The following map into the Epilogue IP errors declared in IP.ep.h:
+// and MUST be kept in this order!!
+#define netErrIPCantFragment (netErrorClass | 74)
+#define netErrIPNoRoute (netErrorClass | 75)
+#define netErrIPNoSrc (netErrorClass | 76)
+#define netErrIPNoDst (netErrorClass | 77)
+#define netErrIPktOverflow (netErrorClass | 78)
+// End of Epilogue IP errors
+#define netErrTooManyTCPConnections (netErrorClass | 79)
+#define netErrNoDNSServers (netErrorClass | 80)
+#define netErrInterfaceDown (netErrorClass | 81)
+
+// Mobitex network radio interface error code returns
+#define netErrNoChannel (netErrorClass | 82) // The datalink layer cannot acquire a channel
+#define netErrDieState (netErrorClass | 83) // Mobitex network has issued a DIE command.
+#define netErrReturnedInMail (netErrorClass | 84) // The addressed of the transmitted packet was not available, and the message was placed in the network's mailbox.
+#define netErrReturnedNoTransfer (netErrorClass | 85) // This message cannot be transferred or put in the network mailbox.
+#define netErrReturnedIllegal (netErrorClass | 86) // The message could not be switched to the network
+#define netErrReturnedCongest (netErrorClass | 87) // Line, radio channels, or network nodes are congested.
+#define netErrReturnedError (netErrorClass | 88) // Technical error in the network.
+#define netErrReturnedBusy (netErrorClass | 89) // The B-party is busy.
+#define netErrGMANState (netErrorClass | 90) // The modem has not registered with the network.
+#define netErrQuitOnTxFail (netErrorClass | 91) // Couldn't get packet through, shutdown.
+#define netErrFlexListFull (netErrorClass | 92) // raw IF error message: see Mobitex spec.
+#define netErrSenderMAN (netErrorClass | 93) // ditto
+#define netErrIllegalType (netErrorClass | 94) // ditto
+#define netErrIllegalState (netErrorClass | 95) // ditto
+#define netErrIllegalFlags (netErrorClass | 96) // ditto
+#define netErrIllegalSendlist (netErrorClass | 97) // ditto
+#define netErrIllegalMPAKLength (netErrorClass | 98) // ditto
+#define netErrIllegalAddressee (netErrorClass | 99) // ditto
+#define netErrIllegalPacketClass (netErrorClass | 100) // ditto
+#define netErrBufferLength (netErrorClass | 101) // any
+#define netErrNiCdLowBattery (netErrorClass | 102) // any
+#define netErrRFinterfaceFatal (netErrorClass | 103) // any
+#define netErrIllegalLogout (netErrorClass | 104) // raw IF error message
+#define netErrAAARadioLoad (netErrorClass | 105) // 7/20/98 JB. If there is insufficient AAA
+#define netErrAntennaDown (netErrorClass | 106)
+#define netErrNiCdCharging (netErrorClass | 107) // just for charging
+#define netErrAntennaWentDown (netErrorClass | 108)
+#define netErrNotActivated (netErrorClass | 109) // The unit has not been FULLY activated. George and Morty completed.
+#define netErrRadioTemp (netErrorClass | 110) // Radio's temp is too high for FCC compliant TX
+#define netErrNiCdChargeError (netErrorClass | 111) // Charging stopped due to NiCd charging characteristic
+#define netErrNiCdSag (netErrorClass | 112) // the computed sag or actual sag indicates a NiCd with diminished capacity.
+#define netErrNiCdChargeSuspend (netErrorClass | 113) // Charging has been suspended due to low AAA batteries.
+// Left room for more Mobitex errors
+
+// Configuration errors
+#define netErrConfigNotFound (netErrorClass | 115)
+#define netErrConfigCantDelete (netErrorClass | 116)
+#define netErrConfigTooMany (netErrorClass | 117)
+#define netErrConfigBadName (netErrorClass | 118)
+#define netErrConfigNotAlias (netErrorClass | 119)
+#define netErrConfigCantPointToAlias (netErrorClass | 120)
+#define netErrConfigEmpty (netErrorClass | 121)
+#define netErrAlreadyOpenWithOtherConfig (netErrorClass | 122)
+#define netErrConfigAliasErr (netErrorClass | 123)
+#define netErrNoMultiPktAddr (netErrorClass | 124)
+#define netErrOutOfPackets (netErrorClass | 125)
+#define netErrMultiPktAddrReset (netErrorClass | 126)
+#define netErrStaleMultiPktAddr (netErrorClass | 127)
+
+// Login scripting plugin errors
+#define netErrScptPluginMissing (netErrorClass | 128)
+#define netErrScptPluginLaunchFail (netErrorClass | 129)
+#define netErrScptPluginCmdFail (netErrorClass | 130)
+#define netErrScptPluginInvalidCmd (netErrorClass | 131)
+
+#define netErrMobitexStart netErrNoChannel
+#define netErrMobitexEnd netErrNiCdChargeSuspend
+
+//-----------------------------------------------------------------------------
+// Net library call ID's. Each library call gets the trap number:
+// netTrapXXXX which serves as an index into the library's dispatch table.
+// The constant sysLibTrapCustom is the first available trap number after
+// the system predefined library traps Open,Close,Sleep & Wake.
+//
+// WARNING!!! This order of these traps MUST match the order of the dispatch
+// table in NetDispatch.c!!!
+//-----------------------------------------------------------------------------
+#pragma mark Traps
+typedef enum {
+ netLibTrapAddrINToA = sysLibTrapCustom,
+ netLibTrapAddrAToIN,
+
+ netLibTrapSocketOpen,
+ netLibTrapSocketClose,
+ netLibTrapSocketOptionSet,
+ netLibTrapSocketOptionGet,
+ netLibTrapSocketBind,
+ netLibTrapSocketConnect,
+ netLibTrapSocketListen,
+ netLibTrapSocketAccept,
+ netLibTrapSocketShutdown,
+
+ netLibTrapSendPB,
+ netLibTrapSend,
+ netLibTrapReceivePB,
+ netLibTrapReceive,
+ netLibTrapDmReceive,
+ netLibTrapSelect,
+
+ netLibTrapPrefsGet,
+ netLibTrapPrefsSet,
+
+ // The following traps are for internal and Network interface
+ // use only.
+ netLibTrapDrvrWake,
+ netLibTrapInterfacePtr,
+ netLibTrapMaster,
+
+ // New Traps
+ netLibTrapGetHostByName,
+ netLibTrapSettingGet,
+ netLibTrapSettingSet,
+ netLibTrapIFAttach,
+ netLibTrapIFDetach,
+ netLibTrapIFGet,
+ netLibTrapIFSettingGet,
+ netLibTrapIFSettingSet,
+ netLibTrapIFUp,
+ netLibTrapIFDown,
+ netLibTrapIFMediaUp,
+ netLibTrapScriptExecuteV32,
+ netLibTrapGetHostByAddr,
+ netLibTrapGetServByName,
+ netLibTrapSocketAddr,
+ netLibTrapFinishCloseWait,
+ netLibTrapGetMailExchangeByName,
+ netLibTrapPrefsAppend,
+ netLibTrapIFMediaDown,
+ netLibTrapOpenCount,
+
+ netLibTrapTracePrintF,
+ netLibTrapTracePutS,
+
+ netLibTrapOpenIfCloseWait,
+ netLibTrapHandlePowerOff,
+
+ netLibTrapConnectionRefresh,
+
+ // Traps added after 1.0 release of NetLib
+ netLibTrapBitMove,
+ netLibTrapBitPutFixed,
+ netLibTrapBitGetFixed,
+ netLibTrapBitPutUIntV,
+ netLibTrapBitGetUIntV,
+ netLibTrapBitPutIntV,
+ netLibTrapBitGetIntV,
+
+ // Traps added after 2.0 release of NetLib
+ netLibOpenConfig,
+ netLibConfigMakeActive,
+ netLibConfigList,
+ netLibConfigIndexFromName,
+ netLibConfigDelete,
+ netLibConfigSaveAs,
+ netLibConfigRename,
+ netLibConfigAliasSet,
+ netLibConfigAliasGet,
+
+ // Traps added after 3.2 release of NetLib
+ netLibTrapScriptExecute,
+
+ netLibTrapLast
+ } NetLibTrapNumberEnum;
+
+
+
+/************************************************************
+ * Net Library procedures.
+ *************************************************************/
+#pragma mark Functions
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//--------------------------------------------------
+// Library initialization, shutdown, sleep and wake
+//--------------------------------------------------
+Err NetLibOpen (UInt16 libRefnum, UInt16 *netIFErrsP)
+ SYS_TRAP(sysLibTrapOpen);
+
+Err NetLibClose (UInt16 libRefnum, UInt16 immediate)
+ SYS_TRAP(sysLibTrapClose);
+
+Err NetLibSleep (UInt16 libRefnum)
+ SYS_TRAP(sysLibTrapSleep);
+
+Err NetLibWake (UInt16 libRefnum)
+ SYS_TRAP(sysLibTrapWake);
+
+
+// This call forces the library to complete a close if it's
+// currently in the close-wait state. Returns 0 if library is closed,
+// Returns netErrFullyOpen if library is still open by some other task.
+Err NetLibFinishCloseWait(UInt16 libRefnum)
+ SYS_TRAP(netLibTrapFinishCloseWait);
+
+// This call is for use by the Network preference panel only. It
+// causes the NetLib to fully open if it's currently in the close-wait
+// state. If it's not in the close wait state, it returns an error code
+Err NetLibOpenIfCloseWait(UInt16 libRefnum)
+ SYS_TRAP(netLibTrapOpenIfCloseWait);
+
+// Get the open Count of the NetLib
+Err NetLibOpenCount (UInt16 refNum, UInt16 *countP)
+ SYS_TRAP(netLibTrapOpenCount);
+
+// Give NetLib a chance to close the connection down in response
+// to a power off event. Returns non-zero if power should not be
+// turned off. EventP points to the event that initiated the power off
+// which is either a keyDownEvent of the hardPowerChr or the autoOffChr.
+// Don't include unless building for Viewer
+#ifdef __SYSEVENT_H__
+Err NetLibHandlePowerOff (UInt16 refNum, SysEventType *eventP)
+ SYS_TRAP(netLibTrapHandlePowerOff);
+#endif
+
+
+// Check status or try and reconnect any interfaces which have come down.
+// This call can be made by applications when they suspect that an interface
+// has come down (like PPP or SLIP). NOTE: This call can display UI
+// (if 'refresh' is true) so it MUST be called from the UI task.
+Err NetLibConnectionRefresh(UInt16 refNum, Boolean refresh,
+ UInt8 *allInterfacesUpP, UInt16 *netIFErrP)
+ SYS_TRAP(netLibTrapConnectionRefresh);
+
+
+
+//--------------------------------------------------
+// Net address translation and conversion routines.
+//--------------------------------------------------
+
+// convert host Int16 to network Int16
+#define NetHToNS(x) (x)
+
+// convert host long to network long
+#define NetHToNL(x) (x)
+
+// convert network Int16 to host Int16
+#define NetNToHS(x) (x)
+
+// convert network long to host long
+#define NetNToHL(x) (x)
+
+// Convert 32-bit IP address to ascii dotted decimal form. The Sockets glue
+// macro inet_ntoa will pass the address of an application global string in
+// spaceP.
+Char * NetLibAddrINToA(UInt16 libRefnum, NetIPAddr inet, Char *spaceP)
+ SYS_TRAP(netLibTrapAddrINToA);
+
+// Convert a dotted decimal ascii string format of an IP address into
+// a 32-bit value.
+NetIPAddr NetLibAddrAToIN(UInt16 libRefnum, Char *a)
+ SYS_TRAP(netLibTrapAddrAToIN);
+
+
+
+//--------------------------------------------------
+// Socket creation and option setting
+//--------------------------------------------------
+
+// Create a socket and return a refnum to it. Protocol is normally 0.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+NetSocketRef NetLibSocketOpen(UInt16 libRefnum, NetSocketAddrEnum domain,
+ NetSocketTypeEnum type, Int16 protocol, Int32 timeout,
+ Err *errP)
+ SYS_TRAP(netLibTrapSocketOpen);
+
+// Close a socket.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketClose(UInt16 libRefnum, NetSocketRef socket, Int32 timeout,
+ Err *errP)
+ SYS_TRAP(netLibTrapSocketClose);
+
+// Set a socket option. Level is usually netSocketOptLevelSocket. Option is one of
+// netSocketOptXXXXX. OptValueP is a pointer to the new value and optValueLen is
+// the length of the option value.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketOptionSet(UInt16 libRefnum, NetSocketRef socket,
+ UInt16 /*NetSocketOptLevelEnum*/ level, UInt16 /*NetSocketOptEnum*/ option,
+ void *optValueP, UInt16 optValueLen,
+ Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSocketOptionSet);
+
+// Get a socket option.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketOptionGet(UInt16 libRefnum, NetSocketRef socket,
+ UInt16 /*NetSocketOptLevelEnum*/ level, UInt16 /*NetSocketOptEnum*/ option,
+ void *optValueP, UInt16 *optValueLenP,
+ Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSocketOptionGet);
+
+
+//--------------------------------------------------
+// Socket Control
+//--------------------------------------------------
+
+// Bind a source address and port number to a socket. This makes the
+// socket accept incoming packets destined for the given socket address.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketBind(UInt16 libRefnum, NetSocketRef socket,
+ NetSocketAddrType *sockAddrP, Int16 addrLen, Int32 timeout,
+ Err *errP)
+ SYS_TRAP(netLibTrapSocketBind);
+
+
+// Connect to a remote socket. For a stream based socket (i.e. TCP), this initiates
+// a 3-way handshake with the remote machine to establish a connection. For
+// non-stream based socket, this merely specifies a destination address and port
+// number for future outgoing packets from this socket.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketConnect(UInt16 libRefnum, NetSocketRef socket,
+ NetSocketAddrType *sockAddrP, Int16 addrLen, Int32 timeout,
+ Err *errP)
+ SYS_TRAP(netLibTrapSocketConnect);
+
+
+// Makes a socket ready to accept incoming connection requests. The queueLen
+// specifies the max number of pending connection requests that will be enqueued
+// while the server is busy handling other requests.
+// Only applies to stream based (i.e. TCP) sockets.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketListen(UInt16 libRefnum, NetSocketRef socket,
+ UInt16 queueLen, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSocketListen);
+
+
+// Blocks the current process waiting for an incoming connection request. The socket
+// must have previously be put into listen mode through the NetLibSocketListen call.
+// On return, *sockAddrP will have the remote machines address and port number.
+// Only applies to stream based (i.e. TCP) sockets.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketAccept(UInt16 libRefnum, NetSocketRef socket,
+ NetSocketAddrType *sockAddrP, Int16 *addrLenP, Int32 timeout,
+ Err *errP)
+ SYS_TRAP(netLibTrapSocketAccept);
+
+
+// Shutdown a connection in one or both directions.
+// Only applies to stream based (i.e. TCP) sockets.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketShutdown(UInt16 libRefnum, NetSocketRef socket,
+ Int16 /*NetSocketDirEnum*/ direction, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSocketShutdown);
+
+
+
+// Gets the local and remote addresses of a socket. Useful for TCP sockets that
+// get dynamically bound at connect time.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketAddr(UInt16 libRefnum, NetSocketRef socketRef,
+ NetSocketAddrType *locAddrP, Int16 *locAddrLenP,
+ NetSocketAddrType *remAddrP, Int16 *remAddrLenP,
+ Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSocketAddr);
+
+
+
+//--------------------------------------------------
+// Sending and Receiving
+//--------------------------------------------------
+// Send data through a socket. The data is specified through the NetIOParamType
+// structure.
+// Flags is one or more of netMsgFlagXXX.
+// Returns # of bytes sent on success, or -1 on error. If error, *errP gets filled
+// in with error code.
+Int16 NetLibSendPB(UInt16 libRefNum, NetSocketRef socket,
+ NetIOParamType *pbP, UInt16 flags, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSendPB);
+
+// Send data through a socket. The data to send is passed in a single buffer,
+// unlike NetLibSendPB. If toAddrP is not nil, the data will be sent to
+// address *toAddrP.
+// Flags is one or more of netMsgFlagXXX.
+// Returns # of bytes sent on success, or -1 on error. If error, *errP gets filled
+// in with error code.
+Int16 NetLibSend(UInt16 libRefNum, NetSocketRef socket,
+ void *bufP, UInt16 bufLen, UInt16 flags,
+ void *toAddrP, UInt16 toLen, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSend);
+
+// Receive data from a socket. The data is gatthered into buffers specified in the
+// NetIOParamType structure.
+// Flags is one or more of netMsgFlagXXX.
+// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none.
+// Returns # of bytes received, or -1 on error. If error, *errP gets filled in
+// with error code.
+Int16 NetLibReceivePB(UInt16 libRefNum, NetSocketRef socket,
+ NetIOParamType *pbP, UInt16 flags, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapReceivePB);
+
+// Receive data from a socket. The data is read into a single buffer, unlike
+// NetLibReceivePB. If fromAddrP is not nil, *fromLenP must be initialized to
+// the size of the buffer that fromAddrP points to and on exit *fromAddrP will
+// have the address of the sender in it.
+// Flags is one or more of netMsgFlagXXX.
+// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none.
+// Returns # of bytes received, or -1 on error. If error, *errP gets filled in
+// with error code.
+Int16 NetLibReceive(UInt16 libRefNum, NetSocketRef socket,
+ void *bufP, UInt16 bufLen, UInt16 flags,
+ void *fromAddrP, UInt16 *fromLenP, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapReceive);
+
+
+// Receive data from a socket directly into a (write-protected) Data Manager
+// record.
+// If fromAddrP is not nil, *fromLenP must be initialized to
+// the size of the buffer that fromAddrP points to and on exit *fromAddrP will
+// have the address of the sender in it.
+// Flags is one or more of netMsgFlagXXX.
+// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none.
+// Returns # of bytes received, or -1 on error. If error, *errP gets filled in
+// with error code.
+Int16 NetLibDmReceive(UInt16 libRefNum, NetSocketRef socket,
+ void *recordP, UInt32 recordOffset, UInt16 rcvLen, UInt16 flags,
+ void *fromAddrP, UInt16 *fromLenP, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapDmReceive);
+
+
+//--------------------------------------------------
+// Name Lookups
+//--------------------------------------------------
+NetHostInfoPtr NetLibGetHostByName(UInt16 libRefNum, Char *nameP,
+ NetHostInfoBufPtr bufP, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapGetHostByName);
+
+
+NetHostInfoPtr NetLibGetHostByAddr(UInt16 libRefNum, UInt8 *addrP, UInt16 len, UInt16 type,
+ NetHostInfoBufPtr bufP, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapGetHostByAddr);
+
+
+NetServInfoPtr NetLibGetServByName(UInt16 libRefNum, const Char *servNameP,
+ const Char *protoNameP, NetServInfoBufPtr bufP,
+ Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapGetServByName);
+
+// Looks up a mail exchange name and returns a list of hostnames for it. Caller
+// must pass space for list of return names (hostNames), space for
+// list of priorities for those hosts (priorities) and max # of names to
+// return (maxEntries).
+// Returns # of entries found, or -1 on error. If error, *errP gets filled in
+// with error code.
+Int16 NetLibGetMailExchangeByName(UInt16 libRefNum, Char *mailNameP,
+ UInt16 maxEntries,
+ Char hostNames[][netDNSMaxDomainName+1], UInt16 priorities[],
+ Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapGetMailExchangeByName);
+
+
+//--------------------------------------------------
+// Interface setup
+//--------------------------------------------------
+Err NetLibIFGet(UInt16 libRefNum, UInt16 index, UInt32 *ifCreatorP,
+ UInt16 *ifInstanceP)
+ SYS_TRAP(netLibTrapIFGet);
+
+Err NetLibIFAttach(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance,
+ Int32 timeout)
+ SYS_TRAP(netLibTrapIFAttach);
+
+Err NetLibIFDetach(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance,
+ Int32 timeout)
+ SYS_TRAP(netLibTrapIFDetach);
+
+Err NetLibIFUp(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance)
+ SYS_TRAP(netLibTrapIFUp);
+
+Err NetLibIFDown(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance,
+ Int32 timeout)
+ SYS_TRAP(netLibTrapIFDown);
+
+
+
+
+//--------------------------------------------------
+// Settings
+//--------------------------------------------------
+// General settings
+Err NetLibSettingGet(UInt16 libRefNum,
+ UInt16 /*NetSettingEnum*/ setting, void *valueP, UInt16 *valueLenP)
+ SYS_TRAP(netLibTrapSettingGet);
+
+Err NetLibSettingSet(UInt16 libRefNum,
+ UInt16 /*NetSettingEnum*/ setting, void *valueP, UInt16 valueLen)
+ SYS_TRAP(netLibTrapSettingSet);
+
+// Network interface specific settings.
+Err NetLibIFSettingGet(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance,
+ UInt16 /*NetIFSettingEnum*/ setting, void *valueP, UInt16 *valueLenP)
+ SYS_TRAP(netLibTrapIFSettingGet);
+
+Err NetLibIFSettingSet(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance,
+ UInt16 /*NetIFSettingEnum*/ setting, void *valueP, UInt16 valueLen)
+ SYS_TRAP(netLibTrapIFSettingSet);
+
+
+
+//--------------------------------------------------
+// System level
+//--------------------------------------------------
+Int16 NetLibSelect(UInt16 libRefNum, UInt16 width, NetFDSetType *readFDs,
+ NetFDSetType *writeFDs, NetFDSetType *exceptFDs,
+ Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSelect);
+
+
+
+//--------------------------------------------------
+// Debugging support
+//--------------------------------------------------
+Err NetLibMaster(UInt16 libRefNum, UInt16 cmd, NetMasterPBPtr pbP,
+ Int32 timeout)
+ SYS_TRAP(netLibTrapMaster);
+
+Err NetLibTracePrintF(UInt16 libRefNum, Char *formatStr, ...)
+ SYS_TRAP(netLibTrapTracePrintF);
+
+Err NetLibTracePutS(UInt16 libRefNum, Char *strP)
+ SYS_TRAP(netLibTrapTracePutS);
+
+
+
+
+
+//--------------------------------------------------
+// Configuration Calls
+//--------------------------------------------------
+Err NetLibOpenConfig( UInt16 refNum, UInt16 configIndex, UInt32 openFlags,
+ UInt16 *netIFErrP)
+ SYS_TRAP(netLibOpenConfig);
+
+Err NetLibConfigMakeActive( UInt16 refNum, UInt16 configIndex)
+ SYS_TRAP(netLibConfigMakeActive);
+
+Err NetLibConfigList( UInt16 refNum, NetConfigNameType nameArray[],
+ UInt16 *arrayEntriesP)
+ SYS_TRAP(netLibConfigList);
+
+Err NetLibConfigIndexFromName( UInt16 refNum, NetConfigNamePtr nameP,
+ UInt16 *indexP)
+ SYS_TRAP(netLibConfigIndexFromName);
+
+Err NetLibConfigDelete( UInt16 refNum, UInt16 index)
+ SYS_TRAP(netLibConfigDelete);
+
+Err NetLibConfigSaveAs( UInt16 refNum, NetConfigNamePtr nameP)
+ SYS_TRAP(netLibConfigSaveAs);
+
+Err NetLibConfigRename( UInt16 refNum, UInt16 index,
+ NetConfigNamePtr newNameP)
+ SYS_TRAP(netLibConfigRename);
+
+Err NetLibConfigAliasSet( UInt16 refNum, UInt16 configIndex,
+ UInt16 aliasToIndex)
+ SYS_TRAP(netLibConfigAliasSet);
+
+Err NetLibConfigAliasGet( UInt16 refNum, UInt16 aliasIndex,
+ UInt16 *indexP, Boolean *isAnotherAliasP)
+ SYS_TRAP(netLibConfigAliasGet);
+
+
+#ifndef PUBLIC_STUFF_STRIPPED
+//--------------------------------------------------
+// Routines that must be linked in from the :Libraries:PalmOS:Src:NetSocket.c
+// source module.
+//
+// These are general convenience routines for applications that use the
+// NetLib. They are not part of the NetLib itself because they generally
+// need to keep track of state within the application and require the use
+// of application globals that are declared in NetSocket.c
+//--------------------------------------------------
+#ifdef __SYSEVENT_H__
+Boolean NetUWirelessAppHandleEvent(SysEventType *eventP, UInt32 flags, Err *errP);
+#endif
+#endif // PUBLIC_STUFF_STRIPPED
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+// Include the NetMgr Bit Utils
+#include <NetBitUtils.h>
+
+#endif // __NETMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/OverlayMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/OverlayMgr.h
new file mode 100644
index 0000000..7d4f4b9
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/OverlayMgr.h
@@ -0,0 +1,214 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: OverlayMgr.h
+ *
+ * Description:
+ * Public header for routines that support overlays & locales.
+ *
+ * History:
+ * Created by Ken Krugler
+ * 06/24/99 kwk Created by Ken Krugler.
+ * 07/06/99 CS Added omSpecAttrForBase
+ * (and renumbered omSpecAttrStripped).
+ * 07/29/99 CS Added omOverlayKindBase for the entries in the base
+ * DBs 'ovly' resource (they had been set to
+ * omOverlayKindReplace before).
+ * 07/29/99 CS Bumped version to 3, since now we're supposed to
+ * support omOverlayKindAdd.
+ * 09/29/99 kwk Bumped version to 4, since we added the baseChecksum
+ * field to OmOverlaySpecType, as a way of speeding up
+ * overlay validation.
+ * 09/29/99 CS Actually bumped version to 4, which Ken forgot.
+ * 10/08/99 kwk Added OmGetRoutineAddress selector/declaration.
+ * Moved OmDispatch, OmInit, and OmOpenOverlayDatabase
+ * into OverlayPrv.h
+ *
+ *****************************************************************************/
+
+#ifndef __OVERLAYMGR_H__
+#define __OVERLAYMGR_H__
+
+// Include elementary types
+#include <PalmTypes.h>
+#include <DataMgr.h>
+
+#ifdef _WIN32
+ #pragma warning(disable: 4200) // nonstandard extension used : zero-sized array in struct/union
+#endif
+
+/***********************************************************************
+ * Overlay Manager constants
+ **********************************************************************/
+
+#define omOverlayVersion 0x0004 // Version of OmOverlaySpecType/OmOverlayRscType
+#define omOverlayDBType 'ovly' // Overlay database type
+#define omOverlayRscType 'ovly' // Overlay desc resource type
+#define omOverlayRscID 1000 // Overlay desc resource ID
+
+#define omFtrCreator 'ovly' // For get/set of Overlay features.
+#define omFtrShowErrorsFlag 0 // Boolean - True => display overlay errors.
+
+// Flags for OmOverlaySpecType.flags field
+#define omSpecAttrForBase 1 // 'ovly' (in base) describes base itself
+#define omSpecAttrStripped 2 // Localized resources stripped (base only)
+
+// OmFindOverlayDatabase called with stripped base, and no appropriate overlay was found.
+#define omErrBaseRequiresOverlay (omErrorClass | 1)
+
+// OmOverlayDBNameToLocale or OmLocaleToOverlayDBName were passed an unknown locale.
+#define omErrUnknownLocale (omErrorClass | 2)
+
+// OmOverlayDBNameToLocale was passed a poorly formed string.
+#define omErrBadOverlayDBName (omErrorClass | 3)
+
+// OmGetIndexedLocale was passed an invalid index.
+#define omErrInvalidLocaleIndex (omErrorClass | 4)
+
+// OmSetSystemLocale was passed an invalid locale (doesn't correspond to available
+// system overlay).
+
+#define omErrInvalidLocale (omErrorClass | 5)
+
+// OmSetSystemLocale was passed a locale that referenced an invalid system overlay
+// (missing one or more required resources)
+
+#define omErrInvalidSystemOverlay (omErrorClass | 6)
+
+// Values for OmOverlayKind
+#define omOverlayKindHide 0 // Hide base resource (not supported in version <= 3)
+#define omOverlayKindAdd 1 // Add new resource (not support in version <= 2)
+#define omOverlayKindReplace 2 // Replace base resource
+#define omOverlayKindBase 3 // Description of base resource itself (not supported in version <= 2)
+
+/***********************************************************************
+ * Selectors & macros used for calling Overlay Manager routines
+ **********************************************************************/
+
+#ifdef DIRECT_OVERLAY_CALLS
+ #define OMDISPATCH_TRAP(omSelectorNum)
+#else
+ #define OMDISPATCH_TRAP(sel) \
+ _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapOmDispatch, sel)
+#endif
+
+// Selectors used for getting to the right Overlay Manager routine via
+// the OmDispatch trap.
+typedef enum {
+ omInit = 0,
+ omOpenOverlayDatabase,
+ omLocaleToOverlayDBName,
+ omOverlayDBNameToLocale,
+ omGetCurrentLocale,
+ omGetIndexedLocale,
+ omGetSystemLocale,
+ omSetSystemLocale,
+ omGetRoutineAddress,
+
+ omMaxSelector = omGetRoutineAddress,
+ omBigSelector = 0x7FFF // Force OmSelector to be 16 bits.
+} OmSelector;
+
+/***********************************************************************
+ * Overlay Manager types
+ **********************************************************************/
+
+typedef UInt16 OmOverlayKind;
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER kwk - figure out exact format for portable struct declaration.
+// We might also want to hide this information in a private header, and
+// just have OmLocaleType in here.
+#endif // PUBLIC_STUFF_STRIPPED
+
+typedef struct {
+ OmOverlayKind overlayType; // Replace, delete, etc.
+ UInt32 rscType; // Resource type to overlay
+ UInt16 rscID; // Resource ID to overlay
+ UInt32 rscLength; // Length of base resource
+ UInt32 rscChecksum; // Checksum of base resource data
+} OmOverlayRscType;
+
+typedef struct {
+ UInt16 language; // Language spoken in locale
+ UInt16 country; // Specifies "dialect" of language
+} OmLocaleType;
+
+// Definition of the Overlay Description Resource ('ovly')
+typedef struct {
+ UInt16 version; // Version of this structure
+ UInt32 flags; // Flags
+ UInt32 baseChecksum; // Checksum of all overlays[].checksum
+ OmLocaleType targetLocale; // Language, & country of overlay resources
+ UInt32 baseDBType; // Type of base DB to overlay
+ UInt32 baseDBCreator; // Creator of base DB to overlay
+ UInt32 baseDBCreateDate; // Date base DB was created
+ UInt32 baseDBModDate; // Date base DB was last modified
+ UInt16 numOverlays; // Number of resources to overlay
+ OmOverlayRscType overlays[0]; // Descriptions of resources to overlay
+} OmOverlaySpecType;
+
+
+/***********************************************************************
+ * Overlay Manager routines
+ **********************************************************************/
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+// Return in <overlayDBName> an overlay database name that's appropriate
+// for the base name <baseDBName> and the locale <targetLocale>. If the
+// <targetLocale> param in NULL, use the current locale. The <overlayDBName>
+// buffer must be at least dmDBNameLength bytes.
+
+Err OmLocaleToOverlayDBName(const Char *baseDBName, const OmLocaleType *targetLocale,
+ Char *overlayDBName)
+ OMDISPATCH_TRAP(omLocaleToOverlayDBName);
+
+// Given the name of an overlay database in <overlayDBName>, return back
+// the overlay in overlayLocale. If the name isn't an overlay name,
+// return omErrBadOverlayDBName.
+
+Err OmOverlayDBNameToLocale(const Char *overlayDBName, OmLocaleType *overlayLocale)
+ OMDISPATCH_TRAP(omOverlayDBNameToLocale);
+
+// Return the current locale in <currentLocale>. This may not be the same as
+// the system locale, which will take effect after the next reset.
+
+void OmGetCurrentLocale(OmLocaleType *currentLocale)
+ OMDISPATCH_TRAP(omGetCurrentLocale);
+
+// Return the nth available locale in <theLocale>. Indexes are zero-based, and the
+// omErrInvalidLocaleIndex result will be returned if <localeIndex> is out of bounds.
+
+Err OmGetIndexedLocale(UInt16 localeIndex, OmLocaleType *theLocale)
+ OMDISPATCH_TRAP(omGetIndexedLocale);
+
+// Return the system locale in <systemLocale>. This may not be the same as
+// the current locale.
+
+void OmGetSystemLocale(OmLocaleType *systemLocale)
+ OMDISPATCH_TRAP(omGetSystemLocale);
+
+// Set the post-reset system locale to be <systemLocale>. Return omErrInvalidLocale if
+// the passed locale doesnÕt correspond to a valid System.prc overlay.
+
+Err OmSetSystemLocale(const OmLocaleType *systemLocale)
+ OMDISPATCH_TRAP(omSetSystemLocale);
+
+// Return back the address of the routine indicated by <inSelector>. If
+// <inSelector> isn't a valid routine selector, return back NULL.
+
+void *OmGetRoutineAddress(OmSelector inSelector)
+ OMDISPATCH_TRAP(omGetRoutineAddress);
+
+#ifdef __cplusplus
+ }
+#endif
+#endif
+
+#endif
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/PalmLocale.h b/SrcShared/Palm/Platform/Incs/Core/System/PalmLocale.h
new file mode 100644
index 0000000..895d5b4
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/PalmLocale.h
@@ -0,0 +1,1258 @@
+/******************************************************************************
+ *
+ * Copyright (c) 2000-2001 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: PalmLocale.h
+ *
+ * Release:
+ *
+ * Description:
+ * Public header for simple constants that support locales (information
+ * specific to locales and regions). This file is designed to support
+ * Rez in addition to C/C++.
+ *
+ * History:
+ * 05/31/00 CS Created by Chris Schneider (from LocaleMgr.h).
+ * 06/02/00 CS Moved character encoding constants in here (from TextMgr.h).
+ * 06/05/00 kwk Moved character encoding names in here (from TextMgr.h)
+ * Updated CP1252 charset name to "Windows-1252", as the new
+ * preferred standard. It was "ISO-8859-1-Windows-3.1-Latin-1".
+ * Added encodingNameUCS2. Fixed up some encoding constant names.
+ * 06/05/00 CS Hacked in changes for Rez, which doesn't support macro
+ * parameters in #defines.
+ * 06/06/00 CS Changed name form Locale.h to PalmLocale.h to avoid
+ * name collision with the Metrowerks Standard Library
+ * header Locale.h.
+ * CS Now use PALM_LOCALE_HAS_TYPES to control whether to
+ * use types (rather than just rez).
+ * 06/07/00 kwk Moved encoding name #defines out of conditional sections,
+ * since these don't depend on PALM_LOCALE_HAS_TYPES.
+ * kwk Fixed charEncodingMax - was 76, should be 75.
+ * 06/27/00 kwk Fixed charEncodingMax in the automatically generated section
+ * to also be 75.
+ * kwk Renumbered char encodings so that charEncodingUCS2 stays
+ * at 9 (where it was before I integrated with Michel), since
+ * the Sony version of TxtConvertEncoding relies on this.
+ * Basically swapped charEncodingUCS2 (was 25) with charEncodingEucJp
+ * (was 9).
+ * 07/21/00 kwk Added charEncodingUTF16, charEncodingUTF16BE, and charEncodingUTF16LE.
+ * The UTF16 encoding requires a BOM (byte order mark) in the text
+ * stream to identify big vs. little endian, while the other two
+ * are explicit. Note that for Palm OS, charEncodingUCS2 is the
+ * same as charEncodingUTF16BE without support for surrogates, but
+ * since we currently don't support characters > 16 bits, in reality
+ * charEncodingUTF16BE is more like charEncodingUCS2.
+ * kwk Updated charEncodingMax to be 77 (was 74).
+ * 08/01/00 kwk Changed cNewCalidonia to cNewCaledonia.
+ * 05/12/01 kwk Added charEncodingPalmGSM, and bumped the max encoding value to 78.
+ * kwk Added encodingNamePalmGSM, for when a MIME message is sent with
+ * any of the 10 special Greek characters.
+ * 07/01/01 kwk Changed charset name to be "palmGSM" to match Palm.net's current
+ * character set name.
+ * 07/15/01 kwk Added three additional Big5-based encodings (CP950, Big5Plus, PalmBig5).
+ * kwk Updated charEncodingMax to be 80 (was 77).
+ * kwk Added Big-5 related encoding names.
+ * 08/16/01 MT Added lLanguageNum and cCountryNum so Elaine has a compile warning
+ * when a new Lanaguage or Country (or Charset added with charEncodingMax)
+ * 10/25/01 kwk Merged w/GSM changes. charEncodingMax is now 81 (was 80).
+ * Shifted up the three new Big5-based encodings, since GSM
+ * has the encoding value of 78.
+ * 10/29/01 kwk Changed encodingNameBig5Plus to encodingNameBig5_HKSCS. Got rid
+ * of encodingNameCP950. Changed charEncodingCP950 to charEncodingBig5_HKSCS.
+ * 11/03/01 kwk Added GBK and PalmGB as character encoding values. Bumped max
+ * encoding to 83. Defined charset names for Simplified Chinese encodings.
+ *
+ *****************************************************************************/
+
+#ifndef __PALMLOCALE_H__
+#define __PALMLOCALE_H__
+
+
+// Names of the known encodings.
+#define encodingNameAscii "us-ascii"
+#define encodingNameISO8859_1 "ISO-8859-1"
+#define encodingNameCP1252 "Windows-1252"
+
+#define encodingNameShiftJIS "Shift_JIS"
+#define encodingNameCP932 "Windows-31J"
+
+#define encodingNameUTF8 "UTF-8"
+#define encodingNameUCS2 "ISO-10646-UCS-2"
+
+#define encodingNamePalmGSM "palmGSM"
+
+#define encodingNameBig5 "Big5"
+#define encodingNameBig5_HKSCS "Big5-HKSCS"
+
+// Note that as of 2001-11-03 there are no defined names for GBK/CP936 in the
+// IANA registry. It appears as though software uses GB2312 as the default name.
+#define encodingNameGB2312 "GB2312"
+#define encodingNameHZ "HZ-GB-2312"
+
+// Maximum length of any encoding name.
+#define maxEncodingNameLength 40
+
+/* Rez doesn't even support macros, so for Rez we must simplify all of the #defines.
+Thus, whenever you modify any constants, please do so in the !rez section,
+then execute the following MPW commands (from elsewhere with this file as the target)
+so that the Rez case will be automatically updated:
+
+Find ¥;Find /TAG SOURCE START/!1:/TAG SOURCE END/Á1
+Copy ¤
+Find ¥;Find /TAG DESTINATION START/!1:/TAG DESTINATION END/Á1
+Echo
+Paste ¤
+Find ¥;Find /TAG DESTINATION START/
+Replace -c ° /(#define[ ¶t]+l[a-z0-9_]+[ ¶t]+)¨1LANGUAGE_VALUE¶(([0-9]+)¨2¶)/ "¨1¨2"
+Replace -c ° /(#define[ ¶t]+c[a-z0-9_]+[ ¶t]+)¨1COUNTRY_VALUE¶(([0-9]+)¨2¶)/ "¨1¨2"
+Replace -c ° /(#define[ ¶t]+charEncoding[a-z0-9_]+[ ¶t]+)¨1CHAR_ENCODING_VALUE¶(([0-9]+)¨2¶)/ "¨1¨2"
+*/
+#if rez
+ #define PALM_LOCALE_HAS_TYPES 0
+#endif
+#ifndef PALM_LOCALE_HAS_TYPES
+ #define PALM_LOCALE_HAS_TYPES 1
+#endif
+
+
+#if PALM_LOCALE_HAS_TYPES // Normal (e.g., non-Rez) case
+
+/***********************************************************************
+ * Locale constants
+ **********************************************************************/
+
+/* Language codes (ISO 639). The first 8 preserve the old values for the deprecated
+LanguageType; the rest are sorted by the 2-character language code.
+
+WARNING! Keep in sync with BOTH:
+ 1) LanguageCode array in OverlayMgr.c
+ 2) localeLanguage #define in UIResDefs.r
+*/
+#define LANGUAGE_VALUE(value) ((LanguageType)value)
+
+// Leave the following line unchanged before 1st #define to be copied to rez section:
+// TAG SOURCE START
+
+#define lEnglish LANGUAGE_VALUE(0) // EN
+#define lFrench LANGUAGE_VALUE(1) // FR
+#define lGerman LANGUAGE_VALUE(2) // DE
+#define lItalian LANGUAGE_VALUE(3) // IT
+#define lSpanish LANGUAGE_VALUE(4) // ES
+#define lUnused LANGUAGE_VALUE(5) // Reserved
+
+// New in 3.1
+#define lJapanese LANGUAGE_VALUE(6) // JA (Palm calls this jp)
+#define lDutch LANGUAGE_VALUE(7) // NL
+
+// New in 4.0
+#define lAfar LANGUAGE_VALUE(8) // AA
+#define lAbkhazian LANGUAGE_VALUE(9) // AB
+#define lAfrikaans LANGUAGE_VALUE(10) // AF
+#define lAmharic LANGUAGE_VALUE(11) // AM
+#define lArabic LANGUAGE_VALUE(12) // AR
+#define lAssamese LANGUAGE_VALUE(13) // AS
+#define lAymara LANGUAGE_VALUE(14) // AY
+#define lAzerbaijani LANGUAGE_VALUE(15) // AZ
+#define lBashkir LANGUAGE_VALUE(16) // BA
+#define lByelorussian LANGUAGE_VALUE(17) // BE
+#define lBulgarian LANGUAGE_VALUE(18) // BG
+#define lBihari LANGUAGE_VALUE(19) // BH
+#define lBislama LANGUAGE_VALUE(20) // BI
+#define lBengali LANGUAGE_VALUE(21) // BN (Bangla)
+#define lTibetan LANGUAGE_VALUE(22) // BO
+#define lBreton LANGUAGE_VALUE(23) // BR
+#define lCatalan LANGUAGE_VALUE(24) // CA
+#define lCorsican LANGUAGE_VALUE(25) // CO
+#define lCzech LANGUAGE_VALUE(26) // CS
+#define lWelsh LANGUAGE_VALUE(27) // CY
+#define lDanish LANGUAGE_VALUE(28) // DA
+#define lBhutani LANGUAGE_VALUE(29) // DZ
+#define lGreek LANGUAGE_VALUE(30) // EL
+#define lEsperanto LANGUAGE_VALUE(31) // EO
+#define lEstonian LANGUAGE_VALUE(32) // ET
+#define lBasque LANGUAGE_VALUE(33) // EU
+#define lPersian LANGUAGE_VALUE(34) // FA (Farsi)
+#define lFinnish LANGUAGE_VALUE(35) // FI
+#define lFiji LANGUAGE_VALUE(36) // FJ
+#define lFaroese LANGUAGE_VALUE(37) // FO
+#define lFrisian LANGUAGE_VALUE(38) // FY
+#define lIrish LANGUAGE_VALUE(39) // GA
+#define lScotsGaelic LANGUAGE_VALUE(40) // GD
+#define lGalician LANGUAGE_VALUE(41) // GL
+#define lGuarani LANGUAGE_VALUE(42) // GN
+#define lGujarati LANGUAGE_VALUE(43) // GU
+#define lHausa LANGUAGE_VALUE(44) // HA
+#define lHindi LANGUAGE_VALUE(45) // HI
+#define lCroatian LANGUAGE_VALUE(46) // HR
+#define lHungarian LANGUAGE_VALUE(47) // HU
+#define lArmenian LANGUAGE_VALUE(48) // HY
+#define lInterlingua LANGUAGE_VALUE(49) // IA
+#define lInterlingue LANGUAGE_VALUE(50) // IE
+#define lInupiak LANGUAGE_VALUE(51) // IK
+#define lIndonesian LANGUAGE_VALUE(52) // IN
+#define lIcelandic LANGUAGE_VALUE(53) // IS
+#define lHebrew LANGUAGE_VALUE(54) // IW
+#define lYiddish LANGUAGE_VALUE(55) // JI
+#define lJavanese LANGUAGE_VALUE(56) // JW
+#define lGeorgian LANGUAGE_VALUE(57) // KA
+#define lKazakh LANGUAGE_VALUE(58) // KK
+#define lGreenlandic LANGUAGE_VALUE(59) // KL
+#define lCambodian LANGUAGE_VALUE(60) // KM
+#define lKannada LANGUAGE_VALUE(61) // KN
+#define lKorean LANGUAGE_VALUE(62) // KO
+#define lKashmiri LANGUAGE_VALUE(63) // KS
+#define lKurdish LANGUAGE_VALUE(64) // KU
+#define lKirghiz LANGUAGE_VALUE(65) // KY
+#define lLatin LANGUAGE_VALUE(66) // LA
+#define lLingala LANGUAGE_VALUE(67) // LN
+#define lLaothian LANGUAGE_VALUE(68) // LO
+#define lLithuanian LANGUAGE_VALUE(69) // LT
+#define lLatvian LANGUAGE_VALUE(70) // LV (Lettish)
+#define lMalagasy LANGUAGE_VALUE(71) // MG
+#define lMaori LANGUAGE_VALUE(72) // MI
+#define lMacedonian LANGUAGE_VALUE(73) // MK
+#define lMalayalam LANGUAGE_VALUE(74) // ML
+#define lMongolian LANGUAGE_VALUE(75) // MN
+#define lMoldavian LANGUAGE_VALUE(76) // MO
+#define lMarathi LANGUAGE_VALUE(77) // MR
+#define lMalay LANGUAGE_VALUE(78) // MS
+#define lMaltese LANGUAGE_VALUE(79) // MT
+#define lBurmese LANGUAGE_VALUE(80) // MY
+#define lNauru LANGUAGE_VALUE(81) // NA
+#define lNepali LANGUAGE_VALUE(82) // NE
+#define lNorwegian LANGUAGE_VALUE(83) // NO
+#define lOccitan LANGUAGE_VALUE(84) // OC
+#define lAfan LANGUAGE_VALUE(85) // OM (Oromo)
+#define lOriya LANGUAGE_VALUE(86) // OR
+#define lPunjabi LANGUAGE_VALUE(87) // PA
+#define lPolish LANGUAGE_VALUE(88) // PL
+#define lPashto LANGUAGE_VALUE(89) // PS (Pushto)
+#define lPortuguese LANGUAGE_VALUE(90) // PT
+#define lQuechua LANGUAGE_VALUE(91) // QU
+#define lRhaetoRomance LANGUAGE_VALUE(92) // RM
+#define lKurundi LANGUAGE_VALUE(93) // RN
+#define lRomanian LANGUAGE_VALUE(94) // RO
+#define lRussian LANGUAGE_VALUE(95) // RU
+#define lKinyarwanda LANGUAGE_VALUE(96) // RW
+#define lSanskrit LANGUAGE_VALUE(97) // SA
+#define lSindhi LANGUAGE_VALUE(98) // SD
+#define lSangho LANGUAGE_VALUE(99) // SG
+#define lSerboCroatian LANGUAGE_VALUE(100) // SH
+#define lSinghalese LANGUAGE_VALUE(101) // SI
+#define lSlovak LANGUAGE_VALUE(102) // SK
+#define lSlovenian LANGUAGE_VALUE(103) // SL
+#define lSamoan LANGUAGE_VALUE(104) // SM
+#define lShona LANGUAGE_VALUE(105) // SN
+#define lSomali LANGUAGE_VALUE(106) // SO
+#define lAlbanian LANGUAGE_VALUE(107) // SQ
+#define lSerbian LANGUAGE_VALUE(108) // SR
+#define lSiswati LANGUAGE_VALUE(109) // SS
+#define lSesotho LANGUAGE_VALUE(110) // ST
+#define lSudanese LANGUAGE_VALUE(111) // SU
+#define lSwedish LANGUAGE_VALUE(112) // SV
+#define lSwahili LANGUAGE_VALUE(113) // SW
+#define lTamil LANGUAGE_VALUE(114) // TA
+#define lTelugu LANGUAGE_VALUE(115) // TE
+#define lTajik LANGUAGE_VALUE(116) // TG
+#define lThai LANGUAGE_VALUE(117) // TH
+#define lTigrinya LANGUAGE_VALUE(118) // TI
+#define lTurkmen LANGUAGE_VALUE(119) // TK
+#define lTagalog LANGUAGE_VALUE(120) // TL
+#define lSetswana LANGUAGE_VALUE(121) // TN
+#define lTonga LANGUAGE_VALUE(122) // TO
+#define lTurkish LANGUAGE_VALUE(123) // TR
+#define lTsonga LANGUAGE_VALUE(124) // TS
+#define lTatar LANGUAGE_VALUE(125) // TT
+#define lTwi LANGUAGE_VALUE(126) // TW
+#define lUkrainian LANGUAGE_VALUE(127) // UK
+#define lUrdu LANGUAGE_VALUE(128) // UR
+#define lUzbek LANGUAGE_VALUE(129) // UZ
+#define lVietnamese LANGUAGE_VALUE(130) // VI
+#define lVolapuk LANGUAGE_VALUE(131) // VO
+#define lWolof LANGUAGE_VALUE(132) // WO
+#define lXhosa LANGUAGE_VALUE(133) // XH
+#define lYoruba LANGUAGE_VALUE(134) // YO
+#define lChinese LANGUAGE_VALUE(135) // ZH
+#define lZulu LANGUAGE_VALUE(136) // ZU
+//
+#define lLanguageNum LANGUAGE_VALUE(137) // Number of Languages
+
+/* Country codes (ISO 3166). The first 33 preserve the old values for the
+deprecated CountryType; the rest are sorted by the 2-character country code.
+
+WARNING! Keep in sync with BOTH:
+ 1) CountryCode array in OverlayMgr.c
+ 2) localeCountry #define in UIResDefs.r
+*/
+#define COUNTRY_VALUE(value) ((CountryType)value)
+
+#define cAustralia COUNTRY_VALUE(0) // AU
+#define cAustria COUNTRY_VALUE(1) // AT
+#define cBelgium COUNTRY_VALUE(2) // BE
+#define cBrazil COUNTRY_VALUE(3) // BR
+#define cCanada COUNTRY_VALUE(4) // CA
+#define cDenmark COUNTRY_VALUE(5) // DK
+#define cFinland COUNTRY_VALUE(6) // FI
+#define cFrance COUNTRY_VALUE(7) // FR
+#define cGermany COUNTRY_VALUE(8) // DE
+#define cHongKong COUNTRY_VALUE(9) // HK
+#define cIceland COUNTRY_VALUE(10) // IS
+#define cIreland COUNTRY_VALUE(11) // IE
+#define cItaly COUNTRY_VALUE(12) // IT
+#define cJapan COUNTRY_VALUE(13) // JP
+#define cLuxembourg COUNTRY_VALUE(14) // LU
+#define cMexico COUNTRY_VALUE(15) // MX
+#define cNetherlands COUNTRY_VALUE(16) // NL
+#define cNewZealand COUNTRY_VALUE(17) // NZ
+#define cNorway COUNTRY_VALUE(18) // NO
+#define cSpain COUNTRY_VALUE(19) // ES
+#define cSweden COUNTRY_VALUE(20) // SE
+#define cSwitzerland COUNTRY_VALUE(21) // CH
+#define cUnitedKingdom COUNTRY_VALUE(22) // GB (UK)
+#define cUnitedStates COUNTRY_VALUE(23) // US
+#define cIndia COUNTRY_VALUE(24) // IN
+#define cIndonesia COUNTRY_VALUE(25) // ID
+#define cRepublicOfKorea COUNTRY_VALUE(26) // KR
+#define cMalaysia COUNTRY_VALUE(27) // MY
+#define cChina COUNTRY_VALUE(28) // CN
+#define cPhilippines COUNTRY_VALUE(29) // PH
+#define cSingapore COUNTRY_VALUE(30) // SG
+#define cThailand COUNTRY_VALUE(31) // TH
+#define cTaiwan COUNTRY_VALUE(32) // TW
+
+// New in 4.0
+#define cAndorra COUNTRY_VALUE(33) // AD
+#define cUnitedArabEmirates COUNTRY_VALUE(34) // AE
+#define cAfghanistan COUNTRY_VALUE(35) // AF
+#define cAntiguaAndBarbuda COUNTRY_VALUE(36) // AG
+#define cAnguilla COUNTRY_VALUE(37) // AI
+#define cAlbania COUNTRY_VALUE(38) // AL
+#define cArmenia COUNTRY_VALUE(39) // AM
+#define cNetherlandsAntilles COUNTRY_VALUE(40) // AN
+#define cAngola COUNTRY_VALUE(41) // AO
+#define cAntarctica COUNTRY_VALUE(42) // AQ
+#define cArgentina COUNTRY_VALUE(43) // AR
+#define cAmericanSamoa COUNTRY_VALUE(44) // AS
+#define cAruba COUNTRY_VALUE(45) // AW
+#define cAzerbaijan COUNTRY_VALUE(46) // AZ
+#define cBosniaAndHerzegovina COUNTRY_VALUE(47) // BA
+#define cBarbados COUNTRY_VALUE(48) // BB
+#define cBangladesh COUNTRY_VALUE(49) // BD
+#define cBurkinaFaso COUNTRY_VALUE(50) // BF
+#define cBulgaria COUNTRY_VALUE(51) // BG
+#define cBahrain COUNTRY_VALUE(52) // BH
+#define cBurundi COUNTRY_VALUE(53) // BI
+#define cBenin COUNTRY_VALUE(54) // BJ
+#define cBermuda COUNTRY_VALUE(55) // BM
+#define cBruneiDarussalam COUNTRY_VALUE(56) // BN
+#define cBolivia COUNTRY_VALUE(57) // BO
+#define cBahamas COUNTRY_VALUE(58) // BS
+#define cBhutan COUNTRY_VALUE(59) // BT
+#define cBouvetIsland COUNTRY_VALUE(60) // BV
+#define cBotswana COUNTRY_VALUE(61) // BW
+#define cBelarus COUNTRY_VALUE(62) // BY
+#define cBelize COUNTRY_VALUE(63) // BZ
+#define cCocosIslands COUNTRY_VALUE(64) // CC
+#define cDemocraticRepublicOfTheCongo COUNTRY_VALUE(65) // CD
+#define cCentralAfricanRepublic COUNTRY_VALUE(66) // CF
+#define cCongo COUNTRY_VALUE(67) // CG
+#define cIvoryCoast COUNTRY_VALUE(68) // CI
+#define cCookIslands COUNTRY_VALUE(69) // CK
+#define cChile COUNTRY_VALUE(70) // CL
+#define cCameroon COUNTRY_VALUE(71) // CM
+#define cColumbia COUNTRY_VALUE(72) // CO
+#define cCostaRica COUNTRY_VALUE(73) // CR
+#define cCuba COUNTRY_VALUE(74) // CU
+#define cCapeVerde COUNTRY_VALUE(75) // CV
+#define cChristmasIsland COUNTRY_VALUE(76) // CX
+#define cCyprus COUNTRY_VALUE(77) // CY
+#define cCzechRepublic COUNTRY_VALUE(78) // CZ
+#define cDjibouti COUNTRY_VALUE(79) // DJ
+#define cDominica COUNTRY_VALUE(80) // DM
+#define cDominicanRepublic COUNTRY_VALUE(81) // DO
+#define cAlgeria COUNTRY_VALUE(82) // DZ
+#define cEcuador COUNTRY_VALUE(83) // EC
+#define cEstonia COUNTRY_VALUE(84) // EE
+#define cEgypt COUNTRY_VALUE(85) // EG
+#define cWesternSahara COUNTRY_VALUE(86) // EH
+#define cEritrea COUNTRY_VALUE(87) // ER
+#define cEthiopia COUNTRY_VALUE(88) // ET
+#define cFiji COUNTRY_VALUE(89) // FJ
+#define cFalklandIslands COUNTRY_VALUE(90) // FK
+#define cMicronesia COUNTRY_VALUE(91) // FM
+#define cFaeroeIslands COUNTRY_VALUE(92) // FO
+#define cMetropolitanFrance COUNTRY_VALUE(93) // FX
+#define cGabon COUNTRY_VALUE(94) // GA
+#define cGrenada COUNTRY_VALUE(95) // GD
+#define cGeorgia COUNTRY_VALUE(96) // GE
+#define cFrenchGuiana COUNTRY_VALUE(97) // GF
+#define cGhana COUNTRY_VALUE(98) // GH
+#define cGibraltar COUNTRY_VALUE(99) // GI
+#define cGreenland COUNTRY_VALUE(100) // GL
+#define cGambia COUNTRY_VALUE(101) // GM
+#define cGuinea COUNTRY_VALUE(102) // GN
+#define cGuadeloupe COUNTRY_VALUE(103) // GP
+#define cEquatorialGuinea COUNTRY_VALUE(104) // GQ
+#define cGreece COUNTRY_VALUE(105) // GR
+#define cSouthGeorgiaAndTheSouthSandwichIslands COUNTRY_VALUE(106) // GS
+#define cGuatemala COUNTRY_VALUE(107) // GT
+#define cGuam COUNTRY_VALUE(108) // GU
+#define cGuineaBisseu COUNTRY_VALUE(109) // GW
+#define cGuyana COUNTRY_VALUE(110) // GY
+#define cHeardAndMcDonaldIslands COUNTRY_VALUE(111) // HM
+#define cHonduras COUNTRY_VALUE(112) // HN
+#define cCroatia COUNTRY_VALUE(113) // HR
+#define cHaiti COUNTRY_VALUE(114) // HT
+#define cHungary COUNTRY_VALUE(115) // HU
+#define cIsrael COUNTRY_VALUE(116) // IL
+#define cBritishIndianOceanTerritory COUNTRY_VALUE(117) // IO
+#define cIraq COUNTRY_VALUE(118) // IQ
+#define cIran COUNTRY_VALUE(119) // IR
+#define cJamaica COUNTRY_VALUE(120) // JM
+#define cJordan COUNTRY_VALUE(121) // JO
+#define cKenya COUNTRY_VALUE(122) // KE
+#define cKyrgyzstan COUNTRY_VALUE(123) // KG (Kirgistan)
+#define cCambodia COUNTRY_VALUE(124) // KH
+#define cKiribati COUNTRY_VALUE(125) // KI
+#define cComoros COUNTRY_VALUE(126) // KM
+#define cStKittsAndNevis COUNTRY_VALUE(127) // KN
+#define cDemocraticPeoplesRepublicOfKorea COUNTRY_VALUE(128) // KP
+#define cKuwait COUNTRY_VALUE(129) // KW
+#define cCaymanIslands COUNTRY_VALUE(130) // KY
+#define cKazakhstan COUNTRY_VALUE(131) // KK
+#define cLaos COUNTRY_VALUE(132) // LA
+#define cLebanon COUNTRY_VALUE(133) // LB
+#define cStLucia COUNTRY_VALUE(134) // LC
+#define cLiechtenstein COUNTRY_VALUE(135) // LI
+#define cSriLanka COUNTRY_VALUE(136) // LK
+#define cLiberia COUNTRY_VALUE(137) // LR
+#define cLesotho COUNTRY_VALUE(138) // LS
+#define cLithuania COUNTRY_VALUE(139) // LT
+#define cLatvia COUNTRY_VALUE(140) // LV
+#define cLibya COUNTRY_VALUE(141) // LY
+#define cMorrocco COUNTRY_VALUE(142) // MA
+#define cMonaco COUNTRY_VALUE(143) // MC
+#define cMoldova COUNTRY_VALUE(144) // MD
+#define cMadagascar COUNTRY_VALUE(145) // MG
+#define cMarshallIslands COUNTRY_VALUE(146) // MH
+#define cMacedonia COUNTRY_VALUE(147) // MK
+#define cMali COUNTRY_VALUE(148) // ML
+#define cMyanmar COUNTRY_VALUE(149) // MM
+#define cMongolia COUNTRY_VALUE(150) // MN
+#define cMacau COUNTRY_VALUE(151) // MO
+#define cNorthernMarianaIslands COUNTRY_VALUE(152) // MP
+#define cMartinique COUNTRY_VALUE(153) // MQ
+#define cMauritania COUNTRY_VALUE(154) // MR
+#define cMontserrat COUNTRY_VALUE(155) // MS
+#define cMalta COUNTRY_VALUE(156) // MT
+#define cMauritius COUNTRY_VALUE(157) // MU
+#define cMaldives COUNTRY_VALUE(158) // MV
+#define cMalawi COUNTRY_VALUE(159) // MW
+#define cMozambique COUNTRY_VALUE(160) // MZ
+#define cNamibia COUNTRY_VALUE(161) // NA
+#define cNewCaledonia COUNTRY_VALUE(162) // NC
+#define cNiger COUNTRY_VALUE(163) // NE
+#define cNorfolkIsland COUNTRY_VALUE(164) // NF
+#define cNigeria COUNTRY_VALUE(165) // NG
+#define cNicaragua COUNTRY_VALUE(166) // NI
+#define cNepal COUNTRY_VALUE(167) // NP
+#define cNauru COUNTRY_VALUE(168) // NR
+#define cNiue COUNTRY_VALUE(169) // NU
+#define cOman COUNTRY_VALUE(170) // OM
+#define cPanama COUNTRY_VALUE(171) // PA
+#define cPeru COUNTRY_VALUE(172) // PE
+#define cFrenchPolynesia COUNTRY_VALUE(173) // PF
+#define cPapuaNewGuinea COUNTRY_VALUE(174) // PG
+#define cPakistan COUNTRY_VALUE(175) // PK
+#define cPoland COUNTRY_VALUE(176) // PL
+#define cStPierreAndMiquelon COUNTRY_VALUE(177) // PM
+#define cPitcairn COUNTRY_VALUE(178) // PN
+#define cPuertoRico COUNTRY_VALUE(179) // PR
+#define cPortugal COUNTRY_VALUE(180) // PT
+#define cPalau COUNTRY_VALUE(181) // PW
+#define cParaguay COUNTRY_VALUE(182) // PY
+#define cQatar COUNTRY_VALUE(183) // QA
+#define cReunion COUNTRY_VALUE(184) // RE
+#define cRomania COUNTRY_VALUE(185) // RO
+#define cRussianFederation COUNTRY_VALUE(186) // RU
+#define cRwanda COUNTRY_VALUE(187) // RW
+#define cSaudiArabia COUNTRY_VALUE(188) // SA
+#define cSolomonIslands COUNTRY_VALUE(189) // SB
+#define cSeychelles COUNTRY_VALUE(190) // SC
+#define cSudan COUNTRY_VALUE(191) // SD
+#define cStHelena COUNTRY_VALUE(192) // SH
+#define cSlovenia COUNTRY_VALUE(193) // SI
+#define cSvalbardAndJanMayenIslands COUNTRY_VALUE(194) // SJ
+#define cSlovakia COUNTRY_VALUE(195) // SK
+#define cSierraLeone COUNTRY_VALUE(196) // SL
+#define cSanMarino COUNTRY_VALUE(197) // SM
+#define cSenegal COUNTRY_VALUE(198) // SN
+#define cSomalia COUNTRY_VALUE(199) // SO
+#define cSuriname COUNTRY_VALUE(200) // SR
+#define cSaoTomeAndPrincipe COUNTRY_VALUE(201) // ST
+#define cElSalvador COUNTRY_VALUE(202) // SV
+#define cSyranArabRepublic COUNTRY_VALUE(203) // SY
+#define cSwaziland COUNTRY_VALUE(204) // SZ
+#define cTurksAndCaicosIslands COUNTRY_VALUE(205) // TC
+#define cChad COUNTRY_VALUE(206) // TD
+#define cFrenchSouthernTerritories COUNTRY_VALUE(207) // TF
+#define cTogo COUNTRY_VALUE(208) // TG
+#define cTajikistan COUNTRY_VALUE(209) // TJ
+#define cTokelau COUNTRY_VALUE(210) // TK
+#define cTurkmenistan COUNTRY_VALUE(211) // TM
+#define cTunisia COUNTRY_VALUE(212) // TN
+#define cTonga COUNTRY_VALUE(213) // TO
+#define cEastTimor COUNTRY_VALUE(214) // TP
+#define cTurkey COUNTRY_VALUE(215) // TR
+#define cTrinidadAndTobago COUNTRY_VALUE(216) // TT
+#define cTuvalu COUNTRY_VALUE(217) // TV
+#define cTanzania COUNTRY_VALUE(218) // TZ
+#define cUkraine COUNTRY_VALUE(219) // UA
+#define cUganda COUNTRY_VALUE(220) // UG
+#define cUnitedStatesMinorOutlyingIslands COUNTRY_VALUE(221) // UM
+#define cUruguay COUNTRY_VALUE(222) // UY
+#define cUzbekistan COUNTRY_VALUE(223) // UZ
+#define cHolySee COUNTRY_VALUE(224) // VA
+#define cStVincentAndTheGrenadines COUNTRY_VALUE(225) // VC
+#define cVenezuela COUNTRY_VALUE(226) // VE
+#define cBritishVirginIslands COUNTRY_VALUE(227) // VG
+#define cUSVirginIslands COUNTRY_VALUE(228) // VI
+#define cVietNam COUNTRY_VALUE(229) // VN
+#define cVanuatu COUNTRY_VALUE(230) // VU
+#define cWallisAndFutunaIslands COUNTRY_VALUE(231) // WF
+#define cSamoa COUNTRY_VALUE(232) // WS
+#define cYemen COUNTRY_VALUE(233) // YE
+#define cMayotte COUNTRY_VALUE(234) // YT
+#define cYugoslavia COUNTRY_VALUE(235) // YU
+#define cSouthAfrica COUNTRY_VALUE(236) // ZA
+#define cZambia COUNTRY_VALUE(237) // ZM
+#define cZimbabwe COUNTRY_VALUE(238) // ZW
+//
+#define cCountryNum COUNTRY_VALUE(239) // Number of Countries
+
+/* Various character encodings supported by the PalmOS. Actually these
+are a mixture of character sets (repetoires or coded character sets
+in Internet lingo) and character encodings (CES - character encoding
+standard). Many, however, are some of both (e.g. CP932 is the Shift-JIS
+encoding of the JIS character set + Microsoft's extensions).
+
+The following character set values are used by:
+ a) Palm devices
+ b) Palm wireless servers
+
+WARNING! Be aware that a device supporting a new character set
+ will require some character set definition and maybe
+ some development on the wireless server side.
+*/
+#define CHAR_ENCODING_VALUE(value) ((CharEncodingType)value)
+
+// Unknown to this version of PalmOS.
+#define charEncodingUnknown CHAR_ENCODING_VALUE(0)
+
+// Maximum character encoding _currently_ defined
+#define charEncodingMax CHAR_ENCODING_VALUE(83)
+
+// Latin Palm OS character encoding, and subsets.
+// PalmOS variant of CP1252, with 10 extra Greek characters
+#define charEncodingPalmGSM CHAR_ENCODING_VALUE(78)
+// PalmOS version of CP1252
+#define charEncodingPalmLatin CHAR_ENCODING_VALUE(3)
+// Windows variant of 8859-1
+#define charEncodingCP1252 CHAR_ENCODING_VALUE(7)
+// ISO 8859 Part 1
+#define charEncodingISO8859_1 CHAR_ENCODING_VALUE(2)
+// ISO 646-1991
+#define charEncodingAscii CHAR_ENCODING_VALUE(1)
+
+// Japanese Palm OS character encoding, and subsets.
+// PalmOS version of CP932
+#define charEncodingPalmSJIS CHAR_ENCODING_VALUE(5)
+// Windows variant of ShiftJIS
+#define charEncodingCP932 CHAR_ENCODING_VALUE(8)
+// Encoding for JIS 0208-1990 + 1-byte katakana
+#define charEncodingShiftJIS CHAR_ENCODING_VALUE(4)
+
+// Unicode character encodings
+#define charEncodingUCS2 CHAR_ENCODING_VALUE(9)
+#define charEncodingUTF8 CHAR_ENCODING_VALUE(6)
+#define charEncodingUTF7 CHAR_ENCODING_VALUE(24)
+#define charEncodingUTF16 CHAR_ENCODING_VALUE(75)
+#define charEncodingUTF16BE CHAR_ENCODING_VALUE(76)
+#define charEncodingUTF16LE CHAR_ENCODING_VALUE(77)
+
+// Latin character encodings
+#define charEncodingCP850 CHAR_ENCODING_VALUE(12)
+#define charEncodingCP437 CHAR_ENCODING_VALUE(13)
+#define charEncodingCP865 CHAR_ENCODING_VALUE(14)
+#define charEncodingCP860 CHAR_ENCODING_VALUE(15)
+#define charEncodingCP861 CHAR_ENCODING_VALUE(16)
+#define charEncodingCP863 CHAR_ENCODING_VALUE(17)
+#define charEncodingCP775 CHAR_ENCODING_VALUE(18)
+#define charEncodingMacIslande CHAR_ENCODING_VALUE(19)
+#define charEncodingMacintosh CHAR_ENCODING_VALUE(20)
+#define charEncodingCP1257 CHAR_ENCODING_VALUE(21)
+#define charEncodingISO8859_3 CHAR_ENCODING_VALUE(22)
+#define charEncodingISO8859_4 CHAR_ENCODING_VALUE(23)
+
+// Extended Latin character encodings
+#define charEncodingISO8859_2 CHAR_ENCODING_VALUE(26)
+#define charEncodingCP1250 CHAR_ENCODING_VALUE(27)
+#define charEncodingCP852 CHAR_ENCODING_VALUE(28)
+#define charEncodingXKamenicky CHAR_ENCODING_VALUE(29)
+#define charEncodingMacXCroate CHAR_ENCODING_VALUE(30)
+#define charEncodingMacXLat2 CHAR_ENCODING_VALUE(31)
+#define charEncodingMacXRomania CHAR_ENCODING_VALUE(32)
+
+// Japanese character encodings
+#define charEncodingEucJp CHAR_ENCODING_VALUE(25)
+#define charEncodingISO2022Jp CHAR_ENCODING_VALUE(10)
+#define charEncodingXAutoJp CHAR_ENCODING_VALUE(11)
+
+// Greek character encodings
+#define charEncodingISO8859_7 CHAR_ENCODING_VALUE(33)
+#define charEncodingCP1253 CHAR_ENCODING_VALUE(34)
+#define charEncodingCP869 CHAR_ENCODING_VALUE(35)
+#define charEncodingCP737 CHAR_ENCODING_VALUE(36)
+#define charEncodingMacXGr CHAR_ENCODING_VALUE(37)
+
+// Cyrillic character encodings
+#define charEncodingCP1251 CHAR_ENCODING_VALUE(38)
+#define charEncodingISO8859_5 CHAR_ENCODING_VALUE(39)
+#define charEncodingKoi8R CHAR_ENCODING_VALUE(40)
+#define charEncodingKoi8 CHAR_ENCODING_VALUE(41)
+#define charEncodingCP855 CHAR_ENCODING_VALUE(42)
+#define charEncodingCP866 CHAR_ENCODING_VALUE(43)
+#define charEncodingMacCyr CHAR_ENCODING_VALUE(44)
+#define charEncodingMacUkraine CHAR_ENCODING_VALUE(45)
+
+// Turkish character encodings
+#define charEncodingCP1254 CHAR_ENCODING_VALUE(46)
+#define charEncodingISO8859_9 CHAR_ENCODING_VALUE(47)
+#define charEncodingCP857 CHAR_ENCODING_VALUE(48)
+#define charEncodingMacTurc CHAR_ENCODING_VALUE(49)
+#define charEncodingCP853 CHAR_ENCODING_VALUE(50)
+
+// Arabic character encodings
+#define charEncodingISO8859_6 CHAR_ENCODING_VALUE(51)
+#define charEncodingAsmo708 CHAR_ENCODING_VALUE(52)
+#define charEncodingCP1256 CHAR_ENCODING_VALUE(53)
+#define charEncodingCP864 CHAR_ENCODING_VALUE(54)
+#define charEncodingAsmo708Plus CHAR_ENCODING_VALUE(55)
+#define charEncodingAsmo708Fr CHAR_ENCODING_VALUE(56)
+#define charEncodingMacAra CHAR_ENCODING_VALUE(57)
+
+// Simplified Chinese character encodings
+#define charEncodingGB2312 CHAR_ENCODING_VALUE(58)
+#define charEncodingHZ CHAR_ENCODING_VALUE(59)
+#define charEncodingGBK CHAR_ENCODING_VALUE(82)
+#define charEncodingPalmGB CHAR_ENCODING_VALUE(83)
+
+// Traditional Chinese character encodings
+#define charEncodingBig5 CHAR_ENCODING_VALUE(60)
+#define charEncodingBig5_HKSCS CHAR_ENCODING_VALUE(79)
+#define charEncodingBig5Plus CHAR_ENCODING_VALUE(80)
+#define charEncodingPalmBig5 CHAR_ENCODING_VALUE(81)
+
+// Vietnamese character encodings
+#define charEncodingViscii CHAR_ENCODING_VALUE(61)
+#define charEncodingViqr CHAR_ENCODING_VALUE(62)
+#define charEncodingVncii CHAR_ENCODING_VALUE(63)
+#define charEncodingVietnet CHAR_ENCODING_VALUE(65)
+#define charEncodingCP1258 CHAR_ENCODING_VALUE(66)
+
+// Korean character encodings
+#define charEncodingKsc5601 CHAR_ENCODING_VALUE(67)
+#define charEncodingCP949 CHAR_ENCODING_VALUE(68)
+#define charEncodingISO2022Kr CHAR_ENCODING_VALUE(69)
+
+// Hebrew character encodings
+#define charEncodingISO8859_8I CHAR_ENCODING_VALUE(70)
+#define charEncodingISO8859_8 CHAR_ENCODING_VALUE(71)
+#define charEncodingCP1255 CHAR_ENCODING_VALUE(72)
+#define charEncodingCP1255V CHAR_ENCODING_VALUE(73)
+
+// Thai character encodings
+#define charEncodingTis620 CHAR_ENCODING_VALUE(74)
+#define charEncodingCP874 CHAR_ENCODING_VALUE(64)
+
+
+// Leave the following line unchanged at end of section:
+// TAG SOURCE END
+
+/* Rez doesn't even support macros, so for Rez we simplify all of the #defines.
+
+WARNING! This section is auto-generated (see comment near top of file).
+*/
+#else // !PALM_LOCALE_HAS_TYPES
+
+// Leave the following line unchanged at beginning of rez section
+// TAG DESTINATION START
+
+#define lEnglish 0 // EN
+#define lFrench 1 // FR
+#define lGerman 2 // DE
+#define lItalian 3 // IT
+#define lSpanish 4 // ES
+#define lUnused 5 // Reserved
+
+// New in 3.1
+#define lJapanese 6 // JA (Palm calls this jp)
+#define lDutch 7 // NL
+
+// New in 4.0
+#define lAfar 8 // AA
+#define lAbkhazian 9 // AB
+#define lAfrikaans 10 // AF
+#define lAmharic 11 // AM
+#define lArabic 12 // AR
+#define lAssamese 13 // AS
+#define lAymara 14 // AY
+#define lAzerbaijani 15 // AZ
+#define lBashkir 16 // BA
+#define lByelorussian 17 // BE
+#define lBulgarian 18 // BG
+#define lBihari 19 // BH
+#define lBislama 20 // BI
+#define lBengali 21 // BN (Bangla)
+#define lTibetan 22 // BO
+#define lBreton 23 // BR
+#define lCatalan 24 // CA
+#define lCorsican 25 // CO
+#define lCzech 26 // CS
+#define lWelsh 27 // CY
+#define lDanish 28 // DA
+#define lBhutani 29 // DZ
+#define lGreek 30 // EL
+#define lEsperanto 31 // EO
+#define lEstonian 32 // ET
+#define lBasque 33 // EU
+#define lPersian 34 // FA (Farsi)
+#define lFinnish 35 // FI
+#define lFiji 36 // FJ
+#define lFaroese 37 // FO
+#define lFrisian 38 // FY
+#define lIrish 39 // GA
+#define lScotsGaelic 40 // GD
+#define lGalician 41 // GL
+#define lGuarani 42 // GN
+#define lGujarati 43 // GU
+#define lHausa 44 // HA
+#define lHindi 45 // HI
+#define lCroatian 46 // HR
+#define lHungarian 47 // HU
+#define lArmenian 48 // HY
+#define lInterlingua 49 // IA
+#define lInterlingue 50 // IE
+#define lInupiak 51 // IK
+#define lIndonesian 52 // IN
+#define lIcelandic 53 // IS
+#define lHebrew 54 // IW
+#define lYiddish 55 // JI
+#define lJavanese 56 // JW
+#define lGeorgian 57 // KA
+#define lKazakh 58 // KK
+#define lGreenlandic 59 // KL
+#define lCambodian 60 // KM
+#define lKannada 61 // KN
+#define lKorean 62 // KO
+#define lKashmiri 63 // KS
+#define lKurdish 64 // KU
+#define lKirghiz 65 // KY
+#define lLatin 66 // LA
+#define lLingala 67 // LN
+#define lLaothian 68 // LO
+#define lLithuanian 69 // LT
+#define lLatvian 70 // LV (Lettish)
+#define lMalagasy 71 // MG
+#define lMaori 72 // MI
+#define lMacedonian 73 // MK
+#define lMalayalam 74 // ML
+#define lMongolian 75 // MN
+#define lMoldavian 76 // MO
+#define lMarathi 77 // MR
+#define lMalay 78 // MS
+#define lMaltese 79 // MT
+#define lBurmese 80 // MY
+#define lNauru 81 // NA
+#define lNepali 82 // NE
+#define lNorwegian 83 // NO
+#define lOccitan 84 // OC
+#define lAfan 85 // OM (Oromo)
+#define lOriya 86 // OR
+#define lPunjabi 87 // PA
+#define lPolish 88 // PL
+#define lPashto 89 // PS (Pushto)
+#define lPortuguese 90 // PT
+#define lQuechua 91 // QU
+#define lRhaetoRomance 92 // RM
+#define lKurundi 93 // RN
+#define lRomanian 94 // RO
+#define lRussian 95 // RU
+#define lKinyarwanda 96 // RW
+#define lSanskrit 97 // SA
+#define lSindhi 98 // SD
+#define lSangho 99 // SG
+#define lSerboCroatian 100 // SH
+#define lSinghalese 101 // SI
+#define lSlovak 102 // SK
+#define lSlovenian 103 // SL
+#define lSamoan 104 // SM
+#define lShona 105 // SN
+#define lSomali 106 // SO
+#define lAlbanian 107 // SQ
+#define lSerbian 108 // SR
+#define lSiswati 109 // SS
+#define lSesotho 110 // ST
+#define lSudanese 111 // SU
+#define lSwedish 112 // SV
+#define lSwahili 113 // SW
+#define lTamil 114 // TA
+#define lTelugu 115 // TE
+#define lTajik 116 // TG
+#define lThai 117 // TH
+#define lTigrinya 118 // TI
+#define lTurkmen 119 // TK
+#define lTagalog 120 // TL
+#define lSetswana 121 // TN
+#define lTonga 122 // TO
+#define lTurkish 123 // TR
+#define lTsonga 124 // TS
+#define lTatar 125 // TT
+#define lTwi 126 // TW
+#define lUkrainian 127 // UK
+#define lUrdu 128 // UR
+#define lUzbek 129 // UZ
+#define lVietnamese 130 // VI
+#define lVolapuk 131 // VO
+#define lWolof 132 // WO
+#define lXhosa 133 // XH
+#define lYoruba 134 // YO
+#define lChinese 135 // ZH
+#define lZulu 136 // ZU
+//
+#define lLanguageNum 137 // Number of Languages
+
+/* Country codes (ISO 3166). The first 33 preserve the old values for the
+deprecated CountryType; the rest are sorted by the 2-character country code.
+
+WARNING! Keep in sync with BOTH:
+ 1) CountryCode array in OverlayMgr.c
+ 2) localeCountry #define in UIResDefs.r
+*/
+#define COUNTRY_VALUE(value) ((CountryType)value)
+
+#define cAustralia 0 // AU
+#define cAustria 1 // AT
+#define cBelgium 2 // BE
+#define cBrazil 3 // BR
+#define cCanada 4 // CA
+#define cDenmark 5 // DK
+#define cFinland 6 // FI
+#define cFrance 7 // FR
+#define cGermany 8 // DE
+#define cHongKong 9 // HK
+#define cIceland 10 // IS
+#define cIreland 11 // IE
+#define cItaly 12 // IT
+#define cJapan 13 // JP
+#define cLuxembourg 14 // LU
+#define cMexico 15 // MX
+#define cNetherlands 16 // NL
+#define cNewZealand 17 // NZ
+#define cNorway 18 // NO
+#define cSpain 19 // ES
+#define cSweden 20 // SE
+#define cSwitzerland 21 // CH
+#define cUnitedKingdom 22 // GB (UK)
+#define cUnitedStates 23 // US
+#define cIndia 24 // IN
+#define cIndonesia 25 // ID
+#define cRepublicOfKorea 26 // KR
+#define cMalaysia 27 // MY
+#define cChina 28 // CN
+#define cPhilippines 29 // PH
+#define cSingapore 30 // SG
+#define cThailand 31 // TH
+#define cTaiwan 32 // TW
+
+// New in 4.0
+#define cAndorra 33 // AD
+#define cUnitedArabEmirates 34 // AE
+#define cAfghanistan 35 // AF
+#define cAntiguaAndBarbuda 36 // AG
+#define cAnguilla 37 // AI
+#define cAlbania 38 // AL
+#define cArmenia 39 // AM
+#define cNetherlandsAntilles 40 // AN
+#define cAngola 41 // AO
+#define cAntarctica 42 // AQ
+#define cArgentina 43 // AR
+#define cAmericanSamoa 44 // AS
+#define cAruba 45 // AW
+#define cAzerbaijan 46 // AZ
+#define cBosniaAndHerzegovina 47 // BA
+#define cBarbados 48 // BB
+#define cBangladesh 49 // BD
+#define cBurkinaFaso 50 // BF
+#define cBulgaria 51 // BG
+#define cBahrain 52 // BH
+#define cBurundi 53 // BI
+#define cBenin 54 // BJ
+#define cBermuda 55 // BM
+#define cBruneiDarussalam 56 // BN
+#define cBolivia 57 // BO
+#define cBahamas 58 // BS
+#define cBhutan 59 // BT
+#define cBouvetIsland 60 // BV
+#define cBotswana 61 // BW
+#define cBelarus 62 // BY
+#define cBelize 63 // BZ
+#define cCocosIslands 64 // CC
+#define cDemocraticRepublicOfTheCongo 65 // CD
+#define cCentralAfricanRepublic 66 // CF
+#define cCongo 67 // CG
+#define cIvoryCoast 68 // CI
+#define cCookIslands 69 // CK
+#define cChile 70 // CL
+#define cCameroon 71 // CM
+#define cColumbia 72 // CO
+#define cCostaRica 73 // CR
+#define cCuba 74 // CU
+#define cCapeVerde 75 // CV
+#define cChristmasIsland 76 // CX
+#define cCyprus 77 // CY
+#define cCzechRepublic 78 // CZ
+#define cDjibouti 79 // DJ
+#define cDominica 80 // DM
+#define cDominicanRepublic 81 // DO
+#define cAlgeria 82 // DZ
+#define cEcuador 83 // EC
+#define cEstonia 84 // EE
+#define cEgypt 85 // EG
+#define cWesternSahara 86 // EH
+#define cEritrea 87 // ER
+#define cEthiopia 88 // ET
+#define cFiji 89 // FJ
+#define cFalklandIslands 90 // FK
+#define cMicronesia 91 // FM
+#define cFaeroeIslands 92 // FO
+#define cMetropolitanFrance 93 // FX
+#define cGabon 94 // GA
+#define cGrenada 95 // GD
+#define cGeorgia 96 // GE
+#define cFrenchGuiana 97 // GF
+#define cGhana 98 // GH
+#define cGibraltar 99 // GI
+#define cGreenland 100 // GL
+#define cGambia 101 // GM
+#define cGuinea 102 // GN
+#define cGuadeloupe 103 // GP
+#define cEquatorialGuinea 104 // GQ
+#define cGreece 105 // GR
+#define cSouthGeorgiaAndTheSouthSandwichIslands 106 // GS
+#define cGuatemala 107 // GT
+#define cGuam 108 // GU
+#define cGuineaBisseu 109 // GW
+#define cGuyana 110 // GY
+#define cHeardAndMcDonaldIslands 111 // HM
+#define cHonduras 112 // HN
+#define cCroatia 113 // HR
+#define cHaiti 114 // HT
+#define cHungary 115 // HU
+#define cIsrael 116 // IL
+#define cBritishIndianOceanTerritory 117 // IO
+#define cIraq 118 // IQ
+#define cIran 119 // IR
+#define cJamaica 120 // JM
+#define cJordan 121 // JO
+#define cKenya 122 // KE
+#define cKyrgyzstan 123 // KG (Kirgistan)
+#define cCambodia 124 // KH
+#define cKiribati 125 // KI
+#define cComoros 126 // KM
+#define cStKittsAndNevis 127 // KN
+#define cDemocraticPeoplesRepublicOfKorea 128 // KP
+#define cKuwait 129 // KW
+#define cCaymanIslands 130 // KY
+#define cKazakhstan 131 // KK
+#define cLaos 132 // LA
+#define cLebanon 133 // LB
+#define cStLucia 134 // LC
+#define cLiechtenstein 135 // LI
+#define cSriLanka 136 // LK
+#define cLiberia 137 // LR
+#define cLesotho 138 // LS
+#define cLithuania 139 // LT
+#define cLatvia 140 // LV
+#define cLibya 141 // LY
+#define cMorrocco 142 // MA
+#define cMonaco 143 // MC
+#define cMoldova 144 // MD
+#define cMadagascar 145 // MG
+#define cMarshallIslands 146 // MH
+#define cMacedonia 147 // MK
+#define cMali 148 // ML
+#define cMyanmar 149 // MM
+#define cMongolia 150 // MN
+#define cMacau 151 // MO
+#define cNorthernMarianaIslands 152 // MP
+#define cMartinique 153 // MQ
+#define cMauritania 154 // MR
+#define cMontserrat 155 // MS
+#define cMalta 156 // MT
+#define cMauritius 157 // MU
+#define cMaldives 158 // MV
+#define cMalawi 159 // MW
+#define cMozambique 160 // MZ
+#define cNamibia 161 // NA
+#define cNewCaledonia 162 // NC
+#define cNiger 163 // NE
+#define cNorfolkIsland 164 // NF
+#define cNigeria 165 // NG
+#define cNicaragua 166 // NI
+#define cNepal 167 // NP
+#define cNauru 168 // NR
+#define cNiue 169 // NU
+#define cOman 170 // OM
+#define cPanama 171 // PA
+#define cPeru 172 // PE
+#define cFrenchPolynesia 173 // PF
+#define cPapuaNewGuinea 174 // PG
+#define cPakistan 175 // PK
+#define cPoland 176 // PL
+#define cStPierreAndMiquelon 177 // PM
+#define cPitcairn 178 // PN
+#define cPuertoRico 179 // PR
+#define cPortugal 180 // PT
+#define cPalau 181 // PW
+#define cParaguay 182 // PY
+#define cQatar 183 // QA
+#define cReunion 184 // RE
+#define cRomania 185 // RO
+#define cRussianFederation 186 // RU
+#define cRwanda 187 // RW
+#define cSaudiArabia 188 // SA
+#define cSolomonIslands 189 // SB
+#define cSeychelles 190 // SC
+#define cSudan 191 // SD
+#define cStHelena 192 // SH
+#define cSlovenia 193 // SI
+#define cSvalbardAndJanMayenIslands 194 // SJ
+#define cSlovakia 195 // SK
+#define cSierraLeone 196 // SL
+#define cSanMarino 197 // SM
+#define cSenegal 198 // SN
+#define cSomalia 199 // SO
+#define cSuriname 200 // SR
+#define cSaoTomeAndPrincipe 201 // ST
+#define cElSalvador 202 // SV
+#define cSyranArabRepublic 203 // SY
+#define cSwaziland 204 // SZ
+#define cTurksAndCaicosIslands 205 // TC
+#define cChad 206 // TD
+#define cFrenchSouthernTerritories 207 // TF
+#define cTogo 208 // TG
+#define cTajikistan 209 // TJ
+#define cTokelau 210 // TK
+#define cTurkmenistan 211 // TM
+#define cTunisia 212 // TN
+#define cTonga 213 // TO
+#define cEastTimor 214 // TP
+#define cTurkey 215 // TR
+#define cTrinidadAndTobago 216 // TT
+#define cTuvalu 217 // TV
+#define cTanzania 218 // TZ
+#define cUkraine 219 // UA
+#define cUganda 220 // UG
+#define cUnitedStatesMinorOutlyingIslands 221 // UM
+#define cUruguay 222 // UY
+#define cUzbekistan 223 // UZ
+#define cHolySee 224 // VA
+#define cStVincentAndTheGrenadines 225 // VC
+#define cVenezuela 226 // VE
+#define cBritishVirginIslands 227 // VG
+#define cUSVirginIslands 228 // VI
+#define cVietNam 229 // VN
+#define cVanuatu 230 // VU
+#define cWallisAndFutunaIslands 231 // WF
+#define cSamoa 232 // WS
+#define cYemen 233 // YE
+#define cMayotte 234 // YT
+#define cYugoslavia 235 // YU
+#define cSouthAfrica 236 // ZA
+#define cZambia 237 // ZM
+#define cZimbabwe 238 // ZW
+//
+#define cCountryNum 239 // Number of Countries
+
+/* Various character encodings supported by the PalmOS. Actually these
+are a mixture of character sets (repetoires or coded character sets
+in Internet lingo) and character encodings (CES - character encoding
+standard). Many, however, are some of both (e.g. CP932 is the Shift-JIS
+encoding of the JIS character set + Microsoft's extensions).
+
+The following character set values are used by:
+ a) Palm devices
+ b) Palm wireless servers
+
+WARNING! Be aware that a device supporting a new character set
+ will require some character set definition and maybe
+ some development on the wireless server side.
+*/
+
+
+///////////////////////////////////////////////////////////////////////////
+// Warning: The following files are interdependent and MUST to be modified together:
+//
+// -> Viewer\Incs\Core\System\PalmLocale.h
+// (defines charset IDs)
+//
+// -> Server\apps\Elaine\Src\Core\CharsetInfo.cpp
+// (defines charset attributes like Asian, cp1252 compatible, etc.)
+//
+// -> Server\CstPalmOSCharsets.lst
+// (list the iso names of
+//
+///////////////////////////////////////////////////////////////////////////
+
+
+#define CHAR_ENCODING_VALUE(value) ((CharEncodingType)value)
+
+// Unknown to this version of PalmOS.
+#define charEncodingUnknown 0
+
+// Maximum character encoding _currently_ defined
+
+#define charEncodingMax 83
+
+// Latin Palm OS character encoding, and subsets.
+// PalmOS variant of CP1252, with 10 extra Greek characters
+#define charEncodingPalmGSM 78
+// PalmOS version of CP1252
+#define charEncodingPalmLatin 3
+// Windows variant of 8859-1
+#define charEncodingCP1252 7
+// ISO 8859 Part 1
+#define charEncodingISO8859_1 2
+// ISO 646-1991
+#define charEncodingAscii 1
+
+// Japanese Palm OS character encoding, and subsets.
+// PalmOS version of CP932
+#define charEncodingPalmSJIS 5
+// Windows variant of ShiftJIS
+#define charEncodingCP932 8
+// Encoding for JIS 0208-1990 + 1-byte katakana
+#define charEncodingShiftJIS 4
+
+// Unicode character encodings
+#define charEncodingUCS2 9
+#define charEncodingUTF8 6
+#define charEncodingUTF7 24
+#define charEncodingUTF16 75
+#define charEncodingUTF16BE 76
+#define charEncodingUTF16LE 77
+
+// Latin character encodings
+#define charEncodingCP850 12
+#define charEncodingCP437 13
+#define charEncodingCP865 14
+#define charEncodingCP860 15
+#define charEncodingCP861 16
+#define charEncodingCP863 17
+#define charEncodingCP775 18
+#define charEncodingMacIslande 19
+#define charEncodingMacintosh 20
+#define charEncodingCP1257 21
+#define charEncodingISO8859_3 22
+#define charEncodingISO8859_4 23
+
+// Extended Latin character encodings
+#define charEncodingISO8859_2 26
+#define charEncodingCP1250 27
+#define charEncodingCP852 28
+#define charEncodingXKamenicky 29
+#define charEncodingMacXCroate 30
+#define charEncodingMacXLat2 31
+#define charEncodingMacXRomania 32
+
+// Japanese character encodings
+#define charEncodingEucJp 25
+#define charEncodingISO2022Jp 10
+#define charEncodingXAutoJp 11
+
+// Greek character encodings
+#define charEncodingISO8859_7 33
+#define charEncodingCP1253 34
+#define charEncodingCP869 35
+#define charEncodingCP737 36
+#define charEncodingMacXGr 37
+
+// Cyrillic character encodings
+#define charEncodingCP1251 38
+#define charEncodingISO8859_5 39
+#define charEncodingKoi8R 40
+#define charEncodingKoi8 41
+#define charEncodingCP855 42
+#define charEncodingCP866 43
+#define charEncodingMacCyr 44
+#define charEncodingMacUkraine 45
+
+// Turkish character encodings
+#define charEncodingCP1254 46
+#define charEncodingISO8859_9 47
+#define charEncodingCP857 48
+#define charEncodingMacTurc 49
+#define charEncodingCP853 50
+
+// Arabic character encodings
+#define charEncodingISO8859_6 51
+#define charEncodingAsmo708 52
+#define charEncodingCP1256 53
+#define charEncodingCP864 54
+#define charEncodingAsmo708Plus 55
+#define charEncodingAsmo708Fr 56
+#define charEncodingMacAra 57
+
+// Simplified Chinese character encodings
+#define charEncodingGB2312 58
+#define charEncodingHZ 59
+#define charEncodingGBK 82
+#define charEncodingPalmGB 83
+
+// Traditional Chinese character encodings
+#define charEncodingBig5 60
+#define charEncodingBig5_HKSCS 79
+#define charEncodingBig5Plus 80
+#define charEncodingPalmBig5 81
+
+// Vietnamese character encodings
+#define charEncodingViscii 61
+#define charEncodingViqr 62
+#define charEncodingVncii 63
+#define charEncodingVietnet 65
+#define charEncodingCP1258 66
+
+// Korean character encodings
+#define charEncodingKsc5601 67
+#define charEncodingCP949 68
+#define charEncodingISO2022Kr 69
+
+// Hebrew character encodings
+#define charEncodingISO8859_8I 70
+#define charEncodingISO8859_8 71
+#define charEncodingCP1255 72
+#define charEncodingCP1255V 73
+
+// Thai character encodings
+#define charEncodingTis620 74
+#define charEncodingCP874 64
+
+
+// Leave the following line unchanged at end of section
+// TAG DESTINATION END
+
+#endif // !PALM_LOCALE_HAS_TYPES
+
+#endif // __PALMLOCALE_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/PenMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/PenMgr.h
new file mode 100644
index 0000000..538c9ac
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/PenMgr.h
@@ -0,0 +1,98 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: PenMgr.h
+ *
+ * Description:
+ * Include file for Pen manager
+ *
+ * History:
+ * 6/5/96 Created by Ron Marianetti
+ *
+ *****************************************************************************/
+
+#ifndef __PEN_MGR_H
+#define __PEN_MGR_H
+
+// Pilot common definitions
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+#include <ErrorBase.h>
+#include <Rect.h>
+
+
+/********************************************************************
+ * Pen Manager Errors
+ * the constant serErrorClass is defined in ErrorBase.h
+ ********************************************************************/
+#define penErrBadParam (penErrorClass | 1)
+#define penErrIgnorePoint (penErrorClass | 2)
+
+
+
+/********************************************************************
+ * Pen manager Routines
+ ********************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+// Initializes the Pen Manager
+Err PenOpen(void)
+ SYS_TRAP(sysTrapPenOpen);
+
+// Closes the Pen Manager and frees whatever memory it allocated
+Err PenClose(void)
+ SYS_TRAP(sysTrapPenClose);
+
+
+// Put pen to sleep
+Err PenSleep(void)
+ SYS_TRAP(sysTrapPenSleep);
+
+// Wake pen
+Err PenWake(void)
+ SYS_TRAP(sysTrapPenWake);
+
+
+// Get the raw pen coordinates from the hardware.
+Err PenGetRawPen(PointType *penP)
+ SYS_TRAP(sysTrapPenGetRawPen);
+
+// Reset calibration in preparation for setting it again
+Err PenResetCalibration (void)
+ SYS_TRAP(sysTrapPenResetCalibration);
+
+// Set calibration settings for the pen
+Err PenCalibrate (PointType *digTopLeftP, PointType *digBotRightP,
+ PointType *scrTopLeftP, PointType *scrBotRightP)
+ SYS_TRAP(sysTrapPenCalibrate);
+
+// Scale a raw pen coordinate into screen coordinates
+Err PenRawToScreen(PointType *penP)
+ SYS_TRAP(sysTrapPenRawToScreen);
+
+// Scale a screen pen coordinate back into a raw coordinate
+Err PenScreenToRaw(PointType *penP)
+ SYS_TRAP(sysTrapPenScreenToRaw);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+/************************************************************
+ * Assembly Function Prototypes
+ *************************************************************/
+#define _PenGetRawPen \
+ ASM_SYS_TRAP(sysTrapPenGetRawPen)
+
+
+
+#endif //__PEN_MGR_H
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Preferences.h b/SrcShared/Palm/Platform/Incs/Core/System/Preferences.h
new file mode 100644
index 0000000..726055b
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Preferences.h
@@ -0,0 +1,428 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Preferences.h
+ *
+ * Release:
+ *
+ * Description:
+ * Header for the system preferences
+ *
+ * History:
+ * 02/31/95 rsf Created by Roger Flores
+ * 06/26/99 kwk Added LanguageType.
+ * 06/30/99 CS Added MeasurementSystemType, then added it to both
+ * CountryPreferencesType and SystemPreferencesType,
+ * and bumped the version to 7.
+ * CS Added prefMeasurementSystem to select this
+ * preference.
+ * CS Added filler fields to CountryPreferencesType
+ * structure, since this guy gets saved as a
+ * resource.
+ * 09/20/99 gap added additional cXXXX country values.
+ * 09/20/99 gap cPRC -> cRepChina.
+ * 10/4/99 jmp Add support for auto-off duration times in seconds
+ * instead of minutes (the new seconds-based auto-off
+ * duration time is preferred; the minutes-based auto-ff
+ * duration times are maintained for compatibility).
+ * 10/5/99 jmp Make the seconds auto-off duration field a UInt16
+ * instead of a UInt8; also define constants for the
+ * "pegged" auto-off duration values (when the value
+ * is pegged, we no longer automatically shut off).
+ * 12/23/99 jmp Fix <> vs. "" problem.
+ * 04/30/00 CS Use LmCountryType instead of CountryType. Also removed
+ * deprecated countryNameLength, currencyNameLength, and
+ * currencySymbolLength, replacing usage with new
+ * kMaxCountryNameLen, kMaxCurrencyNameLen, and
+ * kMaxCurrencySymbolLen.
+ * 05/16/00 CS LmCountryType/LmLanguageType are now back to
+ * CountryType/LanguageType.
+ * 08/01/00 CS Added prefLanguage & prefLocale to selector set, and
+ * locale to SystemPreferencesType.
+ * 08/01/00 kwk Added timeZoneCountry to SystemPreferencesType, and
+ * prefTimeZoneCountry to SystemPreferencesChoice.
+ * 08/08/00 CS Moved obsolete CountryPreferencesType to RezConvert.cp,
+ * since that's the only code that still needs access to
+ * this private, obsolete resource.
+ * 08/08/00 peter Added attentionFlags to SystemPreferencesType, and
+ * prefAttentionFlags to SystemPreferencesChoice.
+ * 11/07/00 grant Added button default assignment resource type.
+ *
+ *****************************************************************************/
+
+#ifndef __PREFERENCES_H__
+#define __PREFERENCES_H__
+
+#include <DateTime.h>
+#include <Localize.h>
+#include <SystemMgr.h>
+#include <LocaleMgr.h> // CountryType, kMaxCountryNameLen, etc.
+#include <AttentionMgr.h> // AttnFlagsType
+
+/***********************************************************************
+ * Constants
+ ***********************************************************************/
+
+#define noPreferenceFound -1
+
+// Preference version constants
+#define preferenceDataVer2 2 // Palm OS 2.0
+#define preferenceDataVer3 3 // Palm OS 3.0
+#define preferenceDataVer4 4 // Palm OS 3.1
+#define preferenceDataVer5 5 // Palm OS 3.2a
+#define preferenceDataVer6 6 // Palm OS 3.2b/3.3
+#define preferenceDataVer8 8 // Palm OS 3.5
+#define preferenceDataVer9 9 // Palm OS 4.0
+
+// Be SURE to update "preferenceDataVerLatest" when adding a new prefs version...
+#define preferenceDataVerLatest preferenceDataVer9
+
+
+#define defaultAutoOffDuration 2 // minutes
+#define defaultAutoOffDurationSecs (2 * minutesInSeconds) // seconds
+
+#define peggedAutoOffDuration 0xFF // minutes (UInt8)
+#define peggedAutoOffDurationSecs 0xFFFF // seconds (UInt16)
+
+#define defaultAutoLockType never //Never auto lock device
+#define defaultAutoLockTime 0
+#define defaultAutoLockTimeFlag 0
+
+// Obsolete after V20
+#if EMULATION_LEVEL == EMULATION_NONE
+ #define defaultSysSoundLevel slOn
+ #define defaultGameSoundLevel slOn
+ #define defaultAlarmSoundLevel slOn
+#else // EMULATION_LEVEL != EMULATION_NONE
+ #define defaultSysSoundLevel slOff
+ #define defaultGameSoundLevel slOff
+ #define defaultAlarmSoundLevel slOn
+#endif
+
+
+#if EMULATION_LEVEL == EMULATION_NONE
+ #define defaultSysSoundVolume sndMaxAmp
+ #define defaultGameSoundVolume sndMaxAmp
+ #define defaultAlarmSoundVolume sndMaxAmp
+#else // EMULATION_LEVEL != EMULATION_NONE
+ #define defaultSysSoundVolume 0
+ #define defaultGameSoundVolume 0
+ #define defaultAlarmSoundVolume sndMaxAmp
+#endif
+
+typedef enum
+ {
+ unitsEnglish = 0, // Feet, yards, miles, gallons, pounds, slugs, etc.
+ unitsMetric // Meters, liters, grams, newtons, etc.
+ } MeasurementSystemType;
+
+
+// These sound levels must corrospond to positions in the popup lists
+// used by the preferences app. These are made obsolete after V20. The
+// loudness of the sound is now represented as a number from 0 to sndMaxAmp.
+typedef enum {
+ slOn = 0,
+ slOff = 1
+ } SoundLevelTypeV20;
+
+// Device Automatic Locking options.
+typedef enum {
+ never = 0, //Auto-Lock disabled.
+ uponPowerOff, // Auto lock when the device powers off.
+ atPresetTime, //Auto lock at HH:MM every day.
+ afterPresetDelay //Auto lock after x minutes or hours.
+ } SecurityAutoLockType;
+
+
+// The number format (thousands separator and decimal point). This defines
+// how numbers are formatted and not neccessarily currency numbers (i.e. Switzerland).
+typedef enum {
+ alOff, // Never show an animation
+ alEventsOnly, // Show an animation for an event
+ alEventsAndRandom, // Also show random animation
+ alEventsAndMoreRandom // Show random animations more frequently
+ } AnimationLevelType;
+
+
+typedef enum
+ {
+ prefVersion,
+ prefCountry,
+ prefDateFormat,
+ prefLongDateFormat,
+ prefWeekStartDay,
+ prefTimeFormat,
+ prefNumberFormat,
+ prefAutoOffDuration, // prefAutoOffDurationSecs is now preferred (prefAutoOffDuration is in minutes)
+ prefSysSoundLevelV20, // slOn or slOff - error beeps and other non-alarm/game sounds
+ prefGameSoundLevelV20, // slOn or slOff - game sound effects
+ prefAlarmSoundLevelV20, // slOn or slOff - alarm sound effects
+ prefHidePrivateRecordsV33,
+ prefDeviceLocked,
+ prefLocalSyncRequiresPassword,
+ prefRemoteSyncRequiresPassword,
+ prefSysBatteryKind,
+ prefAllowEasterEggs,
+ prefMinutesWestOfGMT, // deprecated old unsigned minutes EAST of GMT
+ prefDaylightSavings, // deprecated old daylight saving time rule
+ prefRonamaticChar,
+ prefHard1CharAppCreator, // App creator for hard key #1
+ prefHard2CharAppCreator, // App creator for hard key #2
+ prefHard3CharAppCreator, // App creator for hard key #3
+ prefHard4CharAppCreator, // App creator for hard key #4
+ prefCalcCharAppCreator, // App creator for calculator soft key
+ prefHardCradleCharAppCreator, // App creator for hard cradle key
+ prefLauncherAppCreator, // App creator for launcher soft key
+ prefSysPrefFlags,
+ prefHardCradle2CharAppCreator, // App creator for 2nd hard cradle key
+ prefAnimationLevel,
+
+ // Additions for PalmOS 3.0:
+ prefSysSoundVolume, // actual amplitude - error beeps and other non-alarm/game sounds
+ prefGameSoundVolume, // actual amplitude - game sound effects
+ prefAlarmSoundVolume, // actual amplitude - alarm sound effects
+ prefBeamReceive, // not used - use ExgLibControl with ir(Get/Set)ScanningMode instead
+ prefCalibrateDigitizerAtReset, // True makes the user calibrate at soft reset time
+ prefSystemKeyboardID, // ID of the preferred keyboard resource
+ prefDefSerialPlugIn, // creator ID of the default serial plug-in
+
+ // Additions for PalmOS 3.1:
+ prefStayOnWhenPluggedIn, // don't sleep after timeout when using line current
+ prefStayLitWhenPluggedIn, // keep backlight on when not sleeping on line current
+
+ // Additions for PalmOS 3.2:
+ prefAntennaCharAppCreator, // App creator for antenna key
+
+ // Additions for PalmOS 3.3:
+ prefMeasurementSystem, // English, Metric, etc.
+
+ // Additions for PalmOS 3.5:
+ prefShowPrivateRecords, // returns privateRecordViewEnum
+ prefAutoOffDurationSecs, // auto-off duration in seconds
+
+ // Additions for PalmOS 4.0:
+ prefTimeZone, // GMT offset in minutes, + for east of GMT, - for west
+ prefDaylightSavingAdjustment, // current DST adjustment in minutes (typically 0 or 60)
+
+ prefAutoLockType, // Never, on poweroff, after preset delay or at preset time.
+ prefAutoLockTime, // Auto lock preset time or delay.
+ prefAutoLockTimeFlag, // For Minutes or Hours.
+
+ prefLanguage, // Language spoken in country selected via Setup app/Formats panel
+ prefLocale, // Locale for country selected via Setup app/Formats panel
+
+ prefTimeZoneCountry, // Country used to specify time zone.
+
+ prefAttentionFlags, // User prefs for getting user's attention
+
+ prefDefaultAppCreator // Default application launched on reset.
+
+ } SystemPreferencesChoice;
+
+
+typedef struct {
+ UInt16 version; // Version of preference info
+
+ // International preferences
+ CountryType country; // Country the device is in
+ DateFormatType dateFormat; // Format to display date in
+ DateFormatType longDateFormat; // Format to display date in
+ UInt8 weekStartDay; // Sunday or Monday
+ TimeFormatType timeFormat; // Format to display time in
+ NumberFormatType numberFormat; // Format to display numbers in
+
+ // system preferences
+ UInt8 autoOffDuration; // Time period before shutting off (in minutes)
+ SoundLevelTypeV20 sysSoundLevel; // slOn or slOff - error beeps and other non-alarm sounds
+ SoundLevelTypeV20 alarmSoundLevel; // slOn or slOff - alarm only
+ Boolean hideSecretRecords; // True to not display records with
+ // their secret bit attribute set
+ Boolean deviceLocked; // Device locked until the system
+ // password is entered
+ UInt8 reserved1;
+ UInt16 sysPrefFlags; // Miscellaneous system pref flags
+ // copied into the global GSysPrefFlags
+ // at boot time.
+ SysBatteryKind sysBatteryKind; // The type of batteries installed. This
+ // is copied into the globals GSysbatteryKind
+ // at boot time.
+ UInt8 reserved2;
+
+ } SystemPreferencesTypeV10;
+
+
+// Any entries added to this structure must be initialized in
+// Prefereces.c:GetPreferenceResource
+//
+// DOLATER CS - We should move SystemPreferencesType, SystemPreferencesTypeV10,
+// PrefGetPreferences, and PrefSetPreferences to a private header
+// file, since any code compiled against an old version of this
+// struct will trash memory when run on a version of the Palm OS
+// that makes the struct longer.
+
+typedef struct
+ {
+ UInt16 version; // Version of preference info
+
+ // International preferences
+ CountryType country; // Country the device is in (see PalmLocale.h)
+ DateFormatType dateFormat; // Format to display date in
+ DateFormatType longDateFormat; // Format to display date in
+ Int8 weekStartDay; // Sunday or Monday
+ TimeFormatType timeFormat; // Format to display time in
+ NumberFormatType numberFormat; // Format to display numbers in
+
+ // system preferences
+ UInt8 autoOffDuration; // Time period in minutes before shutting off (use autoOffDurationSecs instead).
+ SoundLevelTypeV20 sysSoundLevelV20; // slOn or slOff - error beeps and other non-alarm/game sounds
+ SoundLevelTypeV20 gameSoundLevelV20; // slOn or slOff - game sound effects
+ SoundLevelTypeV20 alarmSoundLevelV20; // slOn or slOff - alarm sound effects
+ Boolean hideSecretRecords; // True to not display records with
+ // their secret bit attribute set
+ Boolean deviceLocked; // Device locked until the system
+ // password is entered
+ Boolean localSyncRequiresPassword; // User must enter password on Pilot
+ Boolean remoteSyncRequiresPassword; // User must enter password on Pilot
+ UInt16 sysPrefFlags; // Miscellaneous system pref flags
+ // copied into the global GSysPrefFlags
+ // at boot time. Constants are
+ // sysPrefFlagXXX defined in SystemPrv.h
+ SysBatteryKind sysBatteryKind; // The type of batteries installed. This
+ // is copied into the globals GSysbatteryKind
+ // at boot time.
+ UInt8 reserved1;
+ UInt32 minutesWestOfGMT; // minutes west of Greenwich
+ DaylightSavingsTypes daylightSavings; // Type of daylight savings correction
+ UInt8 reserved2;
+ UInt16 ronamaticChar; // character to generate from ronamatic stroke.
+ // Typically it popups the onscreen keyboard.
+ UInt32 hard1CharAppCreator; // creator of application to launch in response
+ // to the hard button #1. Used by SysHandleEvent.
+ UInt32 hard2CharAppCreator; // creator of application to launch in response
+ // to the hard button #2. Used by SysHandleEvent.
+ UInt32 hard3CharAppCreator; // creator of application to launch in response
+ // to the hard button #3. Used by SysHandleEvent.
+ UInt32 hard4CharAppCreator; // creator of application to launch in response
+ // to the hard button #4. Used by SysHandleEvent.
+ UInt32 calcCharAppCreator; // creator of application to launch in response
+ // to the Calculator icon. Used by SysHandleEvent.
+ UInt32 hardCradleCharAppCreator; // creator of application to launch in response
+ // to the Cradle button. Used by SysHandleEvent.
+ UInt32 launcherCharAppCreator; // creator of application to launch in response
+ // to the launcher button. Used by SysHandleEvent.
+ UInt32 hardCradle2CharAppCreator; // creator of application to launch in response
+ // to the 2nd Cradle button. Used by SysHandleEvent.
+ AnimationLevelType animationLevel; // amount of animation to display
+
+ Boolean maskPrivateRecords; // Only meaningful if hideSecretRecords is true.
+ //true to show a grey placeholder box for secret records.
+ //was reserved3 - added for 3.5
+
+
+ // Additions for PalmOS 3.0:
+ UInt16 sysSoundVolume; // system amplitude (0 - sndMaxAmp) - taps, beeps
+ UInt16 gameSoundVolume; // game amplitude (0 - sndMaxAmp) - explosions
+ UInt16 alarmSoundVolume; // alarm amplitude (0 - sndMaxAmp)
+ Boolean beamReceive; // False turns off IR sniffing, sends still work.
+ Boolean calibrateDigitizerAtReset; // True makes the user calibrate at soft reset time
+ UInt16 systemKeyboardID; // ID of the preferred keyboard resource
+ UInt32 defSerialPlugIn; // creator ID of the default serial plug-in
+
+ // Additions for PalmOS 3.1:
+ Boolean stayOnWhenPluggedIn; // don't sleep after timeout when using line current
+ Boolean stayLitWhenPluggedIn; // keep backlight on when not sleeping on line current
+
+ // Additions for PalmOS 3.2:
+ UInt32 antennaCharAppCreator; // creator of application to launch in response
+ // to the antenna key. Used by SysHandleEvent.
+
+ // Additions for PalmOS 3.5:
+ MeasurementSystemType measurementSystem; // metric, english, etc.
+ UInt8 reserved3;
+ UInt16 autoOffDurationSecs; // Time period in seconds before shutting off.
+
+ // Additions for PalmOS 4.0:
+ Int16 timeZone; // minutes east of Greenwich
+ Int16 daylightSavingAdjustment; // current daylight saving correction in minutes
+ CountryType timeZoneCountry; // country used to specify time zone.
+ SecurityAutoLockType autoLockType; // Never, on power off, after preset delay or at preset time
+ UInt32 autoLockTime; // Auto lock preset time or delay.
+ Boolean autoLockTimeFlag; // For Minutes or Hours.
+ LanguageType language; // Language spoken in country selected via Setup app/Formats panel
+
+ AttnFlagsType attentionFlags; // User prefs for getting user's attention
+
+ UInt32 defaultAppCreator; // Creator of the default "safe" app that is launched
+ // on a reset.
+ } SystemPreferencesType;
+
+
+
+typedef SystemPreferencesType *SystemPreferencesPtr;
+
+
+// structure of the resource that holds hard/soft button defaults
+typedef struct {
+ UInt16 keyCode; // virtual key code of the hard/soft button
+ UInt32 creator; // app creator code
+} ButtonDefaultAppType;
+
+typedef struct {
+ UInt16 numButtons; // number of default button assignments
+ ButtonDefaultAppType button[1]; // array of button assignments
+} ButtonDefaultListType;
+
+
+//-------------------------------------------------------------------
+// Preferences routines
+//-------------------------------------------------------------------
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+extern DmOpenRef PrefOpenPreferenceDBV10 (void)
+ SYS_TRAP(sysTrapPrefOpenPreferenceDBV10);
+
+extern DmOpenRef PrefOpenPreferenceDB (Boolean saved)
+ SYS_TRAP(sysTrapPrefOpenPreferenceDB);
+
+extern void PrefGetPreferences(SystemPreferencesPtr p)
+ SYS_TRAP(sysTrapPrefGetPreferences);
+
+extern void PrefSetPreferences(SystemPreferencesPtr p)
+ SYS_TRAP(sysTrapPrefSetPreferences);
+
+extern UInt32 PrefGetPreference(SystemPreferencesChoice choice)
+ SYS_TRAP(sysTrapPrefGetPreference);
+
+extern void PrefSetPreference(SystemPreferencesChoice choice, UInt32 value)
+ SYS_TRAP(sysTrapPrefSetPreference);
+
+extern Int16 PrefGetAppPreferences (UInt32 creator, UInt16 id, void *prefs,
+ UInt16 *prefsSize, Boolean saved)
+ SYS_TRAP(sysTrapPrefGetAppPreferences);
+
+extern Boolean PrefGetAppPreferencesV10 (UInt32 type, Int16 version, void *prefs,
+ UInt16 prefsSize)
+ SYS_TRAP(sysTrapPrefGetAppPreferencesV10);
+
+extern void PrefSetAppPreferences (UInt32 creator, UInt16 id, Int16 version,
+ const void *prefs, UInt16 prefsSize, Boolean saved)
+ SYS_TRAP(sysTrapPrefSetAppPreferences);
+
+extern void PrefSetAppPreferencesV10 (UInt32 creator, Int16 version, void *prefs,
+ UInt16 prefsSize)
+ SYS_TRAP(sysTrapPrefSetAppPreferencesV10);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif // __PREFERENCES_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Rect.h b/SrcShared/Palm/Platform/Incs/Core/System/Rect.h
new file mode 100644
index 0000000..40cd3b7
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Rect.h
@@ -0,0 +1,83 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Rect.h
+ *
+ * Description:
+ * This file defines rectangle structures and routines.
+ *
+ * History:
+ * November 3, 1994 Created by Roger Flores
+ * Name Date Description
+ * ---- ---- -----------
+ * bob 2/9/99 Use Coord abstraction, fix up consts
+ *
+ *****************************************************************************/
+
+#ifndef __RECT_H__
+#define __RECT_H__
+
+// Include elementary types
+#include <PalmTypes.h> // Basic types
+#include <CoreTraps.h> // Trap Numbers.
+
+
+typedef struct AbsRectType {
+ Coord left;
+ Coord top;
+ Coord right;
+ Coord bottom;
+} AbsRectType;
+
+
+typedef struct PointType {
+ Coord x;
+ Coord y;
+} PointType;
+
+
+typedef struct RectangleType {
+ PointType topLeft;
+ PointType extent;
+} RectangleType;
+
+typedef RectangleType *RectanglePtr;
+
+
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void RctSetRectangle (RectangleType *rP,
+ Coord left, Coord top, Coord width, Coord height)
+ SYS_TRAP(sysTrapRctSetRectangle);
+
+extern void RctCopyRectangle (const RectangleType *srcRectP,
+ RectangleType *dstRectP)
+ SYS_TRAP(sysTrapRctCopyRectangle);
+
+extern void RctInsetRectangle (RectangleType *rP, Coord insetAmt)
+ SYS_TRAP(sysTrapRctInsetRectangle);
+
+extern void RctOffsetRectangle (RectangleType *rP, Coord deltaX, Coord deltaY)
+ SYS_TRAP(sysTrapRctOffsetRectangle);
+
+extern Boolean RctPtInRectangle (Coord x, Coord y, const RectangleType *rP)
+ SYS_TRAP(sysTrapRctPtInRectangle);
+
+extern void RctGetIntersection (const RectangleType *r1P, const RectangleType *r2P,
+ RectangleType *r3P)
+ SYS_TRAP(sysTrapRctGetIntersection);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif //__RECT_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SerialLinkMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/SerialLinkMgr.h
new file mode 100644
index 0000000..7142309
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SerialLinkMgr.h
@@ -0,0 +1,437 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SerialLinkMgr.h
+ *
+ * Description:
+ * Source for Serial Link Routines on Pilot
+ *
+ * History:
+ * 2/6/95 replaces DSerial.h from Debugger
+ *
+ *****************************************************************************/
+
+#ifndef __SERIAL_LINK_H
+#define __SERIAL_LINK_H
+
+
+
+// Pilot common definitions
+#include <PalmTypes.h>
+#include <ErrorBase.h>
+
+
+//*************************************************************************
+// Pre-defined, fixxed Socket ID's
+//*************************************************************************
+#define slkSocketDebugger 0 // Debugger Socket
+#define slkSocketConsole 1 // Console Socket
+#define slkSocketRemoteUI 2 // Remote UI Socket
+#define slkSocketDLP 3 // Desktop Link Socket
+#define slkSocketFirstDynamic 4 // first dynamic socket ID
+
+
+//*************************************************************************
+// Packet Types
+//*************************************************************************
+#define slkPktTypeSystem 0 // System packets
+#define slkPktTypeUnused1 1 // used to be: Connection Manager packets
+#define slkPktTypePAD 2 // PAD Protocol packets
+#define slkPktTypeLoopBackTest 3 // Loop-back test packets
+
+
+
+//*************************************************************************
+//
+// Packet structure:
+// header
+// body (0-dbgMaxPacketBodyLength bytes of data)
+// footer
+//
+//*************************************************************************
+
+//----------------------------------------------------------------------
+// packet header
+// Fields marked with -> must be filled in by caller
+// Fields marked with X will be filled in by SlkSendPacket.
+//----------------------------------------------------------------------
+
+typedef UInt8 SlkPktHeaderChecksum;
+
+typedef struct SlkPktHeaderType {
+ UInt16 signature1; // X first 2 bytes of signature
+ UInt8 signature2; // X 3 and final byte of signature
+ UInt8 dest; // -> destination socket Id
+ UInt8 src; // -> src socket Id
+ UInt8 type; // -> packet type
+ UInt16 bodySize; // X size of body
+ UInt8 transId; // -> transaction Id
+ // if 0 specified, it will be replaced
+ SlkPktHeaderChecksum checksum; // X check sum of header
+ } SlkPktHeaderType;
+
+typedef SlkPktHeaderType* SlkPktHeaderPtr;
+
+#define slkPktHeaderSignature1 0xBEEF
+#define slkPktHeaderSignature2 0xED
+
+#define slkPktHeaderSigFirst 0xBE // First byte
+#define slkPktHeaderSigSecond 0xEF // second byte
+#define slkPktHeaderSigThird 0xED // third byte
+
+//----------------------------------------------------------------------
+// packet footer
+//----------------------------------------------------------------------
+typedef struct SlkPktFooterType {
+ UInt16 crc16; // header and body crc
+ } SlkPktFooterType;
+
+typedef SlkPktFooterType* SlkPktFooterPtr;
+
+
+//*************************************************************************
+//
+// Write Data Structure passed to SlkSendPacket. This structure
+// Tells SlkSendPacket where each of the chunks that comprise the body are
+// and the size of each. SlkSendPacket accepts a pointer to an array
+// of SlkWriteDataTypes, the last one has a size field of 0.
+//
+//*************************************************************************
+typedef struct SlkWriteDataType {
+ UInt16 size; // last one has size of 0
+ void* dataP; // pointer to data
+ } SlkWriteDataType;
+typedef SlkWriteDataType* SlkWriteDataPtr;
+
+
+
+
+//*************************************************************************
+//
+// CPU-dependent macros for getting/setting values from/to packets
+//
+//*************************************************************************
+
+//--------------------------------------------------------------------
+// macros to get packet values
+//--------------------------------------------------------------------
+
+#define slkGetPacketByteVal(srcP) (*(UInt8 *)(srcP))
+
+
+#if (CPU_TYPE == CPU_x86)
+#define slkGetPacketWordVal(srcP) \
+ ( (UInt16) \
+ ( \
+ ((UInt16)((UInt8 *)(srcP))[0] << 8) | \
+ ((UInt16)((UInt8 *)(srcP))[1]) \
+ ) \
+ )
+#else
+#define slkGetPacketWordVal(srcP) \
+ ( *((UInt16 *)(srcP)) )
+#endif //CPU_TYPE == CPU_x86
+
+
+#if (CPU_TYPE == CPU_x86)
+#define slkGetPacketDWordVal(srcP) \
+ ( (UInt32) \
+ ( \
+ ((UInt32)((UInt8 *)(srcP))[0] << 24) | \
+ ((UInt32)((UInt8 *)(srcP))[1] << 16) | \
+ ((UInt32)((UInt8 *)(srcP))[2] << 8) | \
+ ((UInt32)((UInt8 *)(srcP))[3]) \
+ ) \
+ )
+#else
+#define slkGetPacketDWordVal(srcP) \
+ ( *((UInt32 *)(srcP)) )
+#endif //CPU_TYPE == CPU_x86
+
+
+#define slkGetPacketSignature1(sigP) \
+ slkGetPacketWordVal(sigP)
+
+#define slkGetPacketSignature2(sigP) \
+ slkGetPacketByteVal(sigP)
+
+
+#define slkGetPacketDest(addressP) \
+ slkGetPacketByteVal(addressP)
+
+#define slkGetPacketSrc(addressP) \
+ slkGetPacketByteVal(addressP)
+
+#define slkGetPacketType(commandP) \
+ slkGetPacketByteVal(commandP)
+
+
+#define slkGetPacketBodySize(lengthP) \
+ slkGetPacketWordVal(lengthP)
+
+#define slkGetPacketTransId(transIDP) \
+ slkGetPacketByteVal(transIDP)
+
+#define slkGetPacketHdrChecksum(checksumP) \
+ slkGetPacketByteVal(checksumP)
+
+
+#define slkGetPacketTotalChecksum(checksumP) \
+ slkGetPacketWordVal(checksumP)
+
+
+
+
+
+
+//--------------------------------------------------------------------
+// macros to set packet values
+//--------------------------------------------------------------------
+
+
+#define slkSetPacketByteVal(srcByteVal, destP) \
+ ( *(UInt8 *)(destP) = (UInt8)(srcByteVal) )
+
+#if (CPU_TYPE == CPU_x86)
+#define slkSetPacketWordVal(srcWordVal, destP) \
+ \
+ do { \
+ UInt16 ___srcVal; \
+ UInt8 * ___srcValP; \
+ \
+ ___srcVal = (UInt16)(srcWordVal); \
+ ___srcValP = (UInt8 *)(&___srcVal); \
+ \
+ ((UInt8 *)(destP))[0] = ___srcValP[1]; \
+ ((UInt8 *)(destP))[1] = ___srcValP[0]; \
+ } while( false )
+#else
+#define slkSetPacketWordVal(srcWordVal, destP) \
+ ( *((UInt16 *)(destP)) = (UInt16)(srcWordVal) )
+#endif //CPU_TYPE == CPU_x86
+
+
+#if (CPU_TYPE == CPU_x86)
+#define slkSetPacketDWordVal(srcDWordVal, destP) \
+ do { \
+ UInt32 ___srcVal; \
+ UInt8 * ___srcValP; \
+ \
+ ___srcVal = (UInt32)(srcDWordVal); \
+ ___srcValP = (UInt8 *)(&___srcVal); \
+ \
+ ((UInt8 *)(destP))[0] = ___srcValP[3]; \
+ ((UInt8 *)(destP))[1] = ___srcValP[2]; \
+ ((UInt8 *)(destP))[2] = ___srcValP[1]; \
+ ((UInt8 *)(destP))[3] = ___srcValP[0]; \
+ } while( false )
+#else
+#define slkSetPacketDWordVal(srcDWordVal, destP) \
+ ( *((UInt32 *)(destP)) = (UInt32)(srcDWordVal) )
+#endif //CPU_TYPE == CPU_x86
+
+
+
+#define slkSetPacketSignature1(magic, destP) \
+ slkSetPacketWordVal(magic, destP)
+
+#define slkSetPacketSignature2(magic, destP) \
+ slkSetPacketByteVal(magic, destP)
+
+
+#define slkSetPacketDest(dest, destP) \
+ slkSetPacketByteVal(dest, destP)
+
+#define slkSetPacketSrc(src, destP) \
+ slkSetPacketByteVal(src, destP)
+
+
+#define slkSetPacketType(type, destP) \
+ slkSetPacketByteVal(type, destP)
+
+
+#define slkSetPacketBodySize(numBytes, destP) \
+ slkSetPacketWordVal(numBytes, destP)
+
+
+#define slkSetPacketTransId(transID, destP) \
+ slkSetPacketByteVal(transID, destP)
+
+#define slkSetPacketHdrChecksum(checksum, destP) \
+ slkSetPacketByteVal(checksum, destP)
+
+#define slkSetPacketTotalChecksum(checksum, destP) \
+ slkSetPacketWordVal(checksum, destP)
+
+
+
+
+
+
+/*******************************************************************
+ * Serial Link Manager Errors
+ * the constant slkErrorClass is defined in SystemMgr.h
+ *******************************************************************/
+#define slkErrChecksum (slkErrorClass | 1)
+#define slkErrFormat (slkErrorClass | 2)
+#define slkErrBuffer (slkErrorClass | 3)
+#define slkErrTimeOut (slkErrorClass | 4)
+#define slkErrHandle (slkErrorClass | 5)
+#define slkErrBodyLimit (slkErrorClass | 6)
+#define slkErrTransId (slkErrorClass | 7)
+#define slkErrResponse (slkErrorClass | 8)
+#define slkErrNoDefaultProc (slkErrorClass | 9)
+#define slkErrWrongPacketType (slkErrorClass | 10)
+#define slkErrBadParam (slkErrorClass | 11)
+#define slkErrAlreadyOpen (slkErrorClass | 12)
+#define slkErrOutOfSockets (slkErrorClass | 13)
+#define slkErrSocketNotOpen (slkErrorClass | 14)
+#define slkErrWrongDestSocket (slkErrorClass | 15)
+#define slkErrWrongPktType (slkErrorClass | 16)
+#define slkErrBusy (slkErrorClass | 17) // called while sending a packet
+ // only returned on single-threaded
+ // emulation implementations
+#define slkErrNotOpen (slkErrorClass | 18)
+
+
+
+/*******************************************************************
+ * Type definition for a Serial Link Socket Listener
+ *
+ *******************************************************************/
+typedef void (*SlkSocketListenerProcPtr)
+ (SlkPktHeaderPtr headerP, void *bodyP);
+
+typedef struct SlkSocketListenType {
+ SlkSocketListenerProcPtr listenerP;
+ SlkPktHeaderPtr headerBufferP; // App allocated buffer for header
+ void* bodyBufferP; // App allocated buffer for body
+ UInt32 bodyBufferSize;
+ } SlkSocketListenType;
+typedef SlkSocketListenType* SlkSocketListenPtr;
+
+
+
+/*******************************************************************
+ * Prototypes
+ *******************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//-------------------------------------------------------------------
+// Initializes the Serial Link Manager
+//-------------------------------------------------------------------
+Err SlkOpen(void)
+ SYS_TRAP(sysTrapSlkOpen);
+
+//-------------------------------------------------------------------
+// Close down the Serial Link Manager
+//-------------------------------------------------------------------
+Err SlkClose(void)
+ SYS_TRAP(sysTrapSlkClose);
+
+
+
+
+//-------------------------------------------------------------------
+// Open up another Serial Link socket. The caller must have already
+// opened the comm library and set it to the right settings.
+//-------------------------------------------------------------------
+
+Err SlkOpenSocket(UInt16 portID, UInt16 *socketP, Boolean staticSocket)
+ SYS_TRAP(sysTrapSlkOpenSocket);
+
+
+//-------------------------------------------------------------------
+// Close up a Serial Link socket.
+// Warning: This routine is assymetrical with SlkOpenSocket because it
+// WILL CLOSE the library for the caller (unless the refNum is the
+// refNum of the debugger comm library).
+//-------------------------------------------------------------------
+Err SlkCloseSocket(UInt16 socket)
+ SYS_TRAP(sysTrapSlkCloseSocket);
+
+
+//-------------------------------------------------------------------
+// Get the library refNum for a particular Socket
+//-------------------------------------------------------------------
+
+
+ Err SlkSocketPortID(UInt16 socket, UInt16 *portIDP)
+ SYS_TRAP(sysTrapSlkSocketRefNum);
+
+ #define SlkSocketRefNum SlkSocketPortID
+
+
+//-------------------------------------------------------------------
+// Set the in-packet timeout for a socket
+//-------------------------------------------------------------------
+Err SlkSocketSetTimeout(UInt16 socket, Int32 timeout)
+ SYS_TRAP(sysTrapSlkSocketSetTimeout);
+
+
+
+
+
+//-------------------------------------------------------------------
+// Flush a Socket
+//-------------------------------------------------------------------
+Err SlkFlushSocket(UInt16 socket, Int32 timeout)
+ SYS_TRAP(sysTrapSlkFlushSocket);
+
+
+//-------------------------------------------------------------------
+// Set up a Socket Listener
+//-------------------------------------------------------------------
+Err SlkSetSocketListener(UInt16 socket, SlkSocketListenPtr socketP)
+ SYS_TRAP(sysTrapSlkSetSocketListener);
+
+
+//-------------------------------------------------------------------
+// Sends a packet's header, body, footer. Stuffs the header's
+// magic number and checksum fields. Expects all other
+// header fields to be filled in by caller.
+// errors returned: dseHandle, dseLine, dseIO, dseParam, dseBodyLimit,
+// dseOther
+//-------------------------------------------------------------------
+Err SlkSendPacket(SlkPktHeaderPtr headerP, SlkWriteDataPtr writeList)
+ SYS_TRAP(sysTrapSlkSendPacket);
+
+
+//-------------------------------------------------------------------
+// Receives and validates an entire packet.
+// errors returned: dseHandle, dseParam, dseLine, dseIO, dseFormat,
+// dseChecksum, dseBuffer, dseBodyLimit, dseTimeOut,
+// dseOther
+//-------------------------------------------------------------------
+Err SlkReceivePacket( UInt16 socket, Boolean andOtherSockets,
+ SlkPktHeaderPtr headerP, void *bodyP, UInt16 bodySize,
+ Int32 timeout)
+ SYS_TRAP(sysTrapSlkReceivePacket);
+
+
+//-------------------------------------------------------------------
+// Do Default processing of a System packet
+//-------------------------------------------------------------------
+Err SlkSysPktDefaultResponse(SlkPktHeaderPtr headerP, void *bodyP)
+ SYS_TRAP(sysTrapSlkSysPktDefaultResponse);
+
+//-------------------------------------------------------------------
+// Do RPC call
+//-------------------------------------------------------------------
+Err SlkProcessRPC(SlkPktHeaderPtr headerP, void *bodyP)
+ SYS_TRAP(sysTrapSlkProcessRPC);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif //__SERIAL_LINK_H
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SerialMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/SerialMgr.h
new file mode 100644
index 0000000..d59687f
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SerialMgr.h
@@ -0,0 +1,371 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SerialMgr.h
+ *
+ * Description:
+ * Include file for Serial manager
+ *
+ * History:
+ * 1/14/98 SerialMgr.h created by Ben Manuto
+ *
+ *****************************************************************************/
+
+#ifndef __SERIALMGR_H
+#define __SERIALMGR_H
+
+
+// Pilot common definitions
+#include <PalmTypes.h>
+#include <ErrorBase.h>
+
+// New Serial manager feature number
+#define sysFtrNewSerialPresent 1
+
+/********************************************************************
+ * Serial Manager Errors
+ * the constant serErrorClass is defined in SystemMgr.h
+ ********************************************************************/
+
+#define serErrBadParam (serErrorClass | 1)
+#define serErrBadPort (serErrorClass | 2)
+#define serErrNoMem (serErrorClass | 3)
+#define serErrBadConnID (serErrorClass | 4)
+#define serErrTimeOut (serErrorClass | 5)
+#define serErrLineErr (serErrorClass | 6)
+#define serErrAlreadyOpen (serErrorClass | 7)
+#define serErrStillOpen (serErrorClass | 8)
+#define serErrNotOpen (serErrorClass | 9)
+#define serErrNotSupported (serErrorClass | 10) // functionality not supported
+#define serErrNoDevicesAvail (serErrorClass | 11) // No serial devices were loaded or are available.
+
+
+//
+// mask values for the lineErrors from SerGetStatus
+//
+
+#define serLineErrorParity 0x0001 // parity error
+#define serLineErrorHWOverrun 0x0002 // HW overrun
+#define serLineErrorFraming 0x0004 // framing error
+#define serLineErrorBreak 0x0008 // break signal asserted
+#define serLineErrorHShake 0x0010 // line hand-shake error
+#define serLineErrorSWOverrun 0x0020 // HW overrun
+#define serLineErrorCarrierLost 0x0040 // CD dropped
+
+
+/********************************************************************
+ * Serial Port Definitions
+ ********************************************************************/
+
+#define serPortLocalHotSync 0x8000 // Use physical HotSync port
+
+#define serPortCradlePort 0x8000 // Use the RS-232 cradle port.
+#define serPortIrPort 0x8001 // Use available IR port.
+
+
+// This constant is used by the Serial Link Mgr only
+#define serPortIDMask 0xC000
+
+
+/********************************************************************
+ * Serial Settings Descriptor
+ ********************************************************************/
+
+#define srmSettingsFlagStopBitsM 0x00000001 // mask for stop bits field
+#define srmSettingsFlagStopBits1 0x00000000 // 1 stop bits
+#define srmSettingsFlagStopBits2 0x00000001 // 2 stop bits
+#define srmSettingsFlagParityOnM 0x00000002 // mask for parity on
+#define srmSettingsFlagParityEvenM 0x00000004 // mask for parity even
+#define srmSettingsFlagXonXoffM 0x00000008 // (NOT IMPLEMENTED) mask for Xon/Xoff flow control
+#define srmSettingsFlagRTSAutoM 0x00000010 // mask for RTS rcv flow control
+#define srmSettingsFlagCTSAutoM 0x00000020 // mask for CTS xmit flow control
+#define srmSettingsFlagBitsPerCharM 0x000000C0 // mask for bits/char
+#define srmSettingsFlagBitsPerChar5 0x00000000 // 5 bits/char
+#define srmSettingsFlagBitsPerChar6 0x00000040 // 6 bits/char
+#define srmSettingsFlagBitsPerChar7 0x00000080 // 7 bits/char
+#define srmSettingsFlagBitsPerChar8 0x000000C0 // 8 bits/char
+#define srmSettingsFlagFlowControl 0x00000100 // mask for enabling/disabling special flow control feature
+ // for the software receive buffer.
+
+
+// Default settings
+#define srmDefaultSettings (srmSettingsFlagBitsPerChar8 | \
+ srmSettingsFlagStopBits1 | \
+ srmSettingsFlagRTSAutoM)
+
+#define srmDefaultCTSTimeout (5*sysTicksPerSecond)
+
+
+// Status bitfield constants
+
+#define srmStatusCtsOn 0x00000001
+#define srmStatusRtsOn 0x00000002
+#define srmStatusDsrOn 0x00000004
+#define srmStatusBreakSigOn 0x00000008
+
+
+//
+// Info fields describing serial HW capabilities.
+//
+
+#define serDevCradlePort 0x00000001 // Serial HW controls RS-232 serial from cradle connector of Pilot.
+#define serDevRS232Serial 0x00000002 // Serial HW has RS-232 line drivers
+#define serDevIRDACapable 0x00000004 // Serial Device has IR line drivers and generates IRDA mode serial.
+#define serDevModemPort 0x00000008 // Serial deivce drives modem connection.
+#define serDevCncMgrVisible 0x00000010 // Serial device port name string to be displayed in Connection Mgr panel.
+
+
+typedef struct DeviceInfoType {
+ UInt32 serDevCreator; // Four Character creator type for serial driver ('sdrv')
+ UInt32 serDevFtrInfo; // Flags defining features of this serial hardware.
+ UInt32 serDevMaxBaudRate; // Maximum baud rate for this device.
+ UInt32 serDevHandshakeBaud; // HW Handshaking is reccomended for baud rates over this
+ Char *serDevPortInfoStr; // Description of serial HW device or virtual device.
+ UInt8 reserved[8]; // Reserved.
+} DeviceInfoType;
+
+typedef DeviceInfoType *DeviceInfoPtr;
+
+
+/********************************************************************
+ * Type of a wakeup handler procedure which can be installed through the
+ * SerSetWakeupHandler() call.
+ ********************************************************************/
+typedef void (*WakeupHandlerProcPtr)(UInt32 refCon);
+
+/********************************************************************
+ * Type of an emulator-mode only blocking hook routine installed via
+ * SerControl function serCtlEmuSetBlockingHook. This is supported only
+ * under emulation mode. The argument to the function is the value
+ * specified in the SerCallbackEntryType structure. The intention of the
+ * return value is to return false if serial manager should abort the
+ * current blocking action, such as when an app quit event has been received;
+ * otherwise, it should return true. However, in the current implementation,
+ * this return value is ignored. The callback can additionally process
+ * events to enable user interaction with the UI, such as interacting with the
+ * debugger.
+ ********************************************************************/
+typedef Boolean (*BlockingHookProcPtr) (UInt32 userRef);
+
+
+/********************************************************************
+ * Serial Library Control Enumerations (Pilot 2.0)
+ ********************************************************************/
+
+/********************************************************************
+ * Structure for specifying callback routines.
+ ********************************************************************/
+typedef struct SrmCallbackEntryType {
+ BlockingHookProcPtr funcP; // function pointer
+ UInt32 userRef; // ref value to pass to callback
+} SrmCallbackEntryType;
+typedef SrmCallbackEntryType* SrmCallbackEntryPtr;
+
+
+typedef enum SrmCtlEnum {
+ srmCtlFirstReserved = 0, // RESERVE 0
+
+ srmCtlSetBaudRate, // Sets the current baud rate for the HW.
+ // valueP = MemPtr to Int32, valueLenP = MemPtr to sizeof(Int32)
+
+ srmCtlGetBaudRate, // Gets the current baud rate for the HW.
+
+ srmCtlSetFlags, // Sets the current flag settings for the serial HW.
+
+ srmCtlGetFlags, // Gets the current flag settings the serial HW.
+
+ srmCtlSetCtsTimeout, // Sets the current Cts timeout value.
+
+ srmCtlGetCtsTimeout, // Gets the current Cts timeout value.
+
+ srmCtlStartBreak, // turn RS232 break signal on:
+ // users are responsible for ensuring that the break is set
+ // long enough to genearate a valid BREAK!
+ // valueP = 0, valueLenP = 0
+
+ srmCtlStopBreak, // turn RS232 break signal off:
+ // valueP = 0, valueLenP = 0
+
+ srmCtlStartLocalLoopback, // Start local loopback test
+ // valueP = 0, valueLenP = 0
+
+ srmCtlStopLocalLoopback, // Stop local loopback test
+ // valueP = 0, valueLenP = 0
+
+
+ srmCtlIrDAEnable, // Enable IrDA connection on this serial port
+ // valueP = 0, valueLenP = 0
+
+ srmCtlIrDADisable, // Disable IrDA connection on this serial port
+ // valueP = 0, valueLenP = 0
+
+ srmCtlRxEnable, // enable receiver ( for IrDA )
+
+ srmCtlRxDisable, // disable receiver ( for IrDA )
+
+ srmCtlEmuSetBlockingHook, // Set a blocking hook routine FOR EMULATION
+ // MODE ONLY - NOT SUPPORTED ON THE PILOT
+ //PASS:
+ // valueP = MemPtr to SerCallbackEntryType
+ // *valueLenP = sizeof(SerCallbackEntryType)
+ //RETURNS:
+ // the old settings in the first argument
+
+ srmCtlUserDef, // Specifying this opCode passes through a user-defined
+ // function to the DrvControl function. This is for use
+ // specifically by serial driver developers who need info
+ // from the serial driver that may not be available through the
+ // standard SrmMgr interface.
+
+ srmCtlGetOptimalTransmitSize, // This function will ask the port for the most efficient buffer size
+ // for transmitting data packets. This opCode returns serErrNotSupported
+ // if the physical or virtual device does not support this feature.
+ // The device can return a transmit size of 0, if send buffering is
+ // requested, but the actual size is up to the caller to choose.
+ // valueP = MemPtr to UInt32 --> return optimal buf size
+ // ValueLenP = sizeof(UInt32)
+
+ srmCtlSetDTRAsserted, // Enable or disable DTR.
+
+ srmCtlGetDTRAsserted, // Determine if DTR is enabled or disabled.
+
+ srmCtlLAST // ***** ADD NEW ENTRIES BEFORE THIS ONE
+
+} SrmCtlEnum;
+
+
+
+/********************************************************************
+ * Serial Hardware Library Routines
+ ********************************************************************/
+
+#ifdef BUILDING_NEW_SERIAL_MGR
+ #define SERIAL_TRAP(serialSelectorNum)
+#else
+ #define SERIAL_TRAP(serialSelectorNum) \
+ _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapSerialDispatch, \
+ serialSelectorNum)
+#endif
+
+
+// *****************************************************************
+// * New Serial Manager trap selectors
+// *****************************************************************
+
+typedef enum { // The order of this enum *MUST* match the sysSerialSelector in SerialMgr.c
+ sysSerialInstall = 0,
+ sysSerialOpen,
+ sysSerialOpenBkgnd,
+ sysSerialClose,
+ sysSerialSleep,
+ sysSerialWake,
+ sysSerialGetDeviceCount,
+ sysSerialGetDeviceInfo,
+ sysSerialGetStatus,
+ sysSerialClearErr,
+ sysSerialControl,
+ sysSerialSend,
+ sysSerialSendWait,
+ sysSerialSendCheck,
+ sysSerialSendFlush,
+ sysSerialReceive,
+ sysSerialReceiveWait,
+ sysSerialReceiveCheck,
+ sysSerialReceiveFlush,
+ sysSerialSetRcvBuffer,
+ sysSerialRcvWindowOpen,
+ sysSerialRcvWindowClose,
+ sysSerialSetWakeupHandler,
+ sysSerialPrimeWakeupHandler,
+
+ maxSerialSelector = sysSerialPrimeWakeupHandler // Used by SerialMgrDispatch.c
+} sysSerialSelector;
+
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+Err SerialMgrInstall(void)
+ SERIAL_TRAP(sysSerialInstall);
+
+Err SrmOpen(UInt32 port, UInt32 baud, UInt16 *newPortIdP)
+ SERIAL_TRAP(sysSerialOpen);
+
+Err SrmOpenBackground(UInt32 port, UInt32 baud, UInt16 *newPortIdP)
+ SERIAL_TRAP(sysSerialOpenBkgnd);
+
+Err SrmClose(UInt16 portId)
+ SERIAL_TRAP(sysSerialClose);
+
+Err SrmSleep()
+ SERIAL_TRAP(sysSerialSleep);
+
+Err SrmWake()
+ SERIAL_TRAP(sysSerialWake);
+
+Err SrmGetDeviceCount(UInt16 *numOfDevicesP)
+ SERIAL_TRAP(sysSerialGetDeviceCount);
+
+Err SrmGetDeviceInfo(UInt32 deviceID, DeviceInfoType *deviceInfoP)
+ SERIAL_TRAP(sysSerialGetDeviceInfo);
+
+Err SrmGetStatus(UInt16 portId, UInt32 *statusFieldP, UInt16 *lineErrsP)
+ SERIAL_TRAP(sysSerialGetStatus);
+
+Err SrmClearErr (UInt16 portId)
+ SERIAL_TRAP(sysSerialClearErr);
+
+Err SrmControl(UInt16 portId, UInt16 op, void *valueP, UInt16 *valueLenP)
+ SERIAL_TRAP(sysSerialControl);
+
+UInt32 SrmSend (UInt16 portId, void *bufP, UInt32 count, Err *errP)
+ SERIAL_TRAP(sysSerialSend);
+
+Err SrmSendWait(UInt16 portId)
+ SERIAL_TRAP(sysSerialSendWait);
+
+Err SrmSendCheck(UInt16 portId, UInt32 *numBytesP)
+ SERIAL_TRAP(sysSerialSendCheck);
+
+Err SrmSendFlush(UInt16 portId)
+ SERIAL_TRAP(sysSerialSendFlush);
+
+UInt32 SrmReceive(UInt16 portId, void *rcvBufP, UInt32 count, Int32 timeout, Err *errP)
+ SERIAL_TRAP(sysSerialReceive);
+
+Err SrmReceiveWait(UInt16 portId, UInt32 bytes, Int32 timeout)
+ SERIAL_TRAP(sysSerialReceiveWait);
+
+Err SrmReceiveCheck(UInt16 portId, UInt32 *numBytesP)
+ SERIAL_TRAP(sysSerialReceiveCheck);
+
+Err SrmReceiveFlush(UInt16 portId, Int32 timeout)
+ SERIAL_TRAP(sysSerialReceiveFlush);
+
+Err SrmSetReceiveBuffer(UInt16 portId, void *bufP, UInt16 bufSize)
+ SERIAL_TRAP(sysSerialSetRcvBuffer);
+
+Err SrmReceiveWindowOpen(UInt16 portId, UInt8 **bufPP, UInt32 *sizeP)
+ SERIAL_TRAP(sysSerialRcvWindowOpen);
+
+Err SrmReceiveWindowClose(UInt16 portId, UInt32 bytesPulled)
+ SERIAL_TRAP(sysSerialRcvWindowClose);
+
+Err SrmSetWakeupHandler(UInt16 portId, WakeupHandlerProcPtr procP, UInt32 refCon)
+ SERIAL_TRAP(sysSerialSetWakeupHandler);
+
+Err SrmPrimeWakeupHandler(UInt16 portId, UInt16 minBytes)
+ SERIAL_TRAP(sysSerialPrimeWakeupHandler);
+
+void SrmSelectorErrPrv (UInt16 serialSelector); // used only by SerialMgrDispatch.c
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif // __SERIALMGR_H
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SoundMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/SoundMgr.h
new file mode 100644
index 0000000..25a7d15
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SoundMgr.h
@@ -0,0 +1,317 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SoundMgr.h
+ *
+ * Description:
+ * Include file for Sound Manager
+ *
+ * History:
+ * 4/11/95 VMK - Created by Vitaly Kruglikov
+ *
+ *****************************************************************************/
+
+#ifndef __SOUNDMGR_H__
+#define __SOUNDMGR_H__
+
+
+// Include elementary types
+#include <PalmTypes.h>
+#include <CoreTraps.h> // Trap Numbers.
+
+#include <Preferences.h>
+
+
+/************************************************************
+ * Sound Manager constants
+ *
+ *************************************************************/
+
+// Sound Manager max and default volume levels
+#define sndMaxAmp 64
+//#define sndVolumeMask 0x0ff
+#define sndDefaultAmp sndMaxAmp
+
+#define sndMidiNameLength 32 // MIDI track name length *including* NULL terminator
+
+
+/************************************************************
+ * Sound Manager data structures
+ *
+ *************************************************************/
+
+//
+// Command numbers for SndCommandType's cmd field
+//
+typedef enum SndCmdIDType {
+
+ sndCmdFreqDurationAmp = 1, // play a sound, blocking for the entire duration (except for zero amplitude)
+ // param1 = frequency in Hz
+ // param2 = duration in milliseconds
+ // param3 = amplitude (0 - sndMaxAmp); if 0, will return immediately
+
+ // Commands added in PilotOS v3.0
+ // ***IMPORTANT***
+ // Please note that SndDoCmd() in PilotOS before v3.0 will Fatal Error on unknown
+ // commands (anything other than sndCmdFreqDurationAmp). For this reason,
+ // applications wishing to take advantage of these new commands while staying
+ // compatible with the earlier version of the OS, _must_ avoid using these commands
+ // when running on OS versions less thatn v3.0 (see sysFtrNumROMVersion in SystemMgr.h).
+ // Beginning with v3.0, SndDoCmd has been fixed to return sndErrBadParam when an
+ // unknown command is passed.
+ //
+ sndCmdNoteOn, // start a sound given its MIDI key index, max duration and velocity;
+ // the call will not wait for the sound to complete, returning imeediately;
+ // any other sound play request made before this one completes will interrupt it.
+ // param1 = MIDI key index (0-127)
+ // param2 = maximum duration in milliseconds
+ // param3 = velocity (0 - 127) (will be interpolated as amplitude)
+
+ sndCmdFrqOn, // start a sound given its frequency in Hz, max duration and amplitude;
+ // the call will not wait for the sound to complete, returning imeediately;
+ // any other sound play request made before this one completes will interrupt it.
+ // param1 = frequency in Hz
+ // param2 = maximum duration in milliseconds
+ // param3 = amplitude (0 - sndMaxAmp)
+
+ sndCmdQuiet // stop current sound
+ // param1 = 0
+ // param2 = 0
+ // param3 = 0
+
+ } SndCmdIDType;
+
+
+
+
+//
+// SndCommandType: used by SndDoCmd()
+//
+
+typedef struct SndCommandType {
+//SndCmdIDType cmd; // command id
+UInt8 cmd; // command id
+UInt8 reserved;
+Int32 param1; // first parameter
+UInt16 param2; // second parameter
+UInt16 param3; // third parameter
+} SndCommandType;
+
+typedef SndCommandType* SndCommandPtr;
+
+
+//
+// Beep numbers used by SndSysBeep()
+//
+
+typedef enum SndSysBeepType {
+ sndInfo = 1,
+ sndWarning,
+ sndError,
+ sndStartUp,
+ sndAlarm,
+ sndConfirmation,
+ sndClick
+ } SndSysBeepType;
+
+
+/************************************************************
+ * Standard MIDI File (SMF) support structures
+ *************************************************************/
+
+
+// Structure of records in the MIDI sound database:
+//
+// Each MIDI record consists of a record header followed immediately by the
+// Standard MIDI File (SMF) data stream. Only SMF format #0 is presently supported.
+// The first byte of the record header is the byte offset from the beginning of the record
+// to the SMF data stream. The name of the record follows the byte offset
+// field. sndMidiNameLength is the limit on name size (including NULL).
+#define sndMidiRecSignature 'PMrc'
+typedef struct SndMidiRecHdrType {
+ UInt32 signature; // set to sndMidiRecSignature
+ UInt8 bDataOffset; // offset from the beginning of the record
+ // to the Standard Midi File data stream
+ UInt8 reserved; // set to zero
+ } SndMidiRecHdrType;
+
+typedef struct SndMidiRecType {
+ SndMidiRecHdrType hdr; // offset from the beginning of the record
+ // to the Standard Midi File data stream
+ Char name[2]; // Track name: 1 or more chars including NULL terminator.
+ // If a track has no name, the NULL character must still
+ // be provided.
+ // Set to 2 to pad the structure out to a word boundary.
+ } SndMidiRecType;
+
+
+// Midi records found by SndCreateMidiList.
+typedef struct SndMidiListItemType
+ {
+ Char name[sndMidiNameLength]; // including NULL terminator
+ UInt32 uniqueRecID;
+ LocalID dbID;
+ UInt16 cardNo;
+ } SndMidiListItemType;
+
+
+// Commands for SndPlaySmf
+typedef enum SndSmfCmdEnum {
+ sndSmfCmdPlay = 1, // play the selection
+ sndSmfCmdDuration // get the duration in milliseconds of the entire track
+ } SndSmfCmdEnum;
+
+typedef void SndComplFuncType(void *chanP, UInt32 dwUserData);
+typedef SndComplFuncType *SndComplFuncPtr;
+
+
+// Return true to continue, false to abort
+typedef Boolean SndBlockingFuncType(void *chanP, UInt32 dwUserData, Int32 sysTicksAvailable);
+typedef SndBlockingFuncType *SndBlockingFuncPtr;
+
+typedef struct SndCallbackInfoType {
+ MemPtr funcP; // pointer to the callback function (NULL = no function)
+ UInt32 dwUserData; // value to be passed in the dwUserData parameter of the callback function
+ } SndCallbackInfoType;
+
+
+typedef struct SndSmfCallbacksType {
+ SndCallbackInfoType completion; // completion callback function (see SndComplFuncType)
+ SndCallbackInfoType blocking; // blocking hook callback function (see SndBlockingFuncType)
+ SndCallbackInfoType reserved; // RESERVED -- SET ALL FIELDS TO ZERO BEFORE PASSING
+ } SndSmfCallbacksType;
+
+
+#define sndSmfPlayAllMilliSec 0xFFFFFFFFUL
+
+typedef struct SndSmfOptionsType {
+ // dwStartMilliSec and dwEndMilliSec are used as inputs to the function for sndSmfCmdPlay and as
+ // outputs for sndSmfCmdDuration
+ UInt32 dwStartMilliSec; // 0 = "start from the beginning"
+ UInt32 dwEndMilliSec; // sndSmfPlayAllMilliSec = "play the entire track";
+ // the default is "play entire track" if this structure
+ // is not passed in
+
+ // The amplitude and interruptible fields are used only for sndSmfCmdPlay
+ UInt16 amplitude; // relative volume: 0 - sndMaxAmp, inclusively; the default is
+ // sndMaxAmp if this structure is not passed in; if 0, the play will
+ // be skipped and the call will return immediately
+
+ Boolean interruptible; // if true, sound play will be interrupted if
+ // user interacts with the controls (digitizer, buttons, etc.);
+ // if false, the paly will not be interrupted; the default behavior
+ // is "interruptible" if this structure is not passed in
+
+ UInt8 reserved1;
+ UInt32 reserved; // RESERVED! -- MUST SET TO ZERO BEFORE PASSING
+ } SndSmfOptionsType;
+
+
+typedef struct SndSmfChanRangeType {
+ UInt8 bFirstChan; // first MIDI channel (0-15 decimal)
+ UInt8 bLastChan; // last MIDI channel (0-15 decimal)
+ } SndSmfChanRangeType;
+
+
+
+
+/************************************************************
+ * Sound Manager result codes
+ * (sndErrorClass is defined in SystemMgr.h)
+ *************************************************************/
+#define sndErrBadParam (sndErrorClass | 1)
+#define sndErrBadChannel (sndErrorClass | 2)
+#define sndErrMemory (sndErrorClass | 3)
+#define sndErrOpen (sndErrorClass | 4)
+#define sndErrQFull (sndErrorClass | 5)
+#define sndErrQEmpty (sndErrorClass | 6) // internal
+#define sndErrFormat (sndErrorClass | 7) // unsupported data format
+#define sndErrBadStream (sndErrorClass | 8) // invalid data stream
+#define sndErrInterrupted (sndErrorClass | 9) // play was interrupted
+
+
+
+/********************************************************************
+ * Sound Manager Routines
+ * These are define as external calls only under emulation mode or
+ * under native mode from the module that actually installs the trap
+ * vectors
+ ********************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//-------------------------------------------------------------------
+// Initialization
+//-------------------------------------------------------------------
+
+// Initializes the Sound Manager. Should only be called by
+// Pilot initialization code.
+Err SndInit(void) SYS_TRAP(sysTrapSndInit);
+
+// Frees the Sound Manager.
+//void SndFree(void) SYS_TRAP(sysTrapSndFree);
+
+
+//-------------------------------------------------------------------
+// API
+//-------------------------------------------------------------------
+
+// Sets default sound volume levels
+//
+// Any parameter may be passed as NULL
+extern void SndSetDefaultVolume(UInt16 *alarmAmpP, UInt16 *sysAmpP, UInt16 *defAmpP)
+ SYS_TRAP(sysTrapSndSetDefaultVolume);
+
+// Gets default sound volume levels
+//
+// Any parameter may be passed as NULL
+extern void SndGetDefaultVolume(UInt16 *alarmAmpP, UInt16 *sysAmpP, UInt16 *masterAmpP)
+ SYS_TRAP(sysTrapSndGetDefaultVolume);
+
+// Executes a sound command on the given sound channel (pass
+// channelP = 0 to use the shared channel).
+extern Err SndDoCmd(void * /*SndChanPtr*/ channelP, SndCommandPtr cmdP, Boolean noWait)
+ SYS_TRAP(sysTrapSndDoCmd);
+
+// Plays one of several defined system beeps/sounds (see sndSysBeep...
+// constants).
+extern void SndPlaySystemSound(SndSysBeepType beepID)
+ SYS_TRAP(sysTrapSndPlaySystemSound);
+
+
+// NEW FOR v3.0
+// Performs an operation on a Standard MIDI File (SMF) Format #0
+extern Err SndPlaySmf(void *chanP, SndSmfCmdEnum cmd, UInt8 *smfP, SndSmfOptionsType *selP,
+ SndSmfChanRangeType *chanRangeP, SndSmfCallbacksType *callbacksP,
+ Boolean bNoWait)
+ SYS_TRAP(sysTrapSndPlaySmf);
+
+// NEW FOR v3.0
+// Creates a list of all midi records. Useful for displaying in lists.
+// For creator wildcard, pass creator=0;
+extern Boolean SndCreateMidiList(UInt32 creator, Boolean multipleDBs, UInt16 *wCountP, MemHandle *entHP)
+ SYS_TRAP(sysTrapSndCreateMidiList);
+
+// NEW FOR v3.2
+// Plays a MIDI sound which is read out of an open resource database
+extern Err SndPlaySmfResource(UInt32 resType, Int16 resID, SystemPreferencesChoice volumeSelector)
+ SYS_TRAP(sysTrapSndPlaySmfResource);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+/************************************************************
+ * Sound Manager Macros
+ *
+ *************************************************************/
+
+#endif // __SOUND_MGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SysEvent.h b/SrcShared/Palm/Platform/Incs/Core/System/SysEvent.h
new file mode 100644
index 0000000..7f67624
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SysEvent.h
@@ -0,0 +1,204 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SysEvent.h
+ *
+ * Description:
+ * This file defines event structures and routines.
+ *
+ * History:
+ * September 26, 1994 Created by Art Lamb
+ * 05/05/98 art Add Text Services event.
+ * 07/23/98 kwk Changed UInt16 field in keyDown event to WChar.
+ * 08/20/98 kwk Split tsmEvent into tsmConfirmEvent & tsmFepButtonEvent.
+ * 09/07/98 kwk Added EvtPeekEvent routine declaration.
+ * 10/13/98 kwk Removed EvtPeekEvent until API can be finalized.
+ * 03/11/99 grant Fixed types of pointers in SysEventType data fields.
+ * 05/31/99 kwk Added tsmFepModeEvent event.
+ * 07/14/99 jesse Moved UI structures & constants to Event.h
+ * defined ranges for future UI & system events.
+ * 07/30/99 kwk Moved TSM events here from Event.h
+ * 09/12/99 gap Add new multi-tap implementation
+ * 09/14/99 gap Removed EvtGetTrapState.
+ *
+ *****************************************************************************/
+
+#ifndef __SYSEVENT_H__
+#define __SYSEVENT_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+#include <Font.h>
+#include <Rect.h>
+#include <Window.h>
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER ¥¥¥ Don't use an enum for this, as convenient as it is, there's namespace
+// pollution, size issues, no way to manage componentization, blah blah blah.
+#endif // PUBLIC_STUFF_STRIPPED
+
+typedef enum {
+ sysEventNilEvent = 0,
+ sysEventPenDownEvent,
+ sysEventPenUpEvent,
+ sysEventPenMoveEvent,
+ sysEventKeyDownEvent,
+ sysEventWinEnterEvent,
+ sysEventWinExitEvent,
+ sysEventAppStopEvent = 22,
+ sysEventTsmConfirmEvent = 35,
+ sysEventTsmFepButtonEvent,
+ sysEventTsmFepModeEvent,
+
+ // add future UI level events in this numeric space
+ // to save room for new system level events
+ sysEventNextUIEvent = 0x0800,
+
+ // <chg 2-25-98 RM> Equates added for library events
+ sysEventFirstINetLibEvent = 0x1000,
+ sysEventFirstWebLibEvent = 0x1100,
+
+ // <chg 10/9/98 SCL> Changed firstUserEvent from 32767 (0x7FFF) to 0x6000
+ // Enums are signed ints, so 32767 technically only allowed for ONE event.
+ sysEventFirstUserEvent = 0x6000
+} SysEventsEnum;
+
+
+
+// keyDownEvent modifers
+#define shiftKeyMask 0x0001
+#define capsLockMask 0x0002
+#define numLockMask 0x0004
+#define commandKeyMask 0x0008
+#define optionKeyMask 0x0010
+#define controlKeyMask 0x0020
+#define autoRepeatKeyMask 0x0040 // True if generated due to auto-repeat
+#define doubleTapKeyMask 0x0080 // True if this is a double-tap event
+#define poweredOnKeyMask 0x0100 // True if this is a double-tap event
+#define appEvtHookKeyMask 0x0200 // True if this is an app hook key
+#define libEvtHookKeyMask 0x0400 // True if this is a library hook key
+
+// define mask for all "virtual" keys
+#define virtualKeyMask (appEvtHookKeyMask | libEvtHookKeyMask | commandKeyMask)
+
+
+// Event timeouts
+#define evtWaitForever -1
+#define evtNoWait 0
+
+struct _GenericEventType {
+ UInt16 datum[8];
+ };
+
+struct _PenUpEventType {
+ PointType start; // display coord. of stroke start
+ PointType end; // display coord. of stroke start
+ };
+
+struct _KeyDownEventType {
+ WChar chr; // ascii code
+ UInt16 keyCode; // virtual key code
+ UInt16 modifiers;
+ };
+
+struct _WinEnterEventType {
+ WinHandle enterWindow;
+ WinHandle exitWindow;
+ };
+
+struct _WinExitEventType {
+ WinHandle enterWindow;
+ WinHandle exitWindow;
+ };
+
+struct _TSMConfirmType {
+ Char * yomiText;
+ UInt16 formID;
+ };
+
+struct _TSMFepButtonType {
+ UInt16 buttonID;
+ };
+
+struct _TSMFepModeEventType {
+ UInt16 mode; // DOLATER kwk - use real type for mode?
+ };
+
+
+// The event record.
+typedef struct SysEventType {
+ SysEventsEnum eType;
+ Boolean penDown;
+ UInt8 tapCount;
+ Coord screenX;
+ Coord screenY;
+ union {
+ struct _GenericEventType generic;
+
+ struct _PenUpEventType penUp;
+ struct _KeyDownEventType keyDown;
+ struct _WinEnterEventType winEnter;
+ struct _WinExitEventType winExit;
+ struct _TSMConfirmType tsmConfirm;
+ struct _TSMFepButtonType tsmFepButton;
+ struct _TSMFepModeEventType tsmFepMode;
+
+ } data;
+
+} SysEventType;
+
+
+// Events are stored in the event queue with some extra fields:
+typedef struct {
+ SysEventType event;
+ UInt32 id; // used to support EvtAddUniqueEvent
+ } SysEventStoreType;
+
+#ifndef PUBLIC_STUFF_STRIPPED // removed header that should be moved into private area
+
+//---------------------------------------------------------------------
+// Event Functions
+//---------------------------------------------------------------------
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* DOLATER: jwm: This lot should be in a private header file, no? */
+
+void SysEventInitialize (void)
+ SYS_TRAP(sysTrapEvtInitialize);
+
+void SysEventAddToQueue (const SysEventType *event)
+ SYS_TRAP(sysTrapEvtAddEventToQueue);
+
+void SysEventAddUniqueToQueue(const SysEventType *eventP, UInt32 id,
+ Boolean inPlace)
+ SYS_TRAP(sysTrapEvtAddUniqueEventToQueue);
+
+void SysEventCopy (const SysEventType *source, SysEventType *dest)
+ SYS_TRAP(sysTrapEvtCopyEvent);
+
+void SysEventGet (SysEventType *event, Int32 timeout)
+ SYS_TRAP(sysTrapEvtGetEvent);
+
+Boolean SysEventAvail (void)
+ SYS_TRAP(sysTrapEvtEventAvail);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+// For Compatibility.. DOLATER... source modules should use EvtGetPen instead.
+#endif // PUBLIC_STUFF_STRIPPED
+#define PenGetPoint(a,b,c) EvtGetPen(a,b,c)
+
+
+
+#endif // __SYSEVENT_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SysEvtMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/SysEvtMgr.h
new file mode 100644
index 0000000..f9d257f
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SysEvtMgr.h
@@ -0,0 +1,252 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SysEvtMgr.h
+ *
+ * Description:
+ * Header for the System Event Manager
+ *
+ * History:
+ * 03/22/95 RM Created by Ron Marianetti
+ * 07/23/98 kwk Changed UInt16 param in EvtEnqueueKey to WChar.
+ *
+ *****************************************************************************/
+
+#ifndef __SYSEVTMGR_H__
+#define __SYSEVTMGR_H__
+
+#include <PalmTypes.h>
+#include <SysEvent.h>
+
+/************************************************************
+ * System Event Manager Errors
+ *************************************************************/
+#define evtErrParamErr (evtErrorClass | 1)
+#define evtErrQueueFull (evtErrorClass | 2)
+#define evtErrQueueEmpty (evtErrorClass | 3)
+
+
+/************************************************************
+ * Commands for EvtSetAutoOffTimer()
+ *************************************************************/
+typedef enum
+{
+ SetAtLeast, // turn off in at least xxx seconds
+ SetExactly, // turn off in xxx seconds
+ SetAtMost, // turn off in at most xxx seconds
+ SetDefault, // change default auto-off timeout to xxx seconds
+ ResetTimer // reset the timer to the default auto-off timeout
+
+} EvtSetAutoOffCmd;
+
+
+/************************************************************
+ * Pen button info structure. This structure is used
+ * to hold the bounds of each button on the silk screen and
+ * the ascii code and modifiers byte that each will generate
+ * when tapped by the user.
+ *************************************************************/
+typedef struct PenBtnInfoType {
+ RectangleType boundsR; // bounding rectangle of button
+ WChar asciiCode; // ascii code for key event
+ UInt16 keyCode; // virtual key code for key event
+ UInt16 modifiers; // modifiers for key event
+ } PenBtnInfoType;
+typedef PenBtnInfoType* PenBtnInfoPtr;
+
+typedef struct PenBtnListType {
+ UInt16 numButtons; // Count of number of buttons
+ PenBtnInfoType buttons[1]; // Placeholder for one or more buttons
+ } PenBtnListType;
+
+
+/************************************************************
+ * Silkscreen area info structure. An array of these structures
+ * is returned by the EvtGetSilkscreenAreaList function.
+ *************************************************************/
+
+// Different types of rectangles on the display. For new vendor areas,
+// the type should be set to the vendor's creator code, as assigned
+// by 3Com's Partner Engineering group.
+#define silkscreenRectScreen 'scrn'
+#define silkscreenRectGraffiti 'graf'
+
+// Values for SilkscreenAreaType.index if areaType = silkscreenRectGraffiti
+#define alphaGraffitiSilkscreenArea 0
+#define numericGraffitiSilkscreenArea 1
+
+// One silkscreen area. The areaType field tells us which type of
+// area it is, while the index field has different meanings depending
+// on the area type.
+typedef struct SilkscreenAreaType {
+ RectangleType bounds;
+ UInt32 areaType; // four byte creator code.
+ UInt16 index;
+ } SilkscreenAreaType;
+
+
+/************************************************************
+ * System Event Manager procedures
+ *************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//-----------------------------------------------------------------
+// High Level Calls
+//------------------------------------------------------------------
+Err EvtSysInit(void)
+ SYS_TRAP(sysTrapEvtSysInit);
+
+// Return next "System" event. This routine will send strokes to Graffiti as necessary
+// and return a key event. Otherwise, it will return a simple pen down or pen
+// up event, or put the processor to sleep for a max time of 'timeout' if
+// no events are available.
+void EvtGetSysEvent(SysEventType *eventP, Int32 timeout)
+ SYS_TRAP(sysTrapEvtGetSysEvent);
+
+
+// Return true if there is a low level system event (pen or key) available
+Boolean EvtSysEventAvail(Boolean ignorePenUps)
+ SYS_TRAP(sysTrapEvtSysEventAvail);
+
+
+
+// Translate a stroke in the silk screen area to a key event
+Err EvtProcessSoftKeyStroke(PointType *startPtP, PointType *endPtP)
+ SYS_TRAP(sysTrapEvtProcessSoftKeyStroke);
+
+
+//-----------------------------------------------------------------
+// Pen Queue Utilties
+//------------------------------------------------------------------
+
+// Replace current pen queue with another of the given size
+Err EvtSetPenQueuePtr(MemPtr penQueueP, UInt32 size)
+ SYS_TRAP(sysTrapEvtSetPenQueuePtr);
+
+// Return size of current pen queue in bytes
+UInt32 EvtPenQueueSize(void)
+ SYS_TRAP(sysTrapEvtPenQueueSize);
+
+// Flush the pen queue
+Err EvtFlushPenQueue(void)
+ SYS_TRAP(sysTrapEvtFlushPenQueue);
+
+
+// Append a point to the pen queue. Passing -1 for x and y means
+// pen-up (terminate the current stroke). Called by digitizer interrupt routine
+Err EvtEnqueuePenPoint(PointType *ptP)
+ SYS_TRAP(sysTrapEvtEnqueuePenPoint);
+
+
+// Return the stroke info for the next stroke in the pen queue. This MUST
+// be the first call when removing a stroke from the queue
+Err EvtDequeuePenStrokeInfo(PointType *startPtP, PointType *endPtP)
+ SYS_TRAP(sysTrapEvtDequeuePenStrokeInfo);
+
+// Dequeue the next point from the pen queue. Returns non-0 if no
+// more points. The point returned will be (-1,-1) at the end
+// of the stroke.
+Err EvtDequeuePenPoint(PointType *retP)
+ SYS_TRAP(sysTrapEvtDequeuePenPoint);
+
+
+// Flush the entire stroke from the pen queue and dispose it
+Err EvtFlushNextPenStroke()
+ SYS_TRAP(sysTrapEvtFlushNextPenStroke);
+
+
+
+
+//-----------------------------------------------------------------
+// Key Queue Utilties
+//------------------------------------------------------------------
+
+// Replace current key queue with another of the given size. This routine will
+// intialize the given key queue before installing it
+Err EvtSetKeyQueuePtr(MemPtr keyQueueP, UInt32 size)
+ SYS_TRAP(sysTrapEvtSetKeyQueuePtr);
+
+// Return size of current key queue in bytes
+UInt32 EvtKeyQueueSize(void)
+ SYS_TRAP(sysTrapEvtKeyQueueSize);
+
+// Flush the key queue
+Err EvtFlushKeyQueue(void)
+ SYS_TRAP(sysTrapEvtFlushKeyQueue);
+
+
+// Append a key to the key queue.
+Err EvtEnqueueKey(WChar ascii, UInt16 keycode, UInt16 modifiers)
+ SYS_TRAP(sysTrapEvtEnqueueKey);
+
+// Return true of key queue empty.
+Boolean EvtKeyQueueEmpty(void)
+ SYS_TRAP(sysTrapEvtKeyQueueEmpty);
+
+
+// Pop off the next key event from the key queue and fill in the given
+// event record structure. Returns non-zero if there aren't any keys in the
+// key queue. If peek is non-zero, key will be left in key queue.
+Err EvtDequeueKeyEvent(SysEventType *eventP, UInt16 peek)
+ SYS_TRAP(sysTrapEvtDequeueKeyEvent);
+
+
+//-----------------------------------------------------------------
+// Silkscreen information calls
+//------------------------------------------------------------------
+
+// Return pointer to the pen based button list
+const PenBtnInfoType* EvtGetPenBtnList(UInt16* numButtons)
+ SYS_TRAP(sysTrapEvtGetPenBtnList);
+
+// Return pointer to the silkscreen area list
+const SilkscreenAreaType* EvtGetSilkscreenAreaList(UInt16* numAreas)
+ SYS_TRAP(sysTrapEvtGetSilkscreenAreaList);
+
+
+//-----------------------------------------------------------------
+// General Utilities
+//------------------------------------------------------------------
+// Force the system to wake-up. This will result in a null event being
+// sent to the current app.
+Err EvtWakeup(void)
+ SYS_TRAP(sysTrapEvtWakeup);
+
+// Reset the auto-off timer. This is called by the SerialLink Manager in order
+// so we don't auto-off while receiving data over the serial port.
+Err EvtResetAutoOffTimer(void)
+ SYS_TRAP(sysTrapEvtResetAutoOffTimer);
+
+Err EvtSetAutoOffTimer(EvtSetAutoOffCmd cmd, UInt16 timeout)
+ SYS_TRAP(sysTrapEvtSetAutoOffTimer);
+
+// Set Graffiti enabled or disabled.
+void EvtEnableGraffiti(Boolean enable)
+ SYS_TRAP(sysTrapEvtEnableGraffiti);
+
+// Force a NullEvent at or before tick
+Boolean EvtSetNullEventTick(UInt32 tick)
+ SYS_TRAP(sysTrapEvtSetNullEventTick);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+/************************************************************
+ * Assembly Function Prototypes
+ *************************************************************/
+#define _EvtEnqueuePenPoint \
+ ASM_SYS_TRAP(sysTrapEvtEnqueuePenPoint)
+
+
+
+#endif //__SYSEVTMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SystemMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/SystemMgr.h
new file mode 100644
index 0000000..a057405
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SystemMgr.h
@@ -0,0 +1,1191 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SystemMgr.h
+ *
+ * Description:
+ * Pilot system equates
+ *
+ * History:
+ * 10/27/94 RM Created by Ron Marianetti
+ * 10/07/96 SCL Added sysAppLaunchFlagDataRelocated flag
+ * 11/13/96 vmk Added sysErrDelayWakened error code
+ * 08/12/98 dia Added sysFtrNumGremlinsSupportGlobals.
+ * 08/18/98 SCL Added sysFtrNumHwrMiscFlags and ...FlagsExt.
+ * Redefined sysFtrNumProcessorID.
+ * 08/23/98 SCL Merged in tsmErrorClass.
+ * 09/07/98 kwk Added SysWantEvent routine declaration.
+ * 10/05/98 jfs Added SysLCDContrast trap descriptor
+ * 04/08/99 kwk Added sysFtrNumVendor (OS 3.3 and later)
+ * 06/28/99 kwk Added omErrorClass.
+ * 08/11/99 kwk Added sysFtrNumCharEncodingFlags.
+ * 11/01/99 kwk Moved SysWantEvent to SystemPrv.h
+ * 12/03/99 SCL Moved SysAppInfoType, SysAppStartup, and SysAppExit
+ * here from SystemPrv.h (for StartupCode/Runtime)
+ *
+ *****************************************************************************/
+
+#ifndef __SYSTEMMGR_H__
+#define __SYSTEMMGR_H__
+
+// Include elementary types
+#include <PalmTypes.h>
+#include <CoreTraps.h> // Trap Numbers.
+
+// Other types
+#include <SystemResources.h> // Resource definitions.
+
+
+// System Headers
+#include <Rect.h>
+#include <Font.h>
+#include <Window.h>
+#include <InsPoint.h>
+#include <Event.h>
+#include <DataMgr.h> // for DmOpenRef
+#include <LibTraps.h>
+
+
+/************************************************************
+ * System Constants
+ *************************************************************/
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER - These #defines should be removed from the public SDK!!!
+// Note that since the SysTicksPerSecond() API still uses these,
+// so they'll need to remain in private headers. There are also
+// several other headers and Palm OS sources that rely on these
+// defines but should be changed to use SysTicksPerSecond().
+#endif // PUBLIC_STUFF_STRIPPED
+// Define the number of ticks/second
+// NOTE: It is strongly recommended that developers avoid using these
+// defines, and use the SysTicksPerSecond() API (below) instead....
+#if EMULATION_LEVEL == EMULATION_MAC
+ #define sysTicksPerSecond 60 // 60/sec on Macintosh
+#elif EMULATION_LEVEL == EMULATION_NONE
+ #define sysTicksPerSecond 100 // 100/sec on Pilot
+#elif EMULATION_LEVEL == EMULATION_WINDOWS
+ #define sysTicksPerSecond 1000 // 1000/sec on Windows PC
+#elif EMULATION_LEVEL == EMULATION_UNIX
+ #define sysTicksPerSecond 1000
+ // 1000/sec on Linux
+#else
+ #error Invalid EMULATION_LEVEL
+#endif
+
+
+
+/************************************************************
+ * Rules for creating and using the Command Parameter Block
+ * passed to SysUIAppSwitch
+ *************************************************************/
+
+// A parameter block containing application-specific information may be passed
+// to an application when launching it via SysUIAppSwitch. To create the
+// parameter block, you allocate a memory block using MemPtrNew and then you must
+// call MemPtrSetOwner to set the block's owner ID to 0. This assigns the block's
+// ownership to the system so that it will not be automatically freed by the system
+// when the calling app exits. The command block must be self contained. It must not
+// have pointers to anything on the stack or in memory blocks owned by an application.
+// The launching and launched applications do not need to worry about freeing the
+// command block since the system will do this after the launched application exits.
+// If no parameter block is being passed, this parameter must be NULL.
+
+
+/************************************************************
+ * Action Codes
+ *
+ * IMPORTANT ACTION CODE CONSIDERATIONS:
+ *
+ * Many action codes are "sent" to apps via a direct function call into the app's
+ * PilotMain() function without launching the app. For these action codes, the
+ * application's global and static variables are *not* available, unless the
+ * application is already running. Some action codes are synchronized with the
+ * currently running UI applcation via the event manager (alarm action codes,
+ * for example), while others, such as HotSync action codes, are sent from a
+ * background thread. To find out if your app is running (is the current UI
+ * app) when an action code is received, test the sysAppLaunchFlagSubCall flag
+ * (defined in SystemMgr.h) which is passed to your PilotMain in the
+ * launchFlags parameter (the third PilotMain parameter). If it is non-zero,
+ * you may assume that your app is currently running and the global variables
+ * are accessible. This information is useful if your app maintains an open
+ * data database (or another similar resource) when it is running. If the app
+ * receives an action code and the sysAppLaunchFlagSubCall is set in
+ * launchFlags, the handler may access global variables and use the open
+ * database handle while handling the call. On the other hand, if the
+ * sysAppLaunchFlagSubCall flag is not set (ie., zero), the handler will need
+ * to open and close the database itself and is not allowed to access global
+ * or static variables.
+ *
+ *************************************************************/
+
+// NOTE: for defining custom action codes, see sysAppLaunchCmdCustomBase below.
+
+// System SysAppLaunch Commands
+#define sysAppLaunchCmdNormalLaunch 0 // Normal Launch
+
+#define sysAppLaunchCmdFind 1 // Find string
+
+#define sysAppLaunchCmdGoTo 2 // Launch and go to a particular record
+
+#define sysAppLaunchCmdSyncNotify 3 // Sent to apps whose databases changed during
+ // HotSync after the sync has been completed,
+ // including when the app itself has been installed
+ // by HotSync. The data database(s) must have the
+ // same creator ID as the application for this
+ // mechanism to function correctly. This is a
+ // good opportunity to update/initialize/validate
+ // the app's data, such as resorting records,
+ // setting alarms, etc.
+ //
+ // Parameter block: None.
+ // Restrictions: No accessing of global or
+ // static variables; no User Interface calls.
+ // Notes: This action code is sent via a
+ // direct function call into the app's
+ // PilotMain function from the background
+ // thread of the HotSync application.
+
+
+#define sysAppLaunchCmdTimeChange 4 // Sent to all applications and preference
+ // panels when the system time is changed.
+ // This notification is the right place to
+ // update alarms and other time-related
+ // activities and resources.
+ //
+ // Parameter block: None.
+ // Restrictions: No accessing of global or
+ // static variables; no User Interface calls.
+ // Notes: This action code is sent via a direct
+ // function call into the app's PilotMain
+ // function without "launching" the app.
+
+#define sysAppLaunchCmdSystemReset 5 // Sent to all applications and preference
+ // panels when the system is either soft-reset
+ // or hard-reset. This notification is the
+ // right place to initialize and/or validate
+ // your application's preferences/features/
+ // database(s) as well as to update alarms and
+ // other time-related activities and resources.
+ //
+ // Parameter block: SysAppLaunchCmdSystemResetType
+ // Restrictions: No accessing of global or
+ // static variables; no User Interface calls.
+ // Notes: This action code is sent via a direct
+ // function call into the app's PilotMain
+ // function without "launching" the app.
+
+#define sysAppLaunchCmdAlarmTriggered 6 // Sent to an application at the time its
+ // alarm time expires (even when another app
+ // is already displaying its alarm dialog box).
+ // This call is intended to allow the app to
+ // perform some very quick activity, such as
+ // scheduling the next alarm or performing a
+ // quick maintenance task. The handler for
+ // sysAppLaunchCmdAlarmTriggered must take as
+ // little time as possible and is *not* allowed
+ // to block (this would delay notification for
+ // alarms set by other applications).
+ //
+ // Parameter block: SysAlarmTriggeredParamType
+ // (defined in AlarmMgr.h)
+ // Restrictions: No accessing of global or
+ // static variables unless sysAppLaunchFlagSubCall
+ // flag is set, as discussed above.
+ // Notes: This action code is sent via a direct
+ // function call into the app's PilotMain
+ // function without "launching" the app.
+
+#define sysAppLaunchCmdDisplayAlarm 7 // Sent to an application when it is time
+ // to display the alarm UI. The application
+ // is responsible for making any alarm sounds
+ // and for displaying the alarm UI.
+ // sysAppLaunchCmdDisplayAlarm calls are ordered
+ // chronoligically and are not overlapped.
+ // This means that your app will receive
+ // sysAppLaunchCmdDisplayAlarm only after
+ // all earlier alarms have been displayed.
+ //
+ // Parameter block: SysDisplayAlarmParamType
+ // (defined in AlarmMgr.h)
+ // Restrictions: No accessing of global or
+ // static variables unless sysAppLaunchFlagSubCall
+ // flag is set, as discussed above. UI calls are
+ // allowed to display the app's alarm dialog.
+ // Notes: This action code is sent via a direct
+ // function call into the app's PilotMain
+ // function without "launching" the app.
+
+#define sysAppLaunchCmdCountryChange 8 // The country has changed
+
+#define sysAppLaunchCmdSyncRequestLocal 9 // Sent to the HotSync application to request a
+ // local HotSync. ("HotSync" button was pressed.)
+
+#define sysAppLaunchCmdSyncRequest sysAppLaunchCmdSyncRequestLocal // for backward compatibility
+
+#define sysAppLaunchCmdSaveData 10 // Sent to running app before sysAppLaunchCmdFind
+ // or other action codes that will cause data
+ // searches or manipulation.
+
+#define sysAppLaunchCmdInitDatabase 11 // Sent to an application when a database with
+ // a matching Creator ID is created during
+ // HotSync (in response to a "create db"
+ // request). This allows the application to
+ // initialize a newly-created database during
+ // HotSync. This might include creating some
+ // default records, setting up the database's
+ // application and sort info blocks, etc.
+ //
+ // Parameter block: SysAppLaunchCmdInitDatabaseType
+ // Restrictions: No accessing of global or
+ // static variables; no User Interface calls.
+ // Notes: This action code is sent via a
+ // direct function call into the app's
+ // PilotMain function from the background
+ // thread of the HotSync application.
+
+#define sysAppLaunchCmdSyncCallApplicationV10 12 // Used by DesktopLink Server command "call application";
+ // Pilot v1.0 only!!!
+
+//------------------------------------------------------------------------
+// New launch codes defined for PalmOS 2.0
+//------------------------------------------------------------------------
+
+#define sysAppLaunchCmdPanelCalledFromApp 13 // The panel should display a done
+ // button instead of the pick list.
+ // The Done button will return the user
+ // to the last app.
+
+#define sysAppLaunchCmdReturnFromPanel 14 // A panel returned to this app
+
+#define sysAppLaunchCmdLookup 15 // Lookup info managed by an app
+
+#define sysAppLaunchCmdSystemLock 16 // Lock the system until a password is entered.
+
+#define sysAppLaunchCmdSyncRequestRemote 17 // Sent to the HotSync application to request
+ // a remote HotSync. ("Remote HotSync" button
+ // was pressed.)
+
+#define sysAppLaunchCmdHandleSyncCallApp 18 // Pilot v2.0 and greater. Sent by DesktopLink Server to an application to handle
+ // the "call application" command; use DlkControl with
+ // control code dlkCtlSendCallAppReply to send the reply(see DLServer.h).
+ // This action code replaces the v1.0 code sysAppLaunchCmdSyncCallApplication.
+ // vmk 11/26/96
+
+#define sysAppLaunchCmdAddRecord 19 // Add a record to an applications's database.
+
+
+//------------------------------------------------------------------------
+// Standard Service Panel launch codes (used by network panel, dialer panel, etc.)
+#ifndef PUBLIC_STUFF_STRIPPED
+// (DOLATER... document parameter block structures)
+#endif // PUBLIC_STUFF_STRIPPED
+//------------------------------------------------------------------------
+#define sysSvcLaunchCmdSetServiceID 20
+#define sysSvcLaunchCmdGetServiceID 21
+#define sysSvcLaunchCmdGetServiceList 22
+#define sysSvcLaunchCmdGetServiceInfo 23
+
+
+#define sysAppLaunchCmdFailedAppNotify 24 // An app just switched to failed.
+#define sysAppLaunchCmdEventHook 25 // Application event hook callback
+#define sysAppLaunchCmdExgReceiveData 26 // Exg command for app to receive data.
+#define sysAppLaunchCmdExgAskUser 27 // Exg command sent before asking user.
+
+
+//------------------------------------------------------------------------
+// Standard Dialer Service launch codes (30 - 39 reserved)
+#ifndef PUBLIC_STUFF_STRIPPED
+// (DOLATER... document parameter block structures)
+#endif // PUBLIC_STUFF_STRIPPED
+//------------------------------------------------------------------------
+
+// sysDialLaunchCmdDial: dials the modem(optionally displays dial progress UI), given service id
+// and serial library reference number
+#define sysDialLaunchCmdDial 30
+// sysDialLaunchCmdHangUp: hangs up the modem(optionally displays disconnect progress UI), given service id
+// and serial library reference number
+#define sysDialLaunchCmdHangUp 31
+#define sysDialLaunchCmdLast 39
+
+
+//------------------------------------------------------------------------
+// Additional standard Service Panel launch codes (used by network panel, dialer panel, etc)
+// (40-49 reserved)
+//------------------------------------------------------------------------
+
+#define sysSvcLaunchCmdGetQuickEditLabel 40 // SvcQuickEditLabelInfoType
+#define sysSvcLaunchCmdLast 49
+
+
+//------------------------------------------------------------------------
+// New launch codes defined for PalmOS 3.x where x >= 1
+//------------------------------------------------------------------------
+
+#define sysAppLaunchCmdURLParams 50 // Sent from the Web Clipper application.
+ // This launch code gets used to satisfy
+ // URLs like the following:
+ // palm:memo.appl?param1=value1&param2=value2
+ // Everything in the URL past the '?' is passed
+ // to the app as the cmdPBP parameter of PilotMain().
+
+#define sysAppLaunchCmdNotify 51 // This is a NotifyMgr notification sent
+ // via SysNotifyBroadcast. The cmdPBP parameter
+ // points to a SysNotifyParamType structure
+ // containing more specific information
+ // about the notification (e.g., what it's for).
+
+#define sysAppLaunchCmdOpenDB 52 // Sent to switch to an application and have it
+ // "open" up the given data file. The cmdPBP
+ // pointer is a pointer to a SysAppLaunchCmdOpenDBType
+ // structure that has the cardNo and localID of the database
+ // to open. This action code is used by the Launcher
+ // to launch data files, like Eleven PQA files that
+ // have the dmHdrAttrLaunchableData bit set in their
+ // database attributes.
+
+#define sysAppLaunchCmdAntennaUp 53 // Sent to switch only to the launcher when
+ // the antenna is raised and the launcher
+ // is the application in the buttons preferences
+ // that is to be run when the antenna is raised is
+ // the launcher.
+
+#define sysAppLaunchCmdGoToURL 54 // Sent to Clipper to have it launch and display
+ // a given URL. cmdPBP points to the URL string.
+
+
+// ***ADD NEW SYSTEM ACTION CODES BEFORE THIS COMMENT***
+
+//------------------------------------------------------------------------
+// Custom action code base (custom action codes begin at this value)
+//------------------------------------------------------------------------
+#define sysAppLaunchCmdCustomBase 0x8000
+
+// Your custom launch codes can be defined like this:
+//
+// typedef enum {
+// myAppCmdDoSomething = sysAppLaunchCmdCustomBase,
+// myAppCmdDoSomethingElse,
+// myAppCmdEtcetera
+//
+// } MyAppCustomActionCodes;
+
+
+
+//------------------------------------------------------------------------
+// SysAppLaunch flags (passed to PilotMain)
+//------------------------------------------------------------------------
+
+#define sysAppLaunchFlagNewThread 0x01 // create a new thread for application
+ // - implies sysAppLaunchFlagNewStack
+#define sysAppLaunchFlagNewStack 0x02 // create separate stack for application
+#define sysAppLaunchFlagNewGlobals 0x04 // create new globals world for application
+ // - implies new owner ID for Memory chunks
+#define sysAppLaunchFlagUIApp 0x08 // notifies launch routine that this is a UI app being
+ // launched.
+#define sysAppLaunchFlagSubCall 0x10 // notifies launch routine that the app is calling it's
+ // entry point as a subroutine call. This tells the launch
+ // code that it's OK to keep the A5 (globals) pointer valid
+ // through the call.
+ // IMPORTANT: This flag is for internal use by
+ // SysAppLaunch only!!! It should NEVER be set
+ // by the caller.
+#define sysAppLaunchFlagDataRelocated 0x80 // global data (static ptrs) have been "relocated"
+ // by either SysAppStartup or StartupCode.c
+ // IMPORTANT: This flag is for internal use by
+ // SysAppLaunch only!!! It should NEVER be set
+ // by the caller.
+
+// The set of private, internal flags that should never be set by the caller
+#define sysAppLaunchFlagPrivateSet (sysAppLaunchFlagSubCall | sysAppLaunchFlagDataRelocated)
+
+
+
+//-------------------------------------------------------------------
+// Parameter blocks for action codes
+// NOTE: The parameter block for the sysAppLaunchCmdFind and sysAppLaunchCmdGoTo
+// action codes are defined in "Find.h";
+//---------------------------------------------------------------------------
+
+// For sysAppLaunchCmdSaveData
+typedef struct {
+ Boolean uiComing; // true if system dialog will be put up
+ // before coming action code arrives.
+ UInt8 reserved1;
+ } SysAppLaunchCmdSaveDataType;
+
+// For sysAppLaunchCmdSystemReset
+typedef struct {
+ Boolean hardReset; // true if system was hardReset, false if soft-reset.
+ Boolean createDefaultDB; // true if app should create default database.
+ } SysAppLaunchCmdSystemResetType;
+
+
+// For sysAppLaunchCmdInitDatabase
+typedef struct SysAppLaunchCmdInitDatabaseType {
+ DmOpenRef dbP; // Handle of the newly-created database,
+ // already open for read/write access.
+ // IMPORTANT: The handler *MUST* leave
+ // this database handle open on return.
+ UInt32 creator; // Creator ID of the newly-created database
+ UInt32 type; // Type ID of the newly-created database
+ UInt16 version; // Version number of the newly-created database
+ } SysAppLaunchCmdInitDatabaseType;
+
+
+// For sysAppLaunchCmdSyncCallApplicationV10
+// This structure used on Pilot v1.0 only. See sysAppLaunchCmdHandleSyncCallApp
+// for later platforms.
+typedef struct SysAppLaunchCmdSyncCallApplicationTypeV10 {
+ UInt16 action; // call action id (app-specific)
+ UInt16 paramSize; // parameter size
+ void * paramP; // ptr to parameter
+ UInt8 remoteSocket; // remote socket id
+ UInt8 tid; // command transaction id
+ Boolean handled; // if handled, MUST be set true by the app
+ UInt8 reserved1;
+ } SysAppLaunchCmdSyncCallApplicationTypeV10;
+
+
+// For sysAppLaunchCmdHandleSyncCallApp (Pilot v2.0 and greater).
+// This structure replaces SysAppLaunchCmdSyncCallApplicationType
+// which was used in Pilot v1.0
+typedef struct SysAppLaunchCmdHandleSyncCallAppType {
+ UInt16 pbSize; // this parameter block size (set to sizeof SysAppLaunchCmdHandleSyncCallAppType)
+ UInt16 action; // call action id (app-specific)
+ void * paramP; // ptr to parameter
+ UInt32 dwParamSize; // parameter size
+ void * dlRefP; // DesktopLink reference pointer for passing
+ // to DlkControl()'s dlkCtlSendCallAppReply code
+
+ Boolean handled; // initialized to FALSE by DLServer; if
+ // handled, MUST be set TRUE by the app(the
+ // handler MUST call DlkControl with
+ // control code dlkCtlSendCallAppReply);
+ // if the handler is not going to send a reply,
+ // it should leave this field set to FALSE, in which
+ // case DesktopLink Server will send the default
+ // "unknown request" reply.
+
+ UInt8 reserved1;
+
+ Err replyErr; // error from dlkCtlSendCallAppReply
+
+ // RESERVED FOR FUTURE EXTENSIONS
+ UInt32 dwReserved1; // RESERVED -- set to null!!!
+ UInt32 dwReserved2; // RESERVED -- set to null!!!
+
+ // Target executable creator and type for testing the mechanism
+ // in EMULATION MODE ONLY!!!
+ #if EMULATION_LEVEL != EMULATION_NONE
+ UInt32 creator;
+ UInt32 type;
+ #endif
+
+ } SysAppLaunchCmdHandleSyncCallAppType;
+
+// For sysAppLaunchCmdFailedAppNotify
+typedef struct
+ {
+ UInt32 creator;
+ UInt32 type;
+ Err result;
+ } SysAppLaunchCmdFailedAppNotifyType;
+
+
+// For sysAppLaunchCmdOpenDB
+typedef struct
+ {
+ UInt16 cardNo;
+ LocalID dbID;
+ } SysAppLaunchCmdOpenDBType;
+
+
+/************************************************************
+ * Structure of Application info for an application. Applications
+ * do not necessarily have to be on their own thread - there
+ * can be more than 1 app on the same AMX task. Each application
+ * has an assocated SysAppInfoType structure which holds the
+ * application specific information like the database MemHandle of the
+ * app, the code MemHandle, the stack chunk pointer, the owner ID, etc.
+ *
+ * As of PalmOS 3.X, one of these structures is created for each
+ * app running as an action code.
+ *
+ ****
+ ****IMPORTANT: ADD NEW FIELDS AT THE END OF THE STRUCTURE FOR
+ **** BACKWARD COMPATIBILITY
+ ****
+ *************************************************************/
+typedef struct SysAppInfoType {
+ Int16 cmd; // command code for app
+ MemPtr cmdPBP; // cmd ParamBlock
+ UInt16 launchFlags; // launch flags
+
+ UInt32 taskID; // AMX task ID of task that app runs in
+ MemHandle codeH; // code MemHandle of the main code segment
+ DmOpenRef dbP; // Application database access MemPtr of App
+ UInt8 *stackP; // stack chunk for the App
+ UInt8 *globalsChunkP; // globals chunk for the App
+
+ UInt16 memOwnerID; // owner ID for Memory Manager chunks
+ MemPtr dmAccessP; // pointer to linked list of opened DB's
+ Err dmLastErr; // Last error from Data Manager
+ MemPtr errExceptionP; // ErrTry,Catch exception list
+
+ // PalmOS v3.0 fields begin here
+ UInt8 *a5Ptr; // A5 MemPtr for this app
+ UInt8 *stackEndP; // stack chunk end for the App (last byte)
+ UInt8 *globalEndP; // global chunk end for the App (last byte)
+ struct SysAppInfoType *rootP; // Points to the SysAppInfoType first
+ // allocated for this thread.
+ MemPtr extraP; // unused MemPtr for the App.
+ } SysAppInfoType;
+typedef SysAppInfoType *SysAppInfoPtr;
+
+
+/************************************************************
+ * Function prototype for libraries
+ *************************************************************/
+
+// ***IMPORTANT***
+// ***IMPORTANT***
+// ***IMPORTANT***
+//
+// The assembly level TrapDispatcher() function uses a hard-coded value for
+// the size of the structure SysLibTblEntryType to obtain a pointer to a
+// library entry in the library table. Therefore, any changes to this structure,
+// require corresponding changes in TrapDispatcher() in ROMBoot.c. Furthermore,
+// it is advantageous to keep the size of the structure a power of 2 as this
+// improves performance by allowing the entry offset to be calculated by shifting
+// left instead of using the multiply instruction. vmk 8/27/96 (yes, I fell into
+// this trap myself)
+typedef struct SysLibTblEntryType {
+ MemPtr *dispatchTblP; // pointer to library dispatch table
+ void *globalsP; // Library globals
+
+ // New INTERNAL fields for v2.0 (vmk 8/27/96):
+ LocalID dbID; // database id of the library
+ void *codeRscH; // library code resource handle for RAM-based libraries
+ } SysLibTblEntryType;
+typedef SysLibTblEntryType* SysLibTblEntryPtr;
+
+// Emulated versions of libraries have a slightly different dispatch table
+// Enough for the offset to the library name and the name itself.
+#if EMULATION_LEVEL != EMULATION_NONE
+typedef struct SimDispatchTableType {
+ UInt32 numEntries; // number of library entries
+ void *entries[1]; // dispatch routine entries
+ // followed by pointer to name
+ } SimDispatchTableType;
+typedef SimDispatchTableType* SimDispatchTablePtr;
+#endif
+
+
+// Library entry point procedure
+typedef Err (*SysLibEntryProcPtr)(UInt16 refNum, SysLibTblEntryPtr entryP);
+
+// This library refNum is reserved for the Debugger comm library
+#define sysDbgCommLibraryRefNum 0
+
+// This portID is reserved for identifying the debugger's port
+#define sysDbgCommPortID 0xC0FF
+
+// This refNum signals an invalid refNum
+#define sysInvalidRefNum 0xFFFF
+
+
+/************************************************************
+ * Function prototype for Kernel
+ *************************************************************/
+// Task termination procedure prototype for use with SysTaskSetTermProc
+typedef void (*SysTermProcPtr)(UInt32 taskID, Int32 reason);
+
+// Timer procedure for use with SysTimerCreate
+typedef void (*SysTimerProcPtr)(Int32 timerID, Int32 param);
+
+
+
+
+/************************************************************
+ * System Errors
+ *************************************************************/
+#define sysErrTimeout (sysErrorClass | 1)
+#define sysErrParamErr (sysErrorClass | 2)
+#define sysErrNoFreeResource (sysErrorClass | 3)
+#define sysErrNoFreeRAM (sysErrorClass | 4)
+#define sysErrNotAllowed (sysErrorClass | 5)
+#define sysErrSemInUse (sysErrorClass | 6)
+#define sysErrInvalidID (sysErrorClass | 7)
+#define sysErrOutOfOwnerIDs (sysErrorClass | 8)
+#define sysErrNoFreeLibSlots (sysErrorClass | 9)
+#define sysErrLibNotFound (sysErrorClass | 10)
+#define sysErrDelayWakened (sysErrorClass | 11) // SysTaskDelay wakened by SysTaskWake before delay completed.
+#define sysErrRomIncompatible (sysErrorClass | 12)
+#define sysErrBufTooSmall (sysErrorClass | 13)
+#define sysErrPrefNotFound (sysErrorClass | 14)
+
+// NotifyMgr error codes:
+#define sysNotifyErrEntryNotFound (sysErrorClass | 16) // could not find registration entry in the list
+#define sysNotifyErrDuplicateEntry (sysErrorClass | 17) // identical entry already exists
+#define sysNotifyErrBroadcastBusy (sysErrorClass | 19) // a broadcast is already in progress - try again later.
+#define sysNotifyErrBroadcastCancelled (sysErrorClass | 20) // a handler cancelled the broadcast
+
+// AMX error codes continued - jb 10/20/98
+#define sysErrMbId (sysErrorClass | 21)
+#define sysErrMbNone (sysErrorClass | 22)
+#define sysErrMbBusy (sysErrorClass | 23)
+#define sysErrMbFull (sysErrorClass | 24)
+#define sysErrMbDepth (sysErrorClass | 25)
+#define sysErrMbEnv (sysErrorClass | 26)
+
+// NotifyMgr Phase #2 Error Codes:
+#define sysNotifyErrQueueFull (sysErrorClass | 27) // deferred queue is full.
+#define sysNotifyErrQueueEmpty (sysErrorClass | 28) // deferred queue is empty.
+#define sysNotifyErrNoStackSpace (sysErrorClass | 29) // not enough stack space for a broadcast
+#define sysErrNotInitialized (sysErrorClass | 30) // manager is not initialized
+
+// AMX error/warning codes continued - jed 9/10/99
+#define sysErrNotAsleep (sysErrorClass | 31) // Task woken by SysTaskWake was not asleep, 1 wake pending
+#define sysErrNotAsleepN (sysErrorClass | 32) // Task woken by SysTaskWake was not asleep, >1 wake pending
+
+
+// Power Manager error codes - should these be located elsewhere? -soe-
+#define pwrErrNone (pwrErrorClass | 0)
+#define pwrErrBacklight (pwrErrorClass | 1)
+#define pwrErrRadio (pwrErrorClass | 2)
+#define pwrErrBeam (pwrErrorClass | 3)
+
+
+
+/************************************************************
+ * System Features
+ *************************************************************/
+#define sysFtrCreator sysFileCSystem // Feature Creator
+
+#define sysFtrNumROMVersion 1 // ROM Version
+ // 0xMMmfsbbb, where MM is major version, m is minor version
+ // f is bug fix, s is stage: 3-release,2-beta,1-alpha,0-development,
+ // bbb is build number for non-releases
+ // V1.12b3 would be: 0x01122003
+ // V2.00a2 would be: 0x02001002
+ // V1.01 would be: 0x01013000
+
+#define sysFtrNumProcessorID 2 // Product id
+ // 0xMMMMRRRR, where MMMM is the processor model and RRRR is the revision.
+#define sysFtrNumProcessorMask 0xFFFF0000 // Mask to obtain processor model
+#define sysFtrNumProcessor328 0x00010000 // Motorola 68328 (Dragonball)
+#define sysFtrNumProcessorEZ 0x00020000 // Motorola 68EZ328 (Dragonball EZ)
+#define sysFtrNumProductID sysFtrNumProcessorID // old (obsolete) define
+
+#define sysFtrNumBacklight 3 // Backlight
+ // bit 0: 1 if present. 0 if Feature does not exist or backlight is not present
+
+#define sysFtrNumEncryption 4 // Which encryption schemes are present
+#define sysFtrNumEncryptionMaskDES 0x00000001 // bit 0: 1 if DES is present
+
+#define sysFtrNumCountry 5 // International ROM identifier
+ // Result is of type CountryType as defined in Preferences.h.
+ // Result is essentially the "default" country for this ROM.
+ // Assume cUnitedStates if sysFtrNumROMVersion >= 02000000
+ // and feature does not exist. Result is in low sixteen bits.
+
+#define sysFtrNumLanguage 6 // Language identifier
+ // Result is of untyped; values are defined in Incs:BuildRules.h
+ // Result is essentially the "default" language for this ROM.
+ // This is new for the WorkPad (v2.0.2) and did NOT exist for any of the
+ // following: GermanPersonal, GermanPro, FrenchPersonal, FrenchPro
+ // Thus we can't really assume anything if the feature doesn't exist,
+ // though the actual language MAY be determined from sysFtrNumCountry,
+ // above. Result is in low sixteen bits.
+
+#define sysFtrNumDisplayDepth 7 // Display depth
+ // Result is the "default" display depth for the screen. (PalmOS 3.0)
+ // This value is used by ScrDisplayMode when setting the default display depth.
+
+#define sysFtrNumHwrMiscFlags 8 // GHwrMiscFlags value (PalmOS 3.1)
+#define sysFtrNumHwrMiscFlagsExt 9 // GHwrMiscFlagsExt value (PalmOS 3.1)
+
+#define sysFtrNumIntlMgr 10
+ // Result is a set of flags that define functionality supported
+ // by the Int'l Manager. (PalmOS 3.1)
+
+#define sysFtrNumEncoding 11
+ // Result is the character encoding (defined in TextMgr.h) supported
+ // by this ROM. If this feature doesn't exist then the assumed encoding
+ // is latin (Windows code page 1252). (PalmOS 3.1)
+
+#define sysFtrDefaultFont 12
+ // Default font ID used for displaying text. (PalmOS 3.1)
+
+#define sysFtrDefaultBoldFont 13
+ // Default font ID used for displaying bold text. (PalmOS 3.1)
+
+#define sysFtrNumGremlinsSupportGlobals 14 // Globals for supporting gremlins.
+ // This value is a pointer to a memory location that stores global variables needed
+ // for intelligently supporting gremlins. Currently, it is only used in Progress.c.
+ // It is only initialized on first use (gremlins and progress bar in combination)
+ // when ERROR_CHECK_LEVEL == ERROR_CHECK_FULL. (PalmOS 3.2)
+
+#define sysFtrNumVendor 15
+ // Result is the vendor id, in the low sixteen bits. (PalmOS 3.3)
+#ifndef PUBLIC_STUFF_STRIPPED
+ // DOLATER: Need more information about what to expect in this feature.
+#endif // PUBLIC_STUFF_STRIPPED
+
+#define sysFtrNumCharEncodingFlags 16
+ // Flags for a given character encoding, specified in TextMgr.h (PalmOS 3.5)
+
+#define sysFtrNumNotifyMgrVersion 17 // version of the NotifyMgr, if any (PalmOS 3.5)
+
+#define sysFtrNumOEMROMVersion 18 // Supplemental ROM version, provided by OEM
+ // This value may be present in OEM devices, and is in the same format
+ // as sysFtrNumROMVersion. (PalmOS 3.5)
+
+#define sysFtrNumErrorCheckLevel 19 // ROM build setting of ERROR_CHECK_LEVEL
+ // May be set to ERROR_CHECK_NONE, ERROR_CHECK_PARTIAL, or ERROR_CHECK_FULL
+ // as defined in <BuildDefines.h>. (PalmOS 3.5)
+
+#define sysFtrNumOEMCompanyID 20 // GHwrOEMCompanyID value (PalmOS 3.5)
+#define sysFtrNumOEMDeviceID 21 // GHwrOEMDeviceID value (PalmOS 3.5)
+#define sysFtrNumOEMHALID 22 // GHwrOEMHALID value (PalmOS 3.5)
+
+
+/************************************************************
+ * ROM token information (for SysGetROMToken, below)
+ *************************************************************/
+// Additional tokens and token information is located in <Hardware.h>
+#define sysROMTokenSnum 'snum' // Memory Card Flash ID (serial number)
+
+
+/************************************************************
+ * Macros for extracting and combining ROM/OS version components
+ *************************************************************/
+
+// ROM/OS stage numbers
+#define sysROMStageDevelopment (0)
+#define sysROMStageAlpha (1)
+#define sysROMStageBeta (2)
+#define sysROMStageRelease (3)
+
+
+// MACRO: sysMakeROMVersion
+//
+// Builds a ROM version value from the major, minor, fix, stage, and build numbers
+//
+#define sysMakeROMVersion(major, minor, fix, stage, buildNum) \
+ ( \
+ (((UInt32)((UInt8)(major) & 0x0FF)) << 24) | \
+ (((UInt32)((UInt8)(minor) & 0x00F)) << 20) | \
+ (((UInt32)((UInt8)(fix) & 0x00F)) << 16) | \
+ (((UInt32)((UInt8)(stage) & 0x00F)) << 12) | \
+ (((UInt32)((UInt16)(buildNum) & 0x0FFF))) \
+ )
+
+
+// Macros for parsing the ROM version number
+// (the system OS version is obtained by calling
+// FtrGet(sysFtrCreator, sysFtrNumROMVersion, dwOSVerP), where dwOSVerP is
+// a pointer to to a UInt32 variable that is to receive the OS version number)
+#define sysGetROMVerMajor(dwROMVer) (((UInt16)((dwROMVer) >> 24)) & 0x00FF)
+#define sysGetROMVerMinor(dwROMVer) (((UInt16)((dwROMVer) >> 20)) & 0x000F)
+#define sysGetROMVerFix(dwROMVer) (((UInt16)((dwROMVer) >> 16)) & 0x000F)
+#define sysGetROMVerStage(dwROMVer) (((UInt16)((dwROMVer) >> 12)) & 0x000F)
+#define sysGetROMVerBuild(dwROMVer) (((UInt16)(dwROMVer)) & 0x0FFF)
+
+
+
+
+/************************************************************
+ * System Types
+ *************************************************************/
+
+// Types of batteries installed.
+typedef enum {
+ sysBatteryKindAlkaline=0,
+ sysBatteryKindNiCad,
+ sysBatteryKindLiIon,
+ sysBatteryKindRechAlk,
+ sysBatteryKindNiMH,
+ sysBatteryKindLiIon1400,
+ sysBatteryKindLast=0xFF // insert new battery types BEFORE this one
+ } SysBatteryKind;
+
+// Different battery states (output of hwrBattery)
+typedef enum {
+ sysBatteryStateNormal=0,
+ sysBatteryStateLowBattery,
+ sysBatteryStateCritBattery,
+ sysBatteryStateShutdown
+ } SysBatteryState;
+
+
+// SysCreateDataBaseList can generate a list of database.
+typedef struct
+ {
+ Char name[dmDBNameLength];
+ UInt32 creator;
+ UInt32 type;
+ UInt16 version;
+ LocalID dbID;
+ UInt16 cardNo;
+ BitmapPtr iconP;
+ } SysDBListItemType;
+
+
+// Structure of a generic message that can be send to a mailbox
+// through the SysMailboxSend call. Note, this structure MUST
+// be CJ_MAXMSZ bytes large, where CJ_MAXMSZ is defined in
+// the AMX includes.
+typedef struct {
+ UInt32 data[3];
+ } SysMailboxMsgType;
+
+
+// Constants used by the SysEvGroupSignal call
+#define sysEvGroupSignalConstant 0
+#define sysEvGroupSignalPulse 1
+
+// Constants used by the SysEvGroupWait call
+#define sysEvGroupWaitOR 0
+#define sysEvGroupWaitAND 1
+
+
+
+/************************************************************
+ * System Pre-defined "file descriptors"
+ * These are used by applications that use the Net Library's
+ * NetLibSelect() call
+ *************************************************************/
+#define sysFileDescStdIn 0
+
+
+/************************************************************
+ * Function Prototypes
+ *************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Prototype for Pilot applications entry point
+UInt32 PilotMain(UInt16 cmd, void *cmdPBP, UInt16 launchFlags);
+
+
+// SystemMgr routines
+void SysUnimplemented(void)
+ SYS_TRAP(sysTrapSysUnimplemented);
+
+void SysColdBoot(void *card0P, UInt32 card0Size,
+ void *card1P, UInt32 card1Size,
+ UInt32 sysCardHeaderOffset)
+ SYS_TRAP(sysTrapSysColdBoot);
+
+void SysInit(void)
+ SYS_TRAP(sysTrapSysInit);
+
+void SysReset(void)
+ SYS_TRAP(sysTrapSysReset);
+
+void SysPowerOn(void *card0P, UInt32 card0Size,
+ void *card1P, UInt32 card1Size,
+ UInt32 sysCardHeaderOffset, Boolean reFormat);
+
+
+void SysDoze(Boolean onlyNMI)
+ SYS_TRAP(sysTrapSysDoze);
+
+Err SysSetPerformance(UInt32 *sysClockP, UInt16 *cpuDutyP)
+ SYS_TRAP(sysTrapSysSetPerformance);
+
+void SysSleep(Boolean untilReset, Boolean emergency)
+ SYS_TRAP(sysTrapSysSleep);
+
+UInt16 SysSetAutoOffTime(UInt16 seconds)
+ SYS_TRAP(sysTrapSysSetAutoOffTime);
+
+UInt16 SysTicksPerSecond(void)
+ SYS_TRAP(sysTrapSysTicksPerSecond);
+
+Err SysLaunchConsole(void)
+ SYS_TRAP(sysTrapSysLaunchConsole);
+
+Boolean SysHandleEvent(EventPtr eventP)
+ SYS_TRAP(sysTrapSysHandleEvent);
+
+void SysUILaunch(void)
+ SYS_TRAP(sysTrapSysUILaunch);
+
+Err SysUIAppSwitch(UInt16 cardNo, LocalID dbID, UInt16 cmd, MemPtr cmdPBP)
+ SYS_TRAP(sysTrapSysUIAppSwitch);
+
+Err SysCurAppDatabase(UInt16 *cardNoP, LocalID *dbIDP)
+ SYS_TRAP(sysTrapSysCurAppDatabase);
+
+Err SysBroadcastActionCode(UInt16 cmd, MemPtr cmdPBP)
+ SYS_TRAP(sysTrapSysBroadcastActionCode);
+
+Err SysAppLaunch(UInt16 cardNo, LocalID dbID, UInt16 launchFlags,
+ UInt16 cmd, MemPtr cmdPBP, UInt32 *resultP)
+ SYS_TRAP(sysTrapSysAppLaunch);
+
+UInt16 SysNewOwnerID(void)
+ SYS_TRAP(sysTrapSysNewOwnerID);
+
+UInt32 SysSetA5(UInt32 newValue)
+ SYS_TRAP(sysTrapSysSetA5);
+
+// Routines used by startup code
+Err SysAppStartup(SysAppInfoPtr *appInfoPP, MemPtr *prevGlobalsP,
+ MemPtr *globalsPtrP)
+ SYS_TRAP(sysTrapSysAppStartup);
+
+Err SysAppExit(SysAppInfoPtr appInfoP, MemPtr prevGlobalsP, MemPtr globalsP)
+ SYS_TRAP(sysTrapSysAppExit);
+
+
+#if EMULATION_LEVEL != EMULATION_NONE
+// Simulator-specific routines
+MemPtr SysCardImageInfo(UInt16 cardNo, UInt32 *sizeP);
+
+void SysCardImageDeleted(UInt16 cardNo);
+#endif // EMULATION_LEVEL != EMULATION_NONE
+
+UInt16 SysUIBusy(Boolean set, Boolean value)
+ SYS_TRAP(sysTrapSysUIBusy);
+
+UInt8 SysLCDContrast(Boolean set, UInt8 newContrastLevel)
+ SYS_TRAP(sysTrapSysLCDContrast);
+
+UInt8 SysLCDBrightness(Boolean set, UInt8 newBrightnessLevel)
+ SYS_TRAP(sysTrapSysLCDBrightness);
+
+
+// System Dialogs
+void SysBatteryDialog(void)
+ SYS_TRAP(sysTrapSysBatteryDialog);
+
+// Utilities
+Err SysSetTrapAddress(UInt16 trapNum, void *procP)
+ SYS_TRAP(sysTrapSysSetTrapAddress);
+
+void * SysGetTrapAddress(UInt16 trapNum)
+ SYS_TRAP(sysTrapSysGetTrapAddress);
+
+UInt16 SysDisableInts(void)
+ SYS_TRAP(sysTrapSysDisableInts);
+
+void SysRestoreStatus(UInt16 status)
+ SYS_TRAP(sysTrapSysRestoreStatus);
+
+extern Char * SysGetOSVersionString()
+ SYS_TRAP(sysTrapSysGetOSVersionString);
+
+// The following trap is a public definition of HwrGetROMToken from <Hardware.h>
+// See token definitions (like sysROMTokenSerial) above...
+Err SysGetROMToken(UInt16 cardNo, UInt32 token, UInt8 **dataP, UInt16 *sizeP )
+ SYS_TRAP(sysTrapHwrGetROMToken);
+
+
+// Library Management
+Err SysLibInstall(SysLibEntryProcPtr libraryP, UInt16 *refNumP)
+ SYS_TRAP(sysTrapSysLibInstall);
+
+Err SysLibLoad(UInt32 libType, UInt32 libCreator, UInt16 *refNumP)
+ SYS_TRAP(sysTrapSysLibLoad);
+
+
+Err SysLibRemove(UInt16 refNum)
+ SYS_TRAP(sysTrapSysLibRemove);
+
+Err SysLibFind(const Char *nameP, UInt16 *refNumP)
+ SYS_TRAP(sysTrapSysLibFind);
+
+SysLibTblEntryPtr SysLibTblEntry(UInt16 refNum)
+ SYS_TRAP(sysTrapSysLibTblEntry);
+
+// Generic Library calls
+Err SysLibOpen(UInt16 refNum)
+ SYS_TRAP(sysLibTrapOpen);
+Err SysLibClose(UInt16 refNum)
+ SYS_TRAP(sysLibTrapClose);
+Err SysLibSleep(UInt16 refNum)
+ SYS_TRAP(sysLibTrapSleep);
+Err SysLibWake(UInt16 refNum)
+ SYS_TRAP(sysLibTrapWake);
+
+
+//-----------------------------------------------------
+// Kernel Prototypes
+//-----------------------------------------------------
+// Task Creation and deleation
+Err SysTranslateKernelErr(Err err)
+ SYS_TRAP(sysTrapSysTranslateKernelErr);
+
+Err SysTaskCreate(UInt32 *taskIDP, UInt32 *creator, ProcPtr codeP,
+ MemPtr stackP, UInt32 stackSize, UInt32 attr, UInt32 priority,
+ UInt32 tSlice)
+ SYS_TRAP(sysTrapSysTaskCreate);
+
+Err SysTaskDelete(UInt32 taskID, UInt32 priority)
+ SYS_TRAP(sysTrapSysTaskDelete);
+
+Err SysTaskTrigger(UInt32 taskID)
+ SYS_TRAP(sysTrapSysTaskTrigger);
+
+UInt32 SysTaskID()
+ SYS_TRAP(sysTrapSysTaskID);
+
+Err SysTaskDelay(Int32 delay)
+ SYS_TRAP(sysTrapSysTaskDelay);
+
+Err SysTaskSetTermProc(UInt32 taskID, SysTermProcPtr termProcP)
+ SYS_TRAP(sysTrapSysTaskSetTermProc);
+
+Err SysTaskSwitching(Boolean enable)
+ SYS_TRAP(sysTrapSysTaskSwitching);
+
+Err SysTaskWait(Int32 timeout)
+ SYS_TRAP(sysTrapSysTaskWait);
+
+Err SysTaskWake(UInt32 taskID)
+ SYS_TRAP(sysTrapSysTaskWake);
+
+void SysTaskWaitClr(void)
+ SYS_TRAP(sysTrapSysTaskWaitClr);
+
+Err SysTaskSuspend(UInt32 taskID)
+ SYS_TRAP(sysTrapSysTaskSuspend);
+
+Err SysTaskResume(UInt32 taskID)
+ SYS_TRAP(sysTrapSysTaskResume);
+
+
+// Counting Semaphores
+Err SysSemaphoreCreate(UInt32 *smIDP, UInt32 *tagP, Int32 initValue)
+ SYS_TRAP(sysTrapSysSemaphoreCreate);
+
+Err SysSemaphoreDelete(UInt32 smID)
+ SYS_TRAP(sysTrapSysSemaphoreDelete);
+
+Err SysSemaphoreWait(UInt32 smID, UInt32 priority, Int32 timeout)
+ SYS_TRAP(sysTrapSysSemaphoreWait);
+
+Err SysSemaphoreSignal(UInt32 smID)
+ SYS_TRAP(sysTrapSysSemaphoreSignal);
+
+Err SysSemaphoreSet(UInt32 smID)
+ SYS_TRAP(sysTrapSysSemaphoreSet);
+
+
+// Resource Semaphores
+Err SysResSemaphoreCreate(UInt32 *smIDP, UInt32 *tagP)
+ SYS_TRAP(sysTrapSysResSemaphoreCreate);
+
+Err SysResSemaphoreDelete(UInt32 smID)
+ SYS_TRAP(sysTrapSysResSemaphoreDelete);
+
+Err SysResSemaphoreReserve(UInt32 smID, UInt32 priority, Int32 timeout)
+ SYS_TRAP(sysTrapSysResSemaphoreReserve);
+
+Err SysResSemaphoreRelease(UInt32 smID)
+ SYS_TRAP(sysTrapSysResSemaphoreRelease);
+
+
+
+// Timers
+Err SysTimerCreate(UInt32 *timerIDP, UInt32 *tagP,
+ SysTimerProcPtr timerProc, UInt32 periodicDelay,
+ UInt32 param)
+ SYS_TRAP(sysTrapSysTimerCreate);
+
+Err SysTimerDelete(UInt32 timerID)
+ SYS_TRAP(sysTrapSysTimerDelete);
+
+Err SysTimerWrite(UInt32 timerID, UInt32 value)
+ SYS_TRAP(sysTrapSysTimerWrite);
+
+Err SysTimerRead(UInt32 timerID, UInt32 *valueP)
+ SYS_TRAP(sysTrapSysTimerRead);
+
+
+// Information
+Err SysKernelInfo(void *paramP)
+ SYS_TRAP(sysTrapSysKernelInfo);
+
+Boolean SysCreateDataBaseList(UInt32 type, UInt32 creator, UInt16 *dbCount,
+ MemHandle *dbIDs, Boolean lookupName)
+ SYS_TRAP(sysTrapSysCreateDataBaseList);
+
+Boolean SysCreatePanelList(UInt16 *panelCount, MemHandle *panelIDs)
+ SYS_TRAP(sysTrapSysCreatePanelList);
+
+UInt16 SysBatteryInfo(Boolean set, UInt16 *warnThresholdP, UInt16 *criticalThresholdP,
+ Int16 *maxTicksP, SysBatteryKind* kindP, Boolean *pluggedIn, UInt8 *percentP)
+ SYS_TRAP(sysTrapSysBatteryInfo);
+
+UInt16 SysBatteryInfoV20(Boolean set, UInt16 *warnThresholdP, UInt16 *criticalThresholdP,
+ Int16 *maxTicksP, SysBatteryKind* kindP, Boolean *pluggedIn)
+ SYS_TRAP(sysTrapSysBatteryInfoV20);
+
+Boolean SysGetStackInfo(MemPtr *startPP, MemPtr *endPP)
+ SYS_TRAP(sysTrapSysGetStackInfo);
+
+
+
+// Mailboxes
+Err SysMailboxCreate(UInt32 *mbIDP, UInt32 *tagP, UInt32 depth)
+ SYS_TRAP(sysTrapSysMailboxCreate);
+
+Err SysMailboxDelete(UInt32 mbID)
+ SYS_TRAP(sysTrapSysMailboxDelete);
+
+Err SysMailboxFlush(UInt32 mbID)
+ SYS_TRAP(sysTrapSysMailboxFlush);
+
+Err SysMailboxSend(UInt32 mbID, void *msgP, UInt32 wAck)
+ SYS_TRAP(sysTrapSysMailboxSend);
+
+Err SysMailboxWait(UInt32 mbID, void *msgP, UInt32 priority,
+ Int32 timeout)
+ SYS_TRAP(sysTrapSysMailboxWait);
+
+// Event Groups
+Err SysEvGroupCreate(UInt32 *evIDP, UInt32 *tagP, UInt32 init)
+ SYS_TRAP(sysTrapSysEvGroupCreate);
+
+//Err SysEvGroupDelete(UInt32 evID) // save trap table space - don't need
+ //SYS_TRAP(sysTrapSysEvGroupDelete);
+
+Err SysEvGroupSignal(UInt32 evID, UInt32 mask, UInt32 value, Int32 type)
+ SYS_TRAP(sysTrapSysEvGroupSignal);
+
+Err SysEvGroupRead(UInt32 evID, UInt32 *valueP)
+ SYS_TRAP(sysTrapSysEvGroupRead);
+
+Err SysEvGroupWait(UInt32 evID, UInt32 mask, UInt32 value, Int32 matchType,
+ Int32 timeout)
+ SYS_TRAP(sysTrapSysEvGroupWait);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+/************************************************************
+ * Assembly Function Prototypes
+ *************************************************************/
+#define _SysSemaphoreSignal \
+ ASM_SYS_TRAP(sysTrapSysSemaphoreSignal)
+
+#define _SysSemaphoreSet \
+ ASM_SYS_TRAP(sysTrapSysSemaphoreSet)
+
+#define _SysDoze \
+ ASM_SYS_TRAP(sysTrapSysDoze)
+
+
+#endif //__SYSTEMMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SystemPkt.h b/SrcShared/Palm/Platform/Incs/Core/System/SystemPkt.h
new file mode 100644
index 0000000..80c562b
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SystemPkt.h
@@ -0,0 +1,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__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SystemResources.h b/SrcShared/Palm/Platform/Incs/Core/System/SystemResources.h
new file mode 100644
index 0000000..39b4e92
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SystemResources.h
@@ -0,0 +1,346 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SystemResources.h
+ *
+ * Description:
+ * Include file for both PalmRez and the C Compiler. This file contains
+ * equates used by both tools. When compiling using the C compiler
+ * the variable RESOURCE_COMPILER must be defined.
+ *
+ * History:
+ * 02/27/95 ron Created by Ron Marianetti
+ * 08/04/95 vmk Added system resource id for Desktop Link user info
+ * 02/03/98 tlw Changed sysFileCDefaultApp from sysFileCMemory which
+ * no longer exists to sysFileCPreferences.
+ * 6/23/98 jhl Added FlashMgr resource
+ * 06/23/98 jhl Added FlashMgr resource
+ * 05/05/99 kwk Added simulator creator/file types, also the
+ * Japanese user dict panel creator and the TSM
+ * library creator.
+ * 05/06/99 lyl Added OEM System File type
+ * 06/25/99 kwk Added sysResIDAppPrefs & sysResIDOverlayFeatures.
+ * 07/14/99 kwk Added sysResTSilkscreen.
+ * 08/08/99 kwk Added sysFileCJEDict.
+ * 09/20/99 kwk Added keyboard feature for reentrancy check.
+ *
+ *****************************************************************************/
+
+#ifndef __SYSTEMRESOURCES_H__
+#define __SYSTEMRESOURCES_H__
+
+//-----------------------------------------------------------
+// This section is common to both the C and Resource Compiler
+//-----------------------------------------------------------
+
+//................................................................
+// File types and creators
+//
+// Each database shall have a creator ID and a type.
+//
+// The creator ID shall establish which application, patch, or extension
+// a particular database is associated with. The creator ID should identify
+// the application/patch/extension, NOT who created it.
+//
+// The type will determine which part of an application,
+// patch, or extension a particular database is.
+//
+// There can be only one database per application, patch, or extension
+// which has type 'application', 'patch', or 'extension'.
+//
+// Creators:
+//
+// ROM-based applications created by Palm Computing have all-lower case
+// creator ID's. Third-party applications have creator ID's which
+// are either all caps, or mixed case. The same requirements go for
+// system patches and extensions.
+//
+// All applications, system patches and extensions shall have unique creator
+// ID's.
+//
+// Types:
+//
+// 'Application', 'Extension', and 'Patch' file/database types for ROM-based
+// apps shall be all-lower case (they are defined below). Other
+// file/database types must be mixed-case,
+// or all caps. These other types are internal to the applications, and
+// therefore the system is unconcerned with their exact values.
+//................................................................
+#define sysFileCSystem 'psys' // Creator type for System files
+#define sysFileCOEMSystem 'poem' // Creator type for OEM System files
+#define sysFileCGraffiti 'graf' // Creator type for Graffiti databases
+#define sysFileCSystemPatch 'ptch' // Creator for System resource file patches
+
+#define sysFileCCalculator 'calc' // Creator type for Calculator App
+#define sysFileCSecurity 'secr' // Creator type for Security App
+#define sysFileCPreferences 'pref' // Creator type for Preferences App
+#define sysFileCAddress 'addr' // Creator type for Address App
+#define sysFileCToDo 'todo' // Creator type for To Do App
+#define sysFileCDatebook 'date' // Creator type for Datebook App
+#define sysFileCMemo 'memo' // Creator type for MemoPad App
+#define sysFileCSync 'sync' // Creator type for HotSync App
+#define sysFileCMemory 'memr' // Creator type for Memory App
+#define sysFileCMail 'mail' // Creator type for Mail App
+#define sysFileCExpense 'exps' // Creator type for Expense App
+#define sysFileCLauncher 'lnch' // Creator type for Launcher App
+#define sysFileCClipper 'clpr' // Creator type for clipper app.
+#define sysFileCSetup 'setp' // Creator type for setup app.
+#define sysFileCActivate 'actv' // Creator type for activation app.
+#define sysFileCFlashInstaller 'fins' // Creator type for FlashInstaller app.
+#define sysFileCRFDiag 'rfdg' // Creator type for RF diagnostics app.
+#define sysFileCMessaging 'msgs' // Creator type for Messaging App
+#define sysFileCModemFlashTool 'gsmf' // Creator type for Palm V modem flash app.
+#define sysFileCJEDict 'dict' // Creator type for JEDict app.
+#define sysFileHotSyncServer 'srvr' // Creator type for HotSync(R) Server app.
+#define sysFileHotSyncServerUpdate 'hssu' // Creator type for HotSync(R) Server update app.
+
+// The following two apps are manufacturing, calibration and maintenance related
+#define sysFileCMACUtilScreen 'mcut' // Creator type for screen oriented MACUtil app.
+#define sysFileCMACUtilSerial 'mcus' // Creator type for serial line driven MACUtil app.
+#define sysResIDMACUtilAutostart 10000 // Autostart serial MACUtil
+
+// Demo Apps
+#define sysFileCGraffitiDemo 'gdem' // Creator type for Graffiti Demo
+#define sysFileCMailDemo 'mdem' // Creator type for Mail Demo
+
+#define sysFileCFirstApp sysFileCPreferences // Creator type for First App after reset
+#define sysFileCAltFirstApp sysFileCSetup // Creator type for First alternate App after reset (with hard key pressed)
+#define sysFileCDefaultApp sysFileCPreferences // Creator type for Default app
+#define sysFileCDefaultButton1App sysFileCDatebook // Creator type for dflt hard button 1 app
+#define sysFileCDefaultButton2App sysFileCAddress // Creator type for dflt hard button 2 app
+#define sysFileCDefaultButton3App sysFileCToDo // Creator type for dflt hard button 3 app
+#define sysFileCDefaultButton4App sysFileCMemo // Creator type for dflt hard button 4 app
+#define sysFileCDefaultCalcButtonApp sysFileCCalculator // Creator type for dflt calc button app
+#define sysFileCDefaultCradleApp sysFileCSync // Creator type for dflt hot sync button app
+#define sysFileCDefaultModemApp sysFileCSync // Creator type for dflt modem button app
+#define sysFileCDefaultAntennaButtonApp sysFileCLauncher // Creator type for dflt antenna up button app
+#define sysFileCNullApp '0000' // Creator type for non-existing app
+#define sysFileCSimulator '\?\?\?\?' // Creator type for Simulator files (app.tres, sys.tres)
+ // '????' does not compile with VC++ (Elaine Server)
+
+#define sysFileCDigitizer 'digi' // Creator type for Digitizer Panel
+#define sysFileCGeneral 'gnrl' // Creator type for General Panel
+#define sysFileCFormats 'frmt' // Creator type for Formats Panel
+#define sysFileCShortCuts 'shct' // Creator type for ShortCuts Panel
+#define sysFileCButtons 'bttn' // Creator type for Buttons Panel
+#define sysFileCOwner 'ownr' // Creator type for Owner Panel
+#define sysFileCModemPanel 'modm' // Creator type for Modem Panel
+#define sysFileCDialPanel 'dial' // Creator type for Dial Panel
+#define sysFileCNetworkPanel 'netw' // Creator type for Network Panel
+#define sysFileCWirelessPanel 'wrls' // Creator type for the wireless Panel.
+#define sysFileCUserDict 'udic' // Creator type for the UserDict panel.
+#define sysFileCPADHtal 'hpad' // Creator type for PAD HTAL lirary
+#define sysFileCTCPHtal 'htcp' // Creator type for TCP HTAL lirary
+#define sysFileCMineHunt 'mine' // Creator type for MineHunt App
+#define sysFileCPuzzle15 'puzl' // Creator type for Puzzle "15" App
+#define sysFileCOpenLibInfo 'olbi' // Creator type for Feature Manager features
+ // used for saving open library info under PalmOS v1.x
+#define sysFileCHwrFlashMgr 'flsh' // Creator type for HwrFlashMgr features
+
+// Libraries. If the resource used by these are expected to be treated as part of
+// the system's usage then the Memory app must be changed.
+#define sysFileTLibrary 'libr' // File type of Shared Libraries
+#define sysFileTLibraryExtension 'libx' // File type of library extensions
+
+#define sysFileCNet 'netl' // Creator type for Net (TCP/IP) Library
+#define sysFileCRmpLib 'netp' // Creator type for RMP Library (NetLib plug-in)
+#define sysFileCINetLib 'inet' // Creator type for INet Library
+#define sysFileCSecLib 'secl' // Creator type for Ir Library
+#define sysFileCWebLib 'webl' // Creator type for Web Library
+#define sysFileCIrLib 'irda' // Creator type for Ir Library
+
+#define sysFileCSerialMgr 'smgr' // Creator for SerialMgrNew used for features.
+#define sysFileCSerialWrapper 'swrp' // Creator type for Serial Wrapper Library.
+#define sysFileCIrSerialWrapper 'iwrp' // Creator type for Ir Serial Wrapper Library.
+#define sysFileCTextServices 'tsml' // Creator type for Text Services Library.
+
+#define sysFileTUartPlugIn 'sdrv' // File type for SerialMgrNew physical port plug-in.
+#define sysFileTVirtPlugin 'vdrv' // Flir type for SerialMgrNew virtual port plug-in.
+#define sysFileCUart328 'u328' // Creator type for '328 UART plug-in
+#define sysFileCUart328EZ 'u8EZ' // Creator type for '328EZ UART plug-in
+#define sysFileCUart650 'u650' // Creator type for '650 UART plug-in
+#define sysFileCVirtIrComm 'ircm' // Creator type for IrComm virtual port plug-in.
+
+#define sysFileTSystem 'rsrc' // File type for Main System File
+#define sysFileTSystemPatch 'ptch' // File type for System resource file patches
+#define sysFileTKernel 'krnl' // File type for System Kernel (AMX)
+#define sysFileTBoot 'boot' // File type for SmallROM System File
+#define sysFileTSmallHal 'shal' // File type for SmallROM HAL File
+#define sysFileTBigHal 'bhal' // File type for Main ROM HAL File
+#define sysFileTSplash 'spls' // File type for Main ROM Splash File
+#define sysFileTUIAppShell 'uish' // File type for UI Application Shell
+#define sysFileTOverlay 'ovly' // File type for UI overlay database
+#define sysFileTExtension 'extn' // File type for System Extensions
+#define sysFileTApplication 'appl' // File type for applications
+#define sysFileTPanel 'panl' // File type for preference panels
+#define sysFileTSavedPreferences 'sprf' // File type for saved preferences
+#define sysFileTPreferences 'pref' // File type for preferences
+#define sysFileTMidi 'smfr' // File type for Standard MIDI File record databases
+#define sysFileTpqa 'pqa ' // File type for the PQA files.
+
+#define sysFileTUserDictionary 'dict' // File type for input method user dictionary.
+#define sysFileTLearningData 'lean' // File type for input method learning data.
+
+#define sysFileTGraffitiMacros 'macr' // Graffiti Macros database
+
+#define sysFileTHtalLib 'htal' // HTAL library
+
+#define sysFileTExgLib 'exgl' // Type of Exchange libraries
+
+#define sysFileTFileStream 'strm' // Default File Stream database type
+
+#define sysFileTTemp 'temp' // Temporary database type; in future versions
+ // of PalmOS (although likely not before 3.3), the
+ // system may automatically delete any db's of
+ // this type at reset time (however, apps are still
+ // responsible for deleting the ones they create
+ // before exiting to protect valuable storage space)
+
+#define sysFileTScriptPlugin 'scpt' // File type for plugin to the Network Panel to
+ //extend scripting capabilities.
+
+#define sysFileTSimulator '\?\?\?\?' // File type for Simulator files (app.tres, sys.tres)
+ // '????' does not compile with VC++ (Elaine Server)
+
+//................................................................
+// Resource types and IDs
+//................................................................
+#define sysResTBootCode 'boot' // Resource type of boot resources
+#define sysResIDBootReset 10000 // Reset code
+#define sysResIDBootInitCode 10001 // Init code
+#define sysResIDBootSysCodeStart 10100 // System code resources start here
+#define sysResIDBootSysCodeMin 10102 // IDs 'Start' to this must exist!!
+#define sysResIDBootUICodeStart 10200 // UI code resources start here
+#define sysResIDBootUICodeMin 10203 // IDs 'Start' to this must exist!!
+
+#define sysResIDBootHAL 19000 // HAL code resource (from HAL.prc)
+
+#define sysResIDBitmapSplash 19000 // ID of (boot) splash screen bitmap
+#define sysResIDBitmapConfirm 19001 // ID of hard reset confirmation bitmap
+
+#define sysResTAppPrefs 'pref' // Resource type of App preferences resources
+#define sysResIDAppPrefs 0 // Application preference
+
+#define sysResTExtPrefs 'xprf' // Resource type of extended preferences
+#define sysResIDExtPrefs 0 // Extended preferences
+
+#define sysResTAppCode 'code' // Resource type of App code resources
+#define sysResTAppGData 'data' // Resource type of App global data resources
+
+#define sysResTExtensionCode 'extn' // Resource type of Extensions code
+#define sysResTExtensionOEMCode 'exte' // Resource type of OEM Extensions code
+
+#define sysResTFeatures 'feat' // Resource type of System features table
+#define sysResIDFeatures 10000 // Resource ID of System features table
+#define sysResIDOverlayFeatures 10001 // Resource ID of system overlay feature table.
+
+#define sysResTCountries 'cnty' // Resource type of System countries table
+#define sysResIDCountries 10000 // Resource ID of System countries table
+
+#define sysResTLibrary 'libr' // Resource type of System Libraries
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER - obsolete, should be removed:
+#endif // PUBLIC_STUFF_STRIPPED
+//#define sysResIDLibrarySerMgr328 10000 // Dragonball (68328) UART
+//#define sysResIDLibrarySerMgr681 10001 // 68681 UART
+//#define sysResIDLibraryRMPPlugIn 10002 // Reliable Message Protocol NetLib Plug-in
+
+#define sysResTSilkscreen 'silk' // Resource type of silkscreen info.
+
+#define sysResTGrfTemplate 'tmpl' // Graffiti templates "file"
+#define sysResIDGrfTemplate 10000 // Graffiti templates "file" ID
+#define sysResTGrfDictionary 'dict' // Graffiti dictionary "file"
+#define sysResIDGrfDictionary 10000 // Graffiti dictionary "file" ID
+#define sysResIDGrfDefaultMacros 10000 // sysResTDefaultDB resource with Graffiti Macros database
+
+#define sysResTDefaultDB 'dflt' // Default database resource type
+#define sysResIDDefaultDB 1 // resource ID of sysResTDefaultDB in each app
+
+#define sysResTErrStrings 'tSTL' // list of error strings
+#define sysResIDErrStrings 10000 // resource ID is (errno>>8)+sysResIDErrStrings
+
+#define sysResIDOEMDBVersion 20001 // resource ID of "tver" and "tint" versions in OEM stamped databases
+
+// System Preferences
+#define sysResTSysPref sysFileCSystem
+#define sysResIDSysPrefMain 0 // Main preferences
+#define sysResIDSysPrefPassword 1 // Password
+#define sysResIDSysPrefFindStr 2 // Find string
+#define sysResIDSysPrefCalibration 3 // Digitizer calibration.
+#define sysResIDDlkUserInfo 4 // Desktop Link user information.
+#define sysResIDDlkLocalPC 5 // Desktop Link local PC host name
+#define sysResIDDlkCondFilterTab 6 // Desktop Link conduit filter table
+#define sysResIDModemMgrPref 7 // Modem Manager preferences
+#define sysResIDDlkLocalPCAddr 8 // Desktop Link local PC host address
+#define sysResIDDlkLocalPCMask 9 // Desktop Link local PC host subnet mask
+
+// These prefs store parameters to pass to an app when launched with a button
+#define sysResIDButton1Param 10 // Parameter for hard button 1 app
+#define sysResIDButton2Param 11 // Parameter for hard button 2 app
+#define sysResIDButton3Param 12 // Parameter for hard button 3 app
+#define sysResIDButton4Param 13 // Parameter for hard button 4 app
+#define sysResIDCalcButtonParam 14 // Parameter for calc button app
+#define sysResIDCradleParam 15 // Parameter for hot sync button app
+#define sysResIDModemParam 16 // Parameter for modem button app
+#define sysResIDAntennaButtonParam 17 // Parameter for antenna up button app
+
+// New for Color, user's color preferences
+#define sysResIDPrefUIColorTableBase 17 // base + depth = ID of actual pref
+#define sysResIDPrefUIColorTable1 18 // User's UI colors for 1bpp displays
+#define sysResIDPrefUIColorTable2 19 // User's UI colors for 2bpp displays
+#define sysResIDPrefUIColorTable4 21 // User's UI colors for 4bpp displays
+#define sysResIDPrefUIColorTable8 25 // User's UI colors for 8bpp displays
+
+// FlashMgr Resources - old
+#define sysResTFlashMgr 'flsh'
+#define sysResIDFlashMgrWorkspace 1 // RAM workspace during flash activity
+
+// FlashMgr Resources - new
+#define sysResTHwrFlashIdent 'flid' // Flash identification code resource
+#define sysResIDHwrFlashIdent 10000 // Flash identification code resource
+
+#define sysResTHwrFlashCode 'flcd' // Flash programming code resource
+ // (resource ID determined by device type)
+
+// OEM Feature type and id.
+#define sysFtrTOEMSys sysFileCOEMSystem
+#define sysFtrIDOEMSysHideBatteryGauge 1
+
+// Onscreen keyboard features
+#define sysFtrTKeyboard 'keyb'
+#define sysFtrIDKeyboardActive 1 // Boolean value, true => keyboard is active.
+ // Currently only used for Japanese.
+
+// Activation status values.
+#define sysActivateStatusFeatureIndex 1
+#define sysActivateNeedGeorgeQuery 0
+#define sysActivateNeedMortyQuery 1
+#define sysActivateFullyActivated 2
+
+#define sysMaxUserDomainNameLength 64
+
+// Current clipper feature indeces
+#define sysClipperPQACardNoIndex 1
+#define sysClipperPQADbIDIndex 2
+
+//-----------------------------------------------------------
+// This section is only valid when running the resource compiler
+//
+// Actually, this section is obsolete. Instear, .r files should
+// inlude SysResTypes.rh to get these definitions.
+//
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER ¥¥¥ leaving this here for now just in case.
+#endif // PUBLIC_STUFF_STRIPPED
+//-----------------------------------------------------------
+
+#ifdef RESOURCE_COMPILER
+
+#include <SysResTypes.rh>
+
+#endif
+
+
+#endif // __SYSTEMRESOURCES_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/TextMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/TextMgr.h
new file mode 100644
index 0000000..baed10f
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/TextMgr.h
@@ -0,0 +1,411 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: TextMgr.h
+ *
+ * Release:
+ *
+ * Description:
+ * Header file for Text Manager.
+ *
+ * History:
+ * 03/05/98 kwk Created by Ken Krugler.
+ * 02/02/99 kwk Added charEncodingPalmLatin & charEncodingPalmSJIS,
+ * since we've extended the CP1252 & CP932 encodings.
+ * Added TxtUpperStr, TxtLowerStr, TxtUpperChar, and
+ * TxtLowerChar macros.
+ * 03/11/99 kwk Changed TxtTruncate to TxtGetTruncationOffset.
+ * 04/24/99 kwk Moved string & character upper/lower casing macros
+ * to IntlGlue library.
+ * 04/28/99 kwk Changed kMaxCharSize to maxCharBytes, as per Roger's request.
+ * 05/15/99 kwk Changed TxtIsValidChar to TxtCharIsValid.
+ * 05/29/99 kwk Removed include of CharAttr.h.
+ * 07/13/99 kwk Moved TxtPrepFindString into TextPrv.h
+ * 09/22/99 kwk Added TxtParamString (OS 3.5).
+ * 10/28/99 kwk Added the TxtCharIsVirtual macro.
+ * 03/01/00 kwk Added the TxtConvertEncoding routine (OS 4.0), and the
+ * txtErrUnknownEncoding and txtErrConvertOverflow errors.
+ * 05/12/00 kwk Deprecated the TxtCharWidth routine.
+ * 05/26/00 kwk Added TxtGetWordWrapOffset (OS 4.0). Convert CharEncodingType
+ * to #define format versus enums. Re-ordered into logical
+ * groups, and fixed up names to match existing convention.
+ * 05/30/00 kwk Added txtErrTranslitUnderflow.
+ * 06/02/00 CS Moved character encoding constants to PalmLocale.h so that
+ * Rez has access to them.
+ * 07/13/00 kwk Added TxtNameToEncoding (OS 4.0).
+ * 07/23/00 kwk Updated TxtConvertEncoding to match new API.
+ * 10/05/00 kwk Added charAttr_<whatever> as substitutes for the old
+ * character attribute flags in CharAttr.h (e.g. _XA, _LO).
+ * kwk Moved sizeOf7BitChar here from CharAttr.h
+ * 11/21/00 kwk Undeprecated TxtCharWidth, in anticipation of future,
+ * proper deprecation.
+ * 11/24/00 kwk Reverted maxCharBytes to 3 (was 4). You only need more than
+ * three bytes for surrogate Unicode characters, which we don't
+ * support, as this would require a 32 bit WChar variable to
+ * hold the result (potentially 21 bits of data). Since we
+ * never use more than 3 bytes, it's OK to shrink this back down.
+ *
+ *****************************************************************************/
+
+#ifndef __TEXTMGR_H__
+#define __TEXTMGR_H__
+
+#include <IntlMgr.h>
+#include <Chars.h>
+
+/***********************************************************************
+ * Public types & constants
+ ***********************************************************************/
+
+// See PalmLocale.h for encoding constants of type CharEncodingType, and
+// character encoding names.
+typedef UInt8 CharEncodingType;
+
+// Transliteration operations for the TxtTransliterate call. We don't use
+// an enum, since each character encoding contains its own set of special
+// transliteration operations (which begin at translitOpCustomBase).
+typedef UInt16 TranslitOpType;
+
+// Standard transliteration operations.
+#define translitOpStandardBase 0 // Beginning of standard operations.
+
+#define translitOpUpperCase 0
+#define translitOpLowerCase 1
+#define translitOpReserved2 2
+#define translitOpReserved3 3
+
+// Custom transliteration operations (defined in CharXXXX.h encoding-specific
+// header files.
+#define translitOpCustomBase 1000 // Beginning of char-encoding specific ops.
+
+#define translitOpPreprocess 0x8000 // Mask for pre-process option, where
+ // no transliteration actually is done.
+
+// Structure used to maintain state across calls to TxtConvertEncoding, for
+// proper handling of source or destination encodings with have modes.
+#define kTxtConvertStateSize 32
+
+typedef struct {
+ UInt8 ioSrcState[kTxtConvertStateSize];
+ UInt8 ioDstState[kTxtConvertStateSize];
+} TxtConvertStateType;
+
+// Flags available in the sysFtrNumCharEncodingFlags feature attribute.
+#define charEncodingOnlySingleByte 0x00000001
+#define charEncodingHasDoubleByte 0x00000002
+#define charEncodingHasLigatures 0x00000004
+#define charEncodingLeftToRight 0x00000008
+
+// Various byte attribute flags. Note that multiple flags can be
+// set, thus a byte could be both a single-byte character, or the first
+// byte of a multi-byte character.
+#define byteAttrFirst 0x80 // First byte of multi-byte char.
+#define byteAttrLast 0x40 // Last byte of multi-byte char.
+#define byteAttrMiddle 0x20 // Middle byte of muli-byte char.
+#define byteAttrSingle 0x01 // Single byte.
+
+// Character attribute flags. These replace the old flags defined in
+// CharAttr.h, but are bit-compatible.
+#define charAttr_XA 0x0200 // extra alphabetic
+#define charAttr_XS 0x0100 // extra space
+#define charAttr_BB 0x0080 // BEL, BS, etc.
+#define charAttr_CN 0x0040 // CR, FF, HT, NL, VT
+#define charAttr_DI 0x0020 // '0'-'9'
+#define charAttr_LO 0x0010 // 'a'-'z' and lowercase extended chars.
+#define charAttr_PU 0x0008 // punctuation
+#define charAttr_SP 0x0004 // space
+#define charAttr_UP 0x0002 // 'A'-'Z' and uppercase extended chars.
+#define charAttr_XD 0x0001 // '0'-'9', 'A'-'F', 'a'-'f'
+
+// Various sets of character attribute flags.
+#define charAttrPrint (charAttr_DI|charAttr_LO|charAttr_PU|charAttr_SP|charAttr_UP|charAttr_XA)
+#define charAttrSpace (charAttr_CN|charAttr_SP|charAttr_XS)
+#define charAttrAlNum (charAttr_DI|charAttr_LO|charAttr_UP|charAttr_XA)
+#define charAttrAlpha (charAttr_LO|charAttr_UP|charAttr_XA)
+#define charAttrCntrl (charAttr_BB|charAttr_CN)
+#define charAttrGraph (charAttr_DI|charAttr_LO|charAttr_PU|charAttr_UP|charAttr_XA)
+#define charAttrDelim (charAttr_SP|charAttr_PU)
+
+// Remember that sizeof(0x0D) == 2 because 0x0D is treated like an int. The
+// same is true of sizeof('a'), sizeof('\0'), and sizeof(chrNull). For this
+// reason it's safest to use the sizeOf7BitChar macro to document buffer size
+// and string length calcs. Note that this can only be used with low-ascii
+// characters, as anything else might be the high byte of a double-byte char.
+#define sizeOf7BitChar(c) 1
+
+// Maximum size a single WChar character will occupy in a text string.
+#define maxCharBytes 3
+
+// Text manager error codes.
+#define txtErrUknownTranslitOp (txtErrorClass | 1)
+#define txtErrTranslitOverrun (txtErrorClass | 2)
+#define txtErrTranslitOverflow (txtErrorClass | 3)
+#define txtErrConvertOverflow (txtErrorClass | 4)
+#define txtErrConvertUnderflow (txtErrorClass | 5)
+#define txtErrUnknownEncoding (txtErrorClass | 6)
+#define txtErrNoCharMapping (txtErrorClass | 7)
+#define txtErrTranslitUnderflow (txtErrorClass | 8)
+
+/***********************************************************************
+ * Public macros
+ ***********************************************************************/
+
+#define TxtCharIsSpace(ch) ((TxtCharAttr(ch) & charAttrSpace) != 0)
+#define TxtCharIsPrint(ch) ((TxtCharAttr(ch) & charAttrPrint) != 0)
+#define TxtCharIsDigit(ch) ((TxtCharAttr(ch) & charAttr_DI) != 0)
+#define TxtCharIsAlNum(ch) ((TxtCharAttr(ch) & charAttrAlNum) != 0)
+#define TxtCharIsAlpha(ch) ((TxtCharAttr(ch) & charAttrAlpha) != 0)
+#define TxtCharIsCntrl(ch) ((TxtCharAttr(ch) & charAttrCntrl) != 0)
+#define TxtCharIsGraph(ch) ((TxtCharAttr(ch) & charAttrGraph) != 0)
+#define TxtCharIsLower(ch) ((TxtCharAttr(ch) & charAttr_LO) != 0)
+#define TxtCharIsPunct(ch) ((TxtCharAttr(ch) & charAttr_PU) != 0)
+#define TxtCharIsUpper(ch) ((TxtCharAttr(ch) & charAttr_UP) != 0)
+#define TxtCharIsHex(ch) ((TxtCharAttr(ch) & charAttr_XD) != 0)
+#define TxtCharIsDelim(ch) ((TxtCharAttr(ch) & charAttrDelim) != 0)
+
+// <c> is a hard key if the event modifier <m> has the command bit set
+// and <c> is either in the proper range or is the calculator character.
+#define TxtCharIsHardKey(m, c) ((((m) & commandKeyMask) != 0) && \
+ ((((c) >= hardKeyMin) && ((c) <= hardKeyMax)) || ((c) == calcChr)))
+
+// <c> is a virtual character if the event modifier <m> has the command
+// bit set. WARNING!!! This macro is only safe to use on Palm OS 3.5 or
+// later. With earlier versions of the OS, use TxtGlueCharIsVirtual()
+// in PalmOSGlue.lib
+#define TxtCharIsVirtual(m, c) (((m) & commandKeyMask) != 0)
+
+#define TxtPreviousCharSize(inText, inOffset) TxtGetPreviousChar((inText), (inOffset), NULL)
+#define TxtNextCharSize(inText, inOffset) TxtGetNextChar((inText), (inOffset), NULL)
+
+
+/***********************************************************************
+ * Public routines
+ ***********************************************************************/
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+// Return back byte attribute (first, last, single, middle) for <inByte>.
+
+UInt8 TxtByteAttr(UInt8 inByte)
+ INTL_TRAP(intlTxtByteAttr);
+
+// Return back the standard attribute bits for <inChar>.
+
+UInt16 TxtCharAttr(WChar inChar)
+ INTL_TRAP(intlTxtCharAttr);
+
+// Return back the extended attribute bits for <inChar>.
+
+UInt16 TxtCharXAttr(WChar inChar)
+ INTL_TRAP(intlTxtCharXAttr);
+
+// Return the size (in bytes) of the character <inChar>. This represents
+// how many bytes would be required to store the character in a string.
+
+UInt16 TxtCharSize(WChar inChar)
+ INTL_TRAP(intlTxtCharSize);
+
+// Return the width (in pixels) of the character <inChar>. You should
+// use FntWCharWidth or FntGlueWCharWidth instead of this routine.
+
+Int16 TxtCharWidth(WChar inChar)
+ INTL_TRAP(intlTxtCharWidth);
+
+// Load the character before offset <inOffset> in the <inText> text. Return
+// back the size of the character.
+
+UInt16 TxtGetPreviousChar(const Char *inText, UInt32 inOffset, WChar *outChar)
+ INTL_TRAP(intlTxtGetPreviousChar);
+
+// Load the character at offset <inOffset> in the <inText> text. Return
+// back the size of the character.
+
+UInt16 TxtGetNextChar(const Char *inText, UInt32 inOffset, WChar *outChar)
+ INTL_TRAP(intlTxtGetNextChar);
+
+// Return the character at offset <inOffset> in the <inText> text.
+
+WChar TxtGetChar(const Char *inText, UInt32 inOffset)
+ INTL_TRAP(intlTxtGetChar);
+
+// Set the character at offset <inOffset> in the <inText> text, and
+// return back the size of the character.
+
+UInt16 TxtSetNextChar(Char *ioText, UInt32 inOffset, WChar inChar)
+ INTL_TRAP(intlTxtSetNextChar);
+
+// Replace the substring "^X" (where X is 0..9, as specified by <inParamNum>)
+// with the string <inParamStr>. If <inParamStr> is NULL then don't modify <ioStr>.
+// Make sure the resulting string doesn't contain more than <inMaxLen> bytes,
+// excluding the terminating null. Return back the number of occurances of
+// the substring found in <ioStr>.
+
+UInt16 TxtReplaceStr(Char *ioStr, UInt16 inMaxLen, const Char *inParamStr, UInt16 inParamNum)
+ INTL_TRAP(intlTxtReplaceStr);
+
+// Allocate a handle containing the result of substituting param0...param3
+// for ^0...^3 in <inTemplate>, and return the locked result. If a parameter
+// is NULL, replace the corresponding substring in the template with "".
+
+Char *TxtParamString(const Char *inTemplate, const Char *param0,
+ const Char *param1, const Char *param2, const Char *param3)
+ INTL_TRAP(intlTxtParamString);
+
+// Return the bounds of the character at <inOffset> in the <inText>
+// text, via the <outStart> & <outEnd> offsets, and also return the
+// actual value of character at or following <inOffset>.
+
+WChar TxtCharBounds(const Char *inText, UInt32 inOffset, UInt32 *outStart, UInt32 *outEnd)
+ INTL_TRAP(intlTxtCharBounds);
+
+// Return the appropriate byte position for truncating <inText> such that it is
+// at most <inOffset> bytes long.
+
+UInt32 TxtGetTruncationOffset(const Char *inText, UInt32 inOffset)
+ INTL_TRAP(intlTxtGetTruncationOffset);
+
+// Search for <inTargetStr> in <inSourceStr>. If found return true and pass back
+// the found position (byte offset) in <outPos>, and the length of the matched
+// text in <outLength>.
+
+Boolean TxtFindString(const Char *inSourceStr, const Char *inTargetStr,
+ UInt32 *outPos, UInt16 *outLength)
+ INTL_TRAP(intlTxtFindString);
+
+// Find the bounds of the word that contains the character at <inOffset>.
+// Return the offsets in <*outStart> and <*outEnd>. Return true if the
+// word we found was not empty & not a delimiter (attribute of first char
+// in word not equal to space or punct).
+
+Boolean TxtWordBounds(const Char *inText, UInt32 inLength, UInt32 inOffset,
+ UInt32 *outStart, UInt32 *outEnd)
+ INTL_TRAP(intlTxtWordBounds);
+
+// Return the offset of the first break position (for text wrapping) that
+// occurs at or before <iOffset> in <iTextP>. Note that this routine will
+// also add trailing spaces and a trailing linefeed to the break position,
+// thus the result could be greater than <iOffset>.
+
+UInt32 TxtGetWordWrapOffset(const Char *iTextP, UInt32 iOffset)
+ INTL_TRAP(intlTxtGetWordWrapOffset);
+
+// Return the minimum (lowest) encoding required for <inChar>. If we
+// don't know about the character, return encoding_Unknown.
+
+CharEncodingType TxtCharEncoding(WChar inChar)
+ INTL_TRAP(intlTxtCharEncoding);
+
+// Return the minimum (lowest) encoding required to represent <inStr>.
+// This is the maximum encoding of any character in the string, where
+// highest is unknown, and lowest is ascii.
+
+CharEncodingType TxtStrEncoding(const Char *inStr)
+ INTL_TRAP(intlTxtStrEncoding);
+
+// Return the higher (max) encoding of <a> and <b>.
+
+CharEncodingType TxtMaxEncoding(CharEncodingType a, CharEncodingType b)
+ INTL_TRAP(intlTxtMaxEncoding);
+
+// Return a pointer to the 'standard' name for <inEncoding>. If the
+// encoding is unknown, return a pointer to an empty string.
+
+const Char *TxtEncodingName(CharEncodingType inEncoding)
+ INTL_TRAP(intlTxtEncodingName);
+
+// Map from a character set name <iEncodingName> to a CharEncodingType.
+// If the character set name is unknown, return charEncodingUnknown.
+
+CharEncodingType TxtNameToEncoding(const Char* iEncodingName)
+ INTL_TRAP(intlTxtNameToEncoding);
+
+// Transliterate <inSrcLength> bytes of text found in <inSrcText>, based
+// on the requested <inOp> operation. Place the results in <outDstText>,
+// and set the resulting length in <ioDstLength>. On entry <ioDstLength>
+// must contain the maximum size of the <outDstText> buffer. If the
+// buffer isn't large enough, return an error (note that outDestText
+// might have been modified during the operation). Note that if <inOp>
+// has the preprocess bit set, then <outDstText> is not modified, and
+// <ioDstLength> will contain the total space required in the destination
+// buffer in order to perform the operation.
+
+Err TxtTransliterate(const Char *inSrcText, UInt16 inSrcLength, Char *outDstText,
+ UInt16 *ioDstLength, TranslitOpType inOp)
+ INTL_TRAP(intlTxtTransliterate);
+
+// Convert <*ioSrcBytes> of text from <srcTextP> between the <srcEncoding>
+// and <dstEncoding> character encodings. If <dstTextP> is not NULL, write
+// the resulting bytes to the buffer, and always return the number of
+// resulting bytes in <*ioDstBytes>. Update <*srcBytes> with the number of
+// bytes from the beginning of <*srcTextP> that were successfully converted.
+// When the routine is called with <srcTextP> pointing to the beginning of
+// a string or text buffer, <newConversion> should be true; if the text is
+// processed in multiple chunks, either because errors occurred or due to
+// source/destination buffer size constraints, then subsequent calls to
+// this routine should pass false for <newConversion>. The TxtConvertStateType
+// record maintains state information so that if the source or destination
+// character encodings have state or modes (e.g. JIS), processing a single
+// sequence of text with multiple calls will work correctly.
+
+// When an error occurs due to an unconvertable character, the behavior of
+// the routine will depend on the <substitutionStr> parameter. If it is NULL,
+// then <*ioSrcBytes> will be set to the offset of the unconvertable character,
+// <ioDstBytes> will be set to the number of successfully converted resulting
+// bytes, and <dstTextP>, in not NULL, will contain conversion results up to
+// the point of the error. The routine will return an appropriate error code,
+// and it is up to the caller to either terminate conversion or skip over the
+// unconvertable character and continue the conversion process (passing false
+// for the <newConversion> parameter in subsequent calls to TxtConvertEncoding).
+// If <substitutionStr> is not NULL, then this string is written to the
+// destination buffer when an unconvertable character is encountered in the
+// source text, and the source character is skipped. Processing continues, though
+// the error code will still be returned when the routine terminates. Note that
+// if a more serious error occurs during processing (e.g. buffer overflow) then
+// that error will be returned even if there was an earlier unconvertable character.
+// Note that the substitution string must use the destination character encoding.
+
+Err TxtConvertEncoding(Boolean newConversion, TxtConvertStateType* ioStateP,
+ const Char* srcTextP, UInt16* ioSrcBytes, CharEncodingType srcEncoding,
+ Char* dstTextP, UInt16* ioDstBytes, CharEncodingType dstEncoding,
+ const Char* substitutionStr, UInt16 substitutionLen)
+ INTL_TRAP(intlTxtConvertEncoding);
+
+// Return true if <inChar> is a valid (drawable) character. Note that we'll
+// return false if it is a virtual character code.
+
+Boolean TxtCharIsValid(WChar inChar)
+ INTL_TRAP(intlTxtCharIsValid);
+
+// Compare the first <s1Len> bytes of <s1> with the first <s2Len> bytes
+// of <s2>. Return the results of the comparison: < 0 if <s1> sorts before
+// <s2>, > 0 if <s1> sorts after <s2>, and 0 if they are equal. Also return
+// the number of bytes that matched in <s1MatchLen> and <s2MatchLen>
+// (either one of which can be NULL if the match length is not needed).
+// This comparison is "caseless", in the same manner as a find operation,
+// thus case, character size, etc. don't matter.
+
+Int16 TxtCaselessCompare(const Char *s1, UInt16 s1Len, UInt16 *s1MatchLen,
+ const Char *s2, UInt16 s2Len, UInt16 *s2MatchLen)
+ INTL_TRAP(intlTxtCaselessCompare);
+
+// Compare the first <s1Len> bytes of <s1> with the first <s2Len> bytes
+// of <s2>. Return the results of the comparison: < 0 if <s1> sorts before
+// <s2>, > 0 if <s1> sorts after <s2>, and 0 if they are equal. Also return
+// the number of bytes that matched in <s1MatchLen> and <s2MatchLen>
+// (either one of which can be NULL if the match length is not needed).
+
+Int16 TxtCompare(const Char *s1, UInt16 s1Len, UInt16 *s1MatchLen,
+ const Char *s2, UInt16 s2Len, UInt16 *s2MatchLen)
+ INTL_TRAP(intlTxtCompare);
+
+#ifdef __cplusplus
+ }
+#endif
+#endif
+
+#endif // __TEXTMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Window.h b/SrcShared/Palm/Platform/Incs/Core/System/Window.h
new file mode 100644
index 0000000..50aec23
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Window.h
@@ -0,0 +1,559 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Window.h
+ *
+ * Description:
+ * This file defines window structures and routines that support color.
+ *
+ * History:
+ * January 20, 1999 Created by Bob Ebert
+ * Name Date Description
+ * ---- ---- -----------
+ * bob 1/20/99 Branch off WindowNew.h
+ * BS 4/20/99 Re-design of the screen driver
+ * bob 5/26/99 Cleanup/reorg
+ * jmp 12/23/99 Fix <> vs. "" problem.
+ *
+ *****************************************************************************/
+
+#ifndef __WINDOW_H__
+#define __WINDOW_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+#include <Font.h>
+#include <Rect.h>
+#include <Bitmap.h>
+
+#include <PalmOptErrorCheckLevel.h> // #define ERROR_CHECK_LEVEL
+
+#ifdef _WIN32
+ #pragma warning(disable: 4214) // nonstandard extension used : bit field types other than int
+#endif
+
+// enum for WinScrollRectangle
+typedef enum { winUp = 0, winDown, winLeft, winRight } WinDirectionType;
+
+
+// enum for WinCreateOffscreenWindow
+typedef enum { screenFormat = 0, genericFormat } WindowFormatType;
+
+
+// enum for WinLockScreen
+typedef enum {winLockCopy, winLockErase, winLockDontCare} WinLockInitType;
+
+
+// operations for the WinScreenMode function
+typedef enum {
+ winScreenModeGetDefaults,
+ winScreenModeGet,
+ winScreenModeSetToDefaults,
+ winScreenModeSet,
+ winScreenModeGetSupportedDepths,
+ winScreenModeGetSupportsColor
+} WinScreenModeOperation;
+
+// Operations for the WinPalette function
+#define winPaletteGet 0
+#define winPaletteSet 1
+#define winPaletteSetToDefault 2
+
+// transfer modes for color drawing
+typedef enum {winPaint, winErase, winMask, winInvert, winOverlay, winPaintInverse, winSwap} WinDrawOperation;
+
+
+typedef enum { blackPattern, whitePattern, grayPattern, customPattern } PatternType;
+#define noPattern blackPattern
+#define grayHLinePattern 0xAA
+#define grayHLinePatternOdd 0x55
+
+
+// grayUnderline means dotted current foreground color
+// solidUnderline means solid current foreground color
+// colorUnderline redundant, use solidUnderline instead
+typedef enum { noUnderline, grayUnderline, solidUnderline, colorUnderline } UnderlineModeType;
+
+#define WinMaxSupportedDepth 8
+#define WinNumSupportedColors 4
+
+typedef UInt8 IndexedColorType; // 1-, 2-, 4-, or 8-bit index
+
+typedef UInt8 CustomPatternType [8]; // 8x8 1-bit deep pattern
+
+// for WinPalette startIndex value, respect indexes in passed table
+#define WinUseTableIndexes -1
+
+//-----------------------------------------------
+// Draw state structures.
+//-----------------------------------------------
+
+
+typedef struct DrawStateType {
+ WinDrawOperation transferMode;
+ PatternType pattern;
+ UnderlineModeType underlineMode;
+ FontID fontId;
+ FontPtr font;
+ CustomPatternType patternData;
+ IndexedColorType foreColor;
+ IndexedColorType backColor;
+ IndexedColorType textColor;
+ UInt8 reserved;
+} DrawStateType;
+
+
+#define DrawStateStackSize 5 // enough for a control in a field in a window
+
+
+
+
+//-----------------------------------------------
+// The Window Structures.
+//-----------------------------------------------
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER ¥¥¥Ê-- need to add #defines for each bit for endian portableness
+#endif // PUBLIC_STUFF_STRIPPED
+typedef union FrameBitsType {
+ struct {
+ UInt16 cornerDiam : 8; // corner diameter, max 38
+ UInt16 reserved_3 : 3;
+ UInt16 threeD : 1; // Draw 3D button
+ UInt16 shadowWidth : 2; // Width of shadow
+ UInt16 width : 2; // Width frame
+ } bits;
+ UInt16 word; // IMPORTANT: INITIALIZE word to zero before setting bits!
+} FrameBitsType;
+
+typedef UInt16 FrameType;
+
+// Standard Frame Types
+#define noFrame 0
+#define simpleFrame 1
+#define rectangleFrame 1
+#define simple3DFrame 0x0012 // 3d, frame = 2
+#define roundFrame 0x0401 // corner = 7, frame = 1
+#define boldRoundFrame 0x0702 // corner = 7, frame = 2
+#define popupFrame 0x0205 // corner = 2, frame = 1, shadow = 1
+#define dialogFrame 0x0302 // corner = 3, frame = 2
+#define menuFrame popupFrame
+
+
+#define winDefaultDepthFlag 0xFF
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER ¥¥¥Ê-- need to add #defines for each bit for endian portableness
+#endif // PUBLIC_STUFF_STRIPPED
+typedef struct WindowFlagsType {
+ UInt16 format:1; // window format: 0=screen mode; 1=generic mode
+ UInt16 offscreen:1; // offscreen flag: 0=onscreen ; 1=offscreen
+ UInt16 modal:1; // modal flag: 0=modeless window; 1=modal window
+ UInt16 focusable:1; // focusable flag: 0=non-focusable; 1=focusable
+ UInt16 enabled:1; // enabled flag: 0=disabled; 1=enabled
+ UInt16 visible:1; // visible flag: 0-invisible; 1=visible
+ UInt16 dialog:1; // dialog flag: 0=non-dialog; 1=dialog
+ UInt16 freeBitmap:1; // free bitmap w/window: 0=don't free, 1=free
+ UInt16 reserved :8;
+} WindowFlagsType;
+
+typedef struct WindowType {
+ Coord displayWidthV20; // use WinGetDisplayExtent instead
+ Coord displayHeightV20; // use WinGetDisplayExtent instead
+ void * displayAddrV20; // use the drawing functions instead
+ WindowFlagsType windowFlags;
+ RectangleType windowBounds;
+ AbsRectType clippingBounds;
+ BitmapPtr bitmapP;
+ FrameBitsType frameType;
+ DrawStateType * drawStateP; // was GraphicStatePtr
+ struct WindowType * nextWindow;
+} WindowType;
+
+typedef WindowType *WinPtr;
+typedef WindowType *WinHandle;
+
+
+//-----------------------------------------------
+// More graphics shapes
+//-----------------------------------------------
+typedef struct WinLineType {
+ Coord x1;
+ Coord y1;
+ Coord x2;
+ Coord y2;
+} WinLineType;
+
+// Rectangles, Points defined in Rect.h
+
+
+
+//-----------------------------------------------
+// Low Memory Globals
+//-----------------------------------------------
+
+// This is the structure of a low memory global reserved for the Window Manager
+// In GRAPHIC_VERSION_2, it held a single drawing state. In this version, it
+// holds stack information for structures that are allocated from the dynamic heap
+typedef struct GraphicStateType {
+ DrawStateType * drawStateP;
+ DrawStateType * drawStateStackP;
+ Int16 drawStateIndex;
+ UInt16 screenLockCount;
+} GraphicStateType;
+
+// ----------------------
+// Window manager errors
+// ----------------------
+#define winErrPalette (winErrorClass | 1)
+
+
+
+//-----------------------------------------------
+// Macros
+//-----------------------------------------------
+
+// For now, the window handle is a pointer to a window structure,
+// this however may change, so use the following macros.
+
+#define WinGetWindowPointer(winHandle) ((WindowType *) winHandle)
+
+#define WinGetWindowHandle(winPtr) ((WinHandle) winPtr)
+
+#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL
+#define ECWinValidateHandle(winHandle) WinValidateHandle(winHandle)
+#else
+#define ECWinValidateHandle(winHandle)
+#endif
+
+
+
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//-----------------------------------------------
+// Routines relating to windows management
+//-----------------------------------------------
+
+extern Boolean WinValidateHandle (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinValidateHandle);
+
+extern WinHandle WinCreateWindow (const RectangleType *bounds, FrameType frame,
+ Boolean modal, Boolean focusable, UInt16 *error)
+ SYS_TRAP(sysTrapWinCreateWindow);
+
+extern WinHandle WinCreateOffscreenWindow (Coord width, Coord height,
+ WindowFormatType format, UInt16 *error)
+ SYS_TRAP(sysTrapWinCreateOffscreenWindow);
+
+extern WinHandle WinCreateBitmapWindow (BitmapType *bitmapP, UInt16 *error)
+ SYS_TRAP(sysTrapWinCreateBitmapWindow);
+
+extern void WinDeleteWindow (WinHandle winHandle, Boolean eraseIt)
+ SYS_TRAP(sysTrapWinDeleteWindow);
+
+extern void WinInitializeWindow (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinInitializeWindow);
+
+extern void WinAddWindow (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinAddWindow);
+
+extern void WinRemoveWindow (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinRemoveWindow);
+
+extern void WinMoveWindowAddr (WindowType *oldLocationP, WindowType *newLocationP)
+ SYS_TRAP(sysTrapWinMoveWindowAddr);
+
+extern void WinSetActiveWindow (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinSetActiveWindow);
+
+extern WinHandle WinSetDrawWindow (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinSetDrawWindow);
+
+extern WinHandle WinGetDrawWindow (void)
+ SYS_TRAP(sysTrapWinGetDrawWindow);
+
+extern WinHandle WinGetActiveWindow (void)
+ SYS_TRAP(sysTrapWinGetActiveWindow);
+
+extern WinHandle WinGetDisplayWindow (void)
+ SYS_TRAP(sysTrapWinGetDisplayWindow);
+
+extern WinHandle WinGetFirstWindow (void)
+ SYS_TRAP(sysTrapWinGetFirstWindow);
+
+extern void WinEnableWindow (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinEnableWindow);
+
+extern void WinDisableWindow (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinDisableWindow);
+
+extern void WinGetWindowFrameRect (WinHandle winHandle, RectangleType *r)
+ SYS_TRAP(sysTrapWinGetWindowFrameRect);
+
+extern void WinDrawWindowFrame (void)
+ SYS_TRAP(sysTrapWinDrawWindowFrame);
+
+extern void WinEraseWindow (void)
+ SYS_TRAP(sysTrapWinEraseWindow);
+
+extern WinHandle WinSaveBits (const RectangleType *source, UInt16 *error)
+ SYS_TRAP(sysTrapWinSaveBits);
+
+extern void WinRestoreBits (WinHandle winHandle, Coord destX, Coord destY)
+ SYS_TRAP(sysTrapWinRestoreBits);
+
+extern void WinCopyRectangle (WinHandle srcWin, WinHandle dstWin,
+ const RectangleType *srcRect, Coord destX, Coord destY, WinDrawOperation mode)
+ SYS_TRAP(sysTrapWinCopyRectangle);
+
+extern void WinScrollRectangle (const RectangleType *rP, WinDirectionType direction,
+ Coord distance, RectangleType *vacatedP)
+ SYS_TRAP(sysTrapWinScrollRectangle);
+
+extern void WinGetDisplayExtent (Coord *extentX, Coord *extentY)
+ SYS_TRAP(sysTrapWinGetDisplayExtent);
+
+extern void WinGetWindowBounds (RectangleType *rP)
+ SYS_TRAP(sysTrapWinGetWindowBounds);
+
+extern void WinSetWindowBounds (WinHandle winHandle, const RectangleType *rP)
+ SYS_TRAP(sysTrapWinSetWindowBounds);
+
+extern void WinGetWindowExtent (Coord *extentX, Coord *extentY)
+ SYS_TRAP(sysTrapWinGetWindowExtent);
+
+extern void WinDisplayToWindowPt (Coord *extentX, Coord *extentY)
+ SYS_TRAP(sysTrapWinDisplayToWindowPt);
+
+extern void WinWindowToDisplayPt (Coord *extentX, Coord *extentY)
+ SYS_TRAP(sysTrapWinWindowToDisplayPt);
+
+extern BitmapType *WinGetBitmap (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinGetBitmap);
+
+extern void WinGetClip (RectangleType *rP)
+ SYS_TRAP(sysTrapWinGetClip);
+
+extern void WinSetClip (const RectangleType *rP)
+ SYS_TRAP(sysTrapWinSetClip);
+
+extern void WinResetClip (void)
+ SYS_TRAP(sysTrapWinResetClip);
+
+extern void WinClipRectangle (RectangleType *rP)
+ SYS_TRAP(sysTrapWinClipRectangle);
+
+extern Boolean WinModal (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinModal);
+
+//-----------------------------------------------
+// Routines to draw shapes or frames shapes
+//-----------------------------------------------
+
+// Pixel(s)
+extern IndexedColorType WinGetPixel (Coord x, Coord y)
+ SYS_TRAP(sysTrapWinGetPixel);
+
+extern void WinPaintPixel (Coord x, Coord y) // uses drawing mode
+ SYS_TRAP(sysTrapWinPaintPixel);
+
+extern void WinDrawPixel (Coord x, Coord y)
+ SYS_TRAP(sysTrapWinDrawPixel);
+
+extern void WinErasePixel (Coord x, Coord y)
+ SYS_TRAP(sysTrapWinErasePixel);
+
+extern void WinInvertPixel (Coord x, Coord y)
+ SYS_TRAP(sysTrapWinInvertPixel);
+
+extern void WinPaintPixels (UInt16 numPoints, PointType pts[])
+ SYS_TRAP(sysTrapWinPaintPixels);
+
+// Line(s)
+extern void WinPaintLines (UInt16 numLines, WinLineType lines[])
+ SYS_TRAP(sysTrapWinPaintLines);
+
+extern void WinPaintLine (Coord x1, Coord y1, Coord x2, Coord y2)
+ SYS_TRAP(sysTrapWinPaintLine);
+
+extern void WinDrawLine (Coord x1, Coord y1, Coord x2, Coord y2)
+ SYS_TRAP(sysTrapWinDrawLine);
+
+extern void WinDrawGrayLine (Coord x1, Coord y1, Coord x2, Coord y2)
+ SYS_TRAP(sysTrapWinDrawGrayLine);
+
+extern void WinEraseLine (Coord x1, Coord y1, Coord x2, Coord y2)
+ SYS_TRAP(sysTrapWinEraseLine);
+
+extern void WinInvertLine (Coord x1, Coord y1, Coord x2, Coord y2)
+ SYS_TRAP(sysTrapWinInvertLine);
+
+extern void WinFillLine (Coord x1, Coord y1, Coord x2, Coord y2)
+ SYS_TRAP(sysTrapWinFillLine);
+
+
+// Rectangle
+extern void WinPaintRectangle (const RectangleType *rP, UInt16 cornerDiam)
+ SYS_TRAP(sysTrapWinPaintRectangle);
+
+extern void WinDrawRectangle (const RectangleType *rP, UInt16 cornerDiam)
+ SYS_TRAP(sysTrapWinDrawRectangle);
+
+extern void WinEraseRectangle (const RectangleType *rP, UInt16 cornerDiam)
+ SYS_TRAP(sysTrapWinEraseRectangle);
+
+extern void WinInvertRectangle (const RectangleType *rP, UInt16 cornerDiam)
+ SYS_TRAP(sysTrapWinInvertRectangle);
+
+extern void WinFillRectangle (const RectangleType *rP, UInt16 cornerDiam)
+ SYS_TRAP(sysTrapWinFillRectangle);
+
+// Rectangle frames
+extern void WinPaintRectangleFrame (FrameType frame, const RectangleType *rP)
+ SYS_TRAP(sysTrapWinPaintRectangleFrame);
+
+extern void WinDrawRectangleFrame (FrameType frame, const RectangleType *rP)
+ SYS_TRAP(sysTrapWinDrawRectangleFrame);
+
+extern void WinDrawGrayRectangleFrame (FrameType frame, const RectangleType *rP)
+ SYS_TRAP(sysTrapWinDrawGrayRectangleFrame);
+
+extern void WinEraseRectangleFrame (FrameType frame, const RectangleType *rP)
+ SYS_TRAP(sysTrapWinEraseRectangleFrame);
+
+extern void WinInvertRectangleFrame (FrameType frame, const RectangleType *rP)
+ SYS_TRAP(sysTrapWinInvertRectangleFrame);
+
+extern void WinGetFramesRectangle (FrameType frame, const RectangleType *rP,
+ RectangleType *obscuredRect)
+ SYS_TRAP(sysTrapWinGetFramesRectangle);
+
+
+// Bitmap
+extern void WinDrawBitmap (BitmapPtr bitmapP, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinDrawBitmap);
+
+extern void WinPaintBitmap (BitmapType *bitmapP, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinPaintBitmap);
+
+
+// Characters
+extern void WinDrawChar (WChar theChar, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinDrawChar);
+
+extern void WinDrawChars (const Char *chars, Int16 len, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinDrawChars);
+
+extern void WinPaintChar (WChar theChar, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinPaintChar);
+
+extern void WinPaintChars (const Char *chars, Int16 len, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinPaintChars);
+
+extern void WinDrawInvertedChars (const Char *chars, Int16 len, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinDrawInvertedChars);
+
+extern void WinDrawTruncChars(const Char *chars, Int16 len, Coord x, Coord y, Coord maxWidth)
+ SYS_TRAP(sysTrapWinDrawTruncChars);
+
+extern void WinEraseChars (const Char *chars, Int16 len, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinEraseChars);
+
+extern void WinInvertChars (const Char *chars, Int16 len, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinInvertChars);
+
+extern UnderlineModeType WinSetUnderlineMode (UnderlineModeType mode)
+ SYS_TRAP(sysTrapWinSetUnderlineMode);
+
+
+
+//-----------------------------------------------
+// Routines for patterns and colors
+//-----------------------------------------------
+
+extern void WinPushDrawState (void) // "save" fore, back, text color, pattern, underline mode, font
+ SYS_TRAP(sysTrapWinPushDrawState);
+
+extern void WinPopDrawState (void) // "restore" saved drawing variables
+ SYS_TRAP(sysTrapWinPopDrawState);
+
+
+extern WinDrawOperation WinSetDrawMode (WinDrawOperation newMode)
+ SYS_TRAP(sysTrapWinSetDrawMode);
+
+
+extern IndexedColorType WinSetForeColor (IndexedColorType foreColor)
+ SYS_TRAP(sysTrapWinSetForeColor);
+
+extern IndexedColorType WinSetBackColor (IndexedColorType backColor)
+ SYS_TRAP(sysTrapWinSetBackColor);
+
+extern IndexedColorType WinSetTextColor (IndexedColorType textColor)
+ SYS_TRAP(sysTrapWinSetTextColor);
+
+// "obsolete" color call, supported for backwards compatibility
+extern void WinSetColors(const RGBColorType *newForeColorP, RGBColorType *oldForeColorP,
+ const RGBColorType *newBackColorP, RGBColorType *oldBackColorP)
+ SYS_TRAP(sysTrapWinSetColors);
+
+extern void WinGetPattern (CustomPatternType *patternP)
+ SYS_TRAP(sysTrapWinGetPattern);
+
+extern PatternType WinGetPatternType (void)
+ SYS_TRAP(sysTrapWinGetPatternType);
+
+extern void WinSetPattern (const CustomPatternType *patternP)
+ SYS_TRAP(sysTrapWinSetPattern);
+
+extern void WinSetPatternType (PatternType newPattern)
+ SYS_TRAP(sysTrapWinSetPatternType);
+
+extern Err WinPalette(UInt8 operation, Int16 startIndex,
+ UInt16 paletteEntries, RGBColorType *tableP)
+ SYS_TRAP(sysTrapWinPalette);
+
+extern IndexedColorType WinRGBToIndex(const RGBColorType *rgbP)
+ SYS_TRAP(sysTrapWinRGBToIndex);
+
+extern void WinIndexToRGB(IndexedColorType i, RGBColorType *rgbP)
+ SYS_TRAP(sysTrapWinIndexToRGB);
+
+
+
+//-----------------------------------------------
+// New WinScreen functions
+//-----------------------------------------------
+
+extern void WinScreenInit(void)
+ SYS_TRAP(sysTrapWinScreenInit);
+
+extern Err WinScreenMode(WinScreenModeOperation operation,
+ UInt32 *widthP,
+ UInt32 *heightP,
+ UInt32 *depthP,
+ Boolean *enableColorP)
+ SYS_TRAP(sysTrapWinScreenMode);
+
+
+//-----------------------------------------------
+// Screen tracking (double buffering) support
+//-----------------------------------------------
+extern UInt8 *WinScreenLock(WinLockInitType initMode)
+ SYS_TRAP(sysTrapWinScreenLock);
+
+extern void WinScreenUnlock(void)
+ SYS_TRAP(sysTrapWinScreenUnlock);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif //__WINDOW_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/UI/AttentionMgr.h b/SrcShared/Palm/Platform/Incs/Core/UI/AttentionMgr.h
new file mode 100644
index 0000000..c466a1f
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/UI/AttentionMgr.h
@@ -0,0 +1,209 @@
+/******************************************************************************
+ *
+ * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: AttentionMgr.h
+ *
+ * Release:
+ *
+ * Description:
+ * Include file for Attention Manager
+ *
+ * History:
+ * Name Date Description
+ * ---- ---- -----------
+ * peter 06/12/00 Initial Revision
+ * gap 07/21/00 Change parameter list and data structures to support
+ * specification of card number as well as dbID.
+ *
+ *****************************************************************************/
+
+#ifndef __ATTENTION_MGR_H__
+#define __ATTENTION_MGR_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+#include <Rect.h>
+#include <SysEvent.h>
+#include <Event.h>
+
+/************************************************************
+ * Attention Manager result codes
+ * (attnErrorClass is defined in ErrorBase)
+ *************************************************************/
+#define attnErrMemory (attnErrorClass | 1) // ran out of memory
+
+
+/************************************************************
+ * Attention Indicator bounds
+ *************************************************************/
+#define kAttnIndicatorLeft 0
+#define kAttnIndicatorTop 0
+#define kAttnIndicatorWidth 16
+#define kAttnIndicatorHeight 15
+
+
+/************************************************************
+ * Constants used for list view drawing.
+ *
+ * Applications should use the following constants to format
+ * the display of information in attention manager list view.
+ *
+ * The application's small icon should be drawn centered within
+ * the first kAttnListMaxIconWidth pixels of the drawing bounds.
+ *
+ * Two lines of text information describing the attention should
+ * then be drawn left justified starting at kAttnListTextOffset
+ * from the left edge of the drawing bounds.
+ *************************************************************/
+#define kAttnListMaxIconWidth 15
+#define kAttnListTextOffset 17
+
+
+/********************************************************************
+ * Attention Manager Structures
+ ********************************************************************/
+
+typedef UInt32 AttnFlagsType;
+
+#define kAttnFlagsSoundBit ((AttnFlagsType)0x0001)
+#define kAttnFlagsLEDBit ((AttnFlagsType)0x0002)
+#define kAttnFlagsVibrateBit ((AttnFlagsType)0x0004)
+#define kAttnFlagsCustomEffectBit ((AttnFlagsType)0x0008)
+ // Note: More bits can be defined if/when hardware capability increases
+
+#define kAttnFlagsAllBits ((AttnFlagsType)0xFFFF)
+
+
+// The following are passed to AttnGetAttention() and AttnUpdate to specify
+// overrides from the user settings for an attention request.
+#define kAttnFlagsUseUserSettings ((AttnFlagsType)0x00000000)
+
+#define kAttnFlagsAlwaysSound (kAttnFlagsSoundBit)
+#define kAttnFlagsAlwaysLED (kAttnFlagsLEDBit)
+#define kAttnFlagsAlwaysVibrate (kAttnFlagsVibrateBit)
+#define kAttnFlagsAlwaysCustomEffect (kAttnFlagsCustomEffectBit)
+#define kAttnFlagsEverything (kAttnFlagsAllBits)
+
+#define kAttnFlagsNoSound (kAttnFlagsSoundBit<<16)
+#define kAttnFlagsNoLED (kAttnFlagsLEDBit<<16)
+#define kAttnFlagsNoVibrate (kAttnFlagsVibrateBit<<16)
+#define kAttnFlagsNoCustomEffect (kAttnFlagsCustomEffectBit<<16)
+#define kAttnFlagsNothing (kAttnFlagsAllBits<<16)
+
+
+// The following are used to interpret the feature.
+#define kAttnFtrCreator 'attn'
+#define kAttnFtrCapabilities 0 // Read to determine device capabilities and user settings.
+
+#define kAttnFlagsUserWantsSound (kAttnFlagsSoundBit)
+#define kAttnFlagsUserWantsLED (kAttnFlagsLEDBit)
+#define kAttnFlagsUserWantsVibrate (kAttnFlagsVibrateBit)
+#define kAttnFlagsUserWantsCustomEffect (kAttnFlagsCustomEffectBit) // Always false
+#define kAttnFlagsUserSettingsMask (kAttnFlagsAllBits)
+
+#define kAttnFlagsHasSound (kAttnFlagsSoundBit<<16)
+#define kAttnFlagsHasLED (kAttnFlagsLEDBit<<16)
+#define kAttnFlagsHasVibrate (kAttnFlagsVibrateBit<<16)
+#define kAttnFlagsHasCustomEffect (kAttnFlagsCustomEffectBit<<16) // Always true
+#define kAttnFlagsCapabilitiesMask (kAttnFlagsAllBits<<16)
+
+
+typedef UInt16 AttnLevelType;
+ #define kAttnLevelInsistent ((AttnLevelType)0)
+ #define kAttnLevelSubtle ((AttnLevelType)1)
+
+typedef UInt16 AttnCommandType;
+ #define kAttnCommandDrawDetail ((AttnCommandType)1)
+ #define kAttnCommandDrawList ((AttnCommandType)2)
+ #define kAttnCommandPlaySound ((AttnCommandType)3)
+ #define kAttnCommandCustomEffect ((AttnCommandType)4)
+ #define kAttnCommandGoThere ((AttnCommandType)5)
+ #define kAttnCommandGotIt ((AttnCommandType)6)
+ #define kAttnCommandSnooze ((AttnCommandType)7)
+ #define kAttnCommandIterate ((AttnCommandType)8)
+
+typedef union AttnCommandArgsTag {
+ struct AttnCommandArgsDrawDetailTag{
+ RectangleType bounds;
+ Boolean firstTime;
+ AttnFlagsType flags;
+ } drawDetail;
+
+ struct AttnCommandArgsDrawListTag {
+ RectangleType bounds;
+ Boolean firstTime;
+ AttnFlagsType flags;
+ Boolean selected;
+ } drawList;
+
+ struct AttnCommandArgsGotItTag {
+ Boolean dismissedByUser;
+ } gotIt;
+
+ struct AttnCommandArgsIterateTag {
+ UInt32 iterationData;
+ } iterate;
+} AttnCommandArgsType;
+
+typedef struct {
+ AttnCommandType command;
+ UInt32 userData;
+ AttnCommandArgsType *commandArgsP;
+} AttnLaunchCodeArgsType;
+
+typedef Err AttnCallbackProc (AttnCommandType command, UInt32 userData, AttnCommandArgsType *commandArgsP);
+
+// These details go with the sysNotifyGotUsersAttention notification.
+typedef struct {
+ AttnFlagsType flags;
+} AttnNotifyDetailsType;
+
+
+/********************************************************************
+ * Public Attention Manager Routines
+ ********************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+Err AttnGetAttention (UInt16 cardNo, LocalID dbID, UInt32 userData,
+ AttnCallbackProc *callbackFnP, AttnLevelType level, AttnFlagsType flags,
+ UInt16 nagRateInSeconds, UInt16 nagRepeatLimit)
+ SYS_TRAP(sysTrapAttnGetAttention);
+
+Boolean AttnUpdate (UInt16 cardNo, LocalID dbID, UInt32 userData,
+ AttnCallbackProc *callbackFnP, AttnFlagsType *flagsP,
+ UInt16 *nagRateInSecondsP, UInt16 *nagRepeatLimitP)
+ SYS_TRAP(sysTrapAttnUpdate);
+
+Boolean AttnForgetIt (UInt16 cardNo, LocalID dbID, UInt32 userData)
+ SYS_TRAP(sysTrapAttnForgetIt);
+
+UInt16 AttnGetCounts (UInt16 cardNo, LocalID dbID, UInt16 *insistentCountP, UInt16 *subtleCountP)
+ SYS_TRAP(sysTrapAttnGetCounts);
+
+void AttnListOpen (void)
+ SYS_TRAP(sysTrapAttnListOpen);
+
+void AttnIterate (UInt16 cardNo, LocalID dbID, UInt32 iterationData)
+ SYS_TRAP(sysTrapAttnIterate);
+
+Err AttnDoSpecialEffects(AttnFlagsType flags)
+ SYS_TRAP(sysTrapAttnDoSpecialEffects);
+
+void AttnIndicatorEnable(Boolean enableIt)
+ SYS_TRAP(sysTrapAttnIndicatorEnable);
+
+Boolean AttnIndicatorEnabled(void)
+ SYS_TRAP(sysTrapAttnIndicatorEnabled);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif // __ATTENTION_MGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/UI/Control.h b/SrcShared/Palm/Platform/Incs/Core/UI/Control.h
new file mode 100644
index 0000000..bd23d96
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/UI/Control.h
@@ -0,0 +1,188 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Control.h
+ *
+ * Description:
+ * This file defines check box structures and routines.
+ *
+ * History:
+ * August 29, 1994 Created by Art Lamb
+ * Name Date Description
+ * ---- ---- -----------
+ * bob 2/9/99 Fix up const stuff
+ * bob 4/16/99 add GraphicControlType
+ *
+ *****************************************************************************/
+
+#ifndef __CONTROL_H__
+#define __CONTROL_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+#include <DataMgr.h>
+#include <Event.h>
+
+typedef struct {
+ UInt8 usable :1; // set if part of ui
+ UInt8 enabled :1; // set if interactable (not grayed out)
+ UInt8 visible :1; // set if drawn (set internally)
+ UInt8 on :1; // set if on (checked)
+ UInt8 leftAnchor :1; // set if bounds expand to the right
+ // clear if bounds expand to the left
+ UInt8 frame :3;
+ UInt8 drawnAsSelected :1; // support for old-style graphic controls
+ // where control overlaps a bitmap
+ UInt8 graphical :1; // set if images are used instead of text
+ UInt8 vertical :1; // true for vertical sliders
+ UInt8 reserved :5;
+} ControlAttrType;
+
+
+enum controlStyles {buttonCtl, pushButtonCtl, checkboxCtl, popupTriggerCtl,
+ selectorTriggerCtl, repeatingButtonCtl, sliderCtl,
+ feedbackSliderCtl };
+typedef enum controlStyles ControlStyleType;
+
+enum buttonFrames {noButtonFrame, standardButtonFrame, boldButtonFrame,
+ rectangleButtonFrame};
+typedef enum buttonFrames ButtonFrameType;
+
+
+typedef struct ControlType {
+ UInt16 id;
+ RectangleType bounds;
+ Char * text;
+ ControlAttrType attr;
+ ControlStyleType style;
+ FontID font;
+ UInt8 group;
+ UInt8 reserved;
+} ControlType;
+
+typedef ControlType *ControlPtr; // deprecated, use ControlType *
+
+
+// GraphicControlType *'s can be cast to ControlType *'s and passed to all
+// Control API functions (as long as the 'graphical' bit in the attrs is set)
+
+typedef struct GraphicControlType {
+ UInt16 id;
+ RectangleType bounds;
+ DmResID bitmapID; // overlays text in ControlType
+ DmResID selectedBitmapID; // overlays text in ControlType
+ ControlAttrType attr;
+ ControlStyleType style;
+ FontID unused;
+ UInt8 group;
+ UInt8 reserved;
+} GraphicControlType;
+
+
+// SliderControlType *'s can be cast to ControlType *'s and passed to all
+// Control API functions (as long as the control style is a slider)
+
+typedef struct SliderControlType {
+ UInt16 id;
+ RectangleType bounds;
+ DmResID thumbID; // overlays text in ControlType
+ DmResID backgroundID; // overlays text in ControlType
+ ControlAttrType attr; // graphical *is* set
+ ControlStyleType style; // must be sliderCtl or repeatingSliderCtl
+ UInt8 reserved;
+ Int16 minValue;
+ Int16 maxValue;
+ Int16 pageSize;
+ Int16 value;
+ MemPtr activeSliderP;
+} SliderControlType;
+
+
+//----------------------------------------------------------
+// Control Functions
+//----------------------------------------------------------
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void CtlDrawControl (ControlType *controlP)
+ SYS_TRAP(sysTrapCtlDrawControl);
+
+extern void CtlEraseControl (ControlType *controlP)
+ SYS_TRAP(sysTrapCtlEraseControl);
+
+extern void CtlHideControl (ControlType *controlP)
+ SYS_TRAP(sysTrapCtlHideControl);
+
+extern void CtlShowControl (ControlType *controlP)
+ SYS_TRAP(sysTrapCtlShowControl);
+
+extern Boolean CtlEnabled (const ControlType *controlP)
+ SYS_TRAP(sysTrapCtlEnabled);
+
+extern void CtlSetEnabled (ControlType *controlP, Boolean usable)
+ SYS_TRAP(sysTrapCtlSetEnabled);
+
+extern void CtlSetUsable (ControlType *controlP, Boolean usable)
+ SYS_TRAP(sysTrapCtlSetUsable);
+
+extern Int16 CtlGetValue (const ControlType *controlP)
+ SYS_TRAP(sysTrapCtlGetValue);
+
+extern void CtlSetValue (ControlType *controlP, Int16 newValue)
+ SYS_TRAP(sysTrapCtlSetValue);
+
+extern const Char *CtlGetLabel (const ControlType *controlP)
+ SYS_TRAP(sysTrapCtlGetLabel);
+
+extern void CtlSetLabel (ControlType *controlP, const Char *newLabel)
+ SYS_TRAP(sysTrapCtlSetLabel);
+
+extern void CtlSetGraphics (ControlType *ctlP,
+ DmResID newBitmapID, DmResID newSelectedBitmapID)
+ SYS_TRAP(sysTrapCtlSetGraphics);
+
+extern void CtlSetSliderValues(ControlType *ctlP, const UInt16 *minValueP, const UInt16 *maxValueP,
+ const UInt16 *pageSizeP, const UInt16 *valueP)
+ SYS_TRAP(sysTrapCtlSetSliderValues);
+
+extern void CtlGetSliderValues(const ControlType *ctlP, UInt16 *minValueP, UInt16 *maxValueP,
+ UInt16 *pageSizeP, UInt16 *valueP)
+ SYS_TRAP(sysTrapCtlGetSliderValues);
+
+extern void CtlHitControl (const ControlType *controlP)
+ SYS_TRAP(sysTrapCtlHitControl);
+
+extern Boolean CtlHandleEvent (ControlType *controlP, EventType *pEvent)
+ SYS_TRAP(sysTrapCtlHandleEvent);
+
+extern Boolean CtlValidatePointer (const ControlType *controlP)
+ SYS_TRAP(sysTrapCtlValidatePointer);
+
+extern ControlType *CtlNewControl (void **formPP, UInt16 ID,
+ ControlStyleType style, const Char *textP,
+ Coord x, Coord y, Coord width, Coord height,
+ FontID font, UInt8 group, Boolean leftAnchor)
+ SYS_TRAP(sysTrapCtlNewControl);
+
+extern GraphicControlType *CtlNewGraphicControl (void **formPP, UInt16 ID,
+ ControlStyleType style, DmResID bitmapID, DmResID selectedBitmapID,
+ Coord x, Coord y, Coord width, Coord height,
+ UInt8 group, Boolean leftAnchor)
+ SYS_TRAP(sysTrapCtlNewGraphicControl);
+
+extern SliderControlType *CtlNewSliderControl (void **formPP, UInt16 ID,
+ ControlStyleType style, DmResID thumbID, DmResID backgroundID,
+ Coord x, Coord y, Coord width, Coord height, UInt16 minValue, UInt16 maxValue,
+ UInt16 pageSize, UInt16 value)
+ SYS_TRAP(sysTrapCtlNewSliderControl);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif //__CONTROL_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/UI/Event.h b/SrcShared/Palm/Platform/Incs/Core/UI/Event.h
new file mode 100644
index 0000000..521d1f8
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/UI/Event.h
@@ -0,0 +1,347 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Event.h
+ *
+ * Description:
+ * This file defines UI event structures and routines.
+ *
+ * History:
+ * September 26, 1994 Created by Art Lamb
+ * 07/14/99 jesse Separated from Event.h
+ * 09/12/99 gap Add for new multi-tap implementation
+ * 09/14/99 gap Removed EvtGetTrapState.
+ * 10/28/99 kwk Added EvtKeydownIsVirtual macro.
+ *
+ *****************************************************************************/
+
+#ifndef __EVENT_H__
+#define __EVENT_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+#include <Font.h>
+#include <Rect.h>
+#include <SysEvent.h>
+#include <Window.h>
+
+
+typedef enum {
+ nilEvent = 0, // system level
+ penDownEvent, // system level
+ penUpEvent, // system level
+ penMoveEvent, // system level
+ keyDownEvent, // system level
+ winEnterEvent, // system level
+ winExitEvent, // system level
+ ctlEnterEvent,
+ ctlExitEvent,
+ ctlSelectEvent,
+ ctlRepeatEvent,
+ lstEnterEvent,
+ lstSelectEvent,
+ lstExitEvent,
+ popSelectEvent,
+ fldEnterEvent,
+ fldHeightChangedEvent,
+ fldChangedEvent,
+ tblEnterEvent,
+ tblSelectEvent,
+ daySelectEvent,
+ menuEvent,
+ appStopEvent = 22, // system level
+ frmLoadEvent,
+ frmOpenEvent,
+ frmGotoEvent,
+ frmUpdateEvent,
+ frmSaveEvent,
+ frmCloseEvent,
+ frmTitleEnterEvent,
+ frmTitleSelectEvent,
+ tblExitEvent,
+ sclEnterEvent,
+ sclExitEvent,
+ sclRepeatEvent,
+ tsmConfirmEvent = 35, // system level
+ tsmFepButtonEvent, // system level
+ tsmFepModeEvent, // system level
+//DOLATER - peter: remove this: frmTitleChangedEvent, // system level
+ attnIndicatorEnterEvent, // for attention manager's indicator
+ attnIndicatorSelectEvent, // for attention manager's indicator
+
+ // add future UI level events in this numeric space
+ // to save room for new system level events
+ menuCmdBarOpenEvent = 0x0800,
+ menuOpenEvent,
+ menuCloseEvent,
+ frmGadgetEnterEvent,
+ frmGadgetMiscEvent,
+
+ // <chg 2-25-98 RM> Equates added for library events
+ firstINetLibEvent = 0x1000,
+ firstWebLibEvent = 0x1100,
+
+ // <chg 10/9/98 SCL> Changed firstUserEvent from 32767 (0x7FFF) to 0x6000
+ // Enums are signed ints, so 32767 technically only allowed for ONE event.
+ firstUserEvent = 0x6000
+} eventsEnum;
+
+
+// The event record.
+typedef struct EventType {
+// eventsEnum eType;
+ Int16 eType;
+ Boolean penDown;
+ UInt8 tapCount;
+ Int16 screenX;
+ Int16 screenY;
+ union {
+ struct _GenericEventType generic;
+ struct _PenUpEventType penUp;
+ struct _KeyDownEventType keyDown;
+ struct _WinEnterEventType winEnter;
+ struct _WinExitEventType winExit;
+ struct _TSMConfirmType tsmConfirm;
+ struct _TSMFepButtonType tsmFepButton;
+ struct _TSMFepModeEventType tsmFepMode;
+
+ struct ctlEnter {
+ UInt16 controlID;
+ struct ControlType *pControl;
+ } ctlEnter;
+
+ struct ctlSelect {
+ UInt16 controlID;
+ struct ControlType *pControl;
+ Boolean on;
+ UInt8 reserved1;
+ UInt16 value; // used for slider controls only
+ } ctlSelect;
+
+ struct ctlRepeat {
+ UInt16 controlID;
+ struct ControlType *pControl;
+ UInt32 time;
+ UInt16 value; // used for slider controls only
+ } ctlRepeat;
+
+ struct ctlExit {
+ UInt16 controlID;
+ struct ControlType *pControl;
+ } ctlExit;
+
+ struct fldEnter {
+ UInt16 fieldID;
+ struct FieldType *pField;
+ } fldEnter;
+
+ struct fldHeightChanged {
+ UInt16 fieldID;
+ struct FieldType *pField;
+ Int16 newHeight;
+ UInt16 currentPos;
+ } fldHeightChanged;
+
+ struct fldChanged {
+ UInt16 fieldID;
+ struct FieldType *pField;
+ } fldChanged;
+
+ struct fldExit {
+ UInt16 fieldID;
+ struct FieldType *pField;
+ } fldExit;
+
+ struct lstEnter {
+ UInt16 listID;
+ struct ListType *pList;
+ Int16 selection;
+ } lstEnter;
+
+ struct lstExit {
+ UInt16 listID;
+ struct ListType *pList;
+ } lstExit;
+
+ struct lstSelect {
+ UInt16 listID;
+ struct ListType *pList;
+ Int16 selection;
+ } lstSelect;
+
+ struct tblEnter {
+ UInt16 tableID;
+ struct TableType *pTable;
+ Int16 row;
+ Int16 column;
+ } tblEnter;
+
+ struct tblExit {
+ UInt16 tableID;
+ struct TableType *pTable;
+ Int16 row;
+ Int16 column;
+ } tblExit;
+
+ struct tblSelect {
+ UInt16 tableID;
+ struct TableType *pTable;
+ Int16 row;
+ Int16 column;
+ } tblSelect;
+
+ struct frmLoad {
+ UInt16 formID;
+ } frmLoad;
+
+ struct frmOpen {
+ UInt16 formID;
+ } frmOpen;
+
+ struct frmGoto {
+ UInt16 formID;
+ UInt16 recordNum; // index of record that contain a match
+ UInt16 matchPos; // postion in record of the match.
+ UInt16 matchLen; // length of match.
+ UInt16 matchFieldNum; // field number string was found int
+ UInt32 matchCustom; // application specific info
+ } frmGoto;
+
+ struct frmClose {
+ UInt16 formID;
+ } frmClose;
+
+ struct frmUpdate {
+ UInt16 formID;
+ UInt16 updateCode; // Application specific
+ } frmUpdate;
+
+ struct frmTitleEnter {
+ UInt16 formID;
+ } frmTitleEnter;
+
+ struct frmTitleSelect {
+ UInt16 formID;
+ } frmTitleSelect;
+
+ struct attnIndicatorEnter {
+ UInt16 formID;
+ } attnIndicatorEnter;
+
+ struct attnIndicatorSelect {
+ UInt16 formID;
+ } attnIndicatorSelect;
+
+ struct daySelect {
+ struct DaySelectorType *pSelector;
+ Int16 selection;
+ Boolean useThisDate;
+ UInt8 reserved1;
+ } daySelect;
+
+ struct menu {
+ UInt16 itemID;
+ } menu;
+
+ struct popSelect {
+ UInt16 controlID;
+ struct ControlType *controlP;
+ UInt16 listID;
+ struct ListType *listP;
+ Int16 selection;
+ Int16 priorSelection;
+ } popSelect;
+
+ struct sclEnter {
+ UInt16 scrollBarID;
+ struct ScrollBarType *pScrollBar;
+ } sclEnter;
+
+ struct sclExit {
+ UInt16 scrollBarID;
+ struct ScrollBarType *pScrollBar;
+ Int16 value;
+ Int16 newValue;
+ } sclExit;
+
+ struct sclRepeat {
+ UInt16 scrollBarID;
+ struct ScrollBarType *pScrollBar;
+ Int16 value;
+ Int16 newValue;
+ Int32 time;
+ } sclRepeat;
+
+ struct menuCmdBarOpen {
+ Boolean preventFieldButtons; // set to stop the field from automatically adding cut/copy/paste
+ UInt8 reserved; // alignment padding
+ } menuCmdBarOpen;
+
+ struct menuOpen {
+ UInt16 menuRscID;
+ //struct MenuBarType *pMenu;
+ Int16 cause;
+ } menuOpen;
+
+ struct gadgetEnter {
+ UInt16 gadgetID; // must be same as gadgetMisc
+ struct FormGadgetType * gadgetP; // must be same as gadgetMisc
+ } gadgetEnter;
+
+ struct gadgetMisc {
+ UInt16 gadgetID; // must be same as gadgetEnter
+ struct FormGadgetType * gadgetP; // must be same as gadgetEnter
+ UInt16 selector;
+ void * dataP;
+ } gadgetMisc;
+
+ } data;
+
+} EventType;
+
+typedef EventType *EventPtr;
+
+// Evaluate to true if <eventP> is a pointer to a virtual character key-
+// down event. We assume that the caller has already determined the event
+// is a keydown. WARNING!!! This macro is only safe to use on Palm OS 3.5
+// or later. With earlier versions of the OS, use TxtGlueCharIsVirtual()
+// in PalmOSGlue.lib
+#define EvtKeydownIsVirtual(eventP) (((eventP)->data.keyDown.modifiers & virtualKeyMask) != 0)
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//---------------------------------------------------------------------
+// Event Functions
+//---------------------------------------------------------------------
+
+void EvtAddEventToQueue (const EventType *event)
+ SYS_TRAP(sysTrapEvtAddEventToQueue);
+
+void EvtAddUniqueEventToQueue(const EventType *eventP, UInt32 id,
+ Boolean inPlace)
+ SYS_TRAP(sysTrapEvtAddUniqueEventToQueue);
+
+void EvtCopyEvent (const EventType *source, EventType *dest)
+ SYS_TRAP(sysTrapEvtCopyEvent);
+
+void EvtGetEvent (EventType *event, Int32 timeout)
+ SYS_TRAP(sysTrapEvtGetEvent);
+
+Boolean EvtEventAvail (void)
+ SYS_TRAP(sysTrapEvtEventAvail);
+
+void EvtGetPen(Int16 *pScreenX, Int16 *pScreenY, Boolean *pPenDown)
+ SYS_TRAP(sysTrapEvtGetPen);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif // __EVENT_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/UI/FatalAlert.h b/SrcShared/Palm/Platform/Incs/Core/UI/FatalAlert.h
new file mode 100644
index 0000000..d550c5c
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/UI/FatalAlert.h
@@ -0,0 +1,43 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: FatalAlert.h
+ *
+ * Description:
+ * This file defines the system Fatal Alert support.
+ *
+ * History:
+ * September 12, 1994 Created by Art Lamb
+ *
+ *****************************************************************************/
+
+#ifndef __FATALALERT_H__
+#define __FATALALERT_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+// Value returned by SysFatalAlert
+#define fatalReset 0
+#define fatalEnterDebugger 1
+#define fatalDoNothing 0xFFFFU
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+UInt16 SysFatalAlert (const Char *msg)
+ SYS_TRAP(sysTrapSysFatalAlert);
+
+void SysFatalAlertInit (void)
+ SYS_TRAP(sysTrapSysFatalAlertInit);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif // __FATALALERT_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/UI/Field.h b/SrcShared/Palm/Platform/Incs/Core/UI/Field.h
new file mode 100644
index 0000000..c31084c
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/UI/Field.h
@@ -0,0 +1,275 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Field.h
+ *
+ * Description:
+ * This file defines field structures and routines.
+ *
+ * History:
+ * August 29, 1994 Created by Art Lamb
+ *
+ *****************************************************************************/
+
+#ifndef __FIELD_H__
+#define __FIELD_H__
+
+#include <PalmTypes.h>
+
+#include <Font.h>
+#include <Event.h>
+#include <Window.h>
+
+#define maxFieldTextLen 0x7fff
+
+// Maximun number of line the a dynamicly sizing field will expand to.
+#define maxFieldLines 11
+
+
+// kind alignment values
+enum justifications {leftAlign, centerAlign, rightAlign};
+typedef enum justifications JustificationType;
+
+
+#define undoBufferSize 100
+
+typedef enum { undoNone, undoTyping, undoBackspace, undoDelete,
+ undoPaste, undoCut, undoInput } UndoMode;
+
+typedef struct {
+ UndoMode mode;
+ UInt8 reserved;
+ UInt16 start;
+ UInt16 end;
+ UInt16 bufferLen;
+ Char *buffer;
+ } FieldUndoType;
+
+
+typedef struct {
+ UInt16 usable :1; // Set if part of ui
+ UInt16 visible :1; // Set if drawn, used internally
+ UInt16 editable :1; // Set if editable
+ UInt16 singleLine :1; // Set if only a single line is displayed
+ UInt16 hasFocus :1; // Set if the field has the focus
+ UInt16 dynamicSize :1; // Set if height expands as text is entered
+ UInt16 insPtVisible :1; // Set if the ins pt is scolled into view
+ UInt16 dirty :1; // Set if user modified
+ UInt16 underlined :2; // text underlined mode
+ UInt16 justification :2; // text alignment
+ UInt16 autoShift :1; // Set if auto case shift
+ UInt16 hasScrollBar :1; // Set if the field has a scroll bar
+ UInt16 numeric :1; // Set if numeric, digits and secimal separator only
+} FieldAttrType;
+
+typedef FieldAttrType *FieldAttrPtr;
+
+typedef struct {
+ UInt16 start; // position in text string of first char.
+ UInt16 length; // number of character in the line
+} LineInfoType;
+
+typedef LineInfoType *LineInfoPtr;
+
+
+typedef struct FieldType {
+ UInt16 id;
+ RectangleType rect;
+ FieldAttrType attr;
+ Char *text; // pointer to the start of text string
+ MemHandle textHandle; // block the contains the text string
+ LineInfoPtr lines;
+ UInt16 textLen;
+ UInt16 textBlockSize;
+ UInt16 maxChars;
+ UInt16 selFirstPos;
+ UInt16 selLastPos;
+ UInt16 insPtXPos;
+ UInt16 insPtYPos;
+ FontID fontID;
+ UInt8 reserved;
+} FieldType;
+
+
+typedef FieldType *FieldPtr; // deprecated, use FieldType *
+
+
+//---------------------------------------------------------------------
+// Field Functions
+//---------------------------------------------------------------------
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void FldCopy (const FieldType *fldP)
+ SYS_TRAP(sysTrapFldCopy);
+
+extern void FldCut (FieldType *fldP)
+ SYS_TRAP(sysTrapFldCut);
+
+extern void FldDrawField (FieldType *fldP)
+ SYS_TRAP(sysTrapFldDrawField);
+
+extern void FldEraseField (FieldType *fldP)
+ SYS_TRAP(sysTrapFldEraseField);
+
+extern void FldFreeMemory (FieldType *fldP)
+ SYS_TRAP(sysTrapFldFreeMemory);
+
+extern void FldGetBounds (const FieldType *fldP, RectanglePtr rect)
+ SYS_TRAP(sysTrapFldGetBounds);
+
+extern FontID FldGetFont (const FieldType *fldP)
+ SYS_TRAP(sysTrapFldGetFont);
+
+extern void FldGetSelection (const FieldType *fldP, UInt16 *startPosition, UInt16 *endPosition)
+ SYS_TRAP(sysTrapFldGetSelection);
+
+extern MemHandle FldGetTextHandle (const FieldType *fldP)
+ SYS_TRAP(sysTrapFldGetTextHandle);
+
+extern Char * FldGetTextPtr (const FieldType *fldP)
+ SYS_TRAP(sysTrapFldGetTextPtr);
+
+extern Boolean FldHandleEvent (FieldType *fldP, EventType *eventP)
+ SYS_TRAP(sysTrapFldHandleEvent);
+
+extern void FldPaste (FieldType *fldP)
+ SYS_TRAP(sysTrapFldPaste);
+
+extern void FldRecalculateField (FieldType *fldP, Boolean redraw)
+ SYS_TRAP(sysTrapFldRecalculateField);
+
+extern void FldSetBounds (FieldType *fldP, const RectangleType *rP)
+ SYS_TRAP(sysTrapFldSetBounds);
+
+extern void FldSetFont (FieldType *fldP, FontID fontID)
+ SYS_TRAP(sysTrapFldSetFont);
+
+extern void FldSetText (FieldType *fldP, MemHandle textHandle, UInt16 offset, UInt16 size)
+ SYS_TRAP(sysTrapFldSetText);
+
+extern void FldSetTextHandle (FieldType *fldP, MemHandle textHandle)
+ SYS_TRAP(sysTrapFldSetTextHandle);
+
+extern void FldSetTextPtr (FieldType *fldP, Char *textP)
+ SYS_TRAP(sysTrapFldSetTextPtr);
+
+extern void FldSetUsable (FieldType *fldP, Boolean usable)
+ SYS_TRAP(sysTrapFldSetUsable);
+
+extern void FldSetSelection (FieldType *fldP, UInt16 startPosition, UInt16 endPosition)
+ SYS_TRAP(sysTrapFldSetSelection);
+
+extern void FldGrabFocus (FieldType *fldP)
+ SYS_TRAP(sysTrapFldGrabFocus);
+
+extern void FldReleaseFocus (FieldType *fldP)
+ SYS_TRAP(sysTrapFldReleaseFocus);
+
+extern UInt16 FldGetInsPtPosition (const FieldType *fldP)
+ SYS_TRAP(sysTrapFldGetInsPtPosition);
+
+extern void FldSetInsPtPosition (FieldType *fldP, UInt16 pos)
+ SYS_TRAP(sysTrapFldSetInsPtPosition);
+
+extern void FldSetInsertionPoint (FieldType *fldP, UInt16 pos)
+ SYS_TRAP(sysTrapFldSetInsertionPoint);
+
+extern UInt16 FldGetScrollPosition (const FieldType *fldP)
+ SYS_TRAP(sysTrapFldGetScrollPosition);
+
+extern void FldSetScrollPosition (FieldType *fldP, UInt16 pos)
+ SYS_TRAP(sysTrapFldSetScrollPosition);
+
+extern void FldGetScrollValues (const FieldType *fldP, UInt16 *scrollPosP,
+ UInt16 *textHeightP, UInt16 *fieldHeightP)
+ SYS_TRAP(sysTrapFldGetScrollValues);
+
+extern UInt16 FldGetTextLength (const FieldType *fldP)
+ SYS_TRAP(sysTrapFldGetTextLength);
+
+extern void FldScrollField (FieldType *fldP, UInt16 linesToScroll, WinDirectionType direction)
+ SYS_TRAP(sysTrapFldScrollField);
+
+extern Boolean FldScrollable (const FieldType *fldP, WinDirectionType direction)
+ SYS_TRAP(sysTrapFldScrollable);
+
+extern UInt16 FldGetVisibleLines (const FieldType *fldP)
+ SYS_TRAP(sysTrapFldGetVisibleLines);
+
+extern UInt16 FldGetTextHeight (const FieldType *fldP)
+ SYS_TRAP(sysTrapFldGetTextHeight);
+
+extern UInt16 FldCalcFieldHeight (const Char *chars, UInt16 maxWidth)
+ SYS_TRAP(sysTrapFldCalcFieldHeight);
+
+extern UInt16 FldWordWrap (const Char *chars, Int16 maxWidth)
+ SYS_TRAP(sysTrapFldWordWrap);
+
+extern void FldCompactText (FieldType *fldP)
+ SYS_TRAP(sysTrapFldCompactText);
+
+extern Boolean FldDirty (const FieldType *fldP)
+ SYS_TRAP(sysTrapFldDirty);
+
+extern void FldSetDirty (FieldType *fldP, Boolean dirty)
+ SYS_TRAP(sysTrapFldSetDirty);
+
+extern UInt16 FldGetMaxChars (const FieldType *fldP)
+ SYS_TRAP(sysTrapFldGetMaxChars);
+
+extern void FldSetMaxChars (FieldType *fldP, UInt16 maxChars)
+ SYS_TRAP(sysTrapFldSetMaxChars);
+
+extern Boolean FldInsert (FieldType *fldP, const Char *insertChars, UInt16 insertLen)
+ SYS_TRAP(sysTrapFldInsert);
+
+extern void FldDelete (FieldType *fldP, UInt16 start, UInt16 end)
+ SYS_TRAP(sysTrapFldDelete);
+
+extern void FldUndo (FieldType *fldP)
+ SYS_TRAP(sysTrapFldUndo);
+
+extern UInt16 FldGetTextAllocatedSize (const FieldType *fldP)
+ SYS_TRAP(sysTrapFldGetTextAllocatedSize);
+
+extern void FldSetTextAllocatedSize (FieldType *fldP, UInt16 allocatedSize)
+ SYS_TRAP(sysTrapFldSetTextAllocatedSize);
+
+extern void FldGetAttributes (const FieldType *fldP, FieldAttrPtr attrP)
+ SYS_TRAP(sysTrapFldGetAttributes);
+
+extern void FldSetAttributes (FieldType *fldP, const FieldAttrType *attrP)
+ SYS_TRAP(sysTrapFldSetAttributes);
+
+extern void FldSendChangeNotification (const FieldType *fldP)
+ SYS_TRAP(sysTrapFldSendChangeNotification);
+
+extern void FldSendHeightChangeNotification (const FieldType *fldP, UInt16 pos, Int16 numLines)
+ SYS_TRAP(sysTrapFldSendHeightChangeNotification);
+
+extern Boolean FldMakeFullyVisible (FieldType *fldP)
+ SYS_TRAP(sysTrapFldMakeFullyVisible);
+
+extern UInt16 FldGetNumberOfBlankLines (const FieldType *fldP)
+ SYS_TRAP(sysTrapFldGetNumberOfBlankLines);
+
+extern FieldType *FldNewField (void **formPP, UInt16 id,
+ Coord x, Coord y, Coord width, Coord height,
+ FontID font, UInt32 maxChars, Boolean editable, Boolean underlined,
+ Boolean singleLine, Boolean dynamicSize, JustificationType justification,
+ Boolean autoShift, Boolean hasScrollBar, Boolean numeric)
+ SYS_TRAP(sysTrapFldNewField);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif // __FIELD_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/UI/Find.h b/SrcShared/Palm/Platform/Incs/Core/UI/Find.h
new file mode 100644
index 0000000..5e3c891
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/UI/Find.h
@@ -0,0 +1,124 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Find.h
+ *
+ * Description:
+ * This file defines field structures and routines.
+ *
+ * History:
+ * August 29, 1994 Created by Art Lamb
+ *
+ *****************************************************************************/
+
+#ifndef __FIND_H__
+#define __FIND_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+#include <DataMgr.h>
+#include <Rect.h>
+
+#define maxFinds 9
+#define maxFindStrLen 16
+
+typedef struct {
+ UInt16 appCardNo; // card number of the application
+ LocalID appDbID; // LocalID of the application
+ Boolean foundInCaller; // true if found in app that called Find
+ UInt8 reserved;
+
+ UInt16 dbCardNo; // card number of the database record was found in
+ LocalID dbID; // LocalID of the database record was found in
+ UInt16 recordNum; // index of record that contain a match
+ UInt16 matchPos; // postion in record of the match.
+ UInt16 matchFieldNum; // field number
+ UInt32 matchCustom; // app specific data
+ } FindMatchType;
+
+typedef FindMatchType *FindMatchPtr;
+
+typedef struct {
+
+ // These fields are used by the applications.
+ UInt16 dbAccesMode; // read mode and maybe show secret
+ UInt16 recordNum; // index of last record that contained a match
+ Boolean more; // true of more matches to display
+ Char strAsTyped [maxFindStrLen+1]; // search string as entered
+ Char strToFind [maxFindStrLen+1]; // search string is lower case
+ UInt8 reserved1;
+
+
+ // The lineNumber field can be modified by the app. The continuation field can
+ // be tested by the app. All other fields are private to the Find routine and
+ // should NOT be accessed by applications.
+ UInt16 numMatches; // # of matches
+ UInt16 lineNumber; // next line in the results tabel
+ Boolean continuation; // true if contining search of same app
+ Boolean searchedCaller; // true after we've searched app that initiated the find
+
+ LocalID callerAppDbID; // dbID of app that initiated search
+ UInt16 callerAppCardNo; // cardNo of app that initiated search
+
+ LocalID appDbID; // dbID of app that we're currently searching
+ UInt16 appCardNo; // card number of app that we're currently searching
+
+ Boolean newSearch; // true for first search
+ UInt8 reserved2;
+ DmSearchStateType searchState; // search state
+ FindMatchType match [maxFinds];
+} FindParamsType;
+
+typedef FindParamsType *FindParamsPtr;
+
+
+// Param Block passsed with the sysAppLaunchCmdGoto Command
+typedef struct {
+ Int16 searchStrLen; // length of search string.
+ UInt16 dbCardNo; // card number of the database
+ LocalID dbID; // LocalID of the database
+ UInt16 recordNum; // index of record that contain a match
+ UInt16 matchPos; // postion in record of the match.
+ UInt16 matchFieldNum; // field number string was found int
+ UInt32 matchCustom; // application specific info
+ } GoToParamsType;
+
+typedef GoToParamsType *GoToParamsPtr;
+
+
+//----------------------------------------------------------
+// Find Functions
+//----------------------------------------------------------
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void Find (GoToParamsPtr goToP)
+ SYS_TRAP(sysTrapFind);
+
+
+Boolean FindStrInStr (Char const *strToSearch, Char const *strToFind,
+ UInt16 *posP)
+ SYS_TRAP(sysTrapFindStrInStr);
+
+Boolean FindSaveMatch (FindParamsPtr findParams, UInt16 recordNum,
+ UInt16 pos, UInt16 fieldNum, UInt32 appCustom, UInt16 cardNo, LocalID dbID)
+ SYS_TRAP(sysTrapFindSaveMatch);
+
+void FindGetLineBounds (const FindParamsType *findParams, RectanglePtr r)
+ SYS_TRAP(sysTrapFindGetLineBounds);
+
+Boolean FindDrawHeader (FindParamsPtr findParams, Char const *title)
+ SYS_TRAP(sysTrapFindDrawHeader);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif //__FIND_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/UI/Form.h b/SrcShared/Palm/Platform/Incs/Core/UI/Form.h
new file mode 100644
index 0000000..0245029
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/UI/Form.h
@@ -0,0 +1,510 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Form.h
+ *
+ * Description:
+ * This file defines dialog box structures and routines.
+ *
+ * History:
+ * September 6, 1994 Created by Art Lamb
+ *
+ *****************************************************************************/
+
+#ifndef __FORM_H__
+#define __FORM_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+#include <Preferences.h>
+
+#include <Field.h>
+#include <Control.h>
+#include <List.h>
+#include <ScrollBar.h>
+#include <Table.h>
+
+#define noFocus 0xffff
+
+#define frmInvalidObjectId 0xffff
+#define frmNoSelectedControl 0xff
+
+// Update code send as part of a frmUpdate event.
+#define frmRedrawUpdateCode 0x8000
+
+// Magic button IDs used by FrmCustomResponseAlert callbacks
+#define frmResponseCreate 1974
+#define frmResponseQuit ((Int16) 0xBEEF)
+
+
+// Alert constants and structures
+enum alertTypes {
+ informationAlert,
+ confirmationAlert,
+ warningAlert,
+ errorAlert };
+typedef enum alertTypes AlertType;
+
+typedef struct {
+ UInt16 alertType;
+ UInt16 helpRscID;
+ UInt16 numButtons;
+ UInt16 defaultButton;
+} AlertTemplateType;
+
+
+// Types of object in a dialog box
+enum formObjects {
+ frmFieldObj,
+ frmControlObj,
+ frmListObj,
+ frmTableObj,
+ frmBitmapObj,
+ frmLineObj,
+ frmFrameObj,
+ frmRectangleObj,
+ frmLabelObj,
+ frmTitleObj,
+ frmPopupObj,
+ frmGraffitiStateObj,
+ frmGadgetObj,
+ frmScrollBarObj };
+typedef enum formObjects FormObjectKind;
+
+
+typedef struct {
+ UInt16 usable :1; // Set if part of ui
+ UInt16 reserved :15; // pad it out
+} FormObjAttrType;
+
+
+// Gadget support:
+#define formGadgetDrawCmd 0 // paramP is unspecified
+#define formGadgetEraseCmd 1 // paramP is unspecified
+#define formGadgetHandleEventCmd 2 // paramP is an EventType *for the relevant event.
+#define formGadgetDeleteCmd 3 // paramP is unspecified.
+
+
+typedef struct {
+ UInt16 usable :1; // Set if part of ui - "should be drawn"
+ UInt16 extended :1; // Set if the structure is an "Extended" gadget (i.e., the 'handler' field is present)
+ UInt16 visible :1; // Set if drawn - "has been drawn" or "must do work to erase"
+ UInt16 reserved :13; // pad it out
+} FormGadgetAttrType;
+
+struct FormType; // forward reference to FormType so we can declare the handler type:
+typedef Boolean (FormGadgetHandlerType) (struct FormGadgetType *gadgetP, UInt16 cmd, void *paramP);
+
+struct FormGadgetType {
+ UInt16 id;
+ FormGadgetAttrType attr;
+ RectangleType rect;
+ const void * data;
+ FormGadgetHandlerType *handler;
+};
+typedef struct FormGadgetType FormGadgetType;
+
+
+// All of the smaller form objects:
+
+typedef struct {
+ FormObjAttrType attr;
+ PointType pos;
+ UInt16 rscID;
+} FormBitmapType;
+
+
+typedef struct {
+ FormObjAttrType attr;
+ PointType point1;
+ PointType point2;
+} FormLineType;
+
+
+typedef struct {
+ UInt16 id;
+ FormObjAttrType attr;
+ RectangleType rect;
+ UInt16 frameType;
+} FormFrameType;
+
+
+typedef struct {
+ FormObjAttrType attr;
+ RectangleType rect;
+} FormRectangleType;
+
+
+typedef struct {
+ UInt16 id;
+ PointType pos;
+ FormObjAttrType attr;
+ FontID fontID;
+ UInt8 reserved;
+ Char * text;
+} FormLabelType;
+
+
+typedef struct {
+ RectangleType rect;
+ Char * text;
+} FormTitleType;
+
+
+typedef struct {
+ UInt16 controlID;
+ UInt16 listID;
+} FormPopupType;
+
+
+typedef struct {
+ PointType pos;
+} FrmGraffitiStateType;
+
+
+typedef union {
+ void * ptr;
+ FieldType * field;
+ ControlType * control;
+ GraphicControlType * graphicControl;
+ SliderControlType * sliderControl;
+ ListType * list;
+ TableType * table;
+ FormBitmapType * bitmap;
+// FormLineType * line;
+// FormFrameType * frame;
+// FormRectangleType * rectangle;
+ FormLabelType * label;
+ FormTitleType * title;
+ FormPopupType * popup;
+ FrmGraffitiStateType * grfState;
+ FormGadgetType * gadget;
+ ScrollBarType * scrollBar;
+} FormObjectType;
+
+// typedef FormObjectType *FormObjectPtr;
+
+
+typedef struct {
+ FormObjectKind objectType;
+ UInt8 reserved;
+ FormObjectType object;
+} FormObjListType;
+
+
+typedef struct {
+ UInt16 usable :1; // Set if part of ui
+ UInt16 enabled :1; // Set if interactable (not grayed out)
+ UInt16 visible :1; // Set if drawn, used internally
+ UInt16 dirty :1; // Set if dialog has been modified
+ UInt16 saveBehind :1; // Set if bits behind form are save when form ids drawn
+ UInt16 graffitiShift :1; // Set if graffiti shift indicator is supported
+ UInt16 globalsAvailable:1; // Set by Palm OS if globals are available for the
+ // form event handler
+ UInt16 doingDialog :1; // FrmDoDialog is using for nested event loop
+ UInt16 exitDialog :1; // tells FrmDoDialog to bail out and stop using this form
+ UInt16 reserved :7; // pad to 16
+ UInt16 reserved2; // FormAttrType now explicitly 32-bits wide.
+} FormAttrType;
+
+
+typedef Boolean FormEventHandlerType (EventType *eventP);
+
+typedef FormEventHandlerType *FormEventHandlerPtr;
+
+struct FormType {
+ WindowType window;
+ UInt16 formId;
+ FormAttrType attr;
+ WinHandle bitsBehindForm;
+ FormEventHandlerType * handler;
+ UInt16 focus;
+ UInt16 defaultButton;
+ UInt16 helpRscId;
+ UInt16 menuRscId;
+ UInt16 numObjects;
+ FormObjListType * objects;
+};
+
+typedef struct FormType FormType;
+typedef FormType *FormPtr;
+
+
+// FormActiveStateType: this structure is passed to FrmActiveState for
+// saving and restoring active form/window state; this structure's
+// contents are abstracted because the contents will differ significantly
+// as PalmOS evolves
+// Added for PalmOS 3.0
+typedef struct FormActiveStateType {
+ UInt16 data[11];
+ } FormActiveStateType;
+
+
+// FrmCustomResponseAlert callback routine prototype
+typedef Boolean FormCheckResponseFuncType
+ (Int16 button, Char * attempt);
+
+typedef FormCheckResponseFuncType *FormCheckResponseFuncPtr;
+
+
+//-----------------------------------------------
+// Macros
+//-----------------------------------------------
+
+#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL
+#define ECFrmValidatePtr(formP) FrmValidatePtr(formP)
+#else
+#define ECFrmValidatePtr(formP)
+#endif
+
+//--------------------------------------------------------------------
+//
+// Form Function
+//
+//--------------------------------------------------------------------
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern FormType * FrmInitForm (UInt16 rscID)
+ SYS_TRAP(sysTrapFrmInitForm);
+
+extern void FrmDeleteForm (FormType *formP)
+ SYS_TRAP(sysTrapFrmDeleteForm);
+
+extern void FrmDrawForm (FormType *formP)
+ SYS_TRAP(sysTrapFrmDrawForm);
+
+extern void FrmEraseForm (FormType *formP)
+ SYS_TRAP(sysTrapFrmEraseForm);
+
+extern FormType * FrmGetActiveForm (void)
+ SYS_TRAP(sysTrapFrmGetActiveForm);
+
+extern void FrmSetActiveForm (FormType *formP)
+ SYS_TRAP(sysTrapFrmSetActiveForm);
+
+extern UInt16 FrmGetActiveFormID (void)
+ SYS_TRAP(sysTrapFrmGetActiveFormID);
+
+extern Boolean FrmGetUserModifiedState (const FormType *formP)
+ SYS_TRAP(sysTrapFrmGetUserModifiedState);
+
+extern void FrmSetNotUserModified (FormType *formP)
+ SYS_TRAP(sysTrapFrmSetNotUserModified);
+
+extern UInt16 FrmGetFocus (const FormType *formP)
+ SYS_TRAP(sysTrapFrmGetFocus);
+
+extern void FrmSetFocus (FormType *formP, UInt16 fieldIndex)
+ SYS_TRAP(sysTrapFrmSetFocus);
+
+extern Boolean FrmHandleEvent (FormType *formP, EventType *eventP)
+ SYS_TRAP(sysTrapFrmHandleEvent);
+
+extern void FrmGetFormBounds (const FormType *formP, RectangleType *rP)
+ SYS_TRAP(sysTrapFrmGetFormBounds);
+
+extern WinHandle FrmGetWindowHandle (const FormType *formP)
+ SYS_TRAP(sysTrapFrmGetWindowHandle);
+
+extern UInt16 FrmGetFormId (const FormType *formP)
+ SYS_TRAP(sysTrapFrmGetFormId);
+
+extern FormType *FrmGetFormPtr (UInt16 formId)
+ SYS_TRAP(sysTrapFrmGetFormPtr);
+
+extern FormType *FrmGetFirstForm (void)
+ SYS_TRAP(sysTrapFrmGetFirstForm);
+
+extern UInt16 FrmGetNumberOfObjects (const FormType *formP)
+ SYS_TRAP(sysTrapFrmGetNumberOfObjects);
+
+extern UInt16 FrmGetObjectIndex (const FormType *formP, UInt16 objID)
+ SYS_TRAP(sysTrapFrmGetObjectIndex);
+
+extern UInt16 FrmGetObjectId (const FormType *formP, UInt16 objIndex)
+ SYS_TRAP(sysTrapFrmGetObjectId);
+
+extern FormObjectKind FrmGetObjectType (const FormType *formP, UInt16 objIndex)
+ SYS_TRAP(sysTrapFrmGetObjectType);
+
+extern void *FrmGetObjectPtr (const FormType *formP, UInt16 objIndex)
+ SYS_TRAP(sysTrapFrmGetObjectPtr);
+
+extern void FrmGetObjectBounds (const FormType *formP, UInt16 objIndex,
+ RectangleType *rP)
+ SYS_TRAP(sysTrapFrmGetObjectBounds);
+
+extern void FrmHideObject (FormType *formP, UInt16 objIndex)
+ SYS_TRAP(sysTrapFrmHideObject);
+
+extern void FrmShowObject (FormType *formP, UInt16 objIndex)
+ SYS_TRAP(sysTrapFrmShowObject);
+
+extern void FrmGetObjectPosition (const FormType *formP, UInt16 objIndex,
+ Coord *x, Coord *y)
+ SYS_TRAP(sysTrapFrmGetObjectPosition);
+
+extern void FrmSetObjectPosition (FormType *formP, UInt16 objIndex,
+ Coord x, Coord y)
+ SYS_TRAP(sysTrapFrmSetObjectPosition);
+
+extern void FrmSetObjectBounds (FormType *formP, UInt16 objIndex,
+ const RectangleType *bounds)
+ SYS_TRAP(sysTrapFrmSetObjectBounds);
+
+extern Int16 FrmGetControlValue (const FormType *formP, UInt16 controlID)
+ SYS_TRAP(sysTrapFrmGetControlValue);
+
+extern void FrmSetControlValue (const FormType *formP, UInt16 controlID,
+ Int16 newValue)
+ SYS_TRAP(sysTrapFrmSetControlValue);
+
+extern UInt16 FrmGetControlGroupSelection (const FormType *formP,
+ UInt8 groupNum)
+ SYS_TRAP(sysTrapFrmGetControlGroupSelection);
+
+extern void FrmSetControlGroupSelection (const FormType *formP,
+ UInt8 groupNum, UInt16 controlID)
+ SYS_TRAP(sysTrapFrmSetControlGroupSelection);
+
+extern void FrmCopyLabel (FormType *formP, UInt16 labelID,
+ const Char *newLabel)
+ SYS_TRAP(sysTrapFrmCopyLabel);
+
+extern const Char *FrmGetLabel (const FormType *formP, UInt16 labelID)
+ SYS_TRAP(sysTrapFrmGetLabel);
+
+extern void FrmSetCategoryLabel (const FormType *formP, UInt16 objIndex,
+ Char *newLabel)
+ SYS_TRAP(sysTrapFrmSetCategoryLabel);
+
+extern const Char *FrmGetTitle (const FormType *formP)
+ SYS_TRAP(sysTrapFrmGetTitle);
+
+extern void FrmSetTitle (FormType *formP, Char *newTitle)
+ SYS_TRAP(sysTrapFrmSetTitle);
+
+extern void FrmCopyTitle (FormType *formP, const Char *newTitle)
+ SYS_TRAP(sysTrapFrmCopyTitle);
+
+extern void *FrmGetGadgetData (const FormType *formP, UInt16 objIndex)
+ SYS_TRAP(sysTrapFrmGetGadgetData);
+
+extern void FrmSetGadgetData (FormType *formP, UInt16 objIndex,
+ const void *data)
+ SYS_TRAP(sysTrapFrmSetGadgetData);
+
+extern void FrmSetGadgetHandler (FormType *formP, UInt16 objIndex,
+ FormGadgetHandlerType *attrP)
+ SYS_TRAP(sysTrapFrmSetGadgetHandler);
+
+extern UInt16 FrmDoDialog (FormType *formP)
+ SYS_TRAP(sysTrapFrmDoDialog);
+
+extern UInt16 FrmAlert (UInt16 alertId)
+ SYS_TRAP(sysTrapFrmAlert);
+
+extern UInt16 FrmCustomAlert (UInt16 alertId, const Char *s1,
+ const Char *s2, const Char *s3)
+ SYS_TRAP(sysTrapFrmCustomAlert);
+
+extern void FrmHelp (UInt16 helpMsgId)
+ SYS_TRAP(sysTrapFrmHelp);
+
+extern void FrmUpdateScrollers (FormType *formP, UInt16 upIndex,
+ UInt16 downIndex, Boolean scrollableUp, Boolean scrollableDown)
+ SYS_TRAP(sysTrapFrmUpdateScrollers);
+
+extern Boolean FrmVisible (const FormType *formP)
+ SYS_TRAP(sysTrapFrmVisible);
+
+extern void FrmSetEventHandler (FormType *formP, FormEventHandlerType *handler)
+ SYS_TRAP(sysTrapFrmSetEventHandler);
+
+extern Boolean FrmDispatchEvent (EventType *eventP)
+ SYS_TRAP(sysTrapFrmDispatchEvent);
+
+
+
+
+extern void FrmPopupForm (UInt16 formId)
+ SYS_TRAP(sysTrapFrmPopupForm);
+
+extern void FrmGotoForm (UInt16 formId)
+ SYS_TRAP(sysTrapFrmGotoForm);
+
+extern void FrmUpdateForm (UInt16 formId, UInt16 updateCode)
+ SYS_TRAP(sysTrapFrmUpdateForm);
+
+extern void FrmReturnToForm (UInt16 formId)
+ SYS_TRAP(sysTrapFrmReturnToForm);
+
+extern void FrmCloseAllForms (void)
+ SYS_TRAP(sysTrapFrmCloseAllForms);
+
+extern void FrmSaveAllForms (void)
+ SYS_TRAP(sysTrapFrmSaveAllForms);
+
+
+
+extern Boolean FrmPointInTitle (const FormType *formP, Coord x, Coord y)
+ SYS_TRAP(sysTrapFrmPointInTitle);
+
+extern void FrmSetMenu (FormType *formP, UInt16 menuRscID)
+ SYS_TRAP(sysTrapFrmSetMenu);
+
+extern Boolean FrmValidatePtr (const FormType *formP)
+ SYS_TRAP(sysTrapFrmValidatePtr);
+
+extern Err FrmAddSpaceForObject (FormType **formPP, MemPtr *objectPP,
+ FormObjectKind objectKind, UInt16 objectSize)
+ SYS_TRAP(sysTrapFrmAddSpaceForObject);
+
+extern Err FrmRemoveObject (FormType **formPP, UInt16 objIndex)
+ SYS_TRAP(sysTrapFrmRemoveObject);
+
+extern FormType *FrmNewForm (UInt16 formID, const Char *titleStrP,
+ Coord x, Coord y, Coord width, Coord height, Boolean modal,
+ UInt16 defaultButton, UInt16 helpRscID, UInt16 menuRscID)
+ SYS_TRAP(sysTrapFrmNewForm);
+
+extern FormLabelType *FrmNewLabel (FormType **formPP, UInt16 ID, const Char *textP,
+ Coord x, Coord y, FontID font)
+ SYS_TRAP(sysTrapFrmNewLabel);
+
+extern FormBitmapType *FrmNewBitmap (FormType **formPP, UInt16 ID,
+ UInt16 rscID, Coord x, Coord y)
+ SYS_TRAP(sysTrapFrmNewBitmap);
+
+extern FormGadgetType *FrmNewGadget (FormType **formPP, UInt16 id,
+ Coord x, Coord y, Coord width, Coord height)
+ SYS_TRAP(sysTrapFrmNewGadget);
+
+extern Err FrmActiveState (FormActiveStateType *stateP, Boolean save)
+ SYS_TRAP(sysTrapFrmActiveState);
+
+extern UInt16 FrmCustomResponseAlert (UInt16 alertId, const Char *s1, const Char *s2,
+ const Char *s3, Char *entryStringBuf, Int16 entryStringBufLength,
+ FormCheckResponseFuncPtr callback)
+ SYS_TRAP(sysTrapFrmCustomResponseAlert);
+
+extern FrmGraffitiStateType *FrmNewGsi (FormType **formPP, Coord x, Coord y)
+ SYS_TRAP(sysTrapFrmNewGsi);
+
+#define FrmSaveActiveState(stateP) FrmActiveState(stateP, true)
+#define FrmRestoreActiveState(stateP) FrmActiveState(stateP, false)
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif // __FORM_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/UI/InsPoint.h b/SrcShared/Palm/Platform/Incs/Core/UI/InsPoint.h
new file mode 100644
index 0000000..f29efc8
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/UI/InsPoint.h
@@ -0,0 +1,60 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: InsPoint.h
+ *
+ * Description:
+ * This file defines insertion point routines.
+ *
+ * History:
+ * Jan 25, 1995 Created by Art Lamb
+ *
+ *****************************************************************************/
+
+#ifndef __INSPOINT_H__
+#define __INSPOINT_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+// Blink interval is half of a second
+#define insPtBlinkInterval (sysTicksPerSecond / 2)
+#define insPtWidth 2
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void InsPtInitialize (void)
+ SYS_TRAP(sysTrapInsPtInitialize);
+
+extern void InsPtSetLocation (const Int16 x, const Int16 y)
+ SYS_TRAP(sysTrapInsPtSetLocation);
+
+extern void InsPtGetLocation (Int16 *x, Int16 *y)
+ SYS_TRAP(sysTrapInsPtGetLocation);
+
+extern void InsPtEnable (Boolean enableIt)
+ SYS_TRAP(sysTrapInsPtEnable);
+
+extern Boolean InsPtEnabled (void)
+ SYS_TRAP(sysTrapInsPtEnabled);
+
+extern void InsPtSetHeight (const Int16 height)
+ SYS_TRAP(sysTrapInsPtSetHeight);
+
+extern Int16 InsPtGetHeight (void)
+ SYS_TRAP(sysTrapInsPtGetHeight);
+
+extern void InsPtCheckBlink (void)
+ SYS_TRAP(sysTrapInsPtCheckBlink);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif //__INSPOINT_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/UI/List.h b/SrcShared/Palm/Platform/Incs/Core/UI/List.h
new file mode 100644
index 0000000..60a6e16
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/UI/List.h
@@ -0,0 +1,134 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: List.h
+ *
+ * Description:
+ * This file defines list structures and routines.
+ *
+ * History:
+ * November 3, 1994 Created by Roger Flores
+ * Name Date Description
+ * ---- ---- -----------
+ * bob 2/9/99 fixed const stuff
+ *
+ *****************************************************************************/
+
+#ifndef __LIST_H__
+#define __LIST_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+#include <Event.h>
+
+#define noListSelection -1
+
+//-------------------------------------------------------------------
+// List structures
+//-------------------------------------------------------------------
+
+typedef struct {
+ UInt16 usable :1; // set if part of ui
+ UInt16 enabled :1; // set if interactable (not grayed out)
+ UInt16 visible :1; // set if drawn
+ UInt16 poppedUp :1; // set if choices displayed in popup win.
+ UInt16 hasScrollBar :1; // set if the list has a scroll bar
+ UInt16 search :1; // set if incremental search is enabled
+ UInt16 reserved :2;
+} ListAttrType;
+
+
+// Load data callback routine prototype
+typedef void ListDrawDataFuncType (Int16 itemNum, RectangleType *bounds,
+ Char **itemsText);
+
+typedef ListDrawDataFuncType *ListDrawDataFuncPtr;
+
+
+typedef struct ListType {
+ UInt16 id;
+ RectangleType bounds;
+ ListAttrType attr;
+ Char * *itemsText;
+ Int16 numItems; // number of choices in the list
+ Int16 currentItem; // currently display choice
+ Int16 topItem; // top item visible when poped up
+ FontID font; // font used to draw list
+ UInt8 reserved;
+ WinHandle popupWin; // used only by popup lists
+ ListDrawDataFuncPtr drawItemsCallback; // 0 indicates no function
+} ListType;
+
+typedef ListType *ListPtr;
+
+
+//-------------------------------------------------------------------
+// List routines
+//-------------------------------------------------------------------
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void LstDrawList (ListType *listP)
+ SYS_TRAP(sysTrapLstDrawList);
+
+extern void LstEraseList (ListType *listP)
+ SYS_TRAP(sysTrapLstEraseList);
+
+extern Int16 LstGetSelection (const ListType *listP)
+ SYS_TRAP(sysTrapLstGetSelection);
+
+extern Char * LstGetSelectionText (const ListType *listP, Int16 itemNum)
+ SYS_TRAP(sysTrapLstGetSelectionText);
+
+extern Boolean LstHandleEvent (ListType *listP, const EventType *eventP)
+ SYS_TRAP(sysTrapLstHandleEvent);
+
+extern void LstSetHeight (ListType *listP, Int16 visibleItems)
+ SYS_TRAP(sysTrapLstSetHeight);
+
+extern void LstSetPosition (ListType *listP, Coord x, Coord y)
+ SYS_TRAP(sysTrapLstSetPosition);
+
+extern void LstSetSelection (ListType *listP, Int16 itemNum)
+ SYS_TRAP(sysTrapLstSetSelection);
+
+extern void LstSetListChoices (ListType *listP, Char **itemsText, Int16 numItems)
+ SYS_TRAP(sysTrapLstSetListChoices);
+
+extern void LstSetDrawFunction (ListType *listP, ListDrawDataFuncPtr func)
+ SYS_TRAP(sysTrapLstSetDrawFunction);
+
+extern void LstSetTopItem (ListType *listP, Int16 itemNum)
+ SYS_TRAP(sysTrapLstSetTopItem);
+
+extern void LstMakeItemVisible (ListType *listP, Int16 itemNum)
+ SYS_TRAP(sysTrapLstMakeItemVisible);
+
+extern Int16 LstGetNumberOfItems (const ListType *listP)
+ SYS_TRAP(sysTrapLstGetNumberOfItems);
+
+extern Int16 LstPopupList (ListType *listP)
+ SYS_TRAP(sysTrapLstPopupList);
+
+extern Boolean LstScrollList(ListType *listP, WinDirectionType direction, Int16 itemCount)
+ SYS_TRAP(sysTrapLstScrollList);
+
+extern Int16 LstGetVisibleItems (const ListType *listP)
+ SYS_TRAP(sysTrapLstGetVisibleItems);
+
+extern Err LstNewList (void **formPP, UInt16 id,
+ Coord x, Coord y, Coord width, Coord height,
+ FontID font, Int16 visibleItems, Int16 triggerId)
+ SYS_TRAP(sysTrapLstNewList);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __LIST_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/UI/ScrollBar.h b/SrcShared/Palm/Platform/Incs/Core/UI/ScrollBar.h
new file mode 100644
index 0000000..a7163bb
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/UI/ScrollBar.h
@@ -0,0 +1,77 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: ScrollBar.h
+ *
+ * Description:
+ * This file defines scroll bar structures and routines.
+ *
+ * History:
+ * Feb 6, 1996 Created by Art Lamb
+ *
+ *****************************************************************************/
+
+#ifndef __SCROLLBAR_H__
+#define __SCROLLBAR_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+#include <Rect.h>
+#include <Event.h>
+
+typedef enum { sclUpArrow, sclDownArrow, sclUpPage, sclDownPage, sclCar }
+ ScrollBarRegionType;
+
+
+typedef struct {
+ UInt16 usable :1; // Set if part of ui
+ UInt16 visible :1; // Set if drawn, used internally
+ UInt16 hilighted :1; // Set if region is hilighted
+ UInt16 shown :1; // Set if drawn and maxValue > minValue
+ UInt16 activeRegion :4; // ScrollBarRegionType
+} ScrollBarAttrType;
+
+
+typedef struct ScrollBarType {
+ RectangleType bounds;
+ UInt16 id;
+ ScrollBarAttrType attr;
+ Int16 value;
+ Int16 minValue;
+ Int16 maxValue;
+ Int16 pageSize;
+ Int16 penPosInCar;
+ Int16 savePos;
+} ScrollBarType;
+
+typedef ScrollBarType *ScrollBarPtr;
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void SclGetScrollBar (const ScrollBarPtr bar, Int16 *valueP,
+ Int16 *minP, Int16 *maxP, Int16 *pageSizeP)
+ SYS_TRAP(sysTrapSclGetScrollBar);
+
+extern void SclSetScrollBar (const ScrollBarPtr bar, Int16 value,
+ const Int16 min, const Int16 max, const Int16 pageSize)
+ SYS_TRAP(sysTrapSclSetScrollBar);
+
+extern void SclDrawScrollBar (const ScrollBarPtr bar)
+ SYS_TRAP(sysTrapSclDrawScrollBar);
+
+extern Boolean SclHandleEvent (const ScrollBarPtr bar, const EventType *event)
+ SYS_TRAP(sysTrapSclHandleEvent);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif //__SCROLLBAR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/UI/Table.h b/SrcShared/Palm/Platform/Incs/Core/UI/Table.h
new file mode 100644
index 0000000..1c67ce8
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/UI/Table.h
@@ -0,0 +1,319 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Table.h
+ *
+ * Description:
+ * This file defines table structures and routines.
+ *
+ * History:
+ * September 1, 1994 Created by Art Lamb
+ *
+ *****************************************************************************/
+
+#ifndef __TABLE_H__
+#define __TABLE_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+#include <Field.h>
+
+//-------------------------------------------------------------------
+// Table structures
+//-------------------------------------------------------------------
+
+#define tableDefaultColumnSpacing 1
+#define tableNoteIndicatorWidth 7
+#define tableNoteIndicatorHeight 11
+#define tableMaxTextItemSize 255 // does not incude terminating null
+
+#define tblUnusableRow 0xffff
+
+// Display style of a table item
+//
+enum tableItemStyles { checkboxTableItem,
+ customTableItem,
+ dateTableItem,
+ labelTableItem,
+ numericTableItem,
+ popupTriggerTableItem,
+ textTableItem,
+ textWithNoteTableItem,
+ timeTableItem,
+ narrowTextTableItem
+ };
+typedef enum tableItemStyles TableItemStyleType;
+
+
+typedef struct {
+ TableItemStyleType itemType;
+ FontID fontID; // font for drawing text
+ Int16 intValue;
+ Char * ptr;
+} TableItemType;
+typedef TableItemType *TableItemPtr;
+
+
+// Draw item callback routine prototype, used only by customTableItem.
+typedef void TableDrawItemFuncType
+ (void *tableP, Int16 row, Int16 column, RectangleType *bounds);
+
+typedef TableDrawItemFuncType *TableDrawItemFuncPtr;
+
+
+// Load data callback routine prototype
+typedef Err TableLoadDataFuncType
+ (void *tableP, Int16 row, Int16 column, Boolean editable,
+ MemHandle * dataH, Int16 *dataOffset, Int16 *dataSize, FieldPtr fld);
+
+typedef TableLoadDataFuncType *TableLoadDataFuncPtr;
+
+
+// Save data callback routine prototype
+typedef Boolean TableSaveDataFuncType
+ (void *tableP, Int16 row, Int16 column);
+
+typedef TableSaveDataFuncType *TableSaveDataFuncPtr;
+
+typedef struct {
+ Coord width; // width in pixels
+ UInt16 reserved1 : 5;
+ UInt16 masked : 1; // if both row + column masked, draw only grey box
+ UInt16 editIndicator : 1;
+ UInt16 usable : 1;
+ UInt16 reserved2 : 8;
+ Coord spacing; // space after column
+ TableDrawItemFuncPtr drawCallback;
+ TableLoadDataFuncPtr loadDataCallback;
+ TableSaveDataFuncPtr saveDataCallback;
+
+} TableColumnAttrType;
+
+
+typedef struct {
+ UInt16 id;
+ Coord height; // row height in pixels
+ UInt32 data;
+
+ UInt16 reserved1 : 7;
+ UInt16 usable : 1;
+ UInt16 reserved2 : 4;
+ UInt16 masked : 1; // if both row + column masked, draw only grey box
+ UInt16 invalid : 1; // true if redraw needed
+ UInt16 staticHeight : 1; // Set if height does not expands as text is entered
+ UInt16 selectable : 1;
+
+ UInt16 reserved3;
+
+} TableRowAttrType;
+
+
+typedef struct {
+ UInt16 visible:1; // Set if drawn, used internally
+ UInt16 editable:1; // Set if editable
+ UInt16 editing:1; // Set if in edit mode
+ UInt16 selected:1; // Set if the current item is selected
+ UInt16 hasScrollBar:1; // Set if the table has a scroll bar
+ UInt16 reserved:11;
+} TableAttrType;
+
+
+typedef struct TableType {
+ UInt16 id;
+ RectangleType bounds;
+ TableAttrType attr;
+ Int16 numColumns;
+ Int16 numRows;
+ Int16 currentRow;
+ Int16 currentColumn;
+ Int16 topRow;
+ TableColumnAttrType * columnAttrs;
+ TableRowAttrType * rowAttrs;
+ TableItemPtr items;
+ FieldType currentField;
+} TableType;
+
+typedef TableType *TablePtr;
+
+
+//-------------------------------------------------------------------
+// Table routines
+//-------------------------------------------------------------------
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void TblDrawTable (TableType *tableP)
+ SYS_TRAP(sysTrapTblDrawTable);
+
+extern void TblRedrawTable (TableType *tableP)
+ SYS_TRAP(sysTrapTblRedrawTable);
+
+extern void TblEraseTable (TableType *tableP)
+ SYS_TRAP(sysTrapTblEraseTable);
+
+extern Boolean TblHandleEvent (TableType *tableP, EventType *event)
+ SYS_TRAP(sysTrapTblHandleEvent);
+
+extern void TblGetItemBounds (const TableType *tableP, Int16 row, Int16 column, RectangleType *rP)
+ SYS_TRAP(sysTrapTblGetItemBounds);
+
+extern void TblSelectItem (TableType *tableP, Int16 row, Int16 column)
+ SYS_TRAP(sysTrapTblSelectItem);
+
+extern Int16 TblGetItemInt (const TableType *tableP, Int16 row, Int16 column)
+ SYS_TRAP(sysTrapTblGetItemInt);
+
+extern void TblSetItemInt (TableType *tableP, Int16 row, Int16 column, Int16 value)
+ SYS_TRAP(sysTrapTblSetItemInt);
+
+extern void TblSetItemPtr (TableType *tableP, Int16 row, Int16 column, void *value)
+ SYS_TRAP(sysTrapTblSetItemPtr);
+
+extern void TblSetItemStyle (TableType *tableP, Int16 row, Int16 column, TableItemStyleType type)
+ SYS_TRAP(sysTrapTblSetItemStyle);
+
+extern void TblUnhighlightSelection (TableType *tableP)
+ SYS_TRAP(sysTrapTblUnhighlightSelection);
+
+extern Boolean TblRowUsable (const TableType *tableP, Int16 row)
+ SYS_TRAP(sysTrapTblRowUsable);
+
+extern void TblSetRowUsable (TableType *tableP, Int16 row, Boolean usable)
+ SYS_TRAP(sysTrapTblSetRowUsable);
+
+extern Int16 TblGetLastUsableRow (const TableType *tableP)
+ SYS_TRAP(sysTrapTblGetLastUsableRow);
+
+extern void TblSetColumnUsable (TableType *tableP, Int16 column, Boolean usable)
+ SYS_TRAP(sysTrapTblSetColumnUsable);
+
+extern void TblSetRowSelectable (TableType *tableP, Int16 row, Boolean selectable)
+ SYS_TRAP(sysTrapTblSetRowSelectable);
+
+extern Boolean TblRowSelectable (const TableType *tableP, Int16 row)
+ SYS_TRAP(sysTrapTblRowSelectable);
+
+extern Int16 TblGetNumberOfRows (const TableType *tableP)
+ SYS_TRAP(sysTrapTblGetNumberOfRows);
+
+extern void TblSetCustomDrawProcedure (TableType *tableP, Int16 column,
+ TableDrawItemFuncPtr drawCallback)
+ SYS_TRAP(sysTrapTblSetCustomDrawProcedure);
+
+extern void TblSetLoadDataProcedure (TableType *tableP, Int16 column,
+ TableLoadDataFuncPtr loadDataCallback)
+ SYS_TRAP(sysTrapTblSetLoadDataProcedure);
+
+extern void TblSetSaveDataProcedure (TableType *tableP, Int16 column,
+ TableSaveDataFuncPtr saveDataCallback)
+ SYS_TRAP(sysTrapTblSetSaveDataProcedure);
+
+extern void TblGetBounds (const TableType *tableP, RectangleType *rP)
+ SYS_TRAP(sysTrapTblGetBounds);
+
+extern void TblSetBounds (TableType *tableP, const RectangleType *rP)
+ SYS_TRAP(sysTrapTblSetBounds);
+
+extern Coord TblGetRowHeight (const TableType *tableP, Int16 row)
+ SYS_TRAP(sysTrapTblGetRowHeight);
+
+extern void TblSetRowHeight (TableType *tableP, Int16 row, Coord height)
+ SYS_TRAP(sysTrapTblSetRowHeight);
+
+extern Coord TblGetColumnWidth (const TableType *tableP, Int16 column)
+ SYS_TRAP(sysTrapTblGetColumnWidth);
+
+extern void TblSetColumnWidth (TableType *tableP, Int16 column, Coord width)
+ SYS_TRAP(sysTrapTblSetColumnWidth);
+
+extern Coord TblGetColumnSpacing (const TableType *tableP, Int16 column)
+ SYS_TRAP(sysTrapTblGetColumnSpacing);
+
+extern void TblSetColumnSpacing (TableType *tableP, Int16 column, Coord spacing)
+ SYS_TRAP(sysTrapTblSetColumnSpacing);
+
+extern Boolean TblFindRowID (const TableType *tableP, UInt16 id, Int16 *rowP)
+ SYS_TRAP(sysTrapTblFindRowID);
+
+extern Boolean TblFindRowData (const TableType *tableP, UInt32 data, Int16 *rowP)
+ SYS_TRAP(sysTrapTblFindRowData);
+
+extern UInt16 TblGetRowID (const TableType *tableP, Int16 row)
+ SYS_TRAP(sysTrapTblGetRowID);
+
+extern void TblSetRowID (TableType *tableP, Int16 row, UInt16 id)
+ SYS_TRAP(sysTrapTblSetRowID);
+
+extern UInt32 TblGetRowData (const TableType *tableP, Int16 row)
+ SYS_TRAP(sysTrapTblGetRowData);
+
+extern void TblSetRowData (TableType *tableP, Int16 row, UInt32 data)
+ SYS_TRAP(sysTrapTblSetRowData);
+
+extern Boolean TblRowInvalid (const TableType *tableP, Int16 row)
+ SYS_TRAP(sysTrapTblRowInvalid);
+
+extern void TblMarkRowInvalid (TableType *tableP, Int16 row)
+ SYS_TRAP(sysTrapTblMarkRowInvalid);
+
+extern void TblMarkTableInvalid (TableType *tableP)
+ SYS_TRAP(sysTrapTblMarkTableInvalid);
+
+extern Boolean TblGetSelection (const TableType *tableP, Int16 *rowP, Int16 *columnP)
+ SYS_TRAP(sysTrapTblGetSelection);
+
+extern void TblInsertRow (TableType *tableP, Int16 row)
+ SYS_TRAP(sysTrapTblInsertRow);
+
+extern void TblRemoveRow (TableType *tableP, Int16 row)
+ SYS_TRAP(sysTrapTblRemoveRow);
+
+extern void TblReleaseFocus (TableType *tableP)
+ SYS_TRAP(sysTrapTblReleaseFocus);
+
+extern Boolean TblEditing (const TableType *tableP)
+ SYS_TRAP(sysTrapTblEditing);
+
+extern FieldPtr TblGetCurrentField (const TableType *tableP)
+ SYS_TRAP(sysTrapTblGetCurrentField);
+
+extern void TblGrabFocus (TableType *tableP, Int16 row, Int16 column)
+ SYS_TRAP(sysTrapTblGrabFocus);
+
+extern void TblSetColumnEditIndicator (TableType *tableP, Int16 column, Boolean editIndicator)
+ SYS_TRAP(sysTrapTblSetColumnEditIndicator);
+
+extern void TblSetRowStaticHeight (TableType *tableP, Int16 row, Boolean staticHeight)
+ SYS_TRAP(sysTrapTblSetRowStaticHeight);
+
+extern void TblHasScrollBar (TableType *tableP, Boolean hasScrollBar)
+ SYS_TRAP(sysTrapTblHasScrollBar);
+
+extern FontID TblGetItemFont (const TableType *tableP, Int16 row, Int16 column)
+ SYS_TRAP(sysTrapTblGetItemFont);
+
+extern void TblSetItemFont (TableType *tableP, Int16 row, Int16 column, FontID fontID)
+ SYS_TRAP(sysTrapTblSetItemFont);
+
+extern void *TblGetItemPtr (const TableType *tableP, Int16 row, Int16 column)
+ SYS_TRAP(sysTrapTblGetItemPtr);
+
+extern Boolean TblRowMasked (const TableType *tableP, Int16 row)
+ SYS_TRAP(sysTrapTblRowMasked);
+
+extern void TblSetRowMasked (TableType *tableP, Int16 row, Boolean masked)
+ SYS_TRAP(sysTrapTblSetRowMasked);
+
+extern void TblSetColumnMasked (TableType *tableP, Int16 column, Boolean masked)
+ SYS_TRAP(sysTrapTblSetColumnMasked);
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif //__TABLE_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/UI/UIResources.h b/SrcShared/Palm/Platform/Incs/Core/UI/UIResources.h
new file mode 100644
index 0000000..56d2d93
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/UI/UIResources.h
@@ -0,0 +1,322 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: UIResources.h
+ *
+ * Description:
+ * This file defines UI resource types & ids.
+ *
+ * History:
+ * ??/??/?? ??? Created.
+ * 06/29/99 CS Added constantRscType & ResLoadConstant().
+ * 07/07/99 kwk Added fepFieldExtraBytesID, maxCategoryWidthID,
+ * extraStackSpaceID.
+ * 07/09/99 kwk Added silkscreenRscType & formRscType.
+ * 07/12/99 kwk Added sysFatalAlert.
+ * 07/18/99 kwk Added strListRscType, system string list resources.
+ * 08/08/99 kwk Added sysEditMenuJapAddWord/LookupWord.
+ * 09/07/99 kwk Added StrippedBase/GenericLaunchErrAlert
+ * 09/17/99 jmp Added a new NoteView form and menu to eliminate the goto
+ * top/bottom menu items and other extraneous UI elements
+ * that we no longer use in the built-in apps. We need to keep
+ * the old NoteView form and menu around for backwards
+ * compatibility.
+ * 12/10/99 kwk Deleted silkscreenRscType, use sysResTSilkscreen instead.
+ *
+ *****************************************************************************/
+
+#ifndef __UIRESOURCES_H__
+#define __UIRESOURCES_H__
+
+#include <CoreTraps.h>
+
+// System Default app icon (for apps missing a tAIB)
+#define defaultAppIconBitmap 10000
+#define defaultAppSmallIconBitmap 10001
+
+// System version string ID - this is hidden in
+// the SystemVersion.rsrc resource, because the 'system' resources
+// don't have ResEdit formats.
+#define systemVersionID 10000
+
+
+//------------------------------------------------------------
+// Resource Type Constants
+//------------------------------------------------------------
+
+#define strRsc 'tSTR'
+#define ainRsc 'tAIN'
+#define iconType 'tAIB'
+#define bitmapRsc 'Tbmp'
+#define bsBitmapRsc 'Tbsb'
+#define alertRscType 'Talt'
+#define kbdRscType 'tkbd'
+#define MenuRscType 'MBAR'
+#define fontRscType 'NFNT'
+#define verRsc 'tver'
+#define appInfoStringsRsc 'tAIS'
+#define fontIndexType 'fnti'
+#define midiRsc 'MIDI'
+#define colorTableRsc 'tclt'
+#define MenuCtlRsc 'tcbr'
+#define constantRscType 'tint'
+#define formRscType 'tFRM'
+#define strListRscType 'tSTL'
+#define wrdListRscType 'wrdl'
+#define defaultCategoryRscType 'taic'
+
+
+//------------------------------------------------------------
+// App Version Constants
+//------------------------------------------------------------
+
+#define appVersionID 1 // our apps use tver 1 resource
+#define appVersionAlternateID 1000 // CW Constructor uses tver 1000 resource
+ // so we'll look for ours first, then try theirs
+#define ainID 1000
+
+#define oemVersionID 10001 // Per-DB version provided by OEMs
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER kwk - should resource ids >= 10000 be in a private header file, so that
+#endif // PUBLIC_STUFF_STRIPPED
+// developers know they're not guaranteed to be around (or in the same format)?
+
+//------------------------------------------------------------
+// System Information Constants
+//------------------------------------------------------------
+
+#define fepFieldExtraBytesID 10000 // Extra bytes for expanded field if FEP is active.
+#define maxCategoryWidthID 10001 // Max pixel width for category trigger.
+#define extraStackSpaceID 10002 // Extra stack space for non-English locales
+
+//------------------------------------------------------------
+// System Alerts
+//------------------------------------------------------------
+
+#define SelectACategoryAlert 10000
+
+// This alert broke 1.0 applications and is now disabled until later.
+// It is redefined below (10015).
+//#define RemoveCategoryAlert 10001
+//#define RemoveCategoryRecordsButton 0
+//#define RemoveCategoryNameButton 1
+//#define RemoveCategoryCancelButton 2
+
+#define LowBatteryAlert 10002
+#define VeryLowBatteryAlert 10003
+#define UndoAlert 10004
+#define UndoCancelButton 1
+
+#define MergeCategoryAlert 10005
+#define MergeCategoryYes 0
+#define MergeCategoryNo 1
+
+#define privateRecordInfoAlert 10006
+
+#define ClipboardLimitAlert 10007
+
+#define CategoryExistsAlert 10012
+
+#define DeviceFullAlert 10013
+
+#define categoryAllUsedAlert 10014
+
+#define RemoveCategoryAlert 10015 // See alert 10001
+#define RemoveCategoryYes 0
+#define RemoveCategoryNo 1
+
+#define DemoUnitAlert 10016
+
+#define NoDataToBeamAlert 10017
+
+// New for PalmOS 3.1
+#define LowCradleChargedBatteryAlert 10018 // (Not present in Palm VII)
+#define VeryLowCradleChargedBatteryAlert 10019 // (Not present in Palm VII)
+
+// New for PalmOS 3.1 (Instant Karma only)
+#define CategoryTooLongAlert 10020 // (Not present in Palm VII)
+
+// New for PalmOS 3.2 - Alerts used by the ErrAlertCustom() call.
+#define ErrOKAlert 10021 // Error Alert with just an OK button
+#define ErrOKCancelAlert 10022 // Error Alert with an OK & Cancel button
+#define ErrCancelAlert 10023 // Error Alert with just Cancel button. Special case for antenna down alert.
+#define InfoOKAlert 10024 // Info alert with just an OK button
+#define InfoOKCancelAlert 10025 // Info alert with an OK & Cancel button
+#define InfoCancelAlert 10026 // Info alert with just a Cancel button
+#define PrivacyWarningAlert 10027 // Privacy warning for weblib
+#define ConfirmationOKAlert 10028 // Confirmation alert with just an OK button
+#define ConfirmationOKCancelAlert 10029 // Confirmation alert with an OK & Cancel button
+#define ConfirmationCancelAlert 10030 // Confirmation alert with just a Cancel button
+#define WarningOKAlert 10031 // Warning Alert with just an OK button
+#define WarningOKCancelAlert 10032 // Warning Alert with an OK & Cancel button
+#define WarningCancelAlert 10033 // Warning Alert with just Cancel button. Special case for antenna down alert.
+
+// New for PalmOS 3.5 - Launch error alerts
+#define StrippedBaseLaunchErrAlert 10034 // Launch error because of stripped base.
+#define GenericLaunchErrAlert 10035 // Generic launch error.
+
+// New for PalmOS 3.5 - Fatal Alert template
+#define sysFatalAlert 10100 // Template for fatal alert
+
+// New for PalmOS 3.5 - Alerts used by new security traps
+#define secInvalidPasswordAlert 13250
+#define secGotoInvalidRecordAlert 13251
+#define secShowPrivatePermanentPassEntryAlert 13261
+#define secShowMaskedPrivatePermanentPassEntryAlert 13265
+#define secHideRecordsAlert 13268
+#define secMaskRecordsAlert 13269
+#define secHideMaskRecordsOK 0
+#define secHideMaskRecordsCancel 1
+
+// command-bar bitmaps
+#define BarCutBitmap 10030
+#define BarCopyBitmap 10031
+#define BarPasteBitmap 10032
+#define BarUndoBitmap 10033
+#define BarBeamBitmap 10034
+#define BarSecureBitmap 10035
+#define BarDeleteBitmap 10036
+#define BarInfoBitmap 10037
+
+//Masking bitmaps
+#define SecLockBitmap 10050
+#define SecLockWidth 6
+#define SecLockHeight 8
+
+// System Menu Bar and Menus
+#define sysEditMenuID 10000
+#define sysEditMenuUndoCmd 10000
+#define sysEditMenuCutCmd 10001
+#define sysEditMenuCopyCmd 10002
+#define sysEditMenuPasteCmd 10003
+#define sysEditMenuSelectAllCmd 10004
+#define sysEditMenuSeparator 10005
+#define sysEditMenuKeyboardCmd 10006
+#define sysEditMenuGraffitiCmd 10007
+
+// Dynamically added to System Edit menu at runtime
+#define sysEditMenuJapAddWord 10100
+#define sysEditMenuJapLookupWord 10101
+
+// Note View Menu Bar and Menus
+#define noteMenuID 10200 // Old NoteView MenuBar
+#define noteUndoCmd sysEditMenuUndoCmd
+#define noteCutCmd sysEditMenuCutCmd
+#define noteCopyCmd sysEditMenuCopyCmd
+#define notePasteCmd sysEditMenuPasteCmd
+#define noteSelectAllCmd sysEditMenuSelectAllCmd
+#define noteSeparator sysEditMenuSeparator
+#define noteKeyboardCmd sysEditMenuKeyboardCmd
+#define noteGraffitiCmd sysEditMenuKeyboardCmd
+
+#define noteFontCmd 10200 // These are here for backwards
+#define noteTopOfPageCmd 10201 // compatibility. The built-in
+#define noteBottomOfPageCmd 10202 // apps no longer use them.
+#define notePhoneLookupCmd 10203
+
+#define newNoteMenuID 10300 // The Edit Menu for the new NoteView.
+#define newNoteFontCmd 10300 // MenuBar is the same as it is for
+#define newNotePhoneLookupCmd 10301 // the old NoteView MenuBar.
+
+// Note View (used by Datebook, To Do, Address, and Expense apps)
+#define NoteView 10900 // The new NoteView is "new" as of Palm OS 3.5.
+#define NewNoteView 10950 // Same as old NoteView, but points to newNoteMenuID and doesn't ref UI objects listed below.
+#define NoteField 10901
+#define NoteDoneButton 10902
+#define NoteSmallFontButton 10903 // Not in NewNoteView, use FontCmd instead.
+#define NoteLargeFontButton 10904 // Not in NewNoteView, use FontCmd instead.
+#define NoteDeleteButton 10905
+#define NoteUpButton 10906 // Not in NewNoteView, use scrollbars now.
+#define NoteDownButton 10907 // Not in NewNoteView, use scrollbars now.
+#define NoteScrollBar 10908
+#define NoteFontGroup 1
+#define noteViewMaxLength 4096 // not including null, tied to tFLD rsrc 10901
+
+
+// About Box - used by Datebook, Memo, Address, To Do, & others
+#define aboutDialog 11000
+#define aboutNameLabel 11001
+#define aboutVersionLabel 11002
+#define aboutErrorStr 11003
+
+
+// Category New Name Dialog (used for new and renamed categories)
+#define categoryNewNameDialog 11100
+#define categoryNewNameField 11103
+#define categoryNewNameOKButton 11104
+
+
+// Categories Edit Dialog
+#define CategoriesEditForm 10000
+#define CategoriesEditList 10002
+#define CategoriesEditOKButton 10003
+#define CategoriesEditNewButton 10004
+#define CategoriesEditRenameButton 10005
+#define CategoriesEditDeleteButton 10006
+
+
+// Graffiti Reference Dialog
+#define graffitiReferenceDialog 11200
+#define graffitiReferenceDoneButton 11202
+#define graffitiReferenceUpButton 11203
+#define graffitiReferenceDownButton 11204
+#define graffitiReferenceFirstBitmap 11205
+
+
+// System string resources
+#define daysOfWeekStrID 10000 // OBSOLETE - use daysOfWeekStdStrListID
+#define dayFullNamesStrID 10001 // OBSOLETE - use daysOfWeekLongStrListID
+#define monthNamesStrID 10002 // OBSOLETE - use monthNamesStdStrListID
+#define monthFullNamesStrID 10003 // OBSOLETE - use monthNamesLongStrListID
+#define categoryAllStrID 10004
+#define categoryEditStrID 10005
+#define menuCommandStrID 10006
+#define launcherBatteryStrID 10007
+#define systemNameStrID 10008
+#define phoneLookupTitleStrID 10009
+#define phoneLookupAddStrID 10010
+#define phoneLookupFormatStrID 10011
+
+// System string list resources
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER kwk - put in error string defines here (range)
+#endif // PUBLIC_STUFF_STRIPPED
+#define daysOfWeekShortStrListID 10200
+#define daysOfWeekStdStrListID 10201
+#define daysOfWeekLongStrListID 10202
+#define monthNamesShortStrListID 10203
+#define monthNamesStdStrListID 10204
+#define monthNamesLongStrListID 10205
+#define prefDateFormatsStrListID 10206
+#define prefDOWDateFormatsStrListID 10207
+
+
+//------------------------------------------------------------
+// Misc. resource routines
+//------------------------------------------------------------
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void * ResLoadForm (UInt16 rscID)
+ SYS_TRAP(sysTrapResLoadForm);
+
+void * ResLoadMenu (UInt16 rscID)
+ SYS_TRAP(sysTrapResLoadMenu);
+
+
+Char * ResLoadString (UInt16 rscID);
+
+UInt32 ResLoadConstant (UInt16 rscID)
+ SYS_TRAP(sysTrapResLoadConstant);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif // __UIRESOURCES_H__
diff --git a/SrcShared/Palm/Platform/Incs/Libraries/LibTraps.h b/SrcShared/Palm/Platform/Incs/Libraries/LibTraps.h
new file mode 100644
index 0000000..cd0b63b
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Libraries/LibTraps.h
@@ -0,0 +1,43 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: LibTraps.h
+ *
+ * Description:
+ * Palm OS Shared Library 'default' traps.
+ *
+ * History:
+ * 7/15/99 Created by Bob Ebert
+ * mm/dd/yy initials - brief revision comment
+ *
+ *****************************************************************************/
+
+ #ifndef __LIBTRAPS_H_
+ #define __LIBTRAPS_H_
+
+// Include elementary types
+#include <PalmTypes.h>
+
+#if CPU_TYPE == CPU_68K
+#include <M68KHwr.h>
+#endif
+
+//--------------------------------------------------------------------
+// Define Library Trap Numbers
+//--------------------------------------------------------------------
+// Library traps start here and go up by 1's
+#define sysLibTrapBase 0xA800
+typedef enum {
+ sysLibTrapName = sysLibTrapBase,
+ sysLibTrapOpen,
+ sysLibTrapClose,
+ sysLibTrapSleep,
+ sysLibTrapWake,
+ sysLibTrapCustom
+ } SysLibTrapNumber;
+
+
+
+#endif //__LIBTRAPS_H_
diff --git a/SrcShared/Palm/Platform/Incs/PalmTypes.h b/SrcShared/Palm/Platform/Incs/PalmTypes.h
new file mode 100644
index 0000000..4eac7ee
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/PalmTypes.h
@@ -0,0 +1,303 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: PalmTypes.h
+ *
+ * Description:
+ * Common header file for all Palm OS components.
+ * Contains elementary data types
+ *
+ * History:
+ * 10/19/94 Created by Ron Marianetti
+ * 04/24/97 SCL Changes for PalmOS 2.0 SDK
+ * 08/21/98 SCL Merged WChar & WCharPtr typedefs from Sumo.
+ * 07/13/99 bob Created from Common.h, lots of cleanup of types
+ *
+ *****************************************************************************/
+
+#ifndef __PALMTYPES_H__
+#define __PALMTYPES_H__
+
+
+/************************************************************
+ * Environment configuration
+ *************************************************************/
+// <BuildDefaults.h> must be included here, rather than in <PalmOS.h>
+// because they must be included for ALL builds.
+// Not every build includes <PalmOS.h>.
+
+// To override build options in a local component, include <BuildDefines.h>
+// first, then define switches as need, and THEN include <PalmTypes.h>.
+// This new mechanism supercedes the old "AppBuildRules.h" approach.
+// More details available in <BuildDefaults.h>.
+#include <BuildDefaults.h>
+
+
+/************************************************************
+ * Useful Macros
+ *************************************************************/
+#if defined(__GNUC__) && defined(__UNIX__) // used to be in <BuildRules.h>
+ // Ensure that structure elements are 16-bit aligned
+ // Other [host] development platforms may need this as well...
+#ifndef PUBLIC_STUFF_STRIPPED
+ // DOLATER - Do NOT remove without talking to TLW first!!
+#endif // PUBLIC_STUFF_STRIPPED
+ #pragma pack(2)
+#endif
+
+
+/********************************************************************
+ * Elementary data types
+ ********************************************************************/
+// Determine if we need to define our basic types or not
+#ifndef __TYPES__ // (Already defined in CW11)
+#ifndef __MACTYPES__ // (Already defined in CWPro3)
+#define __DEFINE_TYPES_ 1
+#endif
+#endif
+
+
+// Fixed size data types
+typedef signed char Int8;
+typedef signed short Int16;
+typedef signed long Int32;
+
+#if __DEFINE_TYPES_
+typedef unsigned char UInt8;
+typedef unsigned short UInt16;
+typedef unsigned long UInt32;
+#endif
+
+
+// Logical data types
+#if __DEFINE_TYPES_
+typedef unsigned char Boolean;
+#endif
+
+typedef char Char;
+typedef UInt16 WChar; // 'wide' int'l character type.
+
+typedef UInt16 Err;
+
+typedef UInt32 LocalID; // local (card relative) chunk ID
+
+typedef Int16 Coord; // screen/window coordinate
+
+
+typedef void * MemPtr; // global pointer
+typedef struct _opaque *MemHandle; // global handle
+
+
+#if __DEFINE_TYPES_
+typedef Int32 (*ProcPtr)();
+#endif
+
+
+/************************************************************
+ * Useful Macros
+ *************************************************************/
+#define min(a, b) (((a) < (b)) ? (a) : (b))
+#define max(a, b) (((a) > (b)) ? (a) : (b))
+
+#define OffsetOf(type, member) ((UInt32) &(((type *) 0)->member))
+
+
+
+
+/************************************************************
+ * Common constants
+ *************************************************************/
+#ifndef NULL
+#define NULL 0
+#endif // NULL
+
+#ifndef bitsInByte
+#define bitsInByte 8
+#endif // bitsInByte
+
+
+// Include the following typedefs if types.h wasn't read.
+#if __DEFINE_TYPES_
+ #ifdef __MWERKS__
+ #if !__option(bool)
+ #ifndef true
+ #define true 1
+ #endif
+ #ifndef false
+ #define false 0
+ #endif
+ #endif
+ #else
+ #ifndef __cplusplus
+ #ifndef true
+ enum {false, true};
+ #endif
+ #endif
+ #endif
+#endif /* __TYPES__ */
+
+
+
+
+/************************************************************
+ * Misc
+ *************************************************************/
+
+// Standardized infinite loop notation
+// Use in place of while(1), while(true), while(!0), ...
+#define loop_forever for (;;)
+
+
+// Include M68KHwr.h:
+#if EMULATION_LEVEL == EMULATION_NONE
+#if CPU_TYPE == CPU_68K
+#include <M68KHwr.h>
+//#pragma warn_no_side_effect on
+#endif
+#endif
+
+/************************************************************
+ * Metrowerks will substitute strlen and strcpy with inline
+ * 68K assembly code. Prevent this.
+ *************************************************************/
+
+#ifdef __MC68K__
+#define _NO_FAST_STRING_INLINES_ 0
+#endif
+
+
+/************************************************************
+ * Define whether or not we are direct linking, or going through
+ * traps.
+ *
+ * When eumulating we use directy linking.
+ * When running under native mode, we use traps EXCEPT for the
+ * modules that actually install the routines into the trap table.
+ * These modules will set the DIRECT_LINK define to 1
+ *************************************************************/
+#ifndef EMULATION_LEVEL
+#error "This should not happen!"
+#endif
+
+#ifndef USE_TRAPS
+ #if EMULATION_LEVEL == EMULATION_NONE
+ #define USE_TRAPS 1 // use Pilot traps
+ #else
+ #define USE_TRAPS 0 // direct link (Simulator)
+ #endif
+#endif
+
+
+/********************************************************************
+ * Palm OS System and Library trap macro definitions:
+ ********************************************************************/
+
+#define _DIRECT_CALL(table, vector)
+#define _DIRECT_CALL_WITH_SELECTOR(table, vector, selector)
+#define _DIRECT_CALL_WITH_16BIT_SELECTOR(table, vector, selector)
+
+#ifndef _STRUCTURE_PICTURES
+
+#define _SYSTEM_TABLE 15
+#define _HAL_TABLE 15
+
+#ifdef __GNUC__
+
+ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+
+ #ifndef _Str
+ #define _Str(X) #X
+ #endif
+
+ #define _OS_CALL(table, vector) \
+ __attribute__ ((__callseq__ ( \
+ "trap #" _Str(table) "; dc.w " _Str(vector))))
+
+ #define _OS_CALL_WITH_SELECTOR(table, vector, selector) \
+ __attribute__ ((__callseq__ ( \
+ "moveq #" _Str(selector) ",%%d2; " \
+ "trap #" _Str(table) "; dc.w " _Str(vector))))
+
+ #define _OS_CALL_WITH_16BIT_SELECTOR(table, vector, selector) \
+ __attribute__ ((__callseq__ ( \
+ "move.w #" _Str(selector) ",-(%%sp); " \
+ "trap #" _Str(table) "; dc.w " _Str(vector) "; " \
+ "addq.w #2,%%sp")))
+
+ #else
+
+ #define _OS_CALL(table, vector) __attribute__ ((systrap (vector)))
+ #define _OS_CALL_WITH_SELECTOR(table, vector, selector)
+ #define _OS_CALL_WITH_16BIT_SELECTOR(table, vector, selector)
+
+ #endif
+
+#elif defined (__MWERKS__) /* The equivalent in CodeWarrior syntax */
+
+ #define _OS_CALL(table, vector) \
+ = { 0x4E40 + table, vector }
+
+ #define _OS_CALL_WITH_SELECTOR(table, vector, selector) \
+ = { 0x7400 + selector, 0x4E40 + table, vector }
+
+ #define _OS_CALL_WITH_16BIT_SELECTOR(table, vector, selector) \
+ = { 0x3F3C, selector, 0x4E40 + table, vector, 0x544F }
+
+#endif
+
+#else
+
+#define _SYSTEM_TABLE "systrap"
+#define _HAL_TABLE "hal"
+
+#define _OS_CALL(table, vector) \
+ __SPIC__("simple", table, vector, 0)
+
+#define _OS_CALL_WITH_SELECTOR(table, vector, selector) \
+ __SPIC__("selector", table, vector, selector)
+
+#define _OS_CALL_WITH_16BIT_SELECTOR(table, vector, selector) \
+ __SPIC__("16bit_selector", table, vector, selector)
+
+#endif
+
+
+#if EMULATION_LEVEL != EMULATION_NONE
+
+#define _HAL_API(kind) _DIRECT##kind
+#define _SYSTEM_API(kind) _DIRECT##kind
+
+#elif USE_TRAPS == 0
+
+#define _HAL_API(kind) _OS##kind
+#define _SYSTEM_API(kind) _DIRECT##kind
+
+#else
+
+#define _HAL_API(kind) _OS##kind
+#define _SYSTEM_API(kind) _OS##kind
+
+#endif
+
+
+/************************************************************
+ * Palm specific TRAP instruction numbers
+ *************************************************************/
+#define sysDbgBreakpointTrapNum 0 // For soft breakpoints
+#define sysDbgTrapNum 8 // For compiled breakpoints
+#define sysDispatchTrapNum 15 // Trap dispatcher
+
+#ifndef PUBLIC_STUFF_STRIPPED
+/* DOLATER:jwm: @@@ move us to CoreTraps.h */
+#endif // PUBLIC_STUFF_STRIPPED
+
+#define SYS_TRAP(trapNum) _SYSTEM_API(_CALL)(_SYSTEM_TABLE, trapNum)
+
+#define ASM_SYS_TRAP(trapNum) \
+ DC.W m68kTrapInstr+sysDispatchTrapNum; \
+ DC.W trapNum
+
+
+#endif //__PALMTYPES_H__