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

Go to the source code of this file.

Detailed Description

Application interface declaration for Com layer.

Include Graph

Include dependency graph for Com_Api.h:

Functions

void Com_InitRx (void)
 This function initializes the RX path of the Com layer. More...
 
void Com_InitTx (void)
 This function initializes the TX path of the Com layer. More...
 
void Com_Init (void)
 Initialization of Com module. More...
 
void Com_DeInit (void)
 This function shall be called only during shutdown routine. More...
 
void Com_EnableTransmission (uint8 bEnable)
 enables/disables Tx path to hardware driver More...
 
void Com_EnableReceptionDM (uint8 bEnable)
 enables/disables Rx frame deadline monitoring More...
 
void Com_MainFunctionTx (void)
 Runnable of Com module (<call cycle>) More...
 
void Com_MainFunctionRx (const uint8 taskMs)
 Runnable of Com module (<call cycle>) More...
 
uint8 Com_SendSignal (tComSignalHandle TxSignalHdl, const void *const SignalDataPtr)
 Write a signal value to the transmit buffer. More...
 
uint8 Com_SendSignalGroup (tComFrameHandle TxFrameHdl)
 Finalize sending signals by updating the frame buffer. More...
 
uint8 Com_ReceiveSignal (tComSignalHandle RxSignalHdl, void *const SignalDataPtr)
 Read a signal value from the message receive buffer. More...
 
uint8 Com_ReceiveSignalGroup (tComFrameHandle TxFrameHdl)
 Prepare receiving signals from the shadow buffer. More...
 
uint8 Com_SendData (tComFrameHandle TxFrameHdl, const uint8 *DataPtr, uint8 Length)
 Copy a data string for transmission. More...
 
uint8 Com_ReceiveData (tComFrameHandle RxFrameHdl, uint8 *DataPtr, uint8 Length)
 Receive data and copy to the application data array. More...
 
uint8 Com_Transmit (tComFrameHandle TxFrameHdl)
 Trigger an explicit transmit request for a Tx frame. More...
 
void Com_TxConfirmation (tComFrameHandle TxFrameHdl, uint8 Status)
 Confirm a successful transmission or a failed transmission attempt by the Can driver. More...
 
void Com_RxIndication (const tComFrameHandle RxFrameHdl, const uint8 *DataPtr, const uint8 Length)
 Indicate a received frame by the Can driver. More...
 
void Com_ControllerBusOff (uint8 Channel)
 Can driver notifying that a CAN controller has gone bus-off. More...
 

Function Documentation

◆ Com_ControllerBusOff()

void Com_ControllerBusOff ( uint8  Channel)

Can driver notifying that a CAN controller has gone bus-off.

@function Com_ControllerBusOff

This function is a callout from Can driver to notify a bus-off event of a controller.
After bus-off, Com may call the error notification to the application, and may wait some time before calling Can_ControllerReset.
Parameters
Channelthe channel index which has gone bus-off
Return values
void

◆ Com_DeInit()

void Com_DeInit ( void  )

This function shall be called only during shutdown routine.

@function Com_DeInit

This function stops all Com channels communication and frees resources
No callouts will be called after DeInit.
Parameters
void
Return values
void

◆ Com_EnableReceptionDM()

void Com_EnableReceptionDM ( uint8  bEnable)

enables/disables Rx frame deadline monitoring

@function Com_EnableReceptionDM

This function has to be called once during startup and once after every wake up.
Receive deadline monitoring can be disabled while the network is expected to be silent, i.e. by network management, prepare to sleep. No timeout faults are raised then. Note: When deadline monitoring is enabled, all timeout counters are set to their initial values. If DM was already enabled before, all counters are still reset to initial values.
Parameters
bEnable(STD_ON, STD_OFF)
Return values
void

◆ Com_EnableTransmission()

void Com_EnableTransmission ( uint8  bEnable)

enables/disables Tx path to hardware driver

@function Com_EnableTransmission

This function has to be called once during startup and once after every wake up.
Transmit path can be disabled to keep the network silent, i.e. by network management, prepare to sleep.
Parameters
bEnable(STD_ON, STD_OFF)
Return values
void

