STM32Cube Expansion Pack CAN Stack
API function definitions for CAN Interface Module

Functions used in the API. More...

Collaboration diagram for API function definitions for CAN Interface Module:

Macros

#define CANIF_INIT_ID   (0x01)
 service ID of CanIf::Init()
 

Functions

Std_ReturnType CanIf::Init (void)
 init of the CanIf module More...
 
Std_ReturnType CanIf::Start (void)
 all init of the CanIf module is done More...
 
Std_ReturnType CanIf::Transmit (CanIf_TxPduIdType txPduId, const CanIf_PduInfoType *ptr2PduInfo)
 Requests transmission of a PDU using the Tx software Buffer. More...
 
Std_ReturnType CanIf::Transmit (ComStack_PduType txPduId, const ComStack_PduInfoType *ptr2PduInfo)
 Requests transmission of a PDU using the Tx software Buffer. More...
 
Std_ReturnType CanIf::Transmit (ComStack_CanMsgHeader msgHeader, const uint8_t *ptr2Data)
 Requests transmission of a PDU using the Tx software Buffer. More...
 
Std_ReturnType CanIf::Receive (CanIf_RxPduIdType rxPduId, const CanIf_PduInfoType *ptr2PduInfo)
 poll the RxBuffer for a message More...
 
Std_ReturnType CanIf::Receive (ComStack_PduType rxPduId, const ComStack_PduInfoType *ptr2PduInfo)
 poll the RxBuffer for a message More...
 
Std_ReturnType CanIf::Receive (REF2VAR(ComStack_CanMsgHeader, AUTOMATIC) msgHeader, const uint8_t *ptr2Data)
 poll the RxBuffer for a message More...
 
Std_ReturnType CanIf::ConnectUpperLayerIndication (ComStack_PduType rxPduId, const CanIfUpperLayer *p2UpperLayerObject)
 we need to know the connected upper layer object for rx indication More...
 
ComStack_PduType CanIf::GetIfRxPduName (CanIf_UpperLayerType upperLayerName, ComStack_PduType rxPduId)
 to get the CanIf_RxPduIdType name
 
ComStack_PduType CanIf::GetIfTxPduName (CanIf_UpperLayerType upperLayerName, ComStack_PduType txPduId)
 to get the CanIf_TxPduIdType name
 

Detailed Description

Functions used in the API.

Function Documentation

◆ ConnectUpperLayerIndication()

Std_ReturnType CanIf::ConnectUpperLayerIndication ( ComStack_PduType  rxPduId,
const CanIfUpperLayer p2UpperLayerObject 
)
virtual

we need to know the connected upper layer object for rx indication

maybe we solve this in a static way on code generation later

Parameters
[in]rxPduIdto name the rx pdu
[in]p2UpperLayerObjectto give the pointer to the object

Implements ComIf.

Definition at line 320 of file CanIf.cpp.

References E_NOT_OK, E_OK, NULL_PTR, and CanIf::p2UpperLayerList.

◆ Init()

Std_ReturnType CanIf::Init ( void  )

init of the CanIf module

This will start the hardware modules

See also
CANIF_INIT_ID

try to setup HW filter

try to setup HW filter

Todo:
MyTest_RxPduConfig[InitPdu].N_PDU_Name -->> muss noch zu geordnet werden !!!

Definition at line 83 of file CanIf.cpp.

References CANIF_DET_REPORTERROR, CANIF_EXTID, CANIF_INIT_ID, CS_Started, E_INIT_FAILED, E_NOT_OK, E_OK, E_SETUP_FAILED, HwInit, Can::Init(), NULL_PTR, CanIf::ptr2CanDriver, Can::SetControllerMode(), Can::SetFilterByBitmask(), Can::SetFilterByCanId(), CanIf::state, and CanIf::txHeaderList.

Here is the call graph for this function:

◆ Receive() [1/3]

Std_ReturnType CanIf::Receive ( CanIf_RxPduIdType  rxPduId,
const CanIf_PduInfoType ptr2PduInfo 
)

poll the RxBuffer for a message

This function looks if there is an message inside the buffer by checking the PDU name

This is the AUTOSAR like function CanIf_ReadRxPduData

Parameters
[in]rxPduIdsearch for the PDU by using the CanIf_RxPduIdType
[out]ptr2PduInfoto return the data
Todo:
this is a fix not save implementation
Todo:
we need some work here -> CanIf::Receive( CONST(CanIf_RxPduIdType,AUTOMATIC) rxPduId, P2VAR(CanIf_PduInfoType, AUTOMATIC, AUTOMATIC) ptr2PduInfo)

