Oliver Hartkopp | 0d66548 | 2007-11-16 15:52:17 -0800 | [diff] [blame] | 1 | /* |
| 2 | * linux/can/error.h |
| 3 | * |
| 4 | * Definitions of the CAN error frame to be filtered and passed to the user. |
| 5 | * |
| 6 | * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> |
| 7 | * Copyright (c) 2002-2007 Volkswagen Group Electronic Research |
| 8 | * All rights reserved. |
| 9 | * |
| 10 | * Send feedback to <socketcan-users@lists.berlios.de> |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #ifndef CAN_ERROR_H |
| 15 | #define CAN_ERROR_H |
| 16 | |
| 17 | #define CAN_ERR_DLC 8 /* dlc for error frames */ |
| 18 | |
| 19 | /* error class (mask) in can_id */ |
| 20 | #define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */ |
| 21 | #define CAN_ERR_LOSTARB 0x00000002U /* lost arbitration / data[0] */ |
| 22 | #define CAN_ERR_CRTL 0x00000004U /* controller problems / data[1] */ |
| 23 | #define CAN_ERR_PROT 0x00000008U /* protocol violations / data[2..3] */ |
| 24 | #define CAN_ERR_TRX 0x00000010U /* transceiver status / data[4] */ |
| 25 | #define CAN_ERR_ACK 0x00000020U /* received no ACK on transmission */ |
| 26 | #define CAN_ERR_BUSOFF 0x00000040U /* bus off */ |
| 27 | #define CAN_ERR_BUSERROR 0x00000080U /* bus error (may flood!) */ |
| 28 | #define CAN_ERR_RESTARTED 0x00000100U /* controller restarted */ |
| 29 | |
| 30 | /* arbitration lost in bit ... / data[0] */ |
| 31 | #define CAN_ERR_LOSTARB_UNSPEC 0x00 /* unspecified */ |
| 32 | /* else bit number in bitstream */ |
| 33 | |
| 34 | /* error status of CAN-controller / data[1] */ |
| 35 | #define CAN_ERR_CRTL_UNSPEC 0x00 /* unspecified */ |
| 36 | #define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /* RX buffer overflow */ |
| 37 | #define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /* TX buffer overflow */ |
| 38 | #define CAN_ERR_CRTL_RX_WARNING 0x04 /* reached warning level for RX errors */ |
| 39 | #define CAN_ERR_CRTL_TX_WARNING 0x08 /* reached warning level for TX errors */ |
| 40 | #define CAN_ERR_CRTL_RX_PASSIVE 0x10 /* reached error passive status RX */ |
| 41 | #define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */ |
| 42 | /* (at least one error counter exceeds */ |
| 43 | /* the protocol-defined level of 127) */ |
| 44 | |
| 45 | /* error in CAN protocol (type) / data[2] */ |
| 46 | #define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */ |
| 47 | #define CAN_ERR_PROT_BIT 0x01 /* single bit error */ |
| 48 | #define CAN_ERR_PROT_FORM 0x02 /* frame format error */ |
| 49 | #define CAN_ERR_PROT_STUFF 0x04 /* bit stuffing error */ |
| 50 | #define CAN_ERR_PROT_BIT0 0x08 /* unable to send dominant bit */ |
| 51 | #define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */ |
| 52 | #define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */ |
| 53 | #define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */ |
| 54 | #define CAN_ERR_PROT_TX 0x80 /* error occured on transmission */ |
| 55 | |
| 56 | /* error in CAN protocol (location) / data[3] */ |
| 57 | #define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */ |
| 58 | #define CAN_ERR_PROT_LOC_SOF 0x03 /* start of frame */ |
| 59 | #define CAN_ERR_PROT_LOC_ID28_21 0x02 /* ID bits 28 - 21 (SFF: 10 - 3) */ |
| 60 | #define CAN_ERR_PROT_LOC_ID20_18 0x06 /* ID bits 20 - 18 (SFF: 2 - 0 )*/ |
| 61 | #define CAN_ERR_PROT_LOC_SRTR 0x04 /* substitute RTR (SFF: RTR) */ |
| 62 | #define CAN_ERR_PROT_LOC_IDE 0x05 /* identifier extension */ |
| 63 | #define CAN_ERR_PROT_LOC_ID17_13 0x07 /* ID bits 17-13 */ |
| 64 | #define CAN_ERR_PROT_LOC_ID12_05 0x0F /* ID bits 12-5 */ |
| 65 | #define CAN_ERR_PROT_LOC_ID04_00 0x0E /* ID bits 4-0 */ |
| 66 | #define CAN_ERR_PROT_LOC_RTR 0x0C /* RTR */ |
| 67 | #define CAN_ERR_PROT_LOC_RES1 0x0D /* reserved bit 1 */ |
| 68 | #define CAN_ERR_PROT_LOC_RES0 0x09 /* reserved bit 0 */ |
| 69 | #define CAN_ERR_PROT_LOC_DLC 0x0B /* data length code */ |
| 70 | #define CAN_ERR_PROT_LOC_DATA 0x0A /* data section */ |
| 71 | #define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /* CRC sequence */ |
| 72 | #define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /* CRC delimiter */ |
| 73 | #define CAN_ERR_PROT_LOC_ACK 0x19 /* ACK slot */ |
| 74 | #define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /* ACK delimiter */ |
| 75 | #define CAN_ERR_PROT_LOC_EOF 0x1A /* end of frame */ |
| 76 | #define CAN_ERR_PROT_LOC_INTERM 0x12 /* intermission */ |
| 77 | |
| 78 | /* error status of CAN-transceiver / data[4] */ |
| 79 | /* CANH CANL */ |
| 80 | #define CAN_ERR_TRX_UNSPEC 0x00 /* 0000 0000 */ |
| 81 | #define CAN_ERR_TRX_CANH_NO_WIRE 0x04 /* 0000 0100 */ |
| 82 | #define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05 /* 0000 0101 */ |
| 83 | #define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06 /* 0000 0110 */ |
| 84 | #define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07 /* 0000 0111 */ |
| 85 | #define CAN_ERR_TRX_CANL_NO_WIRE 0x40 /* 0100 0000 */ |
| 86 | #define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50 /* 0101 0000 */ |
| 87 | #define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60 /* 0110 0000 */ |
| 88 | #define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */ |
| 89 | #define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */ |
| 90 | |
| 91 | /* controller specific additional information / data[5..7] */ |
| 92 | |
| 93 | #endif /* CAN_ERROR_H */ |