DEENESPTFRRUARHIKOZHNL

SAE J1939 Transport Layer (J1939Tp)

ModulJ1939Tp (SAE J1939 Transport Layer)
BSW-Modul-ID37
Standard-Header#include "J1939Tp.h"
SWS-SpezifikationAUTOSAR_CP_SWS_SAEJ1939TransportLayer.pdf, AUTOSAR_SWS_SAEJ1939TransportLayer.pdf
Umfang60 Records · 14 Snippets
ClusterSAE J1939

SAE J1939 Transport Layer (J1939Tp)

AUTOSAR Classic Communication Services-Modul SAE J1939 Transport Layer (J1939Tp, Spezifikation: AUTOSAR_CP_SWS_SAEJ1939TransportLayer.pdf, AUTOSAR_SWS_SAEJ1939TransportLayer.pdf).

Funktionen — Übersicht

Typen — Übersicht

Anforderungen — Übersicht

Funktionen & Typen — Detailansicht

função J1939Tp_Init [SWS_J1939Tp_00087] 📄 PDF

void J1939Tp_Init(const J1939Tp_ConfigType* ConfigPtr);

This function initializes the J1939Tp module.

função J1939Tp_Shutdown [SWS_J1939Tp_00093] 📄 PDF

void J1939Tp_Shutdown(void);

This function is used to shutdown the J1939Tp module.

função J1939Tp_MainFunction [SWS_J1939Tp_00104] 📄 PDF

void J1939Tp_MainFunction(void);

Main function of the J1939Tp. Used for scheduling purposes and timeout supervision.

requirement SWS_J1939Tp_00007 [SWS_J1939Tp_00007] 📄 PDF

Internally used data types and functions shall be defined locally in the implementation source files.

requirement SWS_J1939Tp_00030 [SWS_J1939Tp_00030] 📄 PDF

The function J1939Tp_Transmit() shall reject the transmit request and return the status value E_NOT_OK if the transmission needs a transport protocol and the channel is occupied (see also 7.5.7 ).

requirement SWS_J1939Tp_00032 [SWS_J1939Tp_00032] 📄 PDF

[SWS_J1939Tp_00032] if any of the following conditions occur: • The upper Layer returns the PduR_J1939TpCopyTxData() function call with BUFREQ_E_NOT_OK or • the J1939Tp_CancelTransmit() function is called. In case of a CMDT connection, a CMDT Connection Abort shall be performed as described in [SWS_J1939Tp_00097], and the connection abort reason shall be set to 2 (System resources were needed for another task so this connection managed session was terminated).⌋

requirement SWS_J1939Tp_00039 [SWS_J1939Tp_00039] 📄 PDF

[SWS_J1939Tp_00039] ⌈When configured, the transport protocol variant ( BAM/CMDT, see J1939TpTxProtocolType) and the SA/DA (see J1939TpTxSa/ J1939TpTxDa) shall be used for transmission. For N-SDUs with meta data, these parameters are optional. If SA or DA is not configured, the value provided via the meta data shall be used. If the transport protocol is not configured, it shall be chosen based on the actual DA: BAM when DA is 0xFF, CMDT otherwise.⌋

requirement SWS_J1939Tp_00041 [SWS_J1939Tp_00041] 📄 PDF

J1939Tp shall send the transport frames TP.CM and TP.DT and direct frames using the service function CanIf_Transmit() .

requirement SWS_J1939Tp_00045 [SWS_J1939Tp_00045] 📄 PDF

[SWS_J1939Tp_00045] ⌈The function J1939Tp_Transmit() shall use the TxP- duId and the SduLength provided in the PduInfoType structure. It shall not use the payload of N-SDUs, only the contained meta data.⌋

requirement SWS_J1939Tp_00046 [SWS_J1939Tp_00046] 📄 PDF

[SWS_J1939Tp_00046] ⌈For each TP.DT frame to be sent, the J1939Tp module shall previously call PduR_J1939TpCopyTxData() with the following parameters: • the Identifier of the corresponding N-SDU, • PduInfoType structure with up to 7 bytes as SduLength, • the retry parameter, and • a pointer to a location where the upper layer stores its currently available data. ⌋

requirement SWS_J1939Tp_00047 [SWS_J1939Tp_00047] 📄 PDF

[SWS_J1939Tp_00047] ⌈After a transmission request from the upper layer, the J1939Tp module shall initiate the transmission by sending: • For CMDT: a TP.CM_RTS frame • For BAM: a TP.CM_BAM frame ⌋

requirement SWS_J1939Tp_00048 [SWS_J1939Tp_00048] 📄 PDF

