xWRL6432 MMWAVE-L-SDK  05.04.00.01
CANFD_DRIVER_EXTERNAL_FUNCTION

Introduction

Functions

int32_t CANFD_lld_init (CANFDLLD_Handle hCanfd)
 
int32_t CANFD_lld_deInit (CANFDLLD_Handle handle)
 
int32_t CANFD_lld_configBitTime (CANFDLLD_Handle handle, const CANFDLLD_MCANBitTimingParams *bitTimeParams)
 
int32_t CANFD_lld_createMsgObject (CANFDLLD_Handle handle, CANFDLLD_MessageObject *ptrCanMsgObj)
 
int32_t CANFD_lld_createRxRangeMsgObject (CANFDLLD_Handle handle, CANFDLLD_MessageObject *ptrCanMsgObj)
 
int32_t CANFD_lld_deleteMsgObject (CANFDLLD_MsgObjHandle handle)
 
int32_t CANFD_lld_write (CANFDLLD_MsgObjHandle handle, uint32_t id, CANFDLLD_MCANFrameType frameType, uint32_t dataLength, const uint8_t *data)
 
int32_t CANFD_lld_writeCancel (CANFDLLD_MsgObjHandle handle)
 
int32_t CANFD_lld_writeDma (CANFDLLD_MsgObjHandle handle, uint32_t id, CANFDLLD_MCANFrameType frameType, uint32_t dataLengthPerMsg, uint32_t numMsgs, void *data)
 
int32_t CANFD_lld_writeDmaTriggerNext (CANFDLLD_MsgObjHandle handle)
 
uint32_t CANFD_lld_getFilterEventConfig (uint32_t eventNum)
 
int32_t CANFD_lld_read (CANFDLLD_MsgObjHandle handle, uint32_t *id, CANFDLLD_MCANFrameType *ptrFrameType, CANFDLLD_MCANXidType *idType, uint32_t *ptrDataLength, uint8_t *data)
 
int32_t CANFD_lld_readDmaConfig (CANFDLLD_MsgObjHandle handle, void *data, uint32_t numDmaRxBuf)
 
int32_t CANFD_lld_getOptions (CANFDLLD_Handle handle, CANFDLLD_OptionTLV *ptrOptInfo)
 
int32_t CANFD_lld_setOptions (CANFDLLD_Handle handle, const CANFDLLD_OptionTLV *ptrOptInfo)
 
void CANFD_lld_int0Isr (CANFDLLD_Object *ptrCanFdObj)
 
void CANFD_lld_int1Isr (CANFDLLD_Object *ptrCanFdObj)
 
ATTRIBUTE_WEAK void CANFD_lld_dataAppCallBack (CANFDLLD_MsgObjHandle handle, CANFDLLD_Reason reason)
 Application specified callback function which is invoked by the CANFD driver once transmit is complete or data has been received for the specified message object. More...
 
ATTRIBUTE_WEAK void CANFD_lld_errStatusAppCallBack (CANFDLLD_Handle handle, CANFDLLD_Reason reason, CANFDLLD_ErrStatusResp *errStatusResp)
 Application specified callback function which is invoked by the CANFD driver on error or status change. More...
 
int32_t CANFD_lld_dmaOpen (CANFDLLD_Handle canfdHandle, CANFDLLD_DmaChConfig dmaChCfg)
 API to open an CANFD DMA channel. More...
 
int32_t CANFD_lld_dmaClose (CANFDLLD_Handle canfdHandle)
 API to close an CANFD DMA channel. More...
 
int32_t CANFD_lld_createDmaTxMsgObject (CANFDLLD_Object *ptrCanFdObj, CANFDLLD_MessageObject *ptrCanMsgObj)
 API to configure dma for the Tx message object. Called from the API CANFD_lld_createMsgObject. More...
 
int32_t CANFD_lld_deleteDmaTxMsgObject (CANFDLLD_Object *ptrCanFdObj, CANFDLLD_MessageObject *ptrCanMsgObj)
 API to delete dma configuration for the Tx message object. Called from the API CANFD_lld_deleteMsgObject. More...
 
int32_t CANFD_lld_configureDmaTx (CANFDLLD_Object *ptrCanFdObj, CANFDLLD_MessageObject *ptrCanMsgObj, uint32_t dataLengthPerMsg, uint32_t numMsgs, const void *data)
 API to enable dma event transfer for the Tx. Called from the API CANFD_lld_writeDma. More...
 
