AM263Px MCU+ SDK: APIs for MCAN

| AM263Px MCU+ SDK 26.00.00 |

Files | Data Structures | Functions | Macros
APIs for MCAN
APIs for SOC Specific Device Drivers

## Introduction

This module contains APIs to program and use the MCAN module.

## Files
file | mcan.h
| This file contains the prototypes of the APIs present in the device abstraction layer file of MCAN. This also contains some related macros.

## Data Structures
struct | MCAN_BitTimingParams
| Structure for bit timing calculation. Bit timing related to data phase will be valid only in case where MCAN is put in CAN-FD mode and will be '0' otherwise. More...
struct | MCAN_TDCConfig
| Structure for MCAN Transmitter Delay Compensation parameters. More...
struct | MCAN_GlobalFiltConfig
| Structure for MCAN Global Filter Configuration parameters. More...
struct | MCAN_InitParams
| Structure for MCAN initialization parameters. More...
struct | MCAN_ConfigParams
| Structure for MCAN configuration parameters. More...
struct | MCAN_ErrCntStatus
| Structure for MCAN error logging counters status. More...
struct | MCAN_ProtocolStatus
| Structure for MCAN protocol status. More...
struct | MCAN_MsgRAMConfigParams
| Structure for MCAN Message RAM Configuration Parameters. Message RAM can contain following sections: Standard ID filters, Extended ID filters, TX FIFO(or TX Q), TX Buffers, TX EventFIFO, RX FIFO0, RX FIFO1, RX Buffer. Note: If particular section in the RAM is not used then it's size should be initialized to '0' (Number of buffers in case of Tx/Rx buffer). More...
struct | MCAN_HighPriorityMsgInfo
| Structure for MCAN High Priority Message. More...
struct | MCAN_RxNewDataStatus
| Structure for MCAN new data flag for Rx buffer. More...
struct | MCAN_RxFIFOStatus
| Structure for MCAN Rx FIFO Status. More...
struct | MCAN_TxFIFOStatus
| Structure for MCAN Tx FIFO Status. More...
struct | MCAN_TxEventFIFOStatus
| Structure for MCAN Tx Event FIFO Status. More...
struct | MCAN_ECCErrForceParams
| Structure for ECC Error forcing. More...
struct | MCAN_ECCErrStatus
| Structure for ECC Error Status. More...
struct | MCAN_RevisionId
| Structure for accessing Revision ID and Core Release Info. of MCAN module. More...
struct | MCAN_ECCAggrRevisionId
| Structure for accessing Revision ID of ECC AGGR. More...
struct | MCAN_ECCConfigParams
| Structure for MCAN ECC configuration parameters. More...
struct | MCAN_ECCWrapRevisionId
| Structure for accessing Revision ID of ECC wrapper. More...
struct | MCAN_TxBufElement
| Structure for MCAN Tx Buffer element. More...
struct | MCAN_TxBufElementNoCpy
| Structure for MCAN Tx Buffer element which takes data as a pointer. Using this the MCAL CAN driver can optimize one full copy of CAN payload by a simple pointer assignment. Please note that as the data field is a pointer so wrong value for payload size passed from application will lead to data corruption. More...
struct | MCAN_RxBufElement
| Structure for MCAN Rx Buffer element. More...
struct | MCAN_RxBufElementNoCpy
| Structure for MCAN Rx Buffer element which takes data as a pointer. Using this the MCAL CAN driver can optimize one full copy of CAN payload by a simple pointer assignment. Please note that as the data field is a pointer so wrong value for payload size passed from application will lead to data corruption. More...
struct | MCAN_TxEventFIFOElement
| Structure for MCAN Tx Event FIFO element. More...
struct | MCAN_StdMsgIDFilterElement
| Structure for MCAN Standard Message ID Filter Element. More...
struct | MCAN_ExtMsgIDFilterElement
| Structure for MCAN Extended Message ID Filter Element. More...

## Functions
void | MCAN_reset (uint32_t baseAddr)
| This API is used to initiate reset for MCAN module. More...
uint32_t | MCAN_isInReset (uint32_t baseAddr)
| This function checks if the MCAN module is in Reset. More...
uint32_t | MCAN_isFDOpEnable (uint32_t baseAddr)
| This API will return flexible data rate operation status MCAN module. More...
uint32_t | MCAN_isMemInitDone (uint32_t baseAddr)
| This function checks if the memory initialization is done for MCAN module. More...
void | MCAN_setOpMode (uint32_t baseAddr, uint32_t mode)
| This API will set MCAN module mode of operation. More...
uint32_t | MCAN_getOpMode (uint32_t baseAddr)
| This API will return MCAN module mode of operation. More...
int32_t | MCAN_init (uint32_t baseAddr, const MCAN_InitParams *initParams)
| This API will initialize MCAN module. More...
int32_t | MCAN_config (uint32_t baseAddr, const MCAN_ConfigParams *configParams)
| This API will configure MCAN module. More...
void | MCAN_eccConfig (uint32_t baseAddr, const MCAN_ECCConfigParams *configParams)
| This API will enable/disable ECC on the Message RAM. More...
int32_t | MCAN_setBitTime (uint32_t baseAddr, const MCAN_BitTimingParams *configParams)
| This API will configure a bit timings for MCAN module. More...
int32_t | MCAN_writeDmaHeader (const void *data, const MCAN_TxBufElement *elem)
| This API is used to write only the message header to MCAN TX data buffer and is required in DMA mode. More...
int32_t | MCAN_msgRAMConfig (uint32_t baseAddr, const MCAN_MsgRAMConfigParams *msgRAMConfigParams)
| This API will configure Different sections of Message RAM. More...
int32_t | MCAN_setExtIDAndMask (uint32_t baseAddr, uint32_t idMask)
| This API will configure Extended ID AND Mask. More...
int32_t | MCAN_getWriteMsgElemAddress (uint32_t baseAddr, uint32_t memType, uint32_t bufNum, uint32_t *elemAddr)
| This API is used to get the address of Tx buffer in message ram. More...
void | MCAN_writeHeaderToMsgRam (uint32_t baseAddr, uint32_t memType, uint32_t bufNum, const MCAN_TxBufElement *elem)
| This API is used to write Tx message Header to message RAM. More...
void | MCAN_writeMsgRam (uint32_t baseAddr, uint32_t memType, uint32_t bufNum, const MCAN_TxBufElement *elem)
| This API is used to write Tx message to message RAM. More...
void | MCAN_writeMsgRamNoCpy (uint32_t baseAddr, uint32_t memType, uint32_t bufNum, const MCAN_TxBufElementNoCpy *elem)
| This API is used to write Tx message to message RAM. This uses the MCAN_TxBufElementNoCpy structure element which has data as a pointer instead of an array. Note that as the data is a pointer here hence corruption of data is possible in case you exceed the payload size. Also, this API should be used instead of MCAN_writeMsgRam in case a copy in the MCAL CAN driver needs to be avoided. Both can not be used together as both have different structure. More...
int32_t | MCAN_txBufAddReq (uint32_t baseAddr, uint32_t bufNum)
| This API will set Tx Buffer Add Request. More...
void | MCAN_getNewDataStatus (uint32_t baseAddr, MCAN_RxNewDataStatus *newDataStatus)
| This API will return New Data Message Status. More...
int32_t | MCAN_getReadMsgElemAddress (uint32_t baseAddr, uint32_t memType, uint32_t bufNum, uint32_t fifoNum, uint32_t *elemAddr)
| This API is used to get the address of Rx buffer in message ram. More...
void | MCAN_clearNewDataStatus (uint32_t baseAddr, const MCAN_RxNewDataStatus *newDataStatus)
| This API clear New Data Message Status. More...
void | MCAN_readMsgRam (uint32_t baseAddr, uint32_t memType, uint32_t bufNum, uint32_t fifoNum, MCAN_RxBufElement *elem)
| This API is used to read received message form message RAM. More...
void | MCAN_readMsgRamNoCpy (uint32_t baseAddr, uint32_t memType, uint32_t bufNum, uint32_t fifoNum, MCAN_RxBufElementNoCpy *elem)
| This API is used to read received message from message RAM. This uses the MCAN_RxBufElementNoCpy structure element which has data as pointer instead of an array. Note that as the data is a pointer here hence corruption of data is possible in case you exceed the payload size. Also, this API should be used instead of MCAN_readMsgRam in case a copy in the MCAL CAN driver needs to be avoided. Both can not be used together as both have different structure. More...
void | MCAN_readTxEventFIFO (uint32_t baseAddr, MCAN_TxEventFIFOElement *txEventElem)
| This API is used to read message form Tx Event FIFO. More...
void | MCAN_addStdMsgIDFilter (uint32_t baseAddr, uint32_t filtNum, const MCAN_StdMsgIDFilterElement *elem)
| This API is used to add Standard Message ID Filter Element. More...
void | MCAN_addExtMsgIDFilter (uint32_t baseAddr, uint32_t filtNum, const MCAN_ExtMsgIDFilterElement *elem)
| This API is used to add Extended Message ID Filter Element. More...
void | MCAN_lpbkModeEnable (uint32_t baseAddr, uint32_t lpbkMode, uint32_t enable)
| This API will enable/disable Loop Back Test Mode for MCAN module. More...
void | MCAN_getErrCounters (uint32_t baseAddr, MCAN_ErrCntStatus *errCounter)
| This API will return error counter status for MCAN module. More...
void | MCAN_getProtocolStatus (uint32_t baseAddr, MCAN_ProtocolStatus *protStatus)
| This API will return protocol status for MCAN module. More...
void | MCAN_enableIntr (uint32_t baseAddr, uint32_t intrMask, uint32_t enable)
| This API is used to enable/disable interrupts. More...
void | MCAN_selectIntrLine (uint32_t baseAddr, uint32_t intrMask, uint32_t lineNum)
| This API is used to select interrupt line. More...
uint32_t | MCAN_getIntrLineSelectStatus (uint32_t baseAddr)
| This API is used to get interrupt line selected for each interrupt. More...
void | MCAN_enableIntrLine (uint32_t baseAddr, uint32_t lineNum, uint32_t enable)
| This API is used to enable/disable selected interrupt line. More...
uint32_t | MCAN_getIntrStatus (uint32_t baseAddr)
| This API will return interrupt status. More...
void | MCAN_clearIntrStatus (uint32_t baseAddr, uint32_t intrMask)
| This API is used to clear the interrupt status. More...
void | MCAN_getHighPriorityMsgStatus (uint32_t baseAddr, MCAN_HighPriorityMsgInfo *hpm)
| This API will return High Priority Message Status. More...
void | MCAN_getRxFIFOStatus (uint32_t baseAddr, MCAN_RxFIFOStatus *fifoStatus)
| This API will Rx FIFO status. More...
int32_t | MCAN_writeRxFIFOAck (uint32_t baseAddr, uint32_t fifoNum, uint32_t idx)
| This API will write Rx FIFO Acknowledgement. More...
void | MCAN_getTxFIFOQueStatus (uint32_t baseAddr, MCAN_TxFIFOStatus *fifoStatus)
| This API will Tx FIFO status. More...
uint32_t | MCAN_getTxBufReqPend (uint32_t baseAddr)
| This API will return Tx Buffer Request Pending status. More...
int32_t | MCAN_txBufCancellationReq (uint32_t baseAddr, uint32_t buffNum)
| This API will set Tx Buffer Cancellation Request. More...
uint32_t | MCAN_getTxBufTransmissionStatus (uint32_t baseAddr)
| This API will return Tx Buffer Transmission Occurred status. More...
uint32_t | MCAN_txBufCancellationStatus (uint32_t baseAddr)
| This API will return Transmit Buffer Cancellation Finished status. More...
int32_t | MCAN_txBufTransIntrEnable (uint32_t baseAddr, uint32_t bufNum, uint32_t enable)
| This API is used to enable/disable Tx Buffer Transmission Interrupt. More...
int32_t | MCAN_txBufCancellationIntrEnable (uint32_t baseAddr, uint32_t bufNum, uint32_t enable)
| This API is used to enable/disable Tx Buffer Cancellation Finished Interrupt. More...
void | MCAN_addClockStopRequest (uint32_t baseAddr, uint32_t enable)
| This API add clock stop request for MCAN module to put it in power down mode. More...
void | MCAN_getTxEventFIFOStatus (uint32_t baseAddr, MCAN_TxEventFIFOStatus *fifoStatus)
| This API will Tx Event FIFO status. More...
int32_t | MCAN_writeTxEventFIFOAck (uint32_t baseAddr, uint32_t idx)
| This API will write Event FIFO Acknowledge Index. More...
void | MCAN_eccForceError (uint32_t baseAddr, const MCAN_ECCErrForceParams *eccErr)
| This API will Force Error on ECC. More...
void | MCAN_eccGetErrorStatus (uint32_t baseAddr, MCAN_ECCErrStatus *eccErr)
| This API will return ECC Error status. More...
void | MCAN_eccClearErrorStatus (uint32_t baseAddr, uint32_t errType)
| This API is used to clear the ECC Error status. More...
void | MCAN_eccWriteEOI (uint32_t baseAddr, uint32_t errType)
| This API is used to write End of Interrupt for ECC interrupt. More...
void | MCAN_eccEnableIntr (uint32_t baseAddr, uint32_t errType, uint32_t enable)
| This API is used to enable ECC interrupt. More...
uint32_t | MCAN_eccGetIntrStatus (uint32_t baseAddr, uint32_t errType)
| This API is used to get ECC interrupt status. More...
void | MCAN_eccClearIntrStatus (uint32_t baseAddr, uint32_t errType)
| This API is used to clear ECC interrupt status. More...
void | MCAN_extTSCounterConfig (uint32_t baseAddr, uint32_t prescalar)
| This API will configure external timestamp counter for MCAN module. More...
void | MCAN_extTSCounterEnable (uint32_t baseAddr, uint32_t enable)
| This API will enable/disable fast external time stamp counter for MCAN module. More...
void | MCAN_extTSEnableIntr (uint32_t baseAddr, uint32_t enable)
| This API will enable/disable External TimeStamp Counter Overflow Interrupt for MCAN module. More...
void | MCAN_extTSWriteEOI (uint32_t baseAddr)
| This API is used to write End of Interrupt for External TimeStamp Counter Overflow Interrupt. More...
uint32_t | MCAN_extTSGetUnservicedIntrCount (uint32_t baseAddr)
| This API returns Number of unserviced rollover/overflow interrupts for external TimeStamp counter. More...
void | MCAN_getRevisionId (uint32_t baseAddr, MCAN_RevisionId *revId)
| This API is used get the MCAN revision ID. More...
uint32_t | MCAN_getClockStopAck (uint32_t baseAddr)
| This API get clock stop acknowledgement for MCAN module. It return whether MCAN is power down mode or not. More...
void | MCAN_extTSSetRawStatus (uint32_t baseAddr)
| This API will set External TimeStamp Counter Overflow Interrupt Raw status for MCAN module. More...
void | MCAN_extTSClearRawStatus (uint32_t baseAddr)
| This API will clear External TimeStamp Counter Overflow Interrupt raw status for MCAN module. More...
uint32_t | MCAN_getRxPinState (uint32_t baseAddr)
| This API will return Rx pin state of MCAN module. More...
void | MCAN_setTxPinState (uint32_t baseAddr, uint32_t state)
| This API will set Tx pin state of MCAN module. More...
uint32_t | MCAN_getTxPinState (uint32_t baseAddr)
| This API will return Tx pin state of MCAN module. More...
uint32_t | MCAN_getTSCounterVal (uint32_t baseAddr)
| This API will return current timestamp counter value. More...
uint32_t | MCAN_getClkStopAck (uint32_t baseAddr)
| This API will return clock stop acknowledgement for MCAN module. More...
void | MCAN_getBitTime (uint32_t baseAddr, MCAN_BitTimingParams *configParams)
| This API will get the configured bit timings for MCAN module. More...
void | MCAN_resetTSCounter (uint32_t baseAddr)
| This API will reset timestamp counter value. More...
uint32_t | MCAN_getTOCounterVal (uint32_t baseAddr)
| This API will return current time-out counter value. More...
void | MCAN_eccAggrGetRevisionId (uint32_t baseAddr, MCAN_ECCAggrRevisionId *revId)
| This API is used get the ECC AGGR revision ID. More...
void | MCAN_eccWrapGetRevisionId (uint32_t baseAddr, MCAN_ECCWrapRevisionId *revId)
| This API is used get the ECC Wrapper revision ID. More...
uint32_t | MCAN_extTSIsIntrEnable (uint32_t baseAddr)
| This API returns External TimeStamp Counter Overflow Interrupt enable status for MCAN module. More...
uint32_t | MCAN_getEndianVal (uint32_t baseAddr)
| This function return endianness value of MCAN module. More...
uint32_t | MCAN_getExtIDANDMassk (uint32_t baseAddr)
| This API will get the configured Extended ID AND Mask. More...
void | MCAN_initTxBufElement (MCAN_TxBufElement *txMsg)
| This API will initialize TX message object with default values. More...
void | MCAN_initOperModeParams (MCAN_InitParams *initParams)
| This API will initialize MCAN Operating mode params with default values. More...
void | MCAN_initGlobalFilterConfigParams (MCAN_ConfigParams *configParams)
| This API will initialize MCAN Global Filter config params with default values. More...
void | MCAN_initSetBitTimeParams (MCAN_BitTimingParams *bitTimes)
| This API will initialize MCAN GBit Timing params with default 1Mbps and 5Mbps as nominal and data bit-rate respectively. More...
void | MCAN_initMsgRamConfigParams (MCAN_MsgRAMConfigParams *msgRAMConfigParams)
| This API will initialize MCAN message config RAM params to default. More...
int32_t | MCAN_calcMsgRamParamsStartAddr (MCAN_MsgRAMConfigParams *msgRAMConfigParams)
| This API will calculate start addresses of message RAM params. More...
uint32_t | MCAN_calcCfgAddr (uint32_t baseAddr)
| This API will calculate configure addresses register for the MCAN module. More...

