1 /* SPDX-License-Identifier: ((GPL-2.0-only WIT << 2 /* 1 /* 3 * linux/can/error.h 2 * linux/can/error.h 4 * 3 * 5 * Definitions of the CAN error messages to be 4 * Definitions of the CAN error messages to be filtered and passed to the user. 6 * 5 * 7 * Author: Oliver Hartkopp <oliver.hartkopp@vo 6 * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> 8 * Copyright (c) 2002-2007 Volkswagen Group El 7 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research 9 * All rights reserved. 8 * All rights reserved. 10 * 9 * 11 * Redistribution and use in source and binary << 12 * modification, are permitted provided that t << 13 * are met: << 14 * 1. Redistributions of source code must reta << 15 * notice, this list of conditions and the << 16 * 2. Redistributions in binary form must repr << 17 * notice, this list of conditions and the << 18 * documentation and/or other materials pro << 19 * 3. Neither the name of Volkswagen nor the n << 20 * may be used to endorse or promote produc << 21 * without specific prior written permissio << 22 * << 23 * Alternatively, provided that this notice is << 24 * software may be distributed under the terms << 25 * Public License ("GPL") version 2, in which << 26 * GPL apply INSTEAD OF those given above. << 27 * << 28 * The provided data structures and external i << 29 * are not restricted to be used by modules wi << 30 * << 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT << 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTI << 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCH << 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO << 35 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIR << 36 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGE << 37 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS << 38 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) << 39 * THEORY OF LIABILITY, WHETHER IN CONTRACT, S << 40 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING << 41 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE PO << 42 * DAMAGE. << 43 */ 10 */ 44 11 45 #ifndef _UAPI_CAN_ERROR_H !! 12 #ifndef CAN_ERROR_H 46 #define _UAPI_CAN_ERROR_H !! 13 #define CAN_ERROR_H 47 14 48 #define CAN_ERR_DLC 8 /* dlc for error message 15 #define CAN_ERR_DLC 8 /* dlc for error message frames */ 49 16 50 /* error class (mask) in can_id */ 17 /* error class (mask) in can_id */ 51 #define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX 18 #define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */ 52 #define CAN_ERR_LOSTARB 0x00000002U /* lo 19 #define CAN_ERR_LOSTARB 0x00000002U /* lost arbitration / data[0] */ 53 #define CAN_ERR_CRTL 0x00000004U /* co 20 #define CAN_ERR_CRTL 0x00000004U /* controller problems / data[1] */ 54 #define CAN_ERR_PROT 0x00000008U /* pr 21 #define CAN_ERR_PROT 0x00000008U /* protocol violations / data[2..3] */ 55 #define CAN_ERR_TRX 0x00000010U /* tr 22 #define CAN_ERR_TRX 0x00000010U /* transceiver status / data[4] */ 56 #define CAN_ERR_ACK 0x00000020U /* re 23 #define CAN_ERR_ACK 0x00000020U /* received no ACK on transmission */ 57 #define CAN_ERR_BUSOFF 0x00000040U /* bu 24 #define CAN_ERR_BUSOFF 0x00000040U /* bus off */ 58 #define CAN_ERR_BUSERROR 0x00000080U /* bu 25 #define CAN_ERR_BUSERROR 0x00000080U /* bus error (may flood!) */ 59 #define CAN_ERR_RESTARTED 0x00000100U /* co 26 #define CAN_ERR_RESTARTED 0x00000100U /* controller restarted */ 60 #define CAN_ERR_CNT 0x00000200U /* TX << 61 /* RX << 62 27 63 /* arbitration lost in bit ... / data[0] */ 28 /* arbitration lost in bit ... / data[0] */ 64 #define CAN_ERR_LOSTARB_UNSPEC 0x00 /* unspe 29 #define CAN_ERR_LOSTARB_UNSPEC 0x00 /* unspecified */ 65 /* else 30 /* else bit number in bitstream */ 66 31 67 /* error status of CAN-controller / data[1] */ 32 /* error status of CAN-controller / data[1] */ 68 #define CAN_ERR_CRTL_UNSPEC 0x00 /* unspe 33 #define CAN_ERR_CRTL_UNSPEC 0x00 /* unspecified */ 69 #define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /* RX bu 34 #define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /* RX buffer overflow */ 70 #define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /* TX bu 35 #define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /* TX buffer overflow */ 71 #define CAN_ERR_CRTL_RX_WARNING 0x04 /* reach 36 #define CAN_ERR_CRTL_RX_WARNING 0x04 /* reached warning level for RX errors */ 72 #define CAN_ERR_CRTL_TX_WARNING 0x08 /* reach 37 #define CAN_ERR_CRTL_TX_WARNING 0x08 /* reached warning level for TX errors */ 73 #define CAN_ERR_CRTL_RX_PASSIVE 0x10 /* reach 38 #define CAN_ERR_CRTL_RX_PASSIVE 0x10 /* reached error passive status RX */ 74 #define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reach 39 #define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */ 75 /* (at l 40 /* (at least one error counter exceeds */ 76 /* the p 41 /* the protocol-defined level of 127) */ 77 #define CAN_ERR_CRTL_ACTIVE 0x40 /* recov << 78 42 79 /* error in CAN protocol (type) / data[2] */ 43 /* error in CAN protocol (type) / data[2] */ 80 #define CAN_ERR_PROT_UNSPEC 0x00 /* unspe 44 #define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */ 81 #define CAN_ERR_PROT_BIT 0x01 /* singl 45 #define CAN_ERR_PROT_BIT 0x01 /* single bit error */ 82 #define CAN_ERR_PROT_FORM 0x02 /* frame 46 #define CAN_ERR_PROT_FORM 0x02 /* frame format error */ 83 #define CAN_ERR_PROT_STUFF 0x04 /* bit s 47 #define CAN_ERR_PROT_STUFF 0x04 /* bit stuffing error */ 84 #define CAN_ERR_PROT_BIT0 0x08 /* unabl 48 #define CAN_ERR_PROT_BIT0 0x08 /* unable to send dominant bit */ 85 #define CAN_ERR_PROT_BIT1 0x10 /* unabl 49 #define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */ 86 #define CAN_ERR_PROT_OVERLOAD 0x20 /* bus o 50 #define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */ 87 #define CAN_ERR_PROT_ACTIVE 0x40 /* activ 51 #define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */ 88 #define CAN_ERR_PROT_TX 0x80 /* error 52 #define CAN_ERR_PROT_TX 0x80 /* error occurred on transmission */ 89 53 90 /* error in CAN protocol (location) / data[3] 54 /* error in CAN protocol (location) / data[3] */ 91 #define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspe 55 #define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */ 92 #define CAN_ERR_PROT_LOC_SOF 0x03 /* start 56 #define CAN_ERR_PROT_LOC_SOF 0x03 /* start of frame */ 93 #define CAN_ERR_PROT_LOC_ID28_21 0x02 /* ID bi 57 #define CAN_ERR_PROT_LOC_ID28_21 0x02 /* ID bits 28 - 21 (SFF: 10 - 3) */ 94 #define CAN_ERR_PROT_LOC_ID20_18 0x06 /* ID bi 58 #define CAN_ERR_PROT_LOC_ID20_18 0x06 /* ID bits 20 - 18 (SFF: 2 - 0 )*/ 95 #define CAN_ERR_PROT_LOC_SRTR 0x04 /* subst 59 #define CAN_ERR_PROT_LOC_SRTR 0x04 /* substitute RTR (SFF: RTR) */ 96 #define CAN_ERR_PROT_LOC_IDE 0x05 /* ident 60 #define CAN_ERR_PROT_LOC_IDE 0x05 /* identifier extension */ 97 #define CAN_ERR_PROT_LOC_ID17_13 0x07 /* ID bi 61 #define CAN_ERR_PROT_LOC_ID17_13 0x07 /* ID bits 17-13 */ 98 #define CAN_ERR_PROT_LOC_ID12_05 0x0F /* ID bi 62 #define CAN_ERR_PROT_LOC_ID12_05 0x0F /* ID bits 12-5 */ 99 #define CAN_ERR_PROT_LOC_ID04_00 0x0E /* ID bi 63 #define CAN_ERR_PROT_LOC_ID04_00 0x0E /* ID bits 4-0 */ 100 #define CAN_ERR_PROT_LOC_RTR 0x0C /* RTR * 64 #define CAN_ERR_PROT_LOC_RTR 0x0C /* RTR */ 101 #define CAN_ERR_PROT_LOC_RES1 0x0D /* reser 65 #define CAN_ERR_PROT_LOC_RES1 0x0D /* reserved bit 1 */ 102 #define CAN_ERR_PROT_LOC_RES0 0x09 /* reser 66 #define CAN_ERR_PROT_LOC_RES0 0x09 /* reserved bit 0 */ 103 #define CAN_ERR_PROT_LOC_DLC 0x0B /* data 67 #define CAN_ERR_PROT_LOC_DLC 0x0B /* data length code */ 104 #define CAN_ERR_PROT_LOC_DATA 0x0A /* data 68 #define CAN_ERR_PROT_LOC_DATA 0x0A /* data section */ 105 #define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /* CRC s 69 #define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /* CRC sequence */ 106 #define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /* CRC d 70 #define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /* CRC delimiter */ 107 #define CAN_ERR_PROT_LOC_ACK 0x19 /* ACK s 71 #define CAN_ERR_PROT_LOC_ACK 0x19 /* ACK slot */ 108 #define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /* ACK d 72 #define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /* ACK delimiter */ 109 #define CAN_ERR_PROT_LOC_EOF 0x1A /* end o 73 #define CAN_ERR_PROT_LOC_EOF 0x1A /* end of frame */ 110 #define CAN_ERR_PROT_LOC_INTERM 0x12 /* inter 74 #define CAN_ERR_PROT_LOC_INTERM 0x12 /* intermission */ 111 75 112 /* error status of CAN-transceiver / data[4] * 76 /* error status of CAN-transceiver / data[4] */ 113 /* 77 /* CANH CANL */ 114 #define CAN_ERR_TRX_UNSPEC 0x00 /* 78 #define CAN_ERR_TRX_UNSPEC 0x00 /* 0000 0000 */ 115 #define CAN_ERR_TRX_CANH_NO_WIRE 0x04 /* 79 #define CAN_ERR_TRX_CANH_NO_WIRE 0x04 /* 0000 0100 */ 116 #define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05 /* 80 #define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05 /* 0000 0101 */ 117 #define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06 /* 81 #define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06 /* 0000 0110 */ 118 #define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07 /* 82 #define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07 /* 0000 0111 */ 119 #define CAN_ERR_TRX_CANL_NO_WIRE 0x40 /* 83 #define CAN_ERR_TRX_CANL_NO_WIRE 0x40 /* 0100 0000 */ 120 #define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50 /* 84 #define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50 /* 0101 0000 */ 121 #define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60 /* 85 #define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60 /* 0110 0000 */ 122 #define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 86 #define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */ 123 #define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 87 #define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */ 124 88 125 /* data[5] is reserved (do not use) */ !! 89 /* controller specific additional information / data[5..7] */ 126 << 127 /* TX error counter / data[6] */ << 128 /* RX error counter / data[7] */ << 129 << 130 /* CAN state thresholds << 131 * << 132 * Error counter Error state << 133 * ----------------------------------- << 134 * 0 - 95 Error-active << 135 * 96 - 127 Error-warning << 136 * 128 - 255 Error-passive << 137 * 256 and greater Bus-off << 138 */ << 139 #define CAN_ERROR_WARNING_THRESHOLD 96 << 140 #define CAN_ERROR_PASSIVE_THRESHOLD 128 << 141 #define CAN_BUS_OFF_THRESHOLD 256 << 142 90 143 #endif /* _UAPI_CAN_ERROR_H */ !! 91 #endif /* CAN_ERROR_H */ 144 92
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.