Steven Vlach / 1-WireLib
Committer:
svlach
Date:
Wed Dec 08 21:23:21 2010 +0000
Revision:
1:dcf2f8359398
Parent:
0:70c3bea805ee

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
svlach 0:70c3bea805ee 1 /*
svlach 0:70c3bea805ee 2 * ownet.h
svlach 0:70c3bea805ee 3 *
svlach 0:70c3bea805ee 4 * Created on: Feb 6, 2009
svlach 0:70c3bea805ee 5 * Author: scv
svlach 0:70c3bea805ee 6 */
svlach 0:70c3bea805ee 7 //---------------------------------------------------------------------------
svlach 0:70c3bea805ee 8 // Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved.
svlach 0:70c3bea805ee 9 //
svlach 0:70c3bea805ee 10 // Permission is hereby granted, free of charge, to any person obtaining a
svlach 0:70c3bea805ee 11 // copy of this software and associated documentation files (the "Software"),
svlach 0:70c3bea805ee 12 // to deal in the Software without restriction, including without limitation
svlach 0:70c3bea805ee 13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
svlach 0:70c3bea805ee 14 // and/or sell copies of the Software, and to permit persons to whom the
svlach 0:70c3bea805ee 15 // Software is furnished to do so, subject to the following conditions:
svlach 0:70c3bea805ee 16 //
svlach 0:70c3bea805ee 17 // The above copyright notice and this permission notice shall be included
svlach 0:70c3bea805ee 18 // in all copies or substantial portions of the Software.
svlach 0:70c3bea805ee 19 //
svlach 0:70c3bea805ee 20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
svlach 0:70c3bea805ee 21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
svlach 0:70c3bea805ee 22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
svlach 0:70c3bea805ee 23 // IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES
svlach 0:70c3bea805ee 24 // OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
svlach 0:70c3bea805ee 25 // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
svlach 0:70c3bea805ee 26 // OTHER DEALINGS IN THE SOFTWARE.
svlach 0:70c3bea805ee 27 //
svlach 0:70c3bea805ee 28 // Except as contained in this notice, the name of Dallas Semiconductor
svlach 0:70c3bea805ee 29 // shall not be used except as stated in the Dallas Semiconductor
svlach 0:70c3bea805ee 30 // Branding Policy.
svlach 0:70c3bea805ee 31 //---------------------------------------------------------------------------
svlach 0:70c3bea805ee 32 //
svlach 0:70c3bea805ee 33 // ownet.h - Include file for 1-Wire Net library
svlach 0:70c3bea805ee 34 //
svlach 0:70c3bea805ee 35 // Version: 2.10
svlach 0:70c3bea805ee 36 //
svlach 0:70c3bea805ee 37 // History: 1.02 -> 1.03 Make sure uchar is not defined twice.
svlach 0:70c3bea805ee 38 // 1.03 -> 2.00 Changed 'MLan' to 'ow'.
svlach 0:70c3bea805ee 39 // 2.00 -> 2.01 Added error handling. Added circular-include check.
svlach 0:70c3bea805ee 40 // 2.01 -> 2.10 Added raw memory error handling and SMALLINT
svlach 0:70c3bea805ee 41 // 2.10 -> 3.00 Added memory bank functionality
svlach 0:70c3bea805ee 42 // Added file I/O operations
svlach 0:70c3bea805ee 43 //
svlach 0:70c3bea805ee 44
svlach 0:70c3bea805ee 45 #ifndef OWNET_H
svlach 0:70c3bea805ee 46 #define OWNET_H
svlach 0:70c3bea805ee 47
svlach 1:dcf2f8359398 48
svlach 0:70c3bea805ee 49 //--------------------------------------------------------------//
svlach 0:70c3bea805ee 50 // Common Includes to ownet applications
svlach 0:70c3bea805ee 51 //--------------------------------------------------------------//
svlach 0:70c3bea805ee 52 #include <stdlib.h>
svlach 0:70c3bea805ee 53
svlach 0:70c3bea805ee 54 //--------------------------------------------------------------//
svlach 0:70c3bea805ee 55 // Typedefs
svlach 0:70c3bea805ee 56 //--------------------------------------------------------------//
svlach 0:70c3bea805ee 57 #ifndef SMALLINT
svlach 0:70c3bea805ee 58 //
svlach 0:70c3bea805ee 59 // purpose of smallint is for compile-time changing of formal
svlach 0:70c3bea805ee 60 // parameters and return values of functions. For each target
svlach 0:70c3bea805ee 61 // machine, an integer is alleged to represent the most "simple"
svlach 0:70c3bea805ee 62 // number representable by that architecture. This should, in
svlach 0:70c3bea805ee 63 // most cases, produce optimal code for that particular arch.
svlach 0:70c3bea805ee 64 // BUT... The majority of compilers designed for embedded
svlach 0:70c3bea805ee 65 // processors actually keep an int at 16 bits, although the
svlach 0:70c3bea805ee 66 // architecture might only be comfortable with 8 bits.
svlach 0:70c3bea805ee 67 // The default size of smallint will be the same as that of
svlach 0:70c3bea805ee 68 // an integer, but this allows for easy overriding of that size.
svlach 0:70c3bea805ee 69 //
svlach 0:70c3bea805ee 70 // NOTE:
svlach 0:70c3bea805ee 71 // In all cases where a smallint is used, it is assumed that
svlach 0:70c3bea805ee 72 // decreasing the size of this integer to something as low as
svlach 0:70c3bea805ee 73 // a single byte _will_not_ change the functionality of the
svlach 0:70c3bea805ee 74 // application. e.g. a loop counter that will iterate through
svlach 0:70c3bea805ee 75 // several kilobytes of data should not be SMALLINT. The most
svlach 0:70c3bea805ee 76 // common place you'll see smallint is for boolean return types.
svlach 0:70c3bea805ee 77 //
svlach 0:70c3bea805ee 78 #define SMALLINT int
svlach 0:70c3bea805ee 79 #endif
svlach 0:70c3bea805ee 80
svlach 0:70c3bea805ee 81 #define MAX_BAUD 0x06
svlach 0:70c3bea805ee 82
svlach 0:70c3bea805ee 83
svlach 0:70c3bea805ee 84 #ifndef OW_UCHAR
svlach 0:70c3bea805ee 85 #define OW_UCHAR
svlach 0:70c3bea805ee 86 typedef unsigned char uchar;
svlach 0:70c3bea805ee 87 #if !defined(__MINGW32__) && (defined(__CYGWIN__) || defined(__GNUC__))
svlach 0:70c3bea805ee 88 typedef unsigned long ulong;
svlach 0:70c3bea805ee 89 //ushort already defined in sys/types.h
svlach 0:70c3bea805ee 90 // Commented out 11/23/2010 sv #include <sys/types.h>
svlach 0:70c3bea805ee 91 #else
svlach 0:70c3bea805ee 92 #if defined(_WIN32) || defined(WIN32) || defined(__MC68K__) || defined(_WIN32_WCE) || defined(_DOS) || defined(_WINDOWS) || defined(__MINGW32__)
svlach 0:70c3bea805ee 93 typedef unsigned short ushort;
svlach 0:70c3bea805ee 94 typedef unsigned long ulong;
svlach 0:70c3bea805ee 95 #endif
svlach 0:70c3bea805ee 96 #endif
svlach 0:70c3bea805ee 97
svlach 0:70c3bea805ee 98 #endif
svlach 0:70c3bea805ee 99
svlach 0:70c3bea805ee 100 // general defines
svlach 0:70c3bea805ee 101 #define WRITE_FUNCTION 1
svlach 0:70c3bea805ee 102 #define READ_FUNCTION 0
svlach 0:70c3bea805ee 103
svlach 0:70c3bea805ee 104 // error codes
svlach 0:70c3bea805ee 105 #define READ_ERROR -1
svlach 0:70c3bea805ee 106 #define INVALID_DIR -2
svlach 0:70c3bea805ee 107 #define NO_FILE -3
svlach 0:70c3bea805ee 108 #define WRITE_ERROR -4
svlach 0:70c3bea805ee 109 #define WRONG_TYPE -5
svlach 0:70c3bea805ee 110 #define FILE_TOO_BIG -6
svlach 0:70c3bea805ee 111
svlach 0:70c3bea805ee 112 // Misc
svlach 0:70c3bea805ee 113 #ifndef FALSE
svlach 0:70c3bea805ee 114 #define FALSE 0
svlach 0:70c3bea805ee 115 #endif
svlach 0:70c3bea805ee 116
svlach 0:70c3bea805ee 117 #ifndef TRUE
svlach 0:70c3bea805ee 118 #define TRUE 1
svlach 0:70c3bea805ee 119 #endif
svlach 0:70c3bea805ee 120
svlach 0:70c3bea805ee 121 #ifndef MAX_PORTNUM
svlach 0:70c3bea805ee 122 #define MAX_PORTNUM 16
svlach 0:70c3bea805ee 123 #endif
svlach 0:70c3bea805ee 124
svlach 0:70c3bea805ee 125 // mode bit flags
svlach 0:70c3bea805ee 126 #define MODE_NORMAL 0x00
svlach 0:70c3bea805ee 127 #define MODE_OVERDRIVE 0x01
svlach 0:70c3bea805ee 128 #define MODE_STRONG5 0x02
svlach 0:70c3bea805ee 129 #define MODE_PROGRAM 0x04
svlach 0:70c3bea805ee 130 #define MODE_BREAK 0x08
svlach 0:70c3bea805ee 131
svlach 0:70c3bea805ee 132 // Output flags
svlach 0:70c3bea805ee 133 #define LV_ALWAYS 2
svlach 0:70c3bea805ee 134 #define LV_OPTIONAL 1
svlach 0:70c3bea805ee 135 #define LV_VERBOSE 0
svlach 0:70c3bea805ee 136
svlach 0:70c3bea805ee 137 //--------------------------------------------------------------//
svlach 0:70c3bea805ee 138 // Error handling
svlach 0:70c3bea805ee 139 //--------------------------------------------------------------//
svlach 0:70c3bea805ee 140 extern int owGetErrorNum(void);
svlach 0:70c3bea805ee 141 extern int owHasErrors(void);
svlach 0:70c3bea805ee 142
svlach 0:70c3bea805ee 143
svlach 0:70c3bea805ee 144 //Clears the stack.
svlach 0:70c3bea805ee 145 #define OWERROR_CLEAR() while(owHasErrors()) owGetErrorNum();
svlach 0:70c3bea805ee 146
svlach 0:70c3bea805ee 147 #ifdef DEBUG
svlach 0:70c3bea805ee 148 //Raises an exception with extra debug info
svlach 0:70c3bea805ee 149 #define OWERROR(err) owRaiseError(err,__LINE__,__FILE__)
svlach 0:70c3bea805ee 150 extern void owRaiseError(int,int,char*);
svlach 0:70c3bea805ee 151 #define OWASSERT(s,err,ret) if(!(s)){owRaiseError((err),__LINE__,__FILE__);return (ret);}
svlach 0:70c3bea805ee 152 #else
svlach 0:70c3bea805ee 153 //Raises an exception with just the error code
svlach 0:70c3bea805ee 154 #define OWERROR(err) printf( "Debug Error: %u\r\n", err );
svlach 0:70c3bea805ee 155 extern void owRaiseError(int);
svlach 0:70c3bea805ee 156 #define OWASSERT(s,err,ret) if(!(s)){owRaiseError((err));return (ret);}
svlach 0:70c3bea805ee 157 #endif
svlach 0:70c3bea805ee 158
svlach 0:70c3bea805ee 159 #ifdef SMALL_MEMORY_TARGET
svlach 0:70c3bea805ee 160 #define OWERROR_DUMP(fileno) /*no-op*/;
svlach 0:70c3bea805ee 161 #else
svlach 0:70c3bea805ee 162 //Prints the stack out to the given file.
svlach 0:70c3bea805ee 163 #define OWERROR_DUMP(fileno) iprintf("Debug Error: %u", fileno);
svlach 0:70c3bea805ee 164 // #define OWERROR_DUMP(fileno) while(owHasErrors()) owPrintErrorMsg(fileno);
svlach 0:70c3bea805ee 165 // extern void owPrintErrorMsg(FILE *);
svlach 0:70c3bea805ee 166 extern void owPrintErrorMsgStd();
svlach 0:70c3bea805ee 167 extern char *owGetErrorMsg(int);
svlach 0:70c3bea805ee 168 #endif
svlach 0:70c3bea805ee 169
svlach 0:70c3bea805ee 170 #define OWERROR_NO_ERROR_SET 0
svlach 0:70c3bea805ee 171 #define OWERROR_NO_DEVICES_ON_NET 1
svlach 0:70c3bea805ee 172 #define OWERROR_RESET_FAILED 2
svlach 0:70c3bea805ee 173 #define OWERROR_SEARCH_ERROR 3
svlach 0:70c3bea805ee 174 #define OWERROR_ACCESS_FAILED 4
svlach 0:70c3bea805ee 175 #define OWERROR_DS2480_NOT_DETECTED 5
svlach 0:70c3bea805ee 176 #define OWERROR_DS2480_WRONG_BAUD 6
svlach 0:70c3bea805ee 177 #define OWERROR_DS2480_BAD_RESPONSE 7
svlach 0:70c3bea805ee 178 #define OWERROR_OPENCOM_FAILED 8
svlach 0:70c3bea805ee 179 #define OWERROR_WRITECOM_FAILED 9
svlach 0:70c3bea805ee 180 #define OWERROR_READCOM_FAILED 10
svlach 0:70c3bea805ee 181 #define OWERROR_BLOCK_TOO_BIG 11
svlach 0:70c3bea805ee 182 #define OWERROR_BLOCK_FAILED 12
svlach 0:70c3bea805ee 183 #define OWERROR_PROGRAM_PULSE_FAILED 13
svlach 0:70c3bea805ee 184 #define OWERROR_PROGRAM_BYTE_FAILED 14
svlach 0:70c3bea805ee 185 #define OWERROR_WRITE_BYTE_FAILED 15
svlach 0:70c3bea805ee 186 #define OWERROR_READ_BYTE_FAILED 16
svlach 0:70c3bea805ee 187 #define OWERROR_WRITE_VERIFY_FAILED 17
svlach 0:70c3bea805ee 188 #define OWERROR_READ_VERIFY_FAILED 18
svlach 0:70c3bea805ee 189 #define OWERROR_WRITE_SCRATCHPAD_FAILED 19
svlach 0:70c3bea805ee 190 #define OWERROR_COPY_SCRATCHPAD_FAILED 20
svlach 0:70c3bea805ee 191 #define OWERROR_INCORRECT_CRC_LENGTH 21
svlach 0:70c3bea805ee 192 #define OWERROR_CRC_FAILED 22
svlach 0:70c3bea805ee 193 #define OWERROR_GET_SYSTEM_RESOURCE_FAILED 23
svlach 0:70c3bea805ee 194 #define OWERROR_SYSTEM_RESOURCE_INIT_FAILED 24
svlach 0:70c3bea805ee 195 #define OWERROR_DATA_TOO_LONG 25
svlach 0:70c3bea805ee 196 #define OWERROR_READ_OUT_OF_RANGE 26
svlach 0:70c3bea805ee 197 #define OWERROR_WRITE_OUT_OF_RANGE 27
svlach 0:70c3bea805ee 198 #define OWERROR_DEVICE_SELECT_FAIL 28
svlach 0:70c3bea805ee 199 #define OWERROR_READ_SCRATCHPAD_VERIFY 29
svlach 0:70c3bea805ee 200 #define OWERROR_COPY_SCRATCHPAD_NOT_FOUND 30
svlach 0:70c3bea805ee 201 #define OWERROR_ERASE_SCRATCHPAD_NOT_FOUND 31
svlach 0:70c3bea805ee 202 #define OWERROR_ADDRESS_READ_BACK_FAILED 32
svlach 0:70c3bea805ee 203 #define OWERROR_EXTRA_INFO_NOT_SUPPORTED 33
svlach 0:70c3bea805ee 204 #define OWERROR_PG_PACKET_WITHOUT_EXTRA 34
svlach 0:70c3bea805ee 205 #define OWERROR_PACKET_LENGTH_EXCEEDS_PAGE 35
svlach 0:70c3bea805ee 206 #define OWERROR_INVALID_PACKET_LENGTH 36
svlach 0:70c3bea805ee 207 #define OWERROR_NO_PROGRAM_PULSE 37
svlach 0:70c3bea805ee 208 #define OWERROR_READ_ONLY 38
svlach 0:70c3bea805ee 209 #define OWERROR_NOT_GENERAL_PURPOSE 39
svlach 0:70c3bea805ee 210 #define OWERROR_READ_BACK_INCORRECT 40
svlach 0:70c3bea805ee 211 #define OWERROR_INVALID_PAGE_NUMBER 41
svlach 0:70c3bea805ee 212 #define OWERROR_CRC_NOT_SUPPORTED 42
svlach 0:70c3bea805ee 213 #define OWERROR_CRC_EXTRA_INFO_NOT_SUPPORTED 43
svlach 0:70c3bea805ee 214 #define OWERROR_READ_BACK_NOT_VALID 44
svlach 0:70c3bea805ee 215 #define OWERROR_COULD_NOT_LOCK_REDIRECT 45
svlach 0:70c3bea805ee 216 #define OWERROR_READ_STATUS_NOT_COMPLETE 46
svlach 0:70c3bea805ee 217 #define OWERROR_PAGE_REDIRECTION_NOT_SUPPORTED 47
svlach 0:70c3bea805ee 218 #define OWERROR_LOCK_REDIRECTION_NOT_SUPPORTED 48
svlach 0:70c3bea805ee 219 #define OWERROR_READBACK_EPROM_FAILED 49
svlach 0:70c3bea805ee 220 #define OWERROR_PAGE_LOCKED 50
svlach 0:70c3bea805ee 221 #define OWERROR_LOCKING_REDIRECTED_PAGE_AGAIN 51
svlach 0:70c3bea805ee 222 #define OWERROR_REDIRECTED_PAGE 52
svlach 0:70c3bea805ee 223 #define OWERROR_PAGE_ALREADY_LOCKED 53
svlach 0:70c3bea805ee 224 #define OWERROR_WRITE_PROTECTED 54
svlach 0:70c3bea805ee 225 #define OWERROR_NONMATCHING_MAC 55
svlach 0:70c3bea805ee 226 #define OWERROR_WRITE_PROTECT 56
svlach 0:70c3bea805ee 227 #define OWERROR_WRITE_PROTECT_SECRET 57
svlach 0:70c3bea805ee 228 #define OWERROR_COMPUTE_NEXT_SECRET 58
svlach 0:70c3bea805ee 229 #define OWERROR_LOAD_FIRST_SECRET 59
svlach 0:70c3bea805ee 230 #define OWERROR_POWER_NOT_AVAILABLE 60
svlach 0:70c3bea805ee 231 #define OWERROR_XBAD_FILENAME 61
svlach 0:70c3bea805ee 232 #define OWERROR_XUNABLE_TO_CREATE_DIR 62
svlach 0:70c3bea805ee 233 #define OWERROR_REPEAT_FILE 63
svlach 0:70c3bea805ee 234 #define OWERROR_DIRECTORY_NOT_EMPTY 64
svlach 0:70c3bea805ee 235 #define OWERROR_WRONG_TYPE 65
svlach 0:70c3bea805ee 236 #define OWERROR_BUFFER_TOO_SMALL 66
svlach 0:70c3bea805ee 237 #define OWERROR_NOT_WRITE_ONCE 67
svlach 0:70c3bea805ee 238 #define OWERROR_FILE_NOT_FOUND 68
svlach 0:70c3bea805ee 239 #define OWERROR_OUT_OF_SPACE 69
svlach 0:70c3bea805ee 240 #define OWERROR_TOO_LARGE_BITNUM 70
svlach 0:70c3bea805ee 241 #define OWERROR_NO_PROGRAM_JOB 71
svlach 0:70c3bea805ee 242 #define OWERROR_FUNC_NOT_SUP 72
svlach 0:70c3bea805ee 243 #define OWERROR_HANDLE_NOT_USED 73
svlach 0:70c3bea805ee 244 #define OWERROR_FILE_WRITE_ONLY 74
svlach 0:70c3bea805ee 245 #define OWERROR_HANDLE_NOT_AVAIL 75
svlach 0:70c3bea805ee 246 #define OWERROR_INVALID_DIRECTORY 76
svlach 0:70c3bea805ee 247 #define OWERROR_HANDLE_NOT_EXIST 77
svlach 0:70c3bea805ee 248 #define OWERROR_NONMATCHING_SNUM 78
svlach 0:70c3bea805ee 249 #define OWERROR_NON_PROGRAM_PARTS 79
svlach 0:70c3bea805ee 250 #define OWERROR_PROGRAM_WRITE_PROTECT 80
svlach 0:70c3bea805ee 251 #define OWERROR_FILE_READ_ERR 81
svlach 0:70c3bea805ee 252 #define OWERROR_ADDFILE_TERMINATED 82
svlach 0:70c3bea805ee 253 #define OWERROR_READ_MEMORY_PAGE_FAILED 83
svlach 0:70c3bea805ee 254 #define OWERROR_MATCH_SCRATCHPAD_FAILED 84
svlach 0:70c3bea805ee 255 #define OWERROR_ERASE_SCRATCHPAD_FAILED 85
svlach 0:70c3bea805ee 256 #define OWERROR_READ_SCRATCHPAD_FAILED 86
svlach 0:70c3bea805ee 257 #define OWERROR_SHA_FUNCTION_FAILED 87
svlach 0:70c3bea805ee 258 #define OWERROR_NO_COMPLETION_BYTE 88
svlach 0:70c3bea805ee 259 #define OWERROR_WRITE_DATA_PAGE_FAILED 89
svlach 0:70c3bea805ee 260 #define OWERROR_COPY_SECRET_FAILED 90
svlach 0:70c3bea805ee 261 #define OWERROR_BIND_SECRET_FAILED 91
svlach 0:70c3bea805ee 262 #define OWERROR_INSTALL_SECRET_FAILED 92
svlach 0:70c3bea805ee 263 #define OWERROR_VERIFY_SIG_FAILED 93
svlach 0:70c3bea805ee 264 #define OWERROR_SIGN_SERVICE_DATA_FAILED 94
svlach 0:70c3bea805ee 265 #define OWERROR_VERIFY_AUTH_RESPONSE_FAILED 95
svlach 0:70c3bea805ee 266 #define OWERROR_ANSWER_CHALLENGE_FAILED 96
svlach 0:70c3bea805ee 267 #define OWERROR_CREATE_CHALLENGE_FAILED 97
svlach 0:70c3bea805ee 268 #define OWERROR_BAD_SERVICE_DATA 98
svlach 0:70c3bea805ee 269 #define OWERROR_SERVICE_DATA_NOT_UPDATED 99
svlach 0:70c3bea805ee 270 #define OWERROR_CATASTROPHIC_SERVICE_FAILURE 100
svlach 0:70c3bea805ee 271 #define OWERROR_LOAD_FIRST_SECRET_FAILED 101
svlach 0:70c3bea805ee 272 #define OWERROR_MATCH_SERVICE_SIGNATURE_FAILED 102
svlach 0:70c3bea805ee 273 #define OWERROR_KEY_OUT_OF_RANGE 103
svlach 0:70c3bea805ee 274 #define OWERROR_BLOCK_ID_OUT_OF_RANGE 104
svlach 0:70c3bea805ee 275 #define OWERROR_PASSWORDS_ENABLED 105
svlach 0:70c3bea805ee 276 #define OWERROR_PASSWORD_INVALID 106
svlach 0:70c3bea805ee 277 #define OWERROR_NO_READ_ONLY_PASSWORD 107
svlach 0:70c3bea805ee 278 #define OWERROR_NO_READ_WRITE_PASSWORD 108
svlach 0:70c3bea805ee 279 #define OWERROR_OW_SHORTED 109
svlach 0:70c3bea805ee 280 #define OWERROR_ADAPTER_ERROR 110
svlach 0:70c3bea805ee 281 #define OWERROR_EOP_COPY_SCRATCHPAD_FAILED 111
svlach 0:70c3bea805ee 282 #define OWERROR_EOP_WRITE_SCRATCHPAD_FAILED 112
svlach 0:70c3bea805ee 283 #define OWERROR_HYGRO_STOP_MISSION_UNNECESSARY 113
svlach 0:70c3bea805ee 284 #define OWERROR_HYGRO_STOP_MISSION_ERROR 114
svlach 0:70c3bea805ee 285 #define OWERROR_PORTNUM_ERROR 115
svlach 0:70c3bea805ee 286 #define OWERROR_LEVEL_FAILED 116
svlach 0:70c3bea805ee 287 #define OWERROR_PASSWORD_NOT_SET 117
svlach 0:70c3bea805ee 288 #define OWERROR_LATCH_NOT_SET 118
svlach 0:70c3bea805ee 289 #define OWERROR_LIBUSB_OPEN_FAILED 119
svlach 0:70c3bea805ee 290 #define OWERROR_LIBUSB_DEVICE_ALREADY_OPENED 120
svlach 0:70c3bea805ee 291 #define OWERROR_LIBUSB_SET_CONFIGURATION_ERROR 121
svlach 0:70c3bea805ee 292 #define OWERROR_LIBUSB_CLAIM_INTERFACE_ERROR 122
svlach 0:70c3bea805ee 293 #define OWERROR_LIBUSB_SET_ALTINTERFACE_ERROR 123
svlach 0:70c3bea805ee 294 #define OWERROR_LIBUSB_NO_ADAPTER_FOUND 124
svlach 0:70c3bea805ee 295
svlach 0:70c3bea805ee 296 // One Wire functions defined in ownetu.c
svlach 0:70c3bea805ee 297 SMALLINT owFirst(int portnum, SMALLINT do_reset, SMALLINT alarm_only);
svlach 0:70c3bea805ee 298 SMALLINT owNext(int portnum, SMALLINT do_reset, SMALLINT alarm_only);
svlach 0:70c3bea805ee 299 void owSerialNum(int portnum, uchar *serialnum_buf, SMALLINT do_read);
svlach 0:70c3bea805ee 300 void owFamilySearchSetup(int portnum, SMALLINT search_family);
svlach 0:70c3bea805ee 301 void owSkipFamily(int portnum);
svlach 0:70c3bea805ee 302 SMALLINT owAccess(int portnum);
svlach 0:70c3bea805ee 303 SMALLINT owVerify(int portnum, SMALLINT alarm_only);
svlach 0:70c3bea805ee 304 SMALLINT owOverdriveAccess(int portnum);
svlach 0:70c3bea805ee 305
svlach 0:70c3bea805ee 306
svlach 0:70c3bea805ee 307 // external One Wire functions defined in owsesu.c
svlach 0:70c3bea805ee 308 SMALLINT owAcquire(int portnum, char *port_zstr);
svlach 0:70c3bea805ee 309 int owAcquireEx(char *port_zstr);
svlach 0:70c3bea805ee 310 void owRelease(int portnum);
svlach 0:70c3bea805ee 311
svlach 0:70c3bea805ee 312 // external One Wire functions defined in findtype.c
svlach 0:70c3bea805ee 313 // SMALLINT FindDevices(int,uchar FamilySN[][8],SMALLINT,int);
svlach 0:70c3bea805ee 314
svlach 0:70c3bea805ee 315 // external One Wire functions from link layer owllu.c
svlach 0:70c3bea805ee 316 SMALLINT owTouchReset(int portnum);
svlach 0:70c3bea805ee 317 SMALLINT owTouchBit(int portnum, SMALLINT sendbit);
svlach 0:70c3bea805ee 318 SMALLINT owTouchByte(int portnum, SMALLINT sendbyte);
svlach 0:70c3bea805ee 319 SMALLINT owWriteByte(int portnum, SMALLINT sendbyte);
svlach 0:70c3bea805ee 320 SMALLINT owReadByte(int portnum);
svlach 0:70c3bea805ee 321 SMALLINT owSpeed(int portnum, SMALLINT new_speed);
svlach 0:70c3bea805ee 322 SMALLINT owLevel(int portnum, SMALLINT new_level);
svlach 0:70c3bea805ee 323 SMALLINT owProgramPulse(int portnum);
svlach 0:70c3bea805ee 324 SMALLINT owWriteBytePower(int portnum, SMALLINT sendbyte);
svlach 0:70c3bea805ee 325 SMALLINT owReadBytePower(int portnum);
svlach 0:70c3bea805ee 326 SMALLINT owHasPowerDelivery(int portnum);
svlach 0:70c3bea805ee 327 SMALLINT owHasProgramPulse(int portnum);
svlach 0:70c3bea805ee 328 SMALLINT owHasOverDrive(int portnum);
svlach 0:70c3bea805ee 329 SMALLINT owReadBitPower(int portnum, SMALLINT applyPowerResponse);
svlach 0:70c3bea805ee 330 // external One Wire global from owllu.c
svlach 0:70c3bea805ee 331 extern SMALLINT FAMILY_CODE_04_ALARM_TOUCHRESET_COMPLIANCE;
svlach 0:70c3bea805ee 332
svlach 0:70c3bea805ee 333 // external One Wire functions from transaction layer in owtrnu.c
svlach 0:70c3bea805ee 334 SMALLINT owBlock(int portnum, SMALLINT do_reset, uchar *tran_buf, SMALLINT tran_len);
svlach 0:70c3bea805ee 335 SMALLINT owReadPacketStd(int portnum, SMALLINT do_access, int start_page, uchar *read_buf);
svlach 0:70c3bea805ee 336 SMALLINT owWritePacketStd(int portnum, int start_page, uchar *write_buf,
svlach 0:70c3bea805ee 337 SMALLINT write_len, SMALLINT is_eprom, SMALLINT crc_type);
svlach 0:70c3bea805ee 338 SMALLINT owProgramByte(int portnum, SMALLINT write_byte, int addr, SMALLINT write_cmd,
svlach 0:70c3bea805ee 339 SMALLINT crc_type, SMALLINT do_access);
svlach 0:70c3bea805ee 340
svlach 0:70c3bea805ee 341 // link functions
svlach 0:70c3bea805ee 342 void msDelay(int len);
svlach 0:70c3bea805ee 343 long msGettick(void);
svlach 0:70c3bea805ee 344
svlach 0:70c3bea805ee 345 // ioutil.c functions prototypes
svlach 0:70c3bea805ee 346 int EnterString(char *msg, char *buf, int min, int max);
svlach 0:70c3bea805ee 347 int EnterNum(char *msg, int numchars, long *value, long min, long max);
svlach 0:70c3bea805ee 348 int EnterHex(char *msg, int numchars, ulong *value);
svlach 0:70c3bea805ee 349 int ToHex(char ch);
svlach 0:70c3bea805ee 350 int getkeystroke(void);
svlach 0:70c3bea805ee 351 int key_abort(void);
svlach 0:70c3bea805ee 352 void ExitProg(char *msg, int exit_code);
svlach 0:70c3bea805ee 353 int getData(uchar *write_buff, int max_len, SMALLINT gethex);
svlach 0:70c3bea805ee 354 void PrintHex(uchar* buffer, int cnt);
svlach 0:70c3bea805ee 355 void PrintChars(uchar* buffer, int cnt);
svlach 0:70c3bea805ee 356 void PrintSerialNum(uchar* buffer);
svlach 0:70c3bea805ee 357
svlach 0:70c3bea805ee 358 // external functions defined in crcutil.c
svlach 0:70c3bea805ee 359 void setcrc16(int portnum, unsigned short reset);
svlach 0:70c3bea805ee 360 unsigned short docrc16(int portnum, unsigned short cdata);
svlach 0:70c3bea805ee 361 void setcrc8(int portnum, uchar reset);
svlach 0:70c3bea805ee 362 uchar docrc8(int portnum, uchar x);
svlach 0:70c3bea805ee 363
svlach 0:70c3bea805ee 364 #endif //OWNET_H