![]() |
MCUXpresso SDK API Reference Manual
Rev 2.16.000
NXP Semiconductors
|
This section describes the programming interface of the FlexCAN driver. The FlexCAN driver configures FlexCAN module and provides functional and transactional interfaces to build the FlexCAN application.
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/flexcan
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/flexcan
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/flexcan
Data Structures | |
struct | flexcan_memory_error_report_status_t |
FlexCAN memory error register status structure. More... | |
struct | flexcan_frame_t |
FlexCAN message frame structure. More... | |
struct | flexcan_fd_frame_t |
CAN FD message frame structure. More... | |
struct | flexcan_timing_config_t |
FlexCAN protocol timing characteristic configuration structure. More... | |
struct | flexcan_config_t |
FlexCAN module configuration structure. More... | |
struct | flexcan_rx_mb_config_t |
FlexCAN Receive Message Buffer configuration structure. More... | |
struct | flexcan_rx_fifo_config_t |
FlexCAN Legacy Rx FIFO configuration structure. More... | |
struct | flexcan_enhanced_rx_fifo_std_id_filter_t |
FlexCAN Enhanced Rx FIFO Standard ID filter element structure. More... | |
struct | flexcan_enhanced_rx_fifo_ext_id_filter_t |
FlexCAN Enhanced Rx FIFO Extended ID filter element structure. More... | |
struct | flexcan_enhanced_rx_fifo_config_t |
FlexCAN Enhanced Rx FIFO configuration structure. More... | |
struct | flexcan_mb_transfer_t |
FlexCAN Message Buffer transfer. More... | |
struct | flexcan_fifo_transfer_t |
FlexCAN Rx FIFO transfer. More... | |
struct | flexcan_handle_t |
FlexCAN handle structure. More... | |
Macros | |
#define | DLC_LENGTH_DECODE(dlc) (((dlc) <= 8U) ? (dlc) : (((dlc) <= 12U) ? (((dlc)-6U) * 4U) : (((dlc)-11U) * 16U))) |
FlexCAN frame length helper macro. More... | |
#define | FLEXCAN_ID_STD(id) (((uint32_t)(((uint32_t)(id)) << CAN_ID_STD_SHIFT)) & CAN_ID_STD_MASK) |
FlexCAN Frame ID helper macro. More... | |
#define | FLEXCAN_ID_EXT(id) |
Extend Frame ID helper macro. More... | |
#define | FLEXCAN_RX_MB_STD_MASK(id, rtr, ide) |
FlexCAN Rx Message Buffer Mask helper macro. More... | |
#define | FLEXCAN_RX_MB_EXT_MASK(id, rtr, ide) |
Extend Rx Message Buffer Mask helper macro. More... | |
#define | FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(id, rtr, ide) |
FlexCAN Legacy Rx FIFO Mask helper macro. More... | |
#define | FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_HIGH(id, rtr, ide) |
Standard Rx FIFO Mask helper macro Type B upper part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_LOW(id, rtr, ide) |
Standard Rx FIFO Mask helper macro Type B lower part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_HIGH(id) (((uint32_t)(id)&0x7F8) << 21) |
Standard Rx FIFO Mask helper macro Type C upper part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_HIGH(id) (((uint32_t)(id)&0x7F8) << 13) |
Standard Rx FIFO Mask helper macro Type C mid-upper part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_LOW(id) (((uint32_t)(id)&0x7F8) << 5) |
Standard Rx FIFO Mask helper macro Type C mid-lower part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_LOW(id) (((uint32_t)(id)&0x7F8) >> 3) |
Standard Rx FIFO Mask helper macro Type C lower part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_EXT_MASK_TYPE_A(id, rtr, ide) |
Extend Rx FIFO Mask helper macro Type A helper macro. More... | |
#define | FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_HIGH(id, rtr, ide) |
Extend Rx FIFO Mask helper macro Type B upper part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_LOW(id, rtr, ide) |
Extend Rx FIFO Mask helper macro Type B lower part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_HIGH(id) ((FLEXCAN_ID_EXT(id) & 0x1FE00000) << 3) |
Extend Rx FIFO Mask helper macro Type C upper part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_HIGH(id) |
Extend Rx FIFO Mask helper macro Type C mid-upper part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_LOW(id) |
Extend Rx FIFO Mask helper macro Type C mid-lower part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_LOW(id) ((FLEXCAN_ID_EXT(id) & 0x1FE00000) >> 21) |
Extend Rx FIFO Mask helper macro Type C lower part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_STD_FILTER_TYPE_A(id, rtr, ide) FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(id, rtr, ide) |
FlexCAN Rx FIFO Filter helper macro. More... | |
#define | FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_HIGH(id, rtr, ide) |
Standard Rx FIFO Filter helper macro Type B upper part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_LOW(id, rtr, ide) |
Standard Rx FIFO Filter helper macro Type B lower part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_HIGH(id) |
Standard Rx FIFO Filter helper macro Type C upper part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_HIGH(id) |
Standard Rx FIFO Filter helper macro Type C mid-upper part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_LOW(id) |
Standard Rx FIFO Filter helper macro Type C mid-lower part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_LOW(id) |
Standard Rx FIFO Filter helper macro Type C lower part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_A(id, rtr, ide) FLEXCAN_RX_FIFO_EXT_MASK_TYPE_A(id, rtr, ide) |
Extend Rx FIFO Filter helper macro Type A helper macro. More... | |
#define | FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_HIGH(id, rtr, ide) |
Extend Rx FIFO Filter helper macro Type B upper part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_LOW(id, rtr, ide) |
Extend Rx FIFO Filter helper macro Type B lower part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_HIGH(id) |
Extend Rx FIFO Filter helper macro Type C upper part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_HIGH(id) |
Extend Rx FIFO Filter helper macro Type C mid-upper part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_LOW(id) |
Extend Rx FIFO Filter helper macro Type C mid-lower part helper macro. More... | |
#define | FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_LOW(id) FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_LOW(id) |
Extend Rx FIFO Filter helper macro Type C lower part helper macro. More... | |
#define | ENHANCED_RX_FIFO_FSCH(x) (((uint32_t)(((uint32_t)(x)) << 30)) & 0xC0000000U) |
FlexCAN Enhanced Rx FIFO Filter and Mask helper macro. More... | |
#define | FLEXCAN_ENHANCED_RX_FIFO_STD_MASK_AND_FILTER(id, rtr, id_mask, rtr_mask) (ENHANCED_RX_FIFO_FSCH(0x0) | RTR_STD_HIGH(rtr) | ID_STD_HIGH(id) | RTR_STD_LOW(rtr_mask) | ID_STD_LOW(id_mask)) |
Standard ID filter element with filter + mask scheme. More... | |
#define | FLEXCAN_ENHANCED_RX_FIFO_STD_FILTER_WITH_RANGE(id_upper, rtr, id_lower, rtr_mask) |
Standard ID filter element with filter range. More... | |
#define | FLEXCAN_ENHANCED_RX_FIFO_STD_TWO_FILTERS(id1, rtr1, id2, rtr2) (ENHANCED_RX_FIFO_FSCH(0x2) | RTR_STD_HIGH(rtr1) | ID_STD_HIGH(id1) | RTR_STD_LOW(rtr2) | ID_STD_LOW(id2)) |
Standard ID filter element with two filters without masks. More... | |
#define | FLEXCAN_ENHANCED_RX_FIFO_EXT_MASK_AND_FILTER_LOW(id, rtr) (ENHANCED_RX_FIFO_FSCH(0x0) | RTR_EXT(rtr) | ID_EXT(id)) |
Extended ID filter element with filter + mask scheme low word. More... | |
#define | FLEXCAN_ENHANCED_RX_FIFO_EXT_MASK_AND_FILTER_HIGH(id_mask, rtr_mask) (ENHANCED_RX_FIFO_FSCH(0x0) | RTR_EXT(rtr_mask) | ID_EXT(id_mask)) |
Extended ID filter element with filter + mask scheme high word. More... | |
#define | FLEXCAN_ENHANCED_RX_FIFO_EXT_FILTER_WITH_RANGE_LOW(id_upper, rtr) (ENHANCED_RX_FIFO_FSCH(0x1) | RTR_EXT(rtr) | ID_EXT(id_upper)) |
Extended ID filter element with range scheme low word. More... | |
#define | FLEXCAN_ENHANCED_RX_FIFO_EXT_FILTER_WITH_RANGE_HIGH(id_lower, rtr_mask) (ENHANCED_RX_FIFO_FSCH(0x1) | RTR_EXT(rtr_mask) | ID_EXT(id_lower)) |
Extended ID filter element with range scheme high word. More... | |
#define | FLEXCAN_ENHANCED_RX_FIFO_EXT_TWO_FILTERS_LOW(id2, rtr2) (ENHANCED_RX_FIFO_FSCH(0x2) | RTR_EXT(rtr2) | ID_EXT(id2)) |
Extended ID filter element with two filters without masks low word. More... | |
#define | FLEXCAN_ENHANCED_RX_FIFO_EXT_TWO_FILTERS_HIGH(id1, rtr1) (ENHANCED_RX_FIFO_FSCH(0x2) | RTR_EXT(rtr1) | ID_EXT(id1)) |
Extended ID filter element with two filters without masks high word. More... | |
#define | FLEXCAN_EFIFO_INT_MASK(x) (((uint64_t)(((uint64_t)(x)) << 32)) & 0xF000000000000000U) |
FlexCAN interrupt/status flag helper macro. More... | |
#define | E_RX_FIFO(base) ((uintptr_t)(base) + 0x2000U) |
FlexCAN Enhanced Rx FIFO base address helper macro. More... | |
#define | FLEXCAN_CALLBACK(x) void(x)(CAN_Type * base, flexcan_handle_t * handle, status_t status, uint64_t result, void *userData) |
FlexCAN transfer callback function. More... | |
Driver version | |
#define | FSL_FLEXCAN_DRIVER_VERSION (MAKE_VERSION(2, 11, 6)) |
FlexCAN driver version. More... | |
Initialization and deinitialization | |
bool | FLEXCAN_IsInstanceHasFDMode (CAN_Type *base) |
Determine whether the FlexCAN instance support CAN FD mode at run time. More... | |
void | FLEXCAN_EnterFreezeMode (CAN_Type *base) |
Enter FlexCAN Freeze Mode. More... | |
void | FLEXCAN_ExitFreezeMode (CAN_Type *base) |
Exit FlexCAN Freeze Mode. More... | |
uint32_t | FLEXCAN_GetInstance (CAN_Type *base) |
Get the FlexCAN instance from peripheral base address. More... | |
bool | FLEXCAN_CalculateImprovedTimingValues (CAN_Type *base, uint32_t bitRate, uint32_t sourceClock_Hz, flexcan_timing_config_t *pTimingConfig) |
Calculates the improved timing values by specific bit Rates for classical CAN. More... | |
void | FLEXCAN_Init (CAN_Type *base, const flexcan_config_t *pConfig, uint32_t sourceClock_Hz) |
Initializes a FlexCAN instance. More... | |
bool | FLEXCAN_FDCalculateImprovedTimingValues (CAN_Type *base, uint32_t bitRate, uint32_t bitRateFD, uint32_t sourceClock_Hz, flexcan_timing_config_t *pTimingConfig) |
Calculates the improved timing values by specific bit rates for CANFD. More... | |
void | FLEXCAN_FDInit (CAN_Type *base, const flexcan_config_t *pConfig, uint32_t sourceClock_Hz, flexcan_mb_size_t dataSize, bool brs) |
Initializes a FlexCAN instance. More... | |
void | FLEXCAN_Deinit (CAN_Type *base) |
De-initializes a FlexCAN instance. More... | |
void | FLEXCAN_GetDefaultConfig (flexcan_config_t *pConfig) |
Gets the default configuration structure. More... | |
Configuration. | |
void | FLEXCAN_SetTimingConfig (CAN_Type *base, const flexcan_timing_config_t *pConfig) |
Sets the FlexCAN classical CAN protocol timing characteristic. More... | |
status_t | FLEXCAN_SetBitRate (CAN_Type *base, uint32_t sourceClock_Hz, uint32_t bitRate_Bps) |
Set bit rate of FlexCAN classical CAN frame or CAN FD frame nominal phase. More... | |
void | FLEXCAN_SetFDTimingConfig (CAN_Type *base, const flexcan_timing_config_t *pConfig) |
Sets the FlexCAN CANFD data phase timing characteristic. More... | |
status_t | FLEXCAN_SetFDBitRate (CAN_Type *base, uint32_t sourceClock_Hz, uint32_t bitRateN_Bps, uint32_t bitRateD_Bps) |
Set bit rate of FlexCAN FD frame. More... | |
void | FLEXCAN_SetRxMbGlobalMask (CAN_Type *base, uint32_t mask) |
Sets the FlexCAN receive message buffer global mask. More... | |
void | FLEXCAN_SetRxFifoGlobalMask (CAN_Type *base, uint32_t mask) |
Sets the FlexCAN receive FIFO global mask. More... | |
void | FLEXCAN_SetRxIndividualMask (CAN_Type *base, uint8_t maskIdx, uint32_t mask) |
Sets the FlexCAN receive individual mask. More... | |
void | FLEXCAN_SetTxMbConfig (CAN_Type *base, uint8_t mbIdx, bool enable) |
Configures a FlexCAN transmit message buffer. More... | |
void | FLEXCAN_SetFDTxMbConfig (CAN_Type *base, uint8_t mbIdx, bool enable) |
Configures a FlexCAN transmit message buffer. More... | |
void | FLEXCAN_SetRxMbConfig (CAN_Type *base, uint8_t mbIdx, const flexcan_rx_mb_config_t *pRxMbConfig, bool enable) |
Configures a FlexCAN Receive Message Buffer. More... | |
void | FLEXCAN_SetFDRxMbConfig (CAN_Type *base, uint8_t mbIdx, const flexcan_rx_mb_config_t *pRxMbConfig, bool enable) |
Configures a FlexCAN Receive Message Buffer. More... | |
void | FLEXCAN_SetRxFifoConfig (CAN_Type *base, const flexcan_rx_fifo_config_t *pRxFifoConfig, bool enable) |
Configures the FlexCAN Legacy Rx FIFO. More... | |
void | FLEXCAN_SetEnhancedRxFifoConfig (CAN_Type *base, const flexcan_enhanced_rx_fifo_config_t *pConfig, bool enable) |
Configures the FlexCAN Enhanced Rx FIFO. More... | |
Status | |
static uint64_t | FLEXCAN_GetStatusFlags (CAN_Type *base) |
Gets the FlexCAN module interrupt flags. More... | |
static void | FLEXCAN_ClearStatusFlags (CAN_Type *base, uint64_t mask) |
Clears status flags with the provided mask. More... | |
static void | FLEXCAN_GetBusErrCount (CAN_Type *base, uint8_t *txErrBuf, uint8_t *rxErrBuf) |
Gets the FlexCAN Bus Error Counter value. More... | |
static uint64_t | FLEXCAN_GetMbStatusFlags (CAN_Type *base, uint64_t mask) |
Gets the FlexCAN Message Buffer interrupt flags. More... | |
static uint64_t | FLEXCAN_GetHigh64MbStatusFlags (CAN_Type *base, uint64_t mask) |
Gets the FlexCAN High 64 Message Buffer interrupt flags. More... | |
static void | FLEXCAN_ClearMbStatusFlags (CAN_Type *base, uint64_t mask) |
Clears the FlexCAN Message Buffer interrupt flags. More... | |
static void | FLEXCAN_ClearHigh64MbStatusFlags (CAN_Type *base, uint64_t mask) |
Clears the FlexCAN High 64 Message Buffer interrupt flags. More... | |
void | FLEXCAN_GetMemoryErrorReportStatus (CAN_Type *base, flexcan_memory_error_report_status_t *errorStatus) |
Gets the FlexCAN Memory Error Report registers status. More... | |
static uint32_t | FLEXCAN_GetEnhancedFifoDataCount (CAN_Type *base) |
Gets the number of FlexCAN Enhanced Rx FIFO available frames. More... | |
Interrupts | |
static void | FLEXCAN_EnableInterrupts (CAN_Type *base, uint64_t mask) |
Enables FlexCAN interrupts according to the provided mask. More... | |
static void | FLEXCAN_DisableInterrupts (CAN_Type *base, uint64_t mask) |
Disables FlexCAN interrupts according to the provided mask. More... | |
static void | FLEXCAN_EnableMbInterrupts (CAN_Type *base, uint64_t mask) |
Enables FlexCAN Message Buffer interrupts. More... | |
static void | FLEXCAN_EnableHigh64MbInterrupts (CAN_Type *base, uint64_t mask) |
Enables FlexCAN high 64 Message Buffer interrupts. More... | |
static void | FLEXCAN_DisableMbInterrupts (CAN_Type *base, uint64_t mask) |
Disables FlexCAN Message Buffer interrupts. More... | |
static void | FLEXCAN_DisableHigh64MbInterrupts (CAN_Type *base, uint64_t mask) |
Disables FlexCAN high 64 Message Buffer interrupts. More... | |
DMA Control | |
void | FLEXCAN_EnableRxFifoDMA (CAN_Type *base, bool enable) |
Enables or disables the FlexCAN Rx FIFO DMA request. More... | |
static uintptr_t | FLEXCAN_GetRxFifoHeadAddr (CAN_Type *base) |
Gets the Rx FIFO Head address. More... | |
Bus Operations | |
static void | FLEXCAN_Enable (CAN_Type *base, bool enable) |
Enables or disables the FlexCAN module operation. More... | |
status_t | FLEXCAN_WriteTxMb (CAN_Type *base, uint8_t mbIdx, const flexcan_frame_t *pTxFrame) |
Writes a FlexCAN Message to the Transmit Message Buffer. More... | |
status_t | FLEXCAN_ReadRxMb (CAN_Type *base, uint8_t mbIdx, flexcan_frame_t *pRxFrame) |
Reads a FlexCAN Message from Receive Message Buffer. More... | |
status_t | FLEXCAN_WriteFDTxMb (CAN_Type *base, uint8_t mbIdx, const flexcan_fd_frame_t *pTxFrame) |
Writes a FlexCAN FD Message to the Transmit Message Buffer. More... | |
status_t | FLEXCAN_ReadFDRxMb (CAN_Type *base, uint8_t mbIdx, flexcan_fd_frame_t *pRxFrame) |
Reads a FlexCAN FD Message from Receive Message Buffer. More... | |
status_t | FLEXCAN_ReadRxFifo (CAN_Type *base, flexcan_frame_t *pRxFrame) |
Reads a FlexCAN Message from Legacy Rx FIFO. More... | |
status_t | FLEXCAN_ReadEnhancedRxFifo (CAN_Type *base, flexcan_fd_frame_t *pRxFrame) |
Reads a FlexCAN Message from Enhanced Rx FIFO. More... | |
Transactional | |
status_t | FLEXCAN_TransferFDSendBlocking (CAN_Type *base, uint8_t mbIdx, flexcan_fd_frame_t *pTxFrame) |
Performs a polling send transaction on the CAN bus. More... | |
status_t | FLEXCAN_TransferFDReceiveBlocking (CAN_Type *base, uint8_t mbIdx, flexcan_fd_frame_t *pRxFrame) |
Performs a polling receive transaction on the CAN bus. More... | |
status_t | FLEXCAN_TransferFDSendNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_mb_transfer_t *pMbXfer) |
Sends a message using IRQ. More... | |
status_t | FLEXCAN_TransferFDReceiveNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_mb_transfer_t *pMbXfer) |
Receives a message using IRQ. More... | |
void | FLEXCAN_TransferFDAbortSend (CAN_Type *base, flexcan_handle_t *handle, uint8_t mbIdx) |
Aborts the interrupt driven message send process. More... | |
void | FLEXCAN_TransferFDAbortReceive (CAN_Type *base, flexcan_handle_t *handle, uint8_t mbIdx) |
Aborts the interrupt driven message receive process. More... | |
status_t | FLEXCAN_TransferSendBlocking (CAN_Type *base, uint8_t mbIdx, flexcan_frame_t *pTxFrame) |
Performs a polling send transaction on the CAN bus. More... | |
status_t | FLEXCAN_TransferReceiveBlocking (CAN_Type *base, uint8_t mbIdx, flexcan_frame_t *pRxFrame) |
Performs a polling receive transaction on the CAN bus. More... | |
status_t | FLEXCAN_TransferReceiveFifoBlocking (CAN_Type *base, flexcan_frame_t *pRxFrame) |
Performs a polling receive transaction from Legacy Rx FIFO on the CAN bus. More... | |
status_t | FLEXCAN_TransferReceiveEnhancedFifoBlocking (CAN_Type *base, flexcan_fd_frame_t *pRxFrame) |
Performs a polling receive transaction from Enhanced Rx FIFO on the CAN bus. More... | |
void | FLEXCAN_TransferCreateHandle (CAN_Type *base, flexcan_handle_t *handle, flexcan_transfer_callback_t callback, void *userData) |
Initializes the FlexCAN handle. More... | |
status_t | FLEXCAN_TransferSendNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_mb_transfer_t *pMbXfer) |
Sends a message using IRQ. More... | |
status_t | FLEXCAN_TransferReceiveNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_mb_transfer_t *pMbXfer) |
Receives a message using IRQ. More... | |
status_t | FLEXCAN_TransferReceiveFifoNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_fifo_transfer_t *pFifoXfer) |
Receives a message from Rx FIFO using IRQ. More... | |
status_t | FLEXCAN_TransferGetReceiveFifoCount (CAN_Type *base, flexcan_handle_t *handle, size_t *count) |
Gets the Legacy Rx Fifo transfer status during a interrupt non-blocking receive. More... | |
status_t | FLEXCAN_TransferReceiveEnhancedFifoNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_fifo_transfer_t *pFifoXfer) |
Receives a message from Enhanced Rx FIFO using IRQ. More... | |
static status_t | FLEXCAN_TransferGetReceiveEnhancedFifoCount (CAN_Type *base, flexcan_handle_t *handle, size_t *count) |
Gets the Enhanced Rx Fifo transfer status during a interrupt non-blocking receive. More... | |
uint32_t | FLEXCAN_GetTimeStamp (flexcan_handle_t *handle, uint8_t mbIdx) |
Gets the detail index of Mailbox's Timestamp by handle. More... | |
void | FLEXCAN_TransferAbortSend (CAN_Type *base, flexcan_handle_t *handle, uint8_t mbIdx) |
Aborts the interrupt driven message send process. More... | |
void | FLEXCAN_TransferAbortReceive (CAN_Type *base, flexcan_handle_t *handle, uint8_t mbIdx) |
Aborts the interrupt driven message receive process. More... | |
void | FLEXCAN_TransferAbortReceiveFifo (CAN_Type *base, flexcan_handle_t *handle) |
Aborts the interrupt driven message receive from Rx FIFO process. More... | |
void | FLEXCAN_TransferAbortReceiveEnhancedFifo (CAN_Type *base, flexcan_handle_t *handle) |
Aborts the interrupt driven message receive from Enhanced Rx FIFO process. More... | |
void | FLEXCAN_TransferHandleIRQ (CAN_Type *base, flexcan_handle_t *handle) |
FlexCAN IRQ handle function. More... | |
struct flexcan_memory_error_report_status_t |
This structure contains the memory access properties that caused a memory error access. It is used as the parameter of FLEXCAN_GetMemoryErrorReportStatus() function. And user can use FLEXCAN_GetMemoryErrorReportStatus to get the status of the last memory error access.
Data Fields | |
flexcan_memory_error_type_t | errorType |
The type of memory error that giving rise to the report. More... | |
flexcan_memory_access_type_t | accessType |
The type of memory access that giving rise to the memory error. More... | |
uint16_t | accessAddress |
The address where memory error detected. More... | |
uint32_t | errorData |
The raw data word read from memory with error. More... | |
bool | byteIsRead |
The byte n (0~3) was read or not. More... | |
flexcan_memory_error_type_t flexcan_memory_error_report_status_t::errorType |
flexcan_memory_access_type_t flexcan_memory_error_report_status_t::accessType |
uint16_t flexcan_memory_error_report_status_t::accessAddress |
uint32_t flexcan_memory_error_report_status_t::errorData |
bool flexcan_memory_error_report_status_t::byteIsRead |
The type of error and which bit in byte (n) is affected by the error.
struct flexcan_frame_t |
uint32_t flexcan_frame_t::timestamp |
uint32_t flexcan_frame_t::length |
uint32_t flexcan_frame_t::type |
uint32_t flexcan_frame_t::format |
uint32_t flexcan_frame_t::__pad0__ |
uint32_t flexcan_frame_t::idhit |
uint32_t flexcan_frame_t::id |
uint32_t flexcan_frame_t::dataWord0 |
uint32_t flexcan_frame_t::dataWord1 |
uint8_t flexcan_frame_t::dataByte3 |
uint8_t flexcan_frame_t::dataByte2 |
uint8_t flexcan_frame_t::dataByte1 |
uint8_t flexcan_frame_t::dataByte0 |
uint8_t flexcan_frame_t::dataByte7 |
uint8_t flexcan_frame_t::dataByte6 |
uint8_t flexcan_frame_t::dataByte5 |
uint8_t flexcan_frame_t::dataByte4 |
struct flexcan_fd_frame_t |
The CAN FD message supporting up to sixty four bytes can be used for a data frame, depending on the length selected for the message buffers. The length should be a enumeration member, see _flexcan_fd_frame_length.
Data Fields | |
uint32_t | idhit |
CAN Enhanced Rx FIFO filter hit id (This value is only used in Enhanced Rx FIFO receive mode). More... | |
uint32_t | timestamp: 16 |
FlexCAN internal Free-Running Counter Time Stamp. More... | |
uint32_t | length: 4 |
CAN FD frame data length code (DLC), range see _flexcan_fd_frame_length, When the length <= 8, it equal to the data length, otherwise the number of valid frame data is not equal to the length value. More... | |
uint32_t | type: 1 |
CAN Frame Type(DATA or REMOTE). More... | |
uint32_t | format: 1 |
CAN Frame Identifier(STD or EXT format). More... | |
uint32_t | srr: 1 |
Substitute Remote request. More... | |
uint32_t | __pad0__: 6 |
Reserved. More... | |
uint32_t | esi: 1 |
Error State Indicator. More... | |
uint32_t | brs: 1 |
Bit Rate Switch. More... | |
uint32_t | edl: 1 |
Extended Data Length. More... | |
uint32_t | id: 29 |
CAN Frame Identifier, should be set using FLEXCAN_ID_EXT() or FLEXCAN_ID_STD() macro. More... | |
uint32_t | dataWord [16] |
CAN FD Frame payload, 16 double word maximum. More... | |
uint8_t | dataByte3 |
CAN Frame payload byte3. More... | |
uint8_t | dataByte2 |
CAN Frame payload byte2. More... | |
uint8_t | dataByte1 |
CAN Frame payload byte1. More... | |
uint8_t | dataByte0 |
CAN Frame payload byte0. More... | |
uint8_t | dataByte7 |
CAN Frame payload byte7. More... | |
uint8_t | dataByte6 |
CAN Frame payload byte6. More... | |
uint8_t | dataByte5 |
CAN Frame payload byte5. More... | |
uint8_t | dataByte4 |
CAN Frame payload byte4. More... | |
uint32_t flexcan_fd_frame_t::timestamp |
uint32_t flexcan_fd_frame_t::length |
user can use DLC_LENGTH_DECODE(length) macro to get the number of valid data bytes.
uint32_t flexcan_fd_frame_t::type |
uint32_t flexcan_fd_frame_t::format |
uint32_t flexcan_fd_frame_t::srr |
uint32_t flexcan_fd_frame_t::__pad0__ |
uint32_t flexcan_fd_frame_t::esi |
uint32_t flexcan_fd_frame_t::brs |
uint32_t flexcan_fd_frame_t::edl |
uint32_t flexcan_fd_frame_t::id |
uint32_t flexcan_fd_frame_t::dataWord[16] |
uint8_t flexcan_fd_frame_t::dataByte3 |
uint8_t flexcan_fd_frame_t::dataByte2 |
uint8_t flexcan_fd_frame_t::dataByte1 |
uint8_t flexcan_fd_frame_t::dataByte0 |
uint8_t flexcan_fd_frame_t::dataByte7 |
uint8_t flexcan_fd_frame_t::dataByte6 |
uint8_t flexcan_fd_frame_t::dataByte5 |
uint8_t flexcan_fd_frame_t::dataByte4 |
uint32_t flexcan_fd_frame_t::idhit |
struct flexcan_timing_config_t |
Data Fields | |
uint16_t | preDivider |
Classic CAN or CAN FD nominal phase bit rate prescaler. More... | |
uint8_t | rJumpwidth |
Classic CAN or CAN FD nominal phase Re-sync Jump Width. More... | |
uint8_t | phaseSeg1 |
Classic CAN or CAN FD nominal phase Segment 1. More... | |
uint8_t | phaseSeg2 |
Classic CAN or CAN FD nominal phase Segment 2. More... | |
uint8_t | propSeg |
Classic CAN or CAN FD nominal phase Propagation Segment. More... | |
uint16_t | fpreDivider |
CAN FD data phase bit rate prescaler. More... | |
uint8_t | frJumpwidth |
CAN FD data phase Re-sync Jump Width. More... | |
uint8_t | fphaseSeg1 |
CAN FD data phase Phase Segment 1. More... | |
uint8_t | fphaseSeg2 |
CAN FD data phase Phase Segment 2. More... | |
uint8_t | fpropSeg |
CAN FD data phase Propagation Segment. More... | |
uint16_t flexcan_timing_config_t::preDivider |
uint8_t flexcan_timing_config_t::rJumpwidth |
uint8_t flexcan_timing_config_t::phaseSeg1 |
uint8_t flexcan_timing_config_t::phaseSeg2 |
uint8_t flexcan_timing_config_t::propSeg |
uint16_t flexcan_timing_config_t::fpreDivider |
uint8_t flexcan_timing_config_t::frJumpwidth |
uint8_t flexcan_timing_config_t::fphaseSeg1 |
uint8_t flexcan_timing_config_t::fphaseSeg2 |
uint8_t flexcan_timing_config_t::fpropSeg |
struct flexcan_config_t |
Do not use the baudRate. It has been superceded bitRate
Do not use the baudRateFD. It has been superceded bitRateFD
Data Fields | |
flexcan_clock_source_t | clkSrc |
Clock source for FlexCAN Protocol Engine. More... | |
flexcan_wake_up_source_t | wakeupSrc |
Wake up source selection. More... | |
uint8_t | maxMbNum |
The maximum number of Message Buffers used by user. More... | |
bool | enableLoopBack |
Enable or Disable Loop Back Self Test Mode. More... | |
bool | enableTimerSync |
Enable or Disable Timer Synchronization. More... | |
bool | enableSelfWakeup |
Enable or Disable Self Wakeup Mode. More... | |
bool | enableIndividMask |
Enable or Disable Rx Individual Mask and Queue feature. More... | |
bool | disableSelfReception |
Enable or Disable Self Reflection. More... | |
bool | enableListenOnlyMode |
Enable or Disable Listen Only Mode. More... | |
bool | enableSupervisorMode |
Enable or Disable Supervisor Mode, enable this mode will make registers allow only Supervisor access. More... | |
bool | enableDoze |
Enable or Disable Doze Mode. More... | |
bool | enableMemoryErrorControl |
Enable or Disable the memory errors detection and correction mechanism. More... | |
bool | enableNonCorrectableErrorEnterFreeze |
Enable or Disable Non-Correctable Errors In FlexCAN Access Put Device In Freeze Mode. More... | |
bool | enableTransceiverDelayMeasure |
Enable or Disable the transceiver delay measurement, when it is enabled, then the secondary sample point position is determined by the sum of the transceiver delay measurement plus the enhanced TDC offset. More... | |
uint32_t | baudRate |
FlexCAN bit rate in bps, for classical CAN or CANFD nominal phase. More... | |
uint32_t | baudRateFD |
FlexCAN FD bit rate in bps, for CANFD data phase. More... | |
uint32_t | bitRate |
FlexCAN bit rate in bps, for classical CAN or CANFD nominal phase. More... | |
uint32_t | bitRateFD |
FlexCAN FD bit rate in bps, for CANFD data phase. More... | |
uint32_t flexcan_config_t::baudRate |
uint32_t flexcan_config_t::baudRateFD |
uint32_t flexcan_config_t::bitRate |
uint32_t flexcan_config_t::bitRateFD |
flexcan_clock_source_t flexcan_config_t::clkSrc |
flexcan_wake_up_source_t flexcan_config_t::wakeupSrc |
uint8_t flexcan_config_t::maxMbNum |
bool flexcan_config_t::enableLoopBack |
bool flexcan_config_t::enableTimerSync |
bool flexcan_config_t::enableSelfWakeup |
bool flexcan_config_t::enableIndividMask |
bool flexcan_config_t::disableSelfReception |
bool flexcan_config_t::enableListenOnlyMode |
bool flexcan_config_t::enableSupervisorMode |
bool flexcan_config_t::enableDoze |
bool flexcan_config_t::enableMemoryErrorControl |
bool flexcan_config_t::enableNonCorrectableErrorEnterFreeze |
bool flexcan_config_t::enableTransceiverDelayMeasure |
struct flexcan_rx_mb_config_t |
This structure is used as the parameter of FLEXCAN_SetRxMbConfig() function. The FLEXCAN_SetRxMbConfig() function is used to configure FlexCAN Receive Message Buffer. The function abort previous receiving process, clean the Message Buffer and activate the Rx Message Buffer using given Message Buffer setting.
Data Fields | |
uint32_t | id |
CAN Message Buffer Frame Identifier, should be set using FLEXCAN_ID_EXT() or FLEXCAN_ID_STD() macro. More... | |
flexcan_frame_format_t | format |
CAN Frame Identifier format(Standard of Extend). More... | |
flexcan_frame_type_t | type |
CAN Frame Type(Data or Remote). More... | |
uint32_t flexcan_rx_mb_config_t::id |
flexcan_frame_format_t flexcan_rx_mb_config_t::format |
flexcan_frame_type_t flexcan_rx_mb_config_t::type |
struct flexcan_rx_fifo_config_t |
Data Fields | |
uint32_t * | idFilterTable |
Pointer to the FlexCAN Legacy Rx FIFO identifier filter table. More... | |
uint8_t | idFilterNum |
The FlexCAN Legacy Rx FIFO Filter elements quantity. More... | |
flexcan_rx_fifo_filter_type_t | idFilterType |
The FlexCAN Legacy Rx FIFO Filter type. More... | |
flexcan_rx_fifo_priority_t | priority |
The FlexCAN Legacy Rx FIFO receive priority. More... | |
uint32_t* flexcan_rx_fifo_config_t::idFilterTable |
uint8_t flexcan_rx_fifo_config_t::idFilterNum |
flexcan_rx_fifo_filter_type_t flexcan_rx_fifo_config_t::idFilterType |
flexcan_rx_fifo_priority_t flexcan_rx_fifo_config_t::priority |
struct flexcan_enhanced_rx_fifo_std_id_filter_t |
Data Fields | |
uint32_t | filterType: 2 |
FlexCAN internal Free-Running Counter Time Stamp. More... | |
uint32_t | rtr1: 1 |
CAN FD frame data length code (DLC), range see _flexcan_fd_frame_length, When the length <= 8, it equal to the data length, otherwise the number of valid frame data is not equal to the length value. More... | |
uint32_t | std1: 11 |
CAN Frame Type(DATA or REMOTE). More... | |
uint32_t | rtr2: 1 |
CAN Frame Identifier(STD or EXT format). More... | |
uint32_t | std2: 11 |
Substitute Remote request. More... | |
uint32_t flexcan_enhanced_rx_fifo_std_id_filter_t::filterType |
uint32_t flexcan_enhanced_rx_fifo_std_id_filter_t::rtr1 |
user can use DLC_LENGTH_DECODE(length) macro to get the number of valid data bytes.
uint32_t flexcan_enhanced_rx_fifo_std_id_filter_t::std1 |
uint32_t flexcan_enhanced_rx_fifo_std_id_filter_t::rtr2 |
uint32_t flexcan_enhanced_rx_fifo_std_id_filter_t::std2 |
struct flexcan_enhanced_rx_fifo_ext_id_filter_t |
Data Fields | |
uint32_t | filterType: 2 |
FlexCAN internal Free-Running Counter Time Stamp. More... | |
uint32_t | rtr1: 1 |
CAN FD frame data length code (DLC), range see _flexcan_fd_frame_length, When the length <= 8, it equal to the data length, otherwise the number of valid frame data is not equal to the length value. More... | |
uint32_t | std1: 29 |
CAN Frame Type(DATA or REMOTE). More... | |
uint32_t | rtr2: 1 |
CAN Frame Identifier(STD or EXT format). More... | |
uint32_t | std2: 29 |
Substitute Remote request. More... | |
uint32_t flexcan_enhanced_rx_fifo_ext_id_filter_t::filterType |
uint32_t flexcan_enhanced_rx_fifo_ext_id_filter_t::rtr1 |
user can use DLC_LENGTH_DECODE(length) macro to get the number of valid data bytes.
uint32_t flexcan_enhanced_rx_fifo_ext_id_filter_t::std1 |
uint32_t flexcan_enhanced_rx_fifo_ext_id_filter_t::rtr2 |
uint32_t flexcan_enhanced_rx_fifo_ext_id_filter_t::std2 |
struct flexcan_enhanced_rx_fifo_config_t |
Data Fields | |
uint32_t * | idFilterTable |
Pointer to the FlexCAN Enhanced Rx FIFO identifier filter table, each table member occupies 32 bit word, table size should be equal to idFilterNum. More... | |
uint8_t | idFilterPairNum |
idFilterPairNum is the Enhanced Rx FIFO identifier filter element pair numbers, each pair of filter elements occupies 2 words and can consist of one extended ID filter element or two standard ID filter elements. More... | |
uint8_t | extendIdFilterNum |
The number of extended ID filter element items in the FlexCAN enhanced Rx FIFO identifier filter table, each extended-ID filter element occupies 2 words, extendIdFilterNum need less than or equal to idFilterPairNum. More... | |
uint8_t | fifoWatermark |
(fifoWatermark + 1) is the minimum number of CAN messages stored in the Enhanced RX FIFO which can trigger FIFO watermark interrupt or a DMA request. More... | |
flexcan_efifo_dma_per_read_length_t | dmaPerReadLength |
Define the length of each read of the Enhanced RX FIFO element by the DAM, see _flexcan_fd_frame_length. More... | |
flexcan_rx_fifo_priority_t | priority |
The FlexCAN Enhanced Rx FIFO receive priority. More... | |
uint32_t* flexcan_enhanced_rx_fifo_config_t::idFilterTable |
There are two types of Enhanced Rx FIFO filter elements that can be stored in table : extended-ID filter element (1 word, occupie 1 table members) and standard-ID filter element (2 words, occupies 2 table members), the extended-ID filter element needs to be placed in front of the table.
uint8_t flexcan_enhanced_rx_fifo_config_t::idFilterPairNum |
uint8_t flexcan_enhanced_rx_fifo_config_t::extendIdFilterNum |
uint8_t flexcan_enhanced_rx_fifo_config_t::fifoWatermark |
flexcan_efifo_dma_per_read_length_t flexcan_enhanced_rx_fifo_config_t::dmaPerReadLength |
flexcan_rx_fifo_priority_t flexcan_enhanced_rx_fifo_config_t::priority |
struct flexcan_mb_transfer_t |
Data Fields | |
flexcan_frame_t * | frame |
The buffer of CAN Message to be transfer. More... | |
uint8_t | mbIdx |
The index of Message buffer used to transfer Message. More... | |
flexcan_frame_t* flexcan_mb_transfer_t::frame |
uint8_t flexcan_mb_transfer_t::mbIdx |
struct flexcan_fifo_transfer_t |
Data Fields | |
flexcan_fd_frame_t * | framefd |
The buffer of CAN Message to be received from Enhanced Rx FIFO. More... | |
flexcan_frame_t * | frame |
The buffer of CAN Message to be received from Legacy Rx FIFO. More... | |
size_t | frameNum |
Number of CAN Message need to be received from Legacy or Ehanced Rx FIFO. More... | |
flexcan_fd_frame_t* flexcan_fifo_transfer_t::framefd |
flexcan_frame_t* flexcan_fifo_transfer_t::frame |
size_t flexcan_fifo_transfer_t::frameNum |
struct _flexcan_handle |
FlexCAN handle structure definition.
Data Fields | |
flexcan_transfer_callback_t | callback |
Callback function. More... | |
void * | userData |
FlexCAN callback function parameter. More... | |
flexcan_frame_t *volatile | mbFrameBuf [CAN_WORD1_COUNT] |
The buffer for received CAN data from Message Buffers. More... | |
flexcan_fd_frame_t *volatile | mbFDFrameBuf [CAN_WORD1_COUNT] |
The buffer for received CAN FD data from Message Buffers. More... | |
flexcan_frame_t *volatile | rxFifoFrameBuf |
The buffer for received CAN data from Legacy Rx FIFO. More... | |
flexcan_fd_frame_t *volatile | rxFifoFDFrameBuf |
The buffer for received CAN FD data from Ehanced Rx FIFO. More... | |
size_t | rxFifoFrameNum |
The number of CAN messages remaining to be received from Legacy or Ehanced Rx FIFO. More... | |
size_t | rxFifoTransferTotalNum |
Total CAN Message number need to be received from Legacy or Ehanced Rx FIFO. More... | |
volatile uint8_t | mbState [CAN_WORD1_COUNT] |
Message Buffer transfer state. More... | |
volatile uint8_t | rxFifoState |
Rx FIFO transfer state. More... | |
volatile uint32_t | timestamp [CAN_WORD1_COUNT] |
Mailbox transfer timestamp. More... | |
flexcan_transfer_callback_t flexcan_handle_t::callback |
void* flexcan_handle_t::userData |
flexcan_frame_t* volatile flexcan_handle_t::mbFrameBuf[CAN_WORD1_COUNT] |
flexcan_fd_frame_t* volatile flexcan_handle_t::mbFDFrameBuf[CAN_WORD1_COUNT] |
flexcan_frame_t* volatile flexcan_handle_t::rxFifoFrameBuf |
flexcan_fd_frame_t* volatile flexcan_handle_t::rxFifoFDFrameBuf |
size_t flexcan_handle_t::rxFifoFrameNum |
size_t flexcan_handle_t::rxFifoTransferTotalNum |
volatile uint8_t flexcan_handle_t::mbState[CAN_WORD1_COUNT] |
volatile uint8_t flexcan_handle_t::rxFifoState |
volatile uint32_t flexcan_handle_t::timestamp[CAN_WORD1_COUNT] |
#define FSL_FLEXCAN_DRIVER_VERSION (MAKE_VERSION(2, 11, 6)) |
#define DLC_LENGTH_DECODE | ( | dlc | ) | (((dlc) <= 8U) ? (dlc) : (((dlc) <= 12U) ? (((dlc)-6U) * 4U) : (((dlc)-11U) * 16U))) |
#define FLEXCAN_ID_STD | ( | id | ) | (((uint32_t)(((uint32_t)(id)) << CAN_ID_STD_SHIFT)) & CAN_ID_STD_MASK) |
Standard Frame ID helper macro.
#define FLEXCAN_ID_EXT | ( | id | ) |
#define FLEXCAN_RX_MB_STD_MASK | ( | id, | |
rtr, | |||
ide | |||
) |
Standard Rx Message Buffer Mask helper macro.
#define FLEXCAN_RX_MB_EXT_MASK | ( | id, | |
rtr, | |||
ide | |||
) |
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_A | ( | id, | |
rtr, | |||
ide | |||
) |
Standard Rx FIFO Mask helper macro Type A helper macro.
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_HIGH | ( | id, | |
rtr, | |||
ide | |||
) |
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_LOW | ( | id, | |
rtr, | |||
ide | |||
) |
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_HIGH | ( | id | ) | (((uint32_t)(id)&0x7F8) << 21) |
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_HIGH | ( | id | ) | (((uint32_t)(id)&0x7F8) << 13) |
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_LOW | ( | id | ) | (((uint32_t)(id)&0x7F8) << 5) |
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_LOW | ( | id | ) | (((uint32_t)(id)&0x7F8) >> 3) |
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_A | ( | id, | |
rtr, | |||
ide | |||
) |
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_HIGH | ( | id, | |
rtr, | |||
ide | |||
) |
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_LOW | ( | id, | |
rtr, | |||
ide | |||
) |
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_HIGH | ( | id | ) | ((FLEXCAN_ID_EXT(id) & 0x1FE00000) << 3) |
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_HIGH | ( | id | ) |
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_LOW | ( | id | ) |
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_LOW | ( | id | ) | ((FLEXCAN_ID_EXT(id) & 0x1FE00000) >> 21) |
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_A | ( | id, | |
rtr, | |||
ide | |||
) | FLEXCAN_RX_FIFO_STD_MASK_TYPE_A(id, rtr, ide) |
Standard Rx FIFO Filter helper macro Type A helper macro.
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_HIGH | ( | id, | |
rtr, | |||
ide | |||
) |
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_LOW | ( | id, | |
rtr, | |||
ide | |||
) |
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_HIGH | ( | id | ) |
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_HIGH | ( | id | ) |
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_LOW | ( | id | ) |
#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_LOW | ( | id | ) |
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_A | ( | id, | |
rtr, | |||
ide | |||
) | FLEXCAN_RX_FIFO_EXT_MASK_TYPE_A(id, rtr, ide) |
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_HIGH | ( | id, | |
rtr, | |||
ide | |||
) |
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_LOW | ( | id, | |
rtr, | |||
ide | |||
) |
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_HIGH | ( | id | ) |
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_HIGH | ( | id | ) |
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_LOW | ( | id | ) |
#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_LOW | ( | id | ) | FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_LOW(id) |
#define ENHANCED_RX_FIFO_FSCH | ( | x | ) | (((uint32_t)(((uint32_t)(x)) << 30)) & 0xC0000000U) |
#define FLEXCAN_ENHANCED_RX_FIFO_STD_MASK_AND_FILTER | ( | id, | |
rtr, | |||
id_mask, | |||
rtr_mask | |||
) | (ENHANCED_RX_FIFO_FSCH(0x0) | RTR_STD_HIGH(rtr) | ID_STD_HIGH(id) | RTR_STD_LOW(rtr_mask) | ID_STD_LOW(id_mask)) |
#define FLEXCAN_ENHANCED_RX_FIFO_STD_FILTER_WITH_RANGE | ( | id_upper, | |
rtr, | |||
id_lower, | |||
rtr_mask | |||
) |
#define FLEXCAN_ENHANCED_RX_FIFO_STD_TWO_FILTERS | ( | id1, | |
rtr1, | |||
id2, | |||
rtr2 | |||
) | (ENHANCED_RX_FIFO_FSCH(0x2) | RTR_STD_HIGH(rtr1) | ID_STD_HIGH(id1) | RTR_STD_LOW(rtr2) | ID_STD_LOW(id2)) |
#define FLEXCAN_ENHANCED_RX_FIFO_EXT_MASK_AND_FILTER_LOW | ( | id, | |
rtr | |||
) | (ENHANCED_RX_FIFO_FSCH(0x0) | RTR_EXT(rtr) | ID_EXT(id)) |
#define FLEXCAN_ENHANCED_RX_FIFO_EXT_MASK_AND_FILTER_HIGH | ( | id_mask, | |
rtr_mask | |||
) | (ENHANCED_RX_FIFO_FSCH(0x0) | RTR_EXT(rtr_mask) | ID_EXT(id_mask)) |
#define FLEXCAN_ENHANCED_RX_FIFO_EXT_FILTER_WITH_RANGE_LOW | ( | id_upper, | |
rtr | |||
) | (ENHANCED_RX_FIFO_FSCH(0x1) | RTR_EXT(rtr) | ID_EXT(id_upper)) |
#define FLEXCAN_ENHANCED_RX_FIFO_EXT_FILTER_WITH_RANGE_HIGH | ( | id_lower, | |
rtr_mask | |||
) | (ENHANCED_RX_FIFO_FSCH(0x1) | RTR_EXT(rtr_mask) | ID_EXT(id_lower)) |
#define FLEXCAN_ENHANCED_RX_FIFO_EXT_TWO_FILTERS_LOW | ( | id2, | |
rtr2 | |||
) | (ENHANCED_RX_FIFO_FSCH(0x2) | RTR_EXT(rtr2) | ID_EXT(id2)) |
#define FLEXCAN_ENHANCED_RX_FIFO_EXT_TWO_FILTERS_HIGH | ( | id1, | |
rtr1 | |||
) | (ENHANCED_RX_FIFO_FSCH(0x2) | RTR_EXT(rtr1) | ID_EXT(id1)) |
#define FLEXCAN_EFIFO_INT_MASK | ( | x | ) | (((uint64_t)(((uint64_t)(x)) << 32)) & 0xF000000000000000U) |
#define E_RX_FIFO | ( | base | ) | ((uintptr_t)(base) + 0x2000U) |
#define FLEXCAN_CALLBACK | ( | x | ) | void(x)(CAN_Type * base, flexcan_handle_t * handle, status_t status, uint64_t result, void *userData) |
The FlexCAN transfer callback returns a value from the underlying layer. If the status equals to kStatus_FLEXCAN_ErrorStatus, the result parameter is the Content of FlexCAN status register which can be used to get the working status(or error status) of FlexCAN module. If the status equals to other FlexCAN Message Buffer transfer status, the result is the index of Message Buffer that generate transfer event. If the status equals to other FlexCAN Message Buffer transfer status, the result is meaningless and should be Ignored.
anonymous enum |
enum flexcan_frame_type_t |
Do not use the kFLEXCAN_ClkSrcOs. It has been superceded kFLEXCAN_ClkSrc0
Do not use the kFLEXCAN_ClkSrcPeri. It has been superceded kFLEXCAN_ClkSrc1
enum flexcan_mb_size_t |
For Tx, when the Data size corresponding to DLC value stored in the MB selected for transmission is larger than the MB Payload size, FlexCAN adds the necessary number of bytes with constant 0xCC pattern to complete the expected DLC. For Rx, when the Data size corresponding to DLC value received from the CAN bus is larger than the MB Payload size, the high order bytes that do not fit the Payload size will lose.
The matching process starts from the Rx MB(or Enhanced/Legacy Rx FIFO) with higher priority. If no MB(or Enhanced/Legacy Rx FIFO filter) is satisfied, the matching process goes on with the Enhanced/Legacy Rx FIFO(or Rx MB) with lower priority.
Enumerator | |
---|---|
kFLEXCAN_RxFifoPrioLow |
Matching process start from Rx Message Buffer first. |
kFLEXCAN_RxFifoPrioHigh |
Matching process start from Enhanced/Legacy Rx FIFO first. |
This provides constants for the FlexCAN interrupt enable enumerations for use in the FlexCAN functions.
enum _flexcan_flags |
This provides constants for the FlexCAN status flags for use in the FlexCAN functions.
enum _flexcan_error_flags |
The FlexCAN Error Status enumerations is used to report current error of the FlexCAN bus. This enumerations should be used with KFLEXCAN_ErrorFlag in _flexcan_flags enumerations to ditermine which error is generated.
anonymous enum |
The FlexCAN Legacy Rx FIFO Status enumerations are used to determine the status of the Rx FIFO. Because Rx FIFO occupy the MB0 ~ MB7 (Rx Fifo filter also occupies more Message Buffer space), Rx FIFO status flags are mapped to the corresponding Message Buffer status flags.
Enumerator | |
---|---|
kFLEXCAN_RxFifoOverflowFlag |
Rx FIFO overflow flag. |
kFLEXCAN_RxFifoWarningFlag |
Rx FIFO almost full flag. |
kFLEXCAN_RxFifoFrameAvlFlag |
Frames available in Rx FIFO flag. |
bool FLEXCAN_IsInstanceHasFDMode | ( | CAN_Type * | base | ) |
base | FlexCAN peripheral base address. |
void FLEXCAN_EnterFreezeMode | ( | CAN_Type * | base | ) |
This function makes the FlexCAN work under Freeze Mode.
base | FlexCAN peripheral base address. |
void FLEXCAN_ExitFreezeMode | ( | CAN_Type * | base | ) |
This function makes the FlexCAN leave Freeze Mode.
base | FlexCAN peripheral base address. |
uint32_t FLEXCAN_GetInstance | ( | CAN_Type * | base | ) |
base | FlexCAN peripheral base address. |
bool FLEXCAN_CalculateImprovedTimingValues | ( | CAN_Type * | base, |
uint32_t | bitRate, | ||
uint32_t | sourceClock_Hz, | ||
flexcan_timing_config_t * | pTimingConfig | ||
) |
This function use to calculates the Classical CAN timing values according to the given bit rate. The Calculated timing values will be set in CTRL1/CBT/ENCBT register. The calculation is based on the recommendation of the CiA 301 v4.2.0 and previous version document.
base | FlexCAN peripheral base address. |
bitRate | The classical CAN speed in bps defined by user, should be less than or equal to 1Mbps. |
sourceClock_Hz | The Source clock frequency in Hz. |
pTimingConfig | Pointer to the FlexCAN timing configuration structure. |
void FLEXCAN_Init | ( | CAN_Type * | base, |
const flexcan_config_t * | pConfig, | ||
uint32_t | sourceClock_Hz | ||
) |
This function initializes the FlexCAN module with user-defined settings. This example shows how to set up the flexcan_config_t parameters and how to call the FLEXCAN_Init function by passing in these parameters.
base | FlexCAN peripheral base address. |
pConfig | Pointer to the user-defined configuration structure. |
sourceClock_Hz | FlexCAN Protocol Engine clock source frequency in Hz. |
bool FLEXCAN_FDCalculateImprovedTimingValues | ( | CAN_Type * | base, |
uint32_t | bitRate, | ||
uint32_t | bitRateFD, | ||
uint32_t | sourceClock_Hz, | ||
flexcan_timing_config_t * | pTimingConfig | ||
) |
This function use to calculates the CANFD timing values according to the given nominal phase bit rate and data phase bit rate. The Calculated timing values will be set in CBT/ENCBT and FDCBT/EDCBT registers. The calculation is based on the recommendation of the CiA 1301 v1.0.0 document.
base | FlexCAN peripheral base address. |
bitRate | The CANFD bus control speed in bps defined by user. |
bitRateFD | The CAN FD data phase speed in bps defined by user. Equal to bitRate means disable bit rate switching. |
sourceClock_Hz | The Source clock frequency in Hz. |
pTimingConfig | Pointer to the FlexCAN timing configuration structure. |
void FLEXCAN_FDInit | ( | CAN_Type * | base, |
const flexcan_config_t * | pConfig, | ||
uint32_t | sourceClock_Hz, | ||
flexcan_mb_size_t | dataSize, | ||
bool | brs | ||
) |
This function initializes the FlexCAN module with user-defined settings. This example shows how to set up the flexcan_config_t parameters and how to call the FLEXCAN_FDInit function by passing in these parameters.
base | FlexCAN peripheral base address. |
pConfig | Pointer to the user-defined configuration structure. |
sourceClock_Hz | FlexCAN Protocol Engine clock source frequency in Hz. |
dataSize | FlexCAN Message Buffer payload size. The actual transmitted or received CAN FD frame data size needs to be less than or equal to this value. |
brs | True if bit rate switch is enabled in FD mode. |
void FLEXCAN_Deinit | ( | CAN_Type * | base | ) |
This function disables the FlexCAN module clock and sets all register values to the reset value.
base | FlexCAN peripheral base address. |
void FLEXCAN_GetDefaultConfig | ( | flexcan_config_t * | pConfig | ) |
This function initializes the FlexCAN configuration structure to default values. The default values are as follows. flexcanConfig->clkSrc = kFLEXCAN_ClkSrc0; flexcanConfig->bitRate = 1000000U; flexcanConfig->bitRateFD = 2000000U; flexcanConfig->maxMbNum = 16; flexcanConfig->enableLoopBack = false; flexcanConfig->enableSelfWakeup = false; flexcanConfig->enableIndividMask = false; flexcanConfig->disableSelfReception = false; flexcanConfig->enableListenOnlyMode = false; flexcanConfig->enableDoze = false; flexcanConfig->enableMemoryErrorControl = true; flexcanConfig->enableNonCorrectableErrorEnterFreeze = true; flexcanConfig.timingConfig = timingConfig;
pConfig | Pointer to the FlexCAN configuration structure. |
void FLEXCAN_SetTimingConfig | ( | CAN_Type * | base, |
const flexcan_timing_config_t * | pConfig | ||
) |
This function gives user settings to classical CAN or CAN FD nominal phase timing characteristic. The function is for an experienced user. For less experienced users, call the FLEXCAN_SetBitRate() instead.
base | FlexCAN peripheral base address. |
pConfig | Pointer to the timing configuration structure. |
status_t FLEXCAN_SetBitRate | ( | CAN_Type * | base, |
uint32_t | sourceClock_Hz, | ||
uint32_t | bitRate_Bps | ||
) |
This function set the bit rate of classical CAN frame or CAN FD frame nominal phase base on FLEXCAN_CalculateImprovedTimingValues() API calculated timing values.
base | FlexCAN peripheral base address. |
sourceClock_Hz | Source Clock in Hz. |
bitRate_Bps | Bit rate in Bps. |
void FLEXCAN_SetFDTimingConfig | ( | CAN_Type * | base, |
const flexcan_timing_config_t * | pConfig | ||
) |
This function gives user settings to CANFD data phase timing characteristic. The function is for an experienced user. For less experienced users, call the FLEXCAN_SetFDBitRate() to set both Nominal/Data bit Rate instead.
base | FlexCAN peripheral base address. |
pConfig | Pointer to the timing configuration structure. |
status_t FLEXCAN_SetFDBitRate | ( | CAN_Type * | base, |
uint32_t | sourceClock_Hz, | ||
uint32_t | bitRateN_Bps, | ||
uint32_t | bitRateD_Bps | ||
) |
This function set the baud rate of FLEXCAN FD base on FLEXCAN_FDCalculateImprovedTimingValues() API calculated timing values.
base | FlexCAN peripheral base address. |
sourceClock_Hz | Source Clock in Hz. |
bitRateN_Bps | Nominal bit Rate in Bps. |
bitRateD_Bps | Data bit Rate in Bps. |
void FLEXCAN_SetRxMbGlobalMask | ( | CAN_Type * | base, |
uint32_t | mask | ||
) |
This function sets the global mask for the FlexCAN message buffer in a matching process. The configuration is only effective when the Rx individual mask is disabled in the FLEXCAN_Init().
base | FlexCAN peripheral base address. |
mask | Rx Message Buffer Global Mask value. |
void FLEXCAN_SetRxFifoGlobalMask | ( | CAN_Type * | base, |
uint32_t | mask | ||
) |
This function sets the global mask for FlexCAN FIFO in a matching process.
base | FlexCAN peripheral base address. |
mask | Rx Fifo Global Mask value. |
void FLEXCAN_SetRxIndividualMask | ( | CAN_Type * | base, |
uint8_t | maskIdx, | ||
uint32_t | mask | ||
) |
This function sets the individual mask for the FlexCAN matching process. The configuration is only effective when the Rx individual mask is enabled in the FLEXCAN_Init(). If the Rx FIFO is disabled, the individual mask is applied to the corresponding Message Buffer. If the Rx FIFO is enabled, the individual mask for Rx FIFO occupied Message Buffer is applied to the Rx Filter with the same index. Note that only the first 32 individual masks can be used as the Rx FIFO filter mask.
base | FlexCAN peripheral base address. |
maskIdx | The Index of individual Mask. |
mask | Rx Individual Mask value. |
void FLEXCAN_SetTxMbConfig | ( | CAN_Type * | base, |
uint8_t | mbIdx, | ||
bool | enable | ||
) |
This function aborts the previous transmission, cleans the Message Buffer, and configures it as a Transmit Message Buffer.
base | FlexCAN peripheral base address. |
mbIdx | The Message Buffer index. |
enable | Enable/disable Tx Message Buffer.
|
void FLEXCAN_SetFDTxMbConfig | ( | CAN_Type * | base, |
uint8_t | mbIdx, | ||
bool | enable | ||
) |
This function aborts the previous transmission, cleans the Message Buffer, and configures it as a Transmit Message Buffer.
base | FlexCAN peripheral base address. |
mbIdx | The Message Buffer index. |
enable | Enable/disable Tx Message Buffer.
|
void FLEXCAN_SetRxMbConfig | ( | CAN_Type * | base, |
uint8_t | mbIdx, | ||
const flexcan_rx_mb_config_t * | pRxMbConfig, | ||
bool | enable | ||
) |
This function cleans a FlexCAN build-in Message Buffer and configures it as a Receive Message Buffer.
base | FlexCAN peripheral base address. |
mbIdx | The Message Buffer index. |
pRxMbConfig | Pointer to the FlexCAN Message Buffer configuration structure. |
enable | Enable/disable Rx Message Buffer.
|
void FLEXCAN_SetFDRxMbConfig | ( | CAN_Type * | base, |
uint8_t | mbIdx, | ||
const flexcan_rx_mb_config_t * | pRxMbConfig, | ||
bool | enable | ||
) |
This function cleans a FlexCAN build-in Message Buffer and configures it as a Receive Message Buffer.
base | FlexCAN peripheral base address. |
mbIdx | The Message Buffer index. |
pRxMbConfig | Pointer to the FlexCAN Message Buffer configuration structure. |
enable | Enable/disable Rx Message Buffer.
|
void FLEXCAN_SetRxFifoConfig | ( | CAN_Type * | base, |
const flexcan_rx_fifo_config_t * | pRxFifoConfig, | ||
bool | enable | ||
) |
This function configures the FlexCAN Rx FIFO with given configuration.
base | FlexCAN peripheral base address. |
pRxFifoConfig | Pointer to the FlexCAN Legacy Rx FIFO configuration structure. Can be NULL when enable parameter is false. |
enable | Enable/disable Legacy Rx FIFO.
|
void FLEXCAN_SetEnhancedRxFifoConfig | ( | CAN_Type * | base, |
const flexcan_enhanced_rx_fifo_config_t * | pConfig, | ||
bool | enable | ||
) |
This function configures the Enhanced Rx FIFO with given configuration.
base | FlexCAN peripheral base address. |
pConfig | Pointer to the FlexCAN Enhanced Rx FIFO configuration structure. Can be NULL when enable parameter is false. |
enable | Enable/disable Enhanced Rx FIFO.
|
|
inlinestatic |
This function gets all FlexCAN status flags. The flags are returned as the logical OR value of the enumerators _flexcan_flags. To check the specific status, compare the return value with enumerators in _flexcan_flags.
base | FlexCAN peripheral base address. |
|
inlinestatic |
This function clears the FlexCAN status flags with a provided mask. An automatically cleared flag can't be cleared by this function.
base | FlexCAN peripheral base address. |
mask | The status flags to be cleared, it is logical OR value of _flexcan_flags. |
|
inlinestatic |
This function gets the FlexCAN Bus Error Counter value for both Tx and Rx direction. These values may be needed in the upper layer error handling.
base | FlexCAN peripheral base address. |
txErrBuf | Buffer to store Tx Error Counter value. |
rxErrBuf | Buffer to store Rx Error Counter value. |
|
inlinestatic |
This function gets the interrupt flags of a given Message Buffers.
base | FlexCAN peripheral base address. |
mask | The ORed FlexCAN Message Buffer mask. |
|
inlinestatic |
Valid only if the number of available MBs exceeds 64.
base | FlexCAN peripheral base address. |
mask | The ORed FlexCAN Message Buffer mask. |
|
inlinestatic |
This function clears the interrupt flags of a given Message Buffers.
base | FlexCAN peripheral base address. |
mask | The ORed FlexCAN Message Buffer mask. |
|
inlinestatic |
Valid only if the number of available MBs exceeds 64.
base | FlexCAN peripheral base address. |
mask | The ORed FlexCAN Message Buffer mask. |
void FLEXCAN_GetMemoryErrorReportStatus | ( | CAN_Type * | base, |
flexcan_memory_error_report_status_t * | errorStatus | ||
) |
This function gets the FlexCAN Memory Error Report registers status.
base | FlexCAN peripheral base address. |
errorStatus | Pointer to FlexCAN Memory Error Report registers status structure. |
|
inlinestatic |
This function gets the number of CAN messages stored in the Enhanced Rx FIFO.
base | FlexCAN peripheral base address. |
|
inlinestatic |
This function enables the FlexCAN interrupts according to the provided mask. The mask is a logical OR of enumeration members, see _flexcan_interrupt_enable.
base | FlexCAN peripheral base address. |
mask | The interrupts to enable. Logical OR of _flexcan_interrupt_enable. |
|
inlinestatic |
This function disables the FlexCAN interrupts according to the provided mask. The mask is a logical OR of enumeration members, see _flexcan_interrupt_enable.
base | FlexCAN peripheral base address. |
mask | The interrupts to disable. Logical OR of _flexcan_interrupt_enable. |
|
inlinestatic |
This function enables the interrupts of given Message Buffers.
base | FlexCAN peripheral base address. |
mask | The ORed FlexCAN Message Buffer mask. |
|
inlinestatic |
Valid only if the number of available MBs exceeds 64.
base | FlexCAN peripheral base address. |
mask | The ORed FlexCAN Message Buffer mask. |
|
inlinestatic |
This function disables the interrupts of given Message Buffers.
base | FlexCAN peripheral base address. |
mask | The ORed FlexCAN Message Buffer mask. |
|
inlinestatic |
Valid only if the number of available MBs exceeds 64.
base | FlexCAN peripheral base address. |
mask | The ORed FlexCAN Message Buffer mask. |
void FLEXCAN_EnableRxFifoDMA | ( | CAN_Type * | base, |
bool | enable | ||
) |
This function enables or disables the DMA feature of FlexCAN build-in Rx FIFO.
base | FlexCAN peripheral base address. |
enable | true to enable, false to disable. |
|
inlinestatic |
This function returns the FlexCAN Rx FIFO Head address, which is mainly used for the DMA/eDMA use case.
base | FlexCAN peripheral base address. |
|
inlinestatic |
This function enables or disables the FlexCAN module.
base | FlexCAN base pointer. |
enable | true to enable, false to disable. |
status_t FLEXCAN_WriteTxMb | ( | CAN_Type * | base, |
uint8_t | mbIdx, | ||
const flexcan_frame_t * | pTxFrame | ||
) |
This function writes a CAN Message to the specified Transmit Message Buffer and changes the Message Buffer state to start CAN Message transmit. After that the function returns immediately.
base | FlexCAN peripheral base address. |
mbIdx | The FlexCAN Message Buffer index. |
pTxFrame | Pointer to CAN message frame to be sent. |
kStatus_Success | - Write Tx Message Buffer Successfully. |
kStatus_Fail | - Tx Message Buffer is currently in use. |
status_t FLEXCAN_ReadRxMb | ( | CAN_Type * | base, |
uint8_t | mbIdx, | ||
flexcan_frame_t * | pRxFrame | ||
) |
This function reads a CAN message from a specified Receive Message Buffer. The function fills a receive CAN message frame structure with just received data and activates the Message Buffer again. The function returns immediately.
base | FlexCAN peripheral base address. |
mbIdx | The FlexCAN Message Buffer index. |
pRxFrame | Pointer to CAN message frame structure for reception. |
kStatus_Success | - Rx Message Buffer is full and has been read successfully. |
kStatus_FLEXCAN_RxOverflow | - Rx Message Buffer is already overflowed and has been read successfully. |
kStatus_Fail | - Rx Message Buffer is empty. |
status_t FLEXCAN_WriteFDTxMb | ( | CAN_Type * | base, |
uint8_t | mbIdx, | ||
const flexcan_fd_frame_t * | pTxFrame | ||
) |
This function writes a CAN FD Message to the specified Transmit Message Buffer and changes the Message Buffer state to start CAN FD Message transmit. After that the function returns immediately.
base | FlexCAN peripheral base address. |
mbIdx | The FlexCAN FD Message Buffer index. |
pTxFrame | Pointer to CAN FD message frame to be sent. |
kStatus_Success | - Write Tx Message Buffer Successfully. |
kStatus_Fail | - Tx Message Buffer is currently in use. |
status_t FLEXCAN_ReadFDRxMb | ( | CAN_Type * | base, |
uint8_t | mbIdx, | ||
flexcan_fd_frame_t * | pRxFrame | ||
) |
This function reads a CAN FD message from a specified Receive Message Buffer. The function fills a receive CAN FD message frame structure with just received data and activates the Message Buffer again. The function returns immediately.
base | FlexCAN peripheral base address. |
mbIdx | The FlexCAN FD Message Buffer index. |
pRxFrame | Pointer to CAN FD message frame structure for reception. |
kStatus_Success | - Rx Message Buffer is full and has been read successfully. |
kStatus_FLEXCAN_RxOverflow | - Rx Message Buffer is already overflowed and has been read successfully. |
kStatus_Fail | - Rx Message Buffer is empty. |
status_t FLEXCAN_ReadRxFifo | ( | CAN_Type * | base, |
flexcan_frame_t * | pRxFrame | ||
) |
This function reads a CAN message from the FlexCAN Legacy Rx FIFO.
base | FlexCAN peripheral base address. |
pRxFrame | Pointer to CAN message frame structure for reception. |
kStatus_Success | - Read Message from Rx FIFO successfully. |
kStatus_Fail | - Rx FIFO is not enabled. |
status_t FLEXCAN_ReadEnhancedRxFifo | ( | CAN_Type * | base, |
flexcan_fd_frame_t * | pRxFrame | ||
) |
This function reads a CAN or CAN FD message from the FlexCAN Enhanced Rx FIFO.
base | FlexCAN peripheral base address. |
pRxFrame | Pointer to CAN FD message frame structure for reception. |
kStatus_Success | - Read Message from Rx FIFO successfully. |
kStatus_Fail | - Rx FIFO is not enabled. |
status_t FLEXCAN_TransferFDSendBlocking | ( | CAN_Type * | base, |
uint8_t | mbIdx, | ||
flexcan_fd_frame_t * | pTxFrame | ||
) |
base | FlexCAN peripheral base pointer. |
mbIdx | The FlexCAN FD Message Buffer index. |
pTxFrame | Pointer to CAN FD message frame to be sent. |
kStatus_Success | - Write Tx Message Buffer Successfully. |
kStatus_Fail | - Tx Message Buffer is currently in use. |
status_t FLEXCAN_TransferFDReceiveBlocking | ( | CAN_Type * | base, |
uint8_t | mbIdx, | ||
flexcan_fd_frame_t * | pRxFrame | ||
) |
base | FlexCAN peripheral base pointer. |
mbIdx | The FlexCAN FD Message Buffer index. |
pRxFrame | Pointer to CAN FD message frame structure for reception. |
kStatus_Success | - Rx Message Buffer is full and has been read successfully. |
kStatus_FLEXCAN_RxOverflow | - Rx Message Buffer is already overflowed and has been read successfully. |
kStatus_Fail | - Rx Message Buffer is empty. |
status_t FLEXCAN_TransferFDSendNonBlocking | ( | CAN_Type * | base, |
flexcan_handle_t * | handle, | ||
flexcan_mb_transfer_t * | pMbXfer | ||
) |
This function sends a message using IRQ. This is a non-blocking function, which returns right away. When messages have been sent out, the send callback function is called.
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |
pMbXfer | FlexCAN FD Message Buffer transfer structure. See the flexcan_mb_transfer_t. |
kStatus_Success | Start Tx Message Buffer sending process successfully. |
kStatus_Fail | Write Tx Message Buffer failed. |
kStatus_FLEXCAN_TxBusy | Tx Message Buffer is in use. |
status_t FLEXCAN_TransferFDReceiveNonBlocking | ( | CAN_Type * | base, |
flexcan_handle_t * | handle, | ||
flexcan_mb_transfer_t * | pMbXfer | ||
) |
This function receives a message using IRQ. This is non-blocking function, which returns right away. When the message has been received, the receive callback function is called.
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |
pMbXfer | FlexCAN FD Message Buffer transfer structure. See the flexcan_mb_transfer_t. |
kStatus_Success | - Start Rx Message Buffer receiving process successfully. |
kStatus_FLEXCAN_RxBusy | - Rx Message Buffer is in use. |
void FLEXCAN_TransferFDAbortSend | ( | CAN_Type * | base, |
flexcan_handle_t * | handle, | ||
uint8_t | mbIdx | ||
) |
This function aborts the interrupt driven message send process.
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |
mbIdx | The FlexCAN FD Message Buffer index. |
void FLEXCAN_TransferFDAbortReceive | ( | CAN_Type * | base, |
flexcan_handle_t * | handle, | ||
uint8_t | mbIdx | ||
) |
This function aborts the interrupt driven message receive process.
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |
mbIdx | The FlexCAN FD Message Buffer index. |
status_t FLEXCAN_TransferSendBlocking | ( | CAN_Type * | base, |
uint8_t | mbIdx, | ||
flexcan_frame_t * | pTxFrame | ||
) |
base | FlexCAN peripheral base pointer. |
mbIdx | The FlexCAN Message Buffer index. |
pTxFrame | Pointer to CAN message frame to be sent. |
kStatus_Success | - Write Tx Message Buffer Successfully. |
kStatus_Fail | - Tx Message Buffer is currently in use. |
status_t FLEXCAN_TransferReceiveBlocking | ( | CAN_Type * | base, |
uint8_t | mbIdx, | ||
flexcan_frame_t * | pRxFrame | ||
) |
base | FlexCAN peripheral base pointer. |
mbIdx | The FlexCAN Message Buffer index. |
pRxFrame | Pointer to CAN message frame structure for reception. |
kStatus_Success | - Rx Message Buffer is full and has been read successfully. |
kStatus_FLEXCAN_RxOverflow | - Rx Message Buffer is already overflowed and has been read successfully. |
kStatus_Fail | - Rx Message Buffer is empty. |
status_t FLEXCAN_TransferReceiveFifoBlocking | ( | CAN_Type * | base, |
flexcan_frame_t * | pRxFrame | ||
) |
base | FlexCAN peripheral base pointer. |
pRxFrame | Pointer to CAN message frame structure for reception. |
kStatus_Success | - Read Message from Rx FIFO successfully. |
kStatus_Fail | - Rx FIFO is not enabled. |
status_t FLEXCAN_TransferReceiveEnhancedFifoBlocking | ( | CAN_Type * | base, |
flexcan_fd_frame_t * | pRxFrame | ||
) |
base | FlexCAN peripheral base pointer. |
pRxFrame | Pointer to CAN FD message frame structure for reception. |
kStatus_Success | - Read Message from Rx FIFO successfully. |
kStatus_Fail | - Rx FIFO is not enabled. |
void FLEXCAN_TransferCreateHandle | ( | CAN_Type * | base, |
flexcan_handle_t * | handle, | ||
flexcan_transfer_callback_t | callback, | ||
void * | userData | ||
) |
This function initializes the FlexCAN handle, which can be used for other FlexCAN transactional APIs. Usually, for a specified FlexCAN instance, call this API once to get the initialized handle.
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |
callback | The callback function. |
userData | The parameter of the callback function. |
status_t FLEXCAN_TransferSendNonBlocking | ( | CAN_Type * | base, |
flexcan_handle_t * | handle, | ||
flexcan_mb_transfer_t * | pMbXfer | ||
) |
This function sends a message using IRQ. This is a non-blocking function, which returns right away. When messages have been sent out, the send callback function is called.
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |
pMbXfer | FlexCAN Message Buffer transfer structure. See the flexcan_mb_transfer_t. |
kStatus_Success | Start Tx Message Buffer sending process successfully. |
kStatus_Fail | Write Tx Message Buffer failed. |
kStatus_FLEXCAN_TxBusy | Tx Message Buffer is in use. |
status_t FLEXCAN_TransferReceiveNonBlocking | ( | CAN_Type * | base, |
flexcan_handle_t * | handle, | ||
flexcan_mb_transfer_t * | pMbXfer | ||
) |
This function receives a message using IRQ. This is non-blocking function, which returns right away. When the message has been received, the receive callback function is called.
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |
pMbXfer | FlexCAN Message Buffer transfer structure. See the flexcan_mb_transfer_t. |
kStatus_Success | - Start Rx Message Buffer receiving process successfully. |
kStatus_FLEXCAN_RxBusy | - Rx Message Buffer is in use. |
status_t FLEXCAN_TransferReceiveFifoNonBlocking | ( | CAN_Type * | base, |
flexcan_handle_t * | handle, | ||
flexcan_fifo_transfer_t * | pFifoXfer | ||
) |
This function receives a message using IRQ. This is a non-blocking function, which returns right away. When all messages have been received, the receive callback function is called.
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |
pFifoXfer | FlexCAN Rx FIFO transfer structure. See the flexcan_fifo_transfer_t. |
kStatus_Success | - Start Rx FIFO receiving process successfully. |
kStatus_FLEXCAN_RxFifoBusy | - Rx FIFO is currently in use. |
status_t FLEXCAN_TransferGetReceiveFifoCount | ( | CAN_Type * | base, |
flexcan_handle_t * | handle, | ||
size_t * | count | ||
) |
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |
count | Number of CAN messages receive so far by the non-blocking transaction. |
kStatus_InvalidArgument | count is Invalid. |
kStatus_Success | Successfully return the count. |
status_t FLEXCAN_TransferReceiveEnhancedFifoNonBlocking | ( | CAN_Type * | base, |
flexcan_handle_t * | handle, | ||
flexcan_fifo_transfer_t * | pFifoXfer | ||
) |
This function receives a message using IRQ. This is a non-blocking function, which returns right away. When all messages have been received, the receive callback function is called.
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |
pFifoXfer | FlexCAN Rx FIFO transfer structure. See the ref flexcan_fifo_transfer_t.@ |
kStatus_Success | - Start Rx FIFO receiving process successfully. |
kStatus_FLEXCAN_RxFifoBusy | - Rx FIFO is currently in use. |
|
inlinestatic |
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |
count | Number of CAN messages receive so far by the non-blocking transaction. |
kStatus_InvalidArgument | count is Invalid. |
kStatus_Success | Successfully return the count. |
uint32_t FLEXCAN_GetTimeStamp | ( | flexcan_handle_t * | handle, |
uint8_t | mbIdx | ||
) |
Then function can only be used when calling non-blocking Data transfer (TX/RX) API, After TX/RX data transfer done (User can get the status by handler's callback function), we can get the detail index of Mailbox's timestamp by handle, Detail non-blocking data transfer API (TX/RX) contain. -FLEXCAN_TransferSendNonBlocking -FLEXCAN_TransferFDSendNonBlocking -FLEXCAN_TransferReceiveNonBlocking -FLEXCAN_TransferFDReceiveNonBlocking -FLEXCAN_TransferReceiveFifoNonBlocking
handle | FlexCAN handle pointer. |
mbIdx | The FlexCAN Message Buffer index. |
the | index of mailbox 's timestamp stored in the handle. |
void FLEXCAN_TransferAbortSend | ( | CAN_Type * | base, |
flexcan_handle_t * | handle, | ||
uint8_t | mbIdx | ||
) |
This function aborts the interrupt driven message send process.
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |
mbIdx | The FlexCAN Message Buffer index. |
void FLEXCAN_TransferAbortReceive | ( | CAN_Type * | base, |
flexcan_handle_t * | handle, | ||
uint8_t | mbIdx | ||
) |
This function aborts the interrupt driven message receive process.
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |
mbIdx | The FlexCAN Message Buffer index. |
void FLEXCAN_TransferAbortReceiveFifo | ( | CAN_Type * | base, |
flexcan_handle_t * | handle | ||
) |
This function aborts the interrupt driven message receive from Rx FIFO process.
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |
void FLEXCAN_TransferAbortReceiveEnhancedFifo | ( | CAN_Type * | base, |
flexcan_handle_t * | handle | ||
) |
This function aborts the interrupt driven message receive from Enhanced Rx FIFO process.
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |
void FLEXCAN_TransferHandleIRQ | ( | CAN_Type * | base, |
flexcan_handle_t * | handle | ||
) |
This function handles the FlexCAN Error, the Message Buffer, and the Rx FIFO IRQ request.
base | FlexCAN peripheral base address. |
handle | FlexCAN handle pointer. |