STM32Cube Expansion Pack CAN Stack
CanIf Class Reference

the class to work on the CAN controller interface More...

#include <CanIf.h>

Inheritance diagram for CanIf:
Collaboration diagram for CanIf:

Public Member Functions

 CanIf ()
 
 ~CanIf ()
 
Std_ReturnType Init (void)
 init of the CanIf module More...
 
Std_ReturnType Start (void)
 all init of the CanIf module is done More...
 
Std_ReturnType Transmit (CanIf_TxPduIdType txPduId, const CanIf_PduInfoType *ptr2PduInfo)
 Requests transmission of a PDU using the Tx software Buffer. More...
 
Std_ReturnType Transmit (ComStack_PduType txPduId, const ComStack_PduInfoType *ptr2PduInfo)
 Requests transmission of a PDU using the Tx software Buffer. More...
 
Std_ReturnType Transmit (ComStack_CanMsgHeader msgHeader, const uint8_t *ptr2Data)
 Requests transmission of a PDU using the Tx software Buffer. More...
 
Std_ReturnType Receive (CanIf_RxPduIdType rxPduId, const CanIf_PduInfoType *ptr2PduInfo)
 poll the RxBuffer for a message More...
 
Std_ReturnType Receive (ComStack_PduType rxPduId, const ComStack_PduInfoType *ptr2PduInfo)
 poll the RxBuffer for a message More...
 
Std_ReturnType Receive (REF2VAR(ComStack_CanMsgHeader, AUTOMATIC) msgHeader, const uint8_t *ptr2Data)
 poll the RxBuffer for a message More...
 
Std_ReturnType ConnectUpperLayerIndication (ComStack_PduType rxPduId, const CanIfUpperLayer *p2UpperLayerObject)
 we need to know the connected upper layer object for rx indication More...
 
ComStack_PduType GetIfRxPduName (CanIf_UpperLayerType upperLayerName, ComStack_PduType rxPduId)
 to get the CanIf_RxPduIdType name
 
ComStack_PduType GetIfTxPduName (CanIf_UpperLayerType upperLayerName, ComStack_PduType txPduId)
 to get the CanIf_TxPduIdType name
 
void TxTask (void)
 task function to push the tx message from software buffer to tx mailbox
 
void RxIndication (ECU_CanController Controller, REF2CONST(ComStack_CanMsgHeader, AUTOMATIC) CanMsgHeader, REF2CONST(ComStack_PduInfoType, AUTOMATIC) PduInfo)
 
- Public Member Functions inherited from TME_VersionInfo
 TME_VersionInfo (uint16_t Module, uint16_t Version, uint16_t Patch)
 constructor to set version Ids
 
 TME_VersionInfo (uint16_t Vendor, uint16_t Module, uint16_t Version, uint16_t Patch)
 constructor to set version Ids including the vendor
 
 TME_VersionInfo (const TME_VersionInfo &other)
 copy constructor
 
Std_ReturnType GetVersionInfo (uint32_t BufferLength, const uint8_t *Ptr2Buffer)
 Copies the VersionIinfo to a 8byte buffer. More...
 
- Public Member Functions inherited from ComIf
 ComIf (ComInterfaceType ComIfType)
 constructor to initialize the interface type value
 
ComInterfaceType GetComIfType (void)
 get the type of communication controller interface
 

Private Attributes

CanIfStates state = CanIfStates::PreInit
 
STM_HAL_TxHeaderTypeDef txHeaderList [CANIF_TXPDU_COUNT]
 we need a handle to hold the information for the bxCAN controller More...
 
ComStack_CanMsgHeader rxHeaderList [CANIF_RXPDU_COUNT]
 We create a list with CAN message headers for fast access sorted by the CanIf_rxPduIdType. More...
 
Can *const ptr2CanDriver
 to hold the CanDrv(s)
 
const CanIfUpperLayerp2UpperLayerList [CANIF_RXPDU_COUNT]
 this list will hold the pointer to the upper layers in same order like the rxHeaderList
 

Additional Inherited Members

- Public Types inherited from ComIf
enum  ComInterfaceType { ComInterfaceType::ComIfUnknown = 0, ComInterfaceType::CanIf, ComInterfaceType::TwiIf, ComInterfaceType::FlexRayIf }
 naming the known interface classes More...
 

Detailed Description

the class to work on the CAN controller interface

Gemäß dem AUTOSAR Gedanken abstrahiert das CAN Interface die gesamte CAN Hardware. Es wird also später auch nur ein CanIf Objekt geben.

Genauso wird diese CanIf Objekt global angelegt sein.

Todo:
es braucht eine Absicherung auf nur ein Objekt

Definition at line 149 of file CanIf.h.

Constructor & Destructor Documentation

◆ CanIf()

CanIf::CanIf ( )

Standard constructor will do a connection to the precompile configuration

◆ ~CanIf()

CanIf::~CanIf ( )

Destructor shouldn't called on an embedded system

Member Function Documentation

◆ RxIndication()

void CanIf::RxIndication ( ECU_CanController  Controller,
REF2CONST(ComStack_CanMsgHeader, AUTOMATIC CanMsgHeader,
REF2CONST(ComStack_PduInfoType, AUTOMATIC PduInfo 
)
virtual

The service CanIf_RxIndication() is implemented in CanIf and called by CanDrv after a CAN L-PDU has been received.

Implements ComIf.

Definition at line 232 of file CanIf.cpp.

References p2UpperLayerList, and CanIfUpperLayer::RxIndication().

Here is the call graph for this function:

Member Data Documentation

◆ rxHeaderList

ComStack_CanMsgHeader CanIf::rxHeaderList[CANIF_RXPDU_COUNT]
private

We create a list with CAN message headers for fast access sorted by the CanIf_rxPduIdType.

on rx we can use the the ComStack type (in contrast to STM HAL type) on pre compiled linking that could be on FLASH

Definition at line 304 of file CanIf.h.

◆ state

CanIfStates CanIf::state = CanIfStates::PreInit
private

we have a simple state machine inside

Definition at line 287 of file CanIf.h.

Referenced by Init(), Start(), Transmit(), and TxTask().

◆ txHeaderList

STM_HAL_TxHeaderTypeDef CanIf::txHeaderList[CANIF_TXPDU_COUNT]
private

we need a handle to hold the information for the bxCAN controller

Todo:
there are STM controller with three CAN controller too!!!

We create a list with CAN message headers for fast access sorted by the CanIf_txPduIdType

we use the STM-CAN-Message-Headers for fast copy during tx. Maybe we change this later on pre compiled linking that could be on FLASH

Definition at line 298 of file CanIf.h.

Referenced by Init().


The documentation for this class was generated from the following files: