00001
00029 #ifndef _CANSTAT_H_
00030 #define _CANSTAT_H_
00031
00032
00033
00034
00035
00049 typedef enum {
00054 canOK = 0,
00060 canERR_PARAM = -1,
00065 canERR_NOMSG = -2,
00074 canERR_NOTFOUND = -3,
00078 canERR_NOMEM = -4,
00084 canERR_NOCHANNELS = -5,
00085
00086 canERR_INTERRUPTED = -6,
00087
00091 canERR_TIMEOUT = -7,
00096 canERR_NOTINITIALIZED = -8,
00105 canERR_NOHANDLES = -9,
00111 canERR_INVHANDLE = -10,
00112 canERR_INIFILE = -11,
00113
00117 canERR_DRIVER = -12,
00122 canERR_TXBUFOFL = -13,
00123 canERR_RESERVED_1 = -14,
00124
00130 canERR_HARDWARE = -15,
00136 canERR_DYNALOAD = -16,
00142 canERR_DYNALIB = -17,
00148 canERR_DYNAINIT = -18,
00149 canERR_NOT_SUPPORTED = -19,
00150 canERR_RESERVED_5 = -20,
00151 canERR_RESERVED_6 = -21,
00152 canERR_RESERVED_2 = -22,
00153
00158 canERR_DRIVERLOAD = -23,
00163 canERR_DRIVERFAILED = -24,
00164 canERR_NOCONFIGMGR = -25,
00165 canERR_NOCARD = -26,
00166 canERR_RESERVED_7 = -27,
00167
00172 canERR_REGISTRY = -28,
00173 canERR_LICENSE = -29,
00174
00179 canERR_INTERNAL = -30,
00186 canERR_NO_ACCESS = -31,
00191 canERR_NOT_IMPLEMENTED = -32,
00196 canERR_DEVICE_FILE = -33,
00201 canERR_HOST_FILE = -34,
00206 canERR_DISK = -35,
00210 canERR_CRC = -36,
00214 canERR_CONFIG = -37,
00218 canERR_MEMO_FAIL = -38,
00229 canERR_SCRIPT_FAIL = -39,
00230
00234 canERR_SCRIPT_WRONG_VERSION = -40,
00235
00236
00237
00238 canERR__RESERVED = -41
00239 } canStatus;
00240
00241
00246 #define CANSTATUS_SUCCESS(X) ((X) == canOK)
00247 #define CANSTATUS_FAILURE(X) ((X) != canOK)
00248
00256 #define canEVENT_RX 32000 ///< when the queue of received CAN messages goes from empty to non-empty
00257 #define canEVENT_TX 32001 ///< when a CAN message has been transmitted
00258 #define canEVENT_ERROR 32002 ///< when a CAN bus error is reported by the CAN controller
00259 #define canEVENT_STATUS 32003 ///< when the CAN controller changes state
00260 #define canEVENT_ENVVAR 32004 ///< An envvar changed
00261 # define canEVENT_BUSONOFF 32005 ///< Bus on/off status changed
00262 # define canEVENT_REMOVED 32006 ///< Device removed
00263
00276 #define canNOTIFY_NONE 0 ///< Turn notifications off.
00277 #define canNOTIFY_RX 0x0001 ///< CAN message reception notification
00278 #define canNOTIFY_TX 0x0002 ///< CAN message transmission notification
00279 #define canNOTIFY_ERROR 0x0004 ///< CAN bus error notification
00280 #define canNOTIFY_STATUS 0x0008 ///< CAN chip status change
00281 #define canNOTIFY_ENVVAR 0x0010 ///< An environment variable was changed by a script
00282 # define canNOTIFY_BUSONOFF 0x0020 ///< Notify on bus on/off status changed
00283 # define canNOTIFY_REMOVED 0x0040 ///< Notify on device removed
00284
00303 #define canSTAT_ERROR_PASSIVE 0x00000001 ///< The circuit is error passive
00304 #define canSTAT_BUS_OFF 0x00000002 ///< The circuit is Off Bus
00305 #define canSTAT_ERROR_WARNING 0x00000004 ///< At least one error counter > 96
00306 #define canSTAT_ERROR_ACTIVE 0x00000008 ///< The circuit is error active.
00307 #define canSTAT_TX_PENDING 0x00000010 ///< There are messages pending transmission
00308 #define canSTAT_RX_PENDING 0x00000020 ///< There are messages in the receive buffer
00309 #define canSTAT_RESERVED_1 0x00000040
00310 #define canSTAT_TXERR 0x00000080 ///< There has been at least one TX error
00311 #define canSTAT_RXERR 0x00000100 ///< There has been at least one RX error of some sort
00312 #define canSTAT_HW_OVERRUN 0x00000200 ///< The has been at least one HW buffer overflow
00313 #define canSTAT_SW_OVERRUN 0x00000400 ///< The has been at least one SW buffer overflow
00314 #define canSTAT_OVERRUN (canSTAT_HW_OVERRUN | canSTAT_SW_OVERRUN) ///< For convenience.
00315
00333 #define canMSG_MASK 0x00ff ///< Used to mask the non-info bits
00334 #define canMSG_RTR 0x0001 ///< Message is a remote request
00335 #define canMSG_STD 0x0002 ///< Message has a standard ID
00336 #define canMSG_EXT 0x0004 ///< Message has an extended ID
00337 #define canMSG_WAKEUP 0x0008 ///< Message to be sent / was received in wakeup mode
00338
00357 #define canMSG_NERR 0x0010
00358 #define canMSG_ERROR_FRAME 0x0020 ///< Message is an error frame
00359 #define canMSG_TXACK 0x0040 ///< Message is a TX ACK (msg is really sent)
00360 #define canMSG_TXRQ 0x0080 ///< Message is a TX REQUEST (msg is transfered to the chip)
00361 #define canMSG_DELAY_MSG 0x0100 ///< Message is NOT sent on the bus. The transmission of messages are delayed. The dlc specifies the delay in milliseconds (1..1000).
00362
00372 #define canFDMSG_MASK 0xff0000
00373 #define canFDMSG_EDL 0x010000 ///< Obsolete, use \ref canFDMSG_FDF instead
00374 #define canFDMSG_FDF 0x010000 ///< Message is an FD message (CAN FD)
00375 #define canFDMSG_BRS 0x020000 ///< Message is sent/received with bit rate switch (CAN FD)
00376 #define canFDMSG_ESI 0x040000 ///< Sender of the message is in error passive mode (CAN FD)
00377
00391 #define canMSGERR_MASK 0xff00 ///< Used to mask the non-error bits
00392
00393 #define canMSGERR_HW_OVERRUN 0x0200 ///< HW buffer overrun
00394 #define canMSGERR_SW_OVERRUN 0x0400 ///< SW buffer overrun
00395 #define canMSGERR_STUFF 0x0800 ///< Stuff error
00396 #define canMSGERR_FORM 0x1000 ///< Form error
00397 #define canMSGERR_CRC 0x2000 ///< CRC error
00398 #define canMSGERR_BIT0 0x4000 ///< Sent dom, read rec
00399 #define canMSGERR_BIT1 0x8000 ///< Sent rec, read dom
00400
00401
00402 #define canMSGERR_OVERRUN 0x0600 ///< Any overrun condition.
00403 #define canMSGERR_BIT 0xC000 ///< Any bit error.
00404 #define canMSGERR_BUSERR 0xF800 ///< Any RX error
00405
00406
00407 #define canMSG_SINGLE_SHOT 0x1000000 ///< Message is Single Shot, try to send once, no retransmission (only tx)
00408 #define canMSG_TXNACK 0x2000000 ///< Message is a failed Single Shot, message was not sent (only rx)
00409 #define canMSG_ABL 0x4000000 ///< Only together with canMSG_TXNACK, Single shot message was not sent because arbitration was lost (only rx)
00410
00425 #define canTRANSCEIVER_LINEMODE_NA 0 ///< Not Affected/Not available.
00426 #define canTRANSCEIVER_LINEMODE_SWC_SLEEP 4 ///< SWC Sleep Mode.
00427 #define canTRANSCEIVER_LINEMODE_SWC_NORMAL 5 ///< SWC Normal Mode.
00428 #define canTRANSCEIVER_LINEMODE_SWC_FAST 6 ///< SWC High-Speed Mode.
00429 #define canTRANSCEIVER_LINEMODE_SWC_WAKEUP 7 ///< SWC Wakeup Mode.
00430 #define canTRANSCEIVER_LINEMODE_SLEEP 8 ///< Sleep mode for those supporting it.
00431 #define canTRANSCEIVER_LINEMODE_NORMAL 9 ///< Normal mode (the inverse of sleep mode) for those supporting it.
00432 #define canTRANSCEIVER_LINEMODE_STDBY 10 ///< Standby for those who support it
00433 #define canTRANSCEIVER_LINEMODE_TT_CAN_H 11 ///< Truck & Trailer: operating mode single wire using CAN high
00434 #define canTRANSCEIVER_LINEMODE_TT_CAN_L 12 ///< Truck & Trailer: operating mode single wire using CAN low
00435 #define canTRANSCEIVER_LINEMODE_OEM1 13 ///< Reserved for OEM apps
00436 #define canTRANSCEIVER_LINEMODE_OEM2 14 ///< Reserved for OEM apps
00437 #define canTRANSCEIVER_LINEMODE_OEM3 15 ///< Reserved for OEM apps
00438 #define canTRANSCEIVER_LINEMODE_OEM4 16 ///< Reserved for OEM apps
00439
00446 #define canTRANSCEIVER_RESNET_NA 0
00447 #define canTRANSCEIVER_RESNET_MASTER 1
00448 #define canTRANSCEIVER_RESNET_MASTER_STBY 2
00449 #define canTRANSCEIVER_RESNET_SLAVE 3
00450
00464
00465 #define canTRANSCEIVER_TYPE_UNKNOWN 0 ///< Unknown or undefined
00466 #define canTRANSCEIVER_TYPE_251 1 ///< 82c251
00467 #define canTRANSCEIVER_TYPE_252 2 ///< 82c252, TJA1053, TJA1054
00468 #define canTRANSCEIVER_TYPE_DNOPTO 3 ///< Optoisolated 82C251
00469 #define canTRANSCEIVER_TYPE_W210 4 ///<
00470 #define canTRANSCEIVER_TYPE_SWC_PROTO 5 ///< AU5790 prototype
00471 #define canTRANSCEIVER_TYPE_SWC 6 ///< AU5790
00472 #define canTRANSCEIVER_TYPE_EVA 7 ///<
00473 #define canTRANSCEIVER_TYPE_FIBER 8 ///< 82c251 with fibre extension
00474 #define canTRANSCEIVER_TYPE_K251 9 ///< K-line + 82c251
00475 #define canTRANSCEIVER_TYPE_K 10 ///< K-line, without CAN
00476 #define canTRANSCEIVER_TYPE_1054_OPTO 11 ///< TJA1054 with optical isolation
00477 #define canTRANSCEIVER_TYPE_SWC_OPTO 12 ///< AU5790 with optical isolation
00478 #define canTRANSCEIVER_TYPE_TT 13 ///< B10011S Truck-And-Trailer
00479 #define canTRANSCEIVER_TYPE_1050 14 ///< TJA1050
00480 #define canTRANSCEIVER_TYPE_1050_OPTO 15 ///< TJA1050 with optical isolation
00481 #define canTRANSCEIVER_TYPE_1041 16 ///< TJA1041
00482 #define canTRANSCEIVER_TYPE_1041_OPTO 17 ///< TJA1041 with optical isolation
00483 #define canTRANSCEIVER_TYPE_RS485 18 ///< RS485 (i.e. J1708)
00484 #define canTRANSCEIVER_TYPE_LIN 19 ///< LIN
00485 #define canTRANSCEIVER_TYPE_KONE 20 ///< KONE
00486 #define canTRANSCEIVER_TYPE_CANFD 22 ///< CAN-FD
00487 #define canTRANSCEIVER_TYPE_LINX_LIN 64
00488 #define canTRANSCEIVER_TYPE_LINX_J1708 66
00489 #define canTRANSCEIVER_TYPE_LINX_K 68
00490 #define canTRANSCEIVER_TYPE_LINX_SWC 70
00491 #define canTRANSCEIVER_TYPE_LINX_LS 72
00492
00494 #endif