## Macros
#define | MCAN_MAX_PAYLOAD_BYTES (64U)
| Maximum payload supported by CAN-FD protocol in bytes. More...
#define | MCAN_MAX_TX_MSG_OBJECTS (32U)
| Maximum number of Tx message objects that can be supported by CANFD. More...
#define | MCAN_MAX_RX_MSG_OBJECTS (32U)
| Maximum number of Rx message objects that can be supported by CANFD. More...
#define | MCAN_MAX_MSG_OBJECTS (MCAN_MAX_TX_MSG_OBJECTS + MCAN_MAX_RX_MSG_OBJECTS)
| Maximum number of message objects that can be supported by CANFD. More...

## Return status
#define | MCAN_STATUS_SUCCESS ((int32_t)0)
| Return status when the API execution was successful. More...
#define | MCAN_STATUS_FAILURE ((int32_t)-1)
| Return status when the API execution was not successful due to a failure. More...
#define | MCAN_TIMEOUT ((int32_t)-2)
| Return status when the API execution was not successful due to a time out. More...
#define | MCAN_INVALID_PARAM ((int32_t)-3)
| Return status when the API execution failed due invalid parameters. More...
#define | MCAN_STATUS_BUSY ((int32_t)-4)
| Return status when the API execution failed due to driver busy. More...
#define | MCAN_INVALID_STATE ((int32_t)-5)
| Return status when the API execution failed due to invalid state. More...
#define | MCAN_OUT_OF_RESOURCES ((int32_t)-6)
| Return status when the API execution failed due to lack of resources (memory / HW) More...
#define | MCAN_INTR_MASK_ALL
| Macro defines mask for all the interrupts status for MCAN. More...
#define | MCAN_INTR_MASK_TX
| Macro defines mask for the TX interrupts status for MCAN. More...
#define | MCAN_INTR_MASK_RX
| Macro defines mask for the RX interrupts status for MCAN. More...
#define | MCAN_HEADER_SIZE_BYTES (8U)
| Size of MCAN Header in bytes. More...

## MCAN STD, EXT and TX/RX Elememt Size
#define | MCAN_MSG_RAM_STD_ELEM_SIZE (1U)
| Macros to represent the MCAN STD, EXT and TX/RX Elememt Size. More...
#define | MCAN_MSG_RAM_EXT_ELEM_SIZE (2U)
#define | MCAN_MSG_RAM_TX_RX_ELEM_SIZE (18U)

## MCAN RX FIFO Operation Mode
#define | MCAN_RX_FIFO_OPERATION_MODE_BLOCKING (0U)
| Macros to represent the MCAN RX FIFO mode of operation. More...
#define | MCAN_RX_FIFO_OPERATION_MODE_OVERWRITE (1U)

## MCAN Tx Mem type
#define | MCAN_TX_MEM_TYPE_BUF (0U)
| Macros to represent the MCAN Tx Message RAM type. More...
#define | MCAN_TX_MEM_TYPE_QUEUE (1U)

## MCAN Data Length Size
#define | MCAN_DATA_SIZE_0BYTES (0U)
| Macros to represent MCAN Data Size. More...
#define | MCAN_DATA_SIZE_1BYTES (1U)
#define | MCAN_DATA_SIZE_2BYTES (2U)
#define | MCAN_DATA_SIZE_3BYTES (3U)
#define | MCAN_DATA_SIZE_4BYTES (4U)
#define | MCAN_DATA_SIZE_5BYTES (5U)
#define | MCAN_DATA_SIZE_6BYTES (6U)
#define | MCAN_DATA_SIZE_7BYTES (7U)
#define | MCAN_DATA_SIZE_8BYTES (8U)
#define | MCAN_DATA_SIZE_12BYTES (9U)
#define | MCAN_DATA_SIZE_16BYTES (10U)
#define | MCAN_DATA_SIZE_20BYTES (11U)
#define | MCAN_DATA_SIZE_24BYTES (12U)
#define | MCAN_DATA_SIZE_32BYTES (13U)
#define | MCAN_DATA_SIZE_48BYTES (14U)
#define | MCAN_DATA_SIZE_64BYTES (15U)

## MCAN Standard Filter Element Configuration
#define | MCAN_STD_FILT_ELEM_DISABLE (0U)
| Macros to represent Standard Filter Element Configuration. More...
#define | MCAN_STD_FILT_ELEM_FIFO0 (1U)
#define | MCAN_STD_FILT_ELEM_FIFO1 (2U)
#define | MCAN_STD_FILT_ELEM_REJECT (3U)
#define | MCAN_STD_FILT_ELEM_SET_PRIORITY (4U)
#define | MCAN_STD_FILT_ELEM_SET_PRIORITY_FIFO0 (5U)
#define | MCAN_STD_FILT_ELEM_SET_PRIORITY_FIFO1 (6U)
#define | MCAN_STD_FILT_ELEM_BUFFER (7U)

## MCAN Standard Filter Type
#define | MCAN_STD_FILT_TYPE_RANGE (0U)
| Macros to represent Standard Filter Types. More...
#define | MCAN_STD_FILT_TYPE_DUAL (1U)
#define | MCAN_STD_FILT_TYPE_CLASSIC (2U)
#define | MCAN_STD_FILT_TYPE_DISABLE (3U)

