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