[SWS_J1939Tp_00048] ⌈The J1939Tp module shall abort the transmission session like specified in [SWS_J1939Tp_00032] if any of the following conditions occur: • The upper Layer returns the PduR_J1939TpCopyTxData() function call with BUFREQ_E_NOT_OK or • the J1939Tp_CancelTransmit() function is called. In case of a CMDT connection, a CMDT Connection Abort shall be performed as described in [SWS_J1939Tp_00097], and the connection abort reason shall be set to 2 (System resources were needed for another task so this connection managed session was terminated).⌋

requirement SWS_J1939Tp_00071 [SWS_J1939Tp_00071] 📄 PDF

On errors and exceptions, the J1939Tp module shall not modify its current module state (see Figure 7 - 1 : J1939 Transport Layer life cycle ) but shall simply report the error event.

requirement SWS_J1939Tp_00076 [SWS_J1939Tp_00076] 📄 PDF

The global state (see SWS_J1939Tp_ 00019 ) shall be used to check if the module has been initialized before calling an API.

requirement SWS_J1939Tp_00094 [SWS_J1939Tp_00094] 📄 PDF

[SWS_J1939Tp_00094] ⌈J1939Tp_Shutdown() shall close all pending transport protocol connections, free all resources and set the J1939Tp module into the global state J1939TP_OFF state.⌋

requirement SWS_J1939Tp_00095 [SWS_J1939Tp_00095] 📄 PDF

[SWS_J1939Tp_00095] ⌈J1939Tp_Shutdown() shall not raise a notification about the pending frame transmission or reception.⌋

requirement SWS_J1939Tp_00097 [SWS_J1939Tp_00097] 📄 PDF

[SWS_J1939Tp_00097], and the connection abort reason shall be set to 2 (System resources were needed for another task so this connection managed session was terminated).⌋

requirement SWS_J1939Tp_00101 [SWS_J1939Tp_00101] 📄 PDF

[SWS_J1939Tp_00101] ⌈The function J1939Tp_Transmit() shall reject a request, if the J1939Tp_Transmit() service is called for an N-SDU identifier that is being used in a currently running SAE J1939 Transport Layer session.⌋

requirement SWS_J1939Tp_00106 [SWS_J1939Tp_00106] 📄 PDF

[SWS_J1939Tp_00106] ⌈The calling frequency of the function J1939Tp_- MainFunction() is determined by the configuration parameter J1939TpMainFunctionPeriod.⌋

requirement SWS_J1939Tp_00114 [SWS_J1939Tp_00114] 📄 PDF

[SWS_J1939Tp_00114] Upstream requirements: SRS_BSW_00333 ⌈The function J1939Tp_TxConfirmation() shall be callable in interrupt context (it could be called from the CAN transmit interrupt).⌋

requirement SWS_J1939Tp_00115 [SWS_J1939Tp_00115] 📄 PDF

Type of error Related error code Error value API service used in state J1939TP_ OFF J1939TP_ E_ UNINIT 0x01 J1939Tp_ Init() called in state J1939TP_ ON. J1939TP_ E_ REINIT 0x02 J1939Tp_ Init() was called with an invalid configuration pointer J1939TP_ E_ INIT_ FAILED 0x03 API service called with null pointer. J1939TP_ E_ PARAM_ POINTER 0x10 API service called with wrong ID. J1939TP_ E_ INVALID_ PDU_ SDU_ ID 0x11

requirement SWS_J1939Tp_00116 [SWS_J1939Tp_00116] 📄 PDF

Can If _ Transmit Can If.h Requests transmission of a PDU. Det _ Report - Runtime Error Det.h Service to report runtime errors. If a callout has been configured then this callout shall be called. Pdu R _ J1939 - Tp Copy Rx Data Pdu R_ J1939Tp.h This function is called to provide the received data of an I - PDU segment (N - PDU) to the upper layer. Each call to this function provides the next part of the I - PDU data. The size of the remaining buffer is written to the position indicated by buffer Size Ptr. Pdu R _ J1939 - Tp Copy Tx Data Pdu R_ J1939Tp.h This function is called to acquire the transmit data of an I - PDU segment (N - PDU). Each call to this function provides the next part of the I - PDU data unless retry - >Tp Data State is TP_ DA TARETRY. In this case the function restarts to copy the data beginning at the offset from the current position indicated by retry - >Tx Tp Data Cnt. The size of the remaining data is written to the position indicated by available Data Ptr. Pdu R _ J1939 - Tp Rx Indication Pdu R_ J1939Tp.h Called after an I - PDU has been received via the TP API, the result indicates whether the transmission was successful or not. Pdu R _ J1939 - Tp Start Of - Reception Pdu R_ J1939Tp.h This function is called at the start of receiving an N - SDU. The N - SDU might be fragmented into multiple N - PDUs (FF with one or more following CFs) or might consist of a single N - PDU (SF). The service shall provide the currently available maximum buffer siz e when invoked with Tp Sdu Length equal to 0. Pdu R _ J1939 - Tp Tx - Confirmation Pdu R_ J1939Tp.h This function is called after the I - PDU has been transmitted on its network, the result indicates whether the transmission was successful or not.