Definition at line 275 of file CanIf.cpp.

References E_NOT_OK.

Referenced by CanIf::Receive().

◆ Receive() [2/3]

Std_ReturnType CanIf::Receive ( ComStack_PduType  rxPduId,
const ComStack_PduInfoType ptr2PduInfo 
)
virtual

poll the RxBuffer for a message

This function remaps the pure virtual function coming from the ComIf class

This is the AUTOSAR like function CanIf_ReadRxPduData

Parameters
[in]rxPduIdsearch for the PDU by using the CanIf_RxPduIdType
[out]ptr2PduInfoto return the data

Implements ComIf.

Definition at line 251 of file CanIf.cpp.

References CanIf::Receive().

Here is the call graph for this function:

◆ Receive() [3/3]

Std_ReturnType CanIf::Receive ( REF2VAR(ComStack_CanMsgHeader, AUTOMATIC msgHeader,
const uint8_t *  ptr2Data 
)

poll the RxBuffer for a message

This function looks if there is an message inside the buffer with the requested CAN ID (including IDE & RTR)

Parameters
[in,out]msgHeaderwe need the CanId to look for the message
[out]ptr2Datapointer to return the data -> we need a C++ save way
Todo:
this is a fix not save implementation
Todo:
we need some work here -> CanIf::Receive( REF2VAR(ComStack_CanMsgHeader, AUTOMATIC ) msgHeader, P2VAR(uint8_t, AUTOMATIC, AUTOMATIC) ptr2Data )

Definition at line 260 of file CanIf.cpp.

References E_NOT_OK.

◆ Start()

Std_ReturnType CanIf::Start ( void  )

all init of the CanIf module is done

This will start the interface modules

Definition at line 169 of file CanIf.cpp.

References E_NOT_OK, E_OK, Ready, and CanIf::state.

◆ Transmit() [1/3]

Std_ReturnType CanIf::Transmit ( CanIf_TxPduIdType  txPduId,
const CanIf_PduInfoType ptr2PduInfo 
)

Requests transmission of a PDU using the Tx software Buffer.

returns E_NOT_OK if SW buffer full
this function is the AUTOSAR like transmit function

Parameters
[in]txPduIdname the Pdu to transmit
[in]ptr2PduInfopointer to the data to transmit
Returns
Std_ReturnType
Todo:
we should rework to select the CAN Channel by using PDU IDs

Definition at line 210 of file CanIf.cpp.

References ComStack_CanMsgHeader::CanId, ComStack_CanMessageType::CanMsgHeader, ComStack_CanMsgHeader::DLC, E_NOT_OK, CanIf::ptr2CanDriver, ComStack_CanMessageType::ptr2Data, Ready, CanIf::state, and Can::Write().

Referenced by CanIf::Transmit(), and CanFT2p0::TxIndication().

Here is the call graph for this function:

◆ Transmit() [2/3]

Std_ReturnType CanIf::Transmit ( ComStack_CanMsgHeader  msgHeader,
const uint8_t *  ptr2Data 
)

Requests transmission of a PDU using the Tx software Buffer.

this function is we send messages without a transport protocol, maybe for test messages

returns E_NOT_OK if SW buffer full

Parameters
[in]msgHeaderHeader for the CAN message handling
[in]ptr2Datapointer to the data to transmit
Returns
Std_ReturnType

Definition at line 196 of file CanIf.cpp.

References E_NOT_OK, CanIf::ptr2CanDriver, Ready, CanIf::state, and Can::Write().

Here is the call graph for this function:

◆ Transmit() [3/3]

Std_ReturnType CanIf::Transmit ( ComStack_PduType  txPduId,
const ComStack_PduInfoType ptr2PduInfo 
)
virtual

Requests transmission of a PDU using the Tx software Buffer.

returns E_NOT_OK if SW buffer full
This function remaps the pure virtual function coming from the ComIf class

Parameters
[in]txPduIdname the Pdu to transmit
[in]ptr2PduInfopointer to the data to transmit
Returns
Std_ReturnType
Todo:
we should rework to select the CAN Channel by using PDU IDs

Implements ComIf.

Definition at line 188 of file CanIf.cpp.

References CanIf::Transmit().

Here is the call graph for this function: