linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, linux-can@vger.kernel.org,
	kernel@pengutronix.de,
	Yegor Yefremov <yegorslists@googlemail.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [net-next 01/25] can: j1939: add tables for the CAN identifier and its fields
Date: Fri, 20 Nov 2020 14:32:54 +0100	[thread overview]
Message-ID: <20201120133318.3428231-2-mkl@pengutronix.de> (raw)
In-Reply-To: <20201120133318.3428231-1-mkl@pengutronix.de>

From: Yegor Yefremov <yegorslists@googlemail.com>

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>
---
 Documentation/networking/j1939.rst | 46 +++++++++++++++++++++++++++---
 1 file changed, 42 insertions(+), 4 deletions(-)

diff --git a/Documentation/networking/j1939.rst b/Documentation/networking/j1939.rst
index 0a4b73b03b99..b705d2801e9c 100644
--- a/Documentation/networking/j1939.rst
+++ b/Documentation/networking/j1939.rst
@@ -69,18 +69,56 @@ J1939 concepts
 PGN
 ---
 
+The J1939 protocol uses the 29-bit CAN identifier with the following structure:
+
+  ============  ==============  ====================
+  29 bit CAN-ID
+  --------------------------------------------------
+  Bit positions within the CAN-ID
+  --------------------------------------------------
+  28 ... 26     25 ... 8        7 ... 0
+  ============  ==============  ====================
+  Priority      PGN             SA (Source Address)
+  ============  ==============  ====================
+
 The PGN (Parameter Group Number) is a number to identify a packet. The PGN
 is composed as follows:
-1 bit  : Reserved Bit
-1 bit  : Data Page
-8 bits : PF (PDU Format)
-8 bits : PS (PDU Specific)
+
+  ============  ==============  =================  =================
+  PGN
+  ------------------------------------------------------------------
+  Bit positions within the CAN-ID
+  ------------------------------------------------------------------
+  25            24              23 ... 16          15 ... 8
+  ============  ==============  =================  =================
+  R (Reserved)  DP (Data Page)  PF (PDU Format)    PS (PDU Specific)
+  ============  ==============  =================  =================
 
 In J1939-21 distinction is made between PDU1 format (where PF < 240) and PDU2
 format (where PF >= 240). Furthermore, when using the PDU2 format, the PS-field
 contains a so-called Group Extension, which is part of the PGN. When using PDU2
 format, the Group Extension is set in the PS-field.
 
+  ==============  ========================
+  PDU1 Format (specific) (peer to peer)
+  ----------------------------------------
+  Bit positions within the CAN-ID
+  ----------------------------------------
+  23 ... 16       15 ... 8
+  ==============  ========================
+  00h ... EFh     DA (Destination address)
+  ==============  ========================
+
+  ==============  ========================
+  PDU2 Format (global) (broadcast)
+  ----------------------------------------
+  Bit positions within the CAN-ID
+  ----------------------------------------
+  23 ... 16       15 ... 8
+  ==============  ========================
+  F0h ... FFh     GE (Group Extenstion)
+  ==============  ========================
+
 On the other hand, when using PDU1 format, the PS-field contains a so-called
 Destination Address, which is _not_ part of the PGN. When communicating a PGN
 from user space to kernel (or vice versa) and PDU2 format is used, the PS-field

base-commit: 4082c502bf9c8a6afe4268c654d4e93ab7dfeb69
-- 
2.29.2


  reply	other threads:[~2020-11-20 13:34 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 13:32 pull-request: can-next 2020-11-20 Marc Kleine-Budde
2020-11-20 13:32 ` Marc Kleine-Budde [this message]
2020-11-20 13:32 ` [net-next 02/25] can: add optional DLC element to Classical CAN frame structure Marc Kleine-Budde
2020-11-20 13:32 ` [net-next 03/25] can: rename get_can_dlc() macro with can_cc_dlc2len() Marc Kleine-Budde
2020-11-20 13:32 ` [net-next 04/25] can: remove obsolete get_canfd_dlc() macro Marc Kleine-Budde
2020-11-20 13:32 ` [net-next 05/25] can: replace can_dlc as variable/element for payload length Marc Kleine-Budde
2020-11-20 13:32 ` [net-next 06/25] can: rename CAN FD related can_len2dlc and can_dlc2len helpers Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 07/25] can: update documentation for DLC usage in Classical CAN Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 08/25] can: drivers: introduce helpers to access Classical CAN DLC values Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 09/25] can: drivers: add len8_dlc support for various CAN adapters Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 10/25] can: drivers: add len8_dlc support for esd_usb2 CAN adapter Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 11/25] can: gw: support modification of Classical CAN DLCs Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 12/25] dt-bindings: can: fsl,flexcan: add uint32 reference to clock-frequency property Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 13/25] dt-bindings: can: fsl,flexcan: fix fsl,clk-source property Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 14/25] dt-bindings: firmware: add IMX_SC_R_CAN(x) macro for CAN Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 15/25] can: flexcan: rename macro FLEXCAN_QUIRK_SETUP_STOP_MODE -> FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 16/25] can: flexcan: factor out enabling and disabling of interrupts into separate function Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 17/25] can: flexcan: move enabling/disabling of interrupts from flexcan_chip_{start,stop}() to callers Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 18/25] can: flexcan: flexcan_rx_offload_setup(): factor out mailbox and rx-offload setup into separate function Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 19/25] can: flexcan: flexcan_open(): completely initialize controller before requesting IRQ Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 20/25] can: flexcan: flexcan_close(): change order if commands to properly shut down the controller Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 21/25] can: kvaser_usb: Add USB_{LEAF,HYDRA}_PRODUCT_ID_END defines Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 22/25] can: kvaser_usb: Add new Kvaser Leaf v2 devices Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 23/25] can: kvaser_usb: kvaser_usb_hydra: Add support for new device variant Marc Kleine-Budde
2020-11-20 13:33 ` [net-next 24/25] can: kvaser_usb: Add new Kvaser hydra devices Marc Kleine-Budde
2020-11-20 13:44 ` [PATCH 25/25] can: mcp251xfd: remove useless code in mcp251xfd_chip_softreset Marc Kleine-Budde
2020-11-21 23:09 ` pull-request: can-next 2020-11-20 Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201120133318.3428231-2-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yegorslists@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).