Warning: This file is not a C or C++ file. It does not have highlighting.
1 | /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ |
---|---|
2 | /* |
3 | * j1939.h |
4 | * |
5 | * Copyright (c) 2010-2011 EIA Electronics |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License version 2 as |
9 | * published by the Free Software Foundation. |
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 /* == broadcast or no addr */ |
22 | #define J1939_NO_NAME 0 |
23 | #define J1939_PGN_REQUEST 0x0ea00 /* Request PG */ |
24 | #define J1939_PGN_ADDRESS_CLAIMED 0x0ee00 /* Address Claimed */ |
25 | #define J1939_PGN_ADDRESS_COMMANDED 0x0fed8 /* Commanded Address */ |
26 | #define J1939_PGN_PDU1_MAX 0x3ff00 |
27 | #define J1939_PGN_MAX 0x3ffff |
28 | #define J1939_NO_PGN 0x40000 |
29 | |
30 | /* J1939 Parameter Group Number |
31 | * |
32 | * bit 0-7 : PDU Specific (PS) |
33 | * bit 8-15 : PDU Format (PF) |
34 | * bit 16 : Data Page (DP) |
35 | * bit 17 : Reserved (R) |
36 | * bit 19-31 : set to zero |
37 | */ |
38 | typedef __u32 pgn_t; |
39 | |
40 | /* J1939 Priority |
41 | * |
42 | * bit 0-2 : Priority (P) |
43 | * bit 3-7 : set to zero |
44 | */ |
45 | typedef __u8 priority_t; |
46 | |
47 | /* J1939 NAME |
48 | * |
49 | * bit 0-20 : Identity Number |
50 | * bit 21-31 : Manufacturer Code |
51 | * bit 32-34 : ECU Instance |
52 | * bit 35-39 : Function Instance |
53 | * bit 40-47 : Function |
54 | * bit 48 : Reserved |
55 | * bit 49-55 : Vehicle System |
56 | * bit 56-59 : Vehicle System Instance |
57 | * bit 60-62 : Industry Group |
58 | * bit 63 : Arbitrary Address Capable |
59 | */ |
60 | typedef __u64 name_t; |
61 | |
62 | /* J1939 socket options */ |
63 | #define SOL_CAN_J1939 (SOL_CAN_BASE + CAN_J1939) |
64 | enum { |
65 | SO_J1939_FILTER = 1, /* set filters */ |
66 | SO_J1939_PROMISC = 2, /* set/clr promiscuous mode */ |
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 | J1939_NLA_TOTAL_SIZE, |
82 | J1939_NLA_PGN, |
83 | J1939_NLA_SRC_NAME, |
84 | J1939_NLA_DEST_NAME, |
85 | J1939_NLA_SRC_ADDR, |
86 | J1939_NLA_DEST_ADDR, |
87 | }; |
88 | |
89 | enum { |
90 | J1939_EE_INFO_NONE, |
91 | J1939_EE_INFO_TX_ABORT, |
92 | J1939_EE_INFO_RX_RTS, |
93 | J1939_EE_INFO_RX_DPO, |
94 | J1939_EE_INFO_RX_ABORT, |
95 | }; |
96 | |
97 | struct j1939_filter { |
98 | name_t name; |
99 | name_t name_mask; |
100 | pgn_t pgn; |
101 | pgn_t pgn_mask; |
102 | __u8 addr; |
103 | __u8 addr_mask; |
104 | }; |
105 | |
106 | #define J1939_FILTER_MAX 512 /* maximum number of j1939_filter set via setsockopt() */ |
107 | |
108 | #endif /* !_UAPI_CAN_J1939_H_ */ |
109 |
Warning: This file is not a C or C++ file. It does not have highlighting.