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