1
2
3
4
5
6
7
8
9
10
11
12 #ifndef _UAPI_CAN_J1939_H_
13 #define _UAPI_CAN_J1939_H_
14
15 #include <linux/types.h>
16 #include <linux/socket.h>
17 #include <linux/can.h>
18
19 #define J1939_MAX_UNICAST_ADDR 0xfd
20 #define J1939_IDLE_ADDR 0xfe
21 #define J1939_NO_ADDR 0xff
22 #define J1939_NO_NAME 0
23 #define J1939_PGN_REQUEST 0x0ea00
24 #define J1939_PGN_ADDRESS_CLAIMED 0x0ee00
25 #define J1939_PGN_ADDRESS_COMMANDED 0x0fed8
26 #define J1939_PGN_PDU1_MAX 0x3ff00
27 #define J1939_PGN_MAX 0x3ffff
28 #define J1939_NO_PGN 0x40000
29
30
31
32
33
34
35
36
37
38 typedef __u32 pgn_t;
39
40
41
42
43
44
45 typedef __u8 priority_t;
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 typedef __u64 name_t;
61
62
63 #define SOL_CAN_J1939 (SOL_CAN_BASE + CAN_J1939)
64 enum {
65 SO_J1939_FILTER = 1,
66 SO_J1939_PROMISC = 2,
67 SO_J1939_SEND_PRIO = 3,
68 SO_J1939_ERRQUEUE = 4,
69 };
70
71 enum {
72 SCM_J1939_DEST_ADDR = 1,
73 SCM_J1939_DEST_NAME = 2,
74 SCM_J1939_PRIO = 3,
75 SCM_J1939_ERRQUEUE = 4,
76 };
77
78 enum {
79 J1939_NLA_PAD,
80 J1939_NLA_BYTES_ACKED,
81 };
82
83 enum {
84 J1939_EE_INFO_NONE,
85 J1939_EE_INFO_TX_ABORT,
86 };
87
88 struct j1939_filter {
89 name_t name;
90 name_t name_mask;
91 pgn_t pgn;
92 pgn_t pgn_mask;
93 __u8 addr;
94 __u8 addr_mask;
95 };
96
97 #define J1939_FILTER_MAX 512
98
99 #endif