## MCAN Extended Filter Element Configuration
#define | MCAN_EXT_FILT_ELEM_DISABLE (0U)
| Macros to represent Extended Filter Element Configuration. More...
#define | MCAN_EXT_FILT_ELEM_FIFO0 (1U)
#define | MCAN_EXT_FILT_ELEM_FIFO1 (2U)
#define | MCAN_EXT_FILT_ELEM_REJECT (3U)
#define | MCAN_EXT_FILT_ELEM_SET_PRIORITY (4U)
#define | MCAN_EXT_FILT_ELEM_SET_PRIORITY_FIFO0 (5U)
#define | MCAN_EXT_FILT_ELEM_SET_PRIORITY_FIFO1 (6U)
#define | MCAN_EXT_FILT_ELEM_BUFFER (7U)

## MCAN Extended Filter Type
#define | MCAN_EXT_FILT_TYPE_RANGE (0U)
| Macros to represent Extended Filter Types. More...
#define | MCAN_EXT_FILT_TYPE_DUAL (1U)
#define | MCAN_EXT_FILT_TYPE_CLASSIC (2U)
#define | MCAN_EXT_FILT_TYPE_DISABLE (3U)

## MCAN Interrupt Line no
typedef uint32_t | MCAN_IntrLineNum
| Enum to select the MCAN interrupt lines. More...
#define | MCAN_INTR_LINE_NUM_0 (0U)
#define | MCAN_INTR_LINE_NUM_1 (1U)

## MCAN Id Type
typedef uint32_t | MCAN_IdType
| Enum to represent the MCAN Identifier Type. More...
#define | MCAN_ID_TYPE_11_BIT (0U)
#define | MCAN_ID_TYPE_29_BIT (1U)

## MCAN Operation Mode
typedef uint32_t | MCAN_OperationMode
| Enum to represent the MCAN mode of operation. More...
#define | MCAN_OPERATION_MODE_NORMAL (0U)
#define | MCAN_OPERATION_MODE_SW_INIT (1U)

## MCAN Mem type
typedef uint32_t | MCAN_MemType
| Enum to represent the MCAN Message RAM type. More...
#define | MCAN_MEM_TYPE_BUF (0U)
#define | MCAN_MEM_TYPE_FIFO (1U)

## MCAN Rx FIFO Number
typedef uint32_t | MCAN_RxFIFONum
| Enum to represent the MCAN Rx FIFO number. More...
#define | MCAN_RX_FIFO_NUM_0 (0U)
#define | MCAN_RX_FIFO_NUM_1 (1U)

## MCAN Pin Type
typedef uint32_t | MCAN_PinType
| Enum to represent the MCAN pin type. More...
#define | MCAN_PIN_TYPE_RX (0U)
#define | MCAN_PIN_TYPE_TX (1U)

## MCAN Element Size
typedef uint32_t | MCAN_ElemSize
| Enum to represent FIFO/Buffer element Size. More...
#define | MCAN_ELEM_SIZE_8BYTES (0U)
#define | MCAN_ELEM_SIZE_12BYTES (1U)
#define | MCAN_ELEM_SIZE_16BYTES (2U)
#define | MCAN_ELEM_SIZE_20BYTES (3U)
#define | MCAN_ELEM_SIZE_24BYTES (4U)
#define | MCAN_ELEM_SIZE_32BYTES (5U)
#define | MCAN_ELEM_SIZE_48BYTES (6U)
#define | MCAN_ELEM_SIZE_64BYTES (7U)

## MCAN Timeout select
typedef uint32_t | MCAN_TimeOutSelect
| Enum to represent the MCAN time-out counter configuration. More...
#define | MCAN_TIMEOUT_SELECT_CONT (0U)
#define | MCAN_TIMEOUT_SELECT_TX_EVENT_FIFO (1U)
#define | MCAN_TIMEOUT_SELECT_RX_FIFO0 (2U)
#define | MCAN_TIMEOUT_SELECT_RX_FIFO1 (3U)

## MCAN Interrupt Source
typedef uint32_t | MCAN_IntrSrc
| Enum for MCAN interrupts. More...
#define | MCAN_INTR_SRC_RX_FIFO0_NEW_MSG (MCAN_IR_RF0N_MASK)
#define | MCAN_INTR_SRC_RX_FIFO0_WATERMARK (MCAN_IR_RF0W_MASK)
#define | MCAN_INTR_SRC_RX_FIFO0_FULL (MCAN_IR_RF0F_MASK)
#define | MCAN_INTR_SRC_RX_FIFO0_MSG_LOST (MCAN_IR_RF0L_MASK)
#define | MCAN_INTR_SRC_RX_FIFO1_NEW_MSG (MCAN_IR_RF1N_MASK)
#define | MCAN_INTR_SRC_RX_FIFO1_WATERMARK (MCAN_IR_RF1W_MASK)
#define | MCAN_INTR_SRC_RX_FIFO1_FULL (MCAN_IR_RF1F_MASK)
#define | MCAN_INTR_SRC_RX_FIFO1_MSG_LOST (MCAN_IR_RF1L_MASK)
#define | MCAN_INTR_SRC_HIGH_PRIO_MSG (MCAN_IR_HPM_MASK)
#define | MCAN_INTR_SRC_TRANS_COMPLETE (MCAN_IR_TC_MASK)
#define | MCAN_INTR_SRC_TRANS_CANCEL_FINISH (MCAN_IR_TCF_MASK)
#define | MCAN_INTR_SRC_TX_FIFO_EMPTY (MCAN_IR_TFE_MASK)
#define | MCAN_INTR_SRC_TX_EVT_FIFO_NEW_ENTRY (MCAN_IR_TEFN_MASK)
#define | MCAN_INTR_SRC_TX_EVT_FIFO_WATERMARK (MCAN_IR_TEFW_MASK)
#define | MCAN_INTR_SRC_TX_EVT_FIFO_FULL (MCAN_IR_TEFF_MASK)
#define | MCAN_INTR_SRC_TX_EVT_FIFO_ELEM_LOST (MCAN_IR_TEFL_MASK)
#define | MCAN_INTR_SRC_TIMESTAMP_WRAPAROUND (MCAN_IR_TSW_MASK)
#define | MCAN_INTR_SRC_MSG_RAM_ACCESS_FAILURE (MCAN_IR_MRAF_MASK)
#define | MCAN_INTR_SRC_TIMEOUT (MCAN_IR_TOO_MASK)
#define | MCAN_INTR_SRC_DEDICATED_RX_BUFF_MSG (MCAN_IR_DRX_MASK)
#define | MCAN_INTR_SRC_BIT_ERR_CORRECTED (MCAN_IR_BEC_MASK)
#define | MCAN_INTR_SRC_BIT_ERR_UNCORRECTED (MCAN_IR_BEU_MASK)
#define | MCAN_INTR_SRC_ERR_LOG_OVRFLW (MCAN_IR_ELO_MASK)
#define | MCAN_INTR_SRC_ERR_PASSIVE (MCAN_IR_EP_MASK)
#define | MCAN_INTR_SRC_WARNING_STATUS (MCAN_IR_EW_MASK)
#define | MCAN_INTR_SRC_BUS_OFF_STATUS (MCAN_IR_BO_MASK)
#define | MCAN_INTR_SRC_WATCHDOG (MCAN_IR_WDI_MASK)
#define | MCAN_INTR_SRC_PROTOCOL_ERR_ARB (MCAN_IR_PEA_MASK)
#define | MCAN_INTR_SRC_PROTOCOL_ERR_DATA (MCAN_IR_PED_MASK)
#define | MCAN_INTR_SRC_RES_ADDR_ACCESS (MCAN_IR_ARA_MASK)

## MCAN Ecc Error Type
typedef uint32_t | MCAN_ECCErrType
| Enum to represent the ECC Error Types. More...
#define | MCAN_ECC_ERR_TYPE_SEC (0U)
#define | MCAN_ECC_ERR_TYPE_DED (1U)

## MCAN Loopback Mode
typedef uint32_t | MCAN_LpbkMode
| Enum to select the MCAN Loopback mode. More...
#define | MCAN_LPBK_MODE_INTERNAL (0U)
#define | MCAN_LPBK_MODE_EXTERNAL (1U)

## MCAN Com State
typedef uint32_t | MCAN_ComState
| Enum to represent MCAN's communication state. More...
#define | MCAN_COM_STATE_SYNCHRONIZING (0U)
#define | MCAN_COM_STATE_IDLE (1U)
#define | MCAN_COM_STATE_RECEIVER (2U)
#define | MCAN_COM_STATE_TRANSMITTER (3U)

## MCAN Error Code
typedef uint32_t | MCAN_ErrCode
| Enum to represent MCAN's Error Code. More...
#define | MCAN_ERR_CODE_NO_ERROR (0U)
#define | MCAN_ERR_CODE_STUFF_ERROR (1U)
#define | MCAN_ERR_CODE_FORM_ERROR (2U)
#define | MCAN_ERR_CODE_ACK_ERROR (3U)
#define | MCAN_ERR_CODE_BIT1_ERROR (4U)
#define | MCAN_ERR_CODE_BIT0_ERROR (5U)
#define | MCAN_ERR_CODE_CRC_ERROR (6U)
#define | MCAN_ERR_CODE_NO_CHANGE (7U)

## Macro Definition Documentation

## ◆ MCAN_STATUS_SUCCESS

#define MCAN_STATUS_SUCCESS ((int32_t)0)

Return status when the API execution was successful.

## ◆ MCAN_STATUS_FAILURE

#define MCAN_STATUS_FAILURE ((int32_t)-1)

Return status when the API execution was not successful due to a failure.

## ◆ MCAN_TIMEOUT

#define MCAN_TIMEOUT ((int32_t)-2)

Return status when the API execution was not successful due to a time out.

## ◆ MCAN_INVALID_PARAM

#define MCAN_INVALID_PARAM ((int32_t)-3)

Return status when the API execution failed due invalid parameters.

## ◆ MCAN_STATUS_BUSY

#define MCAN_STATUS_BUSY ((int32_t)-4)

Return status when the API execution failed due to driver busy.

## ◆ MCAN_INVALID_STATE

#define MCAN_INVALID_STATE ((int32_t)-5)

Return status when the API execution failed due to invalid state.

## ◆ MCAN_OUT_OF_RESOURCES

#define MCAN_OUT_OF_RESOURCES ((int32_t)-6)

Return status when the API execution failed due to lack of resources (memory / HW)

## ◆ MCAN_INTR_MASK_ALL

#define MCAN_INTR_MASK_ALL

Value:
(MCAN_IR_RF0N_MASK | \
MCAN_IR_RF0W_MASK | \
MCAN_IR_RF0F_MASK | \
MCAN_IR_RF0L_MASK | \
MCAN_IR_RF1N_MASK | \
MCAN_IR_RF1W_MASK | \
MCAN_IR_RF1F_MASK | \
MCAN_IR_RF1L_MASK | \
MCAN_IR_HPM_MASK | \
MCAN_IR_TC_MASK | \
MCAN_IR_TCF_MASK | \
MCAN_IR_TFE_MASK | \
MCAN_IR_TEFN_MASK | \
MCAN_IR_TEFW_MASK | \
MCAN_IR_TEFF_MASK | \
MCAN_IR_TEFL_MASK | \
MCAN_IR_TSW_MASK | \
MCAN_IR_MRAF_MASK | \
MCAN_IR_TOO_MASK | \
MCAN_IR_DRX_MASK | \
MCAN_IR_BEC_MASK | \
MCAN_IR_BEU_MASK | \
MCAN_IR_ELO_MASK | \
MCAN_IR_EP_MASK | \
MCAN_IR_EW_MASK | \
MCAN_IR_BO_MASK | \
MCAN_IR_WDI_MASK | \
MCAN_IR_PEA_MASK | \
MCAN_IR_PED_MASK | \
MCAN_IR_ARA_MASK)

Macro defines mask for all the interrupts status for MCAN.

## ◆ MCAN_INTR_MASK_TX

#define MCAN_INTR_MASK_TX

