4 * Copyright (c) 2002-2005 Volkswagen Group Electronic Research
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, the following disclaimer and
12 * the referenced file 'COPYING'.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of Volkswagen nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * Alternatively, provided that this notice is retained in full, this
21 * software may be distributed under the terms of the GNU General
22 * Public License ("GPL") version 2 as distributed in the 'COPYING'
23 * file from the main directory of the linux kernel source.
25 * The provided data structures and external interfaces from this code
26 * are not restricted to be used by modules with a GPL compatible license.
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
41 * Send feedback to <llcf@volkswagen.de>
50 RCSID("$Id: can_ioctl.h,v 2.0 2006/04/13 10:37:19 ethuerm Exp $");
53 #include <linux/sockios.h>
56 /* max. 16 private ioctls */
58 #define SIOCSRATE (SIOCDEVPRIVATE+0)
59 #define SIOCGRATE (SIOCDEVPRIVATE+1)
61 #define SIOCSMODE (SIOCDEVPRIVATE+2)
62 #define SIOCGMODE (SIOCDEVPRIVATE+3)
64 #define SIOCSFILTER (SIOCDEVPRIVATE+4)
65 #define SIOCGFILTER (SIOCDEVPRIVATE+5)
67 #define SIOCSTRX (SIOCDEVPRIVATE+6)
68 #define SIOCGTRX (SIOCDEVPRIVATE+7)
70 #define SIOCGSTATUS (SIOCDEVPRIVATE+8)
71 #define SIOCGTRXSTATUS (SIOCDEVPRIVATE+9)
73 #define SIOCGSTATS (SIOCDEVPRIVATE+10)
75 /* parameters for ioctls */
77 /* baudrate for CAN-controller */
78 #define RATE_SPEED 0 /* parameter is in bits/second (speed 0: autoprobe) */
79 #define RATE_BTREG 1 /* parameter is controller specific bit-timing register */
81 /* operation modes for CAN-controller */
82 #define MODE_OFFLINE 0
85 #define MODE_TRX (MODE_TX | MODE_RX)
86 #define MODE_LISTEN 4 /* no acknowledge on CAN layer */
88 /* filter modes (may vary due to controller specific capabilities) */
89 #define FILTER_CAPAB 0 /* get filter type capabilities (32 Bit value) */
90 #define FILTER_MASK_VALUE 1 /* easy bit filter (see struct can_filter) */
91 #define FILTER_SFF_BITMASK 2 /* bitfield with 2048 bit SFF filter */
93 /* filters 3 - 31 currently undefined */
95 #define FILTER_MAX 31 /* max. filter type value */
97 /* operation modes for CAN-transceiver */
98 #define TRX_OPERATE 0 /* normal operation */
99 #define TRX_STANDBY 1 /* standby */
100 #define TRX_SLEEP 2 /* goto sleep */
102 /* operating status of CAN-controller */
104 #define STATUS_WARNING 1 /* see parameter for additional info */
105 #define STATUS_ERROR 2 /* see parameter for additional info */
106 #define STATUS_ERROR_PASSIVE 3
107 #define STATUS_BUS_OFF 4
109 /* additional info for STATUS_ERROR */
110 #define STATUS_ERR_BIT 0x00
111 #define STATUS_ERR_FORM 0x01
112 #define STATUS_ERR_STUFF 0x02
113 #define STATUS_ERR_CRC 0x04
114 #define STATUS_ERR_ACK 0x08
115 #define STATUS_ERR_OTHER 0x10
117 /* operating status of CAN-transceiver */
118 #define TRXSTATUS_OK 0x000
119 #define TRXSTATUS_SLEEP 0x001
120 #define TRXSTATUS_CANH_NO_WIRE 0x002
121 #define TRXSTATUS_CANH_SHORT_TO_BAT 0x004
122 #define TRXSTATUS_CANH_SHORT_TO_VCC 0x008
123 #define TRXSTATUS_CANH_SHORT_TO_GND 0x010
124 #define TRXSTATUS_CANL_NO_WIRE 0x020
125 #define TRXSTATUS_CANL_SHORT_TO_BAT 0x040
126 #define TRXSTATUS_CANL_SHORT_TO_VCC 0x080
127 #define TRXSTATUS_CANL_SHORT_TO_GND 0x100
128 #define TRXSTATUS_CANL_SHORT_TO_CANH 0x200
130 struct can_device_stats {
137 int arbitration_lost;
139 int bus_error_at_init;
143 #endif /* CAN_IOCTL_H */