int32_t CANFD_lld_cancelDmaTx (CANFDLLD_Object *ptrCanFdObj, CANFDLLD_MessageObject *ptrCanMsgObj)
 API to disbale dma event transfer for the Tx to cancel the transfer. More...
 
ATTRIBUTE_WEAK void CANFD_dmaTxCompletionCallback (CANFDLLD_MessageObject *ptrCanMsgObj, void *data, uint32_t completionType)
 Callback function for the Tx completion. This is called for each message in the array of msgs provided in CANFD_lld_configureDmaTx. data will point to the current transmitted message. For intermediate message transfer completion the completionType will be set to CANFD_DMA_TX_COMPLETION_INTERMEDIATE for last message transfer completion the completionType will be set to CANFD_DMA_TX_COMPLETION_FINAL. More...
 
int32_t CANFD_lld_createDmaRxMsgObject (CANFDLLD_Object *ptrCanFdObj, CANFDLLD_MessageObject *ptrCanMsgObj)
 API to configure dma for the Rx message object. Called from the CANFD_lld_createMsgObject. More...
 
int32_t CANFD_lld_deleteDmaRxMsgObject (CANFDLLD_Object *ptrCanFdObj, CANFDLLD_MessageObject *ptrCanMsgObj)
 API to delete dma configuration for the Rx message object. Called from the CANFD_lld_deleteMsgObject. More...
 
int32_t CANFD_lld_configureDmaRx (CANFDLLD_Object *ptrCanFdObj, CANFDLLD_MessageObject *ptrCanMsgObj, uint32_t dataLengthPerMsg, uint32_t numMsgs, const void *data)
 API to enable dma event transfer for the Rx. Called from the API CANFD_lld_readDma. More...
 
ATTRIBUTE_WEAK void CANFD_dmaRxCompletionCallback (CANFDLLD_MessageObject *ptrCanMsgObj, void *data, uint32_t completionType)
 Callback function for the Rx completion. This is called for each message in the array of msgs provided in CANFD_lld_configureDmaRx. data will point to the current received message. For intermediate message transfer completion the completionType will be set to CANFD_DMA_RX_COMPLETION_INTERMEDIATE for last message transfer completion the completionType will be set to CANFD_DMA_RX_COMPLETION_FINAL. More...
 

Function Documentation

◆ CANFD_lld_init()

int32_t CANFD_lld_init ( CANFDLLD_Handle  hCanfd)

Description
Function initializes the CANFD driver with the specified hardware attributes. It resets and configures the MCAN module, sets up the Message RAM and ECC Aggregator. It configures the CANFD driver with the control parameters.

Parameters
hCanfdCANFD handle of type CANFDLLD_Handle
Returns
Success - Handle to the CANFD Driver

◆ CANFD_lld_deInit()

int32_t CANFD_lld_deInit ( CANFDLLD_Handle  handle)

Description
Function closes the CANFD driver instance and cleanups all the memory allocated by the CANFD driver.

Parameters
handleHandle to the CANFD Driver
Returns
Success - 0
Error - <0

◆ CANFD_lld_configBitTime()

int32_t CANFD_lld_configBitTime ( CANFDLLD_Handle  handle,
const CANFDLLD_MCANBitTimingParams bitTimeParams 
)

Description
Function configures the bit time parameters for the CANFD module.

Parameters
handleHandle to the CANFD Driver
bitTimeParamsBit time configuration parameters
Returns
Success - 0
Error - <0

◆ CANFD_lld_createMsgObject()

int32_t CANFD_lld_createMsgObject ( CANFDLLD_Handle  handle,
CANFDLLD_MessageObject ptrCanMsgObj 
)

Description
Function configures the receive or transmit message object. It also enables Tx completion and Tx cancelation interrupts . The callback function will be invoked on data transmit complete for transmit message objects OR upon receiving data for receive message objects. The application MUST then call CANFD_lld_read() API to process the received data.

Parameters
handleHandle to the CANFD Driver
ptrCanMsgObjMessage Object configuration parameters
Returns
Success - Handle to the message object.
Error - NULL

◆ CANFD_lld_createRxRangeMsgObject()

int32_t CANFD_lld_createRxRangeMsgObject ( CANFDLLD_Handle  handle,
CANFDLLD_MessageObject ptrCanMsgObj 
)

Description
Function configures a receive message objects for a range of message identifiers. It also enables Rx interrupts. The callback function will be invoked upon receiving data for receive message objects. The application MUST then call CANFD_lld_read() API to process the received data.