Value:
(MCAN_IR_TSW_MASK | \
MCAN_IR_MRAF_MASK | \
MCAN_IR_TOO_MASK | \
MCAN_IR_DRX_MASK | \
MCAN_IR_BEC_MASK | \
MCAN_IR_BEU_MASK | \
MCAN_IR_ELO_MASK | \
MCAN_IR_EP_MASK | \
MCAN_IR_EW_MASK | \
MCAN_IR_BO_MASK | \
MCAN_IR_WDI_MASK | \
MCAN_IR_PEA_MASK | \
MCAN_IR_PED_MASK | \
MCAN_IR_ARA_MASK | \
MCAN_IR_TC_MASK | \
MCAN_IR_TCF_MASK | \
MCAN_IR_TFE_MASK | \
MCAN_IR_TEFN_MASK | \
MCAN_IR_TEFW_MASK | \
MCAN_IR_TEFF_MASK | \
MCAN_IR_HPM_MASK | \
MCAN_IR_TEFL_MASK)

Macro defines mask for the TX interrupts status for MCAN.

## ◆ MCAN_INTR_MASK_RX

#define MCAN_INTR_MASK_RX

Value:
(MCAN_IR_RF0N_MASK | \
MCAN_IR_TSW_MASK | \
MCAN_IR_MRAF_MASK | \
MCAN_IR_TOO_MASK | \
MCAN_IR_DRX_MASK | \
MCAN_IR_BEC_MASK | \
MCAN_IR_BEU_MASK | \
MCAN_IR_ELO_MASK | \
MCAN_IR_EP_MASK | \
MCAN_IR_EW_MASK | \
MCAN_IR_BO_MASK | \
MCAN_IR_WDI_MASK | \
MCAN_IR_PEA_MASK | \
MCAN_IR_PED_MASK | \
MCAN_IR_ARA_MASK | \
MCAN_IR_HPM_MASK | \
MCAN_IR_RF0W_MASK | \
MCAN_IR_RF0F_MASK | \
MCAN_IR_RF0L_MASK | \
MCAN_IR_RF1N_MASK | \
MCAN_IR_RF1W_MASK | \
MCAN_IR_RF1F_MASK | \
MCAN_IR_RF1L_MASK)

Macro defines mask for the RX interrupts status for MCAN.

## ◆ MCAN_HEADER_SIZE_BYTES

#define MCAN_HEADER_SIZE_BYTES (8U)

Size of MCAN Header in bytes.

## ◆ MCAN_MAX_PAYLOAD_BYTES

#define MCAN_MAX_PAYLOAD_BYTES (64U)

Maximum payload supported by CAN-FD protocol in bytes.

## ◆ MCAN_MSG_RAM_STD_ELEM_SIZE

#define MCAN_MSG_RAM_STD_ELEM_SIZE (1U)

Macros to represent the MCAN STD, EXT and TX/RX Elememt Size.

Standard ID Filter Element Size

## ◆ MCAN_MSG_RAM_EXT_ELEM_SIZE

#define MCAN_MSG_RAM_EXT_ELEM_SIZE (2U)

Extended ID Filter Element Size

## ◆ MCAN_MSG_RAM_TX_RX_ELEM_SIZE

#define MCAN_MSG_RAM_TX_RX_ELEM_SIZE (18U)

Tx/Rx Element Size. 18 words = 18 * 4 = 72 bytes: 8 bytes of header and 64 bytes of data

## ◆ MCAN_RX_FIFO_OPERATION_MODE_BLOCKING

#define MCAN_RX_FIFO_OPERATION_MODE_BLOCKING (0U)

Macros to represent the MCAN RX FIFO mode of operation.

MCAN Blocking mode

## ◆ MCAN_RX_FIFO_OPERATION_MODE_OVERWRITE

#define MCAN_RX_FIFO_OPERATION_MODE_OVERWRITE (1U)

MCAN Overwrite mode

## ◆ MCAN_TX_MEM_TYPE_BUF

#define MCAN_TX_MEM_TYPE_BUF (0U)

Macros to represent the MCAN Tx Message RAM type.

MCAN Tx Msg RAM buffers/FIFO

## ◆ MCAN_TX_MEM_TYPE_QUEUE

#define MCAN_TX_MEM_TYPE_QUEUE (1U)

MCAN Tx Msg RAM Queue

## ◆ MCAN_DATA_SIZE_0BYTES

#define MCAN_DATA_SIZE_0BYTES (0U)

Macros to represent MCAN Data Size.

0 byte data field

## ◆ MCAN_DATA_SIZE_1BYTES

#define MCAN_DATA_SIZE_1BYTES (1U)

1 byte data field

## ◆ MCAN_DATA_SIZE_2BYTES

#define MCAN_DATA_SIZE_2BYTES (2U)

2 byte data field

## ◆ MCAN_DATA_SIZE_3BYTES

#define MCAN_DATA_SIZE_3BYTES (3U)

3 byte data field

## ◆ MCAN_DATA_SIZE_4BYTES

#define MCAN_DATA_SIZE_4BYTES (4U)

4 byte data field

## ◆ MCAN_DATA_SIZE_5BYTES

#define MCAN_DATA_SIZE_5BYTES (5U)

5 byte data field

## ◆ MCAN_DATA_SIZE_6BYTES

#define MCAN_DATA_SIZE_6BYTES (6U)

6 byte data field

## ◆ MCAN_DATA_SIZE_7BYTES

#define MCAN_DATA_SIZE_7BYTES (7U)

7 byte data field

## ◆ MCAN_DATA_SIZE_8BYTES

#define MCAN_DATA_SIZE_8BYTES (8U)

8 byte data field

## ◆ MCAN_DATA_SIZE_12BYTES

#define MCAN_DATA_SIZE_12BYTES (9U)

12 byte data field

## ◆ MCAN_DATA_SIZE_16BYTES

#define MCAN_DATA_SIZE_16BYTES (10U)

16 byte data field

## ◆ MCAN_DATA_SIZE_20BYTES

#define MCAN_DATA_SIZE_20BYTES (11U)

20 byte data field

## ◆ MCAN_DATA_SIZE_24BYTES

#define MCAN_DATA_SIZE_24BYTES (12U)

24 byte data field

## ◆ MCAN_DATA_SIZE_32BYTES

#define MCAN_DATA_SIZE_32BYTES (13U)

32 byte data field

## ◆ MCAN_DATA_SIZE_48BYTES

#define MCAN_DATA_SIZE_48BYTES (14U)

48 byte data field

## ◆ MCAN_DATA_SIZE_64BYTES

#define MCAN_DATA_SIZE_64BYTES (15U)

64 byte data field

## ◆ MCAN_STD_FILT_ELEM_DISABLE

#define MCAN_STD_FILT_ELEM_DISABLE (0U)

Macros to represent Standard Filter Element Configuration.

Disable filter element

## ◆ MCAN_STD_FILT_ELEM_FIFO0

#define MCAN_STD_FILT_ELEM_FIFO0 (1U)

Store in Rx FIFO 0 if filter matches

## ◆ MCAN_STD_FILT_ELEM_FIFO1

#define MCAN_STD_FILT_ELEM_FIFO1 (2U)

Store in Rx FIFO 1 if filter matches

## ◆ MCAN_STD_FILT_ELEM_REJECT

#define MCAN_STD_FILT_ELEM_REJECT (3U)

Reject ID if filter matches

## ◆ MCAN_STD_FILT_ELEM_SET_PRIORITY

#define MCAN_STD_FILT_ELEM_SET_PRIORITY (4U)

Set priority if filter matches

## ◆ MCAN_STD_FILT_ELEM_SET_PRIORITY_FIFO0

#define MCAN_STD_FILT_ELEM_SET_PRIORITY_FIFO0 (5U)

Set priority and store in FIFO 0 if filter matches

## ◆ MCAN_STD_FILT_ELEM_SET_PRIORITY_FIFO1

#define MCAN_STD_FILT_ELEM_SET_PRIORITY_FIFO1 (6U)

Set priority and store in FIFO 1 if filter matches

## ◆ MCAN_STD_FILT_ELEM_BUFFER

#define MCAN_STD_FILT_ELEM_BUFFER (7U)

Store into Rx Buffer or as debug message, configuration of SFT[1:0] ignored

## ◆ MCAN_STD_FILT_TYPE_RANGE

#define MCAN_STD_FILT_TYPE_RANGE (0U)

Macros to represent Standard Filter Types.

Range filter from SFID1 to SFID2 (SFID2 ≥ SFID1)

## ◆ MCAN_STD_FILT_TYPE_DUAL

#define MCAN_STD_FILT_TYPE_DUAL (1U)

Dual ID filter for SFID1 or SFID2

## ◆ MCAN_STD_FILT_TYPE_CLASSIC

#define MCAN_STD_FILT_TYPE_CLASSIC (2U)

Classic filter: SFID1 = filter, SFID2 = mask

## ◆ MCAN_STD_FILT_TYPE_DISABLE

#define MCAN_STD_FILT_TYPE_DISABLE (3U)

Filter element disabled

## ◆ MCAN_EXT_FILT_ELEM_DISABLE

#define MCAN_EXT_FILT_ELEM_DISABLE (0U)

Macros to represent Extended Filter Element Configuration.

Disable filter element

## ◆ MCAN_EXT_FILT_ELEM_FIFO0

#define MCAN_EXT_FILT_ELEM_FIFO0 (1U)

Store in Rx FIFO 0 if filter matches

## ◆ MCAN_EXT_FILT_ELEM_FIFO1

#define MCAN_EXT_FILT_ELEM_FIFO1 (2U)

Store in Rx FIFO 1 if filter matches

## ◆ MCAN_EXT_FILT_ELEM_REJECT

#define MCAN_EXT_FILT_ELEM_REJECT (3U)

Reject ID if filter matches

## ◆ MCAN_EXT_FILT_ELEM_SET_PRIORITY

#define MCAN_EXT_FILT_ELEM_SET_PRIORITY (4U)

Set priority if filter matches

## ◆ MCAN_EXT_FILT_ELEM_SET_PRIORITY_FIFO0

#define MCAN_EXT_FILT_ELEM_SET_PRIORITY_FIFO0 (5U)

Set priority and store in FIFO 0 if filter matches

## ◆ MCAN_EXT_FILT_ELEM_SET_PRIORITY_FIFO1

#define MCAN_EXT_FILT_ELEM_SET_PRIORITY_FIFO1 (6U)

Set priority and store in FIFO 1 if filter matches

## ◆ MCAN_EXT_FILT_ELEM_BUFFER

#define MCAN_EXT_FILT_ELEM_BUFFER (7U)

Store into Rx Buffer or as debug message, configuration of SFT[1:0] ignored

## ◆ MCAN_EXT_FILT_TYPE_RANGE

#define MCAN_EXT_FILT_TYPE_RANGE (0U)

Macros to represent Extended Filter Types.

Range filter from SFID1 to SFID2 (SFID2 ≥ SFID1)

## ◆ MCAN_EXT_FILT_TYPE_DUAL

#define MCAN_EXT_FILT_TYPE_DUAL (1U)

Dual ID filter for SFID1 or SFID2

## ◆ MCAN_EXT_FILT_TYPE_CLASSIC

#define MCAN_EXT_FILT_TYPE_CLASSIC (2U)

Classic filter: SFID1 = filter, SFID2 = mask

## ◆ MCAN_EXT_FILT_TYPE_DISABLE

#define MCAN_EXT_FILT_TYPE_DISABLE (3U)

Range filter from EFID1 to EFID2 (EFID2 ≥ EFID1), XIDAM mask not applied

## ◆ MCAN_MAX_TX_MSG_OBJECTS

#define MCAN_MAX_TX_MSG_OBJECTS (32U)

Maximum number of Tx message objects that can be supported by CANFD.

## ◆ MCAN_MAX_RX_MSG_OBJECTS

#define MCAN_MAX_RX_MSG_OBJECTS (32U)

Maximum number of Rx message objects that can be supported by CANFD.

