1 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
5 * Copyright (c) 2010-2011 EIA Electronics
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.
12 #ifndef _UAPI_CAN_J1939_H_
13 #define _UAPI_CAN_J1939_H_
15 #include <linux/types.h>
16 #include <linux/socket.h>
17 #include <linux/can.h>
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
30 /* J1939 Parameter Group Number
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
42 * bit 0-2 : Priority (P)
43 * bit 3-7 : set to zero
45 typedef __u8 priority_t
;
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
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
62 /* J1939 socket options */
63 #define SOL_CAN_J1939 (SOL_CAN_BASE + CAN_J1939)
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,
72 SCM_J1939_DEST_ADDR
= 1,
73 SCM_J1939_DEST_NAME
= 2,
75 SCM_J1939_ERRQUEUE
= 4,
80 J1939_NLA_BYTES_ACKED
,
91 J1939_EE_INFO_TX_ABORT
,
94 J1939_EE_INFO_RX_ABORT
,
106 #define J1939_FILTER_MAX 512 /* maximum number of j1939_filter set via setsockopt() */
108 #endif /* !_UAPI_CAN_J1939_H_ */