4 * Definitions for the CAN netlink interface
6 * Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com>
8 * Send feedback to <socketcan-users@lists.berlios.de>
15 #include <linux/types.h>
18 * CAN bit-timing parameters
20 * For futher 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.
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 */
36 * CAN harware-dependent bit-timing constant
38 * Used for calculating and checking bit-timing parameters
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 */
44 __u32 tseg2_min
; /* Time segement 2 = phase_seg2 */
46 __u32 sjw_max
; /* Synchronisation jump width */
47 __u32 brp_min
; /* Bit-rate prescaler */
53 * CAN clock parameters
56 __u32 freq
; /* CAN system clock frequency in Hz */
60 * CAN operational and error states
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 */
80 #define CAN_CTRLMODE_LOOPBACK 0x1 /* Loopback mode */
81 #define CAN_CTRLMODE_LISTENONLY 0x2 /* Listen-only mode */
82 #define CAN_CTRLMODE_3_SAMPLES 0x4 /* Triple sampling mode */
85 * CAN device statistics
87 struct can_device_stats
{
88 __u32 bus_error
; /* Bus errors */
89 __u32 error_warning
; /* Changes to error warning state */
90 __u32 error_passive
; /* Changes to error passive state */
91 __u32 bus_off
; /* Changes to bus off state */
92 __u32 arbitration_lost
; /* Arbitration lost errors */
93 __u32 restarts
; /* CAN controller re-starts */
97 * CAN netlink interface
102 IFLA_CAN_BITTIMING_CONST
,
111 #define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1)
113 #endif /* CAN_NETLINK_H */