◆ Com_Init()

void Com_Init ( void  )

Initialization of Com module.

@function Com_Init

This function has to be called once during startup and once after every wake up.
All module variables and states are initialized. All data buffers and shadow buffers are initialized with start values. Transmission is disabled. Reception deadline monitoring is disabled. Receive path and receive indication is enabled, i.e. to enable network management and wakeup communication control
Parameters
void
Return values
void

◆ Com_InitRx()

void Com_InitRx ( void  )

This function initializes the RX path of the Com layer.

@function Com_InitRx

Parameters
void
Return values
void

◆ Com_InitTx()

void Com_InitTx ( void  )

This function initializes the TX path of the Com layer.

@function Com_InitTx

Parameters
void
Return values
void

◆ Com_MainFunctionRx()

void Com_MainFunctionRx ( const uint8  taskMs)

Runnable of Com module (<call cycle>)

@function Com_MainFunctionRx

Main function to be called in constant timed call cycle.
Processes all received messages from hardware driver to Com layer.
  • verify channel status if enabled / disabled
  • progress on timeout supervising counters and generate timeout errors
  • check for received messages, store in buffers and indicate to the application
Parameters
void
Return values
void

◆ Com_MainFunctionTx()

void Com_MainFunctionTx ( void  )

Runnable of Com module (<call cycle>)

@function Com_MainFunctionTx

Main function to be called in constant timed call cycle.
Processes all pending actions for message transmission from Com layer to the hardware driver.
  • verify channel status if enabled / disabled
  • progress on cycle timing counters and generate transmit requests when counters elapsed
  • check pending transmit requests and forward message to HW driver
Parameters
void
Return values
void

◆ Com_ReceiveData()

uint8 Com_ReceiveData ( tComFrameHandle  RxFrameHdl,
uint8 DataPtr,
uint8  Length 
)

Receive data and copy to the application data array.

@function Com_ReceiveData

The function copies data from the receive frame buffer to the application destination.
The given length should match the size of the associated frame buffer, but can be smaller, but never greater.
Parameters
RxFrameHdla handle index from the Rx frames list DataPtr: a pointer to the data destination array Length: number of bytes to be copied, limited to the size of the frame buffer.
Return values
resultof operation: E_OK, E_NOT_OK, E_NOT_AVAILABLE, E_BUSY

◆ Com_ReceiveSignal()

uint8 Com_ReceiveSignal ( tComSignalHandle  RxSignalHdl,
void *const  SignalDataPtr 
)

Read a signal value from the message receive buffer.

@function Com_ReceiveSignal

The application provides a signal storage variable which is updated from the message buffer.
The type is determined by the signal configuration list. If no Shadow buffer is defined, the sigal value is unpacked from the Frame Buffer. If a Shadow Buffer is defined, the signal value is unpacked from the Shadow Buffer. If the signal value type is signed, and the signal size is not 8 or 16 or 32, then sign extension is applied to the signal value.
Parameters
RxSignalHdla handle index from the Rx signals list SignalDataPtr: a void* to the destination variable. The type can be u8, i8, u16, i16, u32, i32.
Return values
resultof operation: E_OK, E_NOT_OK, E_NOT_AVAILABLE, E_BUSY

◆ Com_ReceiveSignalGroup()

uint8 Com_ReceiveSignalGroup ( tComFrameHandle  TxFrameHdl)

Prepare receiving signals from the shadow buffer.

@function Com_ReceiveSignalGroup

This function is called to copy the content of the frame buffer to the shadow buffer.
If a shadow buffer is configured for this frame, this function must be called before the signals can be received by calls to Com_ReceiveSignal. The purpose of receiving signals from a shadow buffer is to keep the whole signal group atomic while reading signal values from it. Note: Signal groups are currently not supported. The owner frame handle is defined to replace the signal group ID.
Parameters
RxFrameHdla handle index from the Rx frames list
Return values
resultof operation: E_OK, E_NOT_OK, E_NOT_AVAILABLE, E_BUSY

◆ Com_RxIndication()

