1 //--------------------------------------------------------------------------- 2 // Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. 3 // 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: 10 // 11 // The above copyright notice and this permission notice shall be included 12 // in all copies or substantial portions of the Software. 13 // 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. 21 // 22 // Except as contained in this notice, the name of Dallas Semiconductor 23 // shall not be used except as stated in the Dallas Semiconductor 24 // Branding Policy. 25 //--------------------------------------------------------------------------- 26 // 27 // DS2480.H - This file contains the DS2480B constants 28 // 29 // Version: 2.00 30 // 31 // History: 1.02 -> 1.03 Make sure uchar is not defined twice. 32 // 33 // 34 35 #ifndef __MC68K__ 36 #include <stdlib.h> 37 #ifndef _WIN32_WCE 38 #include <stdio.h> 39 #endif 40 #endif 41 42 // Typedefs 43 #ifndef OW_UCHAR 44 #define OW_UCHAR 45 typedef unsigned char uchar; 46 #ifdef WIN32 47 #ifndef __CYGWIN__ //&& GCC 48 //already defined in sys/types.h for cygwin 49 typedef unsigned short ushort; 50 #endif 51 typedef unsigned long ulong; 52 #endif 53 #ifdef __MC68K__ 54 typedef unsigned short ushort; 55 typedef unsigned long ulong; 56 #endif 57 #ifdef WINCE 58 typedef unsigned short ushort; 59 typedef unsigned long ulong; 60 #endif 61 #endif 62 63 // Mode Commands 64 #define MODE_DATA 0xE1 65 #define MODE_COMMAND 0xE3 66 #define MODE_STOP_PULSE 0xF1 67 68 // Return byte value 69 #define RB_CHIPID_MASK 0x1C 70 #define RB_RESET_MASK 0x03 71 #define RB_1WIRESHORT 0x00 72 #define RB_PRESENCE 0x01 73 #define RB_ALARMPRESENCE 0x02 74 #define RB_NOPRESENCE 0x03 75 76 #define RB_BIT_MASK 0x03 77 #define RB_BIT_ONE 0x03 78 #define RB_BIT_ZERO 0x00 79 80 // Masks for all bit ranges 81 #define CMD_MASK 0x80 82 #define FUNCTSEL_MASK 0x60 83 #define BITPOL_MASK 0x10 84 #define SPEEDSEL_MASK 0x0C 85 #define MODSEL_MASK 0x02 86 #define PARMSEL_MASK 0x70 87 #define PARMSET_MASK 0x0E 88 89 // Command or config bit 90 #define CMD_COMM 0x81 91 #define CMD_CONFIG 0x01 92 93 // Function select bits 94 #define FUNCTSEL_BIT 0x00 95 #define FUNCTSEL_SEARCHON 0x30 96 #define FUNCTSEL_SEARCHOFF 0x20 97 #define FUNCTSEL_RESET 0x40 98 #define FUNCTSEL_CHMOD 0x60 99 100 // Bit polarity/Pulse voltage bits 101 #define BITPOL_ONE 0x10 102 #define BITPOL_ZERO 0x00 103 #define BITPOL_5V 0x00 104 #define BITPOL_12V 0x10 105 106 // One Wire speed bits 107 #define SPEEDSEL_STD 0x00 108 #define SPEEDSEL_FLEX 0x04 109 #define SPEEDSEL_OD 0x08 110 #define SPEEDSEL_PULSE 0x0C 111 112 // Data/Command mode select bits 113 #define MODSEL_DATA 0x00 114 #define MODSEL_COMMAND 0x02 115 116 // 5V Follow Pulse select bits (If 5V pulse 117 // will be following the next byte or bit.) 118 #define PRIME5V_TRUE 0x02 119 #define PRIME5V_FALSE 0x00 120 121 // Parameter select bits 122 #define PARMSEL_PARMREAD 0x00 123 #define PARMSEL_SLEW 0x10 124 #define PARMSEL_12VPULSE 0x20 125 #define PARMSEL_5VPULSE 0x30 126 #define PARMSEL_WRITE1LOW 0x40 127 #define PARMSEL_SAMPLEOFFSET 0x50 128 #define PARMSEL_ACTIVEPULLUPTIME 0x60 129 #define PARMSEL_BAUDRATE 0x70 130 131 // Pull down slew rate. 132 #define PARMSET_Slew15Vus 0x00 133 #define PARMSET_Slew2p2Vus 0x02 134 #define PARMSET_Slew1p65Vus 0x04 135 #define PARMSET_Slew1p37Vus 0x06 136 #define PARMSET_Slew1p1Vus 0x08 137 #define PARMSET_Slew0p83Vus 0x0A 138 #define PARMSET_Slew0p7Vus 0x0C 139 #define PARMSET_Slew0p55Vus 0x0E 140 141 // 12V programming pulse time table 142 #define PARMSET_32us 0x00 143 #define PARMSET_64us 0x02 144 #define PARMSET_128us 0x04 145 #define PARMSET_256us 0x06 146 #define PARMSET_512us 0x08 147 #define PARMSET_1024us 0x0A 148 #define PARMSET_2048us 0x0C 149 #define PARMSET_infinite 0x0E 150 151 // 5V strong pull up pulse time table 152 #define PARMSET_16p4ms 0x00 153 #define PARMSET_65p5ms 0x02 154 #define PARMSET_131ms 0x04 155 #define PARMSET_262ms 0x06 156 #define PARMSET_524ms 0x08 157 #define PARMSET_1p05s 0x0A 158 #define PARMSET_2p10s 0x0C 159 #define PARMSET_infinite 0x0E 160 161 // Write 1 low time 162 #define PARMSET_Write8us 0x00 163 #define PARMSET_Write9us 0x02 164 #define PARMSET_Write10us 0x04 165 #define PARMSET_Write11us 0x06 166 #define PARMSET_Write12us 0x08 167 #define PARMSET_Write13us 0x0A 168 #define PARMSET_Write14us 0x0C 169 #define PARMSET_Write15us 0x0E 170 171 // Data sample offset and Write 0 recovery time 172 #define PARMSET_SampOff3us 0x00 173 #define PARMSET_SampOff4us 0x02 174 #define PARMSET_SampOff5us 0x04 175 #define PARMSET_SampOff6us 0x06 176 #define PARMSET_SampOff7us 0x08 177 #define PARMSET_SampOff8us 0x0A 178 #define PARMSET_SampOff9us 0x0C 179 #define PARMSET_SampOff10us 0x0E 180 181 // Active pull up on time 182 #define PARMSET_PullUp0p0us 0x00 183 #define PARMSET_PullUp0p5us 0x02 184 #define PARMSET_PullUp1p0us 0x04 185 #define PARMSET_PullUp1p5us 0x06 186 #define PARMSET_PullUp2p0us 0x08 187 #define PARMSET_PullUp2p5us 0x0A 188 #define PARMSET_PullUp3p0us 0x0C 189 #define PARMSET_PullUp3p5us 0x0E 190 191 // Baud rate bits 192 #define PARMSET_9600 0x00 193 #define PARMSET_19200 0x02 194 #define PARMSET_57600 0x04 195 #define PARMSET_115200 0x06 196 197 // DS2480B program voltage available 198 #define DS2480PROG_MASK 0x20 199 200 // mode bit flags 201 #define MODE_NORMAL 0x00 202 #define MODE_OVERDRIVE 0x01 203 #define MODE_STRONG5 0x02 204 #define MODE_PROGRAM 0x04 205 #define MODE_BREAK 0x08 206 207