Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 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 1 2 3 4 5 6


netlink.h
001: /*
002:  * linux/can/netlink.h
003:  *
004:  * Definitions for the CAN netlink interface
005:  *
006:  * Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com>
007:  *
008:  */
009: 
010: #ifndef CAN_NETLINK_H
011: #define CAN_NETLINK_H
012: 
013: #include <linux/types.h>
014: 
015: /*
016:  * CAN bit-timing parameters
017:  *
018:  * For further information, please read chapter "8 BIT TIMING
019:  * REQUIREMENTS" of the "Bosch CAN Specification version 2.0"
020:  * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf.
021:  */
022: struct can_bittiming {
023:         __u32 bitrate;          /* Bit-rate in bits/second */
024:         __u32 sample_point;     /* Sample point in one-tenth of a percent */
025:         __u32 tq;               /* Time quanta (TQ) in nanoseconds */
026:         __u32 prop_seg;         /* Propagation segment in TQs */
027:         __u32 phase_seg1;       /* Phase buffer segment 1 in TQs */
028:         __u32 phase_seg2;       /* Phase buffer segment 2 in TQs */
029:         __u32 sjw;              /* Synchronisation jump width in TQs */
030:         __u32 brp;              /* Bit-rate prescaler */
031: };
032: 
033: /*
034:  * CAN harware-dependent bit-timing constant
035:  *
036:  * Used for calculating and checking bit-timing parameters
037:  */
038: struct can_bittiming_const {
039:         char name[16];          /* Name of the CAN controller hardware */
040:         __u32 tseg1_min;        /* Time segement 1 = prop_seg + phase_seg1 */
041:         __u32 tseg1_max;
042:         __u32 tseg2_min;        /* Time segement 2 = phase_seg2 */
043:         __u32 tseg2_max;
044:         __u32 sjw_max;          /* Synchronisation jump width */
045:         __u32 brp_min;          /* Bit-rate prescaler */
046:         __u32 brp_max;
047:         __u32 brp_inc;
048: };
049: 
050: /*
051:  * CAN clock parameters
052:  */
053: struct can_clock {
054:         __u32 freq;             /* CAN system clock frequency in Hz */
055: };
056: 
057: /*
058:  * CAN operational and error states
059:  */
060: enum can_state {
061:         CAN_STATE_ERROR_ACTIVE = 0,     /* RX/TX error count < 96 */
062:         CAN_STATE_ERROR_WARNING,        /* RX/TX error count < 128 */
063:         CAN_STATE_ERROR_PASSIVE,        /* RX/TX error count < 256 */
064:         CAN_STATE_BUS_OFF,              /* RX/TX error count >= 256 */
065:         CAN_STATE_STOPPED,              /* Device is stopped */
066:         CAN_STATE_SLEEPING,             /* Device is sleeping */
067:         CAN_STATE_MAX
068: };
069: 
070: /*
071:  * CAN bus error counters
072:  */
073: struct can_berr_counter {
074:         __u16 txerr;
075:         __u16 rxerr;
076: };
077: 
078: /*
079:  * CAN controller mode
080:  */
081: struct can_ctrlmode {
082:         __u32 mask;
083:         __u32 flags;
084: };
085: 
086: #define CAN_CTRLMODE_LOOPBACK           0x01    /* Loopback mode */
087: #define CAN_CTRLMODE_LISTENONLY         0x02    /* Listen-only mode */
088: #define CAN_CTRLMODE_3_SAMPLES          0x04    /* Triple sampling mode */
089: #define CAN_CTRLMODE_ONE_SHOT           0x08    /* One-Shot mode */
090: #define CAN_CTRLMODE_BERR_REPORTING     0x10    /* Bus-error reporting */
091: 
092: /*
093:  * CAN device statistics
094:  */
095: struct can_device_stats {
096:         __u32 bus_error;        /* Bus errors */
097:         __u32 error_warning;    /* Changes to error warning state */
098:         __u32 error_passive;    /* Changes to error passive state */
099:         __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 */
123: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/