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