## ◆ MCAN_MAX_MSG_OBJECTS

#define MCAN_MAX_MSG_OBJECTS (MCAN_MAX_TX_MSG_OBJECTS + MCAN_MAX_RX_MSG_OBJECTS)

Maximum number of message objects that can be supported by CANFD.

## ◆ MCAN_INTR_LINE_NUM_0

#define MCAN_INTR_LINE_NUM_0 (0U)

MCAN interrupt line 0

## ◆ MCAN_INTR_LINE_NUM_1

#define MCAN_INTR_LINE_NUM_1 (1U)

MCAN interrupt line 1

## ◆ MCAN_ID_TYPE_11_BIT

#define MCAN_ID_TYPE_11_BIT (0U)

11bit MCAN Standard Identifier

## ◆ MCAN_ID_TYPE_29_BIT

#define MCAN_ID_TYPE_29_BIT (1U)

29bit MCAN Extended Identifier

## ◆ MCAN_OPERATION_MODE_NORMAL

#define MCAN_OPERATION_MODE_NORMAL (0U)

MCAN normal mode

## ◆ MCAN_OPERATION_MODE_SW_INIT

#define MCAN_OPERATION_MODE_SW_INIT (1U)

MCAN SW initialization mode

## ◆ MCAN_MEM_TYPE_BUF

#define MCAN_MEM_TYPE_BUF (0U)

MCAN Msg RAM buffers

## ◆ MCAN_MEM_TYPE_FIFO

#define MCAN_MEM_TYPE_FIFO (1U)

MCAN Msg RAM FIFO/Queue

## ◆ MCAN_RX_FIFO_NUM_0

#define MCAN_RX_FIFO_NUM_0 (0U)

MCAN Rx FIFO 0

## ◆ MCAN_RX_FIFO_NUM_1

#define MCAN_RX_FIFO_NUM_1 (1U)

MCAN Rx FIFO 1

## ◆ MCAN_PIN_TYPE_RX

#define MCAN_PIN_TYPE_RX (0U)

MCAN Rx Pin

## ◆ MCAN_PIN_TYPE_TX

#define MCAN_PIN_TYPE_TX (1U)

MCAN Tx Pin

## ◆ MCAN_ELEM_SIZE_8BYTES

#define MCAN_ELEM_SIZE_8BYTES (0U)

8 byte data field

## ◆ MCAN_ELEM_SIZE_12BYTES

#define MCAN_ELEM_SIZE_12BYTES (1U)

12 byte data field

## ◆ MCAN_ELEM_SIZE_16BYTES

#define MCAN_ELEM_SIZE_16BYTES (2U)

16 byte data field

## ◆ MCAN_ELEM_SIZE_20BYTES

#define MCAN_ELEM_SIZE_20BYTES (3U)

20 byte data field

## ◆ MCAN_ELEM_SIZE_24BYTES

#define MCAN_ELEM_SIZE_24BYTES (4U)

24 byte data field

## ◆ MCAN_ELEM_SIZE_32BYTES

#define MCAN_ELEM_SIZE_32BYTES (5U)

32 byte data field

## ◆ MCAN_ELEM_SIZE_48BYTES

#define MCAN_ELEM_SIZE_48BYTES (6U)

48 byte data field

## ◆ MCAN_ELEM_SIZE_64BYTES

#define MCAN_ELEM_SIZE_64BYTES (7U)

64 byte data field

## ◆ MCAN_TIMEOUT_SELECT_CONT

#define MCAN_TIMEOUT_SELECT_CONT (0U)

Continuous operation Mode

## ◆ MCAN_TIMEOUT_SELECT_TX_EVENT_FIFO

#define MCAN_TIMEOUT_SELECT_TX_EVENT_FIFO (1U)

Timeout controlled by Tx Event FIFO

## ◆ MCAN_TIMEOUT_SELECT_RX_FIFO0

#define MCAN_TIMEOUT_SELECT_RX_FIFO0 (2U)

Timeout controlled by Rx FIFO 0

## ◆ MCAN_TIMEOUT_SELECT_RX_FIFO1

#define MCAN_TIMEOUT_SELECT_RX_FIFO1 (3U)

Timeout controlled by Rx FIFO 1

## ◆ MCAN_INTR_SRC_RX_FIFO0_NEW_MSG

#define MCAN_INTR_SRC_RX_FIFO0_NEW_MSG (MCAN_IR_RF0N_MASK)

Rx FIFO 0 New Message interrupt

## ◆ MCAN_INTR_SRC_RX_FIFO0_WATERMARK

#define MCAN_INTR_SRC_RX_FIFO0_WATERMARK (MCAN_IR_RF0W_MASK)

Rx FIFO 0 Watermark Reached interrupt

## ◆ MCAN_INTR_SRC_RX_FIFO0_FULL

#define MCAN_INTR_SRC_RX_FIFO0_FULL (MCAN_IR_RF0F_MASK)

Rx FIFO 0 Full interrupt

## ◆ MCAN_INTR_SRC_RX_FIFO0_MSG_LOST

#define MCAN_INTR_SRC_RX_FIFO0_MSG_LOST (MCAN_IR_RF0L_MASK)

Rx FIFO 0 Message Lost interrupt

## ◆ MCAN_INTR_SRC_RX_FIFO1_NEW_MSG

#define MCAN_INTR_SRC_RX_FIFO1_NEW_MSG (MCAN_IR_RF1N_MASK)

Rx FIFO 1 New Message interrupt

## ◆ MCAN_INTR_SRC_RX_FIFO1_WATERMARK

#define MCAN_INTR_SRC_RX_FIFO1_WATERMARK (MCAN_IR_RF1W_MASK)

Rx FIFO 1 Watermark Reached interrupt

## ◆ MCAN_INTR_SRC_RX_FIFO1_FULL

#define MCAN_INTR_SRC_RX_FIFO1_FULL (MCAN_IR_RF1F_MASK)

Rx FIFO 1 Full interrupt

## ◆ MCAN_INTR_SRC_RX_FIFO1_MSG_LOST

#define MCAN_INTR_SRC_RX_FIFO1_MSG_LOST (MCAN_IR_RF1L_MASK)

Rx FIFO 1 Message Lost interrupt

## ◆ MCAN_INTR_SRC_HIGH_PRIO_MSG

#define MCAN_INTR_SRC_HIGH_PRIO_MSG (MCAN_IR_HPM_MASK)

High Priority Message interrupt

## ◆ MCAN_INTR_SRC_TRANS_COMPLETE

#define MCAN_INTR_SRC_TRANS_COMPLETE (MCAN_IR_TC_MASK)

Transmission Completed interrupt

## ◆ MCAN_INTR_SRC_TRANS_CANCEL_FINISH

#define MCAN_INTR_SRC_TRANS_CANCEL_FINISH (MCAN_IR_TCF_MASK)

Transmission Cancellation Finished interrupt

## ◆ MCAN_INTR_SRC_TX_FIFO_EMPTY

#define MCAN_INTR_SRC_TX_FIFO_EMPTY (MCAN_IR_TFE_MASK)

Tx FIFO Empty interrupt

## ◆ MCAN_INTR_SRC_TX_EVT_FIFO_NEW_ENTRY

#define MCAN_INTR_SRC_TX_EVT_FIFO_NEW_ENTRY (MCAN_IR_TEFN_MASK)

Tx Event FIFO New Entry interrupt

## ◆ MCAN_INTR_SRC_TX_EVT_FIFO_WATERMARK

#define MCAN_INTR_SRC_TX_EVT_FIFO_WATERMARK (MCAN_IR_TEFW_MASK)

Tx Event FIFO Watermark Reached interrupt

## ◆ MCAN_INTR_SRC_TX_EVT_FIFO_FULL

#define MCAN_INTR_SRC_TX_EVT_FIFO_FULL (MCAN_IR_TEFF_MASK)

Tx Event FIFO Full interrupt

## ◆ MCAN_INTR_SRC_TX_EVT_FIFO_ELEM_LOST

#define MCAN_INTR_SRC_TX_EVT_FIFO_ELEM_LOST (MCAN_IR_TEFL_MASK)

Tx Event FIFO Element Lost interrupt

## ◆ MCAN_INTR_SRC_TIMESTAMP_WRAPAROUND

#define MCAN_INTR_SRC_TIMESTAMP_WRAPAROUND (MCAN_IR_TSW_MASK)

Timestamp Wraparound interrupt

## ◆ MCAN_INTR_SRC_MSG_RAM_ACCESS_FAILURE

#define MCAN_INTR_SRC_MSG_RAM_ACCESS_FAILURE (MCAN_IR_MRAF_MASK)

Message RAM Access Failure interrupt

## ◆ MCAN_INTR_SRC_TIMEOUT

#define MCAN_INTR_SRC_TIMEOUT (MCAN_IR_TOO_MASK)

Timeout Occurred interrupt

## ◆ MCAN_INTR_SRC_DEDICATED_RX_BUFF_MSG

#define MCAN_INTR_SRC_DEDICATED_RX_BUFF_MSG (MCAN_IR_DRX_MASK)

Message stored to Dedicated Rx Buffer interrupt

## ◆ MCAN_INTR_SRC_BIT_ERR_CORRECTED

#define MCAN_INTR_SRC_BIT_ERR_CORRECTED (MCAN_IR_BEC_MASK)

Bit Error Corrected interrupt

## ◆ MCAN_INTR_SRC_BIT_ERR_UNCORRECTED

#define MCAN_INTR_SRC_BIT_ERR_UNCORRECTED (MCAN_IR_BEU_MASK)

Bit Error Uncorrected interrupt

## ◆ MCAN_INTR_SRC_ERR_LOG_OVRFLW

#define MCAN_INTR_SRC_ERR_LOG_OVRFLW (MCAN_IR_ELO_MASK)

Error Logging Overflow interrupt

## ◆ MCAN_INTR_SRC_ERR_PASSIVE

#define MCAN_INTR_SRC_ERR_PASSIVE (MCAN_IR_EP_MASK)

Error Passive interrupt

## ◆ MCAN_INTR_SRC_WARNING_STATUS

#define MCAN_INTR_SRC_WARNING_STATUS (MCAN_IR_EW_MASK)

Warning Status interrupt

## ◆ MCAN_INTR_SRC_BUS_OFF_STATUS

#define MCAN_INTR_SRC_BUS_OFF_STATUS (MCAN_IR_BO_MASK)

Bus_Off Status interrupt

## ◆ MCAN_INTR_SRC_WATCHDOG

#define MCAN_INTR_SRC_WATCHDOG (MCAN_IR_WDI_MASK)

Watchdog Interrupt interrupt

## ◆ MCAN_INTR_SRC_PROTOCOL_ERR_ARB

#define MCAN_INTR_SRC_PROTOCOL_ERR_ARB (MCAN_IR_PEA_MASK)

Protocol Error in Arbitration Phase interrupt

## ◆ MCAN_INTR_SRC_PROTOCOL_ERR_DATA

#define MCAN_INTR_SRC_PROTOCOL_ERR_DATA (MCAN_IR_PED_MASK)

Protocol Error in Data Phase interrupt

## ◆ MCAN_INTR_SRC_RES_ADDR_ACCESS

#define MCAN_INTR_SRC_RES_ADDR_ACCESS (MCAN_IR_ARA_MASK)

Access to Reserved Address interrupt

## ◆ MCAN_ECC_ERR_TYPE_SEC

#define MCAN_ECC_ERR_TYPE_SEC (0U)

ECC Single Error Correction

## ◆ MCAN_ECC_ERR_TYPE_DED

#define MCAN_ECC_ERR_TYPE_DED (1U)

ECC Single Error Detection

## ◆ MCAN_LPBK_MODE_INTERNAL

#define MCAN_LPBK_MODE_INTERNAL (0U)

Internal Loop Back Mode This mode can be used for hot self-test and this mode will not affect bus state.