Parameters
handleHandle to the CANFD Driver
ptrCanMsgObjMessage Object configuration parameters
Returns
Success - Handle to the message object.
Error - NULL

◆ CANFD_lld_deleteMsgObject()

int32_t CANFD_lld_deleteMsgObject ( CANFDLLD_MsgObjHandle  handle)

Description
Function deletes a message object.

Parameters
handleHandle to the message object
Returns
Success - 0
Error - <0

◆ CANFD_lld_write()

int32_t CANFD_lld_write ( CANFDLLD_MsgObjHandle  handle,
uint32_t  id,
CANFDLLD_MCANFrameType  frameType,
uint32_t  dataLength,
const uint8_t *  data 
)

Description
Function used by the application to transmit data.

Parameters
handleHandle to the message object
idMessage Identifier
frameTypeFrame type - Classic or FD
dataLengthData Length to be transmitted. Valid values: 1 to 64 bytes.
dataData to be transmitted
Returns
Success - 0
Error - <0

◆ CANFD_lld_writeCancel()

int32_t CANFD_lld_writeCancel ( CANFDLLD_MsgObjHandle  handle)

Description
Function used by the application to cancel a pending data transmit.

Parameters
handleHandle to the message object
Returns
Success - 0
Error - <0

◆ CANFD_lld_writeDma()

int32_t CANFD_lld_writeDma ( CANFDLLD_MsgObjHandle  handle,
uint32_t  id,
CANFDLLD_MCANFrameType  frameType,
uint32_t  dataLengthPerMsg,
uint32_t  numMsgs,
void *  data 
)

Description
Function used by the application to initiate transmit data in dma mode. DMA mode is recommended to be used when multiple msgs needs to be transmitted. This will transmit first msg and configure the dma to copy subsequent msgs in message ram. Once first msg transfer is completed the CANFD_dmaTxCompletionCallback function is called. Application needs to call the API CANFD_lld_writeDmaTriggerNext to trigger transmission of subsequent msgs.

Parameters
handleHandle to the message object
idMessage Identifier
frameTypeFrame type - Classic or FD
dataLengthPerMsgData Length to be transmitted per msg. Valid values: 1 to 64 bytes.
numMsgsNumber of msgs to be transmitted
dataData to be transmitted. This should be a 2d array of uint8[numMsgs][dataLengthPerMsg]
Returns
Success - 0
Error - <0

◆ CANFD_lld_writeDmaTriggerNext()

int32_t CANFD_lld_writeDmaTriggerNext ( CANFDLLD_MsgObjHandle  handle)

Description
Function used by the application to strat transmission of next msg in dma mode. Transfer should be initiated using the API CANFD_lld_writeDma before calling this function. This should be called after the previous transfer is completed and CANFD_dmaTxCompletionCallback is called.

Parameters
handleHandle to the message object
Returns
Success - 0
Error - <0

◆ CANFD_lld_getFilterEventConfig()

uint32_t CANFD_lld_getFilterEventConfig ( uint32_t  eventNum)

Description
Function used by the application to get the filter element number.

Parameters
eventNumDMA event number
Returns
value to be programmed in CAN msgID filter with DAM event number

◆ CANFD_lld_read()

int32_t CANFD_lld_read ( CANFDLLD_MsgObjHandle  handle,
uint32_t *  id,
CANFDLLD_MCANFrameType ptrFrameType,
CANFDLLD_MCANXidType idType,
uint32_t *  ptrDataLength,
uint8_t *  data 
)

Description
Function is used by the application to get the CAN message from message RAM using a receive message object. NOTE: This API must ONLY be called from the callback context.

Parameters
handleHandle to the message object
idMessage Identifier
ptrFrameTypeFrame type - Classic or FD
idTypeMeassage Id type - 11 bit standard or 29 bit extended
ptrDataLengthData Length of the received frame. Valid values: 1 to 64 bytes.
dataReceived data.
Returns
Success - 0
Error - <0

◆ CANFD_lld_readDmaConfig()

int32_t CANFD_lld_readDmaConfig ( CANFDLLD_MsgObjHandle  handle,
void *  data,
uint32_t  numDmaRxBuf 
)

Description
Function is used by the application to configure reading the received msgs from message ram. This API will configure the DMA to copy msg from MCAN message ram to application buffer. For every message received the CANFD_dmaRxCompletionCallback will be called by driver by pointing to the latest msg in the data buffer.

