]> rtime.felk.cvut.cz Git - socketcan-devel.git/blob - kernel/2.6/can/can_ioctl.h
fix version code.
[socketcan-devel.git] / kernel / 2.6 / can / can_ioctl.h
1 /*
2  * can_ioctl_h
3  *
4  * Copyright (c) 2002-2005 Volkswagen Group Electronic Research
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
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.
19  *
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.
24  *
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.
27  *
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
39  * DAMAGE.
40  *
41  * Send feedback to <llcf@volkswagen.de>
42  *
43  */
44
45 #ifndef CAN_IOCTL_H
46 #define CAN_IOCTL_H
47
48 #ifdef __KERNEL__
49 #include "version.h"
50 RCSID("$Id: can_ioctl.h,v 2.0 2006/04/13 10:37:19 ethuerm Exp $");
51 #endif
52
53 #include <linux/sockios.h>
54
55
56 /* max. 16 private ioctls */
57
58 #define SIOCSRATE      (SIOCDEVPRIVATE+0)
59 #define SIOCGRATE      (SIOCDEVPRIVATE+1)
60
61 #define SIOCSMODE      (SIOCDEVPRIVATE+2)
62 #define SIOCGMODE      (SIOCDEVPRIVATE+3)
63
64 #define SIOCSFILTER    (SIOCDEVPRIVATE+4)
65 #define SIOCGFILTER    (SIOCDEVPRIVATE+5)
66
67 #define SIOCSTRX       (SIOCDEVPRIVATE+6)
68 #define SIOCGTRX       (SIOCDEVPRIVATE+7)
69
70 #define SIOCGSTATUS    (SIOCDEVPRIVATE+8)
71 #define SIOCGTRXSTATUS (SIOCDEVPRIVATE+9)
72
73 #define SIOCGSTATS     (SIOCDEVPRIVATE+10)
74
75 /* parameters for ioctls */
76
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 */
80
81 /* operation modes for CAN-controller */
82 #define MODE_OFFLINE 0
83 #define MODE_RX      1
84 #define MODE_TX      2
85 #define MODE_TRX     (MODE_TX | MODE_RX)
86 #define MODE_LISTEN  4 /* no acknowledge on CAN layer */
87
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 */
92
93                               /* filters 3 - 31 currently undefined */
94
95 #define FILTER_MAX         31 /* max. filter type value */
96
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 */
101
102 /* operating status of CAN-controller */
103 #define STATUS_OK            0
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
108
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
116
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
129
130 struct can_device_stats {
131
132     int error_warning;
133     int data_overrun;
134     int wakeup;
135     int bus_error;
136     int error_passive;
137     int arbitration_lost;
138     int restarts;
139     int bus_error_at_init;
140
141 };
142
143 #endif /* CAN_IOCTL_H */