Infineon MOTIX™ MCU TLE988x/9x Device Family SDK
Functions
Can_Api.h File Reference

Go to the source code of this file.

Detailed Description

Application interface declaration for Can driver.

Include Graph

Include dependency graph for Can_Api.h:

Functions

void Can_Init (void)
 Initialization of Can driver. More...
 
void Can_DeInit (void)
 This function shall be called only during shutdown routine. More...
 
uint8 Can_ControllerReset (uint8 Channel)
 trigger a specific CAN controller channel to re-init the hardware after bus-off More...
 
void Can_MainFunctionWrite (void)
 Runnable of Can module. More...
 
void Can_MainFunctionRead (void)
 Runnable of Can module: cyclic call required when receive path operates in polling mode. More...
 
uint8 Can_Transmit (tComFrameHandle TxFrameHdl, const uint8 *DataPtr, uint8 Length)
 Copy a data string and trigger transmission. More...
 

Function Documentation

◆ Can_ControllerReset()

uint8 Can_ControllerReset ( uint8  Channel)

trigger a specific CAN controller channel to re-init the hardware after bus-off

@function Can_ControllerReset

This function restarts communication on a CAN channel to recover from a bus-off event.
Parameters
Channelthe controller channel index which shall be reset
Return values
resultof operation: E_OK: operation successful E_NOT_OK: parameter out of range

◆ Can_DeInit()

void Can_DeInit ( void  )

This function shall be called only during shutdown routine.

@function Can_DeInit

This function stops all CAN communication and resets the CAN controller
No callouts will be called after DeInit.
Parameters
void
Return values
void

◆ Can_Init()

void Can_Init ( void  )

Initialization of Can driver.

@function Can_Init

This function has to be called once during startup and once after every wake up.
All module variables and states are initialized. All hardware registers and the message RAM are initialized from the CAN configuration.
Parameters
void
Return values
void

◆ Can_MainFunctionRead()

void Can_MainFunctionRead ( void  )

Runnable of Can module: cyclic call required when receive path operates in polling mode.

@function Can_MainFunctionRead

Main function to be called cyclic in polling mode, not necessarily in constant time.
Processes all recently received frames on the hardware
  • check if fifos or CAN objects have received a frame, get the CAN ID.
  • lookup the Rx handle in the associated config table by ID search.
  • forward received frame indications to Com by calling Com_RxIndication for each received frame.
  • discard unknown frames from which CAN ID is not found in the config table.
Parameters
void
Return values
void

◆ Can_MainFunctionWrite()

void Can_MainFunctionWrite ( void  )

Runnable of Can module.

@function Can_MainFunctionWrite

Main function to be called cyclic in polling mode, not necessarily in constant time.
Processes all pending transmit actions on the hardware
  • check if a transmission was successful and callback Com_TxConfirmation(.., E_OK)
  • check if transmissions finally failed and callback Com_TxConfirmation(.., E_NOT_OK)
Parameters
void
Return values
void

◆ Can_Transmit()

uint8 Can_Transmit ( tComFrameHandle  TxFrameHdl,
const uint8 DataPtr,
uint8  Length 
)

Copy a data string and trigger transmission.

@function Can_Transmit

The function copies data to the transmit message object with given length and sets the Tx request.
The given length must not exceed the message hardware object size (8 bytes for standard CAN, 64 bytes for CAN-FD) The CAN driver is using the CAN configuration to resolve which CAN channel and transmit method shall be used. This can either be a FullCAN object or one of the Tx Fifos. If a Fifo is full, the transmit request is discarded and CAN_BUSY is returned. The caller may then repeat the Tx request. If a FullCAN object is still pending to be sent, it is updated (actually overwritten) and E_OK is returned.
Parameters
TxFrameHdla handle index from the Tx frames list DataPtr: a pointer to the data source array Length: number of bytes to be copied, limited to the size of the frame buffer.
Return values
resultof operation: E_OK: operation successful E_NOT_OK: parameter out of range E_NOT_AVAILABLE: driver not initialized or in wrong state E_BUSY: BasicCAN Fifo is full, repeat request later