Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

can: j1939: add tables for the CAN identifier and its fields

Use table markup to show the structure of the CAN identifier, PGN, PDU1, and
PDU2 formats. Also add introductory sentence.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Link: https://lore.kernel.org/r/20201104155730.25196-1-yegorslists@googlemail.com
[mkl: removed trailing whitespace]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

authored by

Yegor Yefremov and committed by
Marc Kleine-Budde
b7d3c0e5 4082c502

+42 -4
+42 -4
Documentation/networking/j1939.rst
··· 69 69 PGN 70 70 --- 71 71 72 + The J1939 protocol uses the 29-bit CAN identifier with the following structure: 73 + 74 + ============ ============== ==================== 75 + 29 bit CAN-ID 76 + -------------------------------------------------- 77 + Bit positions within the CAN-ID 78 + -------------------------------------------------- 79 + 28 ... 26 25 ... 8 7 ... 0 80 + ============ ============== ==================== 81 + Priority PGN SA (Source Address) 82 + ============ ============== ==================== 83 + 72 84 The PGN (Parameter Group Number) is a number to identify a packet. The PGN 73 85 is composed as follows: 74 - 1 bit : Reserved Bit 75 - 1 bit : Data Page 76 - 8 bits : PF (PDU Format) 77 - 8 bits : PS (PDU Specific) 86 + 87 + ============ ============== ================= ================= 88 + PGN 89 + ------------------------------------------------------------------ 90 + Bit positions within the CAN-ID 91 + ------------------------------------------------------------------ 92 + 25 24 23 ... 16 15 ... 8 93 + ============ ============== ================= ================= 94 + R (Reserved) DP (Data Page) PF (PDU Format) PS (PDU Specific) 95 + ============ ============== ================= ================= 78 96 79 97 In J1939-21 distinction is made between PDU1 format (where PF < 240) and PDU2 80 98 format (where PF >= 240). Furthermore, when using the PDU2 format, the PS-field 81 99 contains a so-called Group Extension, which is part of the PGN. When using PDU2 82 100 format, the Group Extension is set in the PS-field. 101 + 102 + ============== ======================== 103 + PDU1 Format (specific) (peer to peer) 104 + ---------------------------------------- 105 + Bit positions within the CAN-ID 106 + ---------------------------------------- 107 + 23 ... 16 15 ... 8 108 + ============== ======================== 109 + 00h ... EFh DA (Destination address) 110 + ============== ======================== 111 + 112 + ============== ======================== 113 + PDU2 Format (global) (broadcast) 114 + ---------------------------------------- 115 + Bit positions within the CAN-ID 116 + ---------------------------------------- 117 + 23 ... 16 15 ... 8 118 + ============== ======================== 119 + F0h ... FFh GE (Group Extenstion) 120 + ============== ======================== 83 121 84 122 On the other hand, when using PDU1 format, the PS-field contains a so-called 85 123 Destination Address, which is _not_ part of the PGN. When communicating a PGN