CAN Transport Layer (CanTp)
Provides segmentation and reassembly of CAN messages up to 4095 bytes (ISO 15765-2).
Funktionen — Übersicht
void CanTp_Init (const CanTp_ConfigType* CfgPtr);This function initializes the Can Tp module.void CanTp_GetVersionInfo (Std_VersionInfoType* versioninfo);This function returns the version information of the Can Tp module.void CanTp_Shutdown (void);This function is called to shutdown the Can Tp module.Std_ReturnType CanTp_Transmit (PduIdType TxPduId, const PduInfoType* PduInfoPtr);Requests transmission of a PDU.Std_ReturnType CanTp_CancelTransmit (PduIdType TxPduId);Requests cancellation of an ongoing transmission of a PDU in a lower layer communication module.Std_ReturnType CanTp_CancelReceive (PduIdType RxPduId);Requests cancellation of an ongoing reception of a PDU in a lower layer transport protocol module.Std_ReturnType CanTp_ChangeParameter (PduIdType id, TPParameterType parameter, uint16 value);Request to change a specific transport protocol parameter (e.Std_ReturnType CanTp_ReadParameter (PduIdType id, TPParameterType parameter, uint16* value);This service is used to read the current value of reception parameters BS and STmin for a specified N - SDU.void CanTp_MainFunction (void);The main function for scheduling the CAN TP.void CanTp_RxIndication (PduIdType RxPduId, const PduInfoType* PduInfoPtr);Indication of a received PDU from a lower layer communication interface module.void CanTp_TxConfirmation (PduIdType TxPduId, Std_ReturnType result);The lower layer communication interface module confirms the transmission of a PDU, or the failure to transmit a PDU.
Typen — Übersicht
struct CanTp_ConfigTypeData structure type for the post - build configuration parameters.
Funktionen & Typen — Detailansicht
function CanTp_Init [SWS_CanTp_00208] 📄 PDF
void CanTp_Init (const CanTp_ConfigType* CfgPtr);
This function initializes the Can Tp module.
The synchronous and non-reentrant function CanTp_Init initializes the CanTp module [SWS_CanTp_00208]. Via the parameter CfgPtr, it takes a pointer to the post-build configuration data (CanTp_ConfigType) and has no return value [SWS_CanTp_00208]. The module environment must call CanTp_Init before the module can be used for further processing [SWS_CanTp_00199].
During initialization, all global variables of the module are initialized and all transport protocol connections are set to a sub-state of CANTP_ON in which neither segmented transmission nor segmented reception is active [SWS_CanTp_00030]. In this process, the receive paths are in the state CANTP_RX_WAIT and the transmit paths are in the state CANTP_TX_WAIT [SWS_CanTp_00030]. After successful execution, the module transitions to the internal state CANTP_ON [SWS_CanTp_00170].
If CanTp_Init is called when the module is already in the global state CANTP_ON, the function resets the module to the Idle state so that neither transmission nor reception operations are running [SWS_CanTp_00111].
If Development Error Detection is enabled, the CanTp module reports the error CANTP_E_UNINIT if the PDU Router or the CAN Interface attempts to execute functions of the module (with the exception of CanTp_GetVersionInfo) prior to the call to CanTp_Init [SWS_CanTp_00031].
This text was generated by an AI based on the specification.
Implementer's Guide to follow (complexity I2)
function CanTp_GetVersionInfo [SWS_CanTp_00210] 📄 PDF
void CanTp_GetVersionInfo (Std_VersionInfoType* versioninfo);
This function returns the version information of the Can Tp module.
function CanTp_Shutdown [SWS_CanTp_00211] 📄 PDF
void CanTp_Shutdown (void);
This function is called to shutdown the Can Tp module.
Usage and Call Context
Function CanTp_Shutdown serves to shut down the entire CanTp module in an orderly manner ([SWS_CanTp_00211]). The interface is provided via header file CanTp.h and has service ID 0x02 ([SWS_CanTp_00211]). The call is processed synchronously, takes no input parameters, and returns no return value ([SWS_CanTp_00211]).
State Transition and Cleanup
Upon execution, CanTp_Shutdown closes all still-pending transport protocol connections, frees all allocated resources, and transitions the CanTp module into state CANTP_OFF ([SWS_CanTp_00202]). An essential aspect of the abort behavior is that explicitly no notification whatsoever may be triggered to upper layers for pending frame transmissions or frame reception processes ([SWS_CanTp_00200]).
Concurrency and Constraints
The function is specified as non-reentrant (Non Reentrant) ([SWS_CanTp_00211]). Consequently, it must not be called simultaneously from different execution contexts or interrupt routines. Specific error codes or notifications to error management are not defined in the scope of the interface.
This usage note was created automatically based on the specification AUTOSAR Classic Release R20-11.
Implementer's Guide to follow (complexity I1)
function CanTp_Transmit [SWS_CanTp_00212] 📄 PDF
Std_ReturnType CanTp_Transmit (PduIdType TxPduId, const PduInfoType* PduInfoPtr);
Requests transmission of a PDU.
use
The function CanTp_Transmit serves to request the transmission of an N-SDU via the CAN transport layer [SWS_CanTp_00212]. The identifier of the PDU to be transmitted (TxPduId) as well as a pointer to data, length, and metadata (PduInfoPtr) are passed as parameters [SWS_CanTp_00212]. The call reports back with E_OK the successful acceptance or with E_NOT_OK the rejection of the request [SWS_CanTp_00212]. While the call is acknowledged synchronously, the handling of the transmission is asynchronous [SWS_CanTp_00176] (Interpretation: The indication "Synchronous" in the specification table is likely to refer to the acceptance of the request). Question Q-df438ddaa4963aba (open)
Interaction and PDU Processing
For N-SDUs with metadata, the module stores the address information (depending on the addressing format such as Normal, Extended, Mixed 11 bit, Normal fixed, or Mixed 29 bit) in order to use it for SF, FF, and CF N-PDUs as well as for identifying FC N-PDUs [SWS_CanTp_00334]. If no metadata is used, CanTp_Transmit accesses only the length specification SduLength to prepare the SF or FF PCI and does not use the N-SDU data buffer [SWS_CanTp_00225].
Error Handling and Concurrency
- Error checking: If DET is enabled and
PduInfoPtris aNULLpointer, the function reports the errorCANTP_E_PARAM_POINTERand returns without further action [SWS_CanTp_00321]. - Channel occupancy: If the assigned channel is in the
CANTP_TX_PROCESSINGstate or a session is already running for the N-SDU identifier, the transmission request is rejected andE_NOT_OKis returned [SWS_CanTp_00123], [SWS_CanTp_00206]. - Reentrancy: The service is reentrant for different PDU IDs, but not reentrant for the same PDU ID [SWS_CanTp_00212].
This text was generated by an AI based on the specification AUTOSAR Classic R20-11.
Implementer's Guide to follow (complexity I2)
function CanTp_CancelTransmit [SWS_CanTp_00246] 📄 PDF
Std_ReturnType CanTp_CancelTransmit (PduIdType TxPduId);
Requests cancellation of an ongoing transmission of a PDU in a lower layer communication module.
The synchronous function CanTp_CancelTransmit requests the cancellation of an ongoing PDU transmission in a lower-layer communication module [SWS_CanTp_00246], thereby initiating the cancellation of the transmission process [SWS_CanTp_00274]. The identifier of the affected PDU (TxPduId) is passed as a parameter [SWS_CanTp_00246]. As the return value, E_OK signals successful execution of the cancellation by the target module, while E_NOT_OK indicates rejection [SWS_CanTp_00246].
After the function call, the transmission on the affected connection is cancelled [SWS_CanTp_00243]. If the cancellation was executed successfully, the module CanTp is required to call the confirmation PduR_CanTpTxConfirmation with the negative result E_NOT_OK in order to inform the upper layers about the cancellation [SWS_CanTp_00255].
With Development Error Detection enabled, CanTp_CancelTransmit checks the validity of TxPduId: in case of an invalid parameter, the development error CANTP_E_PARAM_ID is generated and E_NOT_OK is returned [SWS_CanTp_00254]. If cancellation is requested for an N-SDU that is not currently in the transmission process, the module reports the runtime error CANTP_E_OPER_NOT_SUPPORTED to the Default Error Tracer (DET) and likewise returns E_NOT_OK [SWS_CanTp_00254].
Regarding concurrency, the function is reentrant for different PDU-IDs, but must not be called concurrently for the same TxPduId [SWS_CanTp_00246].
This usage note was generated automatically based on the AUTOSAR specification.
Implementer's Guide to follow (complexity I2)
function CanTp_CancelReceive [SWS_CanTp_00257] 📄 PDF
Std_ReturnType CanTp_CancelReceive (PduIdType RxPduId);
Requests cancellation of an ongoing reception of a PDU in a lower layer transport protocol module.
The function CanTp_CancelReceive synchronously aborts the ongoing reception of a PDU in a lower-layer transport protocol module [SWS_CanTp_00257]. It is available via the header file CanTp.h and has the service ID 0x4c [SWS_CanTp_00257].
Usage and Call Conditions
The identifier of the PDU to be cancelled is passed via the input parameter RxPduId [SWS_CanTp_00257]. The call is processed synchronously and is specified as non-reentrant (Non Reentrant) [SWS_CanTp_00257]. As return value, the interface of type Std_ReturnType provides:
E_OK: The cancellation was successfully executed by the target module [SWS_CanTp_00257].E_NOT_OK: The cancellation was rejected by the target module [SWS_CanTp_00257].
Error handling
With Development Error Detection enabled, the function validates the parameter RxPduId [SWS_CanTp_00260]:
- If the value of
RxPduIdis invalid,CanTp_CancelReceivereports the development errorCANTP_E_PARAM_IDand returnsE_NOT_OK[SWS_CanTp_00260]. - If a cancellation is requested for an N-SDU that is not currently in an ongoing reception process, the module reports the runtime error
CANTP_E_OPER_NOT_SUPPORTEDto the Default Error Tracer and returnsE_NOT_OK[SWS_CanTp_00260].
Interaction with Neighboring Modules
If the reception cancellation was executed successfully, CanTp calls the callback function PduR_CanTpRxIndication with the notification result E_NOT_OK to inform the upper layer about the cancellation [SWS_CanTp_00263].
This usage note is based on the AUTOSAR Classic R20-11 specification and was generated automatically.
Implementer's Guide to follow (complexity I1)
function CanTp_ChangeParameter [SWS_CanTp_00302] 📄 PDF
Std_ReturnType CanTp_ChangeParameter (PduIdType id, TPParameterType parameter, uint16 value);
Request to change a specific transport protocol parameter (e.g. block size).
The synchronous function CanTp_ChangeParameter is used to change a specific transport protocol parameter, such as the block size ([SWS_CanTp_00302]), at runtime. Provided via the header file CanTp.h, the service takes the PDU identifier (id), the identifier of the parameter (parameter), and the new value to be set (value) ([SWS_CanTp_00302]). Upon successful execution, the function returns E_OK; if the change fails or is rejected, it returns E_NOT_OK ([SWS_CanTp_00302]).
Regarding concurrency and call conditions, the following requirements apply:
- The interface is designed as non-reentrant (Non Reentrant) ([SWS_CanTp_00302]).
- If the affected N-SDU is already in an ongoing reception process at the time of the call,
CanTp_ChangeParameteraborts immediately, returnsE_NOT_OK, and does not change the parameter value ([SWS_CanTp_00304]).
A special interaction exists for generic connections: if the function is called for an N-SDU with MetaData, the parameter change is applied to all generic connections and adopted for all subsequent reception operations ([SWS_CanTp_00338]).
This usage note was generated automatically based on the specification requirements.
Implementer's Guide to follow (complexity I1)
function CanTp_ReadParameter [SWS_CanTp_00323] 📄 PDF
Std_ReturnType CanTp_ReadParameter (PduIdType id, TPParameterType parameter, uint16* value);
This service is used to read the current value of reception parameters BS and STmin for a specified N - SDU.
use
The synchronous function CanTp_ReadParameter is used to read out the current value of the reception parameters BS (Block Size) or STmin (Separation Time minimum) for a specified receive N-SDU [SWS_CanTp_00323]. The declaration is available via the header file CanTp.h [SWS_CanTp_00323].
The interface has the following parameters:
id(in): Identifier of the received N-SDU (typePduIdType) for which the reception parameter is read [SWS_CanTp_00323].parameter(in): Determines the parameter to be read (BSorSTminof typeTPParameterType) [SWS_CanTp_00323].value(out): Pointer touint16via which the read parameter value is provided [SWS_CanTp_00323].
As return value, the function provides Std_ReturnType; here, E_OK indicates acceptance of the request and E_NOT_OK rejection [SWS_CanTp_00323].
Error handling
If Development Error Detection is enabled, CanTp_ReadParameter checks the validity of parameters id and parameter [SWS_CanTp_00324]. If one of these parameters is invalid, the function reports the development error CANTP_E_PARAM_ID and returns E_NOT_OK [SWS_CanTp_00324].
Concurrency and Limitations
The function is specified as non-reentrant (Non Reentrant) [SWS_CanTp_00323]. Callers must avoid concurrent accesses to the same interface.
This text was generated by an AI based on the AUTOSAR R20-11 specification documents.
Implementer's Guide to follow (complexity I1)
function CanTp_MainFunction [SWS_CanTp_00213] 📄 PDF
void CanTp_MainFunction (void);
The main function for scheduling the CAN TP.
The function CanTp_MainFunction serves as the central entry point for the periodic scheduling of the CAN Transport Protocol (CAN TP) [SWS_CanTp_00213], [SWS_CanTp_00164]. It has the service ID 0x06, has the signature void CanTp_MainFunction(void), and is available via the header SchM_CanTp.h [SWS_CanTp_00213]. It takes no parameters and returns no return value [SWS_CanTp_00213].
Call Context and Timing Control
Depending on the required period, the call is initiated either by the Schedule Manager or by the Free Running Timer module [SWS_CanTp_00164]. Within the module, CanTp_MainFunction handles the timing supervision and control of the protocol sequences [SWS_CanTp_00164]. Specifically, the function is involved in handling the following timers and timing conditions:
- The protocol timeouts for transmission and confirmation:
N_As,N_Bs,N_Csas well asN_Ar,N_Br, andN_Cr[SWS_CanTp_00164]. - Compliance with the minimum frame separation time
STMmin[SWS_CanTp_00164].
Error Handling and Concurrency
Specific error codes for DET or DEM are not defined for this function in the payload. Interpretation: As a cyclically called scheduling function, CanTp_MainFunction is likely non-reentrant and requires a consistent call rate to ensure correct decrementing of the internal timers. Question Q-2fe22e31085abf49 (open)
This text was generated by an AI based on the AUTOSAR specification R20-11.
Implementer's Guide to follow (complexity I1)
function CanTp_RxIndication [SWS_CanTp_00214] 📄 PDF
void CanTp_RxIndication (PduIdType RxPduId, const PduInfoType* PduInfoPtr);
Indication of a received PDU from a lower layer communication interface module.
Usage and Semantics
The synchronous function [SWS_CanTp_00214] reports the reception of an N-PDU by an underlying communication interface module to the CAN transport module. The call passes the identification of the received PDU (RxPduId) and, via pointer PduInfoPtr, the length (SduLength), payload (SduDataPtr), and associated metadata. The function has no return value.
Concurrency and Call Context
The function is reentrant for different PDU IDs, but not reentrant for the same PDU ID [SWS_CanTp_00214]. CanTp_RxIndication may be called in interrupt context, for example directly from the CAN receive interrupt [SWS_CanTp_00235].
Interaction for Generic Connections
When called for Single Frames (SF) or First Frames (FF) with metadata, CanTp stores the contained address information (such as N_SA and N_TA in normal fixed or mixed 29-bit addressing). This information is used for connection establishment to the upper layer, for transmitting Flow Control frames (FC), and for detecting Consecutive Frames (CF) [SWS_CanTp_00330]. For subsequent CF and received FC frames, CanTp checks the address data of the metadata against the stored values [SWS_CanTp_00333], [SWS_CanTp_00336].
Error Handling and Padding
If DET is enabled and PduInfoPtr is a NULL pointer, the function reports error CANTP_E_PARAM_POINTER and returns without action [SWS_CanTp_00322]. If padding verification is enabled for frames with a payload of up to 8 bytes (CanTpRxPaddingActivation or CanTpTxPaddingActivation equal to CANTP_ON), runtime error CANTP_E_PADDING is reported to the DET in case of length errors:
- An SF with
SduLength < 8is rejected [SWS_CanTp_00345]. - A last CF with
SduLength != 8aborts the ongoing reception viaPduR_CanTpRxIndication()withE_NOT_OK[SWS_CanTp_00346]. - A received FC with
SduLength < 8aborts the ongoing transmission viaPduR_CanTpTxConfirmation()withE_NOT_OK[SWS_CanTp_00349].
This text was generated by an AI and serves as guidance. The AUTOSAR specification is authoritative.
Implementer's Guide to follow (complexity I2)
function CanTp_TxConfirmation [SWS_CanTp_00215] 📄 PDF
void CanTp_TxConfirmation (PduIdType TxPduId, Std_ReturnType result);
The lower layer communication interface module confirms the transmission of a PDU, or the failure to transmit a PDU.
The CanTp module provides the synchronous callback function CanTp_TxConfirmation (service ID 0x40) via header CanTp.h to accept confirmation calls for transmitted PDUs [SWS_CanTp_00076] [SWS_CanTp_00215]. Via this interface, the underlying communication interface module reports the successful transmission or failure of a PDU transmission [SWS_CanTp_00215].
Parameters and Return Values
The function returns no return value (void) and expects two input parameters [SWS_CanTp_00215]:
TxPduId: ID of the transmitted PDU [SWS_CanTp_00215].result: Transmission status. ValueE_OKconfirms successful transmission, whereasE_NOT_OKsignals failure of the PDU transmission [SWS_CanTp_00215].
Error handling
If CanTp_TxConfirmation is called with result value E_NOT_OK, the CanTp module aborts the associated transmission session [SWS_CanTp_00355].
Concurrency and Execution Context
Regarding concurrency, the function is reentrant for different PDU IDs, but not reentrant for the same PDU ID [SWS_CanTp_00215]. It must be callable in interrupt context and may be called, for example, directly from the CAN transmit interrupt [SWS_CanTp_00236].
This usage note was generated automatically based on the specification of AUTOSAR Classic Release R20-11.
Implementer's Guide to follow (complexity I2)
type CanTp_ConfigType [SWS_CanTp_00340] 📄 PDF
Data structure type for the post - build configuration parameters.
Request a governed re-review of this record. The record is not changed immediately.
- Record
AUTOSAR/AP/record/CP_MOD_CanTp- Status
- unspecified
- Version
AUTOSAR/AP/record/CP_MOD_CanTp@rel:R20-11#358cc7cc- Content hash
358cc7cc- Source
- https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_CANTransportLayer.pdf#nameddest=SWS_CanTp_00208
gemini-3.8-flash-low· 2026-10-13 · German original