This module contains APIs to program and use the MCAN module.
Files | |
file | mcan/v0/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_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... | |
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... | |
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... | |
Macros | |
#define | MCAN_INTR_MASK_ALL |
Macro defines mask for all the interrupts status for MCAN. More... | |
#define | MCAN_MAX_PAYLOAD_BYTES (64U) |
Maximum payload supported by CAN-FD protocol 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 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) |
#define MCAN_INTR_MASK_ALL |
Macro defines mask for all the interrupts status for MCAN.
#define MCAN_MAX_PAYLOAD_BYTES (64U) |
Maximum payload supported by CAN-FD protocol in bytes.
#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
#define MCAN_MSG_RAM_EXT_ELEM_SIZE (2U) |
Extended ID Filter Element 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
#define MCAN_RX_FIFO_OPERATION_MODE_BLOCKING (0U) |
Macros to represent the MCAN RX FIFO mode of operation.
MCAN Blocking mode
#define MCAN_RX_FIFO_OPERATION_MODE_OVERWRITE (1U) |
MCAN Overwrite mode
#define MCAN_TX_MEM_TYPE_BUF (0U) |
Macros to represent the MCAN Tx Message RAM type.
MCAN Tx Msg RAM buffers/FIFO
#define MCAN_TX_MEM_TYPE_QUEUE (1U) |
MCAN Tx Msg RAM Queue
#define MCAN_DATA_SIZE_0BYTES (0U) |
Macros to represent MCAN Data Size.
0 byte data field
#define MCAN_DATA_SIZE_1BYTES (1U) |
1 byte data field
#define MCAN_DATA_SIZE_2BYTES (2U) |
2 byte data field
#define MCAN_DATA_SIZE_3BYTES (3U) |
3 byte data field
#define MCAN_DATA_SIZE_4BYTES (4U) |
4 byte data field
#define MCAN_DATA_SIZE_5BYTES (5U) |
5 byte data field
#define MCAN_DATA_SIZE_6BYTES (6U) |
6 byte data field
#define MCAN_DATA_SIZE_7BYTES (7U) |
7 byte data field
#define MCAN_DATA_SIZE_8BYTES (8U) |
8 byte data field
#define MCAN_DATA_SIZE_12BYTES (9U) |
12 byte data field
#define MCAN_DATA_SIZE_16BYTES (10U) |
16 byte data field
#define MCAN_DATA_SIZE_20BYTES (11U) |
20 byte data field
#define MCAN_DATA_SIZE_24BYTES (12U) |
24 byte data field
#define MCAN_DATA_SIZE_32BYTES (13U) |
32 byte data field
#define MCAN_DATA_SIZE_48BYTES (14U) |
48 byte data field
#define MCAN_DATA_SIZE_64BYTES (15U) |
64 byte data field
#define MCAN_STD_FILT_ELEM_DISABLE (0U) |
Macros to represent Standard Filter Element Configuration.
Disable filter element
#define MCAN_STD_FILT_ELEM_FIFO0 (1U) |
Store in Rx FIFO 0 if filter matches
#define MCAN_STD_FILT_ELEM_FIFO1 (2U) |
Store in Rx FIFO 1 if filter matches
#define MCAN_STD_FILT_ELEM_REJECT (3U) |
Reject ID if filter matches
#define MCAN_STD_FILT_ELEM_SET_PRIORITY (4U) |
Set priority if filter matches
#define MCAN_STD_FILT_ELEM_SET_PRIORITY_FIFO0 (5U) |
Set priority and store in FIFO 0 if filter matches
#define MCAN_STD_FILT_ELEM_SET_PRIORITY_FIFO1 (6U) |
Set priority and store in FIFO 1 if filter matches
#define MCAN_STD_FILT_ELEM_BUFFER (7U) |
Store into Rx Buffer or as debug message, configuration of SFT[1:0] ignored
#define MCAN_STD_FILT_TYPE_RANGE (0U) |
Macros to represent Standard Filter Types.
Range filter from SFID1 to SFID2 (SFID2 ≥ SFID1)
#define MCAN_STD_FILT_TYPE_DUAL (1U) |
Dual ID filter for SFID1 or SFID2
#define MCAN_STD_FILT_TYPE_CLASSIC (2U) |
Classic filter: SFID1 = filter, SFID2 = mask
#define MCAN_STD_FILT_TYPE_DISABLE (3U) |
Filter element disabled
#define MCAN_EXT_FILT_ELEM_DISABLE (0U) |
Macros to represent Extended Filter Element Configuration.
Disable filter element
#define MCAN_EXT_FILT_ELEM_FIFO0 (1U) |
Store in Rx FIFO 0 if filter matches
#define MCAN_EXT_FILT_ELEM_FIFO1 (2U) |
Store in Rx FIFO 1 if filter matches
#define MCAN_EXT_FILT_ELEM_REJECT (3U) |
Reject ID if filter matches
#define MCAN_EXT_FILT_ELEM_SET_PRIORITY (4U) |
Set priority if filter matches
#define MCAN_EXT_FILT_ELEM_SET_PRIORITY_FIFO0 (5U) |
Set priority and store in FIFO 0 if filter matches
#define MCAN_EXT_FILT_ELEM_SET_PRIORITY_FIFO1 (6U) |
Set priority and store in FIFO 1 if filter matches
#define MCAN_EXT_FILT_ELEM_BUFFER (7U) |
Store into Rx Buffer or as debug message, configuration of SFT[1:0] ignored
#define MCAN_EXT_FILT_TYPE_RANGE (0U) |
Macros to represent Extended Filter Types.
Range filter from SFID1 to SFID2 (SFID2 ≥ SFID1)
#define MCAN_EXT_FILT_TYPE_DUAL (1U) |
Dual ID filter for SFID1 or SFID2
#define MCAN_EXT_FILT_TYPE_CLASSIC (2U) |
Classic filter: SFID1 = filter, SFID2 = mask
#define MCAN_EXT_FILT_TYPE_DISABLE (3U) |
Range filter from EFID1 to EFID2 (EFID2 ≥ EFID1), XIDAM mask not applied
#define MCAN_INTR_LINE_NUM_0 (0U) |
MCAN interrupt line 0
#define MCAN_INTR_LINE_NUM_1 (1U) |
MCAN interrupt line 1
#define MCAN_ID_TYPE_11_BIT (0U) |
11bit MCAN Standard Identifier
#define MCAN_ID_TYPE_29_BIT (1U) |
29bit MCAN Extended Identifier
#define MCAN_OPERATION_MODE_NORMAL (0U) |
MCAN normal mode
#define MCAN_OPERATION_MODE_SW_INIT (1U) |
MCAN SW initialization mode
#define MCAN_MEM_TYPE_BUF (0U) |
MCAN Msg RAM buffers
#define MCAN_MEM_TYPE_FIFO (1U) |
MCAN Msg RAM FIFO/Queue
#define MCAN_RX_FIFO_NUM_0 (0U) |
MCAN Rx FIFO 0
#define MCAN_RX_FIFO_NUM_1 (1U) |
MCAN Rx FIFO 1
#define MCAN_PIN_TYPE_RX (0U) |
MCAN Rx Pin
#define MCAN_PIN_TYPE_TX (1U) |
MCAN Tx Pin
#define MCAN_ELEM_SIZE_8BYTES (0U) |
8 byte data field
#define MCAN_ELEM_SIZE_12BYTES (1U) |
12 byte data field
#define MCAN_ELEM_SIZE_16BYTES (2U) |
16 byte data field
#define MCAN_ELEM_SIZE_20BYTES (3U) |
20 byte data field
#define MCAN_ELEM_SIZE_24BYTES (4U) |
24 byte data field
#define MCAN_ELEM_SIZE_32BYTES (5U) |
32 byte data field
#define MCAN_ELEM_SIZE_48BYTES (6U) |
48 byte data field
#define MCAN_ELEM_SIZE_64BYTES (7U) |
64 byte data field
#define MCAN_TIMEOUT_SELECT_CONT (0U) |
Continuous operation Mode
#define MCAN_TIMEOUT_SELECT_TX_EVENT_FIFO (1U) |
Timeout controlled by Tx Event FIFO
#define MCAN_TIMEOUT_SELECT_RX_FIFO0 (2U) |
Timeout controlled by Rx FIFO 0
#define MCAN_TIMEOUT_SELECT_RX_FIFO1 (3U) |
Timeout controlled by Rx FIFO 1
#define MCAN_INTR_SRC_RX_FIFO0_NEW_MSG (MCAN_IR_RF0N_MASK) |
Rx FIFO 0 New Message interrupt
#define MCAN_INTR_SRC_RX_FIFO0_WATERMARK (MCAN_IR_RF0W_MASK) |
Rx FIFO 0 Watermark Reached interrupt
#define MCAN_INTR_SRC_RX_FIFO0_FULL (MCAN_IR_RF0F_MASK) |
Rx FIFO 0 Full interrupt
#define MCAN_INTR_SRC_RX_FIFO0_MSG_LOST (MCAN_IR_RF0L_MASK) |
Rx FIFO 0 Message Lost interrupt
#define MCAN_INTR_SRC_RX_FIFO1_NEW_MSG (MCAN_IR_RF1N_MASK) |
Rx FIFO 1 New Message interrupt
#define MCAN_INTR_SRC_RX_FIFO1_WATERMARK (MCAN_IR_RF1W_MASK) |
Rx FIFO 1 Watermark Reached interrupt
#define MCAN_INTR_SRC_RX_FIFO1_FULL (MCAN_IR_RF1F_MASK) |
Rx FIFO 1 Full interrupt
#define MCAN_INTR_SRC_RX_FIFO1_MSG_LOST (MCAN_IR_RF1L_MASK) |
Rx FIFO 1 Message Lost interrupt
#define MCAN_INTR_SRC_HIGH_PRIO_MSG (MCAN_IR_HPM_MASK) |
High Priority Message interrupt
#define MCAN_INTR_SRC_TRANS_COMPLETE (MCAN_IR_TC_MASK) |
Transmission Completed interrupt
#define MCAN_INTR_SRC_TRANS_CANCEL_FINISH (MCAN_IR_TCF_MASK) |
Transmission Cancellation Finished interrupt
#define MCAN_INTR_SRC_TX_FIFO_EMPTY (MCAN_IR_TFE_MASK) |
Tx FIFO Empty interrupt
#define MCAN_INTR_SRC_TX_EVT_FIFO_NEW_ENTRY (MCAN_IR_TEFN_MASK) |
Tx Event FIFO New Entry interrupt
#define MCAN_INTR_SRC_TX_EVT_FIFO_WATERMARK (MCAN_IR_TEFW_MASK) |
Tx Event FIFO Watermark Reached interrupt
#define MCAN_INTR_SRC_TX_EVT_FIFO_FULL (MCAN_IR_TEFF_MASK) |
Tx Event FIFO Full interrupt
#define MCAN_INTR_SRC_TX_EVT_FIFO_ELEM_LOST (MCAN_IR_TEFL_MASK) |
Tx Event FIFO Element Lost interrupt
#define MCAN_INTR_SRC_TIMESTAMP_WRAPAROUND (MCAN_IR_TSW_MASK) |
Timestamp Wraparound interrupt
#define MCAN_INTR_SRC_MSG_RAM_ACCESS_FAILURE (MCAN_IR_MRAF_MASK) |
Message RAM Access Failure interrupt
#define MCAN_INTR_SRC_TIMEOUT (MCAN_IR_TOO_MASK) |
Timeout Occurred interrupt
#define MCAN_INTR_SRC_DEDICATED_RX_BUFF_MSG (MCAN_IR_DRX_MASK) |
Message stored to Dedicated Rx Buffer interrupt
#define MCAN_INTR_SRC_BIT_ERR_CORRECTED (MCAN_IR_BEC_MASK) |
Bit Error Corrected interrupt
#define MCAN_INTR_SRC_BIT_ERR_UNCORRECTED (MCAN_IR_BEU_MASK) |
Bit Error Uncorrected interrupt
#define MCAN_INTR_SRC_ERR_LOG_OVRFLW (MCAN_IR_ELO_MASK) |
Error Logging Overflow interrupt
#define MCAN_INTR_SRC_ERR_PASSIVE (MCAN_IR_EP_MASK) |
Error Passive interrupt
#define MCAN_INTR_SRC_WARNING_STATUS (MCAN_IR_EW_MASK) |
Warning Status interrupt
#define MCAN_INTR_SRC_BUS_OFF_STATUS (MCAN_IR_BO_MASK) |
Bus_Off Status interrupt
#define MCAN_INTR_SRC_WATCHDOG (MCAN_IR_WDI_MASK) |
Watchdog Interrupt interrupt
#define MCAN_INTR_SRC_PROTOCOL_ERR_ARB (MCAN_IR_PEA_MASK) |
Protocol Error in Arbitration Phase interrupt
#define MCAN_INTR_SRC_PROTOCOL_ERR_DATA (MCAN_IR_PED_MASK) |
Protocol Error in Data Phase interrupt
#define MCAN_INTR_SRC_RES_ADDR_ACCESS (MCAN_IR_ARA_MASK) |
Access to Reserved Address interrupt
#define MCAN_ECC_ERR_TYPE_SEC (0U) |
ECC Single Error Correction
#define MCAN_ECC_ERR_TYPE_DED (1U) |
ECC Single Error Detection
#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.
#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
#define MCAN_COM_STATE_SYNCHRONIZING (0U) |
MCAN is synchronizing on CAN communication
#define MCAN_COM_STATE_IDLE (1U) |
MCAN is neither receiver nor transmitter
#define MCAN_COM_STATE_RECEIVER (2U) |
MCAN is operating as receiver
#define MCAN_COM_STATE_TRANSMITTER (3U) |
MCAN is operating as transmitter
#define MCAN_ERR_CODE_NO_ERROR (0U) |
No error occurred since LEC has been reset by successful reception or transmission.
#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.
#define MCAN_ERR_CODE_FORM_ERROR (2U) |
A fixed format part of a received frame has the wrong format.
#define MCAN_ERR_CODE_ACK_ERROR (3U) |
The message transmitted by the M_CAN was not acknowledged by another node.
#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.
#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).
#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.
#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 uint32_t MCAN_IntrLineNum |
Enum to select the MCAN interrupt lines.
typedef uint32_t MCAN_IdType |
Enum to represent the MCAN Identifier Type.
typedef uint32_t MCAN_OperationMode |
Enum to represent the MCAN mode of operation.
typedef uint32_t MCAN_MemType |
Enum to represent the MCAN Message RAM type.
typedef uint32_t MCAN_RxFIFONum |
Enum to represent the MCAN Rx FIFO number.
typedef uint32_t MCAN_PinType |
Enum to represent the MCAN pin type.
typedef uint32_t MCAN_ElemSize |
Enum to represent FIFO/Buffer element Size.
typedef uint32_t MCAN_TimeOutSelect |
Enum to represent the MCAN time-out counter configuration.
typedef uint32_t MCAN_IntrSrc |
Enum for MCAN interrupts.
typedef uint32_t MCAN_ECCErrType |
Enum to represent the ECC Error Types.
typedef uint32_t MCAN_LpbkMode |
Enum to select the MCAN Loopback mode.
typedef uint32_t MCAN_ComState |
Enum to represent MCAN's communication state.
typedef uint32_t MCAN_ErrCode |
Enum to represent MCAN's Error Code.
void MCAN_reset | ( | uint32_t | baseAddr | ) |
This API is used to initiate reset for MCAN module.
baseAddr | Base Address of the MCAN Registers. |
uint32_t MCAN_isInReset | ( | uint32_t | baseAddr | ) |
This function checks if the MCAN module is in Reset.
baseAddr | Base Address of the MCAN Registers. |
state | Returns TRUE if reset is in progress. Else returns FALSE. |
uint32_t MCAN_isFDOpEnable | ( | uint32_t | baseAddr | ) |
This API will return flexible data rate operation status MCAN module.
baseAddr | Base Address of the MCAN Registers. |
uint32_t MCAN_isMemInitDone | ( | uint32_t | baseAddr | ) |
This function checks if the memory initialization is done for MCAN module.
baseAddr | Base Address of the MCAN Registers. |
state | Returns TRUE if memory initialization is done. Else returns FALSE. |
void MCAN_setOpMode | ( | uint32_t | baseAddr, |
uint32_t | mode | ||
) |
This API will set MCAN module mode of operation.
baseAddr | Base Address of the MCAN Registers. |
mode | Mode of operation. Refer enum MCAN_OperationMode. |
uint32_t MCAN_getOpMode | ( | uint32_t | baseAddr | ) |
This API will return MCAN module mode of operation.
baseAddr | Base Address of the MCAN Registers. |
int32_t MCAN_init | ( | uint32_t | baseAddr, |
const MCAN_InitParams * | initParams | ||
) |
This API will initialize MCAN module.
baseAddr | Base Address of the MCAN Registers. |
initParams | Initialization parameters. Refer struct MCAN_InitParams. |
int32_t MCAN_config | ( | uint32_t | baseAddr, |
const MCAN_ConfigParams * | configParams | ||
) |
This API will configure MCAN module.
baseAddr | Base Address of the MCAN Registers. |
configParams | configuration parameters. Refer struct MCAN_ConfigParams. |
void MCAN_eccConfig | ( | uint32_t | baseAddr, |
const MCAN_ECCConfigParams * | configParams | ||
) |
This API will enable/disable ECC on the Message RAM.
baseAddr | Base Address of the MCAN Registers. |
configParams | MCAN ECC Configuration Parameters. Refer struct MCAN_ECCConfigParams. |
int32_t MCAN_setBitTime | ( | uint32_t | baseAddr, |
const MCAN_BitTimingParams * | configParams | ||
) |
This API will configure a bit timings for MCAN module.
baseAddr | Base Address of the MCAN Registers. |
configParams | Configuration parameters for MCAN bit timing. Refer struct MCAN_BitTimingParams. |
int32_t MCAN_msgRAMConfig | ( | uint32_t | baseAddr, |
const MCAN_MsgRAMConfigParams * | msgRAMConfigParams | ||
) |
This API will configure Different sections of Message RAM.
baseAddr | Base Address of the MCAN Registers. |
msgRAMConfigParams | Message RAM Configuration parameters. Refer struct MCAN_MsgRAMConfigParams. |
int32_t MCAN_setExtIDAndMask | ( | uint32_t | baseAddr, |
uint32_t | idMask | ||
) |
This API will configure Extended ID AND Mask.
baseAddr | Base Address of the MCAN Registers. |
idMask | Configuration parameters for MCAN Extended Id mask. This value is 29 bit wide. |
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.
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. |
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.
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. |
int32_t MCAN_txBufAddReq | ( | uint32_t | baseAddr, |
uint32_t | bufNum | ||
) |
This API will set Tx Buffer Add Request.
baseAddr | Base Address of the MCAN Registers. |
bufNum | Tx Buffer number for which request is to be added. |
void MCAN_getNewDataStatus | ( | uint32_t | baseAddr, |
MCAN_RxNewDataStatus * | newDataStatus | ||
) |
This API will return New Data Message Status.
baseAddr | Base Address of the MCAN Registers. |
newDataStatus | Rx Buffer new data status. Refer struct MCAN_RxNewDataStatus. |
void MCAN_clearNewDataStatus | ( | uint32_t | baseAddr, |
const MCAN_RxNewDataStatus * | newDataStatus | ||
) |
This API clear New Data Message Status.
baseAddr | Base Address of the MCAN Registers. |
newDataStatus | Rx Buffer new data status. Refer struct MCAN_RxNewDataStatus. |
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.
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. |
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.
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. |
void MCAN_readTxEventFIFO | ( | uint32_t | baseAddr, |
MCAN_TxEventFIFOElement * | txEventElem | ||
) |
This API is used to read message form Tx Event FIFO.
baseAddr | Base Address of the MCAN Registers. |
txEventElem | Tx Event FIFO Message Object. Refer struct MCAN_TxEventFIFOElement. |
void MCAN_addStdMsgIDFilter | ( | uint32_t | baseAddr, |
uint32_t | filtNum, | ||
const MCAN_StdMsgIDFilterElement * | elem | ||
) |
This API is used to add Standard Message ID Filter Element.
baseAddr | Base Address of the MCAN Registers. |
filtNum | Filter number. |
elem | Filter Object. Refer struct MCAN_StdMsgIDFilterElement. |
void MCAN_addExtMsgIDFilter | ( | uint32_t | baseAddr, |
uint32_t | filtNum, | ||
const MCAN_ExtMsgIDFilterElement * | elem | ||
) |
This API is used to add Extended Message ID Filter Element.
baseAddr | Base Address of the MCAN Registers. |
filtNum | Filter number. |
elem | Filter Object. Refer struct MCAN_ExtMsgIDFilterElement. |
void MCAN_lpbkModeEnable | ( | uint32_t | baseAddr, |
uint32_t | lpbkMode, | ||
uint32_t | enable | ||
) |
This API will enable/disable Loop Back Test Mode for MCAN module.
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. |
void MCAN_getErrCounters | ( | uint32_t | baseAddr, |
MCAN_ErrCntStatus * | errCounter | ||
) |
This API will return error counter status for MCAN module.
baseAddr | Base Address of the MCAN Registers. |
errCounter | Error Counter Status. Refer struct MCAN_ErrCntStatus. |
void MCAN_getProtocolStatus | ( | uint32_t | baseAddr, |
MCAN_ProtocolStatus * | protStatus | ||
) |
This API will return protocol status for MCAN module.
baseAddr | Base Address of the MCAN Registers. |
protStatus | Protocol Status. Refer struct MCAN_ProtocolStatus. |
void MCAN_enableIntr | ( | uint32_t | baseAddr, |
uint32_t | intrMask, | ||
uint32_t | enable | ||
) |
This API is used to enable/disable interrupts.
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. |
void MCAN_selectIntrLine | ( | uint32_t | baseAddr, |
uint32_t | intrMask, | ||
uint32_t | lineNum | ||
) |
This API is used to select interrupt line.
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, |
uint32_t MCAN_getIntrLineSelectStatus | ( | uint32_t | baseAddr | ) |
This API is used to get interrupt line selected for each interrupt.
baseAddr | Base Address of the MCAN Registers. |
void MCAN_enableIntrLine | ( | uint32_t | baseAddr, |
uint32_t | lineNum, | ||
uint32_t | enable | ||
) |
This API is used to enable/disable selected interrupt line.
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. |
uint32_t MCAN_getIntrStatus | ( | uint32_t | baseAddr | ) |
This API will return interrupt status.
baseAddr | Base Address of the MCAN Registers. |
void MCAN_clearIntrStatus | ( | uint32_t | baseAddr, |
uint32_t | intrMask | ||
) |
This API is used to clear the interrupt status.
baseAddr | Base Address of the MCAN Registers. |
intrMask | Interrupts to clear status. |
void MCAN_getHighPriorityMsgStatus | ( | uint32_t | baseAddr, |
MCAN_HighPriorityMsgInfo * | hpm | ||
) |
This API will return High Priority Message Status.
baseAddr | Base Address of the MCAN Registers. |
hpm | High Priority Message Status. Refer struct MCAN_HighPriorityMsgInfo. |
void MCAN_getRxFIFOStatus | ( | uint32_t | baseAddr, |
MCAN_RxFIFOStatus * | fifoStatus | ||
) |
This API will Rx FIFO status.
baseAddr | Base Address of the MCAN Registers. |
fifoStatus | Rx FIFO Status. Refer struct MCAN_RxFIFOStatus. |
int32_t MCAN_writeRxFIFOAck | ( | uint32_t | baseAddr, |
uint32_t | fifoNum, | ||
uint32_t | idx | ||
) |
This API will write Rx FIFO Acknowledgement.
baseAddr | Base Address of the MCAN Registers. Refer enum MCAN_RxFIFONum. |
fifoNum | FIFO Number. |
idx | Rx FIFO Acknowledge Index |
void MCAN_getTxFIFOQueStatus | ( | uint32_t | baseAddr, |
MCAN_TxFIFOStatus * | fifoStatus | ||
) |
This API will Tx FIFO status.
baseAddr | Base Address of the MCAN Registers. |
fifoStatus | Tx FIFO Status. Refer struct MCAN_TxFIFOStatus. |
uint32_t MCAN_getTxBufReqPend | ( | uint32_t | baseAddr | ) |
This API will return Tx Buffer Request Pending status.
baseAddr | Base Address of the MCAN Registers. |
int32_t MCAN_txBufCancellationReq | ( | uint32_t | baseAddr, |
uint32_t | buffNum | ||
) |
This API will set Tx Buffer Cancellation Request.
baseAddr | Base Address of the MCAN Registers. |
buffNum | Tx Buffer number for which request is to be added. |
uint32_t MCAN_getTxBufTransmissionStatus | ( | uint32_t | baseAddr | ) |
This API will return Tx Buffer Transmission Occurred status.
baseAddr | Base Address of the MCAN Registers. |
uint32_t MCAN_txBufCancellationStatus | ( | uint32_t | baseAddr | ) |
This API will return Transmit Buffer Cancellation Finished status.
baseAddr | Base Address of the MCAN Registers. |
int32_t MCAN_txBufTransIntrEnable | ( | uint32_t | baseAddr, |
uint32_t | bufNum, | ||
uint32_t | enable | ||
) |
This API is used to enable/disable Tx Buffer Transmission Interrupt.
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. |
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.
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. |
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.
baseAddr | Base Address of the MCAN Registers. |
enable | Add CLock Stop Request. Adds Clock Clock stop Request is TRUE otherwise removes it. |
void MCAN_getTxEventFIFOStatus | ( | uint32_t | baseAddr, |
MCAN_TxEventFIFOStatus * | fifoStatus | ||
) |
This API will Tx Event FIFO status.
baseAddr | Base Address of the MCAN Registers. |
fifoStatus | Tx Event FIFO Status. Refer struct MCAN_TxEventFIFOStatus. |
int32_t MCAN_writeTxEventFIFOAck | ( | uint32_t | baseAddr, |
uint32_t | idx | ||
) |
This API will write Event FIFO Acknowledge Index.
baseAddr | Base Address of the MCAN Registers. |
idx | Event FIFO Acknowledge Index |
void MCAN_eccForceError | ( | uint32_t | baseAddr, |
const MCAN_ECCErrForceParams * | eccErr | ||
) |
This API will Force Error on ECC.
baseAddr | Base Address of the MCAN Registers. |
eccErr | Force Error on ECC configuration. Refer struct MCAN_ECCErrForceParams. |
void MCAN_eccGetErrorStatus | ( | uint32_t | baseAddr, |
MCAN_ECCErrStatus * | eccErr | ||
) |
This API will return ECC Error status.
baseAddr | Base Address of the MCAN Registers. |
eccErr | ECC error status. Refer struct MCAN_ECCErrStatus. |
void MCAN_eccClearErrorStatus | ( | uint32_t | baseAddr, |
uint32_t | errType | ||
) |
This API is used to clear the ECC Error status.
baseAddr | Base Address of the MCAN Registers. |
errType | Error type to clear status. Refer enum MCAN_ECCErrType. |
void MCAN_eccWriteEOI | ( | uint32_t | baseAddr, |
uint32_t | errType | ||
) |
This API is used to write End of Interrupt for ECC interrupt.
baseAddr | Base Address of the MCAN Registers. |
errType | Interrupt to enable. Refer enum MCAN_ECCErrType. |
void MCAN_eccEnableIntr | ( | uint32_t | baseAddr, |
uint32_t | errType, | ||
uint32_t | enable | ||
) |
This API is used to enable ECC interrupt.
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. |
uint32_t MCAN_eccGetIntrStatus | ( | uint32_t | baseAddr, |
uint32_t | errType | ||
) |
This API is used to get ECC interrupt status.
baseAddr | Base Address of the MCAN Registers. |
errType | Interrupt status to read. Refer enum MCAN_ECCErrType. |
void MCAN_eccClearIntrStatus | ( | uint32_t | baseAddr, |
uint32_t | errType | ||
) |
This API is used to clear ECC interrupt status.
baseAddr | Base Address of the MCAN Registers. |
errType | Interrupt status to clear. Refer enum MCAN_ECCErrType. |
void MCAN_extTSCounterConfig | ( | uint32_t | baseAddr, |
uint32_t | prescalar | ||
) |
This API will configure external timestamp counter for MCAN module.
baseAddr | Base Address of the MCAN Registers. |
prescalar | Timestamp Counter Prescaler. Range:[0x0-0xFFFFFF] |
void MCAN_extTSCounterEnable | ( | uint32_t | baseAddr, |
uint32_t | enable | ||
) |
This API will enable/disable fast external time stamp counter for MCAN module.
baseAddr | Base Address of the MCAN Registers. |
enable | External TS is enabled if it is 1. External TS is disabled if it is 0. |
void MCAN_extTSEnableIntr | ( | uint32_t | baseAddr, |
uint32_t | enable | ||
) |
This API will enable/disable External TimeStamp Counter Overflow Interrupt for MCAN module.
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. |
void MCAN_extTSWriteEOI | ( | uint32_t | baseAddr | ) |
This API is used to write End of Interrupt for External TimeStamp Counter Overflow Interrupt.
baseAddr | Base Address of the MCAN Registers. |
uint32_t MCAN_extTSGetUnservicedIntrCount | ( | uint32_t | baseAddr | ) |
This API returns Number of unserviced rollover/overflow interrupts for external TimeStamp counter.
baseAddr | Base Address of the MCAN Registers. |
void MCAN_getRevisionId | ( | uint32_t | baseAddr, |
MCAN_RevisionId * | revId | ||
) |
This API is used get the MCAN revision ID.
baseAddr | Base Address of the MCAN Registers. |
revId | Contains Revision ID of MCAN module. Refer struct MCAN_RevisionId. |
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.
baseAddr | Base Address of the MCAN Registers. |
void MCAN_extTSSetRawStatus | ( | uint32_t | baseAddr | ) |
This API will set External TimeStamp Counter Overflow Interrupt Raw status for MCAN module.
baseAddr | Base Address of the MCAN Registers. |
void MCAN_extTSClearRawStatus | ( | uint32_t | baseAddr | ) |
This API will clear External TimeStamp Counter Overflow Interrupt raw status for MCAN module.
baseAddr | Base Address of the MCAN Registers. |
uint32_t MCAN_getRxPinState | ( | uint32_t | baseAddr | ) |
This API will return Rx pin state of MCAN module.
baseAddr | Base Address of the MCAN Registers. |
void MCAN_setTxPinState | ( | uint32_t | baseAddr, |
uint32_t | state | ||
) |
This API will set Tx pin state of MCAN module.
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. |
uint32_t MCAN_getTxPinState | ( | uint32_t | baseAddr | ) |
This API will return Tx pin state of MCAN module.
baseAddr | Base Address of the MCAN Registers. |
uint32_t MCAN_getTSCounterVal | ( | uint32_t | baseAddr | ) |
This API will return current timestamp counter value.
baseAddr | Base Address of the MCAN Registers. |
uint32_t MCAN_getClkStopAck | ( | uint32_t | baseAddr | ) |
This API will return clock stop acknowledgement for MCAN module.
baseAddr | Base Address of the MCAN Registers. |
void MCAN_getBitTime | ( | uint32_t | baseAddr, |
MCAN_BitTimingParams * | configParams | ||
) |
This API will get the configured bit timings for MCAN module.
baseAddr | Base Address of the MCAN Registers. |
configParams | Configuration parameters for MCAN bit timing. Refer struct MCAN_BitTimingParams. |
void MCAN_resetTSCounter | ( | uint32_t | baseAddr | ) |
This API will reset timestamp counter value.
baseAddr | Base Address of the MCAN Registers. |
uint32_t MCAN_getTOCounterVal | ( | uint32_t | baseAddr | ) |
This API will return current time-out counter value.
baseAddr | Base Address of the MCAN Registers. |
void MCAN_eccAggrGetRevisionId | ( | uint32_t | baseAddr, |
MCAN_ECCAggrRevisionId * | revId | ||
) |
This API is used get the ECC AGGR revision ID.
baseAddr | Base Address of the MCAN Registers. |
revId | Contains Revision ID of ECC AGGR. Refer struct MCAN_ECCAggrRevisionId. |
void MCAN_eccWrapGetRevisionId | ( | uint32_t | baseAddr, |
MCAN_ECCWrapRevisionId * | revId | ||
) |
This API is used get the ECC Wrapper revision ID.
baseAddr | Base Address of the MCAN Registers. |
revId | Contains Revision ID of ECC Wrapper Refer struct MCAN_ECCWrapRevisionId. |
uint32_t MCAN_extTSIsIntrEnable | ( | uint32_t | baseAddr | ) |
This API returns External TimeStamp Counter Overflow Interrupt enable status for MCAN module.
baseAddr | Base Address of the MCAN Registers. |
uint32_t MCAN_getEndianVal | ( | uint32_t | baseAddr | ) |
This function return endianness value of MCAN module.
baseAddr | Base Address of the MCAN Registers. |
val | Endianness value. (0x87654321) |
uint32_t MCAN_getExtIDANDMassk | ( | uint32_t | baseAddr | ) |
This API will get the configured Extended ID AND Mask.
baseAddr | Base Address of the MCAN Registers. |
void MCAN_initTxBufElement | ( | MCAN_TxBufElement * | txMsg | ) |
This API will initialize TX message object with default values.
txMsg | Pointer to TX Message Object. Refer struct MCAN_TxBufElement. |
void MCAN_initOperModeParams | ( | MCAN_InitParams * | initParams | ) |
This API will initialize MCAN Operating mode params with default values.
initParams | Pointer to MCAN Operating mode Initialization params. Refer struct MCAN_InitParams. |
void MCAN_initGlobalFilterConfigParams | ( | MCAN_ConfigParams * | configParams | ) |
This API will initialize MCAN Global Filter config params with default values.
configParams | Pointer to MCAN Global Filter Config parameters. Refer struct MCAN_ConfigParams. |
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.
bitTimes | Configuration parameters for MCAN bit timing. Refer struct MCAN_BitTimingParams. |
void MCAN_initMsgRamConfigParams | ( | MCAN_MsgRAMConfigParams * | msgRAMConfigParams | ) |
This API will initialize MCAN message config RAM params to default.
msgRAMConfigParams | User Configuration parameters for MCAN Msg RAM. Refer struct MCAN_MsgRAMConfigParams. |
int32_t MCAN_calcMsgRamParamsStartAddr | ( | MCAN_MsgRAMConfigParams * | msgRAMConfigParams | ) |
This API will calculate start addresses of message RAM params.
msgRAMConfigParams | User Configuration parameters for MCAN Msg RAM. Refer struct MCAN_MsgRAMConfigParams. |