Added older SDK releases

This commit is contained in:
root 2016-08-25 07:53:48 -03:00
parent 27e4984f52
commit 2ecf33a29c
682 changed files with 146758 additions and 0 deletions

184
sdk-1/LicenseAgreement.txt Normal file
View File

@ -0,0 +1,184 @@
IMPORTANT: Read Before Using The Accompanying Software
3COM PALM OS SOFTWARE DEVELOPMENT KIT
SOFTWARE LICENSE AGREEMENT
YOU SHOULD CAREFULLY READ THE FOLLOWING TERMS AND
CONDITIONS BEFORE USING THE ACCOMPANYING SOFTWARE,
THE USE OF WHICH IS LICENSED BY PALM COMPUTING, INC., A
SUBSIDIARY OF 3COM CORPORATION (COLLECTIVELY, "3COM"),
TO ITS CUSTOMERS FOR THEIR USE ONLY AS SET FORTH
BELOW. IF YOU DO NOT AGREE TO THE TERMS AND
CONDITIONS OF THIS AGREEMENT, DO NOT USE THE
SOFTWARE. USING ANY PART OF THE SOFTWARE INDICATES
THAT YOU ACCEPT THESE TERMS.
LICENSE: 3Com grants you a nonexclusive, royalty-free license to use the
accompanying software program(s) (the "Software") subject to the terms and
restrictions set forth in this License Agreement. Except as explicitly set forth
below, (i) you are not permitted to lease or rent (except under separate mutually
agreeable terms set forth in writing and signed by both parties), distribute or
sublicense the Software or to use the Software in a time-sharing arrangement or
in any other unauthorized manner; (ii) no license is granted to you in the human
readable code of the Software (source code); and (iii) this License Agreement
does not grant you any rights to patents, copyrights, trade secrets, trademarks, or
any other rights in respect to the Software.
The Software is licensed to be used on any personal computer and/or any Palm
Computing platform product, provided that the Software is used only in
connection with your development of products for use with Palm Computing
platform products. The Software contains certain sample source code in the
form of example applications (including several conduits) and code fragments
(both in the source code files and documentation provided hereunder), and may
include a tutorial application (collectively, "Sample Source Code"). You may
use the Sample Source Code internally to develop products for Palm Computing
platform products. You may distribute any such products built with the Sample
Source Code, provided that you include the following copyright notice within
your source code and in the location of your own copyright notice: "Portions
copyright c 1998 3Com Corporation or its subsidiaries. All rights reserved."
Notwithstanding anything else in this License Agreement, you may not distribute
the conduit development kit header files included as part of the Software to
anyone for any reason.
Except as described above, the Software and supporting documentation may be
copied only as essential for backup or archive purposes in support of your use of
the Software as permitted hereunder. You must reproduce and include all
copyright notices and any other proprietary rights notices appearing on the
Software on any copies that you make.
NO ASSIGNMENT; NO REVERSE ENGINEERING: You may transfer the
Software and this License Agreement to another party if the other party agrees in
writing to accept the terms and conditions of this License Agreement. If you
transfer the Software, you must at the same time either transfer all copies of the
Software as well as the supporting documentation to the same party or destroy
any such materials not transferred. Except as set forth above, you may not
transfer or assign the Software or your rights under this License Agreement.
Modification, reverse engineering, reverse compiling, or disassembly of the
Software is expressly prohibited. However, if you are a European Community
("EC") resident, information necessary to achieve interoperability of the
Software with other programs within the meaning of the EC Directive on the
Legal Protection of Computer Programs is available to you from 3Com upon
written request.
EXPORT RESTRICTIONS: You agree that you will not export or re-export
the Software or accompanying documentation (or any copies thereof) or any
products utilizing the Software or such documentation in violation of any
applicable laws or regulations of the United States or the country in which you
obtained them.
TRADE SECRETS; TITLE: You acknowledge and agree that the structure,
sequence and organization of the Software are the valuable trade secrets of
3Com and its suppliers. You agree to hold such trade secrets in confidence.
You further acknowledge and agree that ownership of, and title to, the Software
and all subsequent copies thereof regardless of the form or media are held by
3Com and its suppliers.
UNITED STATES GOVERNMENT LEGEND: The Software is commercial
in nature and developed solely at private expense. The Software is delivered as
"Commercial Computer Software" as defined in DFARS 252.227-7014 (June
1995) or as a commercial item as defined in FAR 2.101(a) and as such is
provided with only such rights as are provided in this License Agreement, which
is 3Com's standard commercial license for the Software. Technical data is
provided with limited rights only as provided in DFAR 252.227-7015 (Nov.
1995) or FAR 52.227-14 (June 1987), whichever is applicable.
TERM AND TERMINATION: This License Agreement is effective until
terminated. You may terminate it at any time by destroying the Software and
documentation together with all copies and merged portions in any form. It will
also terminate immediately if you fail to comply with any term or condition of
this License Agreement. Upon such termination you agree to destroy the
Software and documentation, together with all copies and merged portions in any
form.
GOVERNING LAW: This License Agreement shall be governed by the laws
of the State of California as such laws are applied to agreements entered into and
to be performed entirely within California between California residents and by
the laws of the United States. You agree that the United Nations Convention on
Contracts for the International Sale of Goods (1980) is hereby excluded in its
entirety from application to this License Agreement.
LIMITED WARRANTY: 3Com warrants the media containing the Software
for a period of ninety (90) days from the date of original purchase from 3Com or
its authorized retailer. Proof of date of purchase will be required. Any updates
to the Software provided by 3Com (which may be provided by 3Com at its sole
discretion) shall be governed by the terms of this License Agreement. The sole
obligation of 3Com with respect to this express warranty shall be (at the
discretion of 3Com) to refund the purchase price paid by you for the Software on
the defective media, or to replace the Software on new media. 3Com makes no
warranty or representation that its software products will meet your requirements
or will work in combination with any hardware or applications software products
provided by third parties, that the operation of the software products will be
uninterrupted or error free, or that all defects in the Software will be corrected.
OBTAINING WARRANTY SERVICE: You must contact 3Com's Palm
Computing, Inc. Customer Service within the applicable warranty period to
obtain warranty service authorization. Dated proof of original purchase will be
required. 3Com is not responsible for your products or parts received without
warranty service authorization.
WARRANTIES EXCLUSIVE: IF TH SOFTWARE MEDIA DOES NOT
OPERATE AS WARRANTED ABOVE, YOUR SOLE REMEDY FOR
BREACH OF THAT WARRANTY SHALL BE REPLACEMENT OF THE
SOFTWARE ON NEW MEDIA OR REFUND OF THE PURCHASE
PRICE PAID, AT THE OPTION OF 3COM AND DEPENDENT UPON
PRIOR AUTHORIZATION. TO THE FULL EXTENT ALLOWED BY
LAW, THE FOREGOING WARRANTIES AND REMEDIES ARE
EXCLUSIVE AND ARE IN LIEU OF ALL OTHER WARRANTIES,
TERMS, OR CONDITIONS, EXPRESS OR IMPLIED, EITHER IN FACT
OR BY OPERATION OF LAW, STATUTORY OR OTHERWISE,
INCLUDING WARRANTIES, TERMS, OR CONDITIONS OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
AND SATISFACTORY QUALITY. 3COM NEITHER ASSUMES NOR
AUTHORIZES ANY OTHER PERSON TO ASSUME FOR IT ANY
OTHER LIABILITY IN CONNECTION WITH THE SALE,
INSTALLATION, MAINTENANCE OR USE OF ITS PRODUCTS.
3Com shall not be liable under this warranty if its testing and examination
disclose that the alleged defect in the product does not exist or was caused by
your or any third person's misuse, neglect, improper installation or testing,
unauthorized attempts to repair or modify, or any other cause beyond the range
of the intended use, or by accident, fire, lightning, or other hazards or acts of
God. This warranty does not apply when the malfunction results from the use of
this product in conjunction with accessories, other products, or ancillary or
peripheral equipment and 3Com determines that there is no fault with the
product itself.
LIMITATION OF LIABILITY. TO THE FULL EXTENT ALLOWED
BY LAW 3COM ALSO EXCLUDES FOR ITSELF AND ITS SUPPLIERS
ANY LIABILITY, WHETHER BASED IN CONTRACT OR TORT
(INCLUDING NEGLIGENCE), FOR INCIDENTAL, CONSEQUENTIAL,
INDIRECT, SPECIAL, OR PUNITIVE DAMAGES OF ANY KIND, OR
FOR LOSS OF REVENUE OR PROFITS, LOSS OF BUSINESS, LOSS OF
INFORMATION OR DATA, OR OTHER FINANCIAL LOSS ARISING
OUT OF OR IN CONNECTION WITH THE SALE, INSTALLATION,
MAINTENANCE, USE, PERFORMANCE, FAILURE, OR
INTERRUPTION OF THIS PRODUCT, EVEN IF 3COM OR ITS
AUTHORIZED RESELLER HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES, AND LIMITS ITS LIABILITY TO
REPLACEMENT OF THE SOFTWARE ON NEW MEDIA, OR REFUND
OF THE PURCHASE PRICE PAID, AT THE OPTION OF 3COM. THIS
DISCLAIMER OF LIABILITY FOR DAMAGES WILL NOT BE
AFFECTED IF ANY REMEDY PROVIDED HEREIN SHALL FAIL OF
ITS ESSENTIAL PURPOSE.
SEVERABILITY: In the event any provision of this License Agreement is
found to be invalid, illegal or unenforceable, the validity, legality and
enforceability of any of the remaining provisions shall not in any way be
affected or impaired and a valid, legal and enforceable provision of similar intent
and economic impact shall be substituted therefor. The headings used in this
Agreement are for convenience only and shall not be considered part of the
Agreement.
ENTIRE AGREEMENT: This License Agreement sets forth the entire
understanding and agreement between you and 3Com, supersedes all prior
agreements, whether written or oral, with respect to the Software and subject
matter hereof, and may be amended only in a writing signed by both parties.
Palm Computing, Inc., a subsidiary of 3Com Corporation
1565 Charleston Road
Mountain View, California 94043
(650) 237-6000

View File

@ -0,0 +1,35 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* AppBuildRules.h
*
* Description:
* This header file can beused as a template for
* application specific build options. To use, simple copy this file
* and place it into your local directory.
*
* Typically, the options specified in this file are used to build
* with different forms of error-checking, etc. and are not common to all projects.
*
* History:
* 6/6/95 RM - Created by Ron Marianetti
*
*******************************************************************/
// Run with error checking that forces all handles to be locked before
// they are accessed. Before alpha, all applications should be able to run with this
// option on.
#define MEMORY_FORCE_LOCK 1
// Set these according to which Shell commands you want to
// link with.
#define SHELL_COMMAND_DB 0 // Available
#define SHELL_COMMAND_UI 0 // Not Available
#define SHELL_COMMAND_APP 0 // Not Available
#define SHELL_COMMAND_EMULATOR 1 // Available

View File

@ -0,0 +1,166 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* BuildRules.h
*
* Description:
* Build Rules for Pilot. This file is necessary for
* the CodeWarrior environment since it doesn't permit #defines
* in the "Makefile".
*
* This file is included from within Common.h
*
* History:
* 12/13/94 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifndef __BUILDRULES_H__
#define __BUILDRULES_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
// 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 on the Mac
#define ENVIRONMENT_MPW 1 // MPW on the Mac
// 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
// The makefile should set the define HW_TARGET to one of the
// following constants:
#define HW_TARGET_NONE 0 // Emulating
#define HW_TARGET_302 1 // Motorola 302 ADS board
#define HW_TARGET_328EMU 2 // Motorola 328 Emulator ADS board
#define HW_TARGET_328 3 // Motorola 328 ADS board
#define HW_TARGET_TD1 4 // Pilot hardware
// 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 COUNTRY to one of the
// following constants:
#define COUNTRY_UNITED_STATES 0
#define COUNTRY_FRANCE 1
#define COUNTRY_GERMANY 2
// The makefile should set the define LANGUAGE to one of the
// following constants:
#define LANGUAGE_ENGLISH 0
#define LANGUAGE_FRENCH 1
#define LANGUAGE_GERMAN 2
/************************************************************
* Include the following file when running under the CodeWarriror
* 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 it's own local directory. This include file
* is never used when building from MPW since MPW can specify compiler
* defines from the command line.
*************************************************************/
#ifndef CMD_LINE_BUILD // pre-defined only from MPW
#include "AppBuildRules.h"
#include <SysBuildRules.h>
#endif
/************************************************************
* Settings, these can be overriden in the makefile
*************************************************************/
#ifndef EMULATION_LEVEL
#define EMULATION_LEVEL EMULATION_NONE
#endif
#if EMULATION_LEVEL == EMULATION_NONE
#define MEMORY_TYPE MEMORY_LOCAL
#endif
#ifndef MEMORY_TYPE
#define MEMORY_TYPE MEMORY_LOCAL
#endif
#ifndef ENVIRONMENT
#define ENVIRONMENT ENVIRONMENT_CW
#endif
#ifndef ERROR_CHECK_LEVEL
#define ERROR_CHECK_LEVEL ERROR_CHECK_FULL
#endif
#ifndef CPU_TYPE
#define CPU_TYPE CPU_68K
#endif
#ifndef HW_TARGET
#define HW_TARGET HW_TARGET_NONE
#endif
#ifndef MEMORY_FORCE_LOCK
#define MEMORY_FORCE_LOCK MEMORY_FORCE_LOCK_OFF
#endif
#ifndef COUNTRY
#define COUNTRY COUNTRY_UNITED_STATES
#endif
#ifndef LANGUAGE
#define LANGUAGE LANGUAGE_ENGLISH
#endif
#endif // __BUILDRULES_H__

217
sdk-1/include/Core/Common.h Normal file
View File

@ -0,0 +1,217 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* Common.h
*
* Description:
* Common header file for all Pilot routines.
* Contains elementary data types
*
* History:
* 10/19/94 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifndef __COMMON_H__
#define __COMMON_H__
/************************************************************
* Build Rules
*************************************************************/
#include <BuildRules.h>
/************************************************************
* 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 USE_TRAPS
#if EMULATION_LEVEL == EMULATION_NONE
#define USE_TRAPS 1
#else
#define USE_TRAPS 0
#endif
#endif
#if USE_TRAPS == 0
#define ONEWORD_INLINE(trapNum)
#define TWOWORD_INLINE(w1, w2)
#define THREEWORD_INLINE(w1, w2, w3)
#define FOURWORD_INLINE(w1, w2, w3, w4)
#define FIVEWORD_INLINE(w1, w2, w3, w4, w5)
#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6)
#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7)
#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8)
#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9)
#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10)
#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11)
#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12)
#else
#ifdef __GNUC__
#define ASMWORD(W) asm("dc.w %c0"::"i"(W));
#define ONEWORD_INLINE(trapNum) \
{ASMWORD(trapNum)}
#define TWOWORD_INLINE(w1, w2) \
{ASMWORD(w1)ASMWORD(w2)}
#define THREEWORD_INLINE(w1, w2, w3) \
{ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)}
#define FOURWORD_INLINE(w1, w2, w3, w4) \
{ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)}
#define FIVEWORD_INLINE(w1, w2, w3, w4, w5) \
{ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)}
#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6) \
{ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)}
#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7) \
{ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)}
#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8) \
{ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)ASMWORD(w8)}
#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) \
{ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)ASMWORD(w8)ASMWORD(w9)}
#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) \
{ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)ASMWORD(w8)ASMWORD(w9)ASMWORD(w10)}
#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) \
{ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)ASMWORD(w8)ASMWORD(w9)ASMWORD(w10)ASMWORD(w11)}
#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) \
{ASMWORD(w1)ASMWORD(w2)ASMWORD(w3)ASMWORD(w4)ASMWORD(w5)ASMWORD(w6)ASMWORD(w7)ASMWORD(w8)ASMWORD(w9)ASMWORD(w10)ASMWORD(w11)ASMWORD(w12)}
#else
#define ONEWORD_INLINE(trapNum) \
= trapNum
#define TWOWORD_INLINE(w1, w2) \
= {w1,w2}
#define THREEWORD_INLINE(w1, w2, w3) \
= {w1,w2,w3}
#define FOURWORD_INLINE(w1, w2, w3, w4) \
= {w1,w2,w3,w4}
#define FIVEWORD_INLINE(w1, w2, w3, w4, w5) \
= {w1,w2,w3,w4,w5}
#define SIXWORD_INLINE(w1, w2, w3, w4, w5, w6) \
= {w1,w2,w3,w4,w5,w6}
#define SEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7) \
= {w1,w2,w3,w4,w5,w6,w7}
#define EIGHTWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8) \
= {w1,w2,w3,w4,w5,w6,w7,w8}
#define NINEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9) \
= {w1,w2,w3,w4,w5,w6,w7,w8,w9}
#define TENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10) \
= {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10}
#define ELEVENWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11) \
= {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11}
#define TWELVEWORD_INLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12) \
= {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12}
#endif
#endif
/********************************************************************
* Elementary data types
********************************************************************/
// Fixed size data types
typedef char SByte; // 8 bits
typedef unsigned char Byte;
typedef short SWord; // 16 bits
typedef unsigned short Word;
typedef long SDWord; // 32 bits
typedef unsigned long DWord;
// Logical data types
typedef unsigned char Boolean;
typedef char Char; // Used for character strings
typedef unsigned char UChar;
typedef short Short; // >= Byte
typedef unsigned short UShort;
typedef short Int; // >= Word (use short so MPW and CW agree)
typedef unsigned short UInt;
typedef long Long; // >= DWord
typedef unsigned long ULong;
typedef short Err;
typedef DWord LocalID; // local (card relative) chunk ID
/************************************************************
* Pointer Types
*************************************************************/
typedef void* VoidPtr;
typedef VoidPtr* VoidHand;
// Fixed size data types
typedef SByte* SBytePtr;
typedef Byte* BytePtr;
typedef SWord* SWordPtr;
typedef Word* WordPtr;
typedef SDWord* SDWordPtr;
typedef DWord* DWordPtr;
// Logical data types
typedef Boolean* BooleanPtr;
typedef Char* CharPtr;
typedef UChar* UCharPtr;
typedef Short* ShortPtr;
typedef UShort* UShortPtr;
typedef Int* IntPtr;
typedef UInt* UIntPtr;
typedef Long* LongPtr;
typedef ULong* ULongPtr;
// Include the following typedefs if types.h wasn't read.
#ifndef __TYPES__
// Generic Pointer types used by Memory Manager
// We have to define Ptr as char* because that's what the Mac includes do.
typedef char* Ptr; // global pointer
typedef Ptr* Handle; // global handle
// Function types
typedef Long (*ProcPtr)();
#endif /* __TYPES__ */
/************************************************************
* Common constants
*************************************************************/
#ifndef NULL
#define NULL 0
#endif // NULL
#ifndef __TYPES__ // Macintosh Types
enum {false, true};
#define __TYPES__
#endif
#endif //__COMMON_H__

View File

@ -0,0 +1,246 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* 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. is contained in separate
* header files.
*
* History:
* 4/27/95 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifdef NON_PORTABLE // So app's don't mistakenly include this
#ifndef __HARDWARE_H__
#define __HARDWARE_H__
/**************************************************************************
* General Equates
***************************************************************************/
// Bits in the low memory global GHwrWakeUp
#define hwrWakeUpGeneral 0x0001
#define hwrWakeUpPWM 0x0002
#define hwrWakeUpFromKey 0x0004 // set if we woke from a key press
#define hwrWakeUpReturnToSleep 0x0008 // set if we woke from 24 hr. interrupt
// in which case we want to go right back to sleep
// Bits for the call HwrDockSignals
#define hwrDockInSyncButton 0x0001 // Dock button
#define hwrDockInGeneric1 0x0002 // General Purpose input #1
#define hwrDockOutGeneric0 0x0001 // General Purpose output #0
// 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
// Screen Dimensions
#define hwrDisplayWidth 160 // Width of display
#define hwrDisplayHeight 160 // Height of display
// Screen refresh rate
#define hwrDisplayPeriod 12 // frame period in ms.
// Battery scaling:
// Voltage = (level + hwrVoltStepsOffset) / hwrStepsPerVolt
#define hwrStepsPerVolt 78 // 78 = 1 volt.
#define hwrVoltStepsOffset 0 // Add to level before scaling
//----------------------------------------------------------------------------
// Digitizer Dimensions
//----------------------------------------------------------------------------
#define hwrSystemTop (hwrDisplayHeight+4)
#define hwrSystemHeight 56
// Graffiti Area
#define hwrGraffitiTop hwrSystemTop // Top coordinate of Graffiti area
#define hwrGraffitiLeft 27 // Left coordinate of Graffiti area
#define hwrGraffitiWidth 106 // Width of Graffiti area
#define hwrGraffitiHeight hwrSystemHeight // Height of Graffiti area
#define hwrGraffitiSplit (hwrGraffitiLeft+62) // Split mode dividing line
// Launch Button
#define hwrLaunchBtnLeft 0
#define hwrLaunchBtnTop hwrSystemTop
#define hwrLaunchBtnWidth 27
#define hwrLaunchBtnHeight (hwrSystemHeight/2)
// Menu Button
#define hwrMenuBtnLeft 0
#define hwrMenuBtnTop (hwrSystemTop+hwrMenuBtnHeight)
#define hwrMenuBtnWidth 27
#define hwrMenuBtnHeight (hwrSystemHeight/2)
// Calculator Button
#define hwrCalcBtnLeft 133
#define hwrCalcBtnTop hwrSystemTop
#define hwrCalcBtnWidth 27
#define hwrCalcBtnHeight (hwrSystemHeight/2)
// Find Button
#define hwrFindBtnLeft 133
#define hwrFindBtnTop (hwrSystemTop+hwrCalcBtnHeight)
#define hwrFindBtnWidth 27
#define hwrFindBtnHeight (hwrSystemHeight/2)
/**************************************************************************
* Prototypes of functions used only when running on the real hardware
***************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
// These routines are only accessed from the Debugger so they don't
// need traps.
void HwrPreRAMInit(void);
void HwrPreDebugInit(void);
void HwrInit(void);
void HwrPostDebugInit(void);
Err HwrFlashWriteSub(Ptr bodyP);
void HwrResetNMI(void);
DWord HwrGetRAMSize(UInt cardNo, DWord limit);
void HwrDrawSplashScreen(void);
void HwrDisableInts(void);
void HwrShutDownPLL(void);
void HwrLowBatteryHandler(void);
// These routines are for "general" use.
void HwrIRQ1Handler(DWord param)
SYS_TRAP(sysTrapHwrIRQ1Handler);
void HwrIRQ2Handler(DWord param)
SYS_TRAP(sysTrapHwrIRQ2Handler);
void HwrIRQ3Handler(DWord param)
SYS_TRAP(sysTrapHwrIRQ3Handler);
void HwrIRQ4Handler(DWord param)
SYS_TRAP(sysTrapHwrIRQ4Handler);
void HwrIRQ5Handler(DWord param)
SYS_TRAP(sysTrapHwrIRQ5Handler);
void HwrIRQ6Handler(DWord param)
SYS_TRAP(sysTrapHwrIRQ6Handler);
void HwrGetRAMMapping(Ptr /*CardInfoPtr*/ cardInfoP, UInt* numBlocksP,
DWordPtr physBlockInfoP, DWordPtr logBlockInfoP)
SYS_TRAP(sysTrapHwrGetRAMMapping);
DWord HwrMemWritable(VoidPtr addr)
SYS_TRAP(sysTrapHwrMemWritable);
DWord HwrMemReadable(VoidPtr addr)
SYS_TRAP(sysTrapHwrMemReadable);
Err HwrCursor(Boolean set, Int* modeP, PointType* whereP, PointType* sizeP,
UInt* blinkP)
SYS_TRAP(sysTrapHwrCursor);
void HwrDelay(ULong microseconds)
SYS_TRAP(sysTrapHwrDelay);
void HwrDoze(Boolean onlyNMI)
SYS_TRAP(sysTrapHwrDoze);
void HwrSleep(Boolean untilReset, Boolean emergency)
SYS_TRAP(sysTrapHwrSleep);
Err HwrWake(void)
SYS_TRAP(sysTrapHwrWake);
Err HwrSetSystemClock(ULong* freqP)
SYS_TRAP(sysTrapHwrSetSystemClock);
Err HwrSetCPUDutyCycle(UInt* dutyP)
SYS_TRAP(sysTrapHwrSetCPUDutyCycle);
Err HwrLCDInit(UInt framePeriod, VoidPtr baseP, UInt width,
UInt height, UInt depth)
SYS_TRAP(sysTrapHwrLCDInit);
Err HwrLCDBaseAddr(Ptr* newAddrP)
SYS_TRAP(sysTrapHwrLCDBaseAddr);
Err HwrLCDDrawBitmap(UInt x, UInt y, Ptr bitmapP, Boolean clearFirst)
SYS_TRAP(sysTrapHwrLCDDrawBitmap);
Err HwrLCDSleep(Boolean untilReset, Boolean emergency)
SYS_TRAP(sysTrapHwrLCDSleep);
Err HwrLCDWake(void)
SYS_TRAP(sysTrapHwrLCDWake);
Err HwrTimerInit(UInt timer)
SYS_TRAP(sysTrapHwrTimerInit);
Err HwrTimerSleep(UInt timer)
SYS_TRAP(sysTrapHwrTimerSleep);
Err HwrTimerWake(UInt timer)
SYS_TRAP(sysTrapHwrTimerWake);
UInt HwrBatteryLevel(void)
SYS_TRAP(sysTrapHwrBatteryLevel);
Boolean HwrPluggedIn(void)
SYS_TRAP(sysTrapHwrPluggedIn);
Boolean HwrEnableDataWrites(void)
SYS_TRAP(sysTrapHwrEnableDataWrites);
void HwrDisableDataWrites(void)
SYS_TRAP(sysTrapHwrDisableDataWrites);
Err HwrDockSignals(WordPtr inputsP, Word outputSet, Word outputClr)
SYS_TRAP(sysTrapHwrDockSignals);
#ifdef __cplusplus
}
#endif
/************************************************************
* Assembly Function Prototypes
*************************************************************/
#define _HwrWake \
ASM_SYS_TRAP(sysTrapHwrWake)
#endif //__HARDWARE_H__
#endif // NON_PORTABLE

View File

@ -0,0 +1,174 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* HardwarePrv.h
*
* Description:
* Private Hardware Equates. This header file
* contains equates that are common across all platforms but that
* change value for each hardware rev and platform.
*
* History:
* 4/27/95 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifdef NON_PORTABLE // So app's don't mistakenly include this
#ifndef __HARDWAREPRV_H__
#define __HARDWAREPRV_H__
// This must be defined on the command line before using this header!!
#if HW_TARGET != HW_TARGET_NONE
#ifndef HW_REV
#error THE COMPILER VARIABLE HW_REV MUST BE DEFINED!!
#endif
#endif
/***********************************************************************
* Equates for Emulation Mode
***********************************************************************/
#if HW_TARGET == HW_TARGET_NONE
#define hwrCardSize 0x10000000L // Size of each card slot
// DOLATER.. take this out???
// Under native mode, this mask can be used to convert a pointer to a card offse¹
//#define hwrCardOffsetMask 0x0FFFFFFFL
#endif
/***********************************************************************
* First Rev of the Pilot Hardware
***********************************************************************/
#if HW_TARGET == HW_TARGET_TD1
// Define location and setup for the 68328 Dragonball chip
#define hwr68328Base 0xFFFFF000L // Base address of 68328
// Define the base of card 0 and the size of each card slot.
#if HW_REV <= 3
#define hwrCardBase0 0x00800000L // starts here
#define hwrCardSize 0x00800000L // Size of each card slot
#define hwrFlashBase 0x00F00000L // Base of Flash ROM
#define hwrFlashSize 0x00080000L // Size of Flash ROM
#define hwrCardOffsetMask 0x007FFFFFL // Used to convert a pointer to a card offset
#else // HW_REV >= 4
#define hwrCardBase0 0x10000000L // starts here
#define hwrCardSize 0x10000000L // Size of each card slot
#define hwrFlashBase 0x10C00000L // Base of Flash ROM
#define hwrFlashSize 0x00080000L // Size of Flash ROM
#define hwrCardOffsetMask 0x0FFFFFFFL // Used to convert a pointer to a card offset
#endif
// Define the Flash width
#define hwrROMWidth 2
// Define location and setup for the 68681 Duart
#define hwrDuartBase 0x10E00000 // Base address of DUART
#define hwrDuartClock 3686400 // in Hertz (3.6864 MHz)
// Setting of ACR register except for baud rate select
// Timer mode - Crystal clock /1
#define hwrDuartACRReg 0x60
#endif // HW_TARGET == HW_TARGET_TD1
/***********************************************************************
* Motorola 68302 Development board
***********************************************************************/
#if HW_TARGET == HW_TARGET_302
// Define # of card slots and base address of each slot
#define hwrNumCardSlots 1 // 1 card slot
#define hwrCardBase0 0x00000000L // starts at 0
#define hwrCardSize 0x10000000L // Size of each card slot
// Under native mode, this mask can be used to convert a pointer to a card offse¹
#define hwrCardOffsetMask 0x0FFFFFFFL
// Define location and setup for the 68681 Duart
#define hwrDuartBase 0x00400000 // Base address of DUART
#define hwrDuartClock 3686400 // in Hertz (3.6864 MHz)
#define hwrDuartIntVec 25 // Interrupt vector number for DUART
// Setting of ACR register except for baud rate select
// Timer mode - Crystal clock /1
#define hwrDuartACRReg 0x60
// Define the Flash base address
#define hwrFlashBase 0x00200000L
#define hwrROMWidth 2
#endif // HW_TARGET == HW_TARGET_302
/***********************************************************************
* Motorola 68328 Emulator Development board
***********************************************************************/
#if HW_TARGET == HW_TARGET_328EMU
// Define # of card slots and base address of each slot
#define hwrNumCardSlots 1 // 1 card slot
#define hwrCardBase0 0x00000000L // starts at 0
#define hwrCardSize 0x10000000L // Size of each card slot
// Under native mode, this mask can be used to convert a pointer to a card offse¹
#define hwrCardOffsetMask 0x0FFFFFFFL
// Define location and setup for the 68681 Duart
#define hwrDuartBase 0x00F00000 // Base address of DUART
#define hwrDuartClock 3686400 // in Hertz (3.6864 MHz)
#define hwrDuartIntVec 25 // Interrupt vector number for DUART
// Setting of ACR register except for baud rate select
// Timer mode - Crystal clock /1
#define hwrDuartACRReg 0x60
// Define the Flash base address
#define hwrFlashBase 0x00400000L
#define hwrROMWidth 2
#endif // HW_TARGET == HW_TARGET_328EMU
#endif //__HARDWARE_H__
#endif // NON_PORTABLE

View File

@ -0,0 +1,308 @@
/*******************************************************************
* Touchdown Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* HardwareTD1.h
*
* Description:
* Hardware Equates for the TD1 platform. This header file
* contains equates specific to Hardware platform TD1.
* It is included only in the modules "ROMHardwareTD1.c" and
* "AMXHardwareTD1.c".
*
* History:
* 6/13/95 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifdef NON_PORTABLE // So app's don't mistakenly include this
#ifndef __HARDWARETD1_H__
#define __HARDWARETD1_H__
#if HW_REV == 1
/************************************************************************
* Port F Bit settings
************************************************************************/
#define hwrTD1PortFPanelYPOff 0x01 // (L) Vcc to Y Panel
#define hwrTD1PortFPanelYMOn 0x02 // (H) Gnd to Y Panel
#define hwrTD1PortFPanelXPOff 0x04 // (L) Vcc to X Panel
#define hwrTD1PortFPanelXMOn 0x08 // (H) Gnd to X Panel
#define hwrTD1PortFUnused4 0x10
#define hwrTD1PortFUnused5 0x20
#define hwrTD1PortFUnused6 0x40
#define hwrTD1PortFSerialOn 0x80 // (H) Serial driver Enable
// Configurations of the panel control bits
#define hwrTD1PortFPanelMask 0x0F // Panel control bits
// Configure for lowest power
#define hwrTD1PortFPanelCfgOff (hwrTD1PortFPanelYPOff | \
hwrTD1PortFPanelXPOff)
// Configure to generate pen interrupt
#define hwrTD1PortFPanelCfgPenIRQ (hwrTD1PortFPanelXMOn | \
hwrTD1PortFPanelYPOff | \
hwrTD1PortFPanelXPOff)
// Configure to Measure Y Position
#define hwrTD1PortFPanelCfgYMeas (hwrTD1PortFPanelXMOn | \
hwrTD1PortFPanelYPOff)
// Configure to Measure X Position
#define hwrTD1PortFPanelCfgXMeas (hwrTD1PortFPanelXPOff | \
hwrTD1PortFPanelYMOn)
/************************************************************************
* Port J Bit Assignments
************************************************************************/
#define hwrTD1PortJADCSOff 0x02 // (L) A/D Chip select
#define hwrTD1PortJBattOff 0x10 // (L) Battery Voltage measure
#define hwrTD1PortJLCDEnableOn 0x20 // (H) LCD Display On
#define hwrTD1PortJLCDVccOff 0x40 // (L) LCD Vcc
#define hwrTD1PortJLCDVeeOn 0x80 // (H) LCD Vee
/************************************************************************
* Port K Bit Assignments
************************************************************************/
#define hwrTD1PortKSelfRefOff 0x08 // (L) PSRAM Self Refresh mode
#define hwrTD1PortKSelfRefOffBit 3
/************************************************************************
* Port M Bit Assignments
************************************************************************/
#define hwrTD1PortMVccFail 0x04 // (L) Input indicates 3.3v is too low
#define hwrTD1PortMCardIRQ 0x08 // (L) IRQ3 input from card
#define hwrTD1PortMUnused4 0x10 // Unused (IRQ2)
#define hwrTD1PortMDockButton 0x20 // (L) Sync button from Serial Doc
#define hwrTD1PortMPenIO 0x40 // Pen input/output
#define hwrTD1PortMDockIn 0x80 // (L) Gen. Purpose input from Serial Doc
/************************************************************************
* SPIM Base Configuration
************************************************************************/
#define hwrTD1SPIMBaseControl (hwr328SPIMControlRateDiv32 | \
hwr328SPIMControlIntEnable | \
hwr328SPIMControlInvPolarity | \
hwr328SPIMControlOppPhase | \
16-1)
/************************************************************************
* Macros for turning write-protection on/off
* These are used in-line for MemSemaphoreReserve and MemSemaphoreRelease
* for performance reasons.
************************************************************************/
#define hwrWriteProtectOff() \
{ \
HwrDBallPtr baseP = (HwrDBallPtr)hwr68328Base; \
/* Word mask; */ \
\
/* DOLATER.. take this out.... */ \
/* mask = baseP->csAGroupMask; */ \
\
/* Clr read-only bit in chip select register for storage area */ \
baseP->csASelect1 &= ~(0x0008); \
baseP->csASelect2 &= ~(0x0008); \
\
/* DOLATER.. take this out... */ \
/* baseP->csAGroupMask = mask; */ \
}
#ifndef BUILD_OPTION_WP_OFF
#define hwrWriteProtectOn() \
{ \
HwrDBallPtr baseP = (HwrDBallPtr)hwr68328Base; \
/* Word mask; */ \
\
/* DOLATER.. take this out.... */ \
/* mask = baseP->csAGroupMask; */ \
\
/* Set read-only bit in chip select register for storage area */ \
baseP->csASelect1 |= (0x0008); \
baseP->csASelect2 |= (0x0008); \
\
/* DOLATER.. take this out... */ \
/* baseP->csAGroupMask = mask; */ \
}
#else
#define hwrWriteProtectOn()
#endif
#elif HW_REV >= 2
/************************************************************************
* Port D Bit settings
************************************************************************/
#define hwrTD1PortDNoExtPower 0x80 // (L) External DC input
/************************************************************************
* Port F Bit settings
************************************************************************/
#define hwrTD1PortFPanelYPOff 0x01 // (L) Vcc to Y Panel
#define hwrTD1PortFPanelYMOn 0x02 // (H) Gnd to Y Panel
#define hwrTD1PortFPanelXPOff 0x04 // (L) Vcc to X Panel
#define hwrTD1PortFPanelXMOn 0x08 // (H) Gnd to X Panel
#define hwrTD1PortFLCDEnableOn 0x10 // (H) LCD Display on
#define hwrTD1PortFLCDVccOff 0x20 // (L) LCD Vcc
#define hwrTD1PortFLCDVeeOn 0x40 // (H) LCD Vee
#define hwrTD1PortFADCSOff 0x80 // (L) A/D Chip Select
// Configurations of the panel control bits
#define hwrTD1PortFPanelMask 0x0F // Panel control bits
// Configure for lowest power
#define hwrTD1PortFPanelCfgOff (hwrTD1PortFPanelYPOff | \
hwrTD1PortFPanelXPOff)
// Configure to generate pen interrupt
#define hwrTD1PortFPanelCfgPenIRQ (hwrTD1PortFPanelXMOn | \
hwrTD1PortFPanelYPOff | \
hwrTD1PortFPanelXPOff)
// Configure to Measure Y Position
#define hwrTD1PortFPanelCfgYMeas (hwrTD1PortFPanelXMOn | \
hwrTD1PortFPanelYPOff)
// Configure to Measure X Position
#define hwrTD1PortFPanelCfgXMeas (hwrTD1PortFPanelXPOff | \
hwrTD1PortFPanelYMOn)
/************************************************************************
* Port G Bit Assignments
************************************************************************/
#define hwrTD1PortGSerialOn 0x08 // (H) Serial Driver Enable
#define hwrTD1PortGBattOff 0x10 // (L) Battery Voltage Measure
#define hwrTD1PortGRefreshOut 0x20 // (L) Timer 1 output to signal refresh
#define hwrTD1PortGSelfRefOff 0x40 // (L) PSRAM Self Refresh mode
#define hwrTD1PortGSelfRefOffBit 6 // Bit # for above
#define hwrTD1PortGDockOut1 0x80 // (H) Gen. Purpose output on Serial Doc
/************************************************************************
* Port M Bit Assignments
************************************************************************/
#define hwrTD1PortMVccFail 0x04 // (L) Input indicates 3.3v is too low
#define hwrTD1PortMCardIRQ 0x08 // (L) IRQ3 input from card
#define hwrTD1PortMUnused4 0x10 // Unused (IRQ2)
#define hwrTD1PortMDockButton 0x20 // (L) Sync button from Serial Doc
#define hwrTD1PortMPenIO 0x40 // Pen input/output
#define hwrTD1PortMDockIn 0x80 // (L) Gen. Purpose input from Serial Doc
/************************************************************************
* SPIM Base Configuration
************************************************************************/
#define hwrTD1SPIMBaseControl (hwr328SPIMControlRateDiv16 | \
hwr328SPIMControlIntEnable | \
hwr328SPIMControlInvPolarity | \
hwr328SPIMControlOppPhase | \
16-1)
/************************************************************************
* Macros for turning write-protection on/off
* These are used in-line for MemSemaphoreReserve and MemSemaphoreRelease
* for performance reasons.
************************************************************************/
#define hwrWriteProtectOff() \
{ \
HwrDBallPtr baseP = (HwrDBallPtr)hwr68328Base; \
/* Word mask; */ \
\
/* DOLATER.. take this out.... */ \
/* mask = baseP->csAGroupMask; */ \
\
/* Clr read-only bit in chip select register for storage area */ \
baseP->csASelect1 &= ~(0x0008); \
baseP->csASelect3 &= ~(0x0008); \
\
/* DOLATER.. take this out... */ \
/*baseP->csAGroupMask = mask; */ \
}
#ifndef BUILD_OPTION_WP_OFF
#define hwrWriteProtectOn() \
{ \
HwrDBallPtr baseP = (HwrDBallPtr)hwr68328Base; \
/* Word mask; */ \
\
/* DOLATER.. take this out.... */ \
/* mask = baseP->csAGroupMask; */ \
\
/* Set read-only bit in chip select register for storage area */ \
baseP->csASelect1 |= (0x0008); \
baseP->csASelect3 |= (0x0008); \
\
/* DOLATER.. take this out... */ \
/*baseP->csAGroupMask = mask; */ \
}
#else
#define hwrWriteProtectOn()
#endif
#else // HW_REV==2
#error "Compiler variable HW_REV not valid!!!"
#endif
/************************************************************************
*Initial values for the PLL. We set the system clock to be VCO/2 so
* the system clock speed becomes:
*
* 32768 * ((hwrTD1FreqSelP + 1) * 14 + hwrTD1FreqSelQ + 1)
* --------------------------------------------------------
* 2
************************************************************************/
// NON-ASIC versions must run at 8 Mhz.
#if HW_REV < 4
#define hwrTD1PLLControl (hwr328PLLControlClkEn | \
hwr328PLLControlSysVCODiv2 | \
hwr328PLLControlPixVCODiv2)
//#define hwrTD1FreqSelQ 0x05
#define hwrTD1FreqSelQ 0x07 // vmk 11/20/95 tunes clock freq for 38400 baud,
// allowing standard baud rates 2400-57600 to function
//#define hwrTD1FreqSelP 0x23
#define hwrTD1FreqSelP 0x24
#define hwrTD1Frequency (32768*((hwrTD1FreqSelP+1)*14+hwrTD1FreqSelQ+1)/2)
// OLD ASIC versions must run between 10 and 12.5 Mhz.
#elif HW_REV == 4
#define hwrTD1PLLControl (hwr328PLLControlClkEn | \
hwr328PLLControlSysVCODiv1 | \
hwr328PLLControlPixVCODiv1)
#define hwrTD1FreqSelQ 0x05
#define hwrTD1FreqSelP 0x19
#define hwrTD1Frequency (32768*((hwrTD1FreqSelP+1)*14+hwrTD1FreqSelQ+1)/1)
// NEW ASIC versions run at 16.580608 Mhz
#else
#define hwrTD1PLLControl (hwr328PLLControlClkEn | \
hwr328PLLControlSysVCODiv1 | \
hwr328PLLControlPixVCODiv1)
#define hwrTD1FreqSelQ 0x01
#define hwrTD1FreqSelP 0x23
#define hwrTD1Frequency (32768*((hwrTD1FreqSelP+1)*14+hwrTD1FreqSelQ+1)/1)
#endif
#endif //__HARDWARETD1_H__
#endif // NON_PORTABLE

View File

@ -0,0 +1,638 @@
/*******************************************************************
* Touchdown Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* 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
*
*******************************************************************/
#ifdef NON_PORTABLE // So apps don't include this...
#ifndef __M68328HWR_H__
#define __M68328HWR_H__
#include <Common.h> // Touchdown includes
/***********************************************************************
* Motorola 68328 registers
***********************************************************************/
typedef struct HwrDBallType {
Byte scr; // $000: System Control Register
Byte ___filler1[0xFF];
Word csAGroupBase; // $100: Chip Select Group A Base Register
Word csBGroupBase; // $102: Chip Select Group B Base Register
Word csCGroupBase; // $104: Chip Select Group C Base Register
Word csDGroupBase; // $106: Chip Select Group D Base Register
Word csAGroupMask; // $108: Chip Select Group A Mask Register
Word csBGroupMask; // $10A: Chip Select Group B Mask Register
Word csCGroupMask; // $10C: Chip Select Group C Mask Register
Word csDGroupMask; // $10E: Chip Select Group D Mask Register
DWord csASelect0; // $110: Group A Chip Select 0 Register
DWord csASelect1; // $114: Group A Chip Select 1 Register
DWord csASelect2; // $118: Group A Chip Select 2 Register
DWord csASelect3; // $11C: Group A Chip Select 3 Register
DWord csBSelect0; // $120: Group B Chip Select 0 Register
DWord csBSelect1; // $124: Group B Chip Select 1 Register
DWord csBSelect2; // $128: Group B Chip Select 2 Register
DWord csBSelect3; // $12C: Group B Chip Select 3 Register
DWord csCSelect0; // $130: Group C Chip Select 0 Register
DWord csCSelect1; // $134: Group C Chip Select 1 Register
DWord csCSelect2; // $138: Group C Chip Select 2 Register
DWord csCSelect3; // $13C: Group C Chip Select 3 Register
DWord csDSelect0; // $140: Group D Chip Select 0 Register
DWord csDSelect1; // $144: Group D Chip Select 1 Register
DWord csDSelect2; // $148: Group D Chip Select 2 Register
DWord csDSelect3; // $14C: Group D Chip Select 3 Register
Word csDebug; // $150: Chip Select debug register
Byte ___filler2[0x200-0x152];
Word pllControl; // $200: PLL Control Register
Word pllFreqSel; // $202: PLL Frequency Select Register
Word pllTest; // $204: PLL Test Register
Byte __filler44;
Byte pwrControl; // $207: Power Control Register
Byte ___filler3[0x300-0x208];
Byte intVector; // $300: Interrupt Vector Register
Byte ___filler4;
Word intControl; // $302: Interrupt Control Register
Word intMaskHi; // $304: Interrupt Mask Register/HIGH word
Word intMaskLo; // $306: Interrupt Mask Register/LOW word
Word intWakeupEnHi; // $308: Interrupt Wakeup Enable Register
Word intWakeupEnLo; // $30A: Interrupt Wakeup Enable Register
Word intStatusHi; // $30C: Interrupt Status Register/HIGH word
Word intStatusLo; // $30E: Interrupt Status Register/LOW word
Word intPendingHi; // $310: Interrupt Pending Register
Word intPendingLo; // $312: Interrupt Pending Register
Byte ___filler4a[0x400-0x314];
Byte portADir; // $400: Port A Direction Register
Byte portAData; // $401: Port A Data Register
Byte ___filler5;
Byte portASelect; // $403: Port A Select Register
Byte ___filler6[4];
Byte portBDir; // $408: Port B Direction Register
Byte portBData; // $409: Port B Data Register
Byte ___filler7;
Byte portBSelect; // $40B: Port B Select Register
Byte ___filler8[4];
Byte portCDir; // $410: Port C Direction Register
Byte portCData; // $411: Port C Data Register
Byte ___filler9;
Byte portCSelect; // $413: Port C Select Register
Byte ___filler10[4];
Byte portDDir; // $418: Port D Direction Register
Byte portDData; // $419: Port D Data Register
Byte portDPullupEn; // $41A: Port D Pull-up Enable
Byte ___filler11;
Byte portDPolarity; // $41C: Port D Polarity Register
Byte portDIntReqEn; // $41D: Port D Interrupt Request Enable
Byte ___filler12;
Byte portDIntEdge; // $41F: Port D IRQ Edge Register
Byte portEDir; // $420: Port E Direction Register
Byte portEData; // $421: Port E Data Register
Byte ___filler13;
Byte portESelect; // $423: Port E Select Register
Byte ___filler14[4];
Byte portFDir; // $428: Port F Direction Register
Byte portFData; // $429: Port F Data Register
Byte portFPullupEn; // $42A: Port F Pull-up Enable
Byte portFSelect; // $42B: Port F Select Register
Byte ___filler16[4];
Byte portGDir; // $430: Port G Direction Register
Byte portGData; // $431: Port G Data Register
Byte portGPullupEn; // $432: Port G Pull-up Enable
Byte portGSelect; // $433: Port G Select Register
Byte ___filler18[4];
Byte portJDir; // $438: Port J Direction Register
Byte portJData; // $439: Port J Data Register
Byte ___filler19;
Byte portJSelect; // $43B: Port J Select Register
Byte ___filler19a[4];
Byte portKDir; // $440: Port K Direction Register
Byte portKData; // $441: Port K Data Register
Byte portKPullupEn; // $442: Port K Pull-up Enable
Byte portKSelect; // $443: Port K Select Register
Byte ___filler21[4];
Byte portMDir; // $448: Port M Direction Register
Byte portMData; // $449: Port M Data Register
Byte portMPullupEn; // $44A: Port M Pull-up Enable Register
Byte portMSelect; // $44B: Port M Select Register
Byte ___filler22[4];
Byte ___filler23[0x500-0x450];
Word pwmControl; // $500: PWM Control Register
Word pwmPeriod; // $502: PWM Period Register
Word pwmWidth; // $504: PWM Width Register
Word pwmCounter; // $506: PWM Counter
Byte ___filler24[0x600-0x508];
Word tmr1Control; // $600: Timer 1 Control Register
Word tmr1Prescaler; // $602: Timer 1 Prescaler Register
Word tmr1Compare; // $604: Timer 1 Compare Register
Word tmr1Capture; // $606: Timer 1 Capture Register
Word tmr1Counter; // $608: Timer 1 Counter Register
Word tmr1Status; // $60A: Timer 1 Status Register
Word tmr2Control; // $60C: Timer 2 Control Register
Word tmr2Prescaler; // $60E: Timer 2 Prescaler Register
Word tmr2Compare; // $610: Timer 2 Compare Register
Word tmr2Capture; // $612: Timer 2 Capture Register
Word tmr2Counter; // $614: Timer 2 Counter Register
Word tmr2Status; // $616: Timer 2 Status Register
Word wdControl; // $618: Watchdog Control Register
Word wdReference; // $61A: Watchdog Reference Register
Word wdCounter; // $61C: Watchdog Counter
Byte ___filler25[0x700-0x61E];
Word spiSlave; // $700: SPI Slave Register
Byte ___filler26[0x800-0x702];
Word spiMasterData; // $800: SPI Master Data Register
Word spiMasterControl; // $802: SPI Master Control Register
Byte ___filler27[0x900-0x804];
Word uControl; // $900: Uart Control Register
Word uBaud; // $902: Uart Baud Control Register
Word uReceive; // $904: Uart Receive Register
Word uTransmit; // $906: Uart Transmit Register
Word uMisc; // $908: Uart Miscellaneous Register
Byte ___filler28[0xA00-0x90A];
DWord lcdStartAddr; // $A00: Screen Starting Address Register
Byte ___filler29;
Byte lcdPageWidth; // $A05: Virtual Page Width Register
Byte ___filler30[2];
Word lcdScreenWidth; // $A08: Screen Width Register
Word lcdScreenHeight; // $A0A: Screen Height Register
Byte ___filler31[0xA18-0xA0C];
Word lcdCursorXPos; // $A18: Cursor X Position
Word lcdCursorYPos; // $A1A: Cursor Y Position
Word lcdCursorWidthHeight; // $A1C: Cursor Width and Height
Byte ___filler32;
Byte lcdBlinkControl; // $A1F: Blink Control Register
Byte lcdPanelControl; // $A20: Panel Interface Control Register
Byte lcdPolarity; // $A21: Polarity Config Register
Byte ___filler33;
Byte lcdACDRate; // $A23: ACD (M) Rate Control Register
Byte ___filler34;
Byte lcdPixelClock; // $A25: Pixel Clock Divider Register
Byte ___filler35;
Byte lcdClockControl; // $A27: Clocking Control Register
Byte ___filler36;
Byte lcdLastBufferAddr; // $A29: Last Buffer Address Register
Byte ___filler37;
Byte lcdOctetTermCount; // $A2B: Octet Terminal Count Register
Byte ___filler38;
Byte lcdPanningOffset; // $A2D: Panning Offset Register
Byte ___filler39[3];
Byte lcdFrameRate; // $A31: Frame Rate Control Modulation Register
Word lcdGrayPalette; // $A32: Gray Palette Mapping Register
Byte lcdReserved; // $A34: Reserved
Byte ___filler40[0xB00-0xA35];
DWord rtcHourMinSec; // $B00: RTC Hours, Minutes, Seconds Register
DWord rtcAlarm; // $B04: RTC Alarm Register
DWord rtcReserved; // $B08: RTC Reserved
Word rtcControl; // $B0C: RTC Control Register
Word rtcIntStatus; // $B0E: RTC Interrupt Status Register
Word rtcIntEnable; // $B10: RTC Interrupt Enable Register
Word stopWatch; // $B12: Stopwatch Minutes
} HwrDBallType;
typedef volatile HwrDBallType* HwrDBallPtr;
/************************************************************************
* 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
// Old dragonball allows up to 4 clocks/word
#if HW_REV < 3
#define hwr328LcdClockControlBurstRate1 0x00
#define hwr328LcdClockControlBurstRate2 0x10
#define hwr328LcdClockControlBurstRate3 0x20
#define hwr328LcdClockControlBurstRate4 0x30
// New dragonball allows up to 16 clocks/word
#else
#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
#endif
#define hwr328LcdClockControl8BitBus 0x02
#define hwr328LcdClockControlPixelClkSrc 0x01
/************************************************************************
* Interrupt Controller Bits
************************************************************************/
// intMaskHi bits
#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 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

View File

@ -0,0 +1,119 @@
/*******************************************************************
* Touchdown Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* M68681Hwr.h
*
* Description:
* Hardware Equates for the Motorola 68681 Duart
*
* History:
* 1/18/95 RM - Created by Ron Marianetti
*
*******************************************************************/
#include <Common.h> // Touchdown includes
/***********************************************************************
* Motorola 68681 DUART registers
***********************************************************************/
typedef union HwrDuartType {
// Read Registers
struct {
Byte u0;
Byte mra; // Mode registers 1A and 2A
Byte u2;
Byte sra; // Status register A
Byte u4;
Byte doNotAccess1; // Do Not Access
Byte u6;
Byte rba; // Receive Buffer A
Byte u8;
Byte ipcr; // Inport Port Change Register
Byte uA;
Byte isr; // Input Status Register
Byte uC;
Byte cur; // Current MSB of counter
Byte uE;
Byte clr; // Current LSB of counter
Byte u10;
Byte mrb; // Mode registers 1B and 2B
Byte u12;
Byte srb; // Status register B
Byte u14;
Byte doNotAccess2; // Do Not Access
Byte u16;
Byte rbb; // Receive Buffer B
Byte u18;
Byte ivr; // Interrupt vector register
Byte u1A;
Byte ipr; // Input Port register
Byte u1C;
Byte startCtr; // Start Counter command register
Byte u1E;
Byte stopCtr; // Stop Counter command register
} read;
// Write Registers
struct {
Byte u0;
Byte mra; // Mode registers 1A and 2A
Byte u2;
Byte csra; // Clock Select Register A
Byte u4;
Byte cra; // Command Register A
Byte u6;
Byte tba; // Transmit Buffer A
Byte u8;
Byte acr; // Auxiliary Control Register
Byte uA;
Byte imr; // Interrupt Mask Register
Byte uC;
Byte ctur; // Counter/Timer Upper Preload Register
Byte uE;
Byte ctlr; // Couunter/Timer Lower Preload Register
Byte u10;
Byte mrb; // Mode registers 1B and 2B
Byte u12;
Byte csrb; // Clock Select Register B
Byte u14;
Byte crb; // Command Register B
Byte u16;
Byte tbb; // Transmitter Buffer B
Byte u18;
Byte ivr; // Interrupt Vector Register
Byte u1A;
Byte opcr; // Output Port Config Register
Byte u1C;
Byte opSet; // Output Port Bit Set
Byte u1E;
Byte opReset; // Output Port Bit Reset
} write;
} HwrDuartType;
typedef volatile HwrDuartType* HwrDuartPtr;
/***********************************************************************
* For Final code on the Touchdown Hardware, define all register bits here
* for now, we'll just define a few and use numbers in the code for the rest
***********************************************************************/
// Status Register (SR)
#define hwrDuartSRRegRB 0x80 // Receive Break
#define hwrDuartSRRegFE 0x40 // Framing Err
#define hwrDuartSRRegPE 0x20 // Parity Err
#define hwrDuartSRRegOE 0x10 // Overrun Err
#define hwrDuartSRRegTxEMP 0x08 // Transmitter Empty
#define hwrDuartSRRegTxRDY 0x04 // Transmitter Ready
#define hwrDuartSRRegFFULL 0x02 // FIFO Full
#define hwrDuartSRRegRxRDY 0x01 // Receiver Ready

View File

@ -0,0 +1,109 @@
/**************************************************************************************
*
* DHwr.h
*
* Pilot debugger remote hardware/system info.
*
**************************************************************************************
* MODIFICATION HISTORY
**************************************************************************************/
#ifndef __M68KHWR_H
#define __M68KHWR_H
// Pilot common definitions
#include <Common.h>
/***********************************************************************
* Breakpoint words we use
***********************************************************************/
#define m68kTrapInstr 0x4E40
#define m68kTrapVectorMask 0x000F
/***********************************************************************
* 68000 Exception Vector table
***********************************************************************/
typedef struct M68KExcTableType {
DWord initStack; // initial stack pointer
DWord initPC; // initial PC
DWord busErr; // 08
DWord addressErr; // 0C
DWord illegalInstr; // 10
DWord divideByZero; // 14
DWord chk; // 18
DWord trap; // 1C
DWord privilege; // 20
DWord trace; // 24
DWord aTrap; // 28
DWord fTrap; // 2C
DWord reserved12; // 30
DWord coproc; // 34
DWord formatErr; // 38
DWord unitializedInt; // 3C
DWord reserved[8]; // 40-5C
DWord spuriousInt; // 60
DWord autoVec1; // 64
DWord autoVec2; // 68
DWord autoVec3; // 6C
DWord autoVec4; // 70
DWord autoVec5; // 74
DWord autoVec6; // 78
DWord autoVec7; // 7C
DWord trapN[16]; // 80 - BC
DWord 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 {
DWord d[8]; /* data registers */
DWord a[7]; /* address registers */
DWord usp; /* user stack pointer */
DWord ssp; /* supervisor stack pointer */
DWord pc; /* program counter */
Word 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

View File

@ -0,0 +1,50 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* Pilot.h
*
* Description:
* Include file used by UI library source code modules
*
* History:
* 6/6/95 RM - Created by Ron Marianetti
*
*******************************************************************/
// This tells "SysAll.h" not to use it's own pre-compiled header
#define __PILOT_H__
#include "Common.h"
// Include the pre-compiled header, if not overriden. This pre-compiled header
// can be automatically re-generated by CodeWarrior by including the
// source file "Pilot.pch" in your project.
// The following Mac include file must be included before the Pilot
// headers for the emulator modules that have both Mac and Pilot
// code in them
#if EMULATION_LEVEL == EMULATION_MAC
#include <types.h>
#endif
// The following ANSI header files have function declarations used by some
// of the UI modules.
// Fastest compilation speed is obtained by not including these
// headers when the pre-compiled header is used.
#ifndef __INCLUDED_PILOT_H_OBJ__
#include <SysAll.h>
#include <UIAll.h>
#define NON_PORTABLE
#include <Globals.h>
#include <UIGlobals.h>
#endif

View File

@ -0,0 +1,30 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* Pilot.pch
*
* Description:
* Source file used to generate pre-compiled headers for Pilot
* UI modules
*
* History:
* 6/6/95 RM - Created by Ron Marianetti
*
*******************************************************************/
// By including this module in your CodeWarrior project. You can automatically
// regenerate the pre-compiled header file used by the UI modules called
// Pilot.h.obj
#ifdef EMULATION_LEVEL
#pragma precompile_target ":Obj:Pilot.h.obj.mpw"
#else
#pragma precompile_target ":Obj:Pilot.h.obj"
#endif
// Include the World....
#include <Pilot.h>

View File

@ -0,0 +1,25 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SysBuildRules.h
*
* Description:
* This header file can beused as a template for
* common build options across all applications. To use, simply break
* the pencil and edit.
*
*
* Typically, the options specified in this file are used to
* set the language and country for the emulator
*
* History:
* 6/6/95 RM - Created by Ron Marianetti
*
*******************************************************************/
//#define LANGUAGE LANGUAGE_FRENCH
//#define COUNTRY COUNTRY_FRANCE

View File

@ -0,0 +1,209 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* AlarmMgr.h
*
* Description:
* Include file for Alarm Manager
*
* History:
* 4/11/95 VMK - Created by Vitaly Kruglikov
*
*******************************************************************/
#ifndef __ALARM_MGR_H__
#define __ALARM_MGR_H__
// Include elementary types
#include <Common.h>
#include <SystemMgr.h>
/************************************************************
* Alarm Manager result codes
* (almErrorClass is defined in SystemMgr.h)
*************************************************************/
#define almErrMemory (almErrorClass | 1) // ran out of memory
#define almErrFull (almErrorClass | 2) // alarm table is full
/********************************************************************
* Alarm Manager Structures
********************************************************************/
// Structure passed with the sysAppLaunchCmdAlarmTriggered action code:
//
// This is a notification that an alarm set by the creator has
// gone off. The action code handler should not do anything time-
// consuming here. The intended use is to set the next alarm and/or
// to perform some quick maintenance task. Particularly, this action code
// handler is not allowed to display any UI(dialogs, etc.) -- this would delay
// notification for alarms set by others. This action code may be ignored.
typedef struct SysAlarmTriggeredParamType {
DWord ref; // --> alarm reference value passed by caller;
ULong alarmSeconds; // --> alarm date/time in seconds since 1/1/1904;
Boolean purgeAlarm; // <-- if set to true on return, this alarm
// will be removed from the alarm table and the
// display notification will NOT be generated for it
} SysAlarmTriggeredParamType;
// Structure passed with the sysAppLaunchCmdDisplayAlarm action code:
//
// This is a notification to display an alarm. This action code
// will be called sometime after the app receives a sysAppLaunchCmdAlarmTriggered
// notification(perhaps after a significant delay). It is possible that this
// notification will not be sent at all in the event the alarm table becomes full and
// the alarm table entry is used to hold a new alarm (this does NOT apply to the
// sysAppLaunchCmdAlarmTriggered notification). This action code may be ignored.
typedef struct SysDisplayAlarmParamType {
DWord ref; // alarm reference value passed by caller;
ULong alarmSeconds; // alarm date/time in seconds since 1/1/1904;
Boolean soundAlarm; // non-zero if alarm needs to be sounded;
} SysDisplayAlarmParamType;
/********************************************************************
* Alarm 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 __cplusplus
extern "C" {
#endif
//-------------------------------------------------------------------
// Initialization
//-------------------------------------------------------------------
//
// ISSUES:
// 1. Is the Alarms Database always on Card 0 ?
//
// A: We will store alarm info on the dynamic heap. Upon reset and
// time change, apps will be notified via action code and will re-
// submit their alarms.
//
// 2. Should a semaphore be used by the Alarm Manager ?
//
// A: No. Present implementation does not require it. May add one
// in the future to ensure data integrity between tasks.
//
// 3. Pilot will need to go back to sleep even if the alarms dialog box is
// not closed after some interval.
//
// A: This will happen in GetNextEvent.
//
// 4. We will need to sound the alarm for all newly triggered alarms
// even while another alarm dialog box is on-screen.
//
// A: Yes. We will keep a flag in our globals to indicate when the
// alarm manager is displaying an alarm. This way we do not hog
// stack and dynamic heap memory with additional alarm boxes.
//
// 5. Should the alarm dialog box be system-modal ?
//
// A: Yes -- by swallowing the "QUIT" (and/or others) message in the alarm dialog's
// event loop.
//
// AlmInit()
//
// Initializes the Alarm Manager.
//
// Create the Alarm Globals.
//
Err AlmInit(void)
SYS_TRAP(sysTrapAlmInit);
//-------------------------------------------------------------------
// API
//-------------------------------------------------------------------
// AlmSetAlarm()
//
// Sets an alarm for the given application. If an alarm for that
// application had been previously set, it will be replaced. Passing
// a zero for alarmSeconds cancels the current alarm for the application.
//
Err AlmSetAlarm(UInt cardNo, LocalID dbID, DWord ref,
ULong alarmSeconds, Boolean quiet)
SYS_TRAP(sysTrapAlmSetAlarm);
// AlmGetAlarm()
//
// Gets the alarm seconds for a given app.
// Zero is returned if there is no alarm setting for the app.
ULong AlmGetAlarm(UInt cardNo, LocalID dbID, DWordPtr refP)
SYS_TRAP(sysTrapAlmGetAlarm);
// AlmEnableNotification
//
// Enables/disables Alarm Manager's notification mechanism. For example,
// the HotSync application disables Alarm notifications during the sync
// to ensure that apps do not try to access their data database until
// the DesktopLink server had a chance to notify the apps whose databases
// were modified during the session. This also prevents the alarm dialogs from
// blocking the HotSync UI. A call to disable MUST always
// precede the call to enable.
//
void AlmEnableNotification(Boolean enable)
SYS_TRAP(sysTrapAlmEnableNotification);
// AlmDisplayAlarm()
//
// Displays any alarms that have gone off.
//
// This function is called by the Event Manager executing on some app's
// thread. This permits us to access resources and execute system calls
// which would not be possible at interrupt time.
//
void AlmDisplayAlarm(Boolean okToDisplay)
SYS_TRAP(sysTrapAlmDisplayAlarm);
// AlmCancelAll()
//
// Cancels all alarms managed by the Alarm Manager. This
// function is presently called by the Time Manager to cancel all alarms
// when the user changes date/time.
//
void AlmCancelAll(void)
SYS_TRAP(sysTrapAlmCancelAll);
// AlmAlarmCallback()
//
// This function is called at interrupt time by the Time Manager when
// an alarm goes off.
//
void AlmAlarmCallback(void)
SYS_TRAP(sysTrapAlmAlarmCallback);
#ifdef __cplusplus
}
#endif
#endif // __ALARM_MGR_H__

View File

@ -0,0 +1,111 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* AlarmPrv.h
*
* Description:
* Private Include file for Alarm Manager
*
* History:
* 4/11/95 VMK - Created by Vitaly Kruglikov
*
*******************************************************************/
#ifdef NON_PORTABLE
#ifndef __ALARM_PRV_H__
#define __ALARM_PRV_H__
/************************************************************
* Alarm Manager Constants
*
*************************************************************/
#define almMinTableLength 2 // minimum # of entries in alarm table;
// MUST NOT BE ZERO.
#define almMaxTableLength 20 // maximum # of enries in alarm table
/*******************************************************************
* Alarm Manager alarm table structures
*
*******************************************************************/
// An entry in the alarm table
typedef struct AlmEntryType {
DWord ref; // alarm reference value passed by caller;
ULong alarmSeconds; // alarm date/time in seconds since 1/1/1904;
// a value of 0 indicates unused entry;
LocalID dbID; // creator app database ID;
Word cardNo : 1; // creator app card number;
Word quiet : 1; // 1 indicates that the caller wants
// to be quietly notified when the alarm
// goes off without all the alarm bells
// and whistles;
Word triggered : 1; // 1 indicates the alarm has been triggered;
Word notified : 1; // 1 indicates we notified the caller that
// the alarm went off;
} AlmEntryType;
typedef AlmEntryType* AlmEntryPtr;
// The alarm table
typedef struct AlmTableType {
Short numEntries; // Number of entries in alarm Table;
// List of alarm entries;
// This is a variable size field which
// ***MUST BE LAST***
AlmEntryType list[almMinTableLength];
} AlmTableType;
typedef AlmTableType* AlmTablePtr;
typedef AlmTablePtr* AlmTableHandle;
/*******************************************************************
* Alarm Manager Globals
*
*******************************************************************/
typedef struct AlmGlobalsType {
// We're not making the alarm table a part of the
// Alarm Globals structure because it is allowed
// to resize, thus posing a problem for
// AlmAlarmCallback() which needs to access the
// Alarm Globals at interrupt time.
AlmTableHandle tableH; // alarm table handle;
ULong lastSoundSeconds;
// alarm seconds of the last alarm for
// which an alarm was sounded;
Word displaying : 1;// 1 indicates we're blocked waiting for
// some app to finish displaying an alarm
// dialog box; set and cleared by
// AlmDisplayNextAlarm();
Word triggered : 1; // 1 indicates an alarm was triggered; this
// field is set by the AlmAlarmCallback() and
// is checked and cleared by AlmDisplayAlarm();
Byte disableCount; // if this value is greater than zero, Alarm
// notifications are disabled (see AlmEnableNotification);
} AlmGlobalsType;
typedef AlmGlobalsType* AlmGlobalsPtr;
#endif // __ALARM_MGR_H__
#endif // NON_PORTABLE

View File

@ -0,0 +1,118 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* CMClient.h
*
* Description:
* Connection Management Protocol client definitions.
*
* History:
* 9/14/95 vmk Created by Vitaly Marty Kruglikov
*
*******************************************************************/
#ifndef __CMCLIENT_H__
#define __CMCLIENT_H__
#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS
// Pilot common definitions
#include "Common.h"
#include "SerLink.h"
#else // EMULATION_LEVEL != EMULATION_WINDOWS
// Pilot common definitions
#include <Common.h>
#include <SerialLinkMgr.h>
#endif // EMULATION_LEVEL == EMULATION_WINDOWS
#if EMULATION_WINDOWS != 1
LOGIC ERROR
#endif
/************************************************************
* Connection Manager result codes
* (cmpErrorClass is defined in SystemMgr.h)
*************************************************************/
#define cmErrParam (cmpErrorClass | 1) // bad parameter
#define cmErrTimedOut (cmpErrorClass | 2) // connection initiation/listenning timed out
#define cmErrComm (cmpErrorClass | 3) // communication(send/receive) error
#define cmErrCommVersion (cmpErrorClass | 4) // incompatible comm version
#define cmErrMemory (cmpErrorClass | 5) // insufficient memory error
#define cmErrCommBusy (cmpErrorClass | 6) // PAD server is already in use
#define cmErrUserCan (cmpErrorClass | 7) // attempt cancelled by user
/********************************************************************
* Connection Manager Constants
********************************************************************/
#define cmWakeupTransactionID 0xFF
/********************************************************************
* Connection Manager Structures
********************************************************************/
typedef Int (*CmAbortProc)(DWord userRef);
typedef struct CmParamType {
UInt localSocket; // -> user's socket
UInt remoteSocket; // -> remote socket
ULong maxBaud; // -> maximum baud rate which can be used
Boolean viaModem; // -> set to true if connecting via modem
CmAbortProc abortProc; // -> ptr to abort procedure
DWord userRef; // -> reference value for abort procedure
} CmParamType;
typedef CmParamType* CmParamPtr;
typedef struct CmSessionType {
// Parameters passed by user
CmParamType param; // user parameters
UInt serRefNum; // serial library reference number
} CmSessionType;
typedef CmSessionType* CmSessionPtr;
/********************************************************************
* Connection Manager API Routines
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
// Listens for a "wakeup" message from the broadcaster
// and completes the connection handshake by sending the "init"
// or "abort" message(called by client).
Err CmListen(CmParamPtr paramP);
#ifdef __cplusplus
}
#endif
/********************************************************************
* Connection Manager Macros
********************************************************************/
#endif // __CMCLIENT_H__

View File

@ -0,0 +1,107 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* CMCommon.h
*
* Description:
* Connection Management Protocol common definitions.
*
* History:
* 9/14/95 vmk Created by Vitaly Marty Kruglikov
*
*******************************************************************/
#ifndef __CMCOMMON_H__
#define __CMCOMMON_H__
#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS
// Pilot common definitions
#include "Common.h"
#else // EMULATION_LEVEL != EMULATION_WINDOWS
// Pilot common definitions
#include <Common.h>
#endif // EMULATION_LEVEL == EMULATION_WINDOWS
#if EMULATION_WINDOWS != 1
LOGIC ERROR
#endif
/********************************************************************
* CMP Packet Format
********************************************************************/
// The CMP packets are used for transmitting data for the Pilot CMP protocol layer.
// The structure of the CMP packet is built into the data part of the SLP packet and is,
// therefore, constrained by the SLP packet data size limitations.
// Packet type values used in the CMP packet body "type" field:
//
typedef enum CmpType {
cmpWakeup = 1, // CMP Wakeup packet sent from server to client
cmpInit, // CMP Init packet sent from client to server
cmpAbort // CMP Abort packet sent from client to server
} CmpType;
// cmpInit and cmpWakeup packet body structure:
//
typedef struct CmpBodyType {
Byte type; // CMP packet type
Byte flags; // in cmpInit packets: indicates which values were adjusted by
// the client(defined below); in cmpWakeup pakcets: null;
// in cmpAbort packets: reason for abort.
DWord commVersion; // in cmpWakeup: server comm software version number;
// in cmpInit: client comm version
DWord baudRate; // in cmpWakeup: max server baud rate;
// in cmpInit packets: the prescribed baud rate
} CmpBodyType;
typedef CmpBodyType* CmpBodyPtr;
// Flags used in the packet body "flags" field of cmpInit
// packets. These values are additive in the sense that they can be
// added or or'ed to form a composite value:
#define cmpInitFlagChangeBaudRate 0x80 // signals that the baud rate was adjusted by the client
// Flags used in the packet body "flags" field of cmpAbort packets.
// These values are additive in the sense that they can be
// added or or'ed to form a composite value:
#define cmpAbortFlagVersionError 0x80 // signals incompatible comm versions
/********************************************************************
* CMP Protocol Parameters
********************************************************************/
// This transaction id is used by cmpWakeup packets. cmpInit and cmpAbort
// packets MUST use a different transaction id.
//
#define cmpWakeupTransactionID 0xFF
// This is the baud rate at which CMP connections are initiated
//
#define cmpInitialBaudRate 9600L
// This is the time limit for trying to initiate a connection
//
#define cmpMaxInitiateSec 20
#endif // __CMCOMMON_H__

View File

@ -0,0 +1,104 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* CMServer.h
*
* Description:
* Connection Management Protocol server definitions.
*
* History:
* 9/14/95 vmk Created by Vitaly Marty Kruglikov
*
*******************************************************************/
#ifndef __CMSERVER_H__
#define __CMSERVER_H__
// Pilot common definitions
#include <Common.h>
//#include <SerialLinkMgr.h>
/************************************************************
* Connection Manager result codes
* (cmpErrorClass is defined in SystemMgr.h)
*************************************************************/
#define cmErrParam (cmpErrorClass | 1) // bad parameter
#define cmErrTimedOut (cmpErrorClass | 2) // connection initiation/listenning timed out
#define cmErrComm (cmpErrorClass | 3) // communication(send/receive) error
#define cmErrCommVersion (cmpErrorClass | 4) // incompatible comm version
#define cmErrMemory (cmpErrorClass | 5) // insufficient memory error
#define cmErrCommBusy (cmpErrorClass | 6) // PAD server is already in use
#define cmErrUserCan (cmpErrorClass | 7) // attempt cancelled by user
/********************************************************************
* Connection Manager Constants
********************************************************************/
/********************************************************************
* Connection Manager Structures
********************************************************************/
typedef Int (*CmAbortProc)(DWord userRef);
typedef struct CmParamType {
UInt localSocket; // -> user's socket
UInt remoteSocket; // -> remote socket
ULong maxBaud; // -> maximum baud rate which can be used
ULong hwShakeAbove; // -> enable HW hand-shake above this baud
Boolean viaModem; // -> set to true if connecting via modem
CmAbortProc abortProc; // -> ptr to abort procedure
DWord userRef; // -> reference value for abort procedure
} CmParamType;
typedef CmParamType* CmParamPtr;
typedef struct CmSessionType {
// Parameters passed by user
CmParamType param; // user parameters
UInt serRefNum; // serial library reference number
} CmSessionType;
typedef CmSessionType* CmSessionPtr;
/********************************************************************
* Connection Manager API Routines
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
// Initiates connection establishment by sending "wakeup" packets
// and listens for connection handshake(called by server).
Err CmBroadcast(CmParamPtr paramP)
SYS_TRAP(sysTrapCmBroadcast);
#ifdef __cplusplus
}
#endif
/********************************************************************
* Connection Manager Macros
********************************************************************/
#endif // __CMSERVER_H__

View File

@ -0,0 +1,51 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* ConsoleMgr.h
*
* Description:
* This module implements simple text in and text out to a console
* application on the other end of the serial port. It talks through
* the Serial Link Manager and sends and receives packets of type slkPktTypeConsole.
*
* History:
* 10/25/94 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifndef __CONSOLEMGR_H__
#define __CONSOLEMGR_H__
/********************************************************************
* Console Manager Routines
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
Err ConPutS(CharPtr message)
SYS_TRAP(sysTrapConPutS);
Err ConGetS(CharPtr message, Long timeout)
SYS_TRAP(sysTrapConGetS);
#ifdef __cplusplus
}
#endif
#endif // __CONSOLEMGR_H__

View File

@ -0,0 +1,64 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1995 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: Crc.h
* AUTHOR: Vitaly Kruglikov: May 10, 1995
*
*
* DESCRIPTION:
* This is the header file for the CRC calculation routines for Pilot.
*
*
* REVISION HISTORY:
* 5/10/95 vmk Initial version.
*
**********************************************************************/
#ifndef __CRC_H__
#define __CRC_H__
// Include elementary types
#include <Common.h>
#include <SystemMgr.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.
//
Word Crc16CalcBlock(VoidPtr bufP, UInt count, Word crc)
SYS_TRAP(sysTrapCrc16CalcBlock);
#ifdef __cplusplus
}
#endif
#endif // __CRC_H__

View File

@ -0,0 +1,190 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* DLClient.h
*
* Description:
* Desktop Link Protocol(DLP) client implementation definitions.
*
* History:
* 7/12/95 vmk Created by Vitaly Marty Kruglikov
*
*******************************************************************/
#define INCLUDE_VIEWER_ID
#ifndef __DL_CLIENT_H__
#define __DL_CLIENT_H__
#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS
// Pilot common definitions
#include "Common.h"
// Desktop Link common definitions
#include "DLCommon.h"
#else // EMULATION_LEVEL != EMULATION_WINDOWS
// Pilot common definitions
#include <Common.h>
// Desktop Link common definitions
#include <DLCommon.h>
#endif // EMULATION_LEVEL == EMULATION_WINDOWS
#if EMULATION_WINDOWS != 1
LOGIC ERROR
#endif
/************************************************************
* DLK result codes
* (dlkErrorClass is defined in SystemMgr.h)
*************************************************************/
#define dlkErrParam (dlkErrorClass | 1) // invalid parameter
#define dlkErrSessClosed (dlkErrorClass | 2) // session closed unexpectedly
#define dlkErrMemory (dlkErrorClass | 3) // memory allocation error
#define dlkErrLocalCan (dlkErrorClass | 4) // cancelled by local user
#define dlkErrNoSession (dlkErrorClass | 5) // could not establish a session
#define dlkErrSizeErr (dlkErrorClass | 6) // reply length is too big
#define dlkErrTooManyClients (dlkErrorClass | 7) // reply length is too big
#define dlkErrBufTooSmall (dlkErrorClass | 8) // reply buffer is too small
#define dlkErrCreate (dlkErrorClass | 9) // error creating database
#define dlkErrNotEnoughSpace (dlkErrorClass | 10) // not enough space on remote
#define dlkErrAlreadyExists (dlkErrorClass | 11) // cannot create a duplicate
#define dlkErrNotFound (dlkErrorClass | 12) // database/record/resource/block not found
#define dlkErrDelete (dlkErrorClass | 13) // delete error
#define dlkErrClose (dlkErrorClass | 14) // close error
#define dlkErrAdd (dlkErrorClass | 15) // add record/resource error
#define dlkErrRead (dlkErrorClass | 16) // read record/resource/block error
#define dlkErrUserInfo (dlkErrorClass | 17) // error reading/writing user info
#define dlkErrReplyFormat (dlkErrorClass | 18) // reply format error
#define dlkErrDeleted (dlkErrorClass | 19) // record was deleted
#define dlkErrOpen (dlkErrorClass | 20) // record was deleted
/********************************************************************
* DLK Session Structures
********************************************************************/
//
// DLP Client session information
//
typedef Int (*DlkAbortProcPtr)(DWord userRef);
typedef struct DlkClientSessionType {
// Information supplied by user
Byte remoteSocket; // server socket
Byte localSocket; // workstation socket
DlkAbortProcPtr abortProcP; // ptr to abort proc
DWord userRef; // user reference value for abort proc
// Session status information
Int numClients; // Number of clients
Byte dlpRefNum; // DLP session reference number
// Reply buffer
WordPtr replyBufP;
ULong replyBufSize;
} DlkClientSessionType;
typedef DlkClientSessionType* DlkClientSessionPtr;
//
// Parameter passed to DlkInitClient()
//
typedef struct DlkClientParamType {
Byte remoteSocket; // server socket for SP
Byte localSocket; // workstation socket
DlkAbortProcPtr abortProcP;
DWord userRef;
} DlkClientParamType;
typedef DlkClientParamType* DlkClientParamPtr;
/********************************************************************
* DLK Routines
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
//
// CLIENT API
//
// * RETURNED: 0 if session ended successfully; otherwise: dlkErrParam,
// * dlkErrNoSession, dlkErrMemory, dlkErrTooManyClients
Err DlkInitClient(DlkClientParamPtr paramP, BytePtr refNumP);
Err DlkClientDone(Byte refNum);
Err DlkSendTickle(Byte refNum);
Err DlkOpenDatabase(Byte refNum, Byte cardNo, CharPtr nameP, Byte mode,
BytePtr dlkDBIDP);
Err DlkCreateDatabase(Byte refNum, Byte cardNo, CharPtr name, Word dbFlags,
DWord creator, DWord type, BytePtr dbIDP);
Err DlkDeleteDatabase(Byte refNum, UInt cardNo, CharPtr nameP);
Err DlkCloseDatabase(Byte refNum, Byte dbID);
Err DlkReadOpenDBInfo(Byte refNum, Byte dbID, WordPtr numRecP);
Err DlkReadAppBlock(Byte refNum, Byte dbID, UInt offset, UInt numBytes,
VoidPtr bufP, UInt bufSize, UIntPtr rcvdLenP, UIntPtr blkSizeP);
Err DlkAddRecord(Byte refNum, Byte dbID, VoidPtr recP,
Word recSize, DWordPtr recIDP);
Err DlkReadRecord(Byte refNum, Byte dbID, UInt index, UInt offset,
UInt numBytes, VoidPtr bufP, UInt bufSize, DWordPtr recIDP,
BytePtr attrP, BytePtr categoryP, UIntPtr rcvdLenP, UIntPtr recSizeP);
Err DlkDeleteAllRecords(Byte RefNum, Byte dbID);
Err DlkWriteUserInfo(Byte refNum, CharPtr userNameP, DWord userID,
DWord lastSyncPC);
Err DlkReadUserInfo(Byte refNum, CharPtr userNameBufP, DWordPtr userIDP,
DWordPtr lastSyncPCP);
Err DlkNotifyOpenConduit(Byte refNum, BooleanPtr cancelP);
Err DlkNotifyEndOfSync(Byte refNum, DlpSyncTermCode termCode);
Err DlkResetRemote(Byte refNum);
Err DlkGetDBNameViaCallAppTest(Byte refNum, Word cardNo, Word index, CharPtr bufP, Word bufSize);
#ifdef __cplusplus
}
#endif
/********************************************************************
* DLK Macros
********************************************************************/
#endif // __DL_CLIENT_H__

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,254 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* DLServer.h
*
* Description:
* Desktop Link Protocol(DLP) Server implementation definitions.
*
* History:
* 7/12/95 vmk Created by Vitaly Marty Kruglikov
*
*******************************************************************/
#ifndef __DL_SERVER_H__
#define __DL_SERVER_H__
// Pilot common definitions
#include <Common.h>
#include <DataMgr.h> // for DmOpenRef
// COMMENT OUT TO BUILD WITHOUT THE VIEWER ID OPTION
#define INCLUDE_VIEWER_ID
/************************************************************
* DLK result codes
* (dlkErrorClass is defined in SystemMgr.h)
*************************************************************/
#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 SystemMgr.rh
********************************************************************/
#define dlkMaxUserNameLength 40
#define dlkUserNameBufSize (dlkMaxUserNameLength + 1)
#define dlkMaxLogSize (2 * 1024)
typedef enum DlkSyncStateType {
dlkSyncStateNeverSynced = 0, // never synced
dlkSyncStateInProgress, // sync is in progress
dlkSyncStateLostConnection, // connection lost during sync
dlkSyncStateLocalCan, // cancelled by local user on TD
dlkSyncStateRemoteCan, // cancelled by user from desktop
dlkSyncStateLowMemoryOnTD, // sync ended due to low memory on TD
dlkSyncStateAborted, // sync was aborted for some other reason
dlkSyncStateCompleted // sync completed normally
} DlkSyncStateType;
typedef struct DlkUserInfoHdrType {
DWord userID; // user id
#ifdef INCLUDE_VIEWER_ID
DWord viewerID; // id assigned to viewer by the desktop
#endif
DWord lastSyncPC; // last sync PC id
ULong succSyncDate; // last successful sync date
ULong lastSyncDate; // last sync date
DlkSyncStateType lastSyncState; // last sync status
Byte userNameLen; // length of name field(including null)
UInt 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
/********************************************************************
* DLK 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 Int (*DlkEventProcPtr)(DWord userRef, DlkEventType dlkEvent,
VoidPtr paramP);
// Parameter structure for dlkEventDatabaseOpened
typedef struct DlkEventDatabaseOpenedType {
CharPtr dbNameP; // database name
ULong dbCreator; // database creator
} DlkEventDatabaseOpenedType;
// Prototype for the "user cancel" check callback function
typedef Int (*DlkUserCanProcPtr)(DWord userRef);
//
// List of modified database creators maintained by DLP Server
//
typedef struct DlkDBCreatorList {
UInt count; // number of entries in the list
Handle listH; // chunk handle of the creators list
} DlkDBCreatorList;
//
// DLP Server session information
//
typedef struct DlkServerSessionType {
// Information supplied by user
Byte sls; // session listenning socket
DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc
DWord userRef; // user reference value for event proc
DlkUserCanProcPtr canProcP; // ptr to user-cancel function
DWord canRef; // parameter for canProcP()
// Current database information
Byte dlkDBID; // Desktop Link database id
DmOpenRef dbP; // TouchDown database access pointer -- if null, no current db
UInt cardNo; // memory module number
ULong dbCreator; // creator id
Char dbName[dmDBNameLength]; // DB name
UInt 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
ULong initialModNum; // initial DB modification number
ULong modRecIndex; // modified record index for
// dlpReadNextModifiedRec(0=beginning)
// List of modified database creators maintained by DLP Server
DlkDBCreatorList creatorList;
// Session status information
DlkSyncStateType 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
Byte cmdTID; // current transaction ID
Word cmdLen; // size of data in request buffer
VoidPtr cmdP; // pointer to command
VoidHand cmdH; // handle of command buffer
Byte remoteSocket; // remote socket id
} DlkServerSessionType;
typedef DlkServerSessionType* DlkServerSessionPtr;
//
// Parameter passed to DlkStartServer()
//
typedef struct DlkServerParamType {
Byte sls; // server listenning socket id for PAD
DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc
DWord userRef; // user reference value for event proc
Int cmdWaitSec; // maximum number of seconds to wait for
// a command (0=default, -1=forever)
DlkUserCanProcPtr canProcP; // ptr to user-cancel function
DWord canRef; // parameter for canProcP()
} DlkServerParamType;
typedef DlkServerParamType* DlkServerParamPtr;
/********************************************************************
* DesktopLink Server Routines
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
//
// SERVER API
//
// * RETURNED: 0 if session ended successfully; otherwise: dlkErrParam,
// * dlkErrNoSession, dlkErrLostConnection, dlkErrMemory,
// * dlkErrUserCan
Err DlkStartServer(DlkServerParamPtr paramP)
SYS_TRAP(sysTrapDlkStartServer);
Err DlkGetSyncInfo(ULongPtr succSyncDateP, ULongPtr lastSyncDateP,
DlkSyncStateType* syncStateP, CharPtr nameBufP,
CharPtr logBufP, ULongPtr logLenP)
SYS_TRAP(sysTrapDlkGetSyncInfo);
// DOLATER... this is a temporary function for debugging modem manager.
// remove it when done.
void DlkSetLogEntry(CharPtr textP, Int textLen, Boolean append)
SYS_TRAP(sysTrapDlkSetLogEntry);
#ifdef __cplusplus
}
#endif
/********************************************************************
* DLK Macros
********************************************************************/
#endif // __DL_SERVER_H__

View File

@ -0,0 +1,56 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* DLUtil.h
*
* Description:
* Desktop Link Protocol(DLP) utility definitions.
*
* History:
* 8/12/95 vmk Created by Vitaly Marty Kruglikov
*
*******************************************************************/
#ifndef __DL_UTIL_H__
#define __DL_UTIL_H__
// Pilot common definitions
#include <Common.h>
// Desktop Link common definitions
#include <DLCommon.h>
/********************************************************************
* Utility Routines
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
Int DlkUtilFillArgWrapper(DlpGenericArgWrapperPtr wrapperP,
Byte argID, Word argSize);
Boolean DlkUtilGetArg(VoidPtr bodyBufP, Word bodySize, Byte argID,
VoidPtr* dataPP, WordPtr dataSizeP);
#ifdef __cplusplus
}
#endif
/********************************************************************
* Utility Macros
********************************************************************/
#endif // __DL_UTIL_H__

View File

@ -0,0 +1,432 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* 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 <Common.h> // Basic types
#include <SysTraps.h> // Trap Numbers.
// Other headers we depend on
#include <MemoryMgr.h>
/************************************************************
* 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
#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
/************************************************************
* Database Header equates
*************************************************************/
#define dmDBNameLength 32 // 31 chars + 1 null terminator
// Attributes of a Database
#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 dmHdrAttrOpen 0x8000 // Database not closed properly
/************************************************************
* 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 VoidPtr DmOpenRef;
/************************************************************
* Structure passed to DmGetNextDatabaseByTypeCreator and used
* to cache search information between multiple searches.
*************************************************************/
typedef struct {
DWord info[8];
} DmSearchStateType;
typedef DmSearchStateType* DmSearchStatePtr;
/************************************************************
* Database manager error codes
* the constant dmErrorClass is defined in SystemMgr.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)
/************************************************************
* Values for the direction parameter of DmSeekRecordInCategory
*************************************************************/
#define dmSeekForward 1
#define dmSeekBackward -1
/************************************************************
* Data Manager procedures
*************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
// Initialization
Err DmInit(void)
SYS_TRAP(sysTrapDmInit);
// Directory Lists
Err DmCreateDatabase(UInt cardNo, const CharPtr nameP,
ULong creator, ULong type, Boolean resDB)
SYS_TRAP(sysTrapDmCreateDatabase);
Err DmCreateDatabaseFromImage(Ptr bufferP)
SYS_TRAP(sysTrapDmCreateDatabaseFromImage);
Err DmDeleteDatabase(UInt cardNo, LocalID dbID)
SYS_TRAP(sysTrapDmDeleteDatabase);
UInt DmNumDatabases(UInt cardNo)
SYS_TRAP(sysTrapDmNumDatabases);
LocalID DmGetDatabase(UInt cardNo, UInt index)
SYS_TRAP(sysTrapDmGetDatabase);
LocalID DmFindDatabase(UInt cardNo, const CharPtr nameP)
SYS_TRAP(sysTrapDmFindDatabase);
Err DmGetNextDatabaseByTypeCreator(Boolean newSearch, DmSearchStatePtr stateInfoP,
ULong type, ULong creator, Boolean onlyLatestVers,
UIntPtr cardNoP, LocalID* dbIDP)
SYS_TRAP(sysTrapDmGetNextDatabaseByTypeCreator);
// Database info
Err DmDatabaseInfo(UInt cardNo, LocalID dbID, const CharPtr nameP,
UIntPtr attributesP, UIntPtr versionP, ULongPtr crDateP,
ULongPtr modDateP, ULongPtr bckUpDateP,
ULongPtr modNumP, LocalID* appInfoIDP,
LocalID* sortInfoIDP, ULongPtr typeP,
ULongPtr creatorP)
SYS_TRAP(sysTrapDmDatabaseInfo);
Err DmSetDatabaseInfo(UInt cardNo, LocalID dbID, const CharPtr nameP,
UIntPtr attributesP, UIntPtr versionP, ULongPtr crDateP,
ULongPtr modDateP, ULongPtr bckUpDateP,
ULongPtr modNumP, LocalID* appInfoIDP,
LocalID* sortInfoIDP, ULongPtr typeP,
ULongPtr creatorP)
SYS_TRAP(sysTrapDmSetDatabaseInfo);
Err DmDatabaseSize(UInt cardNo, LocalID dbID, ULongPtr numRecordsP,
ULongPtr totalBytesP, ULongPtr dataBytesP)
SYS_TRAP(sysTrapDmDatabaseSize);
// Open Databases info
DmOpenRef DmOpenDatabase(UInt cardNo, LocalID dbID, UInt mode)
SYS_TRAP(sysTrapDmOpenDatabase);
DmOpenRef DmOpenDatabaseByTypeCreator(ULong type, ULong creator, UInt mode)
SYS_TRAP(sysTrapDmOpenDatabaseByTypeCreator);
Err DmCloseDatabase(DmOpenRef dbP)
SYS_TRAP(sysTrapDmCloseDatabase);
DmOpenRef DmNextOpenDatabase(DmOpenRef currentP)
SYS_TRAP(sysTrapDmNextOpenDatabase);
Err DmOpenDatabaseInfo(DmOpenRef dbP, LocalID* dbIDP,
UIntPtr openCountP, UIntPtr modeP, UIntPtr cardNoP,
BooleanPtr resDBP)
SYS_TRAP(sysTrapDmOpenDatabaseInfo);
LocalID DmGetAppInfoID (DmOpenRef dbP)
SYS_TRAP(sysTrapDmGetAppInfoID);
// 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
UInt DmNumRecords(DmOpenRef dbP)
SYS_TRAP(sysTrapDmNumRecords);
UInt DmNumRecordsInCategory(DmOpenRef dbP, UInt category)
SYS_TRAP(sysTrapDmNumRecordsInCategory);
Err DmRecordInfo(DmOpenRef dbP, UInt index,
UIntPtr attrP, ULongPtr uniqueIDP, LocalID* chunkIDP)
SYS_TRAP(sysTrapDmRecordInfo);
Err DmSetRecordInfo(DmOpenRef dbP, UInt index,
UIntPtr attrP, ULongPtr uniqueIDP)
SYS_TRAP(sysTrapDmSetRecordInfo);
// Record attaching and detaching
Err DmAttachRecord(DmOpenRef dbP, UIntPtr atP,
Handle newH, Handle* oldHP)
SYS_TRAP(sysTrapDmAttachRecord);
Err DmDetachRecord(DmOpenRef dbP, UInt index,
Handle* oldHP)
SYS_TRAP(sysTrapDmDetachRecord);
Err DmMoveRecord(DmOpenRef dbP, UInt from, UInt to)
SYS_TRAP(sysTrapDmMoveRecord);
// Record creation and deletion
VoidHand DmNewRecord(DmOpenRef dbP, UIntPtr atP,
ULong size)
SYS_TRAP(sysTrapDmNewRecord);
Err DmRemoveRecord(DmOpenRef dbP, UInt index)
SYS_TRAP(sysTrapDmRemoveRecord);
Err DmDeleteRecord(DmOpenRef dbP, UInt index)
SYS_TRAP(sysTrapDmDeleteRecord);
Err DmArchiveRecord(DmOpenRef dbP, UInt index)
SYS_TRAP(sysTrapDmArchiveRecord);
VoidHand DmNewHandle(DmOpenRef dbP, ULong size)
SYS_TRAP(sysTrapDmNewHandle);
Err DmRemoveSecretRecords(DmOpenRef dbP)
SYS_TRAP(sysTrapDmRemoveSecretRecords);
// Record viewing manipulation
Err DmFindRecordByID(DmOpenRef dbP, ULong uniqueID, UIntPtr indexP)
SYS_TRAP(sysTrapDmFindRecordByID);
VoidHand DmQueryRecord(DmOpenRef dbP, UInt index)
SYS_TRAP(sysTrapDmQueryRecord);
VoidHand DmGetRecord(DmOpenRef dbP, UInt index)
SYS_TRAP(sysTrapDmGetRecord);
VoidHand DmQueryNextInCategory(DmOpenRef dbP, UIntPtr indexP, UInt category)
SYS_TRAP(sysTrapDmQueryNextInCategory);
UInt DmPositionInCategory (DmOpenRef dbP, UInt index, UInt category)
SYS_TRAP(sysTrapDmPositionInCategory);
Err DmSeekRecordInCategory (DmOpenRef dbP, UIntPtr indexP, Int offset,
Int direction, UInt category)
SYS_TRAP(sysTrapDmSeekRecordInCategory);
VoidHand DmResizeRecord(DmOpenRef dbP, UInt index, ULong newSize)
SYS_TRAP(sysTrapDmResizeRecord);
Err DmReleaseRecord(DmOpenRef dbP, UInt index, Boolean dirty)
SYS_TRAP(sysTrapDmReleaseRecord);
Int DmSearchRecord(VoidHand recH, DmOpenRef* dbPP)
SYS_TRAP(sysTrapDmSearchRecord);
// Category manipulation
Err DmMoveCategory (DmOpenRef dbP, UInt toCategory, UInt fromCategory, Boolean dirty)
SYS_TRAP(sysTrapDmMoveCategory);
// Validation for writing
Err DmWriteCheck(VoidPtr recordP, ULong offset, ULong bytes)
SYS_TRAP(sysTrapDmWriteCheck);
// Writing
Err DmWrite(VoidPtr recordP, ULong offset, VoidPtr srcP, ULong bytes)
SYS_TRAP(sysTrapDmWrite);
Err DmStrCopy(VoidPtr recordP, ULong offset, CharPtr srcP)
SYS_TRAP(sysTrapDmStrCopy);
Err DmSet(VoidPtr recordP, ULong offset, ULong bytes, Byte value)
SYS_TRAP(sysTrapDmSet);
//------------------------------------------------------------
// Resource based access routines
//------------------------------------------------------------
// High level access routines
VoidHand DmGetResource(ULong type, Int id)
SYS_TRAP(sysTrapDmGetResource);
VoidHand DmGet1Resource(ULong type, Int id)
SYS_TRAP(sysTrapDmGet1Resource);
Err DmReleaseResource(VoidHand resourceH)
SYS_TRAP(sysTrapDmReleaseResource);
VoidHand DmResizeResource(VoidHand resourceH, ULong newSize)
SYS_TRAP(sysTrapDmResizeResource);
// Searching resource databases
DmOpenRef DmNextOpenResDatabase(DmOpenRef dbP)
SYS_TRAP(sysTrapDmNextOpenResDatabase);
Int DmFindResourceType(DmOpenRef dbP, ULong resType, Int typeIndex)
SYS_TRAP(sysTrapDmFindResourceType);
Int DmFindResource(DmOpenRef dbP, ULong resType, Int resID,
VoidHand resH)
SYS_TRAP(sysTrapDmFindResource);
Int DmSearchResource(ULong resType, Int resID,
VoidHand resH, DmOpenRef* dbPP)
SYS_TRAP(sysTrapDmSearchResource);
// Resource Info
UInt DmNumResources(DmOpenRef dbP)
SYS_TRAP(sysTrapDmNumResources);
Err DmResourceInfo(DmOpenRef dbP, Int index,
ULongPtr resTypeP, IntPtr resIDP,
LocalID* chunkLocalIDP)
SYS_TRAP(sysTrapDmResourceInfo);
Err DmSetResourceInfo(DmOpenRef dbP, Int index,
ULongPtr resTypeP, IntPtr resIDP)
SYS_TRAP(sysTrapDmSetResourceInfo);
// Resource attaching and detaching
Err DmAttachResource(DmOpenRef dbP, VoidHand newH,
ULong resType, Int resID)
SYS_TRAP(sysTrapDmAttachResource);
Err DmDetachResource(DmOpenRef dbP, Int index,
VoidHand* oldHP)
SYS_TRAP(sysTrapDmDetachResource);
// Resource creation and deletion
VoidHand DmNewResource(DmOpenRef dbP, ULong resType, Int resID,
ULong size)
SYS_TRAP(sysTrapDmNewResource);
Err DmRemoveResource(DmOpenRef dbP, Int index)
SYS_TRAP(sysTrapDmRemoveResource);
// Resource manipulation
VoidHand DmGetResourceIndex(DmOpenRef dbP, Int index)
SYS_TRAP(sysTrapDmGetResourceIndex);
typedef Int DmComparF (void *, void *, Int other);
Err DmQuickSort(const DmOpenRef dbP, DmComparF *compar, Int other)
SYS_TRAP(sysTrapDmQuickSort);
Err DmInsertionSort (const DmOpenRef dbR, DmComparF *compar, Int other)
SYS_TRAP(sysTrapDmInsertionSort);
UInt DmFindSortPosition(DmOpenRef dbP, VoidPtr newRecord,
DmComparF *compar, Int other)
SYS_TRAP(sysTrapDmFindSortPosition);
#ifdef __cplusplus
}
#endif
#endif // __DATAMGR_H__

View File

@ -0,0 +1,212 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* DataPrv.h
*
* Description:
* Private Header for the Data Manager
*
* History:
* 8/10/95 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifdef NON_PORTABLE
#ifndef __DATAPRV_H__
#define __DATAPRV_H__
/************************************************************
* Structure of a Record entry
*************************************************************/
typedef struct {
LocalID localChunkID; // local chunkID of a record
Byte attributes; // record attributes;
Byte 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 {
DWord type; // resource type
Word 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
Word numRecords; // number of records in this list
Word firstEntry; // array of Record/Rsrc entries
// starts here
} RecordListType;
typedef RecordListType* RecordListPtr;
/************************************************************
* Structure of a Database Header
*************************************************************/
typedef struct {
Byte name[dmDBNameLength]; // name of database
Word attributes; // database attributes
Word version; // version of database
DWord creationDate; // creation date of database
DWord modificationDate; // latest modification date
DWord lastBackupDate; // latest backup date
DWord modificationNumber; // modification number of database
LocalID appInfoID; // application specific info
LocalID sortInfoID; // app specific sorting info
DWord type; // database type
DWord creator; // database creator
DWord 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;
typedef DatabaseHdrPtr* DatabaseHdrHand;
/************************************************************
* 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.
*************************************************************/
typedef struct {
LocalID nextDatabaseListID; // continuation list, if any
Word numDatabases; // # of database ID's in this list
LocalID databaseID[1]; // ChunkID of each 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 {
VoidPtr next; // ptr to next access structure
UInt openCount; // incremented every time it's opened
ULong ownerTaskID; // taskID of owner
UInt exclusive : 1; // true if opened with exclusive access
UInt writeAccess : 1; // true if opened with write access
UInt resDB : 1; // true if resource database
LocalID hdrID; // local ID of database header
DatabaseHdrHand hdrH; // Database header handle
DatabaseHdrPtr hdrP; // Database header ptr for faster access
UInt cardNo; // card number of database
UInt numRecords; // cached here for better performance
Ptr hdrMasterP; // master ptr to header if ROM based
Ptr* 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; // ptr to next access structure
UInt mode; // mode it was opened in
DmOpenInfoPtr openP; // ptr to DmOpenInfoType for database
} 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.
*************************************************************/
typedef struct {
Int index;
UInt relIndex;
SByte cardNo;
SByte storeNo;
UInt storeEntries;
UInt storeStartIndex;
LocalID dirID;
} DmPrvSearchStateType;
typedef DmPrvSearchStateType* DmPrvSearchStatePtr;
/************************************************************
* 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 __cplusplus
extern "C" {
#endif
Err DmMoveOpenDBContext(DmAccessPtr* listHeadP, DmAccessPtr dbP)
SYS_TRAP(sysTrapDmMoveOpenDBContext);
#ifdef __cplusplus
}
#endif
#endif // __DATAPRV_H__
#endif //NON_PORTABLE

View File

@ -0,0 +1,209 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* DateTime.h
*
* Description:
* Date and Time calculations
*
* History:
* 1/19/95 rsf - Created by Roger Flores
*
*
*******************************************************************/
#ifndef __DATETIME_H__
#define __DATETIME_H__
typedef DWord time_t;
typedef struct {
SWord second;
SWord minute;
SWord hour;
SWord day;
SWord month;
SWord year;
SWord 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 {
Byte hours;
Byte 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 {
Word year :7; // years since 1904 (MAC format)
Word month :4;
Word 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 firstYear 1904
#define numberOfYears 128
#define lastYear (firstYear + numberOfYears - 1)
// Constants for time calculations
// Could change these from xIny to yPerX
#define minutesInSeconds 60
#define hoursInMinutes 60
#define hoursInSeconds (hoursInMinutes * minutesInSeconds)
#define hoursPerDay 24
//#define daysInSeconds ((long)(hoursPerDay) * ((long)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 ((ULong) numberOfYears / 4 * daysInFourYears - 1)
#define maxSeconds ((ULong) maxDays * daysInSeconds)
#define maxTime 0x
// 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;
//************************************************************
//* Date and Time macros
//***********************************************************
// Convert a date in a DateType structure to an unsigned int.
#define DateToInt(date) (*(UInt *) &date)
// Convert a date in a DateType structure to an unsigned int.
#define TimeToInt(time) (*(Int *) &time)
//************************************************************
//* Date Time procedures
//************************************************************
#ifdef __cplusplus
extern "C" {
#endif
void TimSecondsToDateTime(ULong seconds, DateTimePtr dateTimeP)
SYS_TRAP(sysTrapTimSecondsToDateTime);
ULong TimDateTimeToSeconds(DateTimePtr dateTimeP)
SYS_TRAP(sysTrapTimDateTimeToSeconds);
void TimAdjust(DateTimePtr dateTimeP, Long adjustment)
SYS_TRAP(sysTrapTimAdjust);
void TimeToAscii(Byte hours, Byte minutes, TimeFormatType timeFormat,
CharPtr pString)
SYS_TRAP(sysTrapTimeToAscii);
UInt DaysInMonth(UInt month, UInt year)
SYS_TRAP(sysTrapDaysInMonth);
UInt DayOfWeek (UInt month, UInt day, UInt year)
SYS_TRAP(sysTrapDayOfWeek);
UInt DayOfMonth (UInt month, UInt day, UInt year)
SYS_TRAP(sysTrapDayOfMonth);
// Date routines.
void DateSecondsToDate (ULong seconds, DatePtr date)
SYS_TRAP(sysTrapDateSecondsToDate);
void DateDaysToDate (ULong days, DatePtr date)
SYS_TRAP(sysTrapDateDaysToDate);
ULong DateToDays (DateType date)
SYS_TRAP(sysTrapDateToDays);
void DateAdjust (DatePtr dateP, Long adjustment)
SYS_TRAP(sysTrapDateAdjust);
void DateToAscii(Byte months, Byte days, Word years,
DateFormatType dateFormat, CharPtr pString)
SYS_TRAP(sysTrapDateToAscii);
void DateToDOWDMFormat(Byte months, Byte days, Word years,
DateFormatType dateFormat, CharPtr pString)
SYS_TRAP(sysTrapDateToDOWDMFormat);
#ifdef __cplusplus
}
#endif
#endif //__DATETIME_H__

View File

@ -0,0 +1,80 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* DebugMgr.h
*
* Description:
* Debugging functions
*
* History:
* 11/03/94 RM - Created by Ron Marianetti
*
*
*******************************************************************/
#ifndef __DEBUGMGR_H__
#define __DEBUGMGR_H__
// Include elementary types
#include <Common.h> // Basic types
#include <SysTraps.h> // Trap Numbers.
/************************************************************
* Prototypes
*************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
Long DbgInit(Ptr spaceP, Ptr dispatchTableP[], Boolean openComm);
#ifdef __GNUC__
static inline
#endif
void DbgSrcBreak(void)
ONEWORD_INLINE(m68kTrapInstr+sysDbgTrapNum);
void DbgSrcMessage(char* debugStr)
SYS_TRAP(sysTrapDbgSrcMessage);
#if EMULATION_LEVEL == EMULATION_NONE
#ifdef __GNUC__
static inline
#endif
void DbgBreak(void) ONEWORD_INLINE(m68kTrapInstr+sysDbgTrapNum);
#else
void DbgBreak(void);
#endif
void DbgMessage(char* aStr)
SYS_TRAP(sysTrapDbgMessage);
CharPtr DbgGetMessage(BytePtr bufferP, Long timeout)
SYS_TRAP(sysTrapDbgGetMessage);
Err DbgCommSettings(ULongPtr baudP, ULongPtr flagsP)
SYS_TRAP(sysTrapDbgCommSettings);
#ifdef __cplusplus
}
#endif
/************************************************************
* Assembly Function Prototypes
*************************************************************/
#define _DbgBreak \
DC.W m68kTrapInstr+sysDbgTrapNum
#endif // __DEBUGMGR_H__

View File

@ -0,0 +1,348 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* 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 0x0300 // 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 {
Ptr 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
Word exceptionId; // exception which caused the
// debugger to be entered.
M68KRegsType reg; // current remote registers.
Word 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.
Byte trapTableRev; // rev of trap table. Used to determine
// when host's trap table cache is invalid
} 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
DWord ssAddr; // step spy address
DWord ssCount; // # of bytes
DWord 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;
} SysPktDbgBreakToggleRspType;
typedef SysPktDbgBreakToggleRspType* SysPktDbgBreakToggleRspPtr;
//--------------------------------------------------------------------
// sysPktFlashCmd
// 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
Word numBytes; // -> # of bytes in sector
DWord flashBase; // -> base address of FLASH, or 0 for default
DWord srcAddr; // -> source address of new data
DWord dstAddr; // -> dest address in flash memory
Byte manuf; // <- manufacturer
Byte device; // <- device
Byte width; // <- Flash memory width
Byte filler;
DWord ramSpaceP; // <- available space in RAM for sector
} SysPktFlashWriteType;
typedef SysPktFlashWriteType* SysPktFlashWritePtr;
//--------------------------------------------------------------------
// sysPktGetTrapBreaksCmd
//
// - Get Trap Breaks
//--------------------------------------------------------------------
typedef struct SysPktGetTrapBreaksCmdType {
_sysPktBodyCommon; // Common Body header
} SysPktGetTrapBreaksCmdType;
typedef SysPktGetTrapBreaksCmdType* SysPktGetTrapBreaksCmdPtr;
typedef struct SysPktGetTrapBreaksRspType {
_sysPktBodyCommon; // Common Body header
//Word trapBP[dbgTotalTrapBreaks];
} SysPktGetTrapBreaksRspType;
typedef SysPktGetTrapBreaksRspType* SysPktGetTrapBreaksRspPtr;
//--------------------------------------------------------------------
// sysPktSetTrapBreaksCmd
//
// - Set Trap Breaks
//--------------------------------------------------------------------
typedef struct SysPktSetTrapBreaksCmdType {
_sysPktBodyCommon; // Common Body header
//Word trapBP[dbgTotalTrapBreaks];
} SysPktSetTrapBreaksCmdType;
typedef SysPktSetTrapBreaksCmdType* SysPktSetTrapBreaksCmdPtr;
typedef struct SysPktSetTrapBreaksRspType {
_sysPktBodyCommon; // Common Body header
} SysPktSetTrapBreaksRspType;
typedef SysPktSetTrapBreaksRspType* SysPktSetTrapBreaksRspPtr;
// 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.
#define dbgSerRsvGlobalsSize 56
/***********************************************************************
* 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];
Word bpOpcode[dbgTotalBreakpoints];
// Current trap breaks
Word trapBreak[dbgTotalTrapBreaks];
DWord 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.
DWord ssAddr; // address to step spy on
DWord ssValue; // saved value
// Exception type
Word excType; // why we entered debugger
Byte reEntered; // true if we re-entered
Byte firstEntrance; // true first time we enter debugger
// Debugger Serial Library globals
Byte serGlobals[dbgSerRsvGlobalsSize]; // Debugger Serial globals
// Debugger Stack
Byte stack[dbgStackSize]; // Debugger stack
Word stackEnd; // End of stack
};
typedef struct DbgGlobalsType DbgGlobalsType;
typedef DbgGlobalsType* DbgGlobalsPtr;
#endif // __DEBUGMGR_H__
#endif // NON_PORTABLE

View File

@ -0,0 +1,122 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* EmuStubs.h
*
* Description:
* Stub routines used only when emulating.
*
* Note: All of these routines must be declared using generic
* C types so that this header file can be included in both
* Pilot source code and Mac or PC source code.
*
* The module that contains these routines "MacStubs.c" or
* "PCStubs.c" is the glue between the Pilot routines and the OS and
* does not include any Pilot headers.
*
* History:
* 11/03/94 RM - Created by Ron Marianetti
*
*
*******************************************************************/
#ifndef __EMUSTUBS_H__
#define __EMUSTUBS_H__
/************************************************************
* Prototypes
*************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
// Screen Driver Stubs
void StubDrawNotify(void* srcWinP, short scrRowBytes,
short fromX, short fromY, short width, short height);
// Console stubs
int StubConPutS(char* cstring);
int StubConGetS(char* cstring);
// Debugger Stubs
void StubDbgSrcBreak(void);
void StubDbgSrcMessage(char* debugStr);
void StubDbgBreak(void);
void StubDbgMessage(char* aStr);
// Time Manager Stubs
unsigned long StubTimGetTicks(void);
unsigned long StubTimGetSeconds(void);
void StubTimSetSeconds(unsigned long seconds);
// Event Manager Stubs
void StubProcessMacEvents(long timeout);
void StubEnqueuePenPosition(void);
void StubFlushEvents (void);
// Emulator Stubs
Boolean StubNilEventPending();
// Error Manager stubs
void StubErrDisplayFileLineMsg(char* filename, unsigned int lineNo, char* msg);
// Sound Manager stubs
#define stubSndErrBadParam -1
#define stubSndErrBadChannel -2
#define stubSndCmdFreqDurationAmp 1
short StubSndCommand(void* channelP, unsigned short defAmp,
unsigned short cmd, unsigned long param1,
unsigned short param2, unsigned short param3,
char noWait);
// Alarm Manager stubs
short StubAlmSetAlarm(unsigned long alarmType,
long (*callback)(), unsigned long alarmTime);
unsigned long StubAlmGetAlarm(unsigned long alarmType);
void StubAlmDisplayAlarm(void);
// Emulator Utility Functions
void StubEventTrace(void *eventP); // Pilot Emulator Event Trace call
// Resource Utility Functions
void** StubGet1Resource(unsigned long resType, int resID);
// Utility functions
unsigned int StubRandom(void);
// Key Manager stubs
unsigned long StubKeyCurrentState(void);
#define stubKeyBitPower 0x0001
#define stubKeyBitPageUp 0x0002
#define stubKeyBitPageDown 0x0004
#define stubKeyBitHard1 0x0008
#define stubKeyBitHard2 0x0010
#define stubKeyBitHard3 0x0020
#define stubKeyBitHard4 0x0040
#ifdef __cplusplus
}
#endif
#endif // __EMUSTUBS_H__

View File

@ -0,0 +1,261 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* ErrorMgr.h
*
* Description:
* Include file for Error Management
*
* History:
* 10/25/94 RM - Created by Ron Marianetti
*
*-----------------------------------------------------------------------
* 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 __ERRORMGR_H__
#define __ERRORMGR_H__
// Include elementary types
#include <Common.h> // Basic types
#include <SysTraps.h> // Trap Numbers.
#if EMULATION_LEVEL != EMULATION_NONE
#include <setjmp.h>
#endif
/************************************************************
* Macros for Showing Errors
*
********************************************************************/
//------------------------------------------------------------
// Full Error Checking
//------------------------------------------------------------
#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL
#define ErrFatalDisplayIf(condition, msg) \
if (condition) ErrDisplayFileLineMsg(__FILE__, __LINE__, msg)
#define ErrNonFatalDisplayIf(condition, msg) \
if (condition) ErrDisplayFileLineMsg(__FILE__, __LINE__, msg)
#define ErrDisplay(msg) \
ErrDisplayFileLineMsg(__FILE__, __LINE__, msg)
//------------------------------------------------------------
// Fatal Error Checking Only
//------------------------------------------------------------
#elif ERROR_CHECK_LEVEL == ERROR_CHECK_PARTIAL
#define ErrFatalDisplayIf(condition, msg) \
if (condition) ErrDisplayFileLineMsg(__FILE__, __LINE__, msg)
#define ErrNonFatalDisplayIf(condition, msg)
#define ErrDisplay(msg) \
ErrDisplayFileLineMsg(__FILE__, __LINE__, msg)
//------------------------------------------------------------
// No Error Checking
//------------------------------------------------------------
#elif ERROR_CHECK_LEVEL == ERROR_CHECK_NONE
#define ErrFatalDisplayIf(condition, msg)
#define ErrNonFatalDisplayIf(condition, msg)
#define ErrDisplay(msg)
//------------------------------------------------------------
// Not Defined...
//------------------------------------------------------------
#else
#error ERROR: the compiler define 'ERROR_CHECK_LEVEL' must be defined!
#endif // ERROR_CHECK_LEVEL
/********************************************************************
* 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
********************************************************************/
typedef long* ErrJumpBuf[12]; // D3-D7,PC,A2-A7
#if EMULATION_LEVEL != EMULATION_NONE
#define ErrJumpBuf jmp_buf
#endif
// Structure used to store Try state.
typedef struct ErrExceptionType {
struct ErrExceptionType* nextP; // next exception type
ErrJumpBuf state; // setjmp/longjmp storage
Long err; // Error code
} ErrExceptionType;
typedef ErrExceptionType* ErrExceptionPtr;
// Try & Catch macros
#define ErrTry \
{ \
ErrExceptionType _TryObject; \
_TryObject.err = 0; \
_TryObject.nextP = (ErrExceptionPtr)*ErrExceptionList(); \
*ErrExceptionList() = (Ptr)&_TryObject; \
if (ErrSetJump(_TryObject.state) == 0) {
#define ErrCatch(theErr) \
*ErrExceptionList() = (Ptr)_TryObject.nextP; \
} \
else { \
Long theErr = _TryObject.err; \
*ErrExceptionList() = (Ptr)_TryObject.nextP;
#define ErrEndCatch \
} \
}
/********************************************************************
* Error Manager Routines
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#if EMULATION_LEVEL != EMULATION_NONE
#define ErrSetJump(buf) setjmp(buf)
#define ErrLongJump(buf,res) longjmp(buf,res)
#else
Int ErrSetJump(ErrJumpBuf buf)
SYS_TRAP(sysTrapErrSetJump);
void ErrLongJump(ErrJumpBuf buf, Int result)
SYS_TRAP(sysTrapErrLongJump);
#endif
Ptr* ErrExceptionList(void)
SYS_TRAP(sysTrapErrExceptionList);
void ErrThrow(Long err)
SYS_TRAP(sysTrapErrThrow);
void ErrDisplayFileLineMsg(CharPtr filename, UInt lineno, CharPtr msg)
SYS_TRAP(sysTrapErrDisplayFileLineMsg);
#ifdef __cplusplus
}
#endif
#endif // __ERRORMGR_H__

View File

@ -0,0 +1,26 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: window.h
* AUTHOR: Art Lamb: September 12, 1994
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines window structures and routines.
*
**********************************************************************/
#ifndef __FATAL_ALERT_H__
#define __FATAL_ALERT_H__
// Value retunred by FatalAlert
#define fatalContinue 0
#define fatalReset 1
UInt SysFatalAlert (CharPtr msg)
SYS_TRAP(sysTrapSysFatalAlert);
#endif

View File

@ -0,0 +1,74 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* FeatureMgr.h
*
* Description:
* Header for the Feature Manager
*
* History:
* 11/14/94 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifndef __FEATUREMGR_H__
#define __FEATUREMGR_H__
#include <Common.h>
/************************************************************
* Feature manager error codes
* the constant ftrErrorClass is defined in SystemMgr.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 __cplusplus
extern "C" {
#endif
// Init the feature Manager
Err FtrInit(void)
SYS_TRAP(sysTrapFtrInit);
// Get a feature
Err FtrGet(DWord creator, UInt featureNum, DWordPtr valueP)
SYS_TRAP(sysTrapFtrGet);
// Set/Create a feature.
Err FtrSet(DWord creator, UInt featureNum, DWord newValue)
SYS_TRAP(sysTrapFtrSet);
// Unregister a feature
Err FtrUnregister(DWord creator, UInt featureNum)
SYS_TRAP(sysTrapFtrUnregister);
// Get a feature by index
Err FtrGetByIndex(UInt index, Boolean romTable,
DWordPtr creatorP, UIntPtr numP, DWordPtr valueP)
SYS_TRAP(sysTrapFtrGetByIndex);
#ifdef __cplusplus
}
#endif
#endif // __FEATUREMGR_H__

View File

@ -0,0 +1,77 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* FeaturePrv.h
*
* Description:
* Private Header for the Feature Manager
*
* History:
* 8/9/95 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifdef NON_PORTABLE
#ifndef __FEATUREPRV_H__
#define __FEATUREPRV_H__
/************************************************************
* Structure of a Feature Table
*************************************************************/
typedef struct FtrFeatureType {
UInt num; // feature number
DWord value; // feature value
} FtrFeatureType;
typedef FtrFeatureType* FtrFeaturePtr;
typedef struct FtrCreatorType {
DWord creator; // feature creator
UInt numEntries; // # of entries
FtrFeatureType feature[1]; // variable size array of Features
} FtrCreatorType;
typedef FtrCreatorType* FtrCreatorPtr;
typedef struct FtrTableType {
UInt numEntries; // # of entries
FtrCreatorType creator[1]; // var. size array of Creators
} FtrTableType;
typedef FtrTableType* FtrTablePtr;
typedef FtrTablePtr* FtrTableHand;
/************************************************************
* Structure of a Feature Manager Globals
*************************************************************/
typedef struct FtrGlobalsType {
FtrTableHand romTableH; // ROM table of features
FtrTableHand ramTableH; // RAM table of features
} FtrGlobalsType;
typedef FtrGlobalsType* FtrGlobalsPtr;
/************************************************************
* Private structures
*************************************************************/
// This structure created for temporary use within calls
typedef struct FtrCacheType {
FtrTableHand romTableH; // ROM table of features
FtrTableHand ramTableH; // RAM table of features
FtrTablePtr romTableP;
FtrTablePtr ramTableP;
} FtrCacheType;
typedef FtrCacheType* FtrCachePtr;
#endif // __FEATUREPRV_H__
#endif // NON_PORTABLE

View File

@ -0,0 +1,105 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* FloatMgr.h
*
* Description:
* Floating point routines
*
* History:
* 3/9/95 - Created by Ron Marianetti
*
*******************************************************************/
#ifndef __FLOATMGR_H__
#define __FLOATMGR_H__
#include <Common.h>
/************************************************************************
* Constants
***********************************************************************/
#define fMaxLong ((Long)0x7FFFFFFF);
#define fMinLong ((Long)0x80000000);
/************************************************************************
* Floating point type
* An exponent of kExpInf represents infinity
***********************************************************************/
typedef struct {
DWord man; // unsigned 32 bit
SWord exp; // signed 16 bit
SByte sign; // +/- 1
} FloatType;
#define kExpInf 16000
/*******************************************************************
* Floating pointer Library Errors
* The constant fplErrorClass is defined in SystemMgr.h
*******************************************************************/
#define fplErrOutOfRange (fplErrorClass | 1)
/************************************************************
* Floating point manager procedures
*************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
Err FplInit(void)
SYS_TRAP(sysTrapFplInit);
void FplFree(void)
SYS_TRAP(sysTrapFplFree);
Err FplFToA(FloatType a, char* s)
SYS_TRAP(sysTrapFplFToA);
FloatType FplAToF(char* s)
SYS_TRAP(sysTrapFplAToF);
Err FplBase10Info(FloatType a, ULong* mantissaP, Int* exponentP,
Int* signP)
SYS_TRAP(sysTrapFplBase10Info);
FloatType FplLongToFloat(Long x)
SYS_TRAP(sysTrapFplLongToFloat);
Long FplFloatToLong(FloatType f)
SYS_TRAP(sysTrapFplFloatToLong);
ULong FplFloatToULong(FloatType f)
SYS_TRAP(sysTrapFplFloatToULong);
FloatType FplMul(FloatType a, FloatType b)
SYS_TRAP(sysTrapFplMul);
FloatType FplAdd(FloatType a, FloatType b)
SYS_TRAP(sysTrapFplAdd);
FloatType FplSub(FloatType a, FloatType b)
SYS_TRAP(sysTrapFplSub);
FloatType FplDiv(FloatType dividend, FloatType divisor)
SYS_TRAP(sysTrapFplDiv);
#ifdef __cplusplus
}
#endif
#endif //__FLOATMGR_H__
/******************************************************************* * Pilot Software * * Copyright(c) 1994, Palm Computing Inc., All Rights Reserved * *------------------------------------------------------------------- * FileName: * FloatMgr.h * * Description: * Floating point routines * * History: * 3/9/95 - Created by Ron Marianetti * *******************************************************************/ #ifndef __FLOATMGR_H__#define __FLOATMGR_H__#include <Common.h>/************************************************************************ * Constants ***********************************************************************/#define fMaxLong ((Long)0x7FFFFFFF);#define fMinLong ((Long)0x80000000);/************************************************************************ * Floating point type * An exponent of kExpInf represents infinity ***********************************************************************/typedef struct { DWord man; // unsigned 32 bit SWord exp; // signed 16 bit SByte

View File

@ -0,0 +1,36 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* FloatPrv.h
*
* Description:
* Private Floating point header
*
* History:
* 3/9/95 - Created by Ron Marianetti
*
*******************************************************************/
#ifdef NON_PORTABLE
#ifndef __FLOATPRV_H__
#define __FLOATPRV_H__
/************************************************************************
* Structure of Floating point Library globals
***********************************************************************/
typedef struct {
FloatType tenPowers[200]; // 10^-99 to 10^99
} FplGlobalsType;
typedef FplGlobalsType* FplGlobalsPtr;
#endif //__FLOATPRV_H__
#endif // NON_PORTABLE

View File

@ -0,0 +1,286 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* 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
*
*******************************************************************/
#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.
#define sysUIRsvGlobalsSize 0xA0
/************************************************************
* Structure of Fixed System Globals
*************************************************************/
typedef struct FixedGlobalsType {
// Memory Manager Globals
Byte memCardSlots; // number of memory card slots
Byte dbgWasEntered; // set true the first time debugger is entered
Ptr memCardInfoP; // pointer to array of CardInfoTypes stored
DWord memSemaphoreID; // Memory Manager semaphore
Word memDebugMode; // Current debug mode of Memory Manager
// Data Manager Globals
Ptr dmOpenList; // Linked list of open databases (DmOpenInfoPtr)
// Debugger/System Shared globals
Byte dbgInDebugger; // true if in debugger
Byte dbgTracing; // tracing in debugger
Ptr dbgGlobalsP; // pointer to dbgGlobals
Ptr dbgSerGlobalsP; // pointer to Debugger Serial globals
// System Manager Globals
Ptr sysAppInfoP; // pointer to SysAppInfoType for system
Ptr sysKernelDataP; // pointer to Kernel data
Ptr* sysDispatchTableP; // pointer to dispatch table
DWord sysOwnerIDsInUse; // 1 bit for each owner ID in use
Ptr sysAMXAppInfoP; // SysAppInfoType for AMX app.
DWord sysClockFreq; // processor clock frequency
DWordPtr sysHardKeyCreators; // ptr to array of App Creator types
SWord sysBatteryCheckTimer; // # of ticks left before we check battery again
Byte sysBatteryMinThreshold; // System will shut down if battery falls below this
Byte hwrBatteryLevel; // current battery level
SWord sysNextBatteryAlertTimer; // # of ticks till next battery warning
Byte sysBatteryWarnThreshold; // If battery below this level, post low battery keyboard event
Byte sysDispatchTableRev; // incremented every time a trap is patched. Used
// by host debugger to invalidate it's cache.
Word sysDispatchTableSize; // # of entries in dispatch table
Ptr sysLibTableP; // (SysLibTblEntryPtr) pointer to Library entries
Word sysLibTableEntries; // size of library table
Ptr sysConsoleStackChunkP; // pointer to console task stack chunk
Ptr sysUIShellAppInfoP; // AppInfoPtr for UIAppShell
Long sysTimerID; // TimerID of timer used for periodic system stuff
ULong sysAutoOffEvtTicks; // Ticks of last event - used to support auto-off
Word sysAutoOffSeconds; // Auto-sleep timeout in seconds.
Long sysRandomSeed; // Random # seed
// Other Manager's globals
Ptr slkGlobalsP; // pointer to serial link globals
Ptr serGlobalsP; // pointer to serial manager globals
Ptr scrGlobalsP; // pointer to screen driver globals
Ptr fplGlobalsP; // pointer to Floating Point Library globals
Ptr penGlobalsP; // Pen manager globals ptr
Ptr sysEvtMgrGlobalsP; // System Event Manager Globals
Ptr sndGlobalsP; // Sound Manager globals
Ptr timGlobalsP; // Time Manager globals
Ptr almGlobalsP; // Alarm Manager globals
Ptr ftrGlobalsP; // pointer to feature manager globals
Ptr grfGlobalsP; // pointer to Graffiti globals
Ptr keyGlobalsP; // Key manager globals
// UI Globals
Byte uiGlobals[sysUIRsvGlobalsSize]; // Basic UI Globals
Ptr uiExtensionsP; // for future use...
// Globals used by UIAppShell in order to manage the launching of UI Apps.
Ptr curUIAppInfoP; // SysAppInfoPtr of current UI App
DWord nextUIAppDBID; // Database LocalID of next UI App to launch
Word nextUIAppCmd; // Cmd for next UI App
Ptr nextUIAppCmdPBP; // Cmd ParamBlock Ptr for next UI App
Byte nextUIAppCardNo; // Card number of next UI App to launch
// Hardware Manager Globals
SByte hwrDataWELevel; // if > 0, Data area is write enabled
Word hwrWakeUp; // Bit mask of which peripherals need to be
// enabled when system wakes
Byte hwrCPUDutyCycle; // Desired Duty cycle of CPU in 31ths.
Byte hwrPenDown; // last state of pen-down
DWord hwrCurTicks; // Current hardware tickCount -
// maintained separately from AMX ticks for performance reasons.
DWord hwrTotalRAMSize; // total RAM Size, used by HwrMemWritable
DWord hwrDozeSubTicks; // # of subTicks we've dozed for since reset
// a sub-tick is 1/4096 seconds.
// Pad server
Ptr padGlobalsP; // PAD Server globals
// New System globals
Byte sysResetFlags; // Reset flags sysResetFlagXXXX
Byte sysBatteryKind; // SysBatteryKind enumerated type
// New Memory Manager global for recording minimum heap free - used for debugging only
DWord memMinDynHeapFree; // Minimum free space in dynamic heap
// System Preferences flags
Word sysPrefFlags; // System Pref flags: sysPrefFlagXXXX
// This is a pointer to the System Manager variable size globals
Ptr sysGlobalsP; // pointer to System Globals
// Miscellaneous System flags
Word sysMiscFlags; // System Misc flags: sysMiscFlagXXX
//-----------------------------------------------------------------------
// 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
extern Ptr PilotGlobalsP; // pointer to start of Memory card 0
#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 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 GSlkGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.slkGlobalsP)
#define GSerGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.serGlobalsP)
#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)
#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)
#define GCurUIAppInfoP (((LowMemHdrType*)PilotGlobalsP)->globals.curUIAppInfoP)
#define GHwrDataWELevel (((LowMemHdrType*)PilotGlobalsP)->globals.hwrDataWELevel)
#define GHwrWakeUp (((LowMemHdrType*)PilotGlobalsP)->globals.hwrWakeUp)
#define GHwrCPUDutyCycle (((LowMemHdrType*)PilotGlobalsP)->globals.hwrCPUDutyCycle)
#define GHwrPenDown (((LowMemHdrType*)PilotGlobalsP)->globals.hwrPenDown)
#define GHwrCurTicks (((LowMemHdrType*)PilotGlobalsP)->globals.hwrCurTicks)
#define GHwrTotalRAMSize (((LowMemHdrType*)PilotGlobalsP)->globals.hwrTotalRAMSize)
#define GHwrDozeSubTicks (((LowMemHdrType*)PilotGlobalsP)->globals.hwrDozeSubTicks)
#define GSysLibTableP (((LowMemHdrType*)PilotGlobalsP)->globals.sysLibTableP)
#define GSysLibTableEntries (((LowMemHdrType*)PilotGlobalsP)->globals.sysLibTableEntries)
#define GDbgSerGlobalsP (((LowMemHdrType*)PilotGlobalsP)->globals.dbgSerGlobalsP)
#endif //__GLOBALS_H__
#endif // NON_PORTABLE

View File

@ -0,0 +1,213 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* Graffiti.h
*
* Description:
* Header for the Graffiti interface
*
* History:
* 6/30 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifndef __GRAFFITI_H__
#define __GRAFFITI_H__
#include <Common.h>
#define grfNoShortCut 0xffff // Index which isn't a shortcut
/*------------------------------------------------------------------------------
* Match info structure. Returned by GrfMatch and GrfMatchGlyph
*-----------------------------------------------------------------------------*/
typedef struct {
Byte glyphID; /* glyph ID of this match */
Byte unCertainty; /* unCertainty of this match (0 most certain) */
} GrfMatchType;
#define grfMaxMatches 4
typedef struct {
Word numMatches; /* number of matches returned in this structure */
GrfMatchType match[grfMaxMatches];
} GrfMatchInfoType;
typedef GrfMatchInfoType* GrfMatchInfoPtr;
#define grfNameLength 8 // eight letters possible (don't forget CR)
//#define grfTextLength 56 // Use <SysEvtPrv.h>
//----------------------------------------------------------------------------
// Escape codes preceding special sequences in the dictionary or macros
//----------------------------------------------------------------------------
// In dictionary or macros preceding virtual key event sequences. These are always
// 11 byte sequences that have ASCII encoded values for the ascii code, keyCode,
// and modifiers:
// grfVirtualSequence, ascii, keyCode, modifiers.
// 1 byte 4 bytes 4 bytes 2 byte
#define grfVirtualSequence 0x01
// In dictionary to tell us about temp shift state changes.
#define grfShiftSequence 0x02
// In dictionary/macros to hide special features
#define grfSpecialSequence 0x03
// Char indicating a seqeunce of characters to expand.
#define grfExpansionSequence '@'
// Chars indicating what to expand into
#define expandDateChar 'D'
#define expandTimeChar 'T'
#define expandStampChar 'S' // This follows 'D' or 'T' for the sake
// of the mnemonic name.
#define shortcutBinaryDataFlag 0x01
// Determine if a string has a sequence
#define HasVirtualSequence(s) (s[0] == grfVirtualSequence)
#define HasSpecialSequence(s) (s[0] == grfSpecialSequence)
#define HasExpansionSequence(s) (s[0] == grfExpansionSequence)
/*------------------------------------------------------------------------------
* Temp shift states, returned by GrfGetState
*-----------------------------------------------------------------------------*/
#define grfTempShiftPunctuation 1
#define grfTempShiftExtended 2
#define grfTempShiftUpper 3
#define grfTempShiftLower 4
/************************************************************
* Graffiti result codes
*************************************************************/
#define grfErrBadParam (grfErrorClass | 1)
#define grfErrPointBufferFull (grfErrorClass | 2)
#define grfErrNoGlyphTable (grfErrorClass | 3)
#define grfErrNoDictionary (grfErrorClass | 4)
#define grfErrNoMapping (grfErrorClass | 5)
#define grfErrMacroNotFound (grfErrorClass | 6)
#define grfErrDepthTooDeep (grfErrorClass | 7)
#define grfErrMacroPtrTooSmall (grfErrorClass | 8)
#define grfErrNoMacros (grfErrorClass | 9)
#define grfErrMacroIncomplete (grfErrorClass | 129) // (grfWarningOffset+1)
#define grfErrBranchNotFound (grfErrorClass | 130) // (grfWarningOffset+2)
/************************************************************
* Graffiti interface procedures
*************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
//-----------------------------------------------------------------
// High Level Calls
//------------------------------------------------------------------
Err GrfInit (void)
SYS_TRAP(sysTrapGrfInit);
Err GrfFree (void)
SYS_TRAP(sysTrapGrfFree);
Err GrfProcessStroke(PointType* startPtP, PointType* endPtP,
Boolean upShift)
SYS_TRAP(sysTrapGrfProcessStroke);
Err GrfFieldChange(Boolean resetState, UIntPtr characterToDelete)
SYS_TRAP(sysTrapGrfFieldChange);
Err GrfGetState(Boolean* capsLockP, Boolean* numLockP,
WordPtr tempShiftP, Boolean* autoShiftedP)
SYS_TRAP(sysTrapGrfGetState);
Err GrfSetState(Boolean capsLock, Boolean numLock,
Boolean upperShift)
SYS_TRAP(sysTrapGrfSetState);
//-----------------------------------------------------------------
// Mid Level Calls
//------------------------------------------------------------------
Err GrfFlushPoints (void)
SYS_TRAP(sysTrapGrfFlushPoints);
Err GrfAddPoint (PointType* pt)
SYS_TRAP(sysTrapGrfAddPoint);
Err GrfInitState(void)
SYS_TRAP(sysTrapGrfInitState);
Err GrfCleanState(void)
SYS_TRAP(sysTrapGrfCleanState);
Err GrfMatch (WordPtr flagsP, void* dataPtrP, WordPtr dataLenP,
WordPtr uncertainLenP, GrfMatchInfoPtr matchInfoP)
SYS_TRAP(sysTrapGrfMatch);
Err GrfGetMacro(CharPtr nameP, BytePtr macroDataP,
WordPtr dataLenP)
SYS_TRAP(sysTrapGrfGetMacro);
Err GrfGetAndExpandMacro(CharPtr nameP, BytePtr macroDataP,
WordPtr dataLenP)
SYS_TRAP(sysTrapGrfGetAndExpandMacro);
//-----------------------------------------------------------------
// Low Level Calls
//------------------------------------------------------------------
Err GrfFilterPoints (void)
SYS_TRAP(sysTrapGrfFilterPoints);
Err GrfGetNumPoints(WordPtr numPtsP)
SYS_TRAP(sysTrapGrfGetNumPoints);
Err GrfGetPoint(Word index, PointType* pointP)
SYS_TRAP(sysTrapGrfGetPoint);
Err GrfFindBranch(Word flags)
SYS_TRAP(sysTrapGrfFindBranch);
Err GrfMatchGlyph (GrfMatchInfoPtr matchInfoP,
Word maxUnCertainty, Word maxMatches)
SYS_TRAP(sysTrapGrfMatchGlyph);
Err GrfGetGlyphMapping (Word glyphID, WordPtr flagsP,
void* dataPtrP, WordPtr dataLenP, WordPtr uncertainLenP)
SYS_TRAP(sysTrapGrfGetGlyphMapping);
Err GrfGetMacroName(Word index, CharPtr nameP)
SYS_TRAP(sysTrapGrfGetMacroName);
Err GrfDeleteMacro(Word index)
SYS_TRAP(sysTrapGrfDeleteMacro);
Err GrfAddMacro(CharPtr nameP, BytePtr macroDataP,
Word dataLen)
SYS_TRAP(sysTrapGrfAddMacro);
#ifdef __cplusplus
}
#endif
#endif //__SYSEVTMGR_H__

View File

@ -0,0 +1,106 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* GraffitiPRV.h
*
* Description:
* Private Header for the Graffiti interface
*
* History:
* 6/30 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifdef NON_PORTABLE
#ifndef __GRAFFITIPRV_H__
#define __GRAFFITIPRV_H__
#define DP3MachineMacintosh
#include <P3API.h>
/************************************************************
* Graffiti Constants
*************************************************************/
// Bytes that follow the grfSpecialSequence byte in Graffiti dictionary
// or macros. These are used for special test code and debugging
#define grfSpecialToggleSplitMode 0x01 // Toggle split mode
#define grfSpecialNoAutoOff 0x02 // Disable auto-off
#define grfSpecialShowUserInfo 0x03 // Display user information
#define grfSpecialDeleteUserInfo 0x04 // Delete user name & id
#define grfSpecialSystemBuildDate 0x05 // Show System Build date
#define grfSpecialBatteryKind 0x06 // Change battery kind
// Max # of keys returned from dictionary or macros
#define grfMaxKeys 100
// Resource type and ID of macros resource
#define grfMacrosResT 'macr'
#define grfMacrosResID 10000
#define grfMacrosMinSize 10 // min size of macros resource
// Version of Graffiti Macros database
#define grfMacrosDBVersion 0 // version word
// Constant used to translate internal Graffiti Warnings into Pilot error codes
#define grfWarningOffset 128
/************************************************************
* Graffiti Globals
*************************************************************/
#define grfMaxMacroName 32
typedef struct GrfGlobalsType {
TP3Data p3Data;
TP3DictState state;
Int uncertain;
Word glyphFlags;
Word shiftState; // temp shift state
SWord macroNameLen;
Byte macroName[grfMaxMacroName];
Byte lastChar;
ULong globalsSize;
// Various flags
Word splitMode : 1;
Word restoreCaps : 1;
Word inMacro : 1;
Word wasAutoShifted : 1;
// Glyph ID assigned to the up-stroke
Byte upShiftGlyphID;
// Handle to P3 private globals
Handle globalsH;
// Handle to template file
Handle templateH;
// Handle to dictionary
Handle dictH;
// Handle to macros resource
Handle macrosH;
// Database acccess pointer to macros database
DmOpenRef macrosDbP;
} GrfGlobalsType;
typedef GrfGlobalsType* GrfGlobalsPtr;
#endif //__GRAFFITIPRV_H__
#endif // NON_PORTABLE

View File

@ -0,0 +1,61 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* KeyMgr.h
*
* Description:
* Include file for Key manager
*
* History:
* 9/13/95 Created by Ron Marianetti
*
*******************************************************************/
#ifndef __KEYMGR_H__
#define __KEYMGR_H__
// Pilot common definitions
#include <Common.h>
#include <SystemMgr.h>
/********************************************************************
* Definition of bit field returned from KeyCurrentState
********************************************************************/
#define keyBitPower 0x01 // Power key
#define keyBitPageUp 0x02 // Page-up
#define keyBitPageDown 0x04 // Page-down
#define keyBitHard1 0x08 // App #1
#define keyBitHard2 0x10 // App #2
#define keyBitHard3 0x20 // App #3
#define keyBitHard4 0x40 // App #4
#define keyBitCradle 0x80 // Button on cradle
/********************************************************************
* Key manager Routines
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
// Set/Get the auto-key repeat rate
Err KeyRates(Boolean set, WordPtr initDelayP, WordPtr periodP,
WordPtr doubleTapDelayP, BooleanPtr queueAheadP)
SYS_TRAP(sysTrapKeyRates);
// Get the current state of the hardware keys
DWord KeyCurrentState(void)
SYS_TRAP(sysTrapKeyCurrentState);
#ifdef __cplusplus
}
#endif
#endif //__KEYMGR_H__

View File

@ -0,0 +1,112 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* KeyPrv.h
*
* Description:
* Private Include file for Key manager
*
* History:
* 9/13/95 Created by Ron Marianetti
*
*******************************************************************/
#ifdef NON_PORTABLE
#ifndef __KEYPRV_H
#define __KEYPRV_H
/********************************************************************
* Key Manager Constants
********************************************************************/
#define keyMinUpTicks (sysTicksPerSecond/20) // Min# of ticks key must be up to recognize it
#define keyBitMask 0x007F // Which bits in port D we use for keys
/********************************************************************
* Key Manager Globals
********************************************************************/
typedef struct KeyGlobalsType {
ULong lastKeyTicks; // GHwrCurTicks last time we enqueued
// a key event - cleared as soon as
// key is released.
Byte keyState; // current state of hardware keys - returned
// by KeyCurrentState
Byte keyUpCount; // # of consecutive times we've detected
// no keys down - used for debouncing
Byte initDelay; // key repeat init delay in ticks
Byte period; // key repeat period in ticks
// These variables used for sensing double-taps
ULong doubleTapTicks; // GHwrCurTicks last tiem we enqueued
// a key event - never cleared.
Word doubleTapDelay; // double-tap timeout in ticks
Byte doubleTapState; // state of hardware keys last time
// Belongs next to 'period' but put here for alignment
Boolean queueAhead; // if true, enqueue auto-repeat keys even if
// queue is not empty.
} KeyGlobalsType;
typedef KeyGlobalsType* KeyGlobalsPtr;
/********************************************************************
* Key manager Routines
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
// Called early on during boot-up to get status of hard reset
// and debugger key options. Returns DWord with bits set for each
// key down.
DWord KeyBootKeys(void);
// Initializes the Key Manager and allocates it's globals
Err KeyInit(void)
SYS_TRAP(sysTrapKeyInit);
// Called as a result of a key-down interrupt or periodically by
// by timer task while key is down. Returns # of ticks before
// it should be called again by timer task.
ULong KeyHandleInterrupt(Boolean periodic, DWord status)
SYS_TRAP(sysTrapKeyHandleInterrupt);
// Called by SysEvtMgr when it gets a pen event in order to
// reset the key manager's double-tap detection.
Err KeyResetDoubleTap(void)
SYS_TRAP(sysTrapKeyResetDoubleTap);
// Called before system goes to sleep
Err KeySleep(Boolean untilReset, Boolean emergency)
SYS_TRAP(sysTrapKeySleep);
// Called when the system wakes up
Err KeyWake(void)
SYS_TRAP(sysTrapKeyWake);
#ifdef __cplusplus
}
#endif
#endif //__KEYPRV_H
#endif // NON_PORTABLE

View File

@ -0,0 +1,51 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: Keyboard.h
* AUTHOR: Roger Flores: March 29, 1995
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines the keyboard's structures
* and routines.
*
***********************************************************************/
#ifndef __KBD_H__
#define __KBD_H__
#define kbdReturnKey linefeedChr
#define kbdTabKey tabChr
#define kbdBackspaceKey backspaceChr
#define kbdShiftKey 2
#define kbdCapsKey 1
#define kbdNoKey -1
/************************************************************
* Keyboard procedures
*************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
// At some point the Graffiti code will need access to the
// shift and caps lock info. Either export the structures
// or provide calls to the info.
extern void SysKeyboardDialog ()
SYS_TRAP(sysTrapSysKeyboardDialog);
#ifdef __cplusplus
}
#endif
#endif // __KBD_H__

View File

@ -0,0 +1,71 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1995 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: Launcher.h
* AUTHOR: Roger Flores: April 27, 1995
*
* DECLARER: UI
*
* DESCRIPTION:
* These are the routines for the launcher.
*
**********************************************************************/
#ifndef __LAUNCHER_H__
#define __LAUNCHER_H__
#include <Common.h>
#include <DataMgr.h>
#include <Rect.h>
#include <Font.h>
#include <Window.h>
typedef struct {
Char name[dmDBNameLength];
ULong creator;
UInt version;
LocalID dbID;
UInt cardNo;
BitmapPtr iconP;
} LauncherAppInfoType;
typedef struct {
RectangleType bounds;
Int numItems; // numItems of applications available via the launcher
Int columns;
Int rows;
Int topItem;
VoidHand appInfoH; // an array is to be allocated
RectangleType frame;
WinHandle popupWin;
WinHandle savedBits;
WinHandle savedActiveWin;
WinHandle savedDrawWin;
TimeFormatType timeFormat; // Format to display time in
char timeString[timeStringLength];
Boolean needToGetNamesAndIcons;
FormPtr savedForm; // the currently active dialog.
} LauncherType;
typedef LauncherType * LauncherPtr;
/************************************************************
* Launcher procedures
*************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
void SysAppLauncherDialog()
SYS_TRAP(sysTrapSysAppLauncherDialog);
#ifdef __cplusplus
}
#endif
#endif // __LAUNCHER_H__

View File

@ -0,0 +1,341 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* MemoryMgr.h
*
* Description:
* Include file for Memory Manager
*
* History:
* 10/25/94 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifndef __MEMORYMGR_H__
#define __MEMORYMGR_H__
// Include elementary types
#include <Common.h> // Basic types
#include <SysTraps.h> // Trap Numbers.
/************************************************************
* 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)
#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 | 10)
/********************************************************************
* 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 __cplusplus
extern "C" {
#endif
//-------------------------------------------------------------------
// Initialization
//-------------------------------------------------------------------
Err MemInit(void)
SYS_TRAP(sysTrapMemInit);
Err MemKernelInit(void)
SYS_TRAP(sysTrapMemKernelInit);
Err MemInitHeapTable(UInt cardNo)
SYS_TRAP(sysTrapMemInitHeapTable);
//-------------------------------------------------------------------
// Card formatting and Info
//-------------------------------------------------------------------
UInt MemNumCards(void)
SYS_TRAP(sysTrapMemNumCards);
Err MemCardFormat(UInt cardNo, CharPtr cardNameP,
CharPtr manufNameP, CharPtr ramStoreNameP)
SYS_TRAP(sysTrapMemCardFormat);
Err MemCardInfo(UInt cardNo,
CharPtr cardNameP, CharPtr manufNameP,
UIntPtr versionP, ULongPtr crDateP,
ULongPtr romSizeP, ULongPtr ramSizeP,
ULongPtr freeBytesP)
SYS_TRAP(sysTrapMemCardInfo);
//-------------------------------------------------------------------
// Store Info
//-------------------------------------------------------------------
Err MemStoreInfo(UInt cardNo, UInt storeNumber,
UIntPtr versionP, UIntPtr flagsP, CharPtr nameP,
ULongPtr crDateP, ULongPtr bckUpDateP,
ULongPtr heapListOffsetP, ULongPtr initCodeOffset1P,
ULongPtr initCodeOffset2P, LocalID* databaseDirIDP)
SYS_TRAP(sysTrapMemStoreInfo);
Err MemStoreSetInfo(UInt cardNo, UInt storeNumber,
UIntPtr versionP, UIntPtr flagsP, CharPtr nameP,
ULongPtr crDateP, ULongPtr bckUpDateP,
ULongPtr heapListOffsetP, ULongPtr initCodeOffset1P,
ULongPtr initCodeOffset2P, LocalID* databaseDirIDP)
SYS_TRAP(sysTrapMemStoreSetInfo);
//-------------------------------------------------------------------
// Heap Info & Utilities
//-------------------------------------------------------------------
UInt MemNumHeaps(UInt cardNo)
SYS_TRAP(sysTrapMemNumHeaps);
UInt MemNumRAMHeaps(UInt cardNo)
SYS_TRAP(sysTrapMemNumRAMHeaps);
UInt MemHeapID(UInt cardNo, UInt heapIndex)
SYS_TRAP(sysTrapMemHeapID);
Boolean MemHeapDynamic(UInt heapID)
SYS_TRAP(sysTrapMemHeapDynamic);
Err MemHeapFreeBytes(UInt heapID, ULongPtr freeP, ULongPtr maxP)
SYS_TRAP(sysTrapMemHeapFreeBytes);
ULong MemHeapSize(UInt heapID)
SYS_TRAP(sysTrapMemHeapSize);
UInt MemHeapFlags(UInt heapID)
SYS_TRAP(sysTrapMemHeapFlags);
// Heap utilities
Err MemHeapCompact(UInt heapID)
SYS_TRAP(sysTrapMemHeapCompact);
Err MemHeapInit(UInt heapID, Int numHandles, Boolean initContents)
SYS_TRAP(sysTrapMemHeapInit);
Err MemHeapFreeByOwnerID(UInt heapID, UInt ownerID)
SYS_TRAP(sysTrapMemHeapFreeByOwnerID);
//-------------------------------------------------------------------
// Low Level Allocation
//-------------------------------------------------------------------
VoidPtr MemChunkNew(UInt heapID, ULong size, UInt attr)
SYS_TRAP(sysTrapMemChunkNew);
Err MemChunkFree(VoidPtr chunkDataP)
SYS_TRAP(sysTrapMemChunkFree);
//-------------------------------------------------------------------
// Pointer (Non-Movable) based Chunk Routines
//-------------------------------------------------------------------
VoidPtr MemPtrNew(ULong size)
SYS_TRAP(sysTrapMemPtrNew);
#define MemPtrFree( p) \
MemChunkFree(p)
// Getting Attributes
VoidHand MemPtrRecoverHandle(VoidPtr p)
SYS_TRAP(sysTrapMemPtrRecoverHandle);
UInt MemPtrFlags(VoidPtr p)
SYS_TRAP(sysTrapMemPtrFlags);
ULong MemPtrSize(VoidPtr p)
SYS_TRAP(sysTrapMemPtrSize);
UInt MemPtrOwner(VoidPtr p)
SYS_TRAP(sysTrapMemPtrOwner);
UInt MemPtrHeapID(VoidPtr p)
SYS_TRAP(sysTrapMemPtrHeapID);
Boolean MemPtrDataStorage(VoidPtr p)
SYS_TRAP(sysTrapMemPtrDataStorage);
UInt MemPtrCardNo(VoidPtr global)
SYS_TRAP(sysTrapMemPtrCardNo);
LocalID MemPtrToLocalID(VoidPtr p)
SYS_TRAP(sysTrapMemPtrToLocalID);
// Setting Attributes
Err MemPtrSetOwner(VoidPtr p, UInt owner)
SYS_TRAP(sysTrapMemPtrSetOwner);
Err MemPtrResize(VoidPtr p, ULong newSize)
SYS_TRAP(sysTrapMemPtrResize);
Err MemPtrResetLock(VoidPtr p)
SYS_TRAP(sysTrapMemPtrResetLock);
Err MemPtrUnlock(VoidPtr p)
SYS_TRAP(sysTrapMemPtrUnlock);
//-------------------------------------------------------------------
// Handle (Movable) based Chunk Routines
//-------------------------------------------------------------------
VoidHand MemHandleNew(ULong size)
SYS_TRAP(sysTrapMemHandleNew);
Err MemHandleFree(VoidHand h)
SYS_TRAP(sysTrapMemHandleFree);
// Getting Attributes
UInt MemHandleFlags(VoidHand h)
SYS_TRAP(sysTrapMemHandleFlags);
ULong MemHandleSize(VoidHand h)
SYS_TRAP(sysTrapMemHandleSize);
UInt MemHandleOwner(VoidHand h)
SYS_TRAP(sysTrapMemHandleOwner);
UInt MemHandleLockCount(VoidHand h)
SYS_TRAP(sysTrapMemHandleLockCount);
UInt MemHandleHeapID(VoidHand h)
SYS_TRAP(sysTrapMemHandleHeapID);
Boolean MemHandleDataStorage(VoidHand h)
SYS_TRAP(sysTrapMemHandleDataStorage);
UInt MemHandleCardNo(VoidHand h)
SYS_TRAP(sysTrapMemHandleCardNo);
LocalID MemHandleToLocalID(VoidHand h)
SYS_TRAP(sysTrapMemHandleToLocalID);
// Setting Attributes
Err MemHandleSetOwner( VoidHand h, UInt owner)
SYS_TRAP(sysTrapMemHandleSetOwner);
Err MemHandleResize(VoidHand h, ULong newSize)
SYS_TRAP(sysTrapMemHandleResize);
VoidPtr MemHandleLock(VoidHand h)
SYS_TRAP(sysTrapMemHandleLock);
Err MemHandleUnlock(VoidHand h)
SYS_TRAP(sysTrapMemHandleUnlock);
Err MemHandleResetLock(VoidHand h)
SYS_TRAP(sysTrapMemHandleResetLock);
//-------------------------------------------------------------------
// Local ID based routines
//-------------------------------------------------------------------
VoidPtr MemLocalIDToGlobal(LocalID local, UInt cardNo)
SYS_TRAP(sysTrapMemLocalIDToGlobal);
LocalIDKind MemLocalIDKind(LocalID local)
SYS_TRAP(sysTrapMemLocalIDKind);
VoidPtr MemLocalIDToPtr(LocalID local, UInt cardNo)
SYS_TRAP(sysTrapMemLocalIDToPtr);
VoidPtr MemLocalIDToLockedPtr(LocalID local, UInt cardNo)
SYS_TRAP(sysTrapMemLocalIDToLockedPtr);
//-------------------------------------------------------------------
// Utilities
//-------------------------------------------------------------------
Err MemMove(VoidPtr dstP, VoidPtr srcP, ULong numBytes)
SYS_TRAP(sysTrapMemMove);
Err MemSet(VoidPtr dstP, ULong numBytes, Byte value)
SYS_TRAP(sysTrapMemSet);
Err MemSemaphoreReserve(Boolean writeAccess)
SYS_TRAP(sysTrapMemSemaphoreReserve);
Err MemSemaphoreRelease(Boolean writeAccess)
SYS_TRAP(sysTrapMemSemaphoreRelease);
//-------------------------------------------------------------------
// Debugging Support
//-------------------------------------------------------------------
Word MemDebugMode(void)
SYS_TRAP(sysTrapMemDebugMode);
Err MemSetDebugMode(Word flags)
SYS_TRAP(sysTrapMemSetDebugMode);
Err MemHeapScramble(UInt heapID)
SYS_TRAP(sysTrapMemHeapScramble);
Err MemHeapCheck(UInt heapID)
SYS_TRAP(sysTrapMemHeapCheck);
#ifdef __cplusplus
}
#endif
#endif // __MEMORYMGR_H__

View File

@ -0,0 +1,327 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* MemoryMgrPrv.h
*
* Description:
* Private includes for Memory Manager
*
* History:
* 7/20/95 RM - Created by Ron Marianetti
*
*******************************************************************/
#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 __MEMORYMGRPRV_H__
#define __MEMORYMGRPRV_H__
/********************************************************************
* Structure of a Master Pointer 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 {
Word numEntries; // number of master pointer entries
Word nextTblOffset; // offset from start of heap to next table
//Ptr mstrP[numEntries]; // array of pointers to movable chunks
} MstrPtrTableType;
typedef MstrPtrTableType* MstrPtrTablePtr;
/********************************************************************
* 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
********************************************************************/
typedef struct {
Word flags; // heap flags;
Word size; // size of heap - 0 means 64K;
MstrPtrTableType mstrPtrTbl; // Master pointer table
} HeapHeaderType;
typedef HeapHeaderType* HeapHeaderPtr;
// Flags Field
#define memHeapFlagReadOnly 0x01 // heap is read-only (ROM based)
#define memMstrPtrTableGrowBy 50 // # of entries to grow master pointer tables by
#define memMstrPtrTableInitSizeD 40 // # of entries to allocate initially for dynamic heap(s)
#define memMstrPtrTableInitSizeS 200 // # of entries to allocate initially for storage heap(s)
/********************************************************************
* Structure of a Chunk
*
********************************************************************/
typedef struct {
Word size; // size of block in bytes, including header
Byte lockOwner; // lock count in high nibble, owner in low
Byte flags; // flags, size adj in low nibble
SWord hOffset; // offset/2 to handle for movables
} ChunkHeaderType;
typedef ChunkHeaderType* ChunkHeaderPtr;
// Definition of ChunkHeaderType.flags --------------------------------
#define memChunkFlagFree 0x80 // free bit
#define memChunkFlagUnused1 0x40 // unused
#define memChunkFlagUnused2 0x20 // unused
#define memChunkFlagUnused3 0x10 // unused
#define memChunkFlagSizeAdj 0x0F // mask for size adjustment
// A non-movable chunk has 0xF as the lock count
#define memChunkLockMask 0xF0
#define memChunkOwnerMask 0x0F
/************************************************************
* 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 {
DWord initStack; // initial stack pointer
DWord resetVector; // reset vector
DWord signature; // must be sysCardSignature
Word hdrVersion; // header version
Word flags; // card flags;
Byte name[memMaxNameLen]; // card name
Byte manuf[memMaxNameLen]; // card manufacturer's name
Word version; // card version
DWord creationDate; // card creation date
Word numRAMBlocks; // number of RAM blocks on card
DWord blockListOffset; // offset to RAM block list
Byte reserved[164]; // to bring us to 0x100 alignment
} CardHeaderType;
typedef CardHeaderType* CardHeaderPtr;
#define memCardHeaderFlagRAMOnly 0x0001 // RAM only card
/************************************************************
* 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 {
DWord signature; // must be sysStoreSignature
Word version; // version of header
Word flags; // flags
Byte name[memMaxNameLen]; // name of store
DWord creationDate; // creation date
DWord backupDate; // last backup date
DWord heapListOffset; // offset to heap list for store
DWord initCodeOffset1; // init code for store, if any
DWord initCodeOffset2; // second init code for store, if any
LocalID databaseDirID; // local ID of database dir.
DWord rsvSpace; // where first heap starts.
DWord dynHeapSpace; // how big the dynamic heap area is
// (always 0 for ROM stores)
DWord 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!.
SysNVParamsType nvParams;
// Filler bytes - reserved for future use. Size adjusted to
// keep total size of storage header at 0x100 bytes.
Byte reserved[176-sizeof(SysNVParamsType)];
// CRC value
DWord 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 {
Word numHeaps; // Number of heaps in store
DWord heapOffset[1]; // offset to heap
} HeapListType;
/********************************************************************
* CardInfo structure
* The Pilot 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 {
// These fields are filled in by the boot code BEFORE
// MemInit() is called.
BytePtr baseP; // base address of card
DWord size; // address range of card
DWord firstRAMBlockSize; // size of RAM block at offset 0
DWord targetROMShift; // used only under Emulation mode, must be
// added to emulated ROM pointers when calculating
// a LocalID for use in the device ROM.
DWord cardHeaderOffset; // offset to card header (usually in ROM)
// = 0 if RAM only card
DWord rsvSpace; // reserve space in RAM before first heap
DWord 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.
Word numRAMHeaps; // Number of RAM heaps - for quick access
DWordPtr ramHeapOffsetsP; // Table of RAM heap offsets - for quick access
Word numROMHeaps; // Number of RAM heaps - for quick access
DWordPtr romHeapOffsetsP; // Table of RAM heap offsets - for quick access
} 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
*************************************************************/
// Default size of the dynamic heap
#define memDynamicHeapSize (0x08000-sysLowMemSize)
// Private constant - # of dynamic heaps
#define memDynamicHeaps 1
/************************************************************
* 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) \
((VoidHand)((DWord)h | 0x80000000))
#define memHandleUnProtect(h) \
((VoidHand)((DWord)h & 0x7FFFFFFF))
#else
#define memHandleProtect(h) (h)
#define memHandleUnProtect(h) (h)
#endif
#if MEMORY_TYPE == MEMORY_LOCAL
#if ERROR_CHECK_LEVEL != ERROR_CHECK_NONE
#define MemDeref(h) \
(MemHandleLockCount(h)==0 ? (*((VoidHand)0x80000000)) : (*memHandleUnProtect(h)))
#else
#define MemDeref(h) \
(*(memHandleUnProtect(h)))
#endif
#else
#if ERROR_CHECK_LEVEL != ERROR_CHECK_NONE
#define MemDeref(h) \
(MemHandleLockCount(h)==0 ? (*((VoidHand)0x80000000)) : ((Ptr)ShlDWord(h)))
#else
#define MemDeref(h) \
((Ptr)ShlDWord(memHandleUnProtect(h)))
#endif
#endif
#endif // NON_PORTABLE
// Typecast access to the MemCardInfo Ptr
#define memCardInfoP(cardNo) \
( ((CardInfoPtr) ((LowMemHdrType*)PilotGlobalsP)->globals.memCardInfoP) + cardNo)
/********************************************************************
* Memory Manager Private Routines
* These are used only by internal System code
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
HeapHeaderPtr MemHeapPtr(UInt heapID)
SYS_TRAP(sysTrapMemHeapPtr);
Err MemStoreSearch(VoidPtr startP, DWord range, StorageHeaderPtr* storePP)
SYS_TRAP(sysTrapMemStoreSearch);
Err MemStoreInit(DWord firstHeapSize, UInt firstHeapMstrPtrs,
UInt cardNo, Word numBlocks, DWordPtr blockInfoP,
StorageHeaderPtr storeP, Word numMstrPtrs)
SYS_TRAP(sysTrapMemStoreInit);
Err MemNVParams(Boolean set, SysNVParamsPtr paramsP)
SYS_TRAP(sysTrapMemNVParams);
#ifdef __cplusplus
}
#endif
#endif // __MEMORYMGRPRV_H__

View File

@ -0,0 +1,118 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* ModemMgr.h
*
* Description:
* Include file for Modem Manager
*
* History:
* 9/20/95 VMK - Created by Vitaly Kruglikov
*
*******************************************************************/
#ifndef __MODEM_MGR_H__
#define __MODEM_MGR_H__
// Include elementary types
#include <Common.h>
#include <SysTraps.h> // Trap Numbers.
/************************************************************
* Modem Manager constants
*************************************************************/
#define mdmMaxStringSize 40
#define mdmCmdBufSize 81 // command buffer capacity (including null)
#define mdmRespBufSize 81 // reply buffer capacity (including null)
#define mdmCmdSize 8 // max storage needed for smartmodem command
#define mdmDefCmdTimeOut 500000L // in micro-seconds
#define mdmDefDTWaitSec 4
#define mdmDefDCDWaitSec 70
#define mdmDefSpeakerVolume 1
/************************************************************
* Modem Manager data structures
*************************************************************/
// Prototype for the "user cancel" check callback function
typedef Int (*MdmUserCanProcPtr)(DWord userRef);
typedef struct MdmInfoType {
UInt serRefNum; // serial library reference number
ULong initialBaud; // initial baud rate to use
ULong cmdTimeOut; // number of Msec to wait after a cmd
Int dtWaitSec; // dialtone wait (sec)
Int dcdWaitSec; // dcd timeout wait (sec)
Int volume; // speaker volume
Boolean pulse; // pulse or tone dialing
Boolean hwHShake; // enable cts/rts handshaking
Boolean autoBaud; // enable/disable auto-baud to connected baud rate
MdmUserCanProcPtr canProcP; // ptr to user-cancel function
DWord userRef; // parameter for canProcP()
Char cmdBuf[mdmCmdBufSize]; // build all commands here
Char respBuf[mdmRespBufSize];// response buffer
ULong connectBaud; // baud at which connection was established
// (0 = unknown)
Boolean traceToLog; // RESERVED FOR INTERNAL USE: when true,
// modem commands and responses are traced
// to the Sync log.
} MdmInfoType;
typedef MdmInfoType* MdmInfoPtr;
/************************************************************
* Modem Manager result codes
* (mdmErrorClass is defined in SystemMgr.h)
*************************************************************/
#define mdmErrNoTone (mdmErrorClass | 1) // no dial tone
#define mdmErrNoDCD (mdmErrorClass | 2) // no carrier / timeout
#define mdmErrBusy (mdmErrorClass | 3) // busy signal heard
#define mdmErrUserCan (mdmErrorClass | 4) // cancelled by user
#define mdmErrCmdError (mdmErrorClass | 5) // command error
/********************************************************************
* Modem 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 __cplusplus
extern "C" {
#endif
//-------------------------------------------------------------------
// API
//-------------------------------------------------------------------
Err MdmDial(MdmInfoPtr modemP, CharPtr okDialP, CharPtr userInitP, CharPtr phoneNumP)
SYS_TRAP(sysTrapMdmDial);
Err MdmHangUp(MdmInfoPtr modemP)
SYS_TRAP(sysTrapMdmHangUp);
#ifdef __cplusplus
}
#endif
/************************************************************
* Modem Manager Macros
*************************************************************/
#endif // __MODEM_MGR_H__

View File

@ -0,0 +1,90 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* ModemPrv.h
*
* Description:
* Private Include file for Modem Manager
*
* History:
* 9/25/95 VMK - Created by Vitaly Kruglikov
*
*******************************************************************/
#ifndef __MODEM_PRV_H__
#define __MODEM_PRV_H__
// Include elementary types
#include <Common.h>
/************************************************************
* Modem Manager constants
*************************************************************/
/************************************************************
* Modem Manager data structures
*************************************************************/
typedef struct MdmCommandsType {
Char csi[mdmCmdSize]; // command sequence introducer
Char eoc[mdmCmdSize]; // end-of-command character(s)
Char quietCmd[mdmCmdSize]; // Q cmd: send result codes
Char dialTone[mdmCmdSize]; // tone dial command
Char dialPulse[mdmCmdSize]; // pulse dial command
Char cmdEchoOff[mdmCmdSize]; // E cmd: echoes in command mode
Char verboseCmd[mdmCmdSize]; // V cmd: word or digit result codes
Char dtWait[mdmCmdSize]; // (S6) dialtone wait (sec)
Char dcdWait[mdmCmdSize]; // (S7) dcd timeout wait (sec)
Char basicxcmd[mdmCmdSize]; // sets result code level for "basic" smartmodem
Char advxcmd[mdmCmdSize]; // sets result code level for advanced clones
Char spkrMode[mdmCmdSize]; // speaker mode
Char volume[mdmCmdSize]; // speaker volume prefix
Char hupCmd[mdmCmdSize]; // hang up command
Char firmDTRDCD[mdmCmdSize]; // DTR on, DCD on
Char escape[mdmCmdSize]; // Escape sequence: +++
Char reset[mdmCmdSize]; // Z cmd: reset the modem
Char factory[mdmCmdSize]; // recall factory config
} MdmCommandsType;
typedef enum MdmRespIDType {
mdmRespUnknown = 0,
mdmRespOK,
mdmRespConnect,
mdmRespNoCarrier,
mdmRespError,
mdmRespNoDialTone,
mdmRespBusy,
mdmRespRing,
mdmRespReserved = -1 // reserve -1 for internal use
} MdmRespIDType;
typedef struct MdmRespEntryType {
Char subStr[20]; // response substring
MdmRespIDType id; // id associated with substring
} MdmRespEntryType;
/************************************************************
* Modem Manager result codes
* (mdmErrorClass is defined in SystemMgr.h)
*************************************************************/
//#define mdmErrBadParam (mdmErrorClass | 1)
/************************************************************
* Modem Manager Macros
*************************************************************/
#endif // __MODEM_PRV_H__

View File

@ -0,0 +1,118 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* PadCommn.h
*
* Description:
* Common Packet Assembly / Disassembly Protocol(PADP) definitions.
*
* History:
* 8/8/95 vmk Created by Vitaly Marty Kruglikov
*
*******************************************************************/
#ifndef __PAD_COMMON_H__
#define __PAD_COMMON_H__
#include <Common.h>
/********************************************************************
* PADP Packet Format
********************************************************************/
// The PADP packets are used for transmitting data for the Pilot PADP protocol layer.
// The structure of the PADP packet is built into the data part of the SLP packet and is,
// therefore, constrained by the SLP packet data size limitations.
// Packet type values used in the PADP packet header's "type" field:
//
typedef enum PadType {
padData = 1, // PADP data packet
padAck = 2, // PADP ACK packet
padUnused = 3, // used to be PADP NACK packet
padTickle = 4 // PADP TICLE packet
} PadType;
// PADP packet header:
//
typedef struct PadHeaderType {
Byte type; // PADP packet type
Byte flags; // flags to signal special conditions
Word sizeOrOffset; // (high, low) --
// in the 1st padData packet of the block, this field holds the
// total block data size; in the subsequent padData packets,
// this field holds the offset of data being sent; in padNack
// packets, this field indicates the offset of the expected
// data.
} PadHeaderType; // TOTAL: 4 bytes
typedef PadHeaderType* PadHeaderPtr;
// Flag values used in the PADP packet header's "flags" field. padHdrFlagFirst and
// padHdrFlagLast must both be set when the entire data block is being transmitted
// in a single PADP packet.
//
#define padHdrFlagFirst 0x80 // identifies the 1st padData packet
// of the block
#define padHdrFlagLast 0x40 // identifies the last padData packet
// of the block
#define padHdrFlagErrMemory 0x20 // signals remote memory error in
// padAck packets
/********************************************************************
* PADP Protocol Parameters
********************************************************************/
// This is the maximum amount of data(in bytes) which may be sent in a single
// PADP packet(not including the PADP packet header)
//
#define padMaxPktDataSize (1*1024)
// This is the maximum amount of data which may be sent in one PADP block
//
#define padMaxBlockSize ((64L * 1024L) - 1L)
// This is the maximum number of retries for resending a given data packet
//
#define padMaxRetries 10
// This is the maximum number of seconds to wait for an acknowledgement after sending
// a data packet
//
#define padAckWaitSec 2
// This is the maximum number of seconds to wait for the next data packet to begin arriving
//
#define padInterPktTimeOutSec 30 // large value for debugging
// default max sec. to wait for command/reply
//
#define padCmdWaitSec 30
#define padReplyWaitSec 30
/********************************************************************
* Macros
********************************************************************/
#endif // __PAD_COMMON_H__

View File

@ -0,0 +1,206 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* PadServer.h
*
* Description:
* Packet Assembly/Disassembly server-side definitions
*
* History:
* 7/17/95 vmk Created by Vitaly Marty Kruglikov
*
*******************************************************************/
#ifndef __PAD_SERVER_H__
#define __PAD_SERVER_H__
// Pilot common definitions
#include <Common.h>
#include <SerialLinkMgr.h>
// Data Manager definitions
#include <DataMgr.h> // for DmOpenRef
// Common Session Protocol definitions
#include <PadCommn.h>
#include <PadUtil.h>
/********************************************************************
* PAD Server Parameters
********************************************************************/
#define psrMaxPktBufSize ( sizeof(PadHeaderType) + \
padMaxPktDataSize )
// psrMinSerRcvBufSize: minimum serial receive buffer size needed
// for PAD Server. The extra 32 bytes are for beginning/end of queue
// and other serial manager overhead
#define psrMinSerRcvBufSize ( sizeof(SlkPktHeaderType) + \
psrMaxPktBufSize + \
sizeof(SlkPktFooterType) + \
32 )
// psrCmdWaitIntervalSec: when waiting for the beginning of a command,
// the PAD receiver will wait up to this many seconds before before timing
// out on the first packet. The higher-level routine will perform
// its regular maintenance tasks (such as checking for user cancel) around
// calls to the PAD receiver.
#define psrCmdWaitIntervalSec 2
/************************************************************
* Session Protocol result codes
* (padErrorClass is defined in SystemMgr.h)
*************************************************************/
#define psrErrParam (padErrorClass | 1) // invalid parameter
#define psrErrTooManyRetries (padErrorClass | 2) // too many retries
#define psrErrTimeOut (padErrorClass | 4) // call timed out
#define psrErrInUse (padErrorClass | 5) // PAD Server/WS manager is in use
#define psrErrMemory (padErrorClass | 6) // not enough memory
#define psrErrUserCan (padErrorClass | 7) // cancelled by user
#define psrErrSizeErr (padErrorClass | 8) // reply block is too big
#define psrErrBlockFormat (padErrorClass | 9) // block format error
/********************************************************************
* Session Manager Structures
********************************************************************/
//
// Packet Assembly/Disassembly structures
//
// PAD sender-specific parameters
typedef struct PsrSendParamType {
Byte remoteSocket; // remote socket id
Byte transID; // transaction ID to use on block packets
// Send segments specification:
Int segCount; // number of segments to send
PmSegmentPtr segP; // ptr to array of segments
// Statistical information for fine-tuning and debugging:
ULong numAttempted; // number of data packets we attempted to send
ULong numAcked; // number of packets which were acked
ULong retries; // number of retries
} PsrSendParamType;
// PAD receiver-specific parameters
typedef struct PsrRcvParamType {
Byte filterTransID; // tranasaction id to filter out
DmOpenRef dbP; // database reference for allocating memory
// Set by PrvReceiveCmdBlock:
VoidPtr cmdP; // ptr to command in dynamic heap chunk
VoidHand cmdBufH; // handle of command buffer chunk in data heap;
ULong blockSize; // size of block
ULong rcvdLen; // amount of data received so far
Byte transID; // received transaction id
Byte remoteSocket; // source socket
Boolean gotTickle; // Set to true if Tickle had been received
} PsrRcvParamType;
// PAD parameter for PrvSendReplyBlock and PrvReceiveCmdBlock:
typedef struct PsrPadParamType {
Byte localSocket; // local socket
SlkPktHeaderPtr slkHdrBufP; // ptr to buffer for serial link header
PadHeaderPtr pktBufP; // ptr to packet buffer of psrMaxPktBufSize bytes
Int initTimeoutSec;// initial receiver timeout seconds
PsrSendParamType send; // PAD sender-specific params
PsrRcvParamType rcv; // PAD receiver-specific params
} PsrPadParamType;
typedef PsrPadParamType* PsrPadParamPtr;
//
// PAD Server globals
//
// Prototype for the "user cancel" check callback function
typedef Int (*PsrUserCanProcPtr)(DWord userRef);
// Server globals
typedef struct PsrGlobalsType {
//Boolean inUse; // true when session is in use
//Boolean open; // true when session is open
Byte serverSocket; // session listenning socket
Int cmdWaitSec; // max seconds to wait for commands
// (-1 = forever)
PsrUserCanProcPtr canProcP; // ptr to user-cancel function
DWord userRef; // parameter for cancelProcP()
SlkPktHeaderType slkHdrBuf; // Serial Link header buffer
// packet data buffer
Word pktBuf[(psrMaxPktBufSize+1)/2];
Byte lastRcvdCmdTID; // transaction id of last command received
// (for duplicate filtration)
PsrPadParamType pad; // PAD routines parameter
} PsrGlobalsType;
typedef PsrGlobalsType* PsrGlobalsPtr;
/********************************************************************
* Session Manager Routines
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
//
// Server API
//
// RETURNED: 0 on success; otherwise: psrErrParam, psrErrInUse,
// psrErrMemory
Err PsrInit(Byte serverSocket, PsrUserCanProcPtr canProcP, DWord userRef,
Int cmdWaitSec)
SYS_TRAP(sysTrapPsrInit);
// MUST be called when done with the session to clean up server info
// if PsrInit() was successful
//
// * RETURNED: 0 on success; otherwise: psrErrParam
Err PsrClose(void) SYS_TRAP(sysTrapPsrClose);
// * RETURNED: 0 on success; otherwise: psrErrParam, psrErrTimeOut,
// * psrErrBlockFormat, psrErrUserCan
Err PsrGetCommand(DmOpenRef refDBP, VoidPtr* cmdPP, VoidHand* cmdBufHP,
WordPtr rcvdCmdLenP, BytePtr tidP, BytePtr remoteSocketP)
SYS_TRAP(sysTrapPsrGetCommand);
// * RETURNED: 0 on success; otherwise: psrErrParam, psrErrTooManyRetries,
// * psrErrSizeErr, psrErrUserCan
Err PsrSendReply(Byte remoteSocket, Byte refTID, PmSegmentPtr segP, Int segCount)
SYS_TRAP(sysTrapPsrSendReply);
#ifdef __cplusplus
}
#endif
/********************************************************************
* Session Protocol Macros
********************************************************************/
#endif // __PAD_SERVER_H__

View File

@ -0,0 +1,74 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* PadUtil.h
*
* Description:
* Packet Assembly/Disassembly utility definitions
*
* History:
* 8/11/95 vmk Created by Vitaly Marty Kruglikov
*
*******************************************************************/
#ifndef __PAD_UTIL_H__
#define __PAD_UTIL_H__
#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS
// Pilot common definitions
#include "Common.h"
#else // EMULATION_LEVEL != EMULATION_WINDOWS
// Pilot common definitions
#include <Common.h>
#endif // EMULATION_LEVEL == EMULATION_WINDOWS
#if EMULATION_WINDOWS != 1
LOGIC ERROR
#endif
// The PmSegmentType structure enables the caller to
// specify the block's data in multiple non-contiguous segments. For example, when
// sending a record, DesktopLink will specify the function header, the argument wrapper,
// the fixed record info, and the record data as two or more segments(one or more segments
// for the fixed structures and one segment for the record data). In such an instance,
// it is not practical(and sometimes not possible) to allocate a single data buffer to
// contain all that information contiguously.
//
typedef struct PmSegmentType {
VoidPtr dataP; // ptr to segment data
Word dataSize; // segment data size in bytes
Boolean wordAlign; // if true, this segments data will be sent
// at an even offset from the start of the
// block, padding the previous segment's
// data with a null byte, if necessary
} PmSegmentType;
typedef PmSegmentType* PmSegmentPtr;
#ifdef __cplusplus
extern "C" {
#endif
ULong PmAddSegmentSizes(Int segCount, PmSegmentType seg[]);
ULong PmCopyFromSegments(VoidPtr bufP, Int segCount, PmSegmentType seg[],
ULong blockOffset, ULong maxSize);
#ifdef __cplusplus
}
#endif
#endif // __PAD_UTIL_H__

View File

@ -0,0 +1,211 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* PadWS.h
*
* Description:
* Packet Assembly/Disassembly workstation-side definitions
*
* History:
* 8/11/95 vmk Created by Vitaly Marty Kruglikov
*
*******************************************************************/
#ifndef __PAD_WS_H__
#define __PAD_WS_H__
#if EMULATION_LEVEL == 1 // EMULATION_WINDOWS
// Pilot common definitions
#include "Common.h"
#include "SerLink.h"
// PAD Protocol definitions
#include "PadCommn.h"
#include "PadUtil.h"
#else // EMULATION_LEVEL != EMULATION_WINDOWS
// Pilot common definitions
#include <Common.h>
#include <SerialLinkMgr.h>
// PAD Protocol definitions
#include <PadCommn.h>
#include <PadUtil.h>
#endif // EMULATION_LEVEL == EMULATION_WINDOWS
#if EMULATION_WINDOWS != 1
LOGIC ERROR
#endif
/********************************************************************
* Session Manager Parameters
********************************************************************/
#define pmMaxPktBufSize ( sizeof(PadHeaderType) + \
padMaxPktDataSize )
// pmReplyWaitIntervalSec: when waiting for the beginning of a reply,
// the PAD receiver will wait up to this many seconds before before timing
// out on the first packet. The higher-level routine will perform
// its regular maintenance tasks (such as checking for user cancel) around
// calls to the PAD receiver.
#define pmReplyWaitIntervalSec 2
/************************************************************
* Session Protocol result codes
* (padErrorClass is defined in SystemMgr.h)
*************************************************************/
#define pmErrParam (padErrorClass | 1) // invalid parameter
#define pmErrTooManyRetries (padErrorClass | 2) // too many retries
#define pmErrTimedOut (padErrorClass | 4) // call timed out
#define pmErrInUse (padErrorClass | 5) // PAD Server/WS manager is in use
#define pmErrMemory (padErrorClass | 6) // not enough memory
#define pmErrUserCan (padErrorClass | 7) // cancelled by user
#define pmErrSizeErr (padErrorClass | 8) // reply block is too big
#define pmErrBlockFormat (padErrorClass | 9) // block format error
#define pmErrBufTooSmall (padErrorClass | 10) // buffer is too small
#define pmErrRemoteMemory (padErrorClass | 11) // remote memory error
/********************************************************************
* Session Manager Structures
********************************************************************/
//
// Packet Assembly/Disassembly structures
//
// PAD sender-specific parameters
typedef struct PmSendParamType {
// Send segments specification:
Int segCount; // number of segments to send
PmSegmentPtr segP; // ptr to array of segments
// Statistical information for fine-tuning and debugging:
ULong numAttempted; // number of data packets we attempted to send
ULong numSucceeded; // number of packets successfully sent
ULong retries; // number of retries
} PmSendParamType;
// PAD receiver-specific parameters
typedef struct PmRcvParamType {
VoidPtr rcvBufP; // ptr to receive buffer
ULong rcvBufSize; // receive buffer size
// Set by PrvReceiveReplyBlock:
ULong blockSize; // size of block
ULong rcvdLen; // amount of data received so far
} PmRcvParamType;
// PAD parameter for PrvSendCommandBlock and PrvReceiveReplyBlock:
typedef struct PmPadParamType {
Byte localSocket; // local socket
Byte remoteSocket; // remote socket
SlkPktHeaderPtr slkHdrBufP; // ptr to buffer for serial link header
PadHeaderPtr pktBufP; // ptr to packet buffer of pmMaxPktBufSize bytes
Int initTimeoutSec;// initial receiver timeout seconds
Byte transID; // current command/reply transaction ID
PmSendParamType send; // PAD sender-specific params
PmRcvParamType rcv; // PAD receiver-specific params
} PmPadParamType;
typedef PmPadParamType* PmPadParamPtr;
//
// PAD Manager Workstation-end globals
//
// Prototype for the "user cancel" check callback function
typedef Int (*PmUserCanProcPtr)(DWord userRef);
typedef struct PmWSGlobalsType {
Int replyWaitSec; // maximum number of seconds to
// wait for a command reply
PmUserCanProcPtr canProcP; // ptr to user-cancel function
DWord userRef; // parameter for cancelProcP()
SlkPktHeaderType slkHdrBuf; // serial link header buffer
// packet data buffer
Word pktBuf[(pmMaxPktBufSize+1)/2];
// Transaction id of last request which we originated
Byte lastTID; // last sent transaction id
PmPadParamType pad; // PAD routines parameter
} PmWSGlobalsType;
typedef PmWSGlobalsType* PmWSGlobalsPtr;
/********************************************************************
* Session Manager Routines
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
//
// Workstation API
//
// RETURNED: 0 on success; otherwise: pmErrParam, pmErrInUse,
// pmErrMemory
Err PmInitWS(Byte wsSocket, Byte serverSocket, PmUserCanProcPtr canProcP,
DWord userRef, Int replyWaitSec);
// MUST be called when done with the session to clean up workstation info
// if PmInitWS() was successful
//
// * RETURNED: 0 on success
Err PmCloseWS(void);
// * RETURNED: 0 on success;
Err PmSendTickle(void);
// * RETURNED: 0 on success; otherwise: pmErrParam, pmErrTimedOut,
// * pmErrBlockFormat, pmErrUserCan, pmErrSizeErr, pmErrBufTooSmall
Err PmSendCommand(PmSegmentPtr cmdSegP, Int cmdSegCount, Int replyWaitSec,
VoidPtr replyBufP, ULong replyBufSize, WordPtr replyLenP,
WordPtr actRcvdLenP);
// * RETURNED: 0 on success; otherwise: pmErrParam, pmErrTimedOut,
// * pmErrBlockFormat, pmErrUserCan, pmErrSizeErr, pmErrBufTooSmall
Err PmReceiveReply( Int replyWaitSec, Byte refTID, VoidPtr replyBufP,
ULong replyBufSize, WordPtr replyLenP, WordPtr actRcvdLenP);
#ifdef __cplusplus
}
#endif
/********************************************************************
* Session Protocol Macros
********************************************************************/
#endif // __PAD_WS_H__

View File

@ -0,0 +1,95 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* 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 <Common.h>
#include <SystemMgr.h>
/********************************************************************
* Pen Manager Errors
* the constant serErrorClass is defined in SystemMgr.h
********************************************************************/
#define penErrBadParam (penErrorClass | 1)
/********************************************************************
* Pen manager Routines
********************************************************************/
#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
/************************************************************
* Assembly Function Prototypes
*************************************************************/
#define _PenGetRawPen \
ASM_SYS_TRAP(sysTrapPenGetRawPen)
#endif //__PEN_MGR_H

View File

@ -0,0 +1,67 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* PenPrv.h
*
* Description:
* Private Include file for Pen manager
*
* History:
* 6/5/96 Created by Ron Marianetti
*
*******************************************************************/
#ifdef NON_PORTABLE
#ifndef __PEN_PRV_H
#define __PEN_PRV_H
/********************************************************************
* Pen Manager Constants
********************************************************************/
#define penCalibrateTop 10
#define penCalibrateLeft 10
#define penCalibrateBottom (hwrDisplayHeight-10)
#define penCalibrateRight (hwrDisplayWidth-10)
#define penInitDelay 30
#define penInitMaxDDZ 12 // max change allowed in dx or dy between
// 2 samples.
/********************************************************************
* Pen Manager Globals
********************************************************************/
typedef struct PenGlobalsType {
UInt xOffset, yOffset;
UInt xScale, yScale;
// This variable is incremented every time we detect the pen up,
// until we've seen it enough times to believe it.
UInt penRising;
// We keep this information around in order to throw out invalid
// points. Invalid points are most likey to occur as the pen is lifted
// and we filter them by throwing out points that show a drastic
// change in velocity in either the x or y direction
Int lastX; // x of last point (-1 if no previous point)
Int lastY; // y of last point
Int lastDX; // delta y of previous 2 points
Int lastDY; // delta x of previous 2 points
// Parameters for filter
UInt delay; // delay before reading A/D
UInt maxDDZ; // max 2nd derivative.
} PenGlobalsType;
typedef PenGlobalsType* PenGlobalsPtr;
#endif //__PEN_MGR_H
#endif // NON_PORTABLE

View File

@ -0,0 +1,179 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* Preferences.h
*
* Description:
* Header for the system preferences
*
* History:
* 2/31/95 rsf - Created by Roger Flores
*
*******************************************************************/
#ifndef __PREFERENCES_H__
#define __PREFERENCES_H__
/***********************************************************************
* Constants
***********************************************************************/
#define preferenceDataVersion 1
#define defaultAutoOffDuration 2 // minutes
#define prefFileTData 'PREF' // Database file type
#if EMULATION_LEVEL == EMULATION_NONE
#define defaultSysSoundLevel slOn
#define defaultAlarmSoundLevel slOn
#else // EMULATION_LEVEL != EMULATION_NONE
#define defaultSysSoundLevel slOff
#define defaultAlarmSoundLevel slOn
#endif
// This is Marketing's official list of countries. I didn't make this
// up - kcr.
typedef enum {
Australia,
Austria,
BelgiumDutch,
BelgiumFrench,
Brazil,
CanadaEnglish,
CanadaFrench,
Denmark,
Finland,
France,
Germany,
Iceland,
Ireland,
Italy,
Japan,
Mexico,
Netherlands,
NewZealand,
Norway,
Portugal,
SouthKorea,
Spain,
Sweden,
SwitzerlandFrench,
SwitzerlandGerman,
SwitzerlandItalian,
Taiwan,
UnitedStates,
UnitedKingdom
} CountryType;
typedef enum {
tfColon,
tfColonAMPM,
tfColon24h,
tfDot,
tfDotAMPM,
tfDot24h,
tfHoursAMPM,
tfHours24h
} TimeFormatType;
// These sound levels must corrospond to positions in the popup lists
// used by the preferences app.
typedef enum {
slOn = 0,
slOff = 1
} SoundLevelType;
// pass a TimeFormatType
#define Use24HourFormat(t) ((t) == tfColon24h || (t) == tfDot24h || (t) == tfHours24h)
#define TimeSeparator(t) ( t >= tfDot ? '.' : ':')
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
dfMYMed // Dec '95
} DateFormatType;
// The number format (thousands separator and decimal point).
typedef enum {
nfCommaPeriod,
nfPeriodComma,
nfSpaceComma,
nfApostrophePeriod
} NumberFormatType;
typedef struct {
Word 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
Byte weekStartDay; // Sunday or Monday
TimeFormatType timeFormat; // Format to display time in
NumberFormatType numberFormat; // Format to display numbers in
// system preferences
Byte autoOffDuration; // Time period before shutting off
SoundLevelType sysSoundLevel; // High, Med, Low, Off - error beeps
SoundLevelType alarmSoundLevel; // High, Med, Low, Off - 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
Word 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.
} SystemPreferencesType;
typedef SystemPreferencesType * SystemPreferencesPtr;
extern DmOpenRef PrefOpenPreferenceDB (void)
SYS_TRAP(sysTrapPrefOpenPreferenceDB);
extern void PrefGetPreferences(SystemPreferencesPtr p)
SYS_TRAP(sysTrapPrefGetPreferences);
extern void PrefSetPreferences(SystemPreferencesPtr p)
SYS_TRAP(sysTrapPrefSetPreferences);
extern Boolean PrefGetAppPreferences (ULong type, Int version, VoidPtr prefs,
Word prefsSize)
SYS_TRAP(sysTrapPrefGetAppPreferences);
void PrefSetAppPreferences (ULong type, Int version, VoidPtr prefs,
Word prefsSize)
SYS_TRAP(sysTrapPrefSetAppPreferences);
#endif // __PREFERENCES_H__

View File

@ -0,0 +1,59 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SerialLib68328.h
*
* Description:
* Include file for 68328 Serial Library
*
* History:
* 2/7/95 Created by Ron Marianetti
* vmk 8/21/95 Added defQData field to serial globals
*
*******************************************************************/
#ifndef __SERIAL_LIB_68328_H
#define __SERIAL_LIB_68328_H
// Pilot common definitions
#include <SerialMgr.h>
/********************************************************************
* Serial Globals
********************************************************************/
typedef struct SerGlobalsType {
UInt openCount; // # of times we've been opened
Int port; // DOLATER... NOT NEEDED ???
SerSettingsType settings;
Word lineErrors; // line errors bitfield
// Receive Queue. When the queue is empty, qStart == qEnd. When the queue
// is full, qStart = qEnd-1 (taking wrap-around into account if necessary).
Word qStart; // start offset of queue
Word qEnd; // end offset of queue
Word qSize; // size of queue
Ptr qData; // pointer to queue data
Ptr defQData; // pointer to default queue data
// Receive Queue semaphore info
Word smSignalSize; // How much the semaphore is waiting for
Long smID; // semaphore ID
DWord lastRcvTicks; // tick count of last received char
// For debugging
Word numReceived; // # of chars received since serial manager opened
Word lastErrorStatus; // receiver status of last line error
Word numRcvErrors; // # of receive line errors since serial manager opened
} SerGlobalsType;
typedef SerGlobalsType* SerGlobalsPtr;
#define serDefaultRcvBufferSize 0x200
#endif //__SERIAL_LIB_68328_H

View File

@ -0,0 +1,58 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SerialLib68328.h
*
* Description:
* Include file for 68328 Serial Library
*
* History:
* 2/7/95 Created by Ron Marianetti
* vmk 8/21/95 Added defQData field to serial globals
*
*******************************************************************/
#ifndef __SERIAL_LIB_68681_H
#define __SERIAL_LIB_68681_H
// Pilot common definitions
#include <SerialMgr.h>
/********************************************************************
* Serial Globals
********************************************************************/
typedef struct SerGlobalsType {
UInt openCount; // # of times we've been opened
Int port;
SerSettingsType settings;
Word lineErrors; // line errors bitfield
VoidPtr chanP; // pointer to this channel base in UART
Boolean staticGlobals; // true when initialized for debugger only
// Receive Queue. When the queue is empty, qStart == qEnd. When the queue
// is full, qStart = qEnd-1 (taking wrap-around into account if necessary).
Word qStart; // start offset of queue
Word qEnd; // end offset of queue
Word qSize; // size of queue
Ptr qData; // pointer to queue data
Ptr defQData; // pointer to default queue data
// Receive Queue semaphore info
Word smSignalSize; // How much the semaphore is waiting for
Long smID; // semaphore ID
Byte currentIMR; // current value of interrupt mask register
} SerGlobalsType;
typedef SerGlobalsType* SerGlobalsPtr;
#define serDefaultRcvBufferSize 0x200
#endif //__SERIAL_LIB_68681_H

View File

@ -0,0 +1,46 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SerialLibMac.h
*
* Description:
* Include file for Mac Serial Library
*
* History:
* 6/30/95 Created by Vitaly Kruglikov
*
*******************************************************************/
#ifndef __SERIAL_LIB_MAC_H
#define __SERIAL_LIB_MAC_H
// Pilot common definitions
#include "Common.h"
#include "SerialMgr.h"
/********************************************************************
* Serial Globals
********************************************************************/
typedef struct SerMacGlobalsType {
UInt refNum; // port reference number
UInt openCount; // number of times we have been opened
UInt port;
SerSettingsType settings;
Word lineErrors; // line errors bitfield
short inRefNum; // input driver reference number
short outRefNum; // output driver reference number
Ptr inBufP; // custom input buffer ptr
} SerMacGlobalsType;
typedef SerMacGlobalsType* SerMacGlobalsPtr;
#define serDefaultRcvBufferSize (30*1024)
#endif //__SERIAL_LIB_MAC_H

View File

@ -0,0 +1,432 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SerialLinkMgr.c
*
* 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 <Common.h>
#include <SystemMgr.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 Byte SlkPktHeaderChecksum;
typedef struct SlkPktHeaderType {
Word signature1; // X first 2 bytes of signature
Byte signature2; // X 3 and final byte of signature
Byte dest; // -> destination socket Id
Byte src; // -> src socket Id
Byte type; // -> packet type
Word bodySize; // X size of body
Byte 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 {
Word 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 {
Word 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) (*(BytePtr)(srcP))
#if (CPU_TYPE == CPU_x86)
#define slkGetPacketWordVal(srcP) \
( (Word) \
( \
((Word)((BytePtr)(srcP))[0] << 8) | \
((Word)((BytePtr)(srcP))[1]) \
) \
)
#else
#define slkGetPacketWordVal(srcP) \
( *((WordPtr)(srcP)) )
#endif //CPU_TYPE == CPU_x86
#if (CPU_TYPE == CPU_x86)
#define slkGetPacketDWordVal(srcP) \
( (DWord) \
( \
((DWord)((BytePtr)(srcP))[0] << 24) | \
((DWord)((BytePtr)(srcP))[1] << 16) | \
((DWord)((BytePtr)(srcP))[2] << 8) | \
((DWord)((BytePtr)(srcP))[3]) \
) \
)
#else
#define slkGetPacketDWordVal(srcP) \
( *((DWordPtr)(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) \
( *(BytePtr)(destP) = (Byte)(srcByteVal) )
#if (CPU_TYPE == CPU_x86)
#define slkSetPacketWordVal(srcWordVal, destP) \
\
do { \
Word ___srcVal; \
BytePtr ___srcValP; \
\
___srcVal = (Word)(srcWordVal); \
___srcValP = (BytePtr)(&___srcVal); \
\
((BytePtr)(destP))[0] = ___srcValP[1]; \
((BytePtr)(destP))[1] = ___srcValP[0]; \
} while( false )
#else
#define slkSetPacketWordVal(srcWordVal, destP) \
( *((WordPtr)(destP)) = (Word)(srcWordVal) )
#endif //CPU_TYPE == CPU_x86
#if (CPU_TYPE == CPU_x86)
#define slkSetPacketDWordVal(srcDWordVal, destP) \
do { \
DWord ___srcVal; \
BytePtr ___srcValP; \
\
___srcVal = (DWord)(srcDWordVal); \
___srcValP = (BytePtr)(&___srcVal); \
\
((BytePtr)(destP))[0] = ___srcValP[3]; \
((BytePtr)(destP))[1] = ___srcValP[2]; \
((BytePtr)(destP))[2] = ___srcValP[1]; \
((BytePtr)(destP))[3] = ___srcValP[0]; \
} while( false )
#else
#define slkSetPacketDWordVal(srcDWordVal, destP) \
( *((DWordPtr)(destP)) = (DWord)(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
ULong bodyBufferSize;
} SlkSocketListenType;
typedef SlkSocketListenType* SlkSocketListenPtr;
/*******************************************************************
* Prototypes
*******************************************************************/
#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(UInt libRefNum, UIntPtr 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(UInt socket)
SYS_TRAP(sysTrapSlkCloseSocket);
//-------------------------------------------------------------------
// Get the library refNum for a particular Socket
//-------------------------------------------------------------------
Err SlkSocketRefNum(UInt socket, UIntPtr refNumP)
SYS_TRAP(sysTrapSlkSocketRefNum);
//-------------------------------------------------------------------
// Set the in-packet timeout for a socket
//-------------------------------------------------------------------
Err SlkSocketSetTimeout(UInt socket, Long timeout)
SYS_TRAP(sysTrapSlkSocketSetTimeout);
//-------------------------------------------------------------------
// Flush a Socket
//-------------------------------------------------------------------
Err SlkFlushSocket(UInt socket, Long timeout)
SYS_TRAP(sysTrapSlkFlushSocket);
//-------------------------------------------------------------------
// Set up a Socket Listener
//-------------------------------------------------------------------
Err SlkSetSocketListener(UInt 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( UInt socket, Boolean andOtherSockets,
SlkPktHeaderPtr headerP, void* bodyP, UInt bodySize,
Long 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 //__SERIAL_LINK_H

View File

@ -0,0 +1,81 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SerialLinkPrv.c
*
* 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 5 // 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
// 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 {
Byte refNum; // refNum of library, or 0xFF if empty
SByte destID; // dest socketID, or -1 if none
} SlkRefInfoType;
typedef SlkRefInfoType* SlkRefInfoPtr;
typedef struct SlkGlobalsType {
UInt openCount;
Byte socketRefNum[slkMaxSockets];
Boolean socketOpen[slkMaxSockets];
SlkSocketListenPtr socketListenP[slkMaxSockets];
Word 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];
Byte transId; // next transaction ID
Long xmitSemaphoreID; // Semaphore ID for transmitting
Word numReceived; // # of packets received since serial link
// was opened.
} SlkGlobalsType;
typedef SlkGlobalsType* SlkGlobalsPtr;
#endif //__SERIALLINKPRV_H
#endif //NON_PORTABLE

View File

@ -0,0 +1,192 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SerialMgr.h
*
* Description:
* Include file for Serial manager
*
* History:
* 2/7/95 Created by Ron Marianetti
* 7/6/95 vmk added serDefaultSettings
*
*******************************************************************/
#ifndef __SERIAL_MGR_H
#define __SERIAL_MGR_H
// Pilot common definitions
#include <Common.h>
#include <SystemMgr.h>
/********************************************************************
* 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)
/********************************************************************
* Serial Settings Descriptor
********************************************************************/
typedef struct SerSettingsType {
ULong baudRate; // baud rate
ULong flags; // miscellaneous settings
Long ctsTimeout; // max # of ticks to wait for CTS to become asserted
// before transmitting; used only when
// configured with serSettingsFlagCTSAutoM.
} SerSettingsType;
typedef SerSettingsType* SerSettingsPtr;
#define serSettingsFlagStopBitsM 0x00000001 // mask for stop bits field
#define serSettingsFlagStopBits1 0x00000000 // 1 stop bits
#define serSettingsFlagStopBits2 0x00000001 // 2 stop bits
#define serSettingsFlagParityOnM 0x00000002 // mask for parity on
#define serSettingsFlagParityEvenM 0x00000004 // mask for parity even
#define serSettingsFlagXonXoffM 0x00000008 // mask for Xon/Xoff flow control
#define serSettingsFlagRTSAutoM 0x00000010 // mask for RTS rcv flow control
#define serSettingsFlagCTSAutoM 0x00000020 // mask for CTS xmit flow control
#define serSettingsFlagBitsPerCharM 0x000000C0 // mask for bits/char
#define serSettingsFlagBitsPerChar5 0x00000000 // 5 bits/char
#define serSettingsFlagBitsPerChar6 0x00000040 // 6 bits/char
#define serSettingsFlagBitsPerChar7 0x00000080 // 7 bits/char
#define serSettingsFlagBitsPerChar8 0x000000C0 // 8 bits/char
// Default settings
#define serDefaultSettings (serSettingsFlagBitsPerChar8 | \
serSettingsFlagStopBits1 | \
serSettingsFlagRTSAutoM)
#define serDefaultCTSTimeout (5*sysTicksPerSecond);
//
// 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
/********************************************************************
* Serial Library 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
// Acquires and opens a serial port with given baud and default settings.
Err SerOpen(UInt refNum, UInt port, ULong baud)
SYS_TRAP(sysLibTrapOpen);
// Closes the serial connection previously opened with SerOpen.
Err SerClose(UInt refNum)
SYS_TRAP(sysLibTrapClose);
// Puts serial library to sleep
Err SerSleep(UInt refNum)
SYS_TRAP(sysLibTrapSleep);
// Wake Serial library
Err SerWake(UInt refNum)
SYS_TRAP(sysLibTrapWake);
// Get attributes of the serial connection
Err SerGetSettings(UInt refNum, SerSettingsPtr settingsP)
SYS_TRAP(sysLibTrapCustom);
// Set attributes of the serial connection
Err SerSetSettings(UInt refNum, SerSettingsPtr settingsP)
SYS_TRAP(sysLibTrapCustom+1);
// Return status of serial connection
Word SerGetStatus(UInt refNum, BooleanPtr ctsOnP,
BooleanPtr dsrOnP)
SYS_TRAP(sysLibTrapCustom+2);
// Reset error condition of serial connection
Err SerClearErr(UInt refNum)
SYS_TRAP(sysLibTrapCustom+3);
// Sends a buffer of data (may queue it up and return).
Err SerSend(UInt refNum, VoidPtr bufP, ULong size)
SYS_TRAP(sysLibTrapCustom+4);
// Waits until the serial transmit buffer empties.
Err SerSendWait(UInt refNum, Long timeout)
SYS_TRAP(sysLibTrapCustom+5);
// Returns how many characters are left in the send queue waiting
// for transmission
Err SerSendCheck(UInt refNum, ULongPtr numBytesP)
SYS_TRAP(sysLibTrapCustom+6);
// Flushes the data out of the transmit buffer
Err SerSendFlush(UInt refNum)
SYS_TRAP(sysLibTrapCustom+7);
// Receives a buffer of data of the given size.
Err SerReceive(UInt refNum, VoidPtr bufP, ULong bytes, Long timeout)
SYS_TRAP(sysLibTrapCustom+8);
// Waits for at least 'bytes' bytes of data to arrive at the serial input.
// but does not read them in
Err SerReceiveWait(UInt refNum, ULong bytes, Long timeout)
SYS_TRAP(sysLibTrapCustom+9);
// Returns how many characters are in the receive queue
Err SerReceiveCheck(UInt refNum, ULongPtr numBytesP)
SYS_TRAP(sysLibTrapCustom+10);
// Flushes any data coming into the serial port, discarding the data.
void SerReceiveFlush(UInt refNum, Long timeout)
SYS_TRAP(sysLibTrapCustom+11);
// Specify a new input buffer. To restore the original buffer, pass
// bufSize = 0.
Err SerSetReceiveBuffer(UInt refNum, VoidPtr bufP, UInt bufSize)
SYS_TRAP(sysLibTrapCustom+12);
// The receive character interrupt service routine, called by kernel when
// a UART interrupt is detected. DOLATER... generalize ISP's for multiple Serial libs
Boolean SerReceiveISP(void)
SYS_TRAP(sysTrapSerReceiveISP);
#ifdef __cplusplus
}
#endif
#endif //__SERIAL_MGR_H

View File

@ -0,0 +1,161 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* 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 <Common.h>
#include <SysTraps.h> // Trap Numbers.
/************************************************************
* Sound Manager constants
*
*************************************************************/
// Sound Manager max and default volume levels
#define sndMaxAmp 64
//#define sndVolumeMask 0x0ff
#define sndDefaultAmp sndMaxAmp
/************************************************************
* Sound Manager data structures
*
*************************************************************/
//
// Command numbers for SndCommandType's cmd field
//
typedef enum SndCmdIDType {
sndCmdFreqDurationAmp = 1 // play a sound
// param1 = frequency in Hz
// param2 = duration in milliseconds
// param3 = amplitude (0 - sndMaxAmp)
} SndCmdIDType;
//
// SndCommandType: used by SndDoCmd()
//
typedef struct SndCommandType {
SndCmdIDType cmd; // command id
Long param1; // first parameter
UInt param2; // second parameter
UInt param3; // third parameter
} SndCommandType;
typedef SndCommandType* SndCommandPtr;
//
// Beep numbers used by SndSysBeep()
//
typedef enum SndSysBeepType {
sndInfo = 1,
sndWarning,
sndError,
sndStartUp,
sndAlarm,
sndConfirmation,
sndClick
} SndSysBeepType;
/************************************************************
* 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
/********************************************************************
* 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 __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
void SndSetDefaultVolume(UIntPtr alarmAmpP, UIntPtr sysAmpP, UIntPtr defAmpP)
SYS_TRAP(sysTrapSndSetDefaultVolume);
// Gets default sound volume levels
//
// Any parameter may be passed as NULL
void SndGetDefaultVolume(UIntPtr alarmAmpP, UIntPtr sysAmpP, UIntPtr defAmpP)
SYS_TRAP(sysTrapSndGetDefaultVolume);
// Executes a sound command on the given sound channel (pass
// channelP = 0 to use the shared channel).
Err SndDoCmd(VoidPtr /*SndChanPtr*/ channelP, SndCommandPtr cmdP, Boolean noWait)
SYS_TRAP(sysTrapSndDoCmd);
// Plays one of several defined system beeps/sounds (see sndSysBeep...
// constants).
void SndPlaySystemSound(SndSysBeepType beepID)
SYS_TRAP(sysTrapSndPlaySystemSound);
#ifdef __cplusplus
}
#endif
/************************************************************
* Sound Manager Macros
*
*************************************************************/
#endif // __SOUND_MGR_H__

View File

@ -0,0 +1,61 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SoundPrv.h
*
* Description:
* Private Include file for Sound Manager
*
* History:
* 4/11/95 VMK - Created by Vitaly Kruglikov
*
*******************************************************************/
#ifdef NON_PORTABLE
#ifndef __SOUNDPRV_H__
#define __SOUNDPRV_H__
/************************************************************
* Sound Manager constants
*************************************************************/
#define sndSamplingRate 8000 // 8 kHz
// DOLATER: determine appropriate values experimentally (TBD)
#define sndBeepDurationMSec 70 // msec
#define sndConfirmationDurationMSec 70 // msec
#define sndClickDurationMSec 9 // msec
// These frequencies are more audible on the current hardware.
#define sndInfoFreq 500 // Hz
#define sndWarningFreq 500 // Hz
#define sndErrorFreq 500 // Hz
#define sndConfirmationFreq 500 // Hz
#define sndStartUpFreq 1000 // Hz
#define sndClickFreq 200 // Hz
/*******************************************************************
* Sound Manager Globals
*
*******************************************************************/
typedef struct SndGlobalsType {
Long smID; // semaphore id for data access integrity
Byte sysAmp; // system sound amplitude(0-sndMaxVolume)
Byte alarmAmp; // alarm sound amplitude(0-sndMaxVolume)
Byte defAmp; // default amplitude for other sounds(0-sndMaxVolume)
} SndGlobalsType;
typedef SndGlobalsType* SndGlobalsPtr;
#endif // __SOUNDPRV_H__
#endif // NON_PORTABLE

View File

@ -0,0 +1,74 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* StringMgr.h
*
* Description:
* String manipulation functions
*
* History:
* 11/09/94 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifndef __STRINGMGR_H__
#define __STRINGMGR_H__
// Include elementary types
#include <Common.h> // Basic types
#include <SysTraps.h> // Trap Numbers.
#ifdef __cplusplus
extern "C" {
#endif
// String Manipulation routines
CharPtr StrCopy(CharPtr dst, CharPtr src)
SYS_TRAP(sysTrapStrCopy);
CharPtr StrCat(CharPtr dst, CharPtr src)
SYS_TRAP(sysTrapStrCat);
UInt StrLen(CharPtr src)
SYS_TRAP(sysTrapStrLen);
Int StrCompare(CharPtr s1, CharPtr s2)
SYS_TRAP(sysTrapStrCompare);
Int StrCaselessCompare(CharPtr s1, CharPtr s2)
SYS_TRAP(sysTrapStrCaselessCompare);
CharPtr StrToLower(CharPtr dst, CharPtr src)
SYS_TRAP(sysTrapStrToLower);
CharPtr StrIToA(CharPtr s, Long i)
SYS_TRAP(sysTrapStrIToA);
CharPtr StrIToH(CharPtr s, ULong i)
SYS_TRAP(sysTrapStrIToH);
CharPtr StrChr (CharPtr str, Int chr)
SYS_TRAP(sysTrapStrChr);
CharPtr StrStr (CharPtr str, CharPtr token)
SYS_TRAP(sysTrapStrStr);
Int StrAToI (CharPtr str)
SYS_TRAP(sysTrapStrAToI);
#ifdef __cplusplus
}
#endif
#endif //__STRINGMGR_H

View File

@ -0,0 +1,64 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SysAll.h
*
* Description:
* Includes all system header files in order to help compiler
* do pre-compiled headers
*
* History:
* 11/17/94 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifndef __SYSALL_H__
#define __SYSALL_H__
//*********************************************************************
// If not included from Pilot.h, as is the case when compiling UI modules,
// use the SysAll pre-compiled header file.
//*********************************************************************
#ifndef __Pilot_H__
#ifndef __GNUC__
#ifndef PILOT_PRECOMPILED_HEADERS_OFF
#if !__option(precompile)
#ifdef CMD_LINE_BUILD
#include "SysAll.h.obj.mpw"
#else
#include "SysAll.h.obj"
#endif
#define __INCLUDED_SYSALL_H_OBJ__
#endif
#endif
#endif
#endif
// Fastest compilation speed is obtained by not including these
// headers when the pre-compiled header is used.
#ifndef __INCLUDED_SYSALL_H_OBJ__
#include <Common.h>
#include <SysTraps.h>
#include <SystemMgr.h>
#include <DebugMgr.h>
#include <ErrorMgr.h>
#include <StringMgr.h>
#include <SysUtils.h>
#include <MemoryMgr.h>
#include <DataMgr.h>
#include <Preferences.h>
#include <TimeMgr.h>
#include <AlarmMgr.h>
#include <SoundMgr.h>
#include <Keyboard.h>
#endif
#endif // __SYSALL_H__

View File

@ -0,0 +1,35 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SysAll.pch
*
* Description:
* Source file used to generate pre-compiled headers for Pilot
* System Modules
*
* History:
* 6/6/95 RM - Created by Ron Marianetti
*
*******************************************************************/
// By including this module in your CodeWarrior project. You can automatically
// regenerate the pre-compiled header file used by the System modules called
// SysAll.h.obj
#ifdef EMULATION_LEVEL
#pragma precompile_target ":Obj:SysAll.h.obj.mpw"
#else
#pragma precompile_target ":Obj:SysAll.h.obj"
#endif
// Define this so that SysAll.h doesn't try to include the pre-compiled header
// that we're currently building.
#define BUILDING_PRECOMPILED_HEADER
// These are the Pilot-only header files.
#include <SysAll.h>

View File

@ -0,0 +1,169 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SysEvtMgr.h
*
* Description:
* Header for the System Event Manager
*
* History:
* 3/22/95 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifndef __SYSEVTMGR_H__
#define __SYSEVTMGR_H__
#include <Common.h>
/************************************************************
* System Event Manager Errors
*************************************************************/
#define evtErrParamErr (evtErrorClass | 1)
#define evtErrQueueFull (evtErrorClass | 2)
#define evtErrQueueEmpty (evtErrorClass | 3)
/************************************************************
* System Event Manager procedures
*************************************************************/
#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(EventPtr eventP, Long timeout)
SYS_TRAP(sysTrapEvtGetSysEvent);
// 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(Ptr penQueueP, ULong size)
SYS_TRAP(sysTrapEvtSetPenQueuePtr);
// Return size of current pen queue in bytes
ULong 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(Ptr keyQueueP, ULong size)
SYS_TRAP(sysTrapEvtSetKeyQueuePtr);
// Return size of current key queue in bytes
ULong EvtKeyQueueSize(void)
SYS_TRAP(sysTrapEvtKeyQueueSize);
// Flush the key queue
Err EvtFlushKeyQueue(void)
SYS_TRAP(sysTrapEvtFlushKeyQueue);
// Append a key to the key queue.
Err EvtEnqueueKey(UInt ascii, UInt keycode, UInt 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.
Err EvtDequeueKeyEvent(EventPtr eventP)
SYS_TRAP(sysTrapEvtDequeueKeyEvent);
//-----------------------------------------------------------------
// 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);
// Set Graffiti enabled or disabled.
void EvtEnableGraffiti(Boolean enable)
SYS_TRAP(sysTrapEvtEnableGraffiti);
#ifdef __cplusplus
}
#endif
/************************************************************
* Assembly Function Prototypes
*************************************************************/
#define _EvtEnqueuePenPoint \
ASM_SYS_TRAP(sysTrapEvtEnqueuePenPoint)
#endif //__SYSEVTMGR_H__

View File

@ -0,0 +1,220 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SysEvtPrv.h
*
* Description:
* Private Header for the System Event Manager
*
* History:
* 8/10/95 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifdef NON_PORTABLE
#ifndef __SYSEVTPRV_H__
#define __SYSEVTPRV_H__
/************************************************************
* 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 {
Int start; // start byte offset
Int end; // end byte offset
Int size; // size of queue in bytes
UInt 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.
PointType addLast; // last point captured
Int addStrokeStart; // offset in queue to start of stroke
// currently being added to queue
// -1 : no stroke being captured
UInt strokesRemoved; // running count: # of strokes removed from queue.
UInt strokesAdded; // running count: # of strokes added to queue.
Int 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.
Byte data[1]; // '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 {
UInt start; // start byte offset
UInt end; // end byte offset
UInt size; // size of queue in bytes
Byte data[1]; // 'size' bytes of data
} KeyQueueType;
typedef KeyQueueType* KeyQueuePtr;
/************************************************************
* 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.
*************************************************************/
typedef struct PenBtnInfoType {
RectangleType boundsR; // bounding rectangle of button
UInt asciiCode; // ascii code for key event
UInt keyCode; // virtual key code for key event
UInt modifiers; // modifiers for key event
} PenBtnInfoType;
typedef PenBtnInfoType* PenBtnInfoPtr;
/************************************************************
* Key constants
*************************************************************/
#define evtKeyStringEscape 0x01 // Escape byte for encoded key strings
// passed to EvtEnqueueKeyString or stored
// in key queue.
#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
UInt 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
UInt appAreaBottom; // bottom coordinate of application area.
UInt penX; // current pen location and state
UInt penY;
Boolean penDown;
Boolean displayingBatteryAlert; // to avoid re-entering battery dialog
UInt lastPenX; // last pen location and state
UInt 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
Long smID; // Semaphore set by interrupt routines
// whenever a low level event is detected
Byte gremlinsFlags; // flag to indicate if gremlins is running and
// if we'er doing an event trace.
Boolean idle;
} SysEvtMgrGlobalsType;
typedef SysEvtMgrGlobalsType* SysEvtMgrGlobalsPtr;
/************************************************************
* System Event Manager procedures
*************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
// Return pointer to the pen based button list
PenBtnInfoPtr EvtGetPenBtnList(UIntPtr numButtons)
SYS_TRAP(sysTrapEvtGetPenBtnList);
#ifdef __cplusplus
}
#endif
#endif //__SYSEVTPRV_H__
#endif // NON_PORTABLE

View File

@ -0,0 +1,849 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SysTraps.h
*
* Description:
* Pilot Traps
*
* History:
* 6/13/95 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifndef __SYSTRAPS_H_
#define __SYSTRAPS_H_
// Include elementary types
#include <Common.h>
#include <M68KHwr.h>
// Regular traps start here and go up by 1's
#define sysTrapBase 0xA000
typedef enum {
sysTrapMemInit = sysTrapBase,
sysTrapMemInitHeapTable,
sysTrapMemStoreInit,
sysTrapMemCardFormat,
sysTrapMemCardInfo,
sysTrapMemStoreInfo,
sysTrapMemStoreSetInfo,
sysTrapMemNumHeaps,
sysTrapMemNumRAMHeaps,
sysTrapMemHeapID,
sysTrapMemHeapPtr,
sysTrapMemHeapFreeBytes,
sysTrapMemHeapSize,
sysTrapMemHeapFlags,
sysTrapMemHeapCompact,
sysTrapMemHeapInit,
sysTrapMemHeapFreeByOwnerID,
sysTrapMemChunkNew,
sysTrapMemChunkFree,
sysTrapMemPtrNew,
sysTrapMemPtrRecoverHandle,
sysTrapMemPtrFlags,
sysTrapMemPtrSize,
sysTrapMemPtrOwner,
sysTrapMemPtrHeapID,
sysTrapMemPtrCardNo,
sysTrapMemPtrToLocalID,
sysTrapMemPtrSetOwner,
sysTrapMemPtrResize,
sysTrapMemPtrResetLock,
sysTrapMemHandleNew,
sysTrapMemHandleLockCount,
sysTrapMemHandleToLocalID,
sysTrapMemHandleLock,
sysTrapMemHandleUnlock,
sysTrapMemLocalIDToGlobal,
sysTrapMemLocalIDKind,
sysTrapMemLocalIDToPtr,
sysTrapMemMove,
sysTrapMemSet,
sysTrapMemStoreSearch,
sysTrapMemPtrDataStorage,
sysTrapMemKernelInit,
sysTrapMemHandleFree,
sysTrapMemHandleFlags,
sysTrapMemHandleSize,
sysTrapMemHandleOwner,
sysTrapMemHandleHeapID,
sysTrapMemHandleDataStorage,
sysTrapMemHandleCardNo,
sysTrapMemHandleSetOwner,
sysTrapMemHandleResize,
sysTrapMemHandleResetLock,
sysTrapMemPtrUnlock,
sysTrapMemLocalIDToLockedPtr,
sysTrapMemSetDebugMode,
sysTrapMemHeapScramble,
sysTrapMemHeapCheck,
sysTrapMemNumCards,
sysTrapMemDebugMode,
sysTrapMemSemaphoreReserve,
sysTrapMemSemaphoreRelease,
sysTrapMemHeapDynamic,
sysTrapMemNVParams,
sysTrapDmInit,
sysTrapDmCreateDatabase,
sysTrapDmDeleteDatabase,
sysTrapDmNumDatabases,
sysTrapDmGetDatabase,
sysTrapDmFindDatabase,
sysTrapDmDatabaseInfo,
sysTrapDmSetDatabaseInfo,
sysTrapDmDatabaseSize,
sysTrapDmOpenDatabase,
sysTrapDmCloseDatabase,
sysTrapDmNextOpenDatabase,
sysTrapDmOpenDatabaseInfo,
sysTrapDmResetRecordStates,
sysTrapDmGetLastErr,
sysTrapDmNumRecords,
sysTrapDmRecordInfo,
sysTrapDmSetRecordInfo,
sysTrapDmAttachRecord,
sysTrapDmDetachRecord,
sysTrapDmMoveRecord,
sysTrapDmNewRecord,
sysTrapDmRemoveRecord,
sysTrapDmDeleteRecord,
sysTrapDmArchiveRecord,
sysTrapDmNewHandle,
sysTrapDmRemoveSecretRecords,
sysTrapDmQueryRecord,
sysTrapDmGetRecord,
sysTrapDmResizeRecord,
sysTrapDmReleaseRecord,
sysTrapDmGetResource,
sysTrapDmGet1Resource,
sysTrapDmReleaseResource,
sysTrapDmResizeResource,
sysTrapDmNextOpenResDatabase,
sysTrapDmFindResourceType,
sysTrapDmFindResource,
sysTrapDmSearchResource,
sysTrapDmNumResources,
sysTrapDmResourceInfo,
sysTrapDmSetResourceInfo,
sysTrapDmAttachResource,
sysTrapDmDetachResource,
sysTrapDmNewResource,
sysTrapDmRemoveResource,
sysTrapDmGetResourceIndex,
sysTrapDmQuickSort,
sysTrapDmQueryNextInCategory,
sysTrapDmNumRecordsInCategory,
sysTrapDmPositionInCategory,
sysTrapDmSeekRecordInCategory,
sysTrapDmMoveCategory,
sysTrapDmOpenDatabaseByTypeCreator,
sysTrapDmWrite,
sysTrapDmStrCopy,
sysTrapDmGetNextDatabaseByTypeCreator,
sysTrapDmWriteCheck,
sysTrapDmMoveOpenDBContext,
sysTrapDmFindRecordByID,
sysTrapDmGetAppInfoID,
sysTrapDmFindSortPosition,
sysTrapDmSet,
sysTrapDmCreateDatabaseFromImage,
sysTrapDbgSrcMessage,
sysTrapDbgMessage,
sysTrapDbgGetMessage,
sysTrapDbgCommSettings,
sysTrapErrDisplayFileLineMsg,
sysTrapErrSetJump,
sysTrapErrLongJump,
sysTrapErrThrow,
sysTrapErrExceptionList,
sysTrapSysBroadcastActionCode,
sysTrapSysUnimplemented,
sysTrapSysColdBoot,
sysTrapSysReset,
sysTrapSysDoze,
sysTrapSysAppLaunch,
sysTrapSysAppStartup,
sysTrapSysAppExit,
sysTrapSysSetA5,
sysTrapSysSetTrapAddress,
sysTrapSysGetTrapAddress,
sysTrapSysTranslateKernelErr,
sysTrapSysSemaphoreCreate,
sysTrapSysSemaphoreDelete,
sysTrapSysSemaphoreWait,
sysTrapSysSemaphoreSignal,
sysTrapSysTimerCreate,
sysTrapSysTimerWrite,
sysTrapSysTaskCreate,
sysTrapSysTaskDelete,
sysTrapSysTaskTrigger,
sysTrapSysTaskID,
sysTrapSysTaskUserInfoPtr,
sysTrapSysTaskDelay,
sysTrapSysTaskSetTermProc,
sysTrapSysUILaunch,
sysTrapSysNewOwnerID,
sysTrapSysSemaphoreSet,
sysTrapSysDisableInts,
sysTrapSysRestoreStatus,
sysTrapSysUIAppSwitch,
sysTrapSysCurAppInfoP,
sysTrapSysHandleEvent,
sysTrapSysInit,
sysTrapSysQSort,
sysTrapSysCurAppDatabase,
sysTrapSysFatalAlert,
sysTrapSysResSemaphoreCreate,
sysTrapSysResSemaphoreDelete,
sysTrapSysResSemaphoreReserve,
sysTrapSysResSemaphoreRelease,
sysTrapSysSleep,
sysTrapSysKeyboardDialog,
sysTrapSysAppLauncherDialog,
sysTrapSysSetPerformance,
sysTrapSysBatteryInfo,
sysTrapSysLibInstall,
sysTrapSysLibRemove,
sysTrapSysLibTblEntry,
sysTrapSysLibFind,
sysTrapSysBatteryDialog,
sysTrapSysCopyStringResource,
sysTrapSysKernelInfo,
sysTrapSysLaunchConsole,
sysTrapSysTimerDelete,
sysTrapSysSetAutoOffTime,
sysTrapSysFormPointerArrayToStrings,
sysTrapSysRandom,
sysTrapSysTaskSwitching,
sysTrapSysTimerRead,
sysTrapStrCopy,
sysTrapStrCat,
sysTrapStrLen,
sysTrapStrCompare,
sysTrapStrIToA,
sysTrapStrCaselessCompare,
sysTrapStrIToH,
sysTrapStrChr,
sysTrapStrStr,
sysTrapStrAToI,
sysTrapStrToLower,
sysTrapSerReceiveISP,
sysTrapSlkOpen,
sysTrapSlkClose,
sysTrapSlkOpenSocket,
sysTrapSlkCloseSocket,
sysTrapSlkSocketRefNum,
sysTrapSlkSocketSetTimeout,
sysTrapSlkFlushSocket,
sysTrapSlkSetSocketListener,
sysTrapSlkSendPacket,
sysTrapSlkReceivePacket,
sysTrapSlkSysPktDefaultResponse,
sysTrapSlkProcessRPC,
sysTrapConPutS,
sysTrapConGetS,
sysTrapFplInit,
sysTrapFplFree,
sysTrapFplFToA,
sysTrapFplAToF,
sysTrapFplBase10Info,
sysTrapFplLongToFloat,
sysTrapFplFloatToLong,
sysTrapFplFloatToULong,
sysTrapFplMul,
sysTrapFplAdd,
sysTrapFplSub,
sysTrapFplDiv,
sysTrapScrInit,
sysTrapScrCopyRectangle,
sysTrapScrDrawChars,
sysTrapScrLineRoutine,
sysTrapScrRectangleRoutine,
sysTrapScrScreenInfo,
sysTrapScrDrawNotify,
sysTrapScrSendUpdateArea,
sysTrapScrCompressScanLine,
sysTrapScrDeCompressScanLine,
sysTrapTimGetSeconds,
sysTrapTimSetSeconds,
sysTrapTimGetTicks,
sysTrapTimInit,
sysTrapTimSetAlarm,
sysTrapTimGetAlarm,
sysTrapTimHandleInterrupt,
sysTrapTimSecondsToDateTime,
sysTrapTimDateTimeToSeconds,
sysTrapTimAdjust,
sysTrapTimSleep,
sysTrapTimWake,
sysTrapCategoryCreateList,
sysTrapCategoryFreeList,
sysTrapCategoryFind,
sysTrapCategoryGetName,
sysTrapCategoryEdit,
sysTrapCategorySelect,
sysTrapCategoryGetNext,
sysTrapCategorySetTriggerLabel,
sysTrapCategoryTruncateName,
sysTrapClipboardAddItem,
sysTrapClipboardCheckIfItemExist,
sysTrapClipboardGetItem,
sysTrapCtlDrawControl,
sysTrapCtlEraseControl,
sysTrapCtlHideControl,
sysTrapCtlShowControl,
sysTrapCtlGetValue,
sysTrapCtlSetValue,
sysTrapCtlGetLabel,
sysTrapCtlSetLabel,
sysTrapCtlHandleEvent,
sysTrapCtlHitControl,
sysTrapCtlSetEnabled,
sysTrapCtlSetUsable,
sysTrapCtlEnabled,
sysTrapEvtInitialize,
sysTrapEvtAddEventToQueue,
sysTrapEvtCopyEvent,
sysTrapEvtGetEvent,
sysTrapEvtGetPen,
sysTrapEvtSysInit,
sysTrapEvtGetSysEvent,
sysTrapEvtProcessSoftKeyStroke,
sysTrapEvtGetPenBtnList,
sysTrapEvtSetPenQueuePtr,
sysTrapEvtPenQueueSize,
sysTrapEvtFlushPenQueue,
sysTrapEvtEnqueuePenPoint,
sysTrapEvtDequeuePenStrokeInfo,
sysTrapEvtDequeuePenPoint,
sysTrapEvtFlushNextPenStroke,
sysTrapEvtSetKeyQueuePtr,
sysTrapEvtKeyQueueSize,
sysTrapEvtFlushKeyQueue,
sysTrapEvtEnqueueKey,
sysTrapEvtDequeueKeyEvent,
sysTrapEvtWakeup,
sysTrapEvtResetAutoOffTimer,
sysTrapEvtKeyQueueEmpty,
sysTrapEvtEnableGraffiti,
sysTrapFldCopy,
sysTrapFldCut,
sysTrapFldDrawField,
sysTrapFldEraseField,
sysTrapFldFreeMemory,
sysTrapFldGetBounds,
sysTrapFldGetTextPtr,
sysTrapFldGetSelection,
sysTrapFldHandleEvent,
sysTrapFldPaste,
sysTrapFldRecalculateField,
sysTrapFldSetBounds,
sysTrapFldSetText,
sysTrapFldGetFont,
sysTrapFldSetFont,
sysTrapFldSetSelection,
sysTrapFldGrabFocus,
sysTrapFldReleaseFocus,
sysTrapFldGetInsPtPosition,
sysTrapFldSetInsPtPosition,
sysTrapFldSetScrollPosition,
sysTrapFldGetScrollPosition,
sysTrapFldGetTextHeight,
sysTrapFldGetTextAllocatedSize,
sysTrapFldGetTextLength,
sysTrapFldScrollField,
sysTrapFldScrollable,
sysTrapFldGetVisibleLines,
sysTrapFldGetAttributes,
sysTrapFldSetAttributes,
sysTrapFldSendChangeNotification,
sysTrapFldCalcFieldHeight,
sysTrapFldGetTextHandle,
sysTrapFldCompactText,
sysTrapFldDirty,
sysTrapFldWordWrap,
sysTrapFldSetTextAllocatedSize,
sysTrapFldSetTextHandle,
sysTrapFldSetTextPtr,
sysTrapFldGetMaxChars,
sysTrapFldSetMaxChars,
sysTrapFldSetUsable,
sysTrapFldInsert,
sysTrapFldDelete,
sysTrapFldUndo,
sysTrapFldSetDirty,
sysTrapFldSendHeightChangeNotification,
sysTrapFldMakeFullyVisible,
sysTrapFntGetFont,
sysTrapFntSetFont,
sysTrapFntGetFontPtr,
sysTrapFntBaseLine,
sysTrapFntCharHeight,
sysTrapFntLineHeight,
sysTrapFntAverageCharWidth,
sysTrapFntCharWidth,
sysTrapFntCharsWidth,
sysTrapFntDescenderHeight,
sysTrapFntCharsInWidth,
sysTrapFntLineWidth,
sysTrapFrmInitForm,
sysTrapFrmDeleteForm,
sysTrapFrmDrawForm,
sysTrapFrmEraseForm,
sysTrapFrmGetActiveForm,
sysTrapFrmSetActiveForm,
sysTrapFrmGetActiveFormID,
sysTrapFrmGetUserModifiedState,
sysTrapFrmSetNotUserModified,
sysTrapFrmGetFocus,
sysTrapFrmSetFocus,
sysTrapFrmHandleEvent,
sysTrapFrmGetFormBounds,
sysTrapFrmGetWindowHandle,
sysTrapFrmGetFormId,
sysTrapFrmGetFormPtr,
sysTrapFrmGetNumberOfObjects,
sysTrapFrmGetObjectIndex,
sysTrapFrmGetObjectId,
sysTrapFrmGetObjectType,
sysTrapFrmGetObjectPtr,
sysTrapFrmHideObject,
sysTrapFrmShowObject,
sysTrapFrmGetObjectPosition,
sysTrapFrmSetObjectPositon,
sysTrapFrmGetControlValue,
sysTrapFrmSetControlValue,
sysTrapFrmGetControlGroupSelection,
sysTrapFrmSetControlGroupSelection,
sysTrapFrmCopyLabel,
sysTrapFrmSetLabel,
sysTrapFrmGetLabel,
sysTrapFrmSetCategoryLabel,
sysTrapFrmGetTitle,
sysTrapFrmSetTitle,
sysTrapFrmAlert,
sysTrapFrmDoDialog,
sysTrapFrmCustomAlert,
sysTrapFrmHelp,
sysTrapFrmUpdateScrollers,
sysTrapFrmGetFirstForm,
sysTrapFrmVisible,
sysTrapFrmGetObjectBounds,
sysTrapFrmCopyTitle,
sysTrapFrmGotoForm,
sysTrapFrmPopupForm,
sysTrapFrmUpdateForm,
sysTrapFrmReturnToForm,
sysTrapFrmSetEventHandler,
sysTrapFrmDispatchEvent,
sysTrapFrmCloseAllForms,
sysTrapFrmSaveAllForms,
sysTrapFrmGetGadgetData,
sysTrapFrmSetGadgetData,
sysTrapFrmSetCategoryTrigger,
sysTrapUIInitialize,
sysTrapUIReset,
sysTrapInsPtInitialize,
sysTrapInsPtSetLocation,
sysTrapInsPtGetLocation,
sysTrapInsPtEnable,
sysTrapInsPtEnabled,
sysTrapInsPtSetHeight,
sysTrapInsPtGetHeight,
sysTrapInsPtCheckBlink,
sysTrapLstSetDrawFunction,
sysTrapLstDrawList,
sysTrapLstEraseList,
sysTrapLstGetSelection,
sysTrapLstGetSelectionText,
sysTrapLstHandleEvent,
sysTrapLstSetHeight,
sysTrapLstSetSelection,
sysTrapLstSetListChoices,
sysTrapLstMakeItemVisible,
sysTrapLstGetNumberOfItems,
sysTrapLstPopupList,
sysTrapLstSetPosition,
sysTrapMenuInit,
sysTrapMenuDispose,
sysTrapMenuHandleEvent,
sysTrapMenuDrawMenu,
sysTrapMenuEraseStatus,
sysTrapMenuGetActiveMenu,
sysTrapMenuSetActiveMenu,
sysTrapRctSetRectangle,
sysTrapRctCopyRectangle,
sysTrapRctInsetRectangle,
sysTrapRctOffsetRectangle,
sysTrapRctPtInRectangle,
sysTrapRctGetIntersection,
sysTrapTblDrawTable,
sysTrapTblEraseTable,
sysTrapTblHandleEvent,
sysTrapTblGetItemBounds,
sysTrapTblSelectItem,
sysTrapTblGetItemInt,
sysTrapTblSetItemInt,
sysTrapTblSetItemStyle,
sysTrapTblUnhighlightSelection,
sysTrapTblSetRowUsable,
sysTrapTblGetNumberOfRows,
sysTrapTblSetCustomDrawProcedure,
sysTrapTblSetRowSelectable,
sysTrapTblRowSelectable,
sysTrapTblSetLoadDataProcedure,
sysTrapTblSetSaveDataProcedure,
sysTrapTblGetBounds,
sysTrapTblSetRowHeight,
sysTrapTblGetColumnWidth,
sysTrapTblGetRowID,
sysTrapTblSetRowID,
sysTrapTblMarkRowInvalid,
sysTrapTblMarkTableInvalid,
sysTrapTblGetSelection,
sysTrapTblInsertRow,
sysTrapTblRemoveRow,
sysTrapTblRowInvalid,
sysTrapTblRedrawTable,
sysTrapTblRowUsable,
sysTrapTblReleaseFocus,
sysTrapTblEditing,
sysTrapTblGetCurrentField,
sysTrapTblSetColumnUsable,
sysTrapTblGetRowHeight,
sysTrapTblSetColumnWidth,
sysTrapTblGrabFocus,
sysTrapTblSetItemPtr,
sysTrapTblFindRowID,
sysTrapTblGetLastUsableRow,
sysTrapTblGetColumnSpacing,
sysTrapTblFindRowData,
sysTrapTblGetRowData,
sysTrapTblSetRowData,
sysTrapTblSetColumnSpacing,
sysTrapWinCreateWindow,
sysTrapWinCreateOffscreenWindow,
sysTrapWinDeleteWindow,
sysTrapWinInitializeWindow,
sysTrapWinAddWindow,
sysTrapWinRemoveWindow,
sysTrapWinSetActiveWindow,
sysTrapWinSetDrawWindow,
sysTrapWinGetDrawWindow,
sysTrapWinGetActiveWindow,
sysTrapWinGetDisplayWindow,
sysTrapWinGetFirstWindow,
sysTrapWinEnableWindow,
sysTrapWinDisableWindow,
sysTrapWinGetWindowFrameRect,
sysTrapWinDrawWindowFrame,
sysTrapWinEraseWindow,
sysTrapWinSaveBits,
sysTrapWinRestoreBits,
sysTrapWinCopyRectangle,
sysTrapWinScrollRectangle,
sysTrapWinGetDisplayExtent,
sysTrapWinGetWindowExtent,
sysTrapWinDisplayToWindowPt,
sysTrapWinWindowToDisplayPt,
sysTrapWinGetClip,
sysTrapWinSetClip,
sysTrapWinResetClip,
sysTrapWinClipRectangle,
sysTrapWinDrawLine,
sysTrapWinDrawGrayLine,
sysTrapWinEraseLine,
sysTrapWinInvertLine,
sysTrapWinFillLine,
sysTrapWinDrawRectangle,
sysTrapWinEraseRectangle,
sysTrapWinInvertRectangle,
sysTrapWinDrawRectangleFrame,
sysTrapWinDrawGrayRectangleFrame,
sysTrapWinEraseRectangleFrame,
sysTrapWinInvertRectangleFrame,
sysTrapWinGetFramesRectangle,
sysTrapWinDrawChars,
sysTrapWinEraseChars,
sysTrapWinInvertChars,
sysTrapWinGetPattern,
sysTrapWinSetPattern,
sysTrapWinSetUnderlineMode,
sysTrapWinDrawBitmap,
sysTrapWinModal,
sysTrapWinGetWindowBounds,
sysTrapWinFillRectangle,
sysTrapWinDrawInvertedChars,
sysTrapPrefOpenPreferenceDB,
sysTrapPrefGetPreferences,
sysTrapPrefSetPreferences,
sysTrapPrefGetAppPreferences,
sysTrapPrefSetAppPreferences,
sysTrapSndInit,
sysTrapSndSetDefaultVolume,
sysTrapSndGetDefaultVolume,
sysTrapSndDoCmd,
sysTrapSndPlaySystemSound,
sysTrapAlmInit,
sysTrapAlmCancelAll,
sysTrapAlmAlarmCallback,
sysTrapAlmSetAlarm,
sysTrapAlmGetAlarm,
sysTrapAlmDisplayAlarm,
sysTrapAlmEnableNotification,
sysTrapHwrGetRAMMapping,
sysTrapHwrMemWritable,
sysTrapHwrMemReadable,
sysTrapHwrDoze,
sysTrapHwrSleep,
sysTrapHwrWake,
sysTrapHwrSetSystemClock,
sysTrapHwrSetCPUDutyCycle,
sysTrapHwrLCDInit,
sysTrapHwrLCDSleep,
sysTrapHwrTimerInit,
sysTrapHwrCursor,
sysTrapHwrBatteryLevel,
sysTrapHwrDelay,
sysTrapHwrEnableDataWrites,
sysTrapHwrDisableDataWrites,
sysTrapHwrLCDBaseAddr,
sysTrapHwrLCDDrawBitmap,
sysTrapHwrTimerSleep,
sysTrapHwrTimerWake,
sysTrapHwrLCDWake,
sysTrapHwrIRQ1Handler,
sysTrapHwrIRQ2Handler,
sysTrapHwrIRQ3Handler,
sysTrapHwrIRQ4Handler,
sysTrapHwrIRQ5Handler,
sysTrapHwrIRQ6Handler,
sysTrapHwrDockSignals,
sysTrapHwrPluggedIn,
sysTrapCrc16CalcBlock,
sysTrapSelectDay,
sysTrapSelectTime,
sysTrapDayDrawDaySelector,
sysTrapDayHandleEvent,
sysTrapDayDrawDays,
sysTrapDayOfWeek,
sysTrapDaysInMonth,
sysTrapDayOfMonth,
sysTrapDateDaysToDate,
sysTrapDateToDays,
sysTrapDateAdjust,
sysTrapDateSecondsToDate,
sysTrapDateToAscii,
sysTrapDateToDOWDMFormat,
sysTrapTimeToAscii,
sysTrapFind,
sysTrapFindStrInStr,
sysTrapFindSaveMatch,
sysTrapFindGetLineBounds,
sysTrapFindDrawHeader,
sysTrapPenOpen,
sysTrapPenClose,
sysTrapPenGetRawPen,
sysTrapPenCalibrate,
sysTrapPenRawToScreen,
sysTrapPenScreenToRaw,
sysTrapPenResetCalibration,
sysTrapPenSleep,
sysTrapPenWake,
sysTrapResLoadForm,
sysTrapResLoadMenu,
sysTrapFtrInit,
sysTrapFtrUnregister,
sysTrapFtrGet,
sysTrapFtrSet,
sysTrapFtrGetByIndex,
sysTrapGrfInit,
sysTrapGrfFree,
sysTrapGrfGetState,
sysTrapGrfSetState,
sysTrapGrfFlushPoints,
sysTrapGrfAddPoint,
sysTrapGrfInitState,
sysTrapGrfCleanState,
sysTrapGrfMatch,
sysTrapGrfGetMacro,
sysTrapGrfFilterPoints,
sysTrapGrfGetNumPoints,
sysTrapGrfGetPoint,
sysTrapGrfFindBranch,
sysTrapGrfMatchGlyph,
sysTrapGrfGetGlyphMapping,
sysTrapGrfGetMacroName,
sysTrapGrfDeleteMacro,
sysTrapGrfAddMacro,
sysTrapGrfGetAndExpandMacro,
sysTrapGrfProcessStroke,
sysTrapGrfFieldChange,
sysTrapGetCharSortValue,
sysTrapGetCharAttr,
sysTrapGetCharCaselessValue,
sysTrapPwdExists,
sysTrapPwdVerify,
sysTrapPwdSet,
sysTrapPwdRemove,
sysTrapGsiInitialize,
sysTrapGsiSetLocation,
sysTrapGsiEnable,
sysTrapGsiEnabled,
sysTrapGsiSetShiftState,
sysTrapKeyInit,
sysTrapKeyHandleInterrupt,
sysTrapKeyCurrentState,
sysTrapKeyResetDoubleTap,
sysTrapKeyRates,
sysTrapKeySleep,
sysTrapKeyWake,
sysTrapCmBroadcast,
sysTrapDlkStartServer,
sysTrapDlkGetSyncInfo,
sysTrapDlkSetLogEntry,
sysTrapPsrInit,
sysTrapPsrClose,
sysTrapPsrGetCommand,
sysTrapPsrSendReply,
sysTrapAbtShowAbout,
sysTrapMdmDial,
sysTrapMdmHangUp,
sysTrapDmSearchRecord,
sysTrapSysInsertionSort,
sysTrapDmInsertionSort,
sysTrapLstSetTopItem,
// WARNING!! LEAVE THIS ONE AT THE END
sysTrapLastTrapNumber
} SysTrapNumber;
#define sysNumTraps (sysTrapLastTrapNumber - sysTrapBase)
//--------------------------------------------------------------------
// 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;
/************************************************************
* Pilot specific TRAP instruction numbers
*************************************************************/
#define sysDbgBreakpointTrapNum 0 // For soft breakpoints
#define sysDbgTrapNum 8 // For compiled breakpoints
#define sysDispatchTrapNum 15 // Trap dispatcher
#ifdef __GNUC__
#define SYS_TRAP(trapNum) \
__attribute__ ((systrap (trapNum)))
#else
#define SYS_TRAP(trapNum) \
TWOWORD_INLINE(m68kTrapInstr+sysDispatchTrapNum,trapNum)
#endif
#define ASM_SYS_TRAP(trapNum) \
DC.W m68kTrapInstr+sysDispatchTrapNum; \
DC.W trapNum
#endif //__SYSTRAPS_H_

View File

@ -0,0 +1,72 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1995 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: SysUtils.h
* AUTHOR: Roger Flores: April 27, 1995
*
* DECLARER: UI
*
* DESCRIPTION:
* These are miscellaneous routines.
*
**********************************************************************/
#ifndef __SYSUTILS_H__
#define __SYSUTILS_H__
// Include elementary types
#include <Common.h> // Basic types
#include <SysTraps.h> // Trap Numbers.
//typedef Int _comparF (const void *, const void *, Int other);
typedef Int _comparF (VoidPtr, VoidPtr, Long other);
typedef _comparF * CmpFuncPtr;
/************************************************************
* Constants
*************************************************************/
#define sysRandomMax 0x7FFF // Max value returned from SysRandom()
/************************************************************
* Macros
*************************************************************/
#define Abs(a) ((a >= 0) ? a : (-a))
/************************************************************
* procedures
*************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
void SysInsertionSort (VoidPtr baseP, Int numOfElements, Int width,
_comparF *comparF, const Long other)
SYS_TRAP(sysTrapSysInsertionSort);
void SysQSort (VoidPtr baseP, Int numOfElements, Int width,
_comparF *comparF, const Long other)
SYS_TRAP(sysTrapSysQSort);
void SysCopyStringResource (CharPtr string, UInt theID)
SYS_TRAP(sysTrapSysCopyStringResource);
VoidHand SysFormPointerArrayToStrings(CharPtr c, Int stringCount)
SYS_TRAP(sysTrapSysFormPointerArrayToStrings);
// Return a random number ranging from 0 to sysRandomMax.
// Normally, 0 is passed unless you want to start with a new seed.
Int SysRandom(ULong newSeed)
SYS_TRAP(sysTrapSysRandom);
#ifdef __cplusplus
}
#endif
#endif // __SYSUTILS_H__

View File

@ -0,0 +1,457 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SystemMgr.h
*
* Description:
* Pilot system equates
*
* History:
* 10/27/94 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifndef __SYSTEMMGR_H__
#define __SYSTEMMGR_H__
// Include elementary types
#include <Common.h>
#include <SysTraps.h> // Trap Numbers.
// Other types
#include <SystemMgr.rh> // Resource definitions.
// UI Headers
#include <UICommon.h>
#include <Init.h>
#include <Rect.h>
#include <Font.h>
#include <Window.h>
#include <InsPoint.h>
#include <Event.h>
#include <DataMgr.h> // for DmOpenRef
/************************************************************
* System Constants
*************************************************************/
// Define the number of ticks/second
#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
#else
#error
#endif
/************************************************************
* Action Codes
*************************************************************/
// 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
#define sysAppLaunchCmdTimeChange 4 // The system time has changed
#define sysAppLaunchCmdSystemReset 5 // Sent after System hard resets
#define sysAppLaunchCmdAlarmTriggered 6 // Schedule next alarm
#define sysAppLaunchCmdDisplayAlarm 7 // Display given alarm dialog
#define sysAppLaunchCmdCountryChange 8 // The country has changed
#define sysAppLaunchCmdSyncRequest 9 // The "HotSync" button was pressed
#define sysAppLaunchCmdSaveData 10 // Sent to running app before sysAppLaunchCmdFind
// or other action codes that will cause
// data searches or manipulation.
#define sysAppLaunchCmdInitDatabase 11 // Initialize a database; sent by DesktopLink
// server to the app whose creator ID matches
// that of the database created in response to
// the "create db" request.
#define sysAppLaunchCmdSyncCallApplication 12 // Used by DesktopLink Server command "call application"
// SysAppLaunch flags
#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.
//-------------------------------------------------------------------
// 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.
} SysAppLaunchCmdSaveDataType;
// For sysAppLaunchCmdSystemReset
typedef struct {
Boolean hardReset; // true if system was hardReset.
Boolean createDefaultDB; // true if app should create default database.
} SysAppLaunchCmdSystemResetType;
// For sysAppLaunchCmdInitDatabase
typedef struct SysAppLaunchCmdInitDatabaseType {
DmOpenRef dbP; // database reference
ULong creator; // datatase creator
ULong type; // database type
UInt version; // database version
} SysAppLaunchCmdInitDatabaseType;
// For sysAppLaunchCmdSyncCallApplication
typedef struct SysAppLaunchCmdSyncCallApplicationType {
Word action; // call action id (app-specific)
Word paramSize; // parameter size
VoidPtr paramP; // ptr to parameter
Byte remoteSocket; // remote socket id
Byte tid; // command transaction id
Boolean handled; // if handled, MUST be set true by the app
} SysAppLaunchCmdSyncCallApplicationType;
/************************************************************
* Function prototype for libraries
*************************************************************/
typedef struct SysLibTblEntryType {
Ptr* dispatchTblP; // pointer to library dispatch table
void* globalsP; // Library globals
} SysLibTblEntryType;
typedef SysLibTblEntryType* SysLibTblEntryPtr;
typedef Err (*SysLibEntryProcPtr)(UInt refNum, SysLibTblEntryPtr entryP);
// This library refNum is reserved for the Debugger comm library
#define sysDbgCommLibraryRefNum 0
/************************************************************
* Function prototype for Kernel
*************************************************************/
// Task termination procedure prototype for use with SysTaskSetTermProc
typedef void (*SysTermProcPtr)(ULong taskID, Long reason);
// Timer procedure for use with SysTimerCreate
typedef void (*SysTimerProcPtr)(Long timerID, Long param);
/************************************************************
* Error Classes for each manager
*************************************************************/
#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 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
#define dlkErrorClass 0x0E00 // Desktop Link Manager
#define padErrorClass 0x0F00 // PAD Manager
#define grfErrorClass 0x1000 // Graffiti Manager
#define mdmErrorClass 0x1100 // Modem Manager
/************************************************************
* 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)
/************************************************************
* 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 sysFtrNumProductID 2 // Product id
// 0xMMMMRRRR, where MMMM is the model and RRRR
// is the revision.
/************************************************************
* System Types
*************************************************************/
// Types of batteries installed.
typedef enum {
sysBatteryKindAlkaline=0,
sysBatteryKindNiCad,
sysBatteryKindLithium
} SysBatteryKind;
/************************************************************
* Function Prototypes
*************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
// Prototype for Pilot applications entry point
DWord PilotMain(Word cmd, Ptr cmdPBP, Word launchFlags);
void SysUnimplemented(void)
SYS_TRAP(sysTrapSysUnimplemented);
void SysColdBoot(Ptr card0P, ULong card0Size,
Ptr card1P, ULong card1Size,
DWord sysCardHeaderOffset)
SYS_TRAP(sysTrapSysColdBoot);
void SysInit(void)
SYS_TRAP(sysTrapSysInit);
void SysReset(void)
SYS_TRAP(sysTrapSysReset);
void SysPowerOn(Ptr card0P, ULong card0Size,
Ptr card1P, ULong card1Size,
DWord sysCardHeaderOffset, Boolean reFormat);
void SysDoze(Boolean onlyNMI)
SYS_TRAP(sysTrapSysDoze);
Err SysSetPerformance(ULongPtr sysClockP, UIntPtr cpuDutyP)
SYS_TRAP(sysTrapSysSetPerformance);
void SysSleep(Boolean untilReset, Boolean emergency)
SYS_TRAP(sysTrapSysSleep);
UInt SysBatteryInfo(Boolean set, UIntPtr warnThresholdP, UIntPtr criticalThresholdP,
UIntPtr maxTicksP, SysBatteryKind* kindP, Boolean* pluggedIn)
SYS_TRAP(sysTrapSysBatteryInfo);
UInt SysSetAutoOffTime(UInt seconds)
SYS_TRAP(sysTrapSysSetAutoOffTime);
Err SysLaunchConsole(void)
SYS_TRAP(sysTrapSysLaunchConsole);
Boolean SysHandleEvent(EventPtr eventP)
SYS_TRAP(sysTrapSysHandleEvent);
void SysUILaunch(void)
SYS_TRAP(sysTrapSysUILaunch);
Err SysUIAppSwitch(UInt cardNo, LocalID dbID, Word cmd, Ptr cmdPBP)
SYS_TRAP(sysTrapSysUIAppSwitch);
Err SysCurAppDatabase(UIntPtr cardNoP, LocalID* dbIDP)
SYS_TRAP(sysTrapSysCurAppDatabase);
Err SysBroadcastActionCode(Word cmd, Ptr cmdPBP)
SYS_TRAP(sysTrapSysBroadcastActionCode);
Err SysAppLaunch(UInt cardNo, LocalID dbID, UInt launchFlags,
Word cmd, Ptr cmdPBP, DWord* resultP)
SYS_TRAP(sysTrapSysAppLaunch);
UInt SysNewOwnerID(void)
SYS_TRAP(sysTrapSysNewOwnerID);
DWord SysSetA5(DWord newValue)
SYS_TRAP(sysTrapSysSetA5);
Ptr SysCardImageInfo(UInt cardNo, ULongPtr sizeP);
void SysCardImageDeleted(UInt cardNo);
// System Dialogs
void SysBatteryDialog(void)
SYS_TRAP(sysTrapSysBatteryDialog);
// Utilities
Err SysSetTrapAddress(UInt trapNum, VoidPtr procP)
SYS_TRAP(sysTrapSysSetTrapAddress);
VoidPtr SysGetTrapAddress(UInt trapNum)
SYS_TRAP(sysTrapSysGetTrapAddress);
Word SysDisableInts(void)
SYS_TRAP(sysTrapSysDisableInts);
void SysRestoreStatus(Word status)
SYS_TRAP(sysTrapSysRestoreStatus);
// Library Management
Err SysLibInstall(SysLibEntryProcPtr libraryP, UIntPtr refNumP)
SYS_TRAP(sysTrapSysLibInstall);
Err SysLibRemove(UInt refNum)
SYS_TRAP(sysTrapSysLibRemove);
Err SysLibFind(CharPtr nameP, UIntPtr refNumP)
SYS_TRAP(sysTrapSysLibFind);
SysLibTblEntryPtr SysLibTblEntry(UInt refNum)
SYS_TRAP(sysTrapSysLibTblEntry);
// Generic Library calls
Err SysLibOpen(UInt refNum)
SYS_TRAP(sysLibTrapOpen);
Err SysLibClose(UInt refNum)
SYS_TRAP(sysLibTrapClose);
Err SysLibSleep(UInt refNum)
SYS_TRAP(sysLibTrapSleep);
Err SysLibWake(UInt refNum)
SYS_TRAP(sysLibTrapWake);
//-----------------------------------------------------
// Kernel Prototypes
//-----------------------------------------------------
Err SysTranslateKernelErr(Err err)
SYS_TRAP(sysTrapSysTranslateKernelErr);
Err SysTaskCreate(ULongPtr taskIDP, LongPtr creator, ProcPtr codeP,
Ptr stackP, ULong stackSize, ULong attr, Long priority,
ULong tSlice)
SYS_TRAP(sysTrapSysTaskCreate);
Err SysTaskDelete(ULong taskID, Long priority)
SYS_TRAP(sysTrapSysTaskDelete);
Err SysTaskTrigger(ULong taskID)
SYS_TRAP(sysTrapSysTaskTrigger);
ULong SysTaskID()
SYS_TRAP(sysTrapSysTaskID);
Err SysTaskDelay(Long delay)
SYS_TRAP(sysTrapSysTaskDelay);
Err SysTaskSetTermProc(ULong taskID, SysTermProcPtr termProcP)
SYS_TRAP(sysTrapSysTaskSetTermProc);
Err SysTaskSwitching(Boolean enable)
SYS_TRAP(sysTrapSysTaskSwitching);
// Counting Semaphores
Err SysSemaphoreCreate(LongPtr smIDP, LongPtr tagP, Long initValue)
SYS_TRAP(sysTrapSysSemaphoreCreate);
Err SysSemaphoreDelete(Long smID)
SYS_TRAP(sysTrapSysSemaphoreDelete);
Err SysSemaphoreWait(Long smID, Long priority, Long timeout)
SYS_TRAP(sysTrapSysSemaphoreWait);
Err SysSemaphoreSignal(Long smID)
SYS_TRAP(sysTrapSysSemaphoreSignal);
Err SysSemaphoreSet(Long smID)
SYS_TRAP(sysTrapSysSemaphoreSet);
// Resource Semaphores
Err SysResSemaphoreCreate(LongPtr smIDP, LongPtr tagP)
SYS_TRAP(sysTrapSysResSemaphoreCreate);
Err SysResSemaphoreDelete(Long smID)
SYS_TRAP(sysTrapSysResSemaphoreDelete);
Err SysResSemaphoreReserve(Long smID, Long priority, Long timeout)
SYS_TRAP(sysTrapSysResSemaphoreReserve);
Err SysResSemaphoreRelease(Long smID)
SYS_TRAP(sysTrapSysResSemaphoreRelease);
// Timers
Err SysTimerCreate(LongPtr timerIDP, LongPtr tagP,
SysTimerProcPtr timerProc, Long periodicDelay,
Long param)
SYS_TRAP(sysTrapSysTimerCreate);
Err SysTimerDelete(Long timerID)
SYS_TRAP(sysTrapSysTimerDelete);
Err SysTimerWrite(Long timerID, ULong value)
SYS_TRAP(sysTrapSysTimerWrite);
Err SysTimerRead(Long timerID, ULong* valueP)
SYS_TRAP(sysTrapSysTimerRead);
// Information
Err SysKernelInfo(VoidPtr paramP)
SYS_TRAP(sysTrapSysKernelInfo);
#ifdef __cplusplus
}
#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__

View File

@ -0,0 +1,165 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SystemMgr.rh
*
* Description:
* Include file for both PilotRez 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:
* 2/27/95 Created by Ron Marianetti
* 8/4/95 vmk Added system resource id for Desktop Link user info
*
*******************************************************************/
#ifndef __SYSTEMMGR_RH__
#define __SYSTEMMGR_RH__
//-----------------------------------------------------------
// 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 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 sysFileCFirstApp 'pref' // Creator type for First App after reset
#define sysFileCDefaultApp 'memr' // Creator type for Default app
#define sysFileCAddress 'addr'
#define sysFileCToDo 'todo'
#define sysFileCDatebook 'date'
#define sysFileCMemo 'memo'
#define sysFileCSync 'sync'
#define sysFileCSecurity 'secr'
#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 sysFileTUIAppShell 'uish' // File type for UI Application Shell
#define sysFileTExtension 'extn' // File type for System Extensions
#define sysFileTApplication 'appl' // File type for applications
#define sysFileTGraffitiMacros 'macr' // Graffiti Macros database
//................................................................
// 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 sysResTAppPrefs 'pref' // Resource type of App preferences resources
#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 sysResTFeatures 'feat' // Resource type of System features table
#define sysResIDFeatures 10000 // Resource ID of System features table
#define sysResTLibrary 'libr' // Resource type of System Libraries
#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
// 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.
//-----------------------------------------------------------
// This section is only valid when running the resource compiler
//-----------------------------------------------------------
#ifdef RESOURCE_COMPILER
// Definition of the Pilot Preferences Resource. This must match
// the definition of the structure SysAppPrefs in SystemMgr.h
resdef {
word priority; // AMX task priority
long stackSize; // required stack size
long minHeapSpace; // min required free space in heap
} sysResTAppPrefs;
// Definition of the ROM - Based Feature table
resdef {
word featureNum; // Feature number
long featureValue; // Feature value
} 'FITM';
resdef {
long creator; // creator type
word len(featureItems);
resource 'FITM' featureItems[];
} 'CITM';
resdef {
word len(creatorItems);
resource 'CITM' creatorItems[];
} sysResTFeatures;
#endif
#endif //__SYSTEMMGR_RH__

View File

@ -0,0 +1,389 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* 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 \
Byte command; \
Byte _filler
// Generic System Packet Body
typedef struct SysPktBodyType {
_sysPktBodyCommon;
Byte 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
Word numBytes; // # of bytes to read
} SysPktReadMemCmdType;
typedef SysPktReadMemCmdType* SysPktReadMemCmdPtr;
typedef struct SysPktReadMemRspType {
_sysPktBodyCommon; // Common Body header
// Byte 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
Word numBytes; // # of bytes to write
// Byte 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 {
Byte byRef; // true if param is by reference
Byte size; // # of Words of paramData
Word data[1]; // variable length array of paramData
} SysPktRPCParamType;
typedef struct SysPktRPCType {
_sysPktBodyCommon; // Common Body header
Word trapWord; // which trap to execute
DWord resultD0; // result from D0 placed here
DWord resultA0; // result from A0 placed here
Word 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
Word rowBytes; // rowbytes of update area
Word fromY; // top of update rect
Word fromX; // left of update rect
Word toY; // top of screen rect
Word toX; // left of screen rect
Word height; // bottom of update rect
Word width; // right of update rect
// The actual pixels of the update area follow
Word 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
SWord penX; // X location of pen
SWord penY; // Y location of pen
Boolean keyPress; // true if key event follows
Word keyModifiers; // keyboard modifiers
Word keyAscii; // key ascii code
Word 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
#define sysPktFlashRsp 0x8E
//--------------------------------------------------------------------
// Get/Set communication parameters
//--------------------------------------------------------------------
#define sysPktCommCmd 0x0F
#define sysPktCommRsp 0x8F
typedef struct SysPktCommCmdType {
_sysPktBodyCommon; // Common Body header
Boolean set; // true to change parameters
ULong baudRate; // new baud rate
ULong flags; // new flags
} SysPktCommCmdType;
typedef SysPktCommCmdType* SysPktCommCmdPtr;
typedef struct SysPktCommRspType {
_sysPktBodyCommon; // Common Body header
ULong baudRate; // current baud rate
ULong 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
Word action;
Byte 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
DWord firstAddr; // first address to search
DWord lastAddr; // last address to begin searching
Word numBytes; // number of data bytes to match
Boolean caseInsensitive; // if true, perform a case-insensitive search
} SysPktFindCmdType;
typedef SysPktFindCmdType* SysPktFindCmdPtr;
typedef struct SysPktFindRspType {
_sysPktBodyCommon; // Common Body header
DWord addr; // address where data was found
Boolean found; // true if data was found
} SysPktFindRspType;
typedef SysPktFindRspType* SysPktFindRspPtr;
//--------------------------------------------------------------------
// message from remote unit
//--------------------------------------------------------------------
#define sysPktRemoteMsgCmd 0x7f
//--------------------------------------------------------------------
// sysPktRemoteMsg
// Send a text message
//--------------------------------------------------------------------
typedef struct SysPktRemoteMsgCmdType {
_sysPktBodyCommon; // Common Body header
//Byte text; // variable length text goes here
} SysPktRemoteMsgCmdType;
typedef SysPktRemoteMsgCmdType* SysPktRemoteMsgCmdPtr;
/*******************************************************************
* Prototypes
*******************************************************************/
#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, UInt dstSocket,
SysPktRPCType* bodyP, UInt trapWord);
// Stuff a parameter into an RPC packet body
VoidPtr SlkRPCStuffParam(SysPktRPCType* bodyP, void* dataP,
Int 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 //__SYSTEM_PKT_H__

View File

@ -0,0 +1,379 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1994, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* SystemPrv.h
*
* Description:
* Private Pilot system equates
*
* History:
* 8/9/95 RM - Created by Ron Marianetti
*
*******************************************************************/
#ifdef NON_PORTABLE
#ifndef __SYSTEMPRV_H__
#define __SYSTEMPRV_H__
// Include fixed global type
#include <Globals.h>
/************************************************************
* 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.
#define sysLowMemSize 0x1200 // size of Low Memory Area
#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
#define sysDefaultLibraries 2 // default size of library table
// The default port number and baud rate for the serial port
#if HW_TARGET == HW_TARGET_TD1
#define sysDefaultSerPort 0 // Use port #0
#define sysDefaultSerBaud 57600 // baud rate
#else
#define sysDefaultSerPort 1 // Use port #1
#define sysDefaultSerBaud 57600 // baud rate
#endif
/************************************************************
* Structure of the PREF resource in applications. Note, this
* structure must mirror the structure of the PREF resource
* as defined in the PilotRez include file.
*************************************************************/
typedef struct SysAppPrefs {
Word priority; // task priority
DWord stackSize; // required stack space
DWord minHeapSpace; // minimum heap space required
} SysAppPrefsType;
typedef SysAppPrefsType* SysAppPrefsPtr;
/************************************************************
* 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 handle of the
* app, the code handle, the stack chunk pointer, the owner ID, etc.
*************************************************************/
typedef struct SysAppInfoType {
Int cmd; // command code for app
Ptr cmdPBP; // cmd ParamBlock
UInt launchFlags; // launch flags
Long taskID; // AMX task ID of task that app runs in
Handle codeH; // code handle of the main code segment
DmOpenRef dbP; // Application database access ptr of App
Ptr stackP; // stack chunk for the App
Ptr globalsChunkP; // globals chunk for the App
UInt memOwnerID; // owner ID for Memory Manager chunks
Ptr dmAccessP; // pointer to linked list of opened DB's
SWord dmLastErr; // Last error from Data Manager
Ptr errExceptionP; // ErrTry,Catch exception list
} SysAppInfoType;
typedef SysAppInfoType* SysAppInfoPtr;
/************************************************************
* 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
DWord initialA5; // Inital value for A5 globals ptr
} SysTCBUserInfoType;
typedef SysTCBUserInfoType* SysTCBUserInfoPtr;
//*****************************************************************
// 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
DWord id; // which object to get info on
union {
struct task {
DWord id; // ID of task
DWord nextID; // ID of next task
DWord tag; // task tag
DWord status; // task status
DWord timer; // # ticks left if task's timeout
DWord timeSlice; // task's time slice
SWord priority; // task priority
Word attributes; // task attributes
SWord pendingCalls; // # of pending calls
DWord senderTaskID; // task ID of message sender
DWord msgExchangeID; // task's message exchange ID, if any
DWord tcbP; // pointer to TCB
DWord stackP; // stack pointer of task
DWord stackStart; // top of task stack (where it started).
DWord stackSize; // size of stack
} task;
struct semaphore {
DWord id;
DWord nextID; // ID of next semaphore
DWord tag; // semaphore tag
SWord initValue; // semaphore initial value
// >= 0 for counting, -1 for resource
SWord curValue; // semaphore current value
// >0 available
// 0 not available
// -n not available, n tasks waiting
SWord nestLevel; // 0 for counting, >= 0 for resource
DWord ownerID; // owner ID
// 0 for counting or resource free
} semaphore;
struct timer {
DWord id;
DWord nextID; // ID of next timer
DWord tag; // timer tag
DWord ticksLeft; // ticks left till timer runs
DWord period; // timer period, if periodic
DWord 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 {
DWord rtcHours; // Real-Time clock hours - add to value
// in DragonBall RTC register to get
// actual date & time.
DWord rtcHourMinSecCopy; // Copy of latest value in rtcHourMinSec reg of
// DBall. Used as default RTC value on Reset.
} 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;
*/
/************************************************************
* 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
Ptr 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
// Flags for the GSysPrefFlags global
#define sysPrefFlagTaxiDisable 0x0001 // Disable Taxi car - insurance policy
// (saved in preferences).
#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
/************************************************************
* Function Prototypes
*************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
SysTCBUserInfoPtr SysTaskUserInfoPtr(ULong taskID)
SYS_TRAP(sysTrapSysTaskUserInfoPtr);
Err SysAppStartup(SysAppInfoPtr* appInfoPP, Ptr* prevGlobalsP,
Ptr* globalsPtrP)
SYS_TRAP(sysTrapSysAppStartup);
Err SysAppExit(SysAppInfoPtr appInfoP, Ptr prevGlobalsP, Ptr globalsP)
SYS_TRAP(sysTrapSysAppExit);
SysAppInfoPtr SysCurAppInfoP(void)
SYS_TRAP(sysTrapSysCurAppInfoP);
#ifdef __cplusplus
}
#endif
/************************************************************
* Assembly Function Prototypes
*************************************************************/
#define _SysFatalAlert \
ASM_SYS_TRAP(sysTrapSysFatalAlert)
#define _SysReset \
ASM_SYS_TRAP(sysTrapSysReset)
#endif //__SYSTEMPRV_H__
#endif // NON_PORTABLE

View File

@ -0,0 +1,77 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* TimeMgr.h
*
* Description:
* Time manager functions
*
* History:
* 1/19/95 roger - Created by Roger Flores
*
*
*******************************************************************/
#ifndef __TIMEMGR_H__
#define __TIMEMGR_H__
// Include elementary types
#include <Common.h>
#include <SysTraps.h> // Trap Numbers.
/************************************************************
* Time Manager result codes
* (timErrorClass is defined in SystemMgr.h)
*************************************************************/
#define timErrMemory (timErrorClass | 1)
/************************************************************
* Function Prototypes
*************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
//-------------------------------------------------------------------
// Initialization
//-------------------------------------------------------------------
Err TimInit(void) SYS_TRAP(sysTrapTimInit);
//-------------------------------------------------------------------
// API
//-------------------------------------------------------------------
// seconds since 1/1/1904
ULong TimGetSeconds(void)
SYS_TRAP(sysTrapTimGetSeconds);
// seconds since 1/1/1904
void TimSetSeconds(ULong seconds)
SYS_TRAP(sysTrapTimSetSeconds);
// ticks since power on
ULong TimGetTicks(void)
SYS_TRAP(sysTrapTimGetTicks);
#ifdef __cplusplus
}
#endif
#endif // __TIMEMGR_H__

View File

@ -0,0 +1,127 @@
/*******************************************************************
* Pilot Software
*
* Copyright(c) 1995, Palm Computing Inc., All Rights Reserved
*
*-------------------------------------------------------------------
* FileName:
* TimePrv.h
*
* Description:
* Private Time manager functions
*
* History:
* 1/19/95 roger - Created by Roger Flores
*
*
*******************************************************************/
#ifdef NON_PORTABLE
#ifndef __TIMEPRV_H__
#define __TIMEPRV_H__
/*******************************************************************
* Private Time Manager Constants
*
*******************************************************************/
// Alarm repeat interval -- once an alarm is triggered, it will
// repeat every timAlarmRepeatSeconds until it is canceled or
// replaced with a new alarm by the Alarm Manager. This ensures
// that an alarm will not be missed by the Alarm Manager code which
// is executed on some app's UI thread.
#define timAlarmRepeatSeconds 10
// Alarm delta interval -- if the difference between the alarm time and the current time
// is less than this interval, the alarm will be triggered immediately. This eliminates
// a race condition which occurs when the alarm time is TOO close to the current time.
#define timAlarmMinDeltaSeconds 2
/*******************************************************************
* Time Manager Globals
*
*******************************************************************/
typedef struct TimGlobalsType {
ULong rtcHours; // Added to DragonBall hours to get actual time
ULong alarmSeconds; // alarm time in seconds since 1/1/1904;
// 0 = none
//-------------------------------------------------------------------------------
// The following fields are used exclusively to work around a bug in the 0G58E version
// of the DragonBall. This bug causes the rtcHourMinSec register in the DragonBall to
// occasionally be "out of date" when read and also prevents alarms from going off
// if we're in sleep mode. To get around this bug, we use the 1 minute interrupt while
// we're in sleep mode to wake up periodically and see if any alarms need to go off and
// we use the 1 second interrupt when we're awake to update our own copy of the hours,
// minutes and seconds.
//-------------------------------------------------------------------------------
Boolean rtcBugWorkaround; // true to work around bug in 0G58E version
// of dragonball.
Boolean rtcBugAsleep; // true if we're in sleep mode
// Our copy of the time that we maintain through the 1 second and minute interrupts
ULong rtcBugAlarm; // when alarm should be triggerred.
ULong rtcBugSeconds; // seconds since 1/1/1904
// IMPORTANT: The boolean rtcBugFastMinuteCalc MUST
// be cleared whenever rtcBugSeconds is changed!!!!!!!
ULong rtcBugLastSeconds; // seconds after last 1 sec. or min. interrupt.
Boolean rtcBugFastMinuteCalc; // true when current time is on a minute
// boundary. Used by TimHandleInterrupt speed up
// the next minute calculation.
} TimGlobalsType;
typedef TimGlobalsType* TimGlobalsPtr;
/************************************************************
* Function Prototypes
*************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
//
// IMPORTANT: TimSetAlarm() and TimGetAlarm() are reserved for use by the
// Alarm Manager!
//
// set an alarm in seconds since 1/1/1904
// (reserved for Alarm Manager use only)
ULong TimSetAlarm(ULong seconds)
SYS_TRAP(sysTrapTimSetAlarm);
// get the current alarm setting in seconds since 1/1/1904
// (reserved for Alarm Manager use only)
ULong TimGetAlarm(void)
SYS_TRAP(sysTrapTimGetAlarm);
Err TimSleep(Boolean untilReset, Boolean emergency)
SYS_TRAP(sysTrapTimSleep);
Err TimWake(void)
SYS_TRAP(sysTrapTimWake);
//-------------------------------------------------------------------
// Interrupt Service routine
//-------------------------------------------------------------------
void TimHandleInterrupt(Boolean periodicUpdate)
SYS_TRAP(sysTrapTimHandleInterrupt);
#ifdef __cplusplus
}
#endif
#endif // __TIMEMGR_H__
#endif // NON_PORTABLE

View File

@ -0,0 +1,23 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1995 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: AboutBox.h
* AUTHOR: Christopher Raff: October 25th, 1995
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines About Box routines
*
***********************************************************************/
#ifndef __ABOUTBOX_H__
#define __ABOUTBOX_H__
extern void AbtShowAbout (DWord creator)
SYS_TRAP(sysTrapAbtShowAbout);
#endif // __ABOUTBOX_H__

View File

@ -0,0 +1,59 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1995 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: Category.h
* AUTHOR: Art Lamb: March 7, 1995
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines category structures and routines.
*
***********************************************************************/
#ifndef __CATEGORY_H__
#define __CATEGORY_H__
typedef struct {
Word renamedCategories;
Char categoryLabels [dmRecNumCategories] [dmCategoryLength];
Byte categoryUniqIDs[dmRecNumCategories];
Byte lastUniqID; // Uniq IDs generated by the device are between
// 0 - 127. Those from the PC are 128 - 255.
} AppInfoType;
extern void CategoryCreateList (DmOpenRef db, ListPtr lst,
Word currentCategory, Boolean showAllCategoryCreateList)
SYS_TRAP(sysTrapCategoryCreateList);
extern void CategoryFreeList (DmOpenRef db, ListPtr lst)
SYS_TRAP(sysTrapCategoryFreeList);
extern Word CategoryFind (DmOpenRef db, CharPtr name)
SYS_TRAP(sysTrapCategoryFind);
extern void CategoryGetName (DmOpenRef db, Word index, CharPtr name)
SYS_TRAP(sysTrapCategoryGetName);
extern Boolean CategoryEdit (DmOpenRef db, WordPtr category)
SYS_TRAP(sysTrapCategoryEdit);
extern Boolean CategorySelect (DmOpenRef db, FormPtr frm, Word ctlID,
Word lstID, Boolean title, WordPtr categoryP, CharPtr categoryName)
SYS_TRAP(sysTrapCategorySelect);
extern Word CategoryGetNext (DmOpenRef db, Word index)
SYS_TRAP(sysTrapCategoryGetNext);
extern void CategorySetTriggerLabel (ControlPtr ctl, CharPtr name)
SYS_TRAP(sysTrapCategorySetTriggerLabel);
extern void CategoryTruncateName (CharPtr name, Word maxWidth)
SYS_TRAP(sysTrapCategoryTruncateName);
#endif // __CATEGORY_H__

View File

@ -0,0 +1,60 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: CharAttr.h
* AUTHOR: Art Lamb: April 21, 1995
*
* DECLARER: Toolbox
*
* DESCRIPTION:
* This file defines character classification and character
* conversion macros
*
**********************************************************************/
#ifndef _CHAR_ATTR_H
#define _CHAR_ATTR_H
// Character attribute code bits
#define _XA 0x200 // extra alphabetic
#define _XS 0x100 // extra space
#define _BB 0x80 // BEL, BS, etc.
#define _CN 0x40 // CR, FF, HT, NL, VT
#define _DI 0x20 // '0'-'9'
#define _LO 0x10 // 'a'-'z' and lowercase extended chars.
#define _PU 0x08 // punctuation
#define _SP 0x04 // space
#define _UP 0x02 // 'A'-'Z' and uppercase extended chars.
#define _XD 0x01 // '0'-'9', 'A'-'F', 'a'-'f'
// Character classification macros.
// If these are used to test characters from events (keyDownEvent)
// IsAscii should be used first.
#define IsAscii(c) (c <= 255)
#define IsAlNum(attr,c) (attr[(Byte)(c)] & (_DI|_LO|_UP|_XA))
#define IsAlpha(attr,c) (attr[(Byte)(c)] & (_LO|_UP|_XA))
#define IsCntrl(attr,c) (attr[(Byte)(c)] & (_BB|_CN))
#define IsDigit(attr,c) (attr[(Byte)(c)] & _DI)
#define IsGraph(attr,c) (attr[(Byte)(c)] & (_DI|_LO|_PU|_UP|_XA))
#define IsLower(attr,c) (attr[(Byte)(c)] & _LO)
#define IsPrint(attr,c) (attr[(Byte)(c)] & (_DI|_LO|_PU|_SP|_UP|_XA))
#define IsPunct(attr,c) (attr[(Byte)(c)] & _PU)
#define IsSpace(attr,c) (attr[(Byte)(c)] & (_CN|_SP|_XS))
#define IsUpper(attr,c) (attr[(Byte)(c)] & _UP)
#define IsHex(attr,c) (attr[(Byte)(c)] & _XD)
#define IsDelim(attr,c) (attr[(Byte)(c)] & _SP|_PU)
WordPtr GetCharAttr (void)
SYS_TRAP(sysTrapGetCharAttr);
BytePtr GetCharSortValue (void)
SYS_TRAP(sysTrapGetCharSortValue);
BytePtr GetCharCaselessValue (void)
SYS_TRAP(sysTrapGetCharCaselessValue);
#endif /* _CHAR_ATTR_H */

View File

@ -0,0 +1,255 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: Chars.h
* AUTHOR: Roger Flores: November 3, 1994
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines the characters in fonts.
*
**********************************************************************/
#ifndef __CHARS_H__
#define __CHARS_H__
// Special characters
#define downArrowChr 0x1F
#define upArrowChr 0x1E
#define leftArrowChr 0x1C
#define rightArrowChr 0x1D
// The hardware arrow buttons generate the following Chr codes.
#define pageUpChr 0x0B
#define pageDownChr 0x0C
// 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 lowBatteryChr 0x0101 // Display low battery dialog
#define enterDebuggerChr 0x0102 // Enter Debugger
#define nextFieldChr 0x0103 // Go to next field in form
#define startConsoleChr 0x0104 // Startup console task
#define menuChr 0x0105 // Ctl-A
#define commandChr 0x0106 // Ctl-C
#define confirmChr 0x0107 // Ctl-D
#define launchChr 0x0108 // Ctl-E
#define keyboardChr 0x0109 // Ctl-F
#define findChr 0x010A
#define calcChr 0x010B
#define prevFieldChr 0x010C
#define alarmChr 0x010D // sent before displaying an alarm
// The Application launching buttons generate the following
// key codes and will also set the commandKeyMask bit in the
// modifiers field
#define hardKeyMin 0x0200
#define hardKeyMax 0x02FF
#define hard1Chr 0x0204
#define hard2Chr 0x0205
#define hard3Chr 0x0206
#define hard4Chr 0x0207
#define hardPowerChr 0x0208
#define hardCradleChr 0x0209 // Button on cradle pressed
#define ChrIsHardKey(c) ((c >= hardKeyMin) && (c <= hardKeyMax))
// Characters from all text fonts. Resource ID's 9000, 9001, 9002
#define nullChr 0x00
#define backspaceChr 0x08
#define tabChr 0x09
#define linefeedChr 0x0A
#define crChr 0x0D
#define colonChr ':'
#define periodChr '.'
#define commaChr ','
#define quoteChr '"'
#define returnChr 0x0D
#define escapeChr 0x1B
#define spaceChr 0x20
#define lastAsciiChr 0xFF
#define numericSpaceChr 0x80
#define cutChr 0x12D // Ctl-X
#define copyChr 0x12E // Ctl-C
#define pasteChr 0x12F // Ctl-V
// Extended characters for Windows Code Page 1252
#define lowSingleCommaQuoteChr 0x82
#define scriptFChr 0x83
#define lowDblCommaQuoteChr 0x84
#define horizEllipsisChr 0x85
#define daggerChr 0x86
#define dblDaggerChr 0x87
#define circumflexChr 0x88
#define perMilleChr 0x89
#define upSHacekChr 0x8A
#define leftSingleGuillemetChr 0x8B
#define upOEChr 0x8C
#define diamondChr 0x8D // These 4 are not actually in the
// windows code page, but we like 'em
// anyway.
#define clubChr 0x8E
#define heartChr 0x8F
#define spadeChr 0x90
#define singleOpenCommaQuoteChr 0x91
#define singleCloseCommaQuoteChr 0x92
#define dblOpenCommaQuoteChr 0x93
#define dblCloseCommaQuoteChr 0x94
#define bulletChr 0x95
#define enDashChr 0x96
#define emDashChr 0x97
#define spacingTildeChr 0x98
#define trademarkChr 0x99
#define lowSHacekChr 0x9A
#define rightSingleGuillemetChr 0x9B
#define lowOEChr 0x9C
#define upYDiaeresisChr 0x9F
#define nonBreakSpaceChr 0xA0
#define invertedExclamationChr 0xA1
#define centChr 0xA2
#define poundChr 0xA3
#define currencyChr 0xA4
#define yenChr 0xA5
#define brokenVertBarChr 0xA6
#define sectionChr 0xA7
#define spacingDiaeresisChr 0xA8
#define copyrightChr 0xA9
#define feminineOrdinalChr 0xAA
#define leftGuillemetChr 0xAB
#define notChr 0xAC
#define softHyphenChr 0xAD
#define registeredChr 0xAE
#define spacingMacronChr 0xAF
#define degreeChr 0xB0
#define plusMinusChr 0xB1
#define superscript2Chr 0xB2
#define superscript3Chr 0xB3
#define spacingAcuteChr 0xB4
#define microChr 0xB5
#define paragraphChr 0xB6
#define middleDotChr 0xB7
#define spacingCedillaChr 0xB8
#define superscript1Chr 0xB9
#define masculineOrdinalChr 0xBA
#define rightGuillemetChr 0xBB
#define fractOneQuarterChr 0xBC
#define fractOneHalfChr 0xBD
#define fractThreeQuartersChr 0xBE
#define invertedQuestionChr 0xBF
#define upAGraveChr 0xC0
#define upAAcuteChr 0xC1
#define upACircumflexChr 0xC2
#define upATildeChr 0xC3
#define upADiaeresisChr 0xC4
#define upARingChr 0xC5
#define upAEChr 0xC6
#define upCCedillaChr 0xC7
#define upEGraveChr 0xC8
#define upEAcuteChr 0xC9
#define upECircumflexChr 0xCA
#define upEDiaeresisChr 0xCB
#define upIGraveChr 0xCC
#define upIAcuteChr 0xCD
#define upICircumflexChr 0xCE
#define upIDiaeresisChr 0xCF
#define upEthChr 0xD0
#define upNTildeChr 0xD1
#define upOGraveChr 0xD2
#define upOAcuteChr 0xD3
#define upOCircumflexChr 0xD4
#define upOTildeChr 0xD5
#define upODiaeresisChr 0xD6
#define multiplyChr 0xD7
#define upOSlashChr 0xD8
#define upUGraveChr 0xD9
#define upUAcuteChr 0xDA
#define upUCircumflexChr 0xDB
#define upUDiaeresisChr 0xDC
#define upYAcuteChr 0xDD
#define upThorn 0xDE
#define lowSharpSChr 0xDF
#define lowAGraveChr 0xE0
#define lowAAcuteChr 0xE1
#define lowACircumflexChr 0xE2
#define lowATildeChr 0xE3
#define lowADiaeresisChr 0xE4
#define lowARingChr 0xE5
#define lowAEChr 0xE6
#define lowCCedillaChr 0xE7
#define lowEGraveChr 0xE8
#define lowEAcuteChr 0xE9
#define lowECircumflexChr 0xEA
#define lowEDiaeresisChr 0xEB
#define lowIGraveChr 0xEC
#define lowIAcuteChr 0xED
#define lowICircumflexChr 0xEE
#define lowIDiaeresisChr 0xEF
#define lowEthChr 0xF0
#define lowNTildeChr 0xF1
#define lowOGraveChr 0xF2
#define lowOAcuteChr 0xF3
#define lowOCircumflexChr 0xF4
#define lowOTildeChr 0xF5
#define lowODiaeresisChr 0xF6
#define divideChr 0xF7
#define lowOSlashChr 0xF8
#define lowUGraveChr 0xF9
#define lowUAcuteChr 0xFA
#define lowUCircumflexChr 0xFB
#define lowUDiaeresisChr 0xFC
#define lowYAcuteChr 0xFD
#define lowThorn 0xFE
#define lowYDiaeresisChr 0xFF
// 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
};
// 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
};
#endif // __CHARS_H__

View File

@ -0,0 +1,45 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: clipBoard.h
* AUTHOR: Art Lamb: September 1, 1994
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines clipboard structures and routines.
*
***********************************************************************/
#ifndef __CLIPBOARD_H__
#define __CLIPBOARD_H__
#define numClipboardForamts 3
#define cbdMaxTextLength 1000
// Clipboard standard formats
enum clipboardFormats { clipboardText, clipboardInk, clipboardBitmap };
typedef enum clipboardFormats ClipboardFormatType;
typedef struct {
VoidHand item;
Word length;
} ClipboardItem;
//----------------------------------------------------------
// Clipboard Functions
//----------------------------------------------------------
extern void ClipboardAddItem
(ClipboardFormatType format, VoidPtr ptr, Word length)
SYS_TRAP(sysTrapClipboardAddItem);
extern VoidHand ClipboardGetItem (ClipboardFormatType format, WordPtr length)
SYS_TRAP(sysTrapClipboardGetItem);
#endif // __CLIPBOARD_H__

View File

@ -0,0 +1,110 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: Control.h
* AUTHOR: Art Lamb: August 29, 1994
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines check box structures and routines.
*
***********************************************************************/
#ifndef __CONTROL_H__
#define __CONTROL_H__
typedef struct {
Byte usable :1; // set if part of ui
Byte enabled :1; // set if interactable (not grayed out)
Byte visible :1; // set if drawn (set internally)
Byte on :1; // set if on (checked)
Byte leftAnchor :1; // set if bounds expand to the right
// clear if bounds expand to the left
Byte frame :3;
} ControlAttrType;
enum controlStyles {buttonCtl, pushButtonCtl, checkboxCtl, popupTriggerCtl,
selectorTriggerCtl, repeatingButtonCtl};
typedef enum controlStyles ControlStyleType;
enum buttonFrames {noButtonFrame, standardButtonFrame, boldButtonFrame,
rectangleButtonFrame};
typedef enum buttonFrames ButtonFrameType;
typedef struct {
Word id;
RectangleType bounds;
CharPtr text;
ControlAttrType attr;
ControlStyleType style;
FontID font;
Byte group;
} ControlType;
typedef ControlType * ControlPtr;
//----------------------------------------------------------
// Control Functions
//----------------------------------------------------------
#ifdef __cplusplus
extern "C" {
#endif
extern void CtlDrawControl (ControlPtr pControl)
SYS_TRAP(sysTrapCtlDrawControl);
extern void CtlEraseControl (ControlPtr pControl)
SYS_TRAP(sysTrapCtlEraseControl);
extern void CtlHideControl (ControlPtr pControl)
SYS_TRAP(sysTrapCtlHideControl);
extern void CtlShowControl (ControlPtr pControl)
SYS_TRAP(sysTrapCtlShowControl);
extern Boolean CtlEnabled (ControlPtr pControl)
SYS_TRAP(sysTrapCtlEnabled);
extern void CtlSetEnabled (ControlPtr pControl, Boolean usable)
SYS_TRAP(sysTrapCtlSetEnabled);
extern void CtlSetUsable (ControlPtr pControl, Boolean usable)
SYS_TRAP(sysTrapCtlSetUsable);
extern SWord CtlGetValue (ControlPtr pControl)
SYS_TRAP(sysTrapCtlGetValue);
extern void CtlSetValue (ControlPtr pControl, SWord newValue)
SYS_TRAP(sysTrapCtlSetValue);
extern CharPtr CtlGetLabel (ControlPtr pControl)
SYS_TRAP(sysTrapCtlGetLabel);
extern void CtlSetLabel (ControlPtr pControl, CharPtr newLabel)
SYS_TRAP(sysTrapCtlSetLabel);
extern void CtlHitControl (ControlPtr pControl)
SYS_TRAP(sysTrapCtlHitControl);
extern Boolean CtlHandleEvent (ControlPtr pControl, EventPtr pEvent)
SYS_TRAP(sysTrapCtlHandleEvent);
#ifdef __cplusplus
}
#endif
#endif //__CONTROL_H__

View File

@ -0,0 +1,43 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: Day.h
* AUTHOR: Roger Flores: May 31, 1995
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines the date picker month object's structures
* and routines.
*
***********************************************************************/
#ifndef __DAY_H__
#define __DAY_H__
#include <DateTime.h>
typedef struct {
RectangleType bounds;
Boolean visible;
SWord visibleMonth; // month actually displayed
SWord visibleYear; // year actually displayed
DateTimeType selected;
} DaySelectorType;
typedef DaySelectorType * DaySelectorPtr;
void DayDrawDaySelector (DaySelectorPtr pSelector)
SYS_TRAP(sysTrapDayDrawDaySelector);
Boolean DayHandleEvent (DaySelectorPtr pSelector, EventPtr pEvent)
SYS_TRAP(sysTrapDayHandleEvent);
void DayDrawDays (DaySelectorPtr pSelector)
SYS_TRAP(sysTrapDayDrawDays);
#endif //__DAY_H__

View File

@ -0,0 +1,267 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: Event.h
* AUTHOR: Art Lamb: September 26, 1994
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines window structures and routines.
*
**********************************************************************/
#ifndef __EVENT_H__
#define __EVENT_H__
// Types of events
enum events {
nilEvent = 0,
penDownEvent,
penUpEvent,
penMoveEvent,
keyDownEvent,
winEnterEvent,
winExitEvent,
ctlEnterEvent,
ctlExitEvent,
ctlSelectEvent,
ctlRepeatEvent,
lstEnterEvent,
lstSelectEvent,
lstExitEvent,
popSelectEvent,
fldEnterEvent,
fldHeightChangedEvent,
fldChangedEvent,
tblEnterEvent,
tblSelectEvent,
daySelectEvent,
menuEvent,
appStopEvent,
frmLoadEvent,
frmOpenEvent,
frmGotoEvent,
frmUpdateEvent,
frmSaveEvent,
frmCloseEvent,
tblExitEvent,
firstUserEvent = 32767
};
// 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
// Event timeouts
#define evtWaitForever -1
// The event record.
typedef struct {
enum events eType;
Boolean penDown;
SWord screenX;
SWord screenY;
union data {
struct generic {
Word data1;
Word data2;
Word data3;
Word data4;
Word data5;
Word data6;
Word data7;
Word data8;
} generic;
struct {
PointType start; // display coord. of stroke start
PointType end; // display coord. of stroke start
} penUp;
struct {
Word chr; // ascii code
Word keyCode; // virtual key code
Word modifiers;
} keyDown;
struct winEnter {
WinHandle enterWindow;
WinHandle exitWindow;
} winEnter;
struct winExit {
WinHandle enterWindow;
WinHandle exitWindow;
} winExit;
struct ctlEnter {
Word controlID;
void * pControl;
} ctlEnter;
struct ctlSelect {
Word controlID;
void * pControl;
Boolean on;
} ctlSelect;
struct ctlRepeat {
Word controlID;
void * pControl;
DWord time;
} ctlRepeat;
struct fldEnter {
Word fieldID;
void * pField;
} fldEnter;
struct fldHeightChanged {
Word fieldID;
void * pField;
Word newHeight;
Word currentPos;
} fldHeightChanged;
struct fldChanged {
Word fieldID;
void * pField;
} fldChanged;
struct fldExit {
Word fieldID;
void * pField;
} fldExit;
struct lstEnter {
Word listID;
void * pList;
Word selection;
} lstEnter;
struct lstExit {
Word listID;
void * pList;
} lstExit;
struct lstSelect {
Word listID;
void * pList;
Word selection;
} lstSelect;
struct tblEnter {
Word tableID;
void * pTable;
Word row;
Word column;
} tblEnter;
struct tblExit {
Word tableID;
void * pTable;
Word row;
Word column;
} tblExit;
struct tblSelect {
Word tableID;
void * pTable;
Word row;
Word column;
} tblSelect;
struct frmLoad {
Word formID;
} frmLoad;
struct frmOpen {
Word formID;
} frmOpen;
struct frmGoto {
Word formID;
Word recordNum; // index of record that contain a match
Word matchPos; // postion in record of the match.
Word matchLen; // length of match.
Word matchFieldNum; // field number string was found int
DWord matchCustom; // application specific info
} frmGoto;
struct frmClose {
Word formID;
} frmClose;
struct frmUpdate {
Word formID;
Word updateCode; // Application specific
} frmUpdate;
struct daySelect {
void * pSelector;
Word selection;
Boolean useThisDate;
} daySelect;
struct menu {
Word itemID;
} menu;
struct popSelect {
Word controlID;
void * controlP;
Word listID;
void * listP;
Word selection;
Word priorSelection;
} popSelect;
} data;
} EventType;
typedef EventType * EventPtr;
//---------------------------------------------------------------------
// Event Functions
//---------------------------------------------------------------------
extern void EvtInitialize (void)
SYS_TRAP(sysTrapEvtInitialize);
extern void EvtAddEventToQueue (EventPtr event)
SYS_TRAP(sysTrapEvtAddEventToQueue);
extern void EvtCopyEvent (EventPtr source, EventPtr dest)
SYS_TRAP(sysTrapEvtCopyEvent);
extern void EvtGetEvent (EventPtr event, SDWord timeout)
SYS_TRAP(sysTrapEvtGetEvent);
void EvtGetPen(SWord *pScreenX, SWord *pScreenY, Boolean *pPenDown)
SYS_TRAP(sysTrapEvtGetPen);
// For Compatibility.. DOLATER... source modules should use EvtGetPen instead.
#define PenGetPoint(a,b,c) EvtGetPen(a,b,c)
#endif // __EVENT_H__

View File

@ -0,0 +1,245 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: field.h
* AUTHOR: Art Lamb: August 29, 1994
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines field structures and routines.
*
***********************************************************************/
#ifndef __FIELD_H__
#define __FIELD_H__
#define maxFieldTextLen 0x7fff
// Maximun number of line the a dynamicly sizing field will expand to.
#define maxFieldLines 11
// kind alignment values
#define leftAlign 0
#define centerAlign 1
#define rightAlign 2
#define undoBufferSize 100
typedef enum { undoNone, undoTyping, undoBackspace, undoDelete,
undoPaste, undoCut } UndoMode;
typedef struct {
UndoMode mode;
Word start;
Word end;
Word bufferLen;
CharPtr buffer;
} FieldUndoType;
typedef struct {
Word usable :1; // Set if part of ui
Word visible :1; // Set if drawn, used internally
Word editable :1; // Set if editable
Word singleLine :1; // Set if only a single line is displayed
Word hasFocus :1; // Set if the field has the focus
Word dynamicSize :1; // Set if height expands as text is entered
Word insPtVisible :1; // Set if the ins pt is scolled into view
Word dirty :1; // Set if user modified
Word underlined :2; // text underlined mode
Word justification :2; // text alignment
} FieldAttrType;
typedef FieldAttrType * FieldAttrPtr;
typedef struct {
Word start; // position in text string of first char.
Word length; // number of character in the line
} LineInfoType;
typedef LineInfoType * LineInfoPtr;
typedef struct {
Word id;
RectangleType rect;
FieldAttrType attr;
CharPtr text; // pointer to the start of text string
VoidHand textHandle; // block the contains the text string
LineInfoPtr lines;
Word textLen;
Word textBlockSize;
Word maxChars;
Word selFirstPos;
Word selLastPos;
Word insPtXPos;
Word insPtYPos;
FontID fontID;
} FieldType;
typedef FieldType * FieldPtr;
//---------------------------------------------------------------------
// Field Functions
//---------------------------------------------------------------------
extern void FldCopy (FieldPtr fld)
SYS_TRAP(sysTrapFldCopy);
extern void FldCut (FieldPtr fld)
SYS_TRAP(sysTrapFldCut);
extern void FldDrawField (FieldPtr fld)
SYS_TRAP(sysTrapFldDrawField);
extern void FldEraseField (FieldPtr fld)
SYS_TRAP(sysTrapFldEraseField);
extern void FldFreeMemory (FieldPtr fld)
SYS_TRAP(sysTrapFldFreeMemory);
extern void FldGetBounds (FieldPtr fld, RectanglePtr rect)
SYS_TRAP(sysTrapFldGetBounds);
extern FontID FldGetFont (FieldPtr fld)
SYS_TRAP(sysTrapFldGetFont);
extern void FldGetSelection (FieldPtr fld, WordPtr startPosition,
WordPtr endPosition)
SYS_TRAP(sysTrapFldGetSelection);
extern Handle FldGetTextHandle (FieldPtr fld)
SYS_TRAP(sysTrapFldGetTextHandle);
extern CharPtr FldGetTextPtr (FieldPtr fld)
SYS_TRAP(sysTrapFldGetTextPtr);
extern Boolean FldHandleEvent (FieldPtr fld, EventPtr pEvent)
SYS_TRAP(sysTrapFldHandleEvent);
extern void FldPaste (FieldPtr fld)
SYS_TRAP(sysTrapFldPaste);
extern void FldRecalculateField (FieldPtr fld, Boolean redraw)
SYS_TRAP(sysTrapFldRecalculateField);
extern void FldSetBounds (FieldPtr fld, RectanglePtr rect)
SYS_TRAP(sysTrapFldSetBounds);
extern void FldSetFont (FieldPtr fld, FontID fontID)
SYS_TRAP(sysTrapFldSetFont);
extern void FldSetText (FieldPtr fld, VoidHand textHandle, Word offset,
Word size)
SYS_TRAP(sysTrapFldSetText);
extern void FldSetTextHandle (FieldPtr fld, Handle textHandle)
SYS_TRAP(sysTrapFldSetTextHandle);
extern void FldSetTextPtr (FieldPtr fld, CharPtr textP)
SYS_TRAP(sysTrapFldSetTextPtr);
extern void FldSetUsable (FieldPtr fld, Boolean usable)
SYS_TRAP(sysTrapFldSetUsable);
extern void FldSetSelection (FieldPtr fld, Word startPosition,
Word endPosition)
SYS_TRAP(sysTrapFldSetSelection);
extern void FldGrabFocus (FieldPtr fld)
SYS_TRAP(sysTrapFldGrabFocus);
extern void FldReleaseFocus (FieldPtr fld)
SYS_TRAP(sysTrapFldReleaseFocus);
extern Word FldGetInsPtPosition (FieldPtr fld)
SYS_TRAP(sysTrapFldGetInsPtPosition);
extern void FldSetInsPtPosition (FieldPtr fld, Word pos)
SYS_TRAP(sysTrapFldSetInsPtPosition);
extern Word FldGetScrollPosition (FieldPtr fld)
SYS_TRAP(sysTrapFldGetScrollPosition);
extern void FldSetScrollPosition (FieldPtr fld, Word pos)
SYS_TRAP(sysTrapFldSetScrollPosition);
extern Word FldGetTextLength (FieldPtr fld)
SYS_TRAP(sysTrapFldGetTextLength);
extern void FldScrollField (FieldPtr fld, Word linesToScroll,
DirectionType direction)
SYS_TRAP(sysTrapFldScrollField);
extern Boolean FldScrollable (FieldPtr fld, DirectionType direction)
SYS_TRAP(sysTrapFldScrollable);
extern Word FldGetVisibleLines (FieldPtr fld)
SYS_TRAP(sysTrapFldGetVisibleLines);
extern Word FldGetTextHeight (FieldPtr fld)
SYS_TRAP(sysTrapFldGetTextHeight);
extern Word FldCalcFieldHeight (CharPtr chars, Word maxWidth)
SYS_TRAP(sysTrapFldCalcFieldHeight);
Word FldWordWrap (CharPtr chars, Word maxWidth)
SYS_TRAP(sysTrapFldWordWrap);
extern void FldCompactText (FieldPtr fld)
SYS_TRAP(sysTrapFldCompactText);
extern Boolean FldDirty (FieldPtr fld)
SYS_TRAP(sysTrapFldDirty);
extern void FldSetDirty (FieldPtr fld, Boolean dirty)
SYS_TRAP(sysTrapFldSetDirty);
extern Word FldGetMaxChars (FieldPtr fld)
SYS_TRAP(sysTrapFldGetMaxChars);
extern void FldSetMaxChars (FieldPtr fld, Word maxChars)
SYS_TRAP(sysTrapFldSetMaxChars);
extern Boolean FldInsert (FieldPtr fld, CharPtr insertChars, Word insertLen)
SYS_TRAP(sysTrapFldInsert);
extern void FldDelete (FieldPtr fld, Word start, Word end)
SYS_TRAP(sysTrapFldDelete);
extern void FldUndo (FieldPtr fld)
SYS_TRAP(sysTrapFldUndo);
extern Word FldGetTextAllocatedSize (FieldPtr fld)
SYS_TRAP(sysTrapFldGetTextAllocatedSize);
extern void FldSetTextAllocatedSize (FieldPtr fld, Word allocatedSize)
SYS_TRAP(sysTrapFldSetTextAllocatedSize);
extern void FldGetAttributes (FieldPtr fld, FieldAttrPtr attrP)
SYS_TRAP(sysTrapFldGetAttributes);
extern void FldSetAttributes (FieldPtr fld, FieldAttrPtr attrP)
SYS_TRAP(sysTrapFldSetAttributes);
extern void FldSendChangeNotification (FieldPtr fld)
SYS_TRAP(sysTrapFldSendChangeNotification);
extern void FldSendHeightChangeNotification (FieldPtr fld, Word pos,
Short numLines)
SYS_TRAP(sysTrapFldSendHeightChangeNotification);
extern Boolean FldMakeFullyVisible (FieldPtr fld)
SYS_TRAP(sysTrapFldMakeFullyVisible);
#endif // __FIELD_H__

View File

@ -0,0 +1,105 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: field.h
* AUTHOR: Art Lamb: August 29, 1994
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines field structures and routines.
*
***********************************************************************/
#ifndef __FIND_H__
#define __FIND_H__
#define maxFinds 9
#define maxFindStrLen 16
typedef struct {
Word appCardNo; // card number of the application
LocalID appDbID; // LocalID of the application
Boolean foundInCaller; // true if found in app that called Find
Word dbCardNo; // card number of the database record was found in
LocalID dbID; // LocalID of the database record was found in
Word recordNum; // index of record that contain a match
Word matchPos; // postion in record of the match.
Word matchFieldNum; // field number
DWord matchCustom; // app specific data
} FindMatchType;
typedef FindMatchType * FindMatchPtr;
typedef struct {
// These fields are used by the applications.
Word dbAccesMode; // read mode and maybe show secret
Word 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
// These fields are private to the Find routine and should NOT be accessed by
// applications.
Word numMatches; // # of matches
Word 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
Word callerAppCardNo; // cardNo of app that initiated search
LocalID appDbID; // dbID of app that we're currently searching
Word appCardNo; // card number of app that we're currently searching
Boolean newSearch; // true for first search
DmSearchStateType searchState; // search state
FindMatchType match [maxFinds];
} FindParamsType;
typedef FindParamsType * FindParamsPtr;
// Param Block passsed with the sysAppLaunchCmdGoto Command
typedef struct {
Word searchStrLen; // length of search string.
Word dbCardNo; // card number of the database
LocalID dbID; // LocalID of the database
Word recordNum; // index of record that contain a match
Word matchPos; // postion in record of the match.
Word matchFieldNum; // field number string was found int
DWord matchCustom; // application specific info
} GoToParamsType;
typedef GoToParamsType * GoToParamsPtr;
//----------------------------------------------------------
// Find Functions
//----------------------------------------------------------
void Find (GoToParamsPtr goToP)
SYS_TRAP(sysTrapFind);
Boolean FindStrInStr (CharPtr strToSearch, CharPtr strToFind,
WordPtr posP)
SYS_TRAP(sysTrapFindStrInStr);
Boolean FindSaveMatch (FindParamsPtr findParams, Word recordNum,
Word pos, Word fieldNum, DWord appCustom, Word cardNo, LocalID dbID)
SYS_TRAP(sysTrapFindSaveMatch);
void FindGetLineBounds (FindParamsPtr findParams, RectanglePtr r)
SYS_TRAP(sysTrapFindGetLineBounds);
Boolean FindDrawHeader (FindParamsPtr findParams, CharPtr title)
SYS_TRAP(sysTrapFindDrawHeader);
#endif __FIND_H__

View File

@ -0,0 +1,109 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: font.h
* AUTHOR: Art Lamb: September 13, 1994
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines font structures and routines.
*
***********************************************************************/
#ifndef __FONT_H__
#define __FONT_H__
typedef struct
{
SByte offset;
SByte width;
} FontCharInfoType;
typedef struct{
SWord fontType; // font type
SWord firstChar; // ASCII code of first character
SWord lastChar; // ASCII code of last character
SWord maxWidth; // maximum character width
SWord kernMax; // negative of maximum character kern
SWord nDescent; // negative of descent
SWord fRectWidth; // width of font rectangle
SWord fRectHeight; // height of font rectangle
SWord owTLoc; // offset to offset/width table
SWord ascent; // ascent
SWord descent; // descent
SWord leading; // leading
SWord rowWords; // row width of bit image / 2
} FontType;
typedef FontType * FontPtr;
enum fontID { stdFont, boldFont, largeFont, symbolFont, symbol11Font,
symbol7Font, ledFont };
#define checkboxFont symbol11Font
typedef enum fontID FontID;
//--------------------------------------------------------------------
//
// Font Function
//
//--------------------------------------------------------------------
#ifdef __cplusplus
extern "C" {
#endif
extern FontID FntGetFont (void)
SYS_TRAP(sysTrapFntGetFont);
extern FontID FntSetFont (FontID font)
SYS_TRAP(sysTrapFntSetFont);
extern FontPtr FntGetFontPtr (void)
SYS_TRAP(sysTrapFntGetFontPtr);
extern SWord FntBaseLine (void)
SYS_TRAP(sysTrapFntBaseLine);
extern SWord FntCharHeight (void)
SYS_TRAP(sysTrapFntCharHeight);
extern SWord FntLineHeight (void)
SYS_TRAP(sysTrapFntLineHeight);
extern SWord FntAverageCharWidth (void)
SYS_TRAP(sysTrapFntAverageCharWidth);
extern SWord FntCharWidth (Char ch)
SYS_TRAP(sysTrapFntCharWidth);
extern SWord FntCharsWidth (Char *chars, Word len)
SYS_TRAP(sysTrapFntCharsWidth);
extern void FntCharsInWidth(CharPtr string, SWord *stringWidthP,
SWord *stringLengthP, Boolean *fitWithinWidth)
SYS_TRAP(sysTrapFntCharsInWidth);
extern SWord FntDescenderHeight (void)
SYS_TRAP(sysTrapFntDescenderHeight);
extern SWord FntLineWidth (CharPtr pChars, Word length)
SYS_TRAP(sysTrapFntLineWidth);
#ifdef __cplusplus
}
#endif
#endif // __FONT_H__

View File

@ -0,0 +1,364 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: Form.h
* AUTHOR: Art Lamb: September 6, 1994
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines dialog box structures and routines.
*
***********************************************************************/
#ifndef __FORM_H__
#define __FORM_H__
#define noFocus 0xffff
// Update code send as part of a frmUpdate event.
#define frmRedrawUpdateCode 0x8000
// Alert constants and structures
enum alertTypes {
informationAlert,
confirmationAlert,
warningAlert,
errorAlert };
typedef enum alertTypes AlertType;
typedef struct {
Word alertType;
Word helpRscID;
Word numButtons;
Word defaultButton;
} AlertTemplateType;
// Types of object in a dialog box
enum formObjects {
frmFieldObj,
frmControlObj,
frmListObj,
frmTableObj,
frmBitmapObj,
frmLineObj,
frmFrameObj,
frmRectangleObj,
frmLabelObj,
frmTitleObj,
frmPopupObj,
frmGraffitiStateObj,
frmGadgetObj };
typedef enum formObjects FormObjectKind;
typedef struct {
Word usable :1; // Set if part of ui
} FormObjAttrType;
typedef struct {
FormObjAttrType attr;
PointType pos;
Word rscID;
} FormBitmapType;
typedef struct {
FormObjAttrType attr;
PointType point1;
PointType point2;
} FormLineType;
typedef struct {
Word id;
FormObjAttrType attr;
RectangleType rect;
Word frameType;
} FormFrameType;
typedef struct {
FormObjAttrType attr;
RectangleType rect;
} FormRectangleType;
typedef struct {
Word id;
PointType pos;
FormObjAttrType attr;
FontID fontID;
Char * text;
} FormLabelType;
typedef struct {
RectangleType rect;
Char * text;
} FormTitleType;
typedef struct {
Word controlID;
Word listID;
} FormPopupType;
typedef struct {
PointType pos;
} FrmGraffitiStateType;
typedef struct {
Word id;
FormObjAttrType attr;
RectangleType rect;
VoidPtr data;
} FormGadgetType;
typedef union {
void * ptr;
FieldType * field;
ControlType * control;
ListType * list;
TableType * table;
FormBitmapType * bitmap;
// FormLineType * line;
// FormFrameType * frame;
// FormRectangleType * rectangle;
FormLabelType * label;
FormTitleType * title;
FormPopupType * popup;
FrmGraffitiStateType * grfState;
FormGadgetType * gadget;
} FormObjectType;
// typedef FormObjectType * FormObjectPtr;
typedef struct {
FormObjectKind objectType;
FormObjectType object;
} FormObjListType;
typedef struct {
Word usable :1; // Set if part of ui
Word enabled :1; // Set if interactable (not grayed out)
Word visible :1; // Set if drawn, used internally
Word dirty :1; // Set if dialog has been modified
Word saveBehind :1; // Set if bits behind form are save when form ids drawn
Word graffitiShift :1; // Set if graffiti shift indicator is supported
Word reserved :11;
} FormAttrType;
typedef Boolean FormEventHandlerType (EventPtr eventP);
typedef FormEventHandlerType * FormEventHandlerPtr;
typedef struct {
WindowType window;
Word formId;
FormAttrType attr;
WinHandle bitsBehindForm;
FormEventHandlerPtr handler;
Word focus;
Word defaultButton;
Word helpRscId;
Word menuRscId;
Word numObjects;
FormObjListType * objects;
} FormType;
typedef FormType * FormPtr;
//--------------------------------------------------------------------
//
// Form Function
//
//--------------------------------------------------------------------
extern FormPtr FrmInitForm (Word rscID)
SYS_TRAP(sysTrapFrmInitForm);
extern void FrmDeleteForm (FormPtr frm)
SYS_TRAP(sysTrapFrmDeleteForm);
extern void FrmDrawForm (FormPtr frm)
SYS_TRAP(sysTrapFrmDrawForm);
extern void FrmEraseForm (FormPtr frm)
SYS_TRAP(sysTrapFrmEraseForm);
extern FormPtr FrmGetActiveForm (void)
SYS_TRAP(sysTrapFrmGetActiveForm);
extern void FrmSetActiveForm (FormPtr frm)
SYS_TRAP(sysTrapFrmSetActiveForm);
extern Word FrmGetActiveFormID (void)
SYS_TRAP(sysTrapFrmGetActiveFormID);
extern Boolean FrmGetUserModifiedState (FormPtr frm)
SYS_TRAP(sysTrapFrmGetUserModifiedState);
extern void FrmSetNotUserModified (FormPtr frm)
SYS_TRAP(sysTrapFrmSetNotUserModified);
extern Word FrmGetFocus (FormPtr frm)
SYS_TRAP(sysTrapFrmGetFocus);
extern void FrmSetFocus (FormPtr frm, Word fieldIndex)
SYS_TRAP(sysTrapFrmSetFocus);
extern Boolean FrmHandleEvent (FormPtr frm, EventPtr eventP)
SYS_TRAP(sysTrapFrmHandleEvent);
extern void FrmGetFormBounds (FormPtr frm, RectanglePtr r)
SYS_TRAP(sysTrapFrmGetFormBounds);
extern WinHandle FrmGetWindowHandle (FormPtr frm)
SYS_TRAP(sysTrapFrmGetWindowHandle);
extern Word FrmGetFormId (FormPtr frm)
SYS_TRAP(sysTrapFrmGetFormId);
extern FormPtr FrmGetFormPtr (Word formId)
SYS_TRAP(sysTrapFrmGetFormPtr);
extern FormPtr FrmGetFirstForm (void)
SYS_TRAP(sysTrapFrmGetFirstForm);
extern Word FrmGetNumberOfObjects (FormPtr frm)
SYS_TRAP(sysTrapFrmGetNumberOfObjects);
extern Word FrmGetObjectIndex (FormPtr frm, Word objID)
SYS_TRAP(sysTrapFrmGetObjectIndex);
extern Word FrmGetObjectId (FormPtr, Word objIndex)
SYS_TRAP(sysTrapFrmGetObjectId);
extern FormObjectKind FrmGetObjectType (FormPtr frm, Word objIndex)
SYS_TRAP(sysTrapFrmGetObjectType);
extern void * FrmGetObjectPtr (FormPtr frm, Word objIndex)
SYS_TRAP(sysTrapFrmGetObjectPtr);
extern void FrmGetObjectBounds (FormPtr frm, Word pObjIndex, RectanglePtr r)
SYS_TRAP(sysTrapFrmGetObjectBounds);
extern void FrmHideObject (FormPtr frm, Word objIndex)
SYS_TRAP(sysTrapFrmHideObject);
extern void FrmShowObject (FormPtr frm, Word objIndex)
SYS_TRAP(sysTrapFrmShowObject);
extern void FrmGetObjectPosition (FormPtr frm, Word objIndex,
SWordPtr x, SWordPtr y)
SYS_TRAP(sysTrapFrmGetObjectPosition);
extern void FrmSetObjectPositon (FormPtr frm, Word objIndex,
SWord x, SWord y)
SYS_TRAP(sysTrapFrmSetObjectPositon);
extern SWord FrmGetControlValue (FormPtr frm, Word controlID)
SYS_TRAP(sysTrapFrmGetControlValue);
extern void FrmSetControlValue (FormPtr frm, Word controlID, SWord newValue)
SYS_TRAP(sysTrapFrmSetControlValue);
extern Byte FrmGetControlGroupSelection (FormPtr frm, Byte groupNum)
SYS_TRAP(sysTrapFrmGetControlGroupSelection);
extern void FrmSetControlGroupSelection (FormPtr frm, Byte groupNum,
Word controlID)
SYS_TRAP(sysTrapFrmSetControlGroupSelection);
extern void FrmCopyLabel (FormPtr frm, Word lableID, CharPtr newLable)
SYS_TRAP(sysTrapFrmCopyLabel);
extern CharPtr FrmGetLabel (FormPtr frm, Word lableID)
SYS_TRAP(sysTrapFrmGetLabel);
extern void FrmSetCategoryLabel (FormPtr frm, Word objIndex, CharPtr newLabel)
SYS_TRAP(sysTrapFrmSetCategoryLabel);
extern CharPtr FrmGetTitle (FormPtr frm)
SYS_TRAP(sysTrapFrmGetTitle);
extern void FrmSetTitle (FormPtr frm, CharPtr newTitle)
SYS_TRAP(sysTrapFrmSetTitle);
extern void FrmCopyTitle (FormPtr frm, CharPtr newTitle)
SYS_TRAP(sysTrapFrmCopyTitle);
extern VoidPtr FrmGetGadgetData (FormPtr frm, Word objIndex)
SYS_TRAP(sysTrapFrmGetGadgetData);
extern void FrmSetGadgetData (FormPtr frm, Word objIndex, VoidPtr data)
SYS_TRAP(sysTrapFrmSetGadgetData);
extern Word FrmDoDialog (FormPtr frm)
SYS_TRAP(sysTrapFrmDoDialog);
extern Word FrmAlert (Word alertId)
SYS_TRAP(sysTrapFrmAlert);
extern Word FrmCustomAlert (Word alertId, CharPtr s1, CharPtr s2, CharPtr s3)
SYS_TRAP(sysTrapFrmCustomAlert);
extern void FrmHelp (Word helpMsgId)
SYS_TRAP(sysTrapFrmHelp);
extern void FrmUpdateScrollers (FormPtr frm, Word upIndex, Word downIndex,
Boolean scrollableUp, Boolean scrollabledown)
SYS_TRAP(sysTrapFrmUpdateScrollers);
extern Boolean FrmVisible (FormPtr frm)
SYS_TRAP(sysTrapFrmVisible);
extern void FrmSetEventHandler (FormPtr frm, FormEventHandlerPtr)
SYS_TRAP(sysTrapFrmSetEventHandler);
extern Boolean FrmDispatchEvent (EventPtr eventP)
SYS_TRAP(sysTrapFrmDispatchEvent);
extern void FrmPopupForm (Word formId)
SYS_TRAP(sysTrapFrmPopupForm);
extern void FrmGotoForm (Word formId)
SYS_TRAP(sysTrapFrmGotoForm);
extern void FrmUpdateForm (Word formId, Word updateCode)
SYS_TRAP(sysTrapFrmUpdateForm);
extern void FrmReturnToForm (Word formId)
SYS_TRAP(sysTrapFrmReturnToForm);
extern void FrmCloseAllForms (void)
SYS_TRAP(sysTrapFrmCloseAllForms);
extern void FrmSaveAllForms (void)
SYS_TRAP(sysTrapFrmSaveAllForms);
#endif __FORM_H__

View File

@ -0,0 +1,54 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1995 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: GriffitifShift.h
* AUTHOR: Art Lamb: Aug 24, 1995
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines Griffiti shift state indicator routines.
*
**********************************************************************/
#ifndef __GRFSHIFTIND_H__
#define __GRFSHIFTIND_H__
// Graffiti lock flags
#define glfCapsLock 0x01
#define glfNumLock 0x02
typedef enum { gsiShiftNone, // no indicator
gsiNumLock, // numeric lock
gsiCapsLock, // capital lock
gsiShiftPunctuation, // punctuation shift
gsiShiftExtended, // extented punctuation shift
gsiShiftUpper, // alpha upper case shift
gsiShiftLower // alpha lower case
} GsiShiftState;
extern void GsiInitialize (void)
SYS_TRAP(sysTrapGsiInitialize);
extern void GsiSetLocation (SWord x, SWord y)
SYS_TRAP(sysTrapGsiSetLocation);
extern void GsiEnable (Boolean enableIt)
SYS_TRAP(sysTrapGsiEnable);
extern Boolean GsiEnabled (void)
SYS_TRAP(sysTrapGsiEnabled);
extern void GsiSetShiftState (Word lockFlags, Word tempShift)
SYS_TRAP(sysTrapGsiSetShiftState);
#endif __GRFSHIFTIND_H__

View File

@ -0,0 +1,25 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1995 -- All Rights Reserved
*
* PROJECT: Touchdown
* FILE: GraffitifUI.h
* AUTHOR: Roger Flores: Sep 15, 1995
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines Graffiti UI routines.
*
**********************************************************************/
#ifndef __GRFUI_H__
#define __GRFUI_H__
extern void SysGrfShortCutListDialog ()
SYS_TRAP(sysTrapSysGrfShortCutListDialog);
#endif __GRFUI_H__

View File

@ -0,0 +1,25 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1995 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: Init.h
* AUTHOR: Art Lamb: Jan 25, 1995
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines UI initialization routines.
*
**********************************************************************/
#ifndef __INIT_H__
#define __INIT_H__
extern void UIInitialize (void)
SYS_TRAP(sysTrapUIInitialize);
extern void UIReset (void)
SYS_TRAP(sysTrapUIReset);
#endif __INIT_H__

View File

@ -0,0 +1,48 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1995 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: InsPoint.h
* AUTHOR: Art Lamb: Jan 25, 1995
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines insertion point routines.
*
**********************************************************************/
#ifndef __INSPOINT_H__
#define __INSPOINT_H__
// Blink interval is half of a second
#define insPtBlinkInterval 30
#define insPtWidth 2
extern void InsPtInitialize (void)
SYS_TRAP(sysTrapInsPtInitialize);
extern void InsPtSetLocation (SWord x, SWord y)
SYS_TRAP(sysTrapInsPtSetLocation);
extern void InsPtGetLocation (SWordPtr x, SWordPtr y)
SYS_TRAP(sysTrapInsPtGetLocation);
extern void InsPtEnable (Boolean enableIt)
SYS_TRAP(sysTrapInsPtEnable);
extern Boolean InsPtEnabled (void)
SYS_TRAP(sysTrapInsPtEnabled);
extern void InsPtSetHeight (SWord height)
SYS_TRAP(sysTrapInsPtSetHeight);
extern SWord InsPtGetHeight (void)
SYS_TRAP(sysTrapInsPtGetHeight);
extern void InsPtCheckBlink (void)
SYS_TRAP(sysTrapInsPtCheckBlink);
#endif __INSPOINT_H__

View File

@ -0,0 +1,104 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: list.h
* AUTHOR: Roger Flores: November 3, 1994
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines list structures and routines.
*
***********************************************************************/
#ifndef __LIST_H__
#define __LIST_H__
#define noListSelection 0x0ffff
//-------------------------------------------------------------------
// List structures
//-------------------------------------------------------------------
typedef struct {
Word usable :1; // set if part of ui
Word enabled :1; // set if interactable (not grayed out)
Word visible :1; // set if drawn
Word poppedUp :1; // set if choices displayed in popup win.
Word reserved :4;
} ListAttrType;
// Load data callback routine prototype
typedef void ListDrawDataFuncType (Word itemNum, RectanglePtr bounds,
CharPtr *itemsText);
typedef ListDrawDataFuncType * ListDrawDataFuncPtr;
typedef struct {
Word id;
RectangleType bounds;
ListAttrType attr;
CharPtr *itemsText;
Word numItems; // number of choices in the list
Word currentItem; // currently display choice
Word topItem; // top item visible when poped up
FontID font; // font used to draw list
WinHandle popupWin; // used only by popup lists
ListDrawDataFuncPtr drawItemsCallback; // 0 indicates no function
} ListType;
typedef ListType * ListPtr;
//-------------------------------------------------------------------
// List routines
//-------------------------------------------------------------------
extern void LstDrawList (ListPtr list)
SYS_TRAP(sysTrapLstDrawList);
extern void LstEraseList (ListPtr list)
SYS_TRAP(sysTrapLstEraseList);
extern Word LstGetSelection (ListPtr list)
SYS_TRAP(sysTrapLstGetSelection);
extern CharPtr LstGetSelectionText (ListPtr list, Word itemNum)
SYS_TRAP(sysTrapLstGetSelectionText);
extern Boolean LstHandleEvent (ListPtr list, EventPtr event)
SYS_TRAP(sysTrapLstHandleEvent);
extern void LstSetHeight (ListPtr pList, Word visibleItems)
SYS_TRAP(sysTrapLstSetHeight);
extern void LstSetPosition (ListPtr pList, SWord x, SWord y)
SYS_TRAP(sysTrapLstSetPosition);
extern void LstSetSelection (ListPtr list, Word itemNum)
SYS_TRAP(sysTrapLstSetSelection);
extern void LstSetListChoices (ListPtr list, Char ** itemsText,
Word numItems)
SYS_TRAP(sysTrapLstSetListChoices);
extern void LstSetDrawFunction (ListPtr pList, ListDrawDataFuncPtr func)
SYS_TRAP(sysTrapLstSetDrawFunction);
extern void LstSetTopItem (ListPtr pList, Word itemNum)
SYS_TRAP(sysTrapLstSetTopItem);
extern void LstMakeItemVisible (ListPtr pList, Word itemNum)
SYS_TRAP(sysTrapLstMakeItemVisible);
extern Word LstGetNumberOfItems (ListPtr pList)
SYS_TRAP(sysTrapLstGetNumberOfItems);
extern SWord LstPopupList (ListPtr list)
SYS_TRAP(sysTrapLstPopupList);
#endif // __LIST_H__

View File

@ -0,0 +1,97 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: menu.h
* AUTHOR: Roger Flores: November 18, 1994
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines menu structures and routines.
*
***********************************************************************/
#ifndef __MENU_H__
#define __MENU_H__
#define noMenuSelection -1
#define noMenuItemSelection -1
// To match Apple's ResEdit the first byte of a menu item's text can
// be a special char indicating a special menu item.
#define MenuSeparatorChar '-'
typedef struct {
Word id; // id of the menu item
Char command; // command key
CharPtr itemStr; // string to be displayed
} MenuItemType;
typedef struct {
WinHandle menuWin; // window of pull-down menu
RectangleType bounds; // bounds of the pulldown
WinHandle bitsBehind; // saving bits behind pull-down menu
RectangleType titleBounds; // bounds of the title in menu bar
CharPtr title; // menu title displayed in menu bar
Word numItems; // number of items in the menu
MenuItemType * items; // array of menu items
} MenuPullDownType;
typedef MenuPullDownType * MenuPullDownPtr;
typedef struct {
Word visible :1; // Set if menu bar is drawn
Word commandPending :1; // Set if next key is a command
Word insPtEnabled :1; // Set if insPt was on when menu was drawn
} MenuBarAttrType;
typedef struct {
WinHandle barWin; // window of menu bar
WinHandle bitsBehind; // saving bits behind menu bar
WinHandle savedActiveWin;
WinHandle bitsBehindStatus;
MenuBarAttrType attr;
SWord curMenu; // current menu or -1 if none
SWord curItem; // current item in curMenu, -1 if none
SDWord commandTick; //
SWord numMenus; // number of menus
MenuPullDownPtr menus; // array of menus
} MenuBarType;
typedef MenuBarType * MenuBarPtr;
extern MenuBarPtr MenuInit (Word resourceId)
SYS_TRAP(sysTrapMenuInit);
extern MenuBarPtr MenuGetActiveMenu (void)
SYS_TRAP(sysTrapMenuGetActiveMenu);
extern MenuBarPtr MenuSetActiveMenu (MenuBarPtr pMenu)
SYS_TRAP(sysTrapMenuSetActiveMenu);
extern void MenuDispose (MenuBarPtr pMenu)
SYS_TRAP(sysTrapMenuDispose);
extern Boolean MenuHandleEvent (MenuBarPtr pMenu, EventPtr event,
WordPtr error)
SYS_TRAP(sysTrapMenuHandleEvent);
extern void MenuDrawMenu (MenuBarPtr pMenu)
SYS_TRAP(sysTrapMenuDrawMenu);
extern void MenuEraseStatus (MenuBarPtr pMenu)
SYS_TRAP(sysTrapMenuEraseStatus);
#endif //__MENU_H__

View File

@ -0,0 +1,71 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: Rect.h
* AUTHOR: Roger Flores: November 3, 1994
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines rectangle structures and routines.
*
***********************************************************************/
#ifndef __RECT_H__
#define __RECT_H__
typedef struct {
SWord left;
SWord top;
SWord right;
SWord bottom;
} AbsRectType;
typedef struct {
SWord x;
SWord y;
} PointType;
typedef struct {
PointType topLeft;
PointType extent;
} RectangleType;
typedef RectangleType * RectanglePtr;
#ifdef __cplusplus
extern "C" {
#endif
extern void RctSetRectangle (RectanglePtr r, SWord left, SWord top,
SWord width, SWord height)
SYS_TRAP(sysTrapRctSetRectangle);
extern void RctCopyRectangle (RectanglePtr srcRect, RectanglePtr dstRect)
SYS_TRAP(sysTrapRctCopyRectangle);
extern void RctInsetRectangle (RectanglePtr r, SWord insetAmt)
SYS_TRAP(sysTrapRctInsetRectangle);
extern void RctOffsetRectangle (RectanglePtr r, SWord deltaX, SWord deltaY)
SYS_TRAP(sysTrapRctOffsetRectangle);
extern Boolean RctPtInRectangle (SWord x, SWord y, RectanglePtr r)
SYS_TRAP(sysTrapRctPtInRectangle);
extern void RctGetIntersection (RectanglePtr r1, RectanglePtr r2, RectanglePtr r3)
SYS_TRAP(sysTrapRctGetIntersection);
#ifdef __cplusplus
}
#endif
#endif //__RECT_H__

View File

@ -0,0 +1,161 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1995 -- All Rights Reserved
*
* PROJECT: Pilot [EMULATOR]
*
* FILE: ScrDriver.h
*
* AUTHOR: Ain McKendrick
*
* DECLARER:
*
* DESCRIPTION: Screen driver function prototypes. For use by TD applications.
*
* REVISION HISTORY:
* Name Date Description
* ---- ---- -----------
* Ain 1/25/95 Initial creation
* Ain 2/3/95 Revised to use new WinPtr type due to name
* changes in window.h
*
**********************************************************************/
#ifndef __SCRDRIVER_H__
#define __SCRDRIVER_H__
#include <SystemMgr.h>
/**************************************************************************
* Internal constants
***************************************************************************/
#define scrMaxLineBytes 32 // Max # of bytes in a scan line
// used in compression/decompression calls
/**************************************************************************
* Internal Drawing info structure used by Screen Driver
***************************************************************************/
//typedef enum {scrCopy, scrAND, scrANDNOT, scrXOR, scrOR, scrCopyNOT} ScrOperation;
typedef struct ScrBltInfoType {
// Common fields.
ScrOperation op; // which bit operation to do
SWord height; // height of blit operation
WordPtr dstBaseP; // base address of window we're blitting to
Word dstRowBytes; // rowBytes of window
WordPtr srcBaseP; // base address of window we're blitting from
Word srcRowBytes; // rowBytes of window
// Info for each line
Word leftMask; // mask for leftmost byte of row
Word rightMask; // mask for rightmost byte of row
SWord midWords; // # of words between left and right mask
SWord dstRowDelta; // delta bytes from row to row
WordPtr dstP; // byte address of first dst line
SWord srcRowDelta; // delta bytes from row to row
WordPtr srcP; // byte address of first source line
// These fields only used for drawing operations.
Word* patternP; // pointer to pattern to use
Word solidPat; // color word if no pattern
//DOLATER.. used to byte byte
Boolean simple; // true if scrCopy with solid pattern
CustomPatternType pattern; // copy of modified pattern
} ScrBltInfoType;
typedef ScrBltInfoType* ScrBltInfoPtr;
/**************************************************************************
* Structure of Screen Driver globals
***************************************************************************/
typedef struct ScrGlobalsType {
Word width; // width of display in pixels
Word height; // height of display in pixels
Word rowBytes; // rowBytes of display
Ptr baseAddr; // base address of display
CustomPatternType grayPat; // Gray pattern
Boolean doDrawNotify; // call ScrDrawNotify after drawing
AbsRectType updateR; // update rect when in remote mode
SDWord lastUpdate; // Tickcount of last update
} ScrGlobalsType;
typedef ScrGlobalsType* ScrGlobalsPtr;
/************************************************************
* Function Prototypes
*************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
// Initialization
void ScrInit(void)
SYS_TRAP(sysTrapScrInit);
// BitBlt Functions
Err ScrCopyRectangle(WinPtr sourceWindow, WinPtr destWindow,
SWord fromX, SWord fromY, SWord toX, SWord toY,
SWord bitCount, SWord lineCount)
SYS_TRAP(sysTrapScrCopyRectangle);
// Character Functions
void ScrDrawChars(WinPtr pWindow, SWord xLoc, SWord yLoc, SWord xExtent, SWord yExtent,
SWord clipTop, SWord clipLeft, SWord clipBottom, SWord clipRight,
CharPtr chars, Word len, FontPtr fontPtr)
SYS_TRAP(sysTrapScrDrawChars);
// Line Draw Functions
void ScrLineRoutine(WinPtr pWindow, SWord x1, SWord y1, SWord x2, SWord y2)
SYS_TRAP(sysTrapScrLineRoutine);
void ScrRectangleRoutine(WinPtr pWindow, SWord x, SWord y, SWord extentX,
SWord extentY)
SYS_TRAP(sysTrapScrRectangleRoutine);
// Utility Functions
void ScrScreenInfo (WinPtr pWindow)
SYS_TRAP(sysTrapScrScreenInfo);
void ScrDrawNotify(SWord updLeft, SWord updTop, SWord updWidth, SWord updHeight)
SYS_TRAP(sysTrapScrDrawNotify);
void ScrSendUpdateArea(Boolean force)
SYS_TRAP(sysTrapScrSendUpdateArea);
Word ScrCompressScanLine(BytePtr lineP, BytePtr prevLineP, Word width,
BytePtr dstParamP, Boolean firstLine)
SYS_TRAP(sysTrapScrCompressScanLine);
Word ScrDeCompressScanLine(BytePtr srcP, BytePtr dstP, Word width)
SYS_TRAP(sysTrapScrDeCompressScanLine);
#ifdef __cplusplus
}
#endif
#endif // __SCRDRIVER_H__

View File

@ -0,0 +1,30 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: SelDay.h
* AUTHOR: Roger Flores: November 10, 1994
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines the date picker month object's structures
* and routines.
*
***********************************************************************/
#ifndef __SELDAY_H__
#define __SELDAY_H__
#include <Day.h>
#define daySelectorMinYear firstYear
#define daySelectorMaxYear lastYear
extern Boolean SelectDay (SWord *month, SWord *day, SWord *year, CharPtr title)
SYS_TRAP(sysTrapSelectDay);
#endif //__SELDAY_H__

View File

@ -0,0 +1,38 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: selTime.h
* AUTHOR: Roger Flores: December 6, 1994
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines select time structures and routines.
*
***********************************************************************/
#ifndef __SELTIME_H__
#define __SELTIME_H__
#define NumericSpaceChar 0x80
//-------------------------------------------------------------------
// structures
//-------------------------------------------------------------------
typedef struct {
Byte hours;
Byte minutes;
Byte seconds;
} HMSTime;
extern Boolean SelectTime (TimePtr startTimeP, TimePtr EndTimeP,
Boolean untimed, CharPtr title, SWord startOfDay)
SYS_TRAP(sysTrapSelectTime);
#endif // __SELTIME_H__

View File

@ -0,0 +1,262 @@
/***********************************************************************
*
* Copyright (c) Palm Computing 1994 -- All Rights Reserved
*
* PROJECT: Pilot
* FILE: field.h
* AUTHOR: Art Lamb: September 1, 1994
*
* DECLARER: UI
*
* DESCRIPTION:
* This file defines table structures and routines.
*
***********************************************************************/
#ifndef __TABLE_H__
#define __TABLE_H__
//-------------------------------------------------------------------
// Table structures
//-------------------------------------------------------------------
#define tableDefaultColumnSpacing 1
#define tableNoteIndicatorWidth 7
#define tableNoteIndicatorHeight 11
// Display style of a table item
//
enum tableItemStyles { checkboxTableItem,
customTableItem,
dateTableItem,
labelTableItem,
numericTableItem,
popupTriggerTableItem,
textTableItem,
textWithNoteTableItem,
timeTableItem};
typedef enum tableItemStyles TableItemStyleType;
typedef struct {
TableItemStyleType itemType;
FontID fontID; // font for drawing text
Word intValue;
CharPtr ptr;
} TableItemType;
typedef TableItemType * TableItemPtr;
// Draw item callback routine prototype, used only by customTableItem.
typedef void TableDrawItemFuncType
(VoidPtr table, Word row, Word column, RectanglePtr bounds);
typedef TableDrawItemFuncType * TableDrawItemFuncPtr;
// Load data callback routine prototype
typedef Err TableLoadDataFuncType
(VoidPtr table, Word row, Word column, Boolean editable,
VoidHand * dataH, WordPtr dataOffset, WordPtr dataSize);
typedef TableLoadDataFuncType * TableLoadDataFuncPtr;
// Save data callback routine prototype
typedef Boolean TableSaveDataFuncType
(VoidPtr table, Word row, Word column);
typedef TableSaveDataFuncType * TableSaveDataFuncPtr;
typedef struct {
Word width; // width in pixels
Boolean usable;
Word spacing; // space after column
TableDrawItemFuncPtr drawCallback;
TableLoadDataFuncPtr loadDataCallback;
TableSaveDataFuncPtr saveDataCallback;
} TableColumnAttrType;
typedef struct {
Word id;
Word height; // row height in pixels
DWord data;
Boolean usable;
Boolean selectable;
Boolean invalid; // true if redraw needed
} TableRowAttrType;
typedef struct {
Word visible:1; // Set if drawn, used internally
Word editable:1; // Set if editable
Word editing:1; // Set if in edit mode
Word selected:1; // Set if the current item is selected
} TableAttrType;
typedef struct {
Word id;
RectangleType bounds;
TableAttrType attr;
Word numColumns;
Word numRows;
Word currentRow;
Word currentColumn;
Word topRow;
TableColumnAttrType * columnAttrs;
TableRowAttrType * rowAttrs;
TableItemPtr items;
FieldType currentField;
} TableType;
typedef TableType * TablePtr;
//-------------------------------------------------------------------
// Table routines
//-------------------------------------------------------------------
extern void TblDrawTable (TablePtr table)
SYS_TRAP(sysTrapTblDrawTable);
extern void TblRedrawTable (TablePtr table)
SYS_TRAP(sysTrapTblRedrawTable);
extern void TblEraseTable (TablePtr table)
SYS_TRAP(sysTrapTblEraseTable);
extern Boolean TblHandleEvent (TablePtr table, EventPtr event)
SYS_TRAP(sysTrapTblHandleEvent);
extern void TblGetItemBounds (TablePtr table, Word row, Word column,
RectanglePtr r)
SYS_TRAP(sysTrapTblGetItemBounds);
extern void TblSelectItem (TablePtr table, Word row, Word column)
SYS_TRAP(sysTrapTblSelectItem);
extern Word TblGetItemInt (TablePtr table, Word row, Word column)
SYS_TRAP(sysTrapTblGetItemInt);
extern void TblSetItemInt (TablePtr table, Word row, Word column, Word value)
SYS_TRAP(sysTrapTblSetItemInt);
extern void TblSetItemPtr (TablePtr table, Word row, Word column, VoidPtr value)
SYS_TRAP(sysTrapTblSetItemPtr);
extern void TblSetItemStyle (TablePtr table, Word row, Word column,
TableItemStyleType type)
SYS_TRAP(sysTrapTblSetItemStyle);
extern void TblUnhighlightSelection (TablePtr table)
SYS_TRAP(sysTrapTblUnhighlightSelection);
extern Boolean TblRowUsable (TablePtr table, Word row)
SYS_TRAP(sysTrapTblRowUsable);
extern void TblSetRowUsable (TablePtr table, Word row, Boolean usable)
SYS_TRAP(sysTrapTblSetRowUsable);
extern Word TblGetLastUsableRow (TablePtr table)
SYS_TRAP(sysTrapTblGetLastUsableRow);
extern void TblSetColumnUsable (TablePtr table, Word row, Boolean usable)
SYS_TRAP(sysTrapTblSetColumnUsable);
extern void TblSetRowSelectable (TablePtr table, Word row, Boolean selectable)
SYS_TRAP(sysTrapTblSetRowSelectable);
extern Boolean TblRowSelectable (TablePtr table, Word row)
SYS_TRAP(sysTrapTblRowSelectable);
extern Word TblGetNumberOfRows (TablePtr table)
SYS_TRAP(sysTrapTblGetNumberOfRows);
extern void TblSetCustomDrawProcedure
(TablePtr table, Word column, TableDrawItemFuncPtr drawCallback)
SYS_TRAP(sysTrapTblSetCustomDrawProcedure);
extern void TblSetLoadDataProcedure
(TablePtr table, Word column, TableLoadDataFuncPtr loadDataCallback)
SYS_TRAP(sysTrapTblSetLoadDataProcedure);
extern void TblSetSaveDataProcedure
(TablePtr table, Word column, TableSaveDataFuncPtr saveDataCallback)
SYS_TRAP(sysTrapTblSetSaveDataProcedure);
extern void TblGetBounds (TablePtr table, RectanglePtr r)
SYS_TRAP(sysTrapTblGetBounds);
extern Word TblGetRowHeight (TablePtr table, Word row)
SYS_TRAP(sysTrapTblGetRowHeight);
extern void TblSetRowHeight (TablePtr table, Word row, Word height)
SYS_TRAP(sysTrapTblSetRowHeight);
extern Word TblGetColumnWidth (TablePtr table, Word column)
SYS_TRAP(sysTrapTblGetColumnWidth);
extern void TblSetColumnWidth (TablePtr table, Word column, Word width)
SYS_TRAP(sysTrapTblSetColumnWidth);
extern Word TblGetColumnSpacing (TablePtr table, Word column)
SYS_TRAP(sysTrapTblGetColumnSpacing);
extern void TblSetColumnSpacing (TablePtr table, Word column, Word spacing)
SYS_TRAP(sysTrapTblSetColumnSpacing);
extern Boolean TblFindRowID (TablePtr table, Word id, WordPtr rowP)
SYS_TRAP(sysTrapTblFindRowID);
extern Boolean TblFindRowData (TablePtr table, DWord data, WordPtr rowP)
SYS_TRAP(sysTrapTblFindRowData);
extern Word TblGetRowID (TablePtr table, Word row)
SYS_TRAP(sysTrapTblGetRowID);
extern void TblSetRowID (TablePtr table, Word row, Word id)
SYS_TRAP(sysTrapTblSetRowID);
extern DWord TblGetRowData (TablePtr table, Word row)
SYS_TRAP(sysTrapTblGetRowData);
extern void TblSetRowData (TablePtr table, Word row, DWord data)
SYS_TRAP(sysTrapTblSetRowData);
extern Boolean TblRowInvalid (TablePtr table, Word row)
SYS_TRAP(sysTrapTblRowInvalid);
extern void TblMarkRowInvalid (TablePtr table, Word row)
SYS_TRAP(sysTrapTblMarkRowInvalid);
extern void TblMarkTableInvalid (TablePtr table)
SYS_TRAP(sysTrapTblMarkTableInvalid);
extern Boolean TblGetSelection (TablePtr table, WordPtr rowP, WordPtr columnP)
SYS_TRAP(sysTrapTblGetSelection);
extern void TblInsertRow (TablePtr table, Word row)
SYS_TRAP(sysTrapTblInsertRow);
extern void TblRemoveRow (TablePtr table, Word row)
SYS_TRAP(sysTrapTblRemoveRow);
extern void TblReleaseFocus (TablePtr table)
SYS_TRAP(sysTrapTblReleaseFocus);
extern Boolean TblEditing (TablePtr table)
SYS_TRAP(sysTrapTblEditing);
extern FieldPtr TblGetCurrentField (TablePtr table)
SYS_TRAP(sysTrapTblGetCurrentField);
extern void TblGrabFocus (TablePtr table, Word row, Word column)
SYS_TRAP(sysTrapTblGrabFocus);
#endif //__TABLE_H__

View File

@ -0,0 +1,32 @@
#ifdef __cplusplus
extern "C" {
#endif
#include <UICommon.h>
#include <Init.h>
#include <Rect.h>
#include <Font.h>
#include <Window.h>
#include <Chars.h>
#include <InsPoint.h>
#include <GraffitiShift.h>
#include <Event.h>
#include <ClipBoard.h>
#include <Control.h>
#include <Field.h>
#include <List.h>
#include <Table.h>
#include <Form.h>
#include <Menu.h>
#include <Category.h>
#include <Find.h>
#include <SelDay.h>
#include <SelTime.h>
#include <AboutBox.h>
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,225 @@
#ifndef __UICOMMON_H__
#define __UICOMMON_H__
enum justifications { leftAlign, centerAlign, rightAlign };
typedef enum justifications JustificationType;
//------------------------------------------------------------
// System functions
//------------------------------------------------------------
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max(a, b) (((a) > (b)) ? (a) : (b))
//------------------------------------------------------------
// Temporary resource routines
//------------------------------------------------------------
#define strRsc 'tSTR'
#define ainRsc 'tAIN'
#define iconType 'tAIB'
#define bitmapRsc 'Tbmp'
#define alertRscType 'Talt'
#define kbdRscType 'tkbd'
#define MenuRscType 'MBAR'
#define fontRscType 'NFNT'
#define verRsc 'tver'
#define appInfoStringsRsc 'tAIS'
// Application version string ID
#define appVersionID 1
#define ainID 1000
// System version string ID - this is hidden in
// the SystemVersion.rsrc resource, because the 'system' resources
// don't have ResEdit formats.
#define systemVersionID 10000
// System bitmaps
#define palmLogoBitmap 10000
#define keyboardBackspaceBitmap 10001
#define keyboardTabBitmap 10002
#define keyboardReturnBitmap 10003
#define InformationAlertBitmap 10004
#define ConfirmationAlertBitmap 10005
#define WarningAlertBitmap 10006
#define ErrorAlertBitmap 10007
#define keyboardShiftBitmap 10008
#define keyboardCapBitmap 10009
// System string resources
#define daysOfWeekStrID 10000
#define dayFullNamesStrID 10001
#define monthNamesStrID 10002
#define monthFullNamesStrID 10003
#define categoryAllStrID 10004
#define categoryEditStrID 10005
#define menuCommandStrID 10006
#define launcherBatteryStrID 10007
#define systemNameStrID 10008
// System Alerts
#define RenameCategoryAlert 10000
#define RenameCategoryYes 0
#define RenameCategoryNo 1
#define RemoveCategoryAlert 10001
#define RemoveCategoryYes 0
#define RemoveCategoryNo 1
#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
// 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
// Keyboard Menu Bar and Menus
#define sysKeyboardMenuID 10100
#define sysKeyboardEditUndoCmd 100
#define sysKeyboardEditCutCmd 101
#define sysKeyboardEditCopyCmd 102
#define sysKeyboardEditPasteCmd 103
#define sysKeyboardEditSelectAllCmd 104
// Note View Menu Bar and Menus
#define noteMenuID 10200
#define noteUndoCmd 10000
#define noteCutCmd 10001
#define noteCopyCmd 10002
#define notePasteCmd 10003
#define noteSelectAllCmd 10004
#define noteSeparator 10005
#define noteKeyboardCmd 10006
#define noteTopOfPageCmd 10200
#define noteBottomOfPageCmd 10201
// System Keyboard Dialog
#define SystemKeyboardID 10000
// Categories Edit Dialog
#define CategoriesEditForm 10000
#define CategoriesEditDoneButton 10002
#define CategoriesEditFirstField 10004
// Date Selector Dialog
#define DateSelectorForm 10100
#define DateSelectorYearLabel 10102
#define DateSelectorPriorYearButton 10103
#define DateSelectorNextYearButton 10104
#define DateSelectorTodayButton 10118
#define DateSelectorCancelButton 10119
#define DateSelectorDayGadget 10120
// Time Selector Dialog
#define TimeSelectorForm 10200
#define TimeSelectorStartTimeButton 10204
#define TimeSelectorEndTimeButton 10205
#define TimeSelectorHourList 10206
#define TimeSelectorMinuteList 10207
#define TimeSelectorOKButton 10208
#define TimeSelectorCancelButton 10209
#define TimeSelectorNoTimeButton 10210
// Onscreen Keyboard
#define KeyboardForm 10300
#define KeyboardGadget 10310
// Help Dialog
#define HelpForm 10400
#define HelpField 10402
#define HelpDoneButton 10403
#define HelpUpButton 10404
#define HelpDownButton 10405
// Find Dialog
#define FindDialog 10500
#define FindStrField 10503
#define FindOKButton 10504
// Find Results Dialog
#define FindResultsDialog 10600
#define FindResultsMsgLabel 10602
#define FindResultsTable 10603
#define FindResultsGoToButton 10604
#define FindResultsCancelButton 10605
#define FindResultsMoreButton 10606
#define FindResultsSearchingStr 10607
#define FindResultsMatchesStr 10608
#define FindResultsNoMatchesStr 10609
#define FindResultsContinueStr 10610
// Note View (used by Datebook, To Do, and Address apps)
#define NoteView 10900
#define NoteField 10901
#define NoteDoneButton 10902
#define NoteSmallFontButton 10903
#define NoteLargeFontButton 10904
#define NoteDeleteButton 10905
#define NoteUpButton 10906
#define NoteDownButton 10907
#define NoteFontGroup 1
// About Box - used by Datebook, Memo, Address, To Do, & others
#define aboutDialog 11000
#define aboutNameLabel 11001
#define aboutVersionLabel 11002
#define aboutErrorStr 11003
//------------------------------------------------------------
// Temporary resource routines
//------------------------------------------------------------
void* ResLoadForm (Word rscID)
SYS_TRAP(sysTrapResLoadForm);
void* ResLoadMenu (Word rscID)
SYS_TRAP(sysTrapResLoadMenu);
CharPtr ResLoadString (Word rscID);
//------------------------------------------------------------
// Temporary debugging routines
//------------------------------------------------------------
extern Boolean HeapDump (void);
#endif //__UICOMMON_H__

Some files were not shown because too many files have changed in this diff Show More