## ◆ MCAN_LPBK_MODE_EXTERNAL

#define MCAN_LPBK_MODE_EXTERNAL (1U)

External Loop Back Mode In this mode, MCAN the M_CAN treats its own transmitted messages as received messages and stores them (if they pass acceptance filtering) into an Rx Buffer or an Rx FIFO. This mode will affect bus state

## ◆ MCAN_COM_STATE_SYNCHRONIZING

#define MCAN_COM_STATE_SYNCHRONIZING (0U)

MCAN is synchronizing on CAN communication

## ◆ MCAN_COM_STATE_IDLE

#define MCAN_COM_STATE_IDLE (1U)

MCAN is neither receiver nor transmitter

## ◆ MCAN_COM_STATE_RECEIVER

#define MCAN_COM_STATE_RECEIVER (2U)

MCAN is operating as receiver

## ◆ MCAN_COM_STATE_TRANSMITTER

#define MCAN_COM_STATE_TRANSMITTER (3U)

MCAN is operating as transmitter

## ◆ MCAN_ERR_CODE_NO_ERROR

#define MCAN_ERR_CODE_NO_ERROR (0U)

No error occurred since LEC has been reset by successful reception or transmission.

## ◆ MCAN_ERR_CODE_STUFF_ERROR

#define MCAN_ERR_CODE_STUFF_ERROR (1U)

More than 5 equal bits in a sequence have occurred in a part of a received message where this is not allowed.

## ◆ MCAN_ERR_CODE_FORM_ERROR

#define MCAN_ERR_CODE_FORM_ERROR (2U)

A fixed format part of a received frame has the wrong format.

## ◆ MCAN_ERR_CODE_ACK_ERROR

#define MCAN_ERR_CODE_ACK_ERROR (3U)

The message transmitted by the M_CAN was not acknowledged by another node.

## ◆ MCAN_ERR_CODE_BIT1_ERROR

#define MCAN_ERR_CODE_BIT1_ERROR (4U)

During the transmission of a message (with the exception of the arbitration field), the device wanted to send a recessive level (bit of logical value 1)) but the monitored bus value was dominant.

## ◆ MCAN_ERR_CODE_BIT0_ERROR

#define MCAN_ERR_CODE_BIT0_ERROR (5U)

During the transmission of a message (or acknowledge bit, or active error flag, or overload flag), the device wanted to send a dominant level (data or identifier bit logical value 0), but the monitored bus value was recessive. During Bus_Off recovery this status is set each time a sequence of 11 recessive bits has been monitored. This enables the CPU to monitor the proceeding of the Bus_Off recovery sequence (indicating the bus is not stuck at dominant or continuously disturbed).

## ◆ MCAN_ERR_CODE_CRC_ERROR

#define MCAN_ERR_CODE_CRC_ERROR (6U)

The CRC check sum of a received message was incorrect. The CRC of an incoming message does not match with the CRC calculated from the received data.

## ◆ MCAN_ERR_CODE_NO_CHANGE

#define MCAN_ERR_CODE_NO_CHANGE (7U)

Any read access to the Protocol Status Register re-initializes the LEC to 7. When the LEC shows the value 7, no CAN bus event was detected since the last CPU read access to the Protocol Status Register.

## Typedef Documentation

## ◆ MCAN_IntrLineNum

typedef uint32_t MCAN_IntrLineNum

Enum to select the MCAN interrupt lines.

## ◆ MCAN_IdType

typedef uint32_t MCAN_IdType

Enum to represent the MCAN Identifier Type.

## ◆ MCAN_OperationMode

typedef uint32_t MCAN_OperationMode

Enum to represent the MCAN mode of operation.

## ◆ MCAN_MemType

typedef uint32_t MCAN_MemType

Enum to represent the MCAN Message RAM type.

## ◆ MCAN_RxFIFONum

typedef uint32_t MCAN_RxFIFONum

Enum to represent the MCAN Rx FIFO number.

## ◆ MCAN_PinType

typedef uint32_t MCAN_PinType

Enum to represent the MCAN pin type.

## ◆ MCAN_ElemSize

typedef uint32_t MCAN_ElemSize

Enum to represent FIFO/Buffer element Size.

## ◆ MCAN_TimeOutSelect

typedef uint32_t MCAN_TimeOutSelect

Enum to represent the MCAN time-out counter configuration.

## ◆ MCAN_IntrSrc

typedef uint32_t MCAN_IntrSrc

Enum for MCAN interrupts.

## ◆ MCAN_ECCErrType

typedef uint32_t MCAN_ECCErrType

Enum to represent the ECC Error Types.

## ◆ MCAN_LpbkMode

typedef uint32_t MCAN_LpbkMode

Enum to select the MCAN Loopback mode.

## ◆ MCAN_ComState

typedef uint32_t MCAN_ComState

Enum to represent MCAN's communication state.

## ◆ MCAN_ErrCode

typedef uint32_t MCAN_ErrCode

Enum to represent MCAN's Error Code.

## Function Documentation

## ◆ MCAN_reset()

void MCAN_reset | ( | uint32_t | baseAddr | ) |

This API is used to initiate reset for MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.

## ◆ MCAN_isInReset()

uint32_t MCAN_isInReset | ( | uint32_t | baseAddr | ) |

This function checks if the MCAN module is in Reset.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Return values

  state | Returns TRUE if reset is in progress. Else returns FALSE.

## ◆ MCAN_isFDOpEnable()

uint32_t MCAN_isFDOpEnable | ( | uint32_t | baseAddr | ) |

This API will return flexible data rate operation status MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  state Returns TRUE if flexible data rate operation is enabled. Else returns FALSE.

## ◆ MCAN_isMemInitDone()

uint32_t MCAN_isMemInitDone | ( | uint32_t | baseAddr | ) |

This function checks if the memory initialization is done for MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Return values

  state | Returns TRUE if memory initialization is done. Else returns FALSE.

## ◆ MCAN_setOpMode()

void MCAN_setOpMode | ( | uint32_t | baseAddr,
|  | uint32_t | mode
| ) |  |

This API will set MCAN module mode of operation.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  mode | Mode of operation. Refer enum MCAN_OperationMode.

## ◆ MCAN_getOpMode()

uint32_t MCAN_getOpMode | ( | uint32_t | baseAddr | ) |

This API will return MCAN module mode of operation.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  mode Mode of operation. Refer enum MCAN_OperationMode.

## ◆ MCAN_init()

int32_t MCAN_init | ( | uint32_t | baseAddr,
|  | const MCAN_InitParams * | initParams
| ) |  |

This API will initialize MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  initParams | Initialization parameters. Refer struct MCAN_InitParams.

Returns
  status Initialization status.

## ◆ MCAN_config()

int32_t MCAN_config | ( | uint32_t | baseAddr,
|  | const MCAN_ConfigParams * | configParams
| ) |  |

This API will configure MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  configParams | configuration parameters. Refer struct MCAN_ConfigParams.

Returns
  status Configuration status.

## ◆ MCAN_eccConfig()

void MCAN_eccConfig | ( | uint32_t | baseAddr,
|  | const MCAN_ECCConfigParams * | configParams
| ) |  |

This API will enable/disable ECC on the Message RAM.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  configParams | MCAN ECC Configuration Parameters. Refer struct MCAN_ECCConfigParams.

## ◆ MCAN_setBitTime()

int32_t MCAN_setBitTime | ( | uint32_t | baseAddr,
|  | const MCAN_BitTimingParams * | configParams
| ) |  |

This API will configure a bit timings for MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  configParams | Configuration parameters for MCAN bit timing. Refer struct MCAN_BitTimingParams.

Returns
  status Bit Timings configuration status.

## ◆ MCAN_writeDmaHeader()

int32_t MCAN_writeDmaHeader | ( | const void * | data,
|  | const MCAN_TxBufElement * | elem
| ) |  |

This API is used to write only the message header to MCAN TX data buffer and is required in DMA mode.

Parameters

  data | MCAN TX data buffer pointer.
  elem | Message Object. Refer struct MCAN_TxBufElement.

## ◆ MCAN_msgRAMConfig()

int32_t MCAN_msgRAMConfig | ( | uint32_t | baseAddr,
|  | const MCAN_MsgRAMConfigParams * | msgRAMConfigParams
| ) |  |

This API will configure Different sections of Message RAM.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  msgRAMConfigParams | Message RAM Configuration parameters. Refer struct MCAN_MsgRAMConfigParams.

Returns
  status Configuration Status.

## ◆ MCAN_setExtIDAndMask()

int32_t MCAN_setExtIDAndMask | ( | uint32_t | baseAddr,
|  | uint32_t | idMask
| ) |  |

This API will configure Extended ID AND Mask.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  idMask | Configuration parameters for MCAN Extended Id mask. This value is 29 bit wide.

Returns
  status Extended ID AND Mask configuration status.

## ◆ MCAN_getWriteMsgElemAddress()

int32_t MCAN_getWriteMsgElemAddress | ( | uint32_t | baseAddr,
|  | uint32_t | memType,
|  | uint32_t | bufNum,
|  | uint32_t * | elemAddr
| ) |  |

This API is used to get the address of Tx buffer in message ram.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  memType | Part of message ram to which given message to write. Refer enum MCAN_MemType.
  bufNum | Buffer number where message to write. This parameter will ignored if memType is FIFO/Q.
  elemAddr | Element address

Returns
  SystemP_SUCCESS if successful; else error on failure

## ◆ MCAN_writeHeaderToMsgRam()

void MCAN_writeHeaderToMsgRam | ( | uint32_t | baseAddr,
|  | uint32_t | memType,
|  | uint32_t | bufNum,
|  | const MCAN_TxBufElement * | elem
| ) |  |

This API is used to write Tx message Header to message RAM.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  memType | Part of message ram to which given message to write. Refer enum MCAN_MemType.
  bufNum | Buffer number where message to write. This parameter will ignored if memType is FIFO/Q.
  elem | Message Object. Refer struct MCAN_TxBufElement.

## ◆ MCAN_writeMsgRam()

void MCAN_writeMsgRam | ( | uint32_t | baseAddr,
|  | uint32_t | memType,
|  | uint32_t | bufNum,
|  | const MCAN_TxBufElement * | elem
| ) |  |

This API is used to write Tx message to message RAM.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  memType | Part of message ram to which given message to write. Refer enum MCAN_MemType.
  bufNum | Buffer number where message to write. This parameter will ignored if memType is FIFO/Q.
  elem | Message Object. Refer struct MCAN_TxBufElement.

## ◆ MCAN_writeMsgRamNoCpy()

void MCAN_writeMsgRamNoCpy | ( | uint32_t | baseAddr,
|  | uint32_t | memType,
|  | uint32_t | bufNum,
|  | const MCAN_TxBufElementNoCpy * | elem
| ) |  |

This API is used to write Tx message to message RAM. This uses the MCAN_TxBufElementNoCpy structure element which has data as a pointer instead of an array. Note that as the data is a pointer here hence corruption of data is possible in case you exceed the payload size. Also, this API should be used instead of MCAN_writeMsgRam in case a copy in the MCAL CAN driver needs to be avoided. Both can not be used together as both have different structure.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  memType | Part of message ram to which given message to write. Refer enum MCAN_MemType.
  bufNum | Buffer number where message to write. This parameter will ignored if memType is FIFO/Q.
  elem | Message Object. Refer struct MCAN_TxBufElementNoCpy.

## ◆ MCAN_txBufAddReq()

int32_t MCAN_txBufAddReq | ( | uint32_t | baseAddr,
|  | uint32_t | bufNum
| ) |  |

This API will set Tx Buffer Add Request.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  bufNum | Tx Buffer number for which request is to be added.

Returns
  status Configuration Status.

## ◆ MCAN_getNewDataStatus()

void MCAN_getNewDataStatus | ( | uint32_t | baseAddr,
|  | MCAN_RxNewDataStatus * | newDataStatus
| ) |  |

