]> rtime.felk.cvut.cz Git - can-utils.git/blob - include/socketcan/can/ioctl.h
include: Remove two unused header files
[can-utils.git] / include / socketcan / can / ioctl.h
1
2 /*
3  * socketcan/can/ioctl.h
4  *
5  * Definitions for CAN controller setup (work in progress)
6  *
7  * $Id$
8  *
9  * Send feedback to <linux-can@vger.kernel.org>
10  *
11  */
12
13 #ifndef CAN_IOCTL_H
14 #define CAN_IOCTL_H
15
16 #include <linux/sockios.h>
17
18 /*
19  * CAN bitrate
20  */
21 #define CAN_BITRATE_UNCONFIGURED        ((__u32) 0xFFFFFFFFU)
22 #define CAN_BITRATE_UNKNOWN             0
23 #define CAN_BITRATE_DEFAULT             500000
24
25 /*
26  * CAN custom bit time
27  */
28 enum can_bittimes {
29         CAN_BITTIME_STD,
30         CAN_BITTIME_BTR
31 };
32
33 /* TSEG1 of controllers usually is a sum of synch_seg (always 1),
34  * prop_seg and phase_seg1, TSEG2 = phase_seg2 */
35
36 struct can_bittime_std {
37         __u32 brp;        /* baud rate prescaler */
38         __u8  prop_seg;   /* from 1 to 8 */
39         __u8  phase_seg1; /* from 1 to 8 */
40         __u8  phase_seg2; /* from 1 to 8 */
41         __u8  sjw:7;      /* from 1 to 4 */
42         __u8  sam:1;      /* 1 - enable triple sampling */
43 };
44
45 struct can_bittime_btr {
46         __u8  btr0;
47         __u8  btr1;
48 };
49
50 struct can_bittime {
51         enum can_bittimes type;
52         union {
53                 struct can_bittime_std std;
54                 struct can_bittime_btr btr;
55         };
56 };
57
58 /*
59  * CAN mode
60  */
61 enum can_mode {
62         CAN_MODE_STOP = 0,
63         CAN_MODE_START,
64         CAN_MODE_SLEEP
65 };
66
67 /*
68  * CAN controller mode
69  */
70 #define CAN_CTRLMODE_LOOPBACK   0x1
71 #define CAN_CTRLMODE_LISTENONLY 0x2
72
73 /*
74  * CAN operational and error states
75  */
76 enum can_state {
77         CAN_STATE_ACTIVE = 0,
78         CAN_STATE_BUS_WARNING,
79         CAN_STATE_BUS_PASSIVE,
80         CAN_STATE_BUS_OFF,
81         CAN_STATE_STOPPED,
82         CAN_STATE_SLEEPING
83 };
84
85 /*
86  * CAN device statistics
87  */
88 struct can_device_stats {
89         int error_warning;
90         int data_overrun;
91         int wakeup;
92         int bus_error;
93         int error_passive;
94         int arbitration_lost;
95         int restarts;
96         int bus_error_at_init;
97 };
98
99 #endif /* CAN_IOCTL_H */