Parameters
handleHandle to the message object
dataArray of CANFDLLD_DmaRxBuf to receive the data from message ram. This should be an array of type CANFDLLD_DmaRxBuf and length numDmaRxBuf
numDmaRxBufNumber of dma buffers to read.
Returns
Success - 0
Error - <0

◆ CANFD_lld_getOptions()

int32_t CANFD_lld_getOptions ( CANFDLLD_Handle  handle,
CANFDLLD_OptionTLV ptrOptInfo 
)

Description
Function is used by the application to get the error and status information from the driver.

Parameters
handleHandle to the CANFD Driver
ptrOptInfoOption info in TLV format which is populated with the requested information
Returns
Success - 0
Error - <0

◆ CANFD_lld_setOptions()

int32_t CANFD_lld_setOptions ( CANFDLLD_Handle  handle,
const CANFDLLD_OptionTLV ptrOptInfo 
)

Description
Function is used by the application to configure the driver options.

Parameters
handleHandle to the CANFD Driver
ptrOptInfoOption info in TLV format which is used to configure the driver
Returns
Success - 0
Error - <0

◆ CANFD_lld_int0Isr()

void CANFD_lld_int0Isr ( CANFDLLD_Object ptrCanFdObj)

Description
The function is the registered interrupt 0 ISR for the CANFD Driver.

Parameters
ptrCanFdObjHandle to the CANFD Driver
Returns
Not applicable

◆ CANFD_lld_int1Isr()

void CANFD_lld_int1Isr ( CANFDLLD_Object ptrCanFdObj)

Description
The function is the registered interrupt 1 ISR for the CANFD Driver.

Parameters
ptrCanFdObjHandle to the CANFD Driver
Returns
Not applicable

◆ CANFD_lld_dataAppCallBack()

ATTRIBUTE_WEAK void CANFD_lld_dataAppCallBack ( CANFDLLD_MsgObjHandle  handle,
CANFDLLD_Reason  reason 
)

Application specified callback function which is invoked by the CANFD driver once transmit is complete or data has been received for the specified message object.

Parameters
handleMessage object handle for which the callback function is invoked.
reasonCause of the interrupt which prompted the callback.

◆ CANFD_lld_errStatusAppCallBack()

ATTRIBUTE_WEAK void CANFD_lld_errStatusAppCallBack ( CANFDLLD_Handle  handle,
CANFDLLD_Reason  reason,
CANFDLLD_ErrStatusResp errStatusResp 
)

Application specified callback function which is invoked by the CANFD driver on error or status change.

Parameters
handleHandle to the CANFD Driver
reasonCause of the interrupt which prompted the callback.
errStatusRespResponse structure populated with the value of the fields that caused the error or status interrupt. Processing of this structure is dependent on the callback reason.

◆ CANFD_lld_dmaOpen()

int32_t CANFD_lld_dmaOpen ( CANFDLLD_Handle  canfdHandle,
CANFDLLD_DmaChConfig  dmaChCfg 
)

API to open an CANFD DMA channel.

This API will open a DMA Channel using the appropriate DMA driver callbacks and the registered via Sysconfig

Parameters
canfdHandleCANFD Handle
dmaChCfgCANFD Channel config
Returns
SystemP_SUCCESS on success, else failure

◆ CANFD_lld_dmaClose()

int32_t CANFD_lld_dmaClose ( CANFDLLD_Handle  canfdHandle)

API to close an CANFD DMA channel.

Parameters
canfdHandleCANFD handle returned from CANFD_lld_init
Returns
SystemP_SUCCESS on success, else failure

◆ CANFD_lld_createDmaTxMsgObject()

int32_t CANFD_lld_createDmaTxMsgObject ( CANFDLLD_Object ptrCanFdObj,
CANFDLLD_MessageObject ptrCanMsgObj 
)

API to configure dma for the Tx message object. Called from the API CANFD_lld_createMsgObject.

Parameters
ptrCanFdObjpointer to the CANFD driver object
ptrCanMsgObjpointer to the CANFD message object
Returns
SystemP_SUCCESS on success, else failure

◆ CANFD_lld_deleteDmaTxMsgObject()

int32_t CANFD_lld_deleteDmaTxMsgObject ( CANFDLLD_Object ptrCanFdObj,
CANFDLLD_MessageObject ptrCanMsgObj 
)

API to delete dma configuration for the Tx message object. Called from the API CANFD_lld_deleteMsgObject.

Parameters
ptrCanFdObjpointer to the CANFD driver object
ptrCanMsgObjpointer to the CANFD message object
Returns
SystemP_SUCCESS on success, else failure