This API will return New Data Message Status.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  newDataStatus | Rx Buffer new data status. Refer struct MCAN_RxNewDataStatus.

## ◆ MCAN_getReadMsgElemAddress()

int32_t MCAN_getReadMsgElemAddress | ( | uint32_t | baseAddr,
|  | uint32_t | memType,
|  | uint32_t | bufNum,
|  | uint32_t | fifoNum,
|  | uint32_t * | elemAddr
| ) |  |

This API is used to get the address of Rx buffer in message ram.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  memType | Part of message ram to which given message to write. Refer enum MCAN_MemType.
  bufNum | Buffer number from where message is to read. This parameter will ignored if memType is FIFO/Q.
  fifoNum | FIFOs number from where message is to read. Refer enum MCAN_RxFIFONum. This parameter will ignored if memType is buffer.
  elemAddr | Element address

Returns
  SystemP_SUCCESS if successful; else error on failure

## ◆ MCAN_clearNewDataStatus()

void MCAN_clearNewDataStatus | ( | uint32_t | baseAddr,
|  | const MCAN_RxNewDataStatus * | newDataStatus
| ) |  |

This API clear New Data Message Status.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  newDataStatus | Rx Buffer new data status. Refer struct MCAN_RxNewDataStatus.

## ◆ MCAN_readMsgRam()

void MCAN_readMsgRam | ( | uint32_t | baseAddr,
|  | uint32_t | memType,
|  | uint32_t | bufNum,
|  | uint32_t | fifoNum,
|  | MCAN_RxBufElement * | elem
| ) |  |

This API is used to read received message form message RAM.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  memType | Part of message ram to which given message to write. Refer enum MCAN_MemType.
  bufNum | Buffer number from where message is to read. This parameter will ignored if memType is FIFO/Q.
  fifoNum | FIFOs number from where message is to read. Refer enum MCAN_RxFIFONum. This parameter will ignored if memType is buffer.
  elem | Message Object. Refer struct MCAN_RxBufElement.

## ◆ MCAN_readMsgRamNoCpy()

void MCAN_readMsgRamNoCpy | ( | uint32_t | baseAddr,
|  | uint32_t | memType,
|  | uint32_t | bufNum,
|  | uint32_t | fifoNum,
|  | MCAN_RxBufElementNoCpy * | elem
| ) |  |

This API is used to read received message from message RAM. This uses the MCAN_RxBufElementNoCpy structure element which has data as pointer instead of an array. Note that as the data is a pointer here hence corruption of data is possible in case you exceed the payload size. Also, this API should be used instead of MCAN_readMsgRam in case a copy in the MCAL CAN driver needs to be avoided. Both can not be used together as both have different structure.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  memType | Part of message ram to which given message to write. Refer enum MCAN_MemType.
  bufNum | Buffer number from where message is to read. This parameter will ignored if memType is FIFO/Q.
  fifoNum | FIFOs number from where message is to read. Refer enum MCAN_RxFIFONum. This parameter will ignored if memType is buffer.
  elem | Message Object. Refer struct MCAN_RxBufElementNoCpy.

## ◆ MCAN_readTxEventFIFO()

void MCAN_readTxEventFIFO | ( | uint32_t | baseAddr,
|  | MCAN_TxEventFIFOElement * | txEventElem
| ) |  |

This API is used to read message form Tx Event FIFO.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  txEventElem | Tx Event FIFO Message Object. Refer struct MCAN_TxEventFIFOElement.

## ◆ MCAN_addStdMsgIDFilter()

void MCAN_addStdMsgIDFilter | ( | uint32_t | baseAddr,
|  | uint32_t | filtNum,
|  | const MCAN_StdMsgIDFilterElement * | elem
| ) |  |

This API is used to add Standard Message ID Filter Element.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  filtNum | Filter number.
  elem | Filter Object. Refer struct MCAN_StdMsgIDFilterElement.

## ◆ MCAN_addExtMsgIDFilter()

void MCAN_addExtMsgIDFilter | ( | uint32_t | baseAddr,
|  | uint32_t | filtNum,
|  | const MCAN_ExtMsgIDFilterElement * | elem
| ) |  |

This API is used to add Extended Message ID Filter Element.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  filtNum | Filter number.
  elem | Filter Object. Refer struct MCAN_ExtMsgIDFilterElement.

## ◆ MCAN_lpbkModeEnable()

void MCAN_lpbkModeEnable | ( | uint32_t | baseAddr,
|  | uint32_t | lpbkMode,
|  | uint32_t | enable
| ) |  |

This API will enable/disable Loop Back Test Mode for MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  lpbkMode | Loopback mode for MCAN. Refer enum MCAN_LpbkMode.
  enable | Loop Back Mode is enabled if it is TRUE. Loop Back Mode is disabled if it is FALSE.

Note
  This API can be called only when MCAN is in Software Initialization mode of operation.

## ◆ MCAN_getErrCounters()

void MCAN_getErrCounters | ( | uint32_t | baseAddr,
|  | MCAN_ErrCntStatus * | errCounter
| ) |  |

This API will return error counter status for MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  errCounter | Error Counter Status. Refer struct MCAN_ErrCntStatus.

## ◆ MCAN_getProtocolStatus()

void MCAN_getProtocolStatus | ( | uint32_t | baseAddr,
|  | MCAN_ProtocolStatus * | protStatus
| ) |  |

This API will return protocol status for MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  protStatus | Protocol Status. Refer struct MCAN_ProtocolStatus.

## ◆ MCAN_enableIntr()

void MCAN_enableIntr | ( | uint32_t | baseAddr,
|  | uint32_t | intrMask,
|  | uint32_t | enable
| ) |  |

This API is used to enable/disable interrupts.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  intrMask | Interrupts to enable. Refer enum MCAN_IntrSrc.
  enable | Interrupt is enabled if it is TRUE. Interrupt is disabled if it is FALSE.

## ◆ MCAN_selectIntrLine()

void MCAN_selectIntrLine | ( | uint32_t | baseAddr,
|  | uint32_t | intrMask,
|  | uint32_t | lineNum
| ) |  |

This API is used to select interrupt line.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  intrMask | Interrupt Number for which interrupt line is to be selected. Refer enum MCAN_IntrSrc.
  lineNum | Interrupt Line to select. Refer enum MCAN_IntrLineNum,

## ◆ MCAN_getIntrLineSelectStatus()

uint32_t MCAN_getIntrLineSelectStatus | ( | uint32_t | baseAddr | ) |

This API is used to get interrupt line selected for each interrupt.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  status Interrupt Line Select Status.

## ◆ MCAN_enableIntrLine()

void MCAN_enableIntrLine | ( | uint32_t | baseAddr,
|  | uint32_t | lineNum,
|  | uint32_t | enable
| ) |  |

This API is used to enable/disable selected interrupt line.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  lineNum | Interrupt Line to select. Refer enum MCAN_IntrLineNum,
  enable | Interrupt Line is enabled if it is 1. Interrupt Line is disabled if it is 0.

## ◆ MCAN_getIntrStatus()

uint32_t MCAN_getIntrStatus | ( | uint32_t | baseAddr | ) |

This API will return interrupt status.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  status Interrupt Status.

## ◆ MCAN_clearIntrStatus()

void MCAN_clearIntrStatus | ( | uint32_t | baseAddr,
|  | uint32_t | intrMask
| ) |  |

This API is used to clear the interrupt status.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  intrMask | Interrupts to clear status.

## ◆ MCAN_getHighPriorityMsgStatus()

void MCAN_getHighPriorityMsgStatus | ( | uint32_t | baseAddr,
|  | MCAN_HighPriorityMsgInfo * | hpm
| ) |  |

This API will return High Priority Message Status.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  hpm | High Priority Message Status. Refer struct MCAN_HighPriorityMsgInfo.

## ◆ MCAN_getRxFIFOStatus()

void MCAN_getRxFIFOStatus | ( | uint32_t | baseAddr,
|  | MCAN_RxFIFOStatus * | fifoStatus
| ) |  |

This API will Rx FIFO status.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  fifoStatus | Rx FIFO Status. Refer struct MCAN_RxFIFOStatus.

## ◆ MCAN_writeRxFIFOAck()

int32_t MCAN_writeRxFIFOAck | ( | uint32_t | baseAddr,
|  | uint32_t | fifoNum,
|  | uint32_t | idx
| ) |  |

This API will write Rx FIFO Acknowledgement.

Parameters

  baseAddr | Base Address of the MCAN Registers. Refer enum MCAN_RxFIFONum.
  fifoNum | FIFO Number.
  idx | Rx FIFO Acknowledge Index

Returns
  status Acknowledgement Status.

## ◆ MCAN_getTxFIFOQueStatus()

void MCAN_getTxFIFOQueStatus | ( | uint32_t | baseAddr,
|  | MCAN_TxFIFOStatus * | fifoStatus
| ) |  |

This API will Tx FIFO status.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  fifoStatus | Tx FIFO Status. Refer struct MCAN_TxFIFOStatus.

## ◆ MCAN_getTxBufReqPend()

uint32_t MCAN_getTxBufReqPend | ( | uint32_t | baseAddr | ) |

This API will return Tx Buffer Request Pending status.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  status Tx Buffer Request Pending status.

## ◆ MCAN_txBufCancellationReq()

int32_t MCAN_txBufCancellationReq | ( | uint32_t | baseAddr,
|  | uint32_t | buffNum
| ) |  |

This API will set Tx Buffer Cancellation Request.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  buffNum | Tx Buffer number for which request is to be added.

Returns
  status Configuration Status.

## ◆ MCAN_getTxBufTransmissionStatus()

uint32_t MCAN_getTxBufTransmissionStatus | ( | uint32_t | baseAddr | ) |

This API will return Tx Buffer Transmission Occurred status.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  status Tx Buffer Transmission Occurred status.

## ◆ MCAN_txBufCancellationStatus()

uint32_t MCAN_txBufCancellationStatus | ( | uint32_t | baseAddr | ) |

This API will return Transmit Buffer Cancellation Finished status.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  status Transmit Buffer Cancellation Finished status.

## ◆ MCAN_txBufTransIntrEnable()

int32_t MCAN_txBufTransIntrEnable | ( | uint32_t | baseAddr,
|  | uint32_t | bufNum,
|  | uint32_t | enable
| ) |  |

This API is used to enable/disable Tx Buffer Transmission Interrupt.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  bufNum | Buffer number for which interrupt is to enable.
  enable | Interrupt is enabled if it is TRUE. Interrupt is disabled if it is FALSE.

Returns
  status Configuration status.

## ◆ MCAN_txBufCancellationIntrEnable()

int32_t MCAN_txBufCancellationIntrEnable | ( | uint32_t | baseAddr,
|  | uint32_t | bufNum,
|  | uint32_t | enable
| ) |  |

This API is used to enable/disable Tx Buffer Cancellation Finished Interrupt.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  bufNum | Buffer number for which interrupt is to enable.
  enable | Interrupt is enabled if it is TRUE. Interrupt is disabled if it is FALSE.

Returns
  status Configuration status.

## ◆ MCAN_addClockStopRequest()

void MCAN_addClockStopRequest | ( | uint32_t | baseAddr,
|  | uint32_t | enable
| ) |  |

This API add clock stop request for MCAN module to put it in power down mode.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  enable | Add CLock Stop Request. Adds Clock Clock stop Request is TRUE otherwise removes it.

## ◆ MCAN_getTxEventFIFOStatus()

void MCAN_getTxEventFIFOStatus | ( | uint32_t | baseAddr,
|  | MCAN_TxEventFIFOStatus * | fifoStatus
| ) |  |

This API will Tx Event FIFO status.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  fifoStatus | Tx Event FIFO Status. Refer struct MCAN_TxEventFIFOStatus.

