STM32G0 MCAL 0.0.1
Tiny MCAL for educational purpose.
Loading...
Searching...
No Matches
CanIf.h File Reference

Header file for the CAN interface. More...

#include "CanIf_Cfg.h"

Go to the source code of this file.

Functions

void CanIf_Init (const CanIf_ConfigType *ConfigPtr)
 Initializes the CAN interface.
 
void CanIf_DeInit (void)
 Deinitializes the CAN interface.
 
Std_ReturnType CanIf_SetControllerMode (uint8 ControllerId, Can_ControllerStateType ControllerMode)
 Sets the CAN controller mode.
 
Std_ReturnType CanIf_GetControllerMode (uint8 ControllerId, Can_ControllerStateType *ControllerModePtr)
 Gets the CAN controller mode.
 
Std_ReturnType CanIf_GetControllerErrorState (uint8 ControllerId, Can_ErrorStateType *ErrorStatePtr)
 Gets the CAN controller error state.
 
Std_ReturnType CanIf_Transmit (PduIdType TxPduId, const PduInfoType *PduInfoPtr)
 Transmits a CAN L-PDU.
 
Std_ReturnType CanIf_ReadRxPduData (PduIdType CanIfRxSduId, PduInfoType *CanIfRxInfoPtr)
 
CanIf_NotifStatusType CanIf_ReadTxNotifStatus (PduIdType CanIfTxSduId)
 
CanIf_NotifStatusType CanIf_ReadRxNotifStatus (PduIdType CanIfRxSduId)
 
Std_ReturnType CanIf_SetPduMode (uint8 ControllerId, CanIf_PduModeType PduModeRequest)
 Sets the requested PDU mode.
 
Std_ReturnType CanIf_GetPduMode (uint8 ControllerId, CanIf_PduModeType *PduModePtr)
 Gets the requested PDU mode.
 
void CanIf_GetVersionInfo (Std_VersionInfoType *VersionInfo)
 
void CanIf_SetDynamicTxId (PduIdType CanIfTxSduId, Can_IdType CanId)
 Sets the CAN controller baudrate.
 
CanIf_NotifStatusType CanIf_GetTxConfirmationState (uint8 ControllerId)
 Gets the CAN controller Tx confirmation state.
 
Std_ReturnType CanIf_SetBaudrate (uint8 ControllerId, uint16 BaudRateConfigID)
 
Std_ReturnType CanIf_GetControllerRxErrorCounter (uint8 ControllerId, uint8 *RxErrorCounterPtr)
 Gets the CAN controller Rx error counter.
 
Std_ReturnType CanIf_GetControllerTxErrorCounter (uint8 ControllerId, uint8 *TxErrorCounterPtr)
 Gets the CAN controller Tx error counter.
 
Std_ReturnType CanIf_EnableBusMirroring (uint8 ControllerId, boolean MirroringActive)
 
Std_ReturnType CanIf_GetCurrentTime (uint8 Controller, Can_TimeStampType *timeStampPtr)
 
void CanIf_EnableEgressTimeStamp (PduIdType TxPduId)
 
Std_ReturnType CanIf_GetEgressTimeStamp (PduIdType TxPduId, Can_TimeStampType *timeStampPtr)
 
Std_ReturnType CanIf_GetIngressTimeStamp (PduIdType RxPduId, Can_TimeStampType *timeStampPtr)
 

Detailed Description

Header file for the CAN interface.

Author
Diego Perez

The CAN Interface module provides CAN communication abstracted access to the CAN Driver and CAN Transceiver Driver services for control and supervision of the CAN network. The CAN Interface forwards downwards the status change requests from the CAN State Manager to the lower layer CAN device drivers, and upwards the CAN Driver / CAN Transceiver Driver events are forwarded by the CAN Interface module to e.g. the corresponding NM module.

Function Documentation

◆ CanIf_DeInit()

void CanIf_DeInit ( void )

Deinitializes the CAN interface.

