Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[linux-2.6-block.git] / include / uapi / linux / can / error.h
CommitLineData
0d66548a
OH
1/*
2 * linux/can/error.h
3 *
d6e640f9 4 * Definitions of the CAN error messages to be filtered and passed to the user.
0d66548a
OH
5 *
6 * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
7 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
8 * All rights reserved.
9 *
2485602f
UKK
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of Volkswagen nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * Alternatively, provided that this notice is retained in full, this
23 * software may be distributed under the terms of the GNU General
24 * Public License ("GPL") version 2, in which case the provisions of the
25 * GPL apply INSTEAD OF those given above.
26 *
27 * The provided data structures and external interfaces from this code
28 * are not restricted to be used by modules with a GPL compatible license.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
41 * DAMAGE.
0d66548a
OH
42 */
43
42193e3e
OH
44#ifndef _UAPI_CAN_ERROR_H
45#define _UAPI_CAN_ERROR_H
0d66548a 46
d6e640f9 47#define CAN_ERR_DLC 8 /* dlc for error message frames */
0d66548a
OH
48
49/* error class (mask) in can_id */
50#define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */
51#define CAN_ERR_LOSTARB 0x00000002U /* lost arbitration / data[0] */
52#define CAN_ERR_CRTL 0x00000004U /* controller problems / data[1] */
53#define CAN_ERR_PROT 0x00000008U /* protocol violations / data[2..3] */
54#define CAN_ERR_TRX 0x00000010U /* transceiver status / data[4] */
55#define CAN_ERR_ACK 0x00000020U /* received no ACK on transmission */
56#define CAN_ERR_BUSOFF 0x00000040U /* bus off */
57#define CAN_ERR_BUSERROR 0x00000080U /* bus error (may flood!) */
58#define CAN_ERR_RESTARTED 0x00000100U /* controller restarted */
59
60/* arbitration lost in bit ... / data[0] */
61#define CAN_ERR_LOSTARB_UNSPEC 0x00 /* unspecified */
62 /* else bit number in bitstream */
63
64/* error status of CAN-controller / data[1] */
65#define CAN_ERR_CRTL_UNSPEC 0x00 /* unspecified */
66#define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /* RX buffer overflow */
67#define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /* TX buffer overflow */
68#define CAN_ERR_CRTL_RX_WARNING 0x04 /* reached warning level for RX errors */
69#define CAN_ERR_CRTL_TX_WARNING 0x08 /* reached warning level for TX errors */
70#define CAN_ERR_CRTL_RX_PASSIVE 0x10 /* reached error passive status RX */
71#define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */
72 /* (at least one error counter exceeds */
73 /* the protocol-defined level of 127) */
74
75/* error in CAN protocol (type) / data[2] */
76#define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */
77#define CAN_ERR_PROT_BIT 0x01 /* single bit error */
78#define CAN_ERR_PROT_FORM 0x02 /* frame format error */
79#define CAN_ERR_PROT_STUFF 0x04 /* bit stuffing error */
80#define CAN_ERR_PROT_BIT0 0x08 /* unable to send dominant bit */
81#define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */
82#define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */
83#define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */
25985edc 84#define CAN_ERR_PROT_TX 0x80 /* error occurred on transmission */
0d66548a
OH
85
86/* error in CAN protocol (location) / data[3] */
87#define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */
88#define CAN_ERR_PROT_LOC_SOF 0x03 /* start of frame */
89#define CAN_ERR_PROT_LOC_ID28_21 0x02 /* ID bits 28 - 21 (SFF: 10 - 3) */
90#define CAN_ERR_PROT_LOC_ID20_18 0x06 /* ID bits 20 - 18 (SFF: 2 - 0 )*/
91#define CAN_ERR_PROT_LOC_SRTR 0x04 /* substitute RTR (SFF: RTR) */
92#define CAN_ERR_PROT_LOC_IDE 0x05 /* identifier extension */
93#define CAN_ERR_PROT_LOC_ID17_13 0x07 /* ID bits 17-13 */
94#define CAN_ERR_PROT_LOC_ID12_05 0x0F /* ID bits 12-5 */
95#define CAN_ERR_PROT_LOC_ID04_00 0x0E /* ID bits 4-0 */
96#define CAN_ERR_PROT_LOC_RTR 0x0C /* RTR */
97#define CAN_ERR_PROT_LOC_RES1 0x0D /* reserved bit 1 */
98#define CAN_ERR_PROT_LOC_RES0 0x09 /* reserved bit 0 */
99#define CAN_ERR_PROT_LOC_DLC 0x0B /* data length code */
100#define CAN_ERR_PROT_LOC_DATA 0x0A /* data section */
101#define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /* CRC sequence */
102#define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /* CRC delimiter */
103#define CAN_ERR_PROT_LOC_ACK 0x19 /* ACK slot */
104#define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /* ACK delimiter */
105#define CAN_ERR_PROT_LOC_EOF 0x1A /* end of frame */
106#define CAN_ERR_PROT_LOC_INTERM 0x12 /* intermission */
107
108/* error status of CAN-transceiver / data[4] */
109/* CANH CANL */
110#define CAN_ERR_TRX_UNSPEC 0x00 /* 0000 0000 */
111#define CAN_ERR_TRX_CANH_NO_WIRE 0x04 /* 0000 0100 */
112#define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05 /* 0000 0101 */
113#define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06 /* 0000 0110 */
114#define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07 /* 0000 0111 */
115#define CAN_ERR_TRX_CANL_NO_WIRE 0x40 /* 0100 0000 */
116#define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50 /* 0101 0000 */
117#define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60 /* 0110 0000 */
118#define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */
119#define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */
120
121/* controller specific additional information / data[5..7] */
122
42193e3e 123#endif /* _UAPI_CAN_ERROR_H */