## ◆ MCAN_writeTxEventFIFOAck()

int32_t MCAN_writeTxEventFIFOAck | ( | uint32_t | baseAddr,
|  | uint32_t | idx
| ) |  |

This API will write Event FIFO Acknowledge Index.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  idx | Event FIFO Acknowledge Index

Returns
  status Acknowledgement Status.

## ◆ MCAN_eccForceError()

void MCAN_eccForceError | ( | uint32_t | baseAddr,
|  | const MCAN_ECCErrForceParams * | eccErr
| ) |  |

This API will Force Error on ECC.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  eccErr | Force Error on ECC configuration. Refer struct MCAN_ECCErrForceParams.

## ◆ MCAN_eccGetErrorStatus()

void MCAN_eccGetErrorStatus | ( | uint32_t | baseAddr,
|  | MCAN_ECCErrStatus * | eccErr
| ) |  |

This API will return ECC Error status.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  eccErr | ECC error status. Refer struct MCAN_ECCErrStatus.

## ◆ MCAN_eccClearErrorStatus()

void MCAN_eccClearErrorStatus | ( | uint32_t | baseAddr,
|  | uint32_t | errType
| ) |  |

This API is used to clear the ECC Error status.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  errType | Error type to clear status. Refer enum MCAN_ECCErrType.

## ◆ MCAN_eccWriteEOI()

void MCAN_eccWriteEOI | ( | uint32_t | baseAddr,
|  | uint32_t | errType
| ) |  |

This API is used to write End of Interrupt for ECC interrupt.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  errType | Interrupt to enable. Refer enum MCAN_ECCErrType.

## ◆ MCAN_eccEnableIntr()

void MCAN_eccEnableIntr | ( | uint32_t | baseAddr,
|  | uint32_t | errType,
|  | uint32_t | enable
| ) |  |

This API is used to enable ECC interrupt.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  errType | Interrupt to enable. Refer enum MCAN_ECCErrType.
  enable | ECC Interrupt is enabled if it is TRUE. ECC Interrupt is disabled if it is FALSE.

## ◆ MCAN_eccGetIntrStatus()

uint32_t MCAN_eccGetIntrStatus | ( | uint32_t | baseAddr,
|  | uint32_t | errType
| ) |  |

This API is used to get ECC interrupt status.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  errType | Interrupt status to read. Refer enum MCAN_ECCErrType.

## ◆ MCAN_eccClearIntrStatus()

void MCAN_eccClearIntrStatus | ( | uint32_t | baseAddr,
|  | uint32_t | errType
| ) |  |

This API is used to clear ECC interrupt status.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  errType | Interrupt status to clear. Refer enum MCAN_ECCErrType.

## ◆ MCAN_extTSCounterConfig()

void MCAN_extTSCounterConfig | ( | uint32_t | baseAddr,
|  | uint32_t | prescalar
| ) |  |

This API will configure external timestamp counter for MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  prescalar | Timestamp Counter Prescaler. Range:[0x0-0xFFFFFF]

Note
  Actual value programmed prescalar values is (prescalar - 1).

## ◆ MCAN_extTSCounterEnable()

void MCAN_extTSCounterEnable | ( | uint32_t | baseAddr,
|  | uint32_t | enable
| ) |  |

This API will enable/disable fast external time stamp counter for MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  enable | External TS is enabled if it is 1. External TS is disabled if it is 0.

## ◆ MCAN_extTSEnableIntr()

void MCAN_extTSEnableIntr | ( | uint32_t | baseAddr,
|  | uint32_t | enable
| ) |  |

This API will enable/disable External TimeStamp Counter Overflow Interrupt for MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  enable | External TimeStamp Counter Overflow Interrupt is enabled if it is TRUE. External TimeStamp Counter Overflow Interrupt is disabled if it is FALSE.

## ◆ MCAN_extTSWriteEOI()

void MCAN_extTSWriteEOI | ( | uint32_t | baseAddr | ) |

This API is used to write End of Interrupt for External TimeStamp Counter Overflow Interrupt.

Parameters

  baseAddr | Base Address of the MCAN Registers.

## ◆ MCAN_extTSGetUnservicedIntrCount()

uint32_t MCAN_extTSGetUnservicedIntrCount | ( | uint32_t | baseAddr | ) |

This API returns Number of unserviced rollover/overflow interrupts for external TimeStamp counter.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  status Returns Number of unserviced rollover/overflow interrupts for external TimeStamp counter. Maximum number of unserviced interrupts is 0xF.

## ◆ MCAN_getRevisionId()

void MCAN_getRevisionId | ( | uint32_t | baseAddr,
|  | MCAN_RevisionId * | revId
| ) |  |

This API is used get the MCAN revision ID.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  revId | Contains Revision ID of MCAN module. Refer struct MCAN_RevisionId.

## ◆ MCAN_getClockStopAck()

uint32_t MCAN_getClockStopAck | ( | uint32_t | baseAddr | ) |

This API get clock stop acknowledgement for MCAN module. It return whether MCAN is power down mode or not.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  status Return Clock Stop Acknowledgement status. Return '1' if M_CAN is set in power down mode else returns '0'.

## ◆ MCAN_extTSSetRawStatus()

void MCAN_extTSSetRawStatus | ( | uint32_t | baseAddr | ) |

This API will set External TimeStamp Counter Overflow Interrupt Raw status for MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.

## ◆ MCAN_extTSClearRawStatus()

void MCAN_extTSClearRawStatus | ( | uint32_t | baseAddr | ) |

This API will clear External TimeStamp Counter Overflow Interrupt raw status for MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.

## ◆ MCAN_getRxPinState()

uint32_t MCAN_getRxPinState | ( | uint32_t | baseAddr | ) |

This API will return Rx pin state of MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  state MCAN Rx Pin State. 0= The CAN bus is dominant 1= The CAN bus is recessive

## ◆ MCAN_setTxPinState()

void MCAN_setTxPinState | ( | uint32_t | baseAddr,
|  | uint32_t | state
| ) |  |

This API will set Tx pin state of MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  state | MCAN Tx Pin State. 00= Reset value 01= Sample Point can be monitored at tx pin 10= The CAN bus is dominant 11= The CAN bus is recessive other= It will treated as 11.

## ◆ MCAN_getTxPinState()

uint32_t MCAN_getTxPinState | ( | uint32_t | baseAddr | ) |

This API will return Tx pin state of MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  state MCAN Tx Pin State. 00= Reset value 01= Sample Point can be monitored at tx pin 10= The CAN bus is dominant 11= The CAN bus is recessive

## ◆ MCAN_getTSCounterVal()

uint32_t MCAN_getTSCounterVal | ( | uint32_t | baseAddr | ) |

This API will return current timestamp counter value.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  val Current Timestamp counter value.

## ◆ MCAN_getClkStopAck()

uint32_t MCAN_getClkStopAck | ( | uint32_t | baseAddr | ) |

This API will return clock stop acknowledgement for MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  ack Clock Stop Acknowledge 0= No clock stop acknowledged 1= M_CAN may be set in power down

## ◆ MCAN_getBitTime()

void MCAN_getBitTime | ( | uint32_t | baseAddr,
|  | MCAN_BitTimingParams * | configParams
| ) |  |

This API will get the configured bit timings for MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  configParams | Configuration parameters for MCAN bit timing. Refer struct MCAN_BitTimingParams.

## ◆ MCAN_resetTSCounter()

void MCAN_resetTSCounter | ( | uint32_t | baseAddr | ) |

This API will reset timestamp counter value.

Parameters

  baseAddr | Base Address of the MCAN Registers.

## ◆ MCAN_getTOCounterVal()

uint32_t MCAN_getTOCounterVal | ( | uint32_t | baseAddr | ) |

This API will return current time-out counter value.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  val Current Time-out counter value.

## ◆ MCAN_eccAggrGetRevisionId()

void MCAN_eccAggrGetRevisionId | ( | uint32_t | baseAddr,
|  | MCAN_ECCAggrRevisionId * | revId
| ) |  |

This API is used get the ECC AGGR revision ID.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  revId | Contains Revision ID of ECC AGGR. Refer struct MCAN_ECCAggrRevisionId.

## ◆ MCAN_eccWrapGetRevisionId()

void MCAN_eccWrapGetRevisionId | ( | uint32_t | baseAddr,
|  | MCAN_ECCWrapRevisionId * | revId
| ) |  |

This API is used get the ECC Wrapper revision ID.

Parameters

  baseAddr | Base Address of the MCAN Registers.
  revId | Contains Revision ID of ECC Wrapper Refer struct MCAN_ECCWrapRevisionId.

## ◆ MCAN_extTSIsIntrEnable()

uint32_t MCAN_extTSIsIntrEnable | ( | uint32_t | baseAddr | ) |

This API returns External TimeStamp Counter Overflow Interrupt enable status for MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  status Returns TRUE if External TimeStamp Counter Overflow Interrupt is enabled. Else returns FALSE.

## ◆ MCAN_getEndianVal()

uint32_t MCAN_getEndianVal | ( | uint32_t | baseAddr | ) |

This function return endianness value of MCAN module.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Return values

  val | Endianness value. (0x87654321)

## ◆ MCAN_getExtIDANDMassk()

uint32_t MCAN_getExtIDANDMassk | ( | uint32_t | baseAddr | ) |

This API will get the configured Extended ID AND Mask.

Parameters

  baseAddr | Base Address of the MCAN Registers.

Returns
  idMask Extended ID AND Mask.

## ◆ MCAN_initTxBufElement()

void MCAN_initTxBufElement | ( | MCAN_TxBufElement * | txMsg | ) |

This API will initialize TX message object with default values.

Parameters

  txMsg | Pointer to TX Message Object. Refer struct MCAN_TxBufElement.

## ◆ MCAN_initOperModeParams()

void MCAN_initOperModeParams | ( | MCAN_InitParams * | initParams | ) |

This API will initialize MCAN Operating mode params with default values.

Parameters

  initParams | Pointer to MCAN Operating mode Initialization params. Refer struct MCAN_InitParams.

## ◆ MCAN_initGlobalFilterConfigParams()

void MCAN_initGlobalFilterConfigParams | ( | MCAN_ConfigParams * | configParams | ) |

This API will initialize MCAN Global Filter config params with default values.

Parameters

  configParams | Pointer to MCAN Global Filter Config parameters. Refer struct MCAN_ConfigParams.

## ◆ MCAN_initSetBitTimeParams()

void MCAN_initSetBitTimeParams | ( | MCAN_BitTimingParams * | bitTimes | ) |

This API will initialize MCAN GBit Timing params with default 1Mbps and 5Mbps as nominal and data bit-rate respectively.

Parameters

  bitTimes | Configuration parameters for MCAN bit timing. Refer struct MCAN_BitTimingParams.

## ◆ MCAN_initMsgRamConfigParams()

void MCAN_initMsgRamConfigParams | ( | MCAN_MsgRAMConfigParams * | msgRAMConfigParams | ) |

This API will initialize MCAN message config RAM params to default.

Parameters

  msgRAMConfigParams | User Configuration parameters for MCAN Msg RAM. Refer struct MCAN_MsgRAMConfigParams.

## ◆ MCAN_calcMsgRamParamsStartAddr()

int32_t MCAN_calcMsgRamParamsStartAddr | ( | MCAN_MsgRAMConfigParams * | msgRAMConfigParams | ) |

This API will calculate start addresses of message RAM params.

Parameters

  msgRAMConfigParams | User Configuration parameters for MCAN Msg RAM. Refer struct MCAN_MsgRAMConfigParams.

Returns
  status Address calculation status.

## ◆ MCAN_calcCfgAddr()

uint32_t MCAN_calcCfgAddr | ( | uint32_t | baseAddr | ) |

This API will calculate configure addresses register for the MCAN module.

Parameters

  baseAddr | Base Address of mcan module

Returns
  status Address calculation status.