void Com_RxIndication ( const tComFrameHandle  RxFrameHdl,
const uint8 DataPtr,
const uint8  Length 
)

Indicate a received frame by the Can driver.

@function Com_RxIndication

This function is a callout from Can driver to indicate a successful reception of the frame.
Com shall check the length first, if the received data fits in the Com buffer. If the data is too long and a receive error notification callout function is defined, receiving fails and a receive error is forwarded to the upper layer. Else: received data is copied to Com buffer. Receive deadline monitoring is then performed for the frame (restart of timeout counter). If a receive indication callout function is defined for the frame, Com forwards the Rx indication to the upper layer.
Parameters
RxFrameHdla handle index from the Tx frames list DataPtr: pointer to received data in can hardware. Note: after returning from this function, the pointer becomes invalid as the message object is freed. So the RxIndication function must copy the data before returning. Length: length of received frame according to frame DLC (expanded to number of bytes if CAN-FD)
Return values
void

◆ Com_SendData()

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

Copy a data string for transmission.

@function Com_SendData

The function copies data from the application source to the transmit frame buffer.
The given length should match the size of the associated frame buffer, but can be smaller, but never greater. A message transmission is NOT implicitly triggered by sending data.
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, E_NOT_OK, E_NOT_AVAILABLE, E_BUSY

◆ Com_SendSignal()

uint8 Com_SendSignal ( tComSignalHandle  TxSignalHdl,
const void *const  SignalDataPtr 
)

Write a signal value to the transmit buffer.

@function Com_SendSignal

The application provides a signal value which is read from the DataPtr location.
The type is determined by the signal configuration list. If no Shadow buffer is defined, the sigal value is packed into the Frame Buffer. If a Shadow Buffer is defined, the signal value is packed into the Shadow Buffer. A message transmission is NOT implicitly triggered by sending a signal.
Parameters
TxSignalHdla handle index from the Tx signals list SignalDataPtr: a void* to the source value. The type can be u8, u16, u32, depending on the configuration for this signal
Return values
resultof operation: E_OK, E_NOT_OK, E_NOT_AVAILABLE, E_BUSY

◆ Com_SendSignalGroup()

uint8 Com_SendSignalGroup ( tComFrameHandle  TxFrameHdl)

Finalize sending signals by updating the frame buffer.

@function Com_SendSignalGroup

This function copies the content of the shadow buffer to the frame buffer.
if a shadow buffer is configured for this frame, this function must be called after all signals were updated by calls to Com_SendSignal. The purpose of sending signals to a shadow buffer is to keep the whole signal group atomic while updating it. Note: Signal groups are currently not supported. The owner frame handle is defined to replace the signal group ID.
Parameters
TxFrameHdla handle index from the Tx frames list
Return values
resultof operation: E_OK, E_NOT_OK, E_NOT_AVAILABLE, E_BUSY

◆ Com_Transmit()

uint8 Com_Transmit ( tComFrameHandle  TxFrameHdl)

Trigger an explicit transmit request for a Tx frame.

@function Com_Transmit

This function is called to initiate a transmission of the frame with disregard to its transmit cycle.
If a cycle time is configured for the frame, the cycle counter is restarted after the frame has been sent. This function shall not be called if transmission is based on fixed cycle only.
Parameters
TxFrameHdla handle index from the Tx frames list
Return values
resultof operation: E_OK, E_NOT_OK, E_NOT_AVAILABLE, E_BUSY

◆ Com_TxConfirmation()

void Com_TxConfirmation ( tComFrameHandle  TxFrameHdl,
uint8  Status 
)

Confirm a successful transmission or a failed transmission attempt by the Can driver.

@function Com_TxConfirmation

This function is a callout from Can driver to confirm a successful or failed transmission of the frame that had been Tx requested before.
Com can forward the confirmation to the upper layer in case if a callout function is defined for this frame. Tx confirmation can be used to control Tx timeout supervising or communication state machines. In case of success, Com calls the upper layer TxConfirmation function In case of failure, Com calls the upper layer TxError function
Parameters
TxFrameHdla handle index from the Tx frames list Status: result of the transmit request; E_OK = success, E_NOT_OK = failed
Return values
void