1 | /*
|
---|
2 | ** Copyright 2012 by Kvaser AB, Mölndal, Sweden
|
---|
3 | ** http://www.kvaser.com
|
---|
4 | **
|
---|
5 | ** This software is dual licensed under the following two licenses:
|
---|
6 | ** BSD-new and GPLv2. You may use either one. See the included
|
---|
7 | ** COPYING file for details.
|
---|
8 | **
|
---|
9 | ** License: BSD-new
|
---|
10 | ** ===============================================================================
|
---|
11 | ** Redistribution and use in source and binary forms, with or without
|
---|
12 | ** modification, are permitted provided that the following conditions are met:
|
---|
13 | ** * Redistributions of source code must retain the above copyright
|
---|
14 | ** notice, this list of conditions and the following disclaimer.
|
---|
15 | ** * 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 | ** * Neither the name of the <organization> nor the
|
---|
19 | ** names of its contributors may be used to endorse or promote products
|
---|
20 | ** derived from this software without specific prior written permission.
|
---|
21 | **
|
---|
22 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
---|
23 | ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
---|
24 | ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
25 | ** DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
---|
26 | ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
---|
27 | ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
---|
28 | ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
29 | ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
30 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
---|
31 | ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
32 | **
|
---|
33 | **
|
---|
34 | ** License: GPLv2
|
---|
35 | ** ===============================================================================
|
---|
36 | ** This program is free software; you can redistribute it and/or
|
---|
37 | ** modify it under the terms of the GNU General Public License
|
---|
38 | ** as published by the Free Software Foundation; either version 2
|
---|
39 | ** of the License, or (at your option) any later version.
|
---|
40 | **
|
---|
41 | ** This program is distributed in the hope that it will be useful,
|
---|
42 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
43 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
44 | ** GNU General Public License for more details.
|
---|
45 | **
|
---|
46 | ** You should have received a copy of the GNU General Public License
|
---|
47 | ** along with this program; if not, write to the Free Software
|
---|
48 | ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
---|
49 | **
|
---|
50 | ** ---------------------------------------------------------------------------
|
---|
51 | **/
|
---|
52 |
|
---|
53 | /*
|
---|
54 | ** Description:
|
---|
55 | ** Driver ioctl commands for Linux
|
---|
56 | **
|
---|
57 | */
|
---|
58 |
|
---|
59 | #ifndef _VCAN_IOCTL_H
|
---|
60 | #define _VCAN_IOCTL_H
|
---|
61 |
|
---|
62 | # include <asm/ioctl.h>
|
---|
63 |
|
---|
64 | # define VCAN_IOC_MAGIC 'v'
|
---|
65 |
|
---|
66 |
|
---|
67 |
|
---|
68 | // See /Documentation/ioctl-number.txt
|
---|
69 | #define VCAN_IOC_SENDMSG _IOW(VCAN_IOC_MAGIC, 101, int)
|
---|
70 | #define VCAN_IOC_RECVMSG _IOR(VCAN_IOC_MAGIC, 102, int)
|
---|
71 | #define VCAN_IOC_OPEN_CHAN _IO(VCAN_IOC_MAGIC,107)
|
---|
72 | #define VCAN_IOC_OPEN_TRANSP _IO(VCAN_IOC_MAGIC,106)
|
---|
73 | #define VCAN_IOC_OPEN_EXCL _IO(VCAN_IOC_MAGIC,105)
|
---|
74 | #define VCAN_IOC_GET_NRCHANNELS _IO(VCAN_IOC_MAGIC,104)
|
---|
75 | #define VCAN_IOC_WAIT_EMPTY _IO(VCAN_IOC_MAGIC,109)
|
---|
76 | #define VCAN_IOC_FLUSH_RCVBUFFER _IO(VCAN_IOC_MAGIC,112)
|
---|
77 | #define VCAN_IOC_GET_STAT _IO(VCAN_IOC_MAGIC,113)
|
---|
78 | #define VCAN_IOC_SET_WRITE_BLOCK _IO(VCAN_IOC_MAGIC,114)
|
---|
79 | #define VCAN_IOC_SET_READ_BLOCK _IO(VCAN_IOC_MAGIC,115)
|
---|
80 | #define VCAN_IOC_SET_WRITE_TIMEOUT _IO(VCAN_IOC_MAGIC,116)
|
---|
81 | #define VCAN_IOC_SET_READ_TIMEOUT _IO(VCAN_IOC_MAGIC,117)
|
---|
82 | #define VCAN_IOC_FLUSH_SENDBUFFER _IO(VCAN_IOC_MAGIC,118)
|
---|
83 | #define VCAN_IOC_BUS_ON _IO(VCAN_IOC_MAGIC,119)
|
---|
84 | #define VCAN_IOC_BUS_OFF _IO(VCAN_IOC_MAGIC,120)
|
---|
85 | #define VCAN_IOC_SET_BITRATE _IO(VCAN_IOC_MAGIC,121)
|
---|
86 | #define VCAN_IOC_GET_BITRATE _IO(VCAN_IOC_MAGIC,122)
|
---|
87 | #define VCAN_IOC_SET_OUTPUT_MODE _IO(VCAN_IOC_MAGIC,123)
|
---|
88 | #define VCAN_IOC_GET_OUTPUT_MODE _IO(VCAN_IOC_MAGIC,124)
|
---|
89 | #define VCAN_IOC_SET_MSG_FILTER _IO(VCAN_IOC_MAGIC,125)
|
---|
90 | #define VCAN_IOC_GET_MSG_FILTER _IO(VCAN_IOC_MAGIC,126)
|
---|
91 | #define VCAN_IOC_READ_TIMER _IO(VCAN_IOC_MAGIC,127)
|
---|
92 | #define VCAN_IOC_GET_TX_ERR _IO(VCAN_IOC_MAGIC,128)
|
---|
93 | #define VCAN_IOC_GET_RX_ERR _IO(VCAN_IOC_MAGIC,129)
|
---|
94 | #define VCAN_IOC_GET_OVER_ERR _IO(VCAN_IOC_MAGIC,130)
|
---|
95 | #define VCAN_IOC_GET_RX_QUEUE_LEVEL _IO(VCAN_IOC_MAGIC,131)
|
---|
96 | #define VCAN_IOC_GET_TX_QUEUE_LEVEL _IO(VCAN_IOC_MAGIC,132)
|
---|
97 | #define VCAN_IOC_GET_CHIP_STATE _IO(VCAN_IOC_MAGIC,133)
|
---|
98 | #define VCAN_IOC_GET_VERSION _IO(VCAN_IOC_MAGIC,134)
|
---|
99 | #define VCAN_IOC_GET_TXACK _IO(VCAN_IOC_MAGIC,135)
|
---|
100 | #define VCAN_IOC_SET_TXACK _IO(VCAN_IOC_MAGIC,136)
|
---|
101 |
|
---|
102 | #define VCAN_IOC_GET_SERIAL _IO(VCAN_IOC_MAGIC,138)
|
---|
103 | #define VCAN_IOC_GET_EAN _IO(VCAN_IOC_MAGIC,139)
|
---|
104 | #define VCAN_IOC_GET_CARD_NUMBER _IO(VCAN_IOC_MAGIC,140)
|
---|
105 | #define VCAN_IOC_GET_CHAN_NO_ON_CARD _IO(VCAN_IOC_MAGIC,141)
|
---|
106 | #define VCAN_IOC_GET_FIRMWARE_REV _IO(VCAN_IOC_MAGIC,142)
|
---|
107 | #define VCAN_IOC_SET_TIMER_SCALE _IO(VCAN_IOC_MAGIC,143)
|
---|
108 | #define VCAN_IOC_GET_TIMER_SCALE _IO(VCAN_IOC_MAGIC,144)
|
---|
109 | #define VCAN_IOC_GET_EVENTHANDLE _IO(VCAN_IOC_MAGIC,145)
|
---|
110 | #define VCAN_IOC_GET_CHAN_CAP _IO(VCAN_IOC_MAGIC,146)
|
---|
111 | #define VCAN_IOC_GET_TRANS_CAP _IO(VCAN_IOC_MAGIC,147)
|
---|
112 | #define VCAN_IOC_GET_CHAN_FLAGS _IO(VCAN_IOC_MAGIC,148)
|
---|
113 | #define VCAN_IOC_GET_CARD_TYPE _IO(VCAN_IOC_MAGIC,149)
|
---|
114 |
|
---|
115 | #define VCAN_IOC_SET_TXRQ _IO(VCAN_IOC_MAGIC,150)
|
---|
116 |
|
---|
117 | #define VCAN_IOC_GET_HARDWARE_REV _IO(VCAN_IOC_MAGIC,151)
|
---|
118 |
|
---|
119 | #define VCAN_IOC_SET_TXECHO _IO(VCAN_IOC_MAGIC,152)
|
---|
120 |
|
---|
121 | #define VCAN_IOC_SSP_AUTO _IO(VCAN_IOC_MAGIC,154)
|
---|
122 | #define VCAN_IOC_SSP_GET _IO(VCAN_IOC_MAGIC,155)
|
---|
123 | #define VCAN_IOC_SSP_SET _IO(VCAN_IOC_MAGIC,156)
|
---|
124 |
|
---|
125 | #define MAX_IOCTL_CARD_NAME 31
|
---|
126 | #define MAX_IOCTL_DRIVER_NAME 31
|
---|
127 | #define MAX_IOCTL_VENDOR_NAME 31
|
---|
128 | #define MAX_IOCTL_CHANNEL_PREFIX 31
|
---|
129 | #define MAX_IOCTL_CHANNEL_NAME 31
|
---|
130 |
|
---|
131 | #define VCAN_CHANNEL_CAP_SEND_ERROR_FRAMES 0x00000001
|
---|
132 | #define VCAN_CHANNEL_CAP_RECEIVE_ERROR_FRAMES 0x00000002
|
---|
133 | #define VCAN_CHANNEL_CAP_TIMEBASE_ON_CARD 0x00000004
|
---|
134 | #define VCAN_CHANNEL_CAP_BUSLOAD_CALCULATION 0x00000008
|
---|
135 | #define VCAN_CHANNEL_CAP_OBJECT_BUFFER_MODE 0x00000010
|
---|
136 | #define VCAN_CHANNEL_CAP_TIME_SYNC 0x00000020
|
---|
137 | #define VCAN_CHANNEL_CAP_ABSOLUTE_TIME 0x00000040
|
---|
138 | #define VCAN_CHANNEL_CAP_EXTENDED_CAN 0x00000080
|
---|
139 | /* Flags for Kvasers channel capabilities */
|
---|
140 | #define VCAN_CHANNEL_CAP_ERROR_COUNTERS 0x00010000
|
---|
141 | #define VCAN_CHANNEL_CAP_CAN_DIAGNOSTICS 0x00020000
|
---|
142 | #define VCAN_CHANNEL_CAP_TXREQUEST 0x00040000
|
---|
143 | #define VCAN_CHANNEL_CAP_TXACKNOWLEDGE 0x00080000
|
---|
144 | #define VCAN_CHANNEL_CAP_VIRTUAL 0x00100000
|
---|
145 | #define VCAN_CHANNEL_CAP_SIMULATED 0x00200000
|
---|
146 | #define VCAN_CHANNEL_CAP_REMOTE 0x00400000 // Device (channel) is remote, e.g. Iris
|
---|
147 | #define VCAN_CHANNEL_CAP_CANFD 0x00800000 // Device (channel) supports CAN-FD
|
---|
148 | #define VCAN_CHANNEL_CAP_CANFD_NONISO 0x01000000 // Device (channel) supports non-ISO CAN-FD
|
---|
149 |
|
---|
150 | #define VCAN_CHANNEL_STATUS_TIME_SYNC_ENABLED 0x00000001
|
---|
151 | #define VCAN_CHANNEL_STATUS_TIME_SYNC_RUNNING 0x00000002
|
---|
152 | #define VCAN_CHANNEL_STATUS_ON_BUS 0x00000004
|
---|
153 | #define VCAN_CHANNEL_STATUS_ACTIVATED 0x00000008
|
---|
154 |
|
---|
155 | #endif /* _VCAN_IOCTL_H */
|
---|