1 /* ************************************************************************* */
2 /* SauthPalm.h                                                               */
3 /* DS Software Authorization Alpha01 API for the HandSpring Visor            */
4 /* 04/03/2000                                                                */
5 /*                                                                           */
6 /* Copyright (C) 2000 Dallas Semiconductor Corporation.                      */
7 /* All rights Reserved. Printed in U.S.A.                                    */
8 /* This software is protected by copyright laws of                           */
9 /* the United States and of foreign countries.                               */
10 /* This software is furnished under a license agreement and/or a             */
11 /* nondisclosure agreement and may only be used or copied in accordance      */
12 /* with the terms of those agreements.                                       */
13 /* The mere transfer of this software does not imply any licenses            */
14 /* of trade secrets, proprietary technology, copyrights, patents,            */
15 /* trademarks, maskwork rights, or any other form of intellectual            */
16 /* property whatsoever. Dallas Semiconductor retains all ownership rights.   */
17 /*                                                                           */
18 /* ************************************************************************* */
19 
20 #ifndef _SAUTHPALM_H_
21 #define _SAUTHPALM_H_
22 
23 #include "ownet.h"
24 
25 #ifndef OW_UCHAR
26 typedef unsigned char  uchar;
27 typedef unsigned short ushort;
28 typedef unsigned int   uint;
29 typedef unsigned long  ulong;
30 #endif
31 
32 #ifndef SERIAL_DS2480
33 #define SERIAL_DS2480      0
34 #endif
35 
36 #ifndef PARALLEL_DS1481
37 #define PARALLEL_DS1481    1
38 #endif
39 
40 // DS1413
41 #ifndef SERIAL_DS1413
42 #define SERIAL_DS1413      2
43 #endif
44 
45 #define DS2480 SERIAL_DS2480
46 #define DS1410 PARALLEL_DS1481
47 #define DS1413 SERIAL_DS1413
48 
49 #define VISOR_EX  1
50 #define VISOR_INT 2
51 
52 #ifndef TRUE
53 #define TRUE 1
54 #define FALSE 0
55 #endif
56 //
57 #define PALM_EXTERNAL_DS1481 0
58 #define PALM_INTERNAL_DS1481 1
59 ////////////////
60 #define EXT_ENI   0x001
61 #define EXT_D_CLK 0x002
62 #define EXT_RES   0x004
63 #define INT_ENI   0x010
64 #define INT_D_CLK 0x020
65 #define INT_RES   0x040
66 //
67 #define EXT_O1    0x001
68 #define INT_O1    0x010
69 //
70 #define OUTPUT_DEFAULT     (uchar)0x0ff
71 #define OUTPUT_ENABLE_ONLY (uchar)(~EXT_ENI | 0x0f)
72 #define OUTPUT_READ_WRITE1 (uchar)(EXT_D_CLK | EXT_RES)
73 #define OUTPUT_WRITE0      (uchar)(EXT_RES)
74 #define OUTPUT_RESET       (uchar)(EXT_D_CLK)
75 #define OUTPUT_OVERDRIVE   (uchar)(~(EXT_D_CLK | EXT_RES))
76 #define OUTPUT_OVERDRIVE_ENABLE   (uchar)(~(EXT_D_CLK | EXT_RES | EXT_ENI))
77 #define OUTPUT_CLOCK_DATA  (uchar)(~(EXT_D_CLK | EXT_ENI))
78 //
79 #define far
80 #define pascal
81 #define DisableInterrupts()
82 #define EnableInterrupts()
83 #define SpinMSec(T) Sleep(T)
84 
85 //
86 #define TRUE  1
87 #define FALSE 0
88 //
89 #define RESET OUTPUT_RESET  // Set data lines to 0xFD to perform a reset
90 #define W0BIT OUTPUT_WRITE0  // Set data lines to 0xFE to send a write 0
91 #define RWBIT OUTPUT_READ_WRITE1  // Set data lines to 0xFF to send a write 1 or read 0/1
92 //
93 #define MAX_W 2000
94 //
95 ////////////////
96 
97 #ifdef __cplusplus
98 extern "C" {
99 #endif
100 
101 void Sleep(long p_Millis);
102 // legacy functions
103 uchar far pascal keyopen(void);
104 uchar far pascal keyclose(void);
105 uchar far pascal dowcheck(void);
106 uchar far pascal setup(uchar pn);
107 uchar far pascal next(void);
108 uchar far pascal first(void);
109 uchar far pascal access(void);
110 uchar far pascal databyte(uchar br);
111 uchar far pascal gndtest(void);
112 uchar far * far pascal romdata(void);
113 uchar far pascal OverdriveOn(void);
114 uchar far pascal OverdriveOff(void);
115 // current functions
116 uchar SetAdapterType(uchar Type, char *type);
117 uchar SetAdapterSpeed(ulong speed);
118 uchar iBDataBlock(uchar *data, int count);
119 uchar iBDataByte(uchar data);
120 uchar iBSetup(uchar pn);
121 uchar iBKeyOpen(void);
122 uchar iBKeyClose(void);
123 uchar iBFirst(void);
124 uchar iBNext(void);
125 uchar *iBROMData(void);
126 uchar iBOverdriveOn(void);
127 uchar iBOverdriveOff(void);
128 uchar iBStream(uchar *arr,int length);
129 uchar iBAccess(void);
130 uchar iBFastAccess(void);
131 uchar iBStrongAccess(void);
132 uchar SetAdapter5VTime(uchar time);
133 uchar Adapter5VPrime(void);
134 uchar Adapter5VCancel(void);
135 uchar iBDataBit(uchar bit);
136 // powerManagment
137 void AdapterPowerManagement(uchar on);
138 
139 #ifdef __cplusplus
140 }
141 #endif
142 
143 #endif /* _SAUTHPALM_H_ */
144 
145