diff options
Diffstat (limited to 'include/uapi/linux/can/netlink.h')
-rw-r--r-- | include/uapi/linux/can/netlink.h | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/include/uapi/linux/can/netlink.h b/include/uapi/linux/can/netlink.h new file mode 100644 index 00000000000..14966ddb7df --- /dev/null +++ b/include/uapi/linux/can/netlink.h | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * linux/can/netlink.h | ||
3 | * | ||
4 | * Definitions for the CAN netlink interface | ||
5 | * | ||
6 | * Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com> | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #ifndef CAN_NETLINK_H | ||
11 | #define CAN_NETLINK_H | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | |||
15 | /* | ||
16 | * CAN bit-timing parameters | ||
17 | * | ||
18 | * For further information, please read chapter "8 BIT TIMING | ||
19 | * REQUIREMENTS" of the "Bosch CAN Specification version 2.0" | ||
20 | * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf. | ||
21 | */ | ||
22 | struct can_bittiming { | ||
23 | __u32 bitrate; /* Bit-rate in bits/second */ | ||
24 | __u32 sample_point; /* Sample point in one-tenth of a percent */ | ||
25 | __u32 tq; /* Time quanta (TQ) in nanoseconds */ | ||
26 | __u32 prop_seg; /* Propagation segment in TQs */ | ||
27 | __u32 phase_seg1; /* Phase buffer segment 1 in TQs */ | ||
28 | __u32 phase_seg2; /* Phase buffer segment 2 in TQs */ | ||
29 | __u32 sjw; /* Synchronisation jump width in TQs */ | ||
30 | __u32 brp; /* Bit-rate prescaler */ | ||
31 | }; | ||
32 | |||
33 | /* | ||
34 | * CAN harware-dependent bit-timing constant | ||
35 | * | ||
36 | * Used for calculating and checking bit-timing parameters | ||
37 | */ | ||
38 | struct can_bittiming_const { | ||
39 | char name[16]; /* Name of the CAN controller hardware */ | ||
40 | __u32 tseg1_min; /* Time segement 1 = prop_seg + phase_seg1 */ | ||
41 | __u32 tseg1_max; | ||
42 | __u32 tseg2_min; /* Time segement 2 = phase_seg2 */ | ||
43 | __u32 tseg2_max; | ||
44 | __u32 sjw_max; /* Synchronisation jump width */ | ||
45 | __u32 brp_min; /* Bit-rate prescaler */ | ||
46 | __u32 brp_max; | ||
47 | __u32 brp_inc; | ||
48 | }; | ||
49 | |||
50 | /* | ||
51 | * CAN clock parameters | ||
52 | */ | ||
53 | struct can_clock { | ||
54 | __u32 freq; /* CAN system clock frequency in Hz */ | ||
55 | }; | ||
56 | |||
57 | /* | ||
58 | * CAN operational and error states | ||
59 | */ | ||
60 | enum can_state { | ||
61 | CAN_STATE_ERROR_ACTIVE = 0, /* RX/TX error count < 96 */ | ||
62 | CAN_STATE_ERROR_WARNING, /* RX/TX error count < 128 */ | ||
63 | CAN_STATE_ERROR_PASSIVE, /* RX/TX error count < 256 */ | ||
64 | CAN_STATE_BUS_OFF, /* RX/TX error count >= 256 */ | ||
65 | CAN_STATE_STOPPED, /* Device is stopped */ | ||
66 | CAN_STATE_SLEEPING, /* Device is sleeping */ | ||
67 | CAN_STATE_MAX | ||
68 | }; | ||
69 | |||
70 | /* | ||
71 | * CAN bus error counters | ||
72 | */ | ||
73 | struct can_berr_counter { | ||
74 | __u16 txerr; | ||
75 | __u16 rxerr; | ||
76 | }; | ||
77 | |||
78 | /* | ||
79 | * CAN controller mode | ||
80 | */ | ||
81 | struct can_ctrlmode { | ||
82 | __u32 mask; | ||
83 | __u32 flags; | ||
84 | }; | ||
85 | |||
86 | #define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */ | ||
87 | #define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */ | ||
88 | #define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */ | ||
89 | #define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */ | ||
90 | #define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */ | ||
91 | |||
92 | /* | ||
93 | * CAN device statistics | ||
94 | */ | ||
95 | struct can_device_stats { | ||
96 | __u32 bus_error; /* Bus errors */ | ||
97 | __u32 error_warning; /* Changes to error warning state */ | ||
98 | __u32 error_passive; /* Changes to error passive state */ | ||
99 | __u32 bus_off; /* Changes to bus off state */ | ||
100 | __u32 arbitration_lost; /* Arbitration lost errors */ | ||
101 | __u32 restarts; /* CAN controller re-starts */ | ||
102 | }; | ||
103 | |||
104 | /* | ||
105 | * CAN netlink interface | ||
106 | */ | ||
107 | enum { | ||
108 | IFLA_CAN_UNSPEC, | ||
109 | IFLA_CAN_BITTIMING, | ||
110 | IFLA_CAN_BITTIMING_CONST, | ||
111 | IFLA_CAN_CLOCK, | ||
112 | IFLA_CAN_STATE, | ||
113 | IFLA_CAN_CTRLMODE, | ||
114 | IFLA_CAN_RESTART_MS, | ||
115 | IFLA_CAN_RESTART, | ||
116 | IFLA_CAN_BERR_COUNTER, | ||
117 | __IFLA_CAN_MAX | ||
118 | }; | ||
119 | |||
120 | #define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1) | ||
121 | |||
122 | #endif /* CAN_NETLINK_H */ | ||