De-initializes the CanIf module. Caller of the CanIf_DeInit() function has to be sure there are no on-going transmissions/receptions, nor any pending transmission confirmations.

Requirement
SWS_CANIF_91002, SWS_CANIF_00661

◆ CanIf_GetControllerErrorState()

Std_ReturnType CanIf_GetControllerErrorState ( uint8 ControllerId,
Can_ErrorStateType * ErrorStatePtr )

Gets the CAN controller error state.

This service calls the corresponding CAN Driver service for getting the current CAN controller error state.

Parameters
[in]ControllerIdCAN controller for which the status shall be changed.
[out]ErrorStatePtrPointer to a memory location, where the current error state of the CAN controller will be stored.
Returns
E_OK: Controller mode request has been accepted E_NOT_OK: Controller mode request has not been accepted
Requirement
SWS_CANIF_00005, SWS_CANIF_00661, SWS_CANIF_00898, SWS_CANIF_00899

< Error return value

< OK return value

◆ CanIf_GetControllerMode()

Std_ReturnType CanIf_GetControllerMode ( uint8 ControllerId,
Can_ControllerStateType * ControllerModePtr )

Gets the CAN controller mode.

This service calls the corresponding CAN Driver service for getting the current CAN controller mode.

Parameters
[in]ControllerIdCAN controller for which the status shall be changed.
[out]ControllerModePtrPointer to a memory location, where the current mode of the CAN controller will be stored.
Returns
E_OK: Controller mode request has been accepted E_NOT_OK: Controller mode request has not been accepted
Requirement
SWS_CANIF_00004, SWS_CANIF_00661, SWS_CANIF_00313, SWS_CANIF_00656

< Error return value

< OK return value

◆ CanIf_GetControllerRxErrorCounter()

Std_ReturnType CanIf_GetControllerRxErrorCounter ( uint8 ControllerId,
uint8 * RxErrorCounterPtr )

Gets the CAN controller Rx error counter.

This service calls the corresponding CAN Driver service for obtaining the Rx error counter of the CAN controller.

Parameters
[in]ControllerIdCAN controller for which the status shall be changed.
[out]RxErrorCounterPtrPointer to a memory location, where the current Rx error counter
Returns
E_OK: Rx error counter available. E_NOT_OK: Wrong ControllerId, or Rx error counter not available.
Requirement
SWS_CANIF_91003, SWS_CANIF_00661, SWS_CANIF_00907, SWS_CANIF_00908

< Error return value

< OK return value

◆ CanIf_GetControllerTxErrorCounter()

Std_ReturnType CanIf_GetControllerTxErrorCounter ( uint8 ControllerId,
uint8 * TxErrorCounterPtr )

Gets the CAN controller Tx error counter.

This service calls the corresponding CAN Driver service for obtaining the Tx error counter of the CAN controller.

Parameters
[in]ControllerIdCAN controller for which the status shall be changed.
[out]TxErrorCounterPtrPointer to a memory location, where the current Tx error counter
Returns
E_OK: Rx error counter available. E_NOT_OK: Wrong ControllerId, or Rx error counter not available.
Requirement
SWS_CANIF_91005, SWS_CANIF_00909, SWS_CANIF_00910

< Error return value

< OK return value

◆ CanIf_GetPduMode()

Std_ReturnType CanIf_GetPduMode ( uint8 ControllerId,
CanIf_PduModeType * PduModePtr )

Gets the requested PDU mode.

This service returns the requested mode of the L-PDUs of a predefined logical PDU channel.

Parameters
[in]ControllerIdAll PDUs of the own ECU connected to the corresponding CanIf ControllerId, which is assigned to a physical CAN controller are addressed.
[out]PduModePtrPointer to a memory location, where the requested PDU mode is stored.
Returns
E_OK: PDU mode request has been accepted E_NOT_OK: PDU mode request has not been accepted
Requirement
SWS_CANIF_00009, SWS_CANIF_00661, SWS_CANIF_00346, SWS_CANIF_00657