requirement SWS_J1939Tp_00119 [SWS_J1939Tp_00119] 📄 PDF

[SWS_J1939Tp_00119] and [SWS_J1939Tp_00032], the J1939Tp module will notify the upper layer by calling the PduR_J1939TpTxConfirmation() callback when the transmit request has been completed.

requirement SWS_J1939Tp_00123 [SWS_J1939Tp_00123] 📄 PDF

J1939Tp shall implement all CMDT related timing constraints ( Tr, Th, T1, T2, T3, T4) as described in [16] . They supervise the CMDT data flow.

requirement SWS_J1939Tp_00157 [SWS_J1939Tp_00157] 📄 PDF

[SWS_J1939Tp_00157] ⌈All service interfaces provided to the lower layer shall be independent of the internal communication configuration and implementation of the J1939Tp.⌋(SRS_J1939_00042)

requirement SWS_J1939Tp_00188 [SWS_J1939Tp_00188] 📄 PDF

If de velopment error det ection for the J1939Tp is enabled, all APIs using a SDU - or PDU - Identifier shall check the input Identifier and raise the development error: J1939TP_E_INVALID_PDU_SDU_ID in case the API has been called for a not configured PDU or SDU.

requirement SWS_J1939Tp_00192 [SWS_J1939Tp_00192] 📄 PDF

After a sequence error, J1939Tp shall abort BAM connections as specified in SWS_J1939Tp_ 00031 .

requirement SWS_J1939Tp_00194 [SWS_J1939Tp_00194] 📄 PDF

If J1939Tp Tx RetrySupport is disabled, when the J1939Tp receives a TP.CM_CTS frame requesting already sent data, it shall abort the transmission using the mechanisms described by SWS_J1939Tp_ 00032 and SWS_J1939Tp_ 00097 with reason 25 5 ( unassigned ).

requirement SWS_J1939Tp_00195 [SWS_J1939Tp_00195] 📄 PDF

If a TP.CM_CTS wait frame (number of packets set to 0, see also [16] ) is received, the J1939Tp shall wait for another TP.CM_CTS frame.

requirement SWS_J1939Tp_00198 [SWS_J1939Tp_00198] 📄 PDF

The J1939 Transport Layer shall use meta data items of type SOURCE_ADDRESS_16, TARGET_ADDRESS_16, and PRIORITY_8 of all N - SDUs, and meta data items of type CAN_ID_32 for all N - PDUs.

requirement SWS_J1939Tp_00199 [SWS_J1939Tp_00199] 📄 PDF

During transmission, the relevant set of N - PDUs is identified by the configured SA/DA of N - SDUs without MetaData, or by the SA/DA explicitly provided in the MetaData by the upper layer.

requirement SWS_J1939Tp_00200 [SWS_J1939Tp_00200] 📄 PDF

The J1939 Transport Layer module shall send TP.DT frames always with 8 bytes according to [16] .

requirement SWS_J1939Tp_00203 [SWS_J1939Tp_00203] 📄 PDF

J1939Tp_Cancel Transmit shall return E_NOT_OK if ‘ Tx P duId ’ is invalid, if ‘ Tx P duId ’ is currently not active, if currently a direct frame is transmitted, if the last TP.DT frame has already been transmitted during BAM transmission, or if the TP.CM_EOMAck frame has already been received during CMDT transmission .

requirement SWS_J1939Tp_00204 [SWS_J1939Tp_00204] 📄 PDF

J1939Tp_CancelReceive shall return E_NOT_OK if ‘ Rx P duId ’ is invalid, if ‘ Rx P duId ’ is currently not active, if currently a direct frame is received, if the last TP.DT frame has already been received during BAM reception, or if the TP.CM_EOMAck frame has already been sent during CMDT reception .

requirement SWS_J1939Tp_00206 [SWS_J1939Tp_00206] 📄 PDF

[SWS_J1939Tp_00206] ⌈J1939Tp_ChangeParameter() shall return E_NOT_OK if id is invalid, if parameter is not TP_BS, or if value is larger than 255.⌋()

requirement SWS_J1939Tp_00214 [SWS_J1939Tp_00214] 📄 PDF

The J1939Tp_CancelTransmit API shall only be available when J1939TpCancellationSupport is enabled.

requirement SWS_J1939Tp_00215 [SWS_J1939Tp_00215] 📄 PDF

The J1939Tp_CancelReceive API shall only be available when J1939TpCancellationSupport is enabled.

requirement SWS_J1939Tp_00216 [SWS_J1939Tp_00216] 📄 PDF

If J1939Tp Rx RetrySupport is disabled, when a sequence error occurs during reception , the J1939Tp module shall abort the reception session - as specified in SWS_J1939Tp_ 00031 and - as specified in SWS_J1939Tp_ 00097 with connection abort reason FF 16 (SNA).

