1 //---------------------------------------------------------------------------
2 // Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved.
4 // Permission is hereby granted, free of charge, to any person obtaining a
5 // copy of this software and associated documentation files (the "Software"),
6 // to deal in the Software without restriction, including without limitation
7 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 // and/or sell copies of the Software, and to permit persons to whom the
9 // Software is furnished to do so, subject to the following conditions:
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 // IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES
18 // OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 // OTHER DEALINGS IN THE SOFTWARE.
22 // Except as contained in this notice, the name of Dallas Semiconductor
23 // shall not be used except as stated in the Dallas Semiconductor
25 //---------------------------------------------------------------------------
27 // ownet.h - Include file for 1-Wire Net library
31 // History: 1.02 -> 1.03 Make sure uchar is not defined twice.
32 // 1.03 -> 2.00 Changed 'MLan' to 'ow'.
38 typedef unsigned char uchar;
39 typedef unsigned int ushort;
40 typedef unsigned long ulong;
44 #define WRITE_FUNCTION 1
45 #define READ_FUNCTION 0
49 #define INVALID_DIR -2
51 #define WRITE_ERROR -4
53 #define FILE_TOO_BIG -6
58 #define MAX_PORTNUM 16
61 #define MODE_NORMAL 0x00
62 #define MODE_OVERDRIVE 0x01
63 #define MODE_STRONG5 0x02
64 #define MODE_PROGRAM 0x04
65 #define MODE_BREAK 0x08
67 // family codes of devices
68 #define DIR_FAMILY 0x01
69 #define TEMP_FAMILY 0x10
70 #define SWITCH_FAMILY 0x12
71 #define COUNT_FAMILY 0x1D
72 #define ATOD_FAMILY 0X20
73 #define THERMO_FAM 0x21
74 // this is weird, the DS2502 should be 0x09
75 #define DS2502_FAMILY 0x89
78 extern void FlushCOM(int);
79 extern int WriteCOM(int,int,uchar*);
80 extern int ReadCOM(int,int,uchar*);
81 extern void BreakCOM(int);
82 extern void SetBaudCOM(int,int);
83 extern void msDelay(int);
84 extern long msGettick(void);
85 extern int OpenCOM(int,char *);
86 extern void CloseCOM(int);
89 extern int owFirst(int,int,int);
90 extern int owNext(int,int,int);
91 extern void owSerialNum(int,uchar *, int);
92 extern void owFamilySearchSetup(int,int);
93 extern void owSkipFamily(int);
94 extern int owAccess(int);
95 extern int owVerify(int,int);
96 extern int owOverdriveAccess(int);
97 extern int bitacc(int,int,int,uchar *);
98 extern uchar SerialNum[MAX_PORTNUM][8];
101 extern int owBlock(int,int,uchar *,int);
102 extern int owReadPacketStd(int,int,int,uchar *);
103 extern int owWritePacketStd(int,int,uchar *,int,int,int);
104 extern int owProgramByte(int,int,int,int,int,int);
107 extern void setcrc16(int,ushort);
108 extern ushort docrc16(int,ushort);
109 extern void setcrc8(int,uchar);
110 extern uchar docrc8(int,uchar);
113 extern int owTouchReset(int);
114 extern int owTouchByte(int, int);
115 extern int owWriteByte(int,int);
116 extern int owReadByte(int);
117 extern int owSpeed(int,int);
118 extern int owLevel(int,int);
119 extern int owProgramPulse(int);
121 // owlli for the internal (TINI) ow bus
122 extern uchar iowTouchReset(void);
123 extern uchar iowReadByte(void);
124 extern uchar iowWriteByte(uchar);
125 extern uchar iowBlock(uchar, uchar*, uchar);
126 extern uchar iowFirst(uchar do_reset, uchar alarm_only);
127 extern uchar iowNext(uchar do_reset, uchar alarm_only);
128 extern uchar iowSpeed(int speed);
129 extern uchar iowLevel(int level);
130 extern uchar iowProgramPulse(void);
131 extern void iowSerialNum(uchar *, uchar);
134 extern int owAcquire(int,char *, char *);
135 //extern int owAcquire(int,char *);
136 extern void owRelease(int, char *);
137 //extern void owRelease(int);
140 extern int FindDevices(int, uchar FamilySN[][8], int, int);
143 int owReadFile(int,uchar *,uchar *);
144 int owFormatWriteFile(int,uchar *, int, uchar *);
148 // sdcc has no double
150 // sdcc has no key_abort
151 #define key_abort Serial0CharArrived