◆ CANFD_lld_configureDmaTx()

int32_t CANFD_lld_configureDmaTx ( CANFDLLD_Object ptrCanFdObj,
CANFDLLD_MessageObject ptrCanMsgObj,
uint32_t  dataLengthPerMsg,
uint32_t  numMsgs,
const void *  data 
)

API to enable dma event transfer for the Tx. Called from the API CANFD_lld_writeDma.

Parameters
ptrCanFdObjpointer to the CANFD driver object
ptrCanMsgObjpointer to the CANFD message object
dataLengthPerMsgdata length in bytes for each message
numMsgsNumber f messages to transmit
datapointer to the data buffer to transmit
Returns
SystemP_SUCCESS on success, else failure

◆ CANFD_lld_cancelDmaTx()

int32_t CANFD_lld_cancelDmaTx ( CANFDLLD_Object ptrCanFdObj,
CANFDLLD_MessageObject ptrCanMsgObj 
)

API to disbale dma event transfer for the Tx to cancel the transfer.

Parameters
ptrCanFdObjpointer to the CANFD driver object
ptrCanMsgObjpointer to the CANFD message object
Returns
SystemP_SUCCESS on success, else failure

◆ CANFD_dmaTxCompletionCallback()

ATTRIBUTE_WEAK void CANFD_dmaTxCompletionCallback ( CANFDLLD_MessageObject ptrCanMsgObj,
void *  data,
uint32_t  completionType 
)

Callback function for the Tx completion. This is called for each message in the array of msgs provided in CANFD_lld_configureDmaTx. data will point to the current transmitted message. For intermediate message transfer completion the completionType will be set to CANFD_DMA_TX_COMPLETION_INTERMEDIATE for last message transfer completion the completionType will be set to CANFD_DMA_TX_COMPLETION_FINAL.

Parameters
ptrCanMsgObjpointer to the CANFD message object
datapointer to current completed message
completionTypespecifie completion type for the callback

◆ CANFD_lld_createDmaRxMsgObject()

int32_t CANFD_lld_createDmaRxMsgObject ( CANFDLLD_Object ptrCanFdObj,
CANFDLLD_MessageObject ptrCanMsgObj 
)

API to configure dma for the Rx message object. Called from the CANFD_lld_createMsgObject.

Parameters
ptrCanFdObjpointer to the CANFD driver object
ptrCanMsgObjpointer to the CANFD message object
Returns
SystemP_SUCCESS on success, else failure

◆ CANFD_lld_deleteDmaRxMsgObject()

int32_t CANFD_lld_deleteDmaRxMsgObject ( CANFDLLD_Object ptrCanFdObj,
CANFDLLD_MessageObject ptrCanMsgObj 
)

API to delete dma configuration for the Rx message object. Called from the CANFD_lld_deleteMsgObject.

Parameters
ptrCanFdObjpointer to the CANFD driver object
ptrCanMsgObjpointer to the CANFD message object
Returns
SystemP_SUCCESS on success, else failure

◆ CANFD_lld_configureDmaRx()

int32_t CANFD_lld_configureDmaRx ( CANFDLLD_Object ptrCanFdObj,
CANFDLLD_MessageObject ptrCanMsgObj,
uint32_t  dataLengthPerMsg,
uint32_t  numMsgs,
const void *  data 
)

API to enable dma event transfer for the Rx. Called from the API CANFD_lld_readDma.

Parameters
ptrCanFdObjpointer to the CANFD driver object
ptrCanMsgObjpointer to the CANFD message object
dataLengthPerMsgdata length in bytes for each message
numMsgsNumber of messages to transmit
datapointer to the data buffer to transmit
Returns
SystemP_SUCCESS on success, else failure

◆ CANFD_dmaRxCompletionCallback()

ATTRIBUTE_WEAK void CANFD_dmaRxCompletionCallback ( CANFDLLD_MessageObject ptrCanMsgObj,
void *  data,
uint32_t  completionType 
)

Callback function for the Rx completion. This is called for each message in the array of msgs provided in CANFD_lld_configureDmaRx. data will point to the current received message. For intermediate message transfer completion the completionType will be set to CANFD_DMA_RX_COMPLETION_INTERMEDIATE for last message transfer completion the completionType will be set to CANFD_DMA_RX_COMPLETION_FINAL.

Parameters
ptrCanMsgObjpointer to the CANFD message object
datapointer to current recieved message
completionTypespecifie completion type for the callback