requirement SWS_J1939Tp_00217 [SWS_J1939Tp_00217] 📄 PDF

If J1939Tp Tx RetrySupport is enabled , the J1939Tp shall call PduR_J1939TpCopyTxData with - TpDataState set to TP_DATACONF for the first call after reception of a TP.CM_CTS, and - TpDataState set to TP_CONFPENDING for the following calls .

requirement SWS_J1939Tp_00218 [SWS_J1939Tp_00218] 📄 PDF

If J1939Tp Tx RetrySupport is disabled, the parameter retry of PduR_J1939TpCopyTxData shall allways be set to the NULL_PTR .

requirement SWS_J1939Tp_00219 [SWS_J1939Tp_00219] 📄 PDF

[SWS_J1939Tp_00219] ⌈For BAM transmissions, the parameter retry of PduR_- J1939TpCopyTxData() shall always be set to the NULL_PTR.⌋

requirement SWS_J1939Tp_00220 [SWS_J1939Tp_00220] 📄 PDF

If J1939Tp Tx RetrySupport is enabled, a valid RetryInfoType stuct shall be provided via the parameter retry of PduR_J1939TpCopyTxData during CMDT transmission s .

requirement SWS_J1939Tp_00222 [SWS_J1939Tp_00222] 📄 PDF

If J1939Tp Rx RetrySupport is enabled, when a sequence error occurs during reception, the J1939Tp module shall , after the last TP.DT message of the block was received, send a TP.CM_CTS frame requesting the package s that follow the last correctly received package of the current block .

requirement SWS_J1939Tp_00223 [SWS_J1939Tp_00223] 📄 PDF

When the J1939Tp receives a TP.CM_CTS frame that requests data beyond the current position or preceding the position where the last TP.CM_CTS was received, it shall abort the transmission using the mechanisms described by SWS_J1939Tp_ 00032 and SWS_J1939Tp_ 00097 with reason FF 16 (SNA).

requirement SWS_J1939Tp_00228 [SWS_J1939Tp_00228] 📄 PDF

When PduR_J1939TpCopyTxData returns BUFREQ_E_BUSY , the J1939Tp shall retry the call to PduR_J1939TpCopyTxData until the data is available or a timeout occurs.

requirement SWS_J1939Tp_00230 [SWS_J1939Tp_00230] 📄 PDF

Module Header File Imported Type Com Stack_ Types Com Stack_ Types.h Buf Req _ Return Type Com Stack_ Types.h Pdu Id Type Com Stack_ Types.h Pdu Info Type Com Stack_ Types.h Pdu Length Type Com Stack_ Types.h Retry Info Type Com Stack_ Types.h T P Parameter Type Com Stack_ Types.h Tp Data State Type Std Std_ Types.h Std _ Return Type Std_ Types.h Std _ Version Info Type

requirement SWS_J1939Tp_00231 [SWS_J1939Tp_00231] 📄 PDF

The J1939 Transport Layer module shall support several connections for the same PGN in parallel a s long as they can be received or transmitted independently.

requirement SWS_J1939Tp_00232 [SWS_J1939Tp_00232] 📄 PDF

The content of a TP.DT message with a sequence error and of the TP.DT messages following a sequence error in the same block shall be discarded.

requirement SWS_J1939Tp_00233 [SWS_J1939Tp_00233] 📄 PDF

If several receiving connections are configured with identical PGNs and matching channel parameters, the J1939Tp shall allocate an arbitrary free connection with matching parameters.

requirement SWS_J1939Tp_00234 [SWS_J1939Tp_00234] 📄 PDF

Type of error Related error code Error value Timeout occurred on receiver side after reception of an intermediate TP.DT frame of a block. J1939TP_ E_ TIMEOUT _ T1 0x30 Timeout occurred on receiver side after transmission of a TP.CM/ CTS frame. J1939TP_ E_ TIMEOUT_ T2 0x31 Timeout occurred on transmitter side after transmission of the last TP.DT frame of a block. J1939TP_ E_ TIMEOUT_ T3 0x32 Timeout occurred on transmitter side after reception of a TP.CM/ CTS(0) frame. J1939TP_ E_ TIMEOUT_ T4 0x33 Timeout occurred on transmitter or receiver side while trying to send the next TP.DT or TP.CM frame. J1939TP_ E_ TIMEOUT_ TR 0x34 Timeout occurred on receiver side while trying to send the next TP.CM/ CTS frame after a TP.CM/ CTS(0) frame. J1939TP_ E_ TIMEOUT_ TH 0x35 Invalid value for "total message size" in received TP.CM/ RTS frame. J1939TP_ E_ INVALID_ TMS 0x40 Value for "total number of packe ts" in received TP.CM/ RTS frame does not match the "total message size". J1939TP_ E_ INVALID_ TNOP 0x41 Invalid value for "maximum number of packets" in received TP.CM/ RTS frame. J1939TP_ E_ INVALID_ MNOP 0x42 Unexpected PGN in received TP.CM frame. J1939TP_ E_ INVALID_ PGN 0x43 Invalid value for "number of packets" in received TP.CM/ CTS frame. J1939TP_ E_ INVALID_ NOP 0x44 Invalid value for "next packet number" in received TP.CM/ CTS frame. J1939TP_ E_ INVALID_ NPN 0x45 Invalid value for "connect ion abort reason" in received TP.Conn_ Abort frame. J1939TP_ E_ INVALID_ CAR 0x46 Unexpected serial number in received TP.DT frame. J1939TP_ E_ 0x47 INVALID_ SN

requirement SWS_J1939Tp_00235 [SWS_J1939Tp_00235] 📄 PDF

[SWS_J1939Tp_00235] ⌈The J1939Tp_GetVersionInfo() API shall only be avail- able when J1939TpVersionInfoApi is enabled.⌋

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/CP_MOD_J1939Tp
Status
unspecified
Version
AUTOSAR/AP/record/CP_MOD_J1939Tp@rel:R20-11#8cb36e63
Content hash
8cb36e63
Source
https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_SAEJ1939TransportLayer.pdf#nameddest=SWS_J1939Tp_00087

Inicialização e estado

Returns the version information of J1939Tp.

void J1939Tp_GetVersionInfo(Std_VersionInfoType* VersionInfo);
J1939Tp_Init função

This function initializes the J1939Tp module.

void J1939Tp_Init(const J1939Tp_ConfigType* ConfigPtr);

Serviços

Requests cancellation of an ongoing reception of a PDU in a lower layer transport protocol module.

Std_ReturnType J1939Tp_CancelReceive(PduIdType RxPduId);

Requests cancellation of an ongoing transmission of a PDU in a lower layer communication module.

Std_ReturnType J1939Tp_CancelTransmit(PduIdType TxPduId);

Request to change a specific transport protocol parameter (e.g. block size).

Std_ReturnType J1939Tp_ChangeParameter(PduIdType id, TPParameterType parameter, uint16 value);

This function is used to shutdown the J1939Tp module.

void J1939Tp_Shutdown(void);

Requests transmission of a PDU.

Std_ReturnType J1939Tp_Transmit(PduIdType TxPduId, const PduInfoType* PduInfoPtr);

Callbacks

Indication of a received PDU from a lower layer communication interface module.

void J1939Tp_RxIndication(PduIdType RxPduId, const PduInfoType* PduInfoPtr);

The lower layer communication interface module confirms the transmission of a PDU, or the failure to transmit a PDU.

void J1939Tp_TxConfirmation(PduIdType TxPduId, Std_ReturnType result);

Cíclico

Main function of the J1939Tp. Used for scheduling purposes and timeout supervision.

void J1939Tp_MainFunction(void);

Tipos

Data structure containing post - build configuration data of J1939 - TP.

Requisitos

SWS_J1939Tp_00007 requirement

Internally used data types and functions shall be defined locally in the implementation source files.

SWS_J1939Tp_00030 requirement

The function J1939Tp_Transmit() shall reject the transmit request and return the status value E_NOT_OK if the transmission needs a transport protocol and the channel is occupied (see also 7.5.7 ).

SWS_J1939Tp_00032 requirement

[SWS_J1939Tp_00032] if any of the following conditions occur: • The upper Layer returns the PduR_J1939TpCopyTxData() function call with BUFREQ_E_NOT_OK or • the J1939Tp_CancelTransmit() function is called. In case of a CMDT connection, a CMDT Connection Abort shall be performed as described in [SWS_J1939Tp_00097], and the connection abort reason shall be set to 2 (System resources were needed for another task so this connection managed session was terminated).⌋

SWS_J1939Tp_00039 requirement

[SWS_J1939Tp_00039] ⌈When configured, the transport protocol variant ( BAM/CMDT, see J1939TpTxProtocolType) and the SA/DA (see J1939TpTxSa/ J1939TpTxDa) shall be used for transmission. For N-SDUs with meta data, these parameters are optional. If SA or DA is not configured, the value provided via the meta data shall be used. If the transport protocol is not configured, it shall be chosen based on the actual DA: BAM when DA is 0xFF, CMDT otherwise.⌋

SWS_J1939Tp_00041 requirement

J1939Tp shall send the transport frames TP.CM and TP.DT and direct frames using the service function CanIf_Transmit() .

SWS_J1939Tp_00045 requirement

[SWS_J1939Tp_00045] ⌈The function J1939Tp_Transmit() shall use the TxP- duId and the SduLength provided in the PduInfoType structure. It shall not use the payload of N-SDUs, only the contained meta data.⌋