< Error return value

< OK return value

◆ CanIf_GetTxConfirmationState()

CanIf_NotifStatusType CanIf_GetTxConfirmationState ( uint8 ControllerId)

Gets the CAN controller Tx confirmation state.

This service reports, if any TX confirmation has been done for the whole CAN controller since the last CAN controller start.

Parameters
[in]ControllerIdCAN controller for which the status shall be changed.
Returns
Combined TX confirmation status for all TX PDUs of the CAN controller
Requirement
SWS_CANIF_00734, SWS_CANIF_00661, SWS_CANIF_00736

◆ CanIf_Init()

void CanIf_Init ( const CanIf_ConfigType * ConfigPtr)

Initializes the CAN interface.

This service Initializes internal and external interfaces of the CAN Interface for the further processing.

Parameters
[in]ConfigPtrPointer to the CAN Interface configuration structure.
Requirement
SWS_CANIF_00001

◆ CanIf_SetControllerMode()

Std_ReturnType CanIf_SetControllerMode ( uint8 ControllerId,
Can_ControllerStateType ControllerMode )

Sets the CAN controller mode.

This service calls the corresponding CAN Driver service for changing of the CAN controller mode.

Parameters
[in]ControllerIdCAN controller for which the status shall be changed.
[in]ControllerModeRequested mode transition.
Returns
E_OK: Controller mode request has been accepted E_NOT_OK: Controller mode request has not been accepted
Requirement
SWS_CANIF_00003, SWS_CANIF_00661, SWS_CANIF_00311, SWS_CANIF_00774

< Error return value

< OK return value

◆ CanIf_SetDynamicTxId()

void CanIf_SetDynamicTxId ( PduIdType CanIfTxSduId,
Can_IdType CanId )

Sets the CAN controller baudrate.

This service reconfigures the corresponding CAN identifier of the requested CAN L-PDU.

Parameters
[in]CanIfTxSduIdL-SDU handle to be transmitted. This handle specifies the corresponding CAN L-SDU ID and implicitly the CAN Driver instance as well as the corresponding CAN controller device.
[in]CanIdStandard/Extended CAN ID of CAN L-SDU that shall be transmitted as FD or conventional CAN frame.
Requirement
SWS_CANIF_00189, SWS_CANIF_00661, SWS_CANIF_00352, SWS_CANIF_00353

◆ CanIf_SetPduMode()

Std_ReturnType CanIf_SetPduMode ( uint8 ControllerId,
CanIf_PduModeType PduModeRequest )

Sets the requested PDU mode.

This service sets the requested mode at the L-PDUs of a predefined logical PDU channel.

Parameters
[in]ControllerIdAll PDUs of the own ECU connected to the corresponding CanIf ControllerId, which is assigned to a physical CAN controller are addressed.
[in]PduModeRequestRequested PDU mode change.
Returns
E_OK: Request for mode transition has been accepted. E_NOT_OK: Request for mode transition has not been accepted.
Requirement
SWS_CANIF_00008, SWS_CANIF_00661, SWS_CANIF_00341, SWS_CANIF_00860, SWS_CANIF_00874

< Error return value

< OK return value

◆ CanIf_Transmit()

Std_ReturnType CanIf_Transmit ( PduIdType TxPduId,
const PduInfoType * PduInfoPtr )

Transmits a CAN L-PDU.

This service calls the corresponding CAN Driver service for transmission of a CAN L-PDU.

Parameters
[in]TxPduIdIdentifier of the PDU to be transmitted
[in]PduInfoPtrLength of and pointer to the PDU data and pointer to MetaData.
Returns
E_OK: Transmit request has been accepted E_NOT_OK: Transmit request has not been accepted
Requirement
SWS_CANIF_00005, SWS_CANIF_00661, SWS_CANIF_00319, SWS_CANIF_00320, SWS_CANIF_00893

< Error return value

< OK return value