SWS_J1939Tp_00046 requirement

[SWS_J1939Tp_00046] ⌈For each TP.DT frame to be sent, the J1939Tp module shall previously call PduR_J1939TpCopyTxData() with the following parameters: • the Identifier of the corresponding N-SDU, • PduInfoType structure with up to 7 bytes as SduLength, • the retry parameter, and • a pointer to a location where the upper layer stores its currently available data. ⌋

SWS_J1939Tp_00047 requirement

[SWS_J1939Tp_00047] ⌈After a transmission request from the upper layer, the J1939Tp module shall initiate the transmission by sending: • For CMDT: a TP.CM_RTS frame • For BAM: a TP.CM_BAM frame ⌋

SWS_J1939Tp_00048 requirement

[SWS_J1939Tp_00048] ⌈The J1939Tp module shall abort the transmission session like specified in [SWS_J1939Tp_00032] if any of the following conditions occur: • The upper Layer returns the PduR_J1939TpCopyTxData() function call with BUFREQ_E_NOT_OK or • the J1939Tp_CancelTransmit() function is called. In case of a CMDT connection, a CMDT Connection Abort shall be performed as described in [SWS_J1939Tp_00097], and the connection abort reason shall be set to 2 (System resources were needed for another task so this connection managed session was terminated).⌋

SWS_J1939Tp_00060 requirement

Det _ Report Error Det.h Service to report development errors.

SWS_J1939Tp_00071 requirement

On errors and exceptions, the J1939Tp module shall not modify its current module state (see Figure 7 - 1 : J1939 Transport Layer life cycle ) but shall simply report the error event.

SWS_J1939Tp_00076 requirement

The global state (see SWS_J1939Tp_ 00019 ) shall be used to check if the module has been initialized before calling an API.

SWS_J1939Tp_00094 requirement

[SWS_J1939Tp_00094] ⌈J1939Tp_Shutdown() shall close all pending transport protocol connections, free all resources and set the J1939Tp module into the global state J1939TP_OFF state.⌋

SWS_J1939Tp_00095 requirement

[SWS_J1939Tp_00095] ⌈J1939Tp_Shutdown() shall not raise a notification about the pending frame transmission or reception.⌋

SWS_J1939Tp_00097 requirement

[SWS_J1939Tp_00097], and the connection abort reason shall be set to 2 (System resources were needed for another task so this connection managed session was terminated).⌋

SWS_J1939Tp_00101 requirement

[SWS_J1939Tp_00101] ⌈The function J1939Tp_Transmit() shall reject a request, if the J1939Tp_Transmit() service is called for an N-SDU identifier that is being used in a currently running SAE J1939 Transport Layer session.⌋

SWS_J1939Tp_00106 requirement

[SWS_J1939Tp_00106] ⌈The calling frequency of the function J1939Tp_- MainFunction() is determined by the configuration parameter J1939TpMainFunctionPeriod.⌋

SWS_J1939Tp_00114 requirement

[SWS_J1939Tp_00114] Upstream requirements: SRS_BSW_00333 ⌈The function J1939Tp_TxConfirmation() shall be callable in interrupt context (it could be called from the CAN transmit interrupt).⌋

SWS_J1939Tp_00115 requirement

Type of error Related error code Error value API service used in state J1939TP_ OFF J1939TP_ E_ UNINIT 0x01 J1939Tp_ Init() called in state J1939TP_ ON. J1939TP_ E_ REINIT 0x02 J1939Tp_ Init() was called with an invalid configuration pointer J1939TP_ E_ INIT_ FAILED 0x03 API service called with null pointer. J1939TP_ E_ PARAM_ POINTER 0x10 API service called with wrong ID. J1939TP_ E_ INVALID_ PDU_ SDU_ ID 0x11

SWS_J1939Tp_00116 requirement

Can If _ Transmit Can If.h Requests transmission of a PDU. Det _ Report - Runtime Error Det.h Service to report runtime errors. If a callout has been configured then this callout shall be called. Pdu R _ J1939 - Tp Copy Rx Data Pdu R_ J1939Tp.h This function is called to provide the received data of an I - PDU segment (N - PDU) to the upper layer. Each call to this function provides the next part of the I - PDU data. The size of the remaining buffer is written to the position indicated by buffer Size Ptr. Pdu R _ J1939 - Tp Copy Tx Data Pdu R_ J1939Tp.h This function is called to acquire the transmit data of an I - PDU segment (N - PDU). Each call to this function provides the next part of the I - PDU data unless retry - >Tp Data State is TP_ DA TARETRY. In this case the function restarts to copy the data beginning at the offset from the current position indicated by retry - >Tx Tp Data Cnt. The size of the remaining data is written to the position indicated by available Data Ptr. Pdu R _ J1939 - Tp Rx Indication Pdu R_ J1939Tp.h Called after an I - PDU has been received via the TP API, the result indicates whether the transmission was successful or not. Pdu R _ J1939 - Tp Start Of - Reception Pdu R_ J1939Tp.h This function is called at the start of receiving an N - SDU. The N - SDU might be fragmented into multiple N - PDUs (FF with one or more following CFs) or might consist of a single N - PDU (SF). The service shall provide the currently available maximum buffer siz e when invoked with Tp Sdu Length equal to 0. Pdu R _ J1939 - Tp Tx - Confirmation Pdu R_ J1939Tp.h This function is called after the I - PDU has been transmitted on its network, the result indicates whether the transmission was successful or not.

SWS_J1939Tp_00119 requirement

[SWS_J1939Tp_00119] and [SWS_J1939Tp_00032], the J1939Tp module will notify the upper layer by calling the PduR_J1939TpTxConfirmation() callback when the transmit request has been completed.

SWS_J1939Tp_00123 requirement

J1939Tp shall implement all CMDT related timing constraints ( Tr, Th, T1, T2, T3, T4) as described in [16] . They supervise the CMDT data flow.

SWS_J1939Tp_00157 requirement

[SWS_J1939Tp_00157] ⌈All service interfaces provided to the lower layer shall be independent of the internal communication configuration and implementation of the J1939Tp.⌋(SRS_J1939_00042)

SWS_J1939Tp_00188 requirement

If de velopment error det ection for the J1939Tp is enabled, all APIs using a SDU - or PDU - Identifier shall check the input Identifier and raise the development error: J1939TP_E_INVALID_PDU_SDU_ID in case the API has been called for a not configured PDU or SDU.

SWS_J1939Tp_00192 requirement

After a sequence error, J1939Tp shall abort BAM connections as specified in SWS_J1939Tp_ 00031 .

SWS_J1939Tp_00194 requirement

If J1939Tp Tx RetrySupport is disabled, when the J1939Tp receives a TP.CM_CTS frame requesting already sent data, it shall abort the transmission using the mechanisms described by SWS_J1939Tp_ 00032 and SWS_J1939Tp_ 00097 with reason 25 5 ( unassigned ).

SWS_J1939Tp_00195 requirement

If a TP.CM_CTS wait frame (number of packets set to 0, see also [16] ) is received, the J1939Tp shall wait for another TP.CM_CTS frame.

SWS_J1939Tp_00198 requirement

The J1939 Transport Layer shall use meta data items of type SOURCE_ADDRESS_16, TARGET_ADDRESS_16, and PRIORITY_8 of all N - SDUs, and meta data items of type CAN_ID_32 for all N - PDUs.

SWS_J1939Tp_00199 requirement

During transmission, the relevant set of N - PDUs is identified by the configured SA/DA of N - SDUs without MetaData, or by the SA/DA explicitly provided in the MetaData by the upper layer.

SWS_J1939Tp_00200 requirement

The J1939 Transport Layer module shall send TP.DT frames always with 8 bytes according to [16] .

SWS_J1939Tp_00203 requirement

J1939Tp_Cancel Transmit shall return E_NOT_OK if ‘ Tx P duId ’ is invalid, if ‘ Tx P duId ’ is currently not active, if currently a direct frame is transmitted, if the last TP.DT frame has already been transmitted during BAM transmission, or if the TP.CM_EOMAck frame has already been received during CMDT transmission .

SWS_J1939Tp_00204 requirement

J1939Tp_CancelReceive shall return E_NOT_OK if ‘ Rx P duId ’ is invalid, if ‘ Rx P duId ’ is currently not active, if currently a direct frame is received, if the last TP.DT frame has already been received during BAM reception, or if the TP.CM_EOMAck frame has already been sent during CMDT reception .

SWS_J1939Tp_00206 requirement

[SWS_J1939Tp_00206] ⌈J1939Tp_ChangeParameter() shall return E_NOT_OK if id is invalid, if parameter is not TP_BS, or if value is larger than 255.⌋()

SWS_J1939Tp_00214 requirement

The J1939Tp_CancelTransmit API shall only be available when J1939TpCancellationSupport is enabled.

SWS_J1939Tp_00215 requirement

The J1939Tp_CancelReceive API shall only be available when J1939TpCancellationSupport is enabled.

SWS_J1939Tp_00216 requirement

If J1939Tp Rx RetrySupport is disabled, when a sequence error occurs during reception , the J1939Tp module shall abort the reception session - as specified in SWS_J1939Tp_ 00031 and - as specified in SWS_J1939Tp_ 00097 with connection abort reason FF 16 (SNA).

SWS_J1939Tp_00217 requirement

If J1939Tp Tx RetrySupport is enabled , the J1939Tp shall call PduR_J1939TpCopyTxData with - TpDataState set to TP_DATACONF for the first call after reception of a TP.CM_CTS, and - TpDataState set to TP_CONFPENDING for the following calls .

SWS_J1939Tp_00218 requirement

If J1939Tp Tx RetrySupport is disabled, the parameter retry of PduR_J1939TpCopyTxData shall allways be set to the NULL_PTR .

SWS_J1939Tp_00219 requirement

[SWS_J1939Tp_00219] ⌈For BAM transmissions, the parameter retry of PduR_- J1939TpCopyTxData() shall always be set to the NULL_PTR.⌋

SWS_J1939Tp_00220 requirement

If J1939Tp Tx RetrySupport is enabled, a valid RetryInfoType stuct shall be provided via the parameter retry of PduR_J1939TpCopyTxData during CMDT transmission s .

SWS_J1939Tp_00222 requirement

If J1939Tp Rx RetrySupport is enabled, when a sequence error occurs during reception, the J1939Tp module shall , after the last TP.DT message of the block was received, send a TP.CM_CTS frame requesting the package s that follow the last correctly received package of the current block .

SWS_J1939Tp_00223 requirement

When the J1939Tp receives a TP.CM_CTS frame that requests data beyond the current position or preceding the position where the last TP.CM_CTS was received, it shall abort the transmission using the mechanisms described by SWS_J1939Tp_ 00032 and SWS_J1939Tp_ 00097 with reason FF 16 (SNA).

SWS_J1939Tp_00228 requirement

When PduR_J1939TpCopyTxData returns BUFREQ_E_BUSY , the J1939Tp shall retry the call to PduR_J1939TpCopyTxData until the data is available or a timeout occurs.

SWS_J1939Tp_00230 requirement

Module Header File Imported Type Com Stack_ Types Com Stack_ Types.h Buf Req _ Return Type Com Stack_ Types.h Pdu Id Type Com Stack_ Types.h Pdu Info Type Com Stack_ Types.h Pdu Length Type Com Stack_ Types.h Retry Info Type Com Stack_ Types.h T P Parameter Type Com Stack_ Types.h Tp Data State Type Std Std_ Types.h Std _ Return Type Std_ Types.h Std _ Version Info Type

SWS_J1939Tp_00231 requirement

The J1939 Transport Layer module shall support several connections for the same PGN in parallel a s long as they can be received or transmitted independently.

SWS_J1939Tp_00232 requirement

The content of a TP.DT message with a sequence error and of the TP.DT messages following a sequence error in the same block shall be discarded.

SWS_J1939Tp_00233 requirement

If several receiving connections are configured with identical PGNs and matching channel parameters, the J1939Tp shall allocate an arbitrary free connection with matching parameters.

SWS_J1939Tp_00234 requirement

Type of error Related error code Error value Timeout occurred on receiver side after reception of an intermediate TP.DT frame of a block. J1939TP_ E_ TIMEOUT _ T1 0x30 Timeout occurred on receiver side after transmission of a TP.CM/ CTS frame. J1939TP_ E_ TIMEOUT_ T2 0x31 Timeout occurred on transmitter side after transmission of the last TP.DT frame of a block. J1939TP_ E_ TIMEOUT_ T3 0x32 Timeout occurred on transmitter side after reception of a TP.CM/ CTS(0) frame. J1939TP_ E_ TIMEOUT_ T4 0x33 Timeout occurred on transmitter or receiver side while trying to send the next TP.DT or TP.CM frame. J1939TP_ E_ TIMEOUT_ TR 0x34 Timeout occurred on receiver side while trying to send the next TP.CM/ CTS frame after a TP.CM/ CTS(0) frame. J1939TP_ E_ TIMEOUT_ TH 0x35 Invalid value for "total message size" in received TP.CM/ RTS frame. J1939TP_ E_ INVALID_ TMS 0x40 Value for "total number of packe ts" in received TP.CM/ RTS frame does not match the "total message size". J1939TP_ E_ INVALID_ TNOP 0x41 Invalid value for "maximum number of packets" in received TP.CM/ RTS frame. J1939TP_ E_ INVALID_ MNOP 0x42 Unexpected PGN in received TP.CM frame. J1939TP_ E_ INVALID_ PGN 0x43 Invalid value for "number of packets" in received TP.CM/ CTS frame. J1939TP_ E_ INVALID_ NOP 0x44 Invalid value for "next packet number" in received TP.CM/ CTS frame. J1939TP_ E_ INVALID_ NPN 0x45 Invalid value for "connect ion abort reason" in received TP.Conn_ Abort frame. J1939TP_ E_ INVALID_ CAR 0x46 Unexpected serial number in received TP.DT frame. J1939TP_ E_ 0x47 INVALID_ SN

SWS_J1939Tp_00235 requirement

[SWS_J1939Tp_00235] ⌈The J1939Tp_GetVersionInfo() API shall only be avail- able when J1939TpVersionInfoApi is enabled.⌋