RTEMS 6.1-rc6
Loading...
Searching...
No Matches
Data Structures | Enumerator | Variables
Flexcan_driver

Data Structures

struct  _flexcan_frame
 FlexCAN message frame structure. More...
 
struct  _flexcan_timing_config
 FlexCAN protocol timing characteristic configuration structure. More...
 
struct  _flexcan_config
 FlexCAN module configuration structure. More...
 
struct  _flexcan_rx_mb_config
 FlexCAN Receive Message Buffer configuration structure. More...
 
struct  _flexcan_rx_fifo_config
 FlexCAN Legacy Rx FIFO configuration structure. More...
 
struct  _flexcan_mb_transfer
 FlexCAN Message Buffer transfer. More...
 
struct  _flexcan_fifo_transfer
 FlexCAN Rx FIFO transfer. More...
 
struct  _flexcan_handle
 FlexCAN handle structure. More...
 

Variables

uint32_t   _flexcan_frame::timestamp: 16
 
uint32_t   _flexcan_frame::length: 4
 
uint32_t   _flexcan_frame::type: 1
 
uint32_t   _flexcan_frame::format: 1
 
uint32_t   _flexcan_frame::__pad0__: 1
 
uint32_t   _flexcan_frame::idhit: 9
 
struct {
   uint32_t   _flexcan_frame::timestamp: 16
 
   uint32_t   _flexcan_frame::length: 4
 
   uint32_t   _flexcan_frame::type: 1
 
   uint32_t   _flexcan_frame::format: 1
 
   uint32_t   _flexcan_frame::__pad0__: 1
 
   uint32_t   _flexcan_frame::idhit: 9
 
}; 
 
uint32_t   _flexcan_frame::id: 29
 
uint32_t   _flexcan_frame::__pad0__: 3
 
struct {
   uint32_t   _flexcan_frame::id: 29
 
   uint32_t   _flexcan_frame::__pad0__: 3
 
}; 
 
uint32_t   _flexcan_frame::dataWord0
 
uint32_t   _flexcan_frame::dataWord1
 
struct {
   uint32_t   _flexcan_frame::dataWord0
 
   uint32_t   _flexcan_frame::dataWord1
 
 
uint8_t   _flexcan_frame::dataByte3
 
uint8_t   _flexcan_frame::dataByte2
 
uint8_t   _flexcan_frame::dataByte1
 
uint8_t   _flexcan_frame::dataByte0
 
uint8_t   _flexcan_frame::dataByte7
 
uint8_t   _flexcan_frame::dataByte6
 
uint8_t   _flexcan_frame::dataByte5
 
uint8_t   _flexcan_frame::dataByte4
 
struct {
   uint8_t   _flexcan_frame::dataByte3
 
   uint8_t   _flexcan_frame::dataByte2
 
   uint8_t   _flexcan_frame::dataByte1
 
   uint8_t   _flexcan_frame::dataByte0
 
   uint8_t   _flexcan_frame::dataByte7
 
   uint8_t   _flexcan_frame::dataByte6
 
   uint8_t   _flexcan_frame::dataByte5
 
   uint8_t   _flexcan_frame::dataByte4
 
 
union {
   struct {
      uint32_t   _flexcan_frame::dataWord0
 
      uint32_t   _flexcan_frame::dataWord1
 
   } 
 
   struct {
      uint8_t   _flexcan_frame::dataByte3
 
      uint8_t   _flexcan_frame::dataByte2
 
      uint8_t   _flexcan_frame::dataByte1
 
      uint8_t   _flexcan_frame::dataByte0
 
      uint8_t   _flexcan_frame::dataByte7
 
      uint8_t   _flexcan_frame::dataByte6
 
      uint8_t   _flexcan_frame::dataByte5
 
      uint8_t   _flexcan_frame::dataByte4
 
   } 
 
}; 
 
uint16_t _flexcan_timing_config::preDivider
 
uint8_t _flexcan_timing_config::rJumpwidth
 
uint8_t _flexcan_timing_config::phaseSeg1
 
uint8_t _flexcan_timing_config::phaseSeg2
 
uint8_t _flexcan_timing_config::propSeg
 
uint32_t   _flexcan_config::baudRate
 
struct {
   uint32_t   _flexcan_config::baudRate
 
 
uint32_t   _flexcan_config::bitRate
 
struct {
   uint32_t   _flexcan_config::bitRate
 
 
union {
   struct {
      uint32_t   _flexcan_config::baudRate
 
   } 
 
   struct {
      uint32_t   _flexcan_config::bitRate
 
   } 
 
}; 
 
flexcan_clock_source_t _flexcan_config::clkSrc
 
flexcan_wake_up_source_t _flexcan_config::wakeupSrc
 
uint8_t _flexcan_config::maxMbNum
 
bool _flexcan_config::enableLoopBack
 
bool _flexcan_config::enableTimerSync
 
bool _flexcan_config::enableSelfWakeup
 
bool _flexcan_config::enableIndividMask
 
bool _flexcan_config::disableSelfReception
 
bool _flexcan_config::enableListenOnlyMode
 
bool _flexcan_config::enableSupervisorMode
 
flexcan_timing_config_t _flexcan_config::timingConfig
 
uint32_t _flexcan_rx_mb_config::id
 
flexcan_frame_format_t _flexcan_rx_mb_config::format
 
flexcan_frame_type_t _flexcan_rx_mb_config::type
 
uint32_t * _flexcan_rx_fifo_config::idFilterTable
 
uint8_t _flexcan_rx_fifo_config::idFilterNum
 
flexcan_rx_fifo_filter_type_t _flexcan_rx_fifo_config::idFilterType
 
flexcan_rx_fifo_priority_t _flexcan_rx_fifo_config::priority
 
flexcan_frame_t_flexcan_mb_transfer::frame
 
uint8_t _flexcan_mb_transfer::mbIdx
 
flexcan_frame_t_flexcan_fifo_transfer::frame
 
size_t _flexcan_fifo_transfer::frameNum
 
flexcan_transfer_callback_t _flexcan_handle::callback
 
void * _flexcan_handle::userData
 
flexcan_frame_t *volatile _flexcan_handle::mbFrameBuf [CAN_WORD1_COUNT]
 
flexcan_frame_t *volatile _flexcan_handle::rxFifoFrameBuf
 
size_t _flexcan_handle::rxFifoFrameNum
 
size_t _flexcan_handle::rxFifoTransferTotalNum
 
volatile uint8_t _flexcan_handle::mbState [CAN_WORD1_COUNT]
 
volatile uint8_t _flexcan_handle::rxFifoState
 
volatile uint32_t _flexcan_handle::timestamp [CAN_WORD1_COUNT]
 

Driver version

enum  {
  kStatus_FLEXCAN_TxBusy = MAKE_STATUS(kStatusGroup_FLEXCAN, 0) , kStatus_FLEXCAN_TxIdle = MAKE_STATUS(kStatusGroup_FLEXCAN, 1) , kStatus_FLEXCAN_TxSwitchToRx , kStatus_FLEXCAN_RxBusy = MAKE_STATUS(kStatusGroup_FLEXCAN, 3) ,
  kStatus_FLEXCAN_RxIdle = MAKE_STATUS(kStatusGroup_FLEXCAN, 4) , kStatus_FLEXCAN_RxOverflow = MAKE_STATUS(kStatusGroup_FLEXCAN, 5) , kStatus_FLEXCAN_RxFifoBusy = MAKE_STATUS(kStatusGroup_FLEXCAN, 6) , kStatus_FLEXCAN_RxFifoIdle = MAKE_STATUS(kStatusGroup_FLEXCAN, 7) ,
  kStatus_FLEXCAN_RxFifoOverflow = MAKE_STATUS(kStatusGroup_FLEXCAN, 8) , kStatus_FLEXCAN_RxFifoWarning = MAKE_STATUS(kStatusGroup_FLEXCAN, 9) , kStatus_FLEXCAN_RxFifoDisabled , kStatus_FLEXCAN_ErrorStatus = MAKE_STATUS(kStatusGroup_FLEXCAN, 11) ,
  kStatus_FLEXCAN_WakeUp = MAKE_STATUS(kStatusGroup_FLEXCAN, 12) , kStatus_FLEXCAN_UnHandled = MAKE_STATUS(kStatusGroup_FLEXCAN, 13) , kStatus_FLEXCAN_RxRemote = MAKE_STATUS(kStatusGroup_FLEXCAN, 14)
}
 FlexCAN transfer status. More...
 
enum  _flexcan_frame_format { kFLEXCAN_FrameFormatStandard = 0x0U , kFLEXCAN_FrameFormatExtend = 0x1U }
 FlexCAN frame format. More...
 
enum  _flexcan_frame_type { kFLEXCAN_FrameTypeData = 0x0U , kFLEXCAN_FrameTypeRemote = 0x1U }
 FlexCAN frame type. More...
 
enum  _flexcan_clock_source { kFLEXCAN_ClkSrcOsc = 0x0U , kFLEXCAN_ClkSrcPeri = 0x1U , kFLEXCAN_ClkSrc0 = 0x0U , kFLEXCAN_ClkSrc1 = 0x1U }
 FlexCAN clock source. More...
 
enum  _flexcan_wake_up_source { kFLEXCAN_WakeupSrcUnfiltered = 0x0U , kFLEXCAN_WakeupSrcFiltered = 0x1U }
 FlexCAN wake up source. More...
 
enum  _flexcan_rx_fifo_filter_type { kFLEXCAN_RxFifoFilterTypeA = 0x0U , kFLEXCAN_RxFifoFilterTypeB , kFLEXCAN_RxFifoFilterTypeC , kFLEXCAN_RxFifoFilterTypeD = 0x3U }
 FlexCAN Rx Fifo Filter type. More...
 
enum  _flexcan_rx_fifo_priority { kFLEXCAN_RxFifoPrioLow = 0x0U , kFLEXCAN_RxFifoPrioHigh = 0x1U }
 FlexCAN Enhanced/Legacy Rx FIFO priority. More...
 
enum  _flexcan_interrupt_enable {
  kFLEXCAN_BusOffInterruptEnable = CAN_CTRL1_BOFFMSK_MASK , kFLEXCAN_ErrorInterruptEnable = CAN_CTRL1_ERRMSK_MASK , kFLEXCAN_TxWarningInterruptEnable = CAN_CTRL1_TWRNMSK_MASK , kFLEXCAN_RxWarningInterruptEnable = CAN_CTRL1_RWRNMSK_MASK ,
  kFLEXCAN_WakeUpInterruptEnable = CAN_MCR_WAKMSK_MASK
}
 FlexCAN interrupt enable enumerations. More...
 
enum  _flexcan_flags {
  kFLEXCAN_SynchFlag = CAN_ESR1_SYNCH_MASK , kFLEXCAN_TxWarningIntFlag = CAN_ESR1_TWRNINT_MASK , kFLEXCAN_RxWarningIntFlag = CAN_ESR1_RWRNINT_MASK , kFLEXCAN_IdleFlag = CAN_ESR1_IDLE_MASK ,
  kFLEXCAN_FaultConfinementFlag = CAN_ESR1_FLTCONF_MASK , kFLEXCAN_TransmittingFlag = CAN_ESR1_TX_MASK , kFLEXCAN_ReceivingFlag = CAN_ESR1_RX_MASK , kFLEXCAN_BusOffIntFlag = CAN_ESR1_BOFFINT_MASK ,
  kFLEXCAN_ErrorIntFlag = CAN_ESR1_ERRINT_MASK , kFLEXCAN_WakeUpIntFlag = CAN_ESR1_WAKINT_MASK , kFLEXCAN_ErrorFlag
}
 FlexCAN status flags. More...
 
enum  _flexcan_error_flags {
  kFLEXCAN_TxErrorWarningFlag = CAN_ESR1_TXWRN_MASK , kFLEXCAN_RxErrorWarningFlag = CAN_ESR1_RXWRN_MASK , kFLEXCAN_StuffingError = CAN_ESR1_STFERR_MASK , kFLEXCAN_FormError = CAN_ESR1_FRMERR_MASK ,
  kFLEXCAN_CrcError = CAN_ESR1_CRCERR_MASK , kFLEXCAN_AckError = CAN_ESR1_ACKERR_MASK , kFLEXCAN_Bit0Error = CAN_ESR1_BIT0ERR_MASK , kFLEXCAN_Bit1Error = CAN_ESR1_BIT1ERR_MASK
}
 FlexCAN error status flags. More...
 
enum  { kFLEXCAN_RxFifoOverflowFlag = CAN_IFLAG1_BUF7I_MASK , kFLEXCAN_RxFifoWarningFlag = CAN_IFLAG1_BUF6I_MASK , kFLEXCAN_RxFifoFrameAvlFlag = CAN_IFLAG1_BUF5I_MASK }
 FlexCAN Legacy Rx FIFO status flags. More...
 
typedef enum _flexcan_frame_format flexcan_frame_format_t
 FlexCAN frame format.
 
typedef enum _flexcan_frame_type flexcan_frame_type_t
 FlexCAN frame type.
 
typedef enum _flexcan_clock_source flexcan_clock_source_t
 FlexCAN clock source.
 
typedef enum _flexcan_wake_up_source flexcan_wake_up_source_t
 FlexCAN wake up source.
 
typedef enum _flexcan_rx_fifo_filter_type flexcan_rx_fifo_filter_type_t
 FlexCAN Rx Fifo Filter type.
 
typedef enum _flexcan_rx_fifo_priority flexcan_rx_fifo_priority_t
 FlexCAN Enhanced/Legacy Rx FIFO priority.
 
typedef struct _flexcan_frame flexcan_frame_t
 FlexCAN message frame structure.
 
typedef struct _flexcan_timing_config flexcan_timing_config_t
 FlexCAN protocol timing characteristic configuration structure.
 
typedef struct _flexcan_config flexcan_config_t
 FlexCAN module configuration structure.
 
typedef struct _flexcan_rx_mb_config flexcan_rx_mb_config_t
 FlexCAN Receive Message Buffer configuration structure.
 
typedef struct _flexcan_rx_fifo_config flexcan_rx_fifo_config_t
 FlexCAN Legacy Rx FIFO configuration structure.
 
typedef struct _flexcan_mb_transfer flexcan_mb_transfer_t
 FlexCAN Message Buffer transfer.
 
typedef struct _flexcan_fifo_transfer flexcan_fifo_transfer_t
 FlexCAN Rx FIFO transfer.
 
typedef struct _flexcan_handle flexcan_handle_t
 FlexCAN handle structure definition.
 
typedef void(* flexcan_transfer_callback_t) (CAN_Type *base, flexcan_handle_t *handle, status_t status, uint32_t result, void *userData)
 
#define FSL_FLEXCAN_DRIVER_VERSION   (MAKE_VERSION(2, 9, 2))
 FlexCAN driver version.
 
#define FLEXCAN_WAIT_TIMEOUT   (1000U)
 
#define FLEXCAN_ID_STD(id)    (((uint32_t)(((uint32_t)(id)) << CAN_ID_STD_SHIFT)) & CAN_ID_STD_MASK)
 FlexCAN frame length helper macro.
 
#define FLEXCAN_ID_EXT(id)
 
#define FLEXCAN_RX_MB_STD_MASK(id, rtr, ide)
 FlexCAN 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)
 FlexCAN Legacy Rx FIFO Mask 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)
 FlexCAN Rx FIFO Filter 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 FLEXCAN_ERROR_AND_STATUS_INIT_FLAG
 FlexCAN interrupt/status flag helper macro.
 
#define FLEXCAN_WAKE_UP_FLAG   ((uint32_t)kFLEXCAN_WakeUpIntFlag)
 
#define FLEXCAN_MEMORY_ERROR_INIT_FLAG   (0U)
 
#define FLEXCAN_MEMORY_ENHANCED_RX_FIFO_INIT_FLAG   (0U)
 FlexCAN Enhanced Rx FIFO base address helper macro.
 
#define FLEXCAN_CALLBACK(x)    void(x)(CAN_Type * base, flexcan_handle_t * handle, status_t status, uint32_t result, void *userData)
 FlexCAN transfer callback function.
 

Initialization and deinitialization

void FLEXCAN_EnterFreezeMode (CAN_Type *base)
 Enter FlexCAN Freeze Mode.
 
void FLEXCAN_ExitFreezeMode (CAN_Type *base)
 Exit FlexCAN Freeze Mode.
 
uint32_t FLEXCAN_GetInstance (CAN_Type *base)
 Get the FlexCAN instance from peripheral base address.
 
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.
 
void FLEXCAN_Init (CAN_Type *base, const flexcan_config_t *pConfig, uint32_t sourceClock_Hz)
 Initializes a FlexCAN instance.
 
void FLEXCAN_Deinit (CAN_Type *base)
 De-initializes a FlexCAN instance.
 
void FLEXCAN_GetDefaultConfig (flexcan_config_t *pConfig)
 Gets the default configuration structure.
 

Configuration.

void FLEXCAN_SetTimingConfig (CAN_Type *base, const flexcan_timing_config_t *pConfig)
 Sets the FlexCAN classical CAN protocol timing characteristic.
 
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.
 
void FLEXCAN_SetRxMbGlobalMask (CAN_Type *base, uint32_t mask)
 Sets the FlexCAN receive message buffer global mask.
 
void FLEXCAN_SetRxFifoGlobalMask (CAN_Type *base, uint32_t mask)
 Sets the FlexCAN receive FIFO global mask.
 
void FLEXCAN_SetRxIndividualMask (CAN_Type *base, uint8_t maskIdx, uint32_t mask)
 Sets the FlexCAN receive individual mask.
 
void FLEXCAN_SetTxMbConfig (CAN_Type *base, uint8_t mbIdx, bool enable)
 Configures a FlexCAN transmit message buffer.
 
void FLEXCAN_SetRxMbConfig (CAN_Type *base, uint8_t mbIdx, const flexcan_rx_mb_config_t *pRxMbConfig, bool enable)
 Configures a FlexCAN Receive Message Buffer.
 
void FLEXCAN_SetRxFifoConfig (CAN_Type *base, const flexcan_rx_fifo_config_t *pRxFifoConfig, bool enable)
 Configures the FlexCAN Legacy Rx FIFO.
 

Bus Operations

status_t FLEXCAN_WriteTxMb (CAN_Type *base, uint8_t mbIdx, const flexcan_frame_t *pTxFrame)
 Writes a FlexCAN Message to the Transmit Message Buffer.
 
status_t FLEXCAN_ReadRxMb (CAN_Type *base, uint8_t mbIdx, flexcan_frame_t *pRxFrame)
 Reads a FlexCAN Message from Receive Message Buffer.
 
status_t FLEXCAN_ReadRxFifo (CAN_Type *base, flexcan_frame_t *pRxFrame)
 Reads a FlexCAN Message from Legacy Rx FIFO.
 

Transactional

status_t FLEXCAN_TransferSendBlocking (CAN_Type *base, uint8_t mbIdx, flexcan_frame_t *pTxFrame)
 Performs a polling send transaction on the CAN bus.
 
status_t FLEXCAN_TransferReceiveBlocking (CAN_Type *base, uint8_t mbIdx, flexcan_frame_t *pRxFrame)
 Performs a polling receive transaction on the CAN bus.
 
status_t FLEXCAN_TransferReceiveFifoBlocking (CAN_Type *base, flexcan_frame_t *pRxFrame)
 Performs a polling receive transaction from Legacy Rx FIFO on the CAN bus.
 
void FLEXCAN_TransferCreateHandle (CAN_Type *base, flexcan_handle_t *handle, flexcan_transfer_callback_t callback, void *userData)
 Initializes the FlexCAN handle.
 
status_t FLEXCAN_TransferSendNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_mb_transfer_t *pMbXfer)
 Sends a message using IRQ.
 
status_t FLEXCAN_TransferReceiveNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_mb_transfer_t *pMbXfer)
 Receives a message using IRQ.
 
status_t FLEXCAN_TransferReceiveFifoNonBlocking (CAN_Type *base, flexcan_handle_t *handle, flexcan_fifo_transfer_t *pFifoXfer)
 Receives a message from Rx FIFO using IRQ.
 
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.
 
uint32_t FLEXCAN_GetTimeStamp (flexcan_handle_t *handle, uint8_t mbIdx)
 Gets the detail index of Mailbox's Timestamp by handle.
 
void FLEXCAN_TransferAbortSend (CAN_Type *base, flexcan_handle_t *handle, uint8_t mbIdx)
 Aborts the interrupt driven message send process.
 
void FLEXCAN_TransferAbortReceive (CAN_Type *base, flexcan_handle_t *handle, uint8_t mbIdx)
 Aborts the interrupt driven message receive process.
 
void FLEXCAN_TransferAbortReceiveFifo (CAN_Type *base, flexcan_handle_t *handle)
 Aborts the interrupt driven message receive from Rx FIFO process.
 
void FLEXCAN_TransferHandleIRQ (CAN_Type *base, flexcan_handle_t *handle)
 FlexCAN IRQ handle function.
 

Detailed Description

Macro Definition Documentation

◆ FLEXCAN_CALLBACK

#define FLEXCAN_CALLBACK (   x)     void(x)(CAN_Type * base, flexcan_handle_t * handle, status_t status, uint32_t result, void *userData)

FlexCAN transfer callback function.

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.

◆ FLEXCAN_ERROR_AND_STATUS_INIT_FLAG

#define FLEXCAN_ERROR_AND_STATUS_INIT_FLAG
Value:
(uint32_t)kFLEXCAN_ErrorIntFlag | FLEXCAN_MEMORY_ERROR_INIT_FLAG)
@ kFLEXCAN_RxWarningIntFlag
Definition: fsl_flexcan.h:503
@ kFLEXCAN_BusOffIntFlag
Definition: fsl_flexcan.h:508
@ kFLEXCAN_TxWarningIntFlag
Definition: fsl_flexcan.h:502
@ kFLEXCAN_ErrorIntFlag
Definition: fsl_flexcan.h:509

FlexCAN interrupt/status flag helper macro.

◆ FLEXCAN_ID_EXT

#define FLEXCAN_ID_EXT (   id)
Value:
(((uint32_t)(((uint32_t)(id)) << CAN_ID_EXT_SHIFT)) & \
(CAN_ID_EXT_MASK | CAN_ID_STD_MASK))

Extend Frame ID helper macro.

◆ FLEXCAN_ID_STD

#define FLEXCAN_ID_STD (   id)     (((uint32_t)(((uint32_t)(id)) << CAN_ID_STD_SHIFT)) & CAN_ID_STD_MASK)

FlexCAN frame length helper macro.

FlexCAN Frame ID helper macro. Standard Frame ID helper macro.

◆ FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_A

#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.

◆ FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_HIGH

#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_HIGH (   id,
  rtr,
  ide 
)
Value:
id, rtr, ide)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_HIGH(id, rtr, ide)
Definition: fsl_flexcan.h:93

Extend Rx FIFO Filter helper macro Type B upper part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_LOW

#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_B_LOW (   id,
  rtr,
  ide 
)
Value:
id, rtr, ide)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_LOW(id, rtr, ide)
Definition: fsl_flexcan.h:102

Extend Rx FIFO Filter helper macro Type B lower part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_HIGH

#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_HIGH (   id)
Value:
id)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_HIGH(id)
Definition: fsl_flexcan.h:109

Extend Rx FIFO Filter helper macro Type C upper part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_LOW

#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.

◆ FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_HIGH

#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_HIGH (   id)
Value:
id)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_HIGH(id)
Definition: fsl_flexcan.h:112

Extend Rx FIFO Filter helper macro Type C mid-upper part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_LOW

#define FLEXCAN_RX_FIFO_EXT_FILTER_TYPE_C_MID_LOW (   id)
Value:
id)
#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_LOW(id)
Definition: fsl_flexcan.h:117

Extend Rx FIFO Filter helper macro Type C mid-lower part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_MASK_TYPE_A

#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_A (   id,
  rtr,
  ide 
)
Value:
(((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \
(FLEXCAN_ID_EXT(id) << 1))
#define FLEXCAN_ID_EXT(id)
Definition: fsl_flexcan.h:42

Extend Rx FIFO Mask helper macro Type A helper macro.

◆ FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_HIGH

#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_HIGH (   id,
  rtr,
  ide 
)
Value:
( \
((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \
((FLEXCAN_ID_EXT(id) & 0x1FFF8000) \
<< 1))

Extend Rx FIFO Mask helper macro Type B upper part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_LOW

#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_B_LOW (   id,
  rtr,
  ide 
)
Value:
(((uint32_t)((uint32_t)(rtr) << 15) | (uint32_t)((uint32_t)(ide) << 14)) | \
((FLEXCAN_ID_EXT(id) & 0x1FFF8000) >> \
15))

Extend Rx FIFO Mask helper macro Type B lower part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_HIGH

#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.

◆ FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_LOW

#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.

◆ FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_HIGH

#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_HIGH (   id)
Value:
((FLEXCAN_ID_EXT(id) & 0x1FE00000) >> \
5)

Extend Rx FIFO Mask helper macro Type C mid-upper part helper macro.

◆ FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_LOW

#define FLEXCAN_RX_FIFO_EXT_MASK_TYPE_C_MID_LOW (   id)
Value:
((FLEXCAN_ID_EXT(id) & 0x1FE00000) >> \
13)

Extend Rx FIFO Mask helper macro Type C mid-lower part helper macro.

◆ FLEXCAN_RX_FIFO_STD_FILTER_TYPE_A

#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.

Standard Rx FIFO Filter helper macro Type A helper macro.

◆ FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_HIGH

#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_HIGH (   id,
  rtr,
  ide 
)
Value:
id, rtr, ide)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_HIGH(id, rtr, ide)
Definition: fsl_flexcan.h:66

Standard Rx FIFO Filter helper macro Type B upper part helper macro.

◆ FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_LOW

#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_B_LOW (   id,
  rtr,
  ide 
)
Value:
id, rtr, ide)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_LOW(id, rtr, ide)
Definition: fsl_flexcan.h:71

Standard Rx FIFO Filter helper macro Type B lower part helper macro.

◆ FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_HIGH

#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_HIGH (   id)
Value:
id)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_HIGH(id)
Definition: fsl_flexcan.h:76

Standard Rx FIFO Filter helper macro Type C upper part helper macro.

◆ FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_LOW

#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_LOW (   id)
Value:
id)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_LOW(id)
Definition: fsl_flexcan.h:85

Standard Rx FIFO Filter helper macro Type C lower part helper macro.

◆ FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_HIGH

#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_HIGH (   id)
Value:
id)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_HIGH(id)
Definition: fsl_flexcan.h:79

Standard Rx FIFO Filter helper macro Type C mid-upper part helper macro.

◆ FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_LOW

#define FLEXCAN_RX_FIFO_STD_FILTER_TYPE_C_MID_LOW (   id)
Value:
id)
#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_LOW(id)
Definition: fsl_flexcan.h:82

Standard Rx FIFO Filter helper macro Type C mid-lower part helper macro.

◆ FLEXCAN_RX_FIFO_STD_MASK_TYPE_A

#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_A (   id,
  rtr,
  ide 
)
Value:
(((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \
(FLEXCAN_ID_STD(id) << 1))
#define FLEXCAN_ID_STD(id)
FlexCAN frame length helper macro.
Definition: fsl_flexcan.h:39

FlexCAN Legacy Rx FIFO Mask helper macro.

Standard Rx FIFO Mask helper macro Type A helper macro.

◆ FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_HIGH

#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_HIGH (   id,
  rtr,
  ide 
)
Value:
(((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \
(((uint32_t)(id)&0x7FF) << 19))

Standard Rx FIFO Mask helper macro Type B upper part helper macro.

◆ FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_LOW

#define FLEXCAN_RX_FIFO_STD_MASK_TYPE_B_LOW (   id,
  rtr,
  ide 
)
Value:
(((uint32_t)((uint32_t)(rtr) << 15) | (uint32_t)((uint32_t)(ide) << 14)) | \
(((uint32_t)(id)&0x7FF) << 3))

Standard Rx FIFO Mask helper macro Type B lower part helper macro.

◆ FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_HIGH

#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.

◆ FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_LOW

#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.

◆ FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_HIGH

#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.

◆ FLEXCAN_RX_FIFO_STD_MASK_TYPE_C_MID_LOW

#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.

◆ FLEXCAN_RX_MB_EXT_MASK

#define FLEXCAN_RX_MB_EXT_MASK (   id,
  rtr,
  ide 
)
Value:
(((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \

Extend Rx Message Buffer Mask helper macro.

◆ FLEXCAN_RX_MB_STD_MASK

#define FLEXCAN_RX_MB_STD_MASK (   id,
  rtr,
  ide 
)
Value:
(((uint32_t)((uint32_t)(rtr) << 31) | (uint32_t)((uint32_t)(ide) << 30)) | \

FlexCAN Rx Message Buffer Mask helper macro.

Standard Rx Message Buffer Mask helper macro.

Typedef Documentation

◆ flexcan_clock_source_t

FlexCAN clock source.

Deprecated:

Do not use the kFLEXCAN_ClkSrcOs. It has been superceded kFLEXCAN_ClkSrc0

Do not use the kFLEXCAN_ClkSrcPeri. It has been superceded kFLEXCAN_ClkSrc1

◆ flexcan_config_t

FlexCAN module configuration structure.

Deprecated:

Do not use the baudRate. It has been superceded bitRate

Do not use the baudRateFD. It has been superceded bitRateFD

◆ flexcan_rx_fifo_priority_t

FlexCAN Enhanced/Legacy Rx FIFO priority.

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.

◆ flexcan_rx_mb_config_t

FlexCAN Receive Message Buffer configuration structure.

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.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

FlexCAN transfer status.

Enumerator
kStatus_FLEXCAN_TxBusy 

Tx Message Buffer is Busy.

kStatus_FLEXCAN_TxIdle 

Tx Message Buffer is Idle.

kStatus_FLEXCAN_TxSwitchToRx 

Remote Message is send out and Message buffer changed to Receive one.

kStatus_FLEXCAN_RxBusy 

Rx Message Buffer is Busy.

kStatus_FLEXCAN_RxIdle 

Rx Message Buffer is Idle.

kStatus_FLEXCAN_RxOverflow 

Rx Message Buffer is Overflowed.

kStatus_FLEXCAN_RxFifoBusy 

Rx Message FIFO is Busy.

kStatus_FLEXCAN_RxFifoIdle 

Rx Message FIFO is Idle.

kStatus_FLEXCAN_RxFifoOverflow 

Rx Message FIFO is overflowed.

kStatus_FLEXCAN_RxFifoWarning 

Rx Message FIFO is almost overflowed.

kStatus_FLEXCAN_RxFifoDisabled 

Rx Message FIFO is disabled during reading.

kStatus_FLEXCAN_ErrorStatus 

FlexCAN Module Error and Status.

kStatus_FLEXCAN_WakeUp 

FlexCAN is waken up from STOP mode.

kStatus_FLEXCAN_UnHandled 

UnHadled Interrupt asserted.

kStatus_FLEXCAN_RxRemote 

Rx Remote Message Received in Mail box.

◆ anonymous enum

anonymous enum

FlexCAN Legacy Rx FIFO status flags.

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.

◆ _flexcan_clock_source

FlexCAN clock source.

Deprecated:

Do not use the kFLEXCAN_ClkSrcOs. It has been superceded kFLEXCAN_ClkSrc0

Do not use the kFLEXCAN_ClkSrcPeri. It has been superceded kFLEXCAN_ClkSrc1

Enumerator
kFLEXCAN_ClkSrcOsc 

FlexCAN Protocol Engine clock from Oscillator.

kFLEXCAN_ClkSrcPeri 

FlexCAN Protocol Engine clock from Peripheral Clock.

kFLEXCAN_ClkSrc0 

FlexCAN Protocol Engine clock selected by user as SRC == 0.

kFLEXCAN_ClkSrc1 

FlexCAN Protocol Engine clock selected by user as SRC == 1.

◆ _flexcan_error_flags

FlexCAN error status 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.

Enumerator
kFLEXCAN_TxErrorWarningFlag 

Tx Error Warning Status.

kFLEXCAN_RxErrorWarningFlag 

Rx Error Warning Status.

kFLEXCAN_StuffingError 

Stuffing Error.

kFLEXCAN_FormError 

Form Error.

kFLEXCAN_CrcError 

Cyclic Redundancy Check Error.

kFLEXCAN_AckError 

Received no ACK on transmission.

kFLEXCAN_Bit0Error 

Unable to send dominant bit.

kFLEXCAN_Bit1Error 

Unable to send recessive bit.

◆ _flexcan_flags

FlexCAN status flags.

This provides constants for the FlexCAN status flags for use in the FlexCAN functions.

Note
The CPU read action clears the bits corresponding to the FlEXCAN_ErrorFlag macro, therefore user need to read status flags and distinguish which error is occur using _flexcan_error_flags enumerations.
Enumerator
kFLEXCAN_SynchFlag 

CAN Synchronization Status.

kFLEXCAN_TxWarningIntFlag 

Tx Warning Interrupt Flag.

kFLEXCAN_RxWarningIntFlag 

Rx Warning Interrupt Flag.

kFLEXCAN_IdleFlag 

FlexCAN In IDLE Status.

kFLEXCAN_FaultConfinementFlag 

FlexCAN Fault Confinement State.

kFLEXCAN_TransmittingFlag 

FlexCAN In Transmission Status.

kFLEXCAN_ReceivingFlag 

FlexCAN In Reception Status.

kFLEXCAN_BusOffIntFlag 

Bus Off Interrupt Flag.

kFLEXCAN_ErrorIntFlag 

CAN Error Interrupt Flag.

kFLEXCAN_WakeUpIntFlag 

Self Wake-Up Interrupt Flag.

◆ _flexcan_frame_format

FlexCAN frame format.

Enumerator
kFLEXCAN_FrameFormatStandard 

Standard frame format attribute.

kFLEXCAN_FrameFormatExtend 

Extend frame format attribute.

◆ _flexcan_frame_type

FlexCAN frame type.

Enumerator
kFLEXCAN_FrameTypeData 

Data frame type attribute.

kFLEXCAN_FrameTypeRemote 

Remote frame type attribute.

◆ _flexcan_interrupt_enable

FlexCAN interrupt enable enumerations.

This provides constants for the FlexCAN interrupt enable enumerations for use in the FlexCAN functions.

Note
FlexCAN Message Buffers and Legacy Rx FIFO interrupts not included in.
Enumerator
kFLEXCAN_BusOffInterruptEnable 

Bus Off interrupt, use bit 15.

kFLEXCAN_ErrorInterruptEnable 

CAN Error interrupt, use bit 14.

kFLEXCAN_TxWarningInterruptEnable 

Tx Warning interrupt, use bit 11.

kFLEXCAN_RxWarningInterruptEnable 

Rx Warning interrupt, use bit 10.

kFLEXCAN_WakeUpInterruptEnable 

Self Wake Up interrupt, use bit 26.

◆ _flexcan_rx_fifo_filter_type

FlexCAN Rx Fifo Filter type.

Enumerator
kFLEXCAN_RxFifoFilterTypeA 

One full ID (standard and extended) per ID Filter element.

kFLEXCAN_RxFifoFilterTypeB 

Two full standard IDs or two partial 14-bit ID slices per ID Filter Table element.

kFLEXCAN_RxFifoFilterTypeC 

Four partial 8-bit Standard or extended ID slices per ID Filter Table element.

kFLEXCAN_RxFifoFilterTypeD 

All frames rejected.

◆ _flexcan_rx_fifo_priority

FlexCAN Enhanced/Legacy Rx FIFO priority.

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.

◆ _flexcan_wake_up_source

FlexCAN wake up source.

Enumerator
kFLEXCAN_WakeupSrcUnfiltered 

FlexCAN uses unfiltered Rx input to detect edge.

kFLEXCAN_WakeupSrcFiltered 

FlexCAN uses filtered Rx input to detect edge.

Function Documentation

◆ FLEXCAN_CalculateImprovedTimingValues()

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.

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.

Parameters
baseFlexCAN peripheral base address.
bitRateThe classical CAN speed in bps defined by user, should be less than or equal to 1Mbps.
sourceClock_HzThe Source clock frequency in Hz.
pTimingConfigPointer to the FlexCAN timing configuration structure.
Returns
TRUE if timing configuration found, FALSE if failed to find configuration.

brief Calculates the improved timing values by specific bit Rates for classical CAN.

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.

param base FlexCAN peripheral base address. param bitRate The classical CAN speed in bps defined by user, should be less than or equal to 1Mbps. param sourceClock_Hz The Source clock frequency in Hz. param pTimingConfig Pointer to the FlexCAN timing configuration structure.

return TRUE if timing configuration found, FALSE if failed to find configuration.

◆ FLEXCAN_Deinit()

void FLEXCAN_Deinit ( CAN_Type base)

De-initializes a FlexCAN instance.

This function disables the FlexCAN module clock and sets all register values to the reset value.

Parameters
baseFlexCAN peripheral base address.

brief De-initializes a FlexCAN instance.

This function disables the FlexCAN module clock and sets all register values to the reset value.

param base FlexCAN peripheral base address.

◆ FLEXCAN_EnterFreezeMode()

void FLEXCAN_EnterFreezeMode ( CAN_Type base)

Enter FlexCAN Freeze Mode.

This function makes the FlexCAN work under Freeze Mode.

Parameters
baseFlexCAN peripheral base address.

brief Enter FlexCAN Freeze Mode.

This function makes the FlexCAN work under Freeze Mode.

param base FlexCAN peripheral base address.

◆ FLEXCAN_ExitFreezeMode()

void FLEXCAN_ExitFreezeMode ( CAN_Type base)

Exit FlexCAN Freeze Mode.

This function makes the FlexCAN leave Freeze Mode.

Parameters
baseFlexCAN peripheral base address.

brief Exit FlexCAN Freeze Mode.

This function makes the FlexCAN leave Freeze Mode.

param base FlexCAN peripheral base address.

◆ FLEXCAN_GetDefaultConfig()

void FLEXCAN_GetDefaultConfig ( flexcan_config_t pConfig)

Gets the default configuration structure.

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;

Parameters
pConfigPointer to the FlexCAN configuration structure.

brief Gets the default configuration structure.

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->enablePretendedeNetworking = false; flexcanConfig->enableMemoryErrorControl = true; flexcanConfig->enableNonCorrectableErrorEnterFreeze = true; flexcanConfig->enableTransceiverDelayMeasure = true; flexcanConfig.timingConfig = timingConfig;

param pConfig Pointer to the FlexCAN configuration structure.

◆ FLEXCAN_GetInstance()

uint32_t FLEXCAN_GetInstance ( CAN_Type base)

Get the FlexCAN instance from peripheral base address.

Parameters
baseFlexCAN peripheral base address.
Returns
FlexCAN instance.

brief Get the FlexCAN instance from peripheral base address.

param base FlexCAN peripheral base address. return FlexCAN instance.

◆ FLEXCAN_GetTimeStamp()

uint32_t FLEXCAN_GetTimeStamp ( flexcan_handle_t handle,
uint8_t  mbIdx 
)

Gets the detail index of Mailbox's Timestamp by handle.

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

Parameters
handleFlexCAN handle pointer.
mbIdxThe FlexCAN Message Buffer index.
Return values
theindex of mailbox 's timestamp stored in the handle.

brief Gets the detail index of Mailbox's Timestamp by handle.

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

param handle FlexCAN handle pointer. param mbIdx The FlexCAN FD Message Buffer index. return the index of mailbox 's timestamp stored in the handle.

◆ FLEXCAN_Init()

void FLEXCAN_Init ( CAN_Type base,
const flexcan_config_t pConfig,
uint32_t  sourceClock_Hz 
)

Initializes a FlexCAN instance.

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.

flexcan_config_t flexcanConfig;
flexcanConfig.clkSrc = kFLEXCAN_ClkSrc0;
flexcanConfig.bitRate = 1000000U;
flexcanConfig.maxMbNum = 16;
flexcanConfig.enableLoopBack = false;
flexcanConfig.enableSelfWakeup = false;
flexcanConfig.enableIndividMask = false;
flexcanConfig.enableDoze = false;
flexcanConfig.disableSelfReception = false;
flexcanConfig.enableListenOnlyMode = false;
flexcanConfig.timingConfig = timingConfig;
FLEXCAN_Init(CAN0, &flexcanConfig, 40000000UL);
uint8_t maxMbNum
Definition: fsl_flexcan.h:806
uint32_t bitRate
Definition: fsl_flexcan.h:798
bool enableListenOnlyMode
Definition: fsl_flexcan.h:812
bool enableSelfWakeup
Definition: fsl_flexcan.h:809
bool disableSelfReception
Definition: fsl_flexcan.h:811
flexcan_clock_source_t clkSrc
Definition: fsl_flexcan.h:804
bool enableLoopBack
Definition: fsl_flexcan.h:807
void FLEXCAN_Init(CAN_Type *base, const flexcan_config_t *pConfig, uint32_t sourceClock_Hz)
Initializes a FlexCAN instance.
Definition: fsl_flexcan.c:780
bool enableIndividMask
Definition: fsl_flexcan.h:810
@ kFLEXCAN_ClkSrc0
Definition: fsl_flexcan.h:343
FlexCAN module configuration structure.
Definition: fsl_flexcan.h:786
Parameters
baseFlexCAN peripheral base address.
pConfigPointer to the user-defined configuration structure.
sourceClock_HzFlexCAN Protocol Engine clock source frequency in Hz.

brief Initializes a FlexCAN instance.

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. code flexcan_config_t flexcanConfig; flexcanConfig.clkSrc = kFLEXCAN_ClkSrc0; flexcanConfig.bitRate = 1000000U; flexcanConfig.maxMbNum = 16; flexcanConfig.enableLoopBack = false; flexcanConfig.enableSelfWakeup = false; flexcanConfig.enableIndividMask = false; flexcanConfig.disableSelfReception = false; flexcanConfig.enableListenOnlyMode = false; flexcanConfig.enableDoze = false; flexcanConfig.timingConfig = timingConfig; FLEXCAN_Init(CAN0, &flexcanConfig, 40000000UL); endcode

param base FlexCAN peripheral base address. param pConfig Pointer to the user-defined configuration structure. param sourceClock_Hz FlexCAN Protocol Engine clock source frequency in Hz.

◆ FLEXCAN_ReadRxFifo()

status_t FLEXCAN_ReadRxFifo ( CAN_Type base,
flexcan_frame_t pRxFrame 
)

Reads a FlexCAN Message from Legacy Rx FIFO.

This function reads a CAN message from the FlexCAN Legacy Rx FIFO.

Parameters
baseFlexCAN peripheral base address.
pRxFramePointer to CAN message frame structure for reception.
Return values
kStatus_Success- Read Message from Rx FIFO successfully.
kStatus_Fail- Rx FIFO is not enabled.

brief Reads a FlexCAN Message from Legacy Rx FIFO.

This function reads a CAN message from the FlexCAN Legacy Rx FIFO.

param base FlexCAN peripheral base address. param pRxFrame Pointer to CAN message frame structure for reception. retval kStatus_Success - Read Message from Rx FIFO successfully. retval kStatus_Fail - Rx FIFO is not enabled.

◆ FLEXCAN_ReadRxMb()

status_t FLEXCAN_ReadRxMb ( CAN_Type base,
uint8_t  mbIdx,
flexcan_frame_t pRxFrame 
)

Reads a FlexCAN Message from Receive Message Buffer.

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.

Parameters
baseFlexCAN peripheral base address.
mbIdxThe FlexCAN Message Buffer index.
pRxFramePointer to CAN message frame structure for reception.
Return values
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.

brief Reads a FlexCAN Message from Receive Message Buffer.

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.

param base FlexCAN peripheral base address. param mbIdx The FlexCAN Message Buffer index. param pRxFrame Pointer to CAN message frame structure for reception. retval kStatus_Success - Rx Message Buffer is full and has been read successfully. retval kStatus_FLEXCAN_RxOverflow - Rx Message Buffer is already overflowed and has been read successfully. retval kStatus_Fail - Rx Message Buffer is empty.

◆ FLEXCAN_SetBitRate()

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.

This function set the bit rate of classical CAN frame or CAN FD frame nominal phase base on FLEXCAN_CalculateImprovedTimingValues() API calculated timing values.

Note
Calling FLEXCAN_SetBitRate() overrides the bit rate set in FLEXCAN_Init().
Parameters
baseFlexCAN peripheral base address.
sourceClock_HzSource Clock in Hz.
bitRate_BpsBit rate in Bps.
Returns
kStatus_Success - Set CAN baud rate (only Nominal phase) successfully.

brief Set bit rate of FlexCAN classical CAN frame or CAN FD frame nominal phase.

This function set the bit rate of classical CAN frame or CAN FD frame nominal phase base on FLEXCAN_CalculateImprovedTimingValues() API calculated timing values.

note Calling FLEXCAN_SetBitRate() overrides the bit rate set in FLEXCAN_Init().

param base FlexCAN peripheral base address. param sourceClock_Hz Source Clock in Hz. param bitRate_Bps Bit rate in Bps. return kStatus_Success - Set CAN baud rate (only Nominal phase) successfully.

◆ FLEXCAN_SetRxFifoConfig()

void FLEXCAN_SetRxFifoConfig ( CAN_Type base,
const flexcan_rx_fifo_config_t pRxFifoConfig,
bool  enable 
)

Configures the FlexCAN Legacy Rx FIFO.

This function configures the FlexCAN Rx FIFO with given configuration.

Note
Legacy Rx FIFO only can receive classic CAN message.
Parameters
baseFlexCAN peripheral base address.
pRxFifoConfigPointer to the FlexCAN Legacy Rx FIFO configuration structure. Can be NULL when enable parameter is false.
enableEnable/disable Legacy Rx FIFO.
  • true: Enable Legacy Rx FIFO.
  • false: Disable Legacy Rx FIFO.

brief Configures the FlexCAN Legacy Rx FIFO.

This function configures the FlexCAN Rx FIFO with given configuration. note Legacy Rx FIFO only can receive classic CAN message.

param base FlexCAN peripheral base address. param pRxFifoConfig Pointer to the FlexCAN Legacy Rx FIFO configuration structure. Can be NULL when enable parameter is false. param enable Enable/disable Legacy Rx FIFO.

  • true: Enable Legacy Rx FIFO.
  • false: Disable Legacy Rx FIFO.

◆ FLEXCAN_SetRxFifoGlobalMask()

void FLEXCAN_SetRxFifoGlobalMask ( CAN_Type base,
uint32_t  mask 
)

Sets the FlexCAN receive FIFO global mask.

This function sets the global mask for FlexCAN FIFO in a matching process.

Parameters
baseFlexCAN peripheral base address.
maskRx Fifo Global Mask value.

brief Sets the FlexCAN receive FIFO global mask.

This function sets the global mask for FlexCAN FIFO in a matching process.

param base FlexCAN peripheral base address. param mask Rx Fifo Global Mask value.

◆ FLEXCAN_SetRxIndividualMask()

void FLEXCAN_SetRxIndividualMask ( CAN_Type base,
uint8_t  maskIdx,
uint32_t  mask 
)

Sets the FlexCAN receive individual 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.

Parameters
baseFlexCAN peripheral base address.
maskIdxThe Index of individual Mask.
maskRx Individual Mask value.

brief Sets the FlexCAN receive individual 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.

param base FlexCAN peripheral base address. param maskIdx The Index of individual Mask. param mask Rx Individual Mask value.

◆ FLEXCAN_SetRxMbConfig()

void FLEXCAN_SetRxMbConfig ( CAN_Type base,
uint8_t  mbIdx,
const flexcan_rx_mb_config_t pRxMbConfig,
bool  enable 
)

Configures a FlexCAN Receive Message Buffer.

This function cleans a FlexCAN build-in Message Buffer and configures it as a Receive Message Buffer.

Parameters
baseFlexCAN peripheral base address.
mbIdxThe Message Buffer index.
pRxMbConfigPointer to the FlexCAN Message Buffer configuration structure.
enableEnable/disable Rx Message Buffer.
  • true: Enable Rx Message Buffer.
  • false: Disable Rx Message Buffer.

brief Configures a FlexCAN Receive Message Buffer.

This function cleans a FlexCAN build-in Message Buffer and configures it as a Receive Message Buffer.

param base FlexCAN peripheral base address. param mbIdx The Message Buffer index. param pRxMbConfig Pointer to the FlexCAN Message Buffer configuration structure. param enable Enable/disable Rx Message Buffer.

  • true: Enable Rx Message Buffer.
  • false: Disable Rx Message Buffer.

◆ FLEXCAN_SetRxMbGlobalMask()

void FLEXCAN_SetRxMbGlobalMask ( CAN_Type base,
uint32_t  mask 
)

Sets the FlexCAN receive message buffer global 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().

Parameters
baseFlexCAN peripheral base address.
maskRx Message Buffer Global Mask value.

brief Sets the FlexCAN receive message buffer global 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().

param base FlexCAN peripheral base address. param mask Rx Message Buffer Global Mask value.

◆ FLEXCAN_SetTimingConfig()

void FLEXCAN_SetTimingConfig ( CAN_Type base,
const flexcan_timing_config_t pConfig 
)

Sets the FlexCAN classical CAN protocol timing characteristic.

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.

Note
Calling FLEXCAN_SetTimingConfig() overrides the bit rate set in FLEXCAN_Init() or FLEXCAN_SetBitRate().
Parameters
baseFlexCAN peripheral base address.
pConfigPointer to the timing configuration structure.

brief Sets the FlexCAN classical protocol timing characteristic.

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_GetDefaultConfig() and get the default timing characteristicsthe, then call FLEXCAN_Init() and fill the bit rate field.

note Calling FLEXCAN_SetTimingConfig() overrides the bit rate set in FLEXCAN_Init().

param base FlexCAN peripheral base address. param pConfig Pointer to the timing configuration structure.

◆ FLEXCAN_SetTxMbConfig()

void FLEXCAN_SetTxMbConfig ( CAN_Type base,
uint8_t  mbIdx,
bool  enable 
)

Configures a FlexCAN transmit message buffer.

This function aborts the previous transmission, cleans the Message Buffer, and configures it as a Transmit Message Buffer.

Parameters
baseFlexCAN peripheral base address.
mbIdxThe Message Buffer index.
enableEnable/disable Tx Message Buffer.
  • true: Enable Tx Message Buffer.
  • false: Disable Tx Message Buffer.

brief Configures a FlexCAN transmit message buffer.

This function aborts the previous transmission, cleans the Message Buffer, and configures it as a Transmit Message Buffer.

param base FlexCAN peripheral base address. param mbIdx The Message Buffer index. param enable Enable/disable Tx Message Buffer.

  • true: Enable Tx Message Buffer.
  • false: Disable Tx Message Buffer.

◆ FLEXCAN_TransferAbortReceive()

void FLEXCAN_TransferAbortReceive ( CAN_Type base,
flexcan_handle_t handle,
uint8_t  mbIdx 
)

Aborts the interrupt driven message receive process.

This function aborts the interrupt driven message receive process.

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
mbIdxThe FlexCAN Message Buffer index.

brief Aborts the interrupt driven message receive process.

This function aborts the interrupt driven message receive process.

param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. param mbIdx The FlexCAN Message Buffer index.

◆ FLEXCAN_TransferAbortReceiveFifo()

void FLEXCAN_TransferAbortReceiveFifo ( CAN_Type base,
flexcan_handle_t handle 
)

Aborts the interrupt driven message receive from Rx FIFO process.

This function aborts the interrupt driven message receive from Rx FIFO process.

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.

brief Aborts the interrupt driven message receive from Legacy Rx FIFO process.

This function aborts the interrupt driven message receive from Legacy Rx FIFO process.

param base FlexCAN peripheral base address. param handle FlexCAN handle pointer.

◆ FLEXCAN_TransferAbortSend()

void FLEXCAN_TransferAbortSend ( CAN_Type base,
flexcan_handle_t handle,
uint8_t  mbIdx 
)

Aborts the interrupt driven message send process.

This function aborts the interrupt driven message send process.

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
mbIdxThe FlexCAN Message Buffer index.

brief Aborts the interrupt driven message send process.

This function aborts the interrupt driven message send process.

param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. param mbIdx The FlexCAN Message Buffer index.

◆ FLEXCAN_TransferCreateHandle()

void FLEXCAN_TransferCreateHandle ( CAN_Type base,
flexcan_handle_t handle,
flexcan_transfer_callback_t  callback,
void *  userData 
)

Initializes the FlexCAN handle.

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.

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
callbackThe callback function.
userDataThe parameter of the callback function.

brief Initializes the FlexCAN handle.

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.

param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. param callback The callback function. param userData The parameter of the callback function.

◆ FLEXCAN_TransferGetReceiveFifoCount()

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.

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
countNumber of CAN messages receive so far by the non-blocking transaction.
Return values
kStatus_InvalidArgumentcount is Invalid.
kStatus_SuccessSuccessfully return the count.

brief Gets the Legacy Rx Fifo transfer status during a interrupt non-blocking receive.

param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. param count Number of CAN messages receive so far by the non-blocking transaction. retval kStatus_InvalidArgument count is Invalid. retval kStatus_Success Successfully return the count.

◆ FLEXCAN_TransferHandleIRQ()

void FLEXCAN_TransferHandleIRQ ( CAN_Type base,
flexcan_handle_t handle 
)

FlexCAN IRQ handle function.

This function handles the FlexCAN Error, the Message Buffer, and the Rx FIFO IRQ request.

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.

brief FlexCAN IRQ handle function.

This function handles the FlexCAN Error, the Message Buffer, and the Rx FIFO IRQ request.

param base FlexCAN peripheral base address. param handle FlexCAN handle pointer.

◆ FLEXCAN_TransferReceiveBlocking()

status_t FLEXCAN_TransferReceiveBlocking ( CAN_Type base,
uint8_t  mbIdx,
flexcan_frame_t pRxFrame 
)

Performs a polling receive transaction on the CAN bus.

Note
A transfer handle does not need to be created before calling this API.
Parameters
baseFlexCAN peripheral base pointer.
mbIdxThe FlexCAN Message Buffer index.
pRxFramePointer to CAN message frame structure for reception.
Return values
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.

brief Performs a polling receive transaction on the CAN bus.

note A transfer handle does not need to be created before calling this API.

param base FlexCAN peripheral base pointer. param mbIdx The FlexCAN Message Buffer index. param pRxFrame Pointer to CAN message frame structure for reception. retval kStatus_Success - Rx Message Buffer is full and has been read successfully. retval kStatus_FLEXCAN_RxOverflow - Rx Message Buffer is already overflowed and has been read successfully. retval kStatus_Fail - Rx Message Buffer is empty.

◆ FLEXCAN_TransferReceiveFifoBlocking()

status_t FLEXCAN_TransferReceiveFifoBlocking ( CAN_Type base,
flexcan_frame_t pRxFrame 
)

Performs a polling receive transaction from Legacy Rx FIFO on the CAN bus.

Note
A transfer handle does not need to be created before calling this API.
Parameters
baseFlexCAN peripheral base pointer.
pRxFramePointer to CAN message frame structure for reception.
Return values
kStatus_Success- Read Message from Rx FIFO successfully.
kStatus_Fail- Rx FIFO is not enabled.

brief Performs a polling receive transaction from Legacy Rx FIFO on the CAN bus.

note A transfer handle does not need to be created before calling this API.

param base FlexCAN peripheral base pointer. param pRxFrame Pointer to CAN message frame structure for reception. retval kStatus_Success - Read Message from Rx FIFO successfully. retval kStatus_Fail - Rx FIFO is not enabled.

◆ FLEXCAN_TransferReceiveFifoNonBlocking()

status_t FLEXCAN_TransferReceiveFifoNonBlocking ( CAN_Type base,
flexcan_handle_t handle,
flexcan_fifo_transfer_t pFifoXfer 
)

Receives a message from Rx FIFO using IRQ.

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.

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
pFifoXferFlexCAN Rx FIFO transfer structure. See the flexcan_fifo_transfer_t.
Return values
kStatus_Success- Start Rx FIFO receiving process successfully.
kStatus_FLEXCAN_RxFifoBusy- Rx FIFO is currently in use.

brief Receives a message from Legacy Rx FIFO using IRQ.

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.

param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. param pFifoXfer FlexCAN Rx FIFO transfer structure. See the ref flexcan_fifo_transfer_t. retval kStatus_Success - Start Rx FIFO receiving process successfully. retval kStatus_FLEXCAN_RxFifoBusy - Rx FIFO is currently in use.

◆ FLEXCAN_TransferReceiveNonBlocking()

status_t FLEXCAN_TransferReceiveNonBlocking ( CAN_Type base,
flexcan_handle_t handle,
flexcan_mb_transfer_t pMbXfer 
)

Receives a message using IRQ.

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.

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
pMbXferFlexCAN Message Buffer transfer structure. See the flexcan_mb_transfer_t.
Return values
kStatus_Success- Start Rx Message Buffer receiving process successfully.
kStatus_FLEXCAN_RxBusy- Rx Message Buffer is in use.

brief Receives a message using IRQ.

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.

param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. param pMbXfer FlexCAN Message Buffer transfer structure. See the flexcan_mb_transfer_t. retval kStatus_Success - Start Rx Message Buffer receiving process successfully. retval kStatus_FLEXCAN_RxBusy - Rx Message Buffer is in use.

◆ FLEXCAN_TransferSendBlocking()

status_t FLEXCAN_TransferSendBlocking ( CAN_Type base,
uint8_t  mbIdx,
flexcan_frame_t pTxFrame 
)

Performs a polling send transaction on the CAN bus.

Note
A transfer handle does not need to be created before calling this API.
Parameters
baseFlexCAN peripheral base pointer.
mbIdxThe FlexCAN Message Buffer index.
pTxFramePointer to CAN message frame to be sent.
Return values
kStatus_Success- Write Tx Message Buffer Successfully.
kStatus_Fail- Tx Message Buffer is currently in use.

brief Performs a polling send transaction on the CAN bus.

note A transfer handle does not need to be created before calling this API.

param base FlexCAN peripheral base pointer. param mbIdx The FlexCAN Message Buffer index. param pTxFrame Pointer to CAN message frame to be sent. retval kStatus_Success - Write Tx Message Buffer Successfully. retval kStatus_Fail - Tx Message Buffer is currently in use.

◆ FLEXCAN_TransferSendNonBlocking()

status_t FLEXCAN_TransferSendNonBlocking ( CAN_Type base,
flexcan_handle_t handle,
flexcan_mb_transfer_t pMbXfer 
)

Sends a message using IRQ.

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.

Parameters
baseFlexCAN peripheral base address.
handleFlexCAN handle pointer.
pMbXferFlexCAN Message Buffer transfer structure. See the flexcan_mb_transfer_t.
Return values
kStatus_SuccessStart Tx Message Buffer sending process successfully.
kStatus_FailWrite Tx Message Buffer failed.
kStatus_FLEXCAN_TxBusyTx Message Buffer is in use.

brief Sends a message using IRQ.

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.

param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. param pMbXfer FlexCAN Message Buffer transfer structure. See the flexcan_mb_transfer_t. retval kStatus_Success Start Tx Message Buffer sending process successfully. retval kStatus_Fail Write Tx Message Buffer failed. retval kStatus_FLEXCAN_TxBusy Tx Message Buffer is in use.

◆ FLEXCAN_WriteTxMb()

status_t FLEXCAN_WriteTxMb ( CAN_Type base,
uint8_t  mbIdx,
const flexcan_frame_t pTxFrame 
)

Writes a FlexCAN Message to the Transmit Message Buffer.

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.

Parameters
baseFlexCAN peripheral base address.
mbIdxThe FlexCAN Message Buffer index.
pTxFramePointer to CAN message frame to be sent.
Return values
kStatus_Success- Write Tx Message Buffer Successfully.
kStatus_Fail- Tx Message Buffer is currently in use.

brief Writes a FlexCAN Message to the Transmit Message Buffer.

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.

param base FlexCAN peripheral base address. param mbIdx The FlexCAN Message Buffer index. param pTxFrame Pointer to CAN message frame to be sent. retval kStatus_Success - Write Tx Message Buffer Successfully. retval kStatus_Fail - Tx Message Buffer is currently in use.

Variable Documentation

◆ __pad0__ [1/3]

uint32_t _flexcan_frame::__pad0__

Reserved.

◆  [2/3]

uint32_t { ... } ::__pad0__

Reserved.

◆  [3/3]

uint32_t { ... } ::__pad0__

Reserved.

◆  [1/2]

uint32_t { ... } ::baudRate

FlexCAN bit rate in bps, for classical CAN or CANFD nominal phase.

◆ baudRate [2/2]

uint32_t _flexcan_config::baudRate

FlexCAN bit rate in bps, for classical CAN or CANFD nominal phase.

◆ bitRate [1/2]

uint32_t _flexcan_config::bitRate

FlexCAN bit rate in bps, for classical CAN or CANFD nominal phase.

◆  [2/2]

uint32_t { ... } ::bitRate

FlexCAN bit rate in bps, for classical CAN or CANFD nominal phase.

◆ callback

flexcan_transfer_callback_t _flexcan_handle::callback

Callback function.

◆ clkSrc

flexcan_clock_source_t _flexcan_config::clkSrc

Clock source for FlexCAN Protocol Engine.

◆  [1/2]

uint8_t { ... } ::dataByte0

CAN Frame payload byte0.

◆ dataByte0 [2/2]

uint8_t _flexcan_frame::dataByte0

CAN Frame payload byte0.

◆  [1/2]

uint8_t { ... } ::dataByte1

CAN Frame payload byte1.

◆ dataByte1 [2/2]

uint8_t _flexcan_frame::dataByte1

CAN Frame payload byte1.

◆ dataByte2 [1/2]

uint8_t _flexcan_frame::dataByte2

CAN Frame payload byte2.

◆  [2/2]

uint8_t { ... } ::dataByte2

CAN Frame payload byte2.

◆ dataByte3 [1/2]

uint8_t _flexcan_frame::dataByte3

CAN Frame payload byte3.

◆  [2/2]

uint8_t { ... } ::dataByte3

CAN Frame payload byte3.

◆ dataByte4 [1/2]

uint8_t _flexcan_frame::dataByte4

CAN Frame payload byte4.

◆  [2/2]

uint8_t { ... } ::dataByte4

CAN Frame payload byte4.

◆ dataByte5 [1/2]

uint8_t _flexcan_frame::dataByte5

CAN Frame payload byte5.

◆  [2/2]

uint8_t { ... } ::dataByte5

CAN Frame payload byte5.

◆ dataByte6 [1/2]

uint8_t _flexcan_frame::dataByte6

CAN Frame payload byte6.

◆  [2/2]

uint8_t { ... } ::dataByte6

CAN Frame payload byte6.

◆ dataByte7 [1/2]

uint8_t _flexcan_frame::dataByte7

CAN Frame payload byte7.

◆  [2/2]

uint8_t { ... } ::dataByte7

CAN Frame payload byte7.

◆  [1/2]

uint32_t { ... } ::dataWord0

CAN Frame payload word0.

◆ dataWord0 [2/2]

uint32_t _flexcan_frame::dataWord0

CAN Frame payload word0.

◆  [1/2]

uint32_t { ... } ::dataWord1

CAN Frame payload word1.

◆ dataWord1 [2/2]

uint32_t _flexcan_frame::dataWord1

CAN Frame payload word1.

◆ disableSelfReception

bool _flexcan_config::disableSelfReception

Enable or Disable Self Reflection.

◆ enableIndividMask

bool _flexcan_config::enableIndividMask

Enable or Disable Rx Individual Mask and Queue feature.

◆ enableListenOnlyMode

bool _flexcan_config::enableListenOnlyMode

Enable or Disable Listen Only Mode.

◆ enableLoopBack

bool _flexcan_config::enableLoopBack

Enable or Disable Loop Back Self Test Mode.

◆ enableSelfWakeup

bool _flexcan_config::enableSelfWakeup

Enable or Disable Self Wakeup Mode.

◆ enableSupervisorMode

bool _flexcan_config::enableSupervisorMode

Enable or Disable Supervisor Mode, enable this mode will make registers allow only Supervisor access.

◆ enableTimerSync

bool _flexcan_config::enableTimerSync

Enable or Disable Timer Synchronization.

◆  [1/3]

uint32_t { ... } ::format

CAN Frame Identifier(STD or EXT format).

◆ format [2/3]

uint32_t _flexcan_frame::format

CAN Frame Identifier(STD or EXT format).

◆ format [3/3]

flexcan_frame_format_t _flexcan_rx_mb_config::format

CAN Frame Identifier format(Standard of Extend).

◆ frame [1/2]

flexcan_frame_t* _flexcan_mb_transfer::frame

The buffer of CAN Message to be transfer.

◆ frame [2/2]

flexcan_frame_t* _flexcan_fifo_transfer::frame

The buffer of CAN Message to be received from Legacy Rx FIFO.

◆ frameNum

size_t _flexcan_fifo_transfer::frameNum

Number of CAN Message need to be received from Legacy or Ehanced Rx FIFO.

◆  [1/3]

uint32_t { ... } ::id

CAN Frame Identifier, should be set using FLEXCAN_ID_EXT() or FLEXCAN_ID_STD() macro.

◆ id [2/3]

uint32_t _flexcan_frame::id

CAN Frame Identifier, should be set using FLEXCAN_ID_EXT() or FLEXCAN_ID_STD() macro.

◆ id [3/3]

uint32_t _flexcan_rx_mb_config::id

CAN Message Buffer Frame Identifier, should be set using FLEXCAN_ID_EXT() or FLEXCAN_ID_STD() macro.

◆ idFilterNum

uint8_t _flexcan_rx_fifo_config::idFilterNum

The FlexCAN Legacy Rx FIFO Filter elements quantity.

◆ idFilterTable

uint32_t* _flexcan_rx_fifo_config::idFilterTable

Pointer to the FlexCAN Legacy Rx FIFO identifier filter table.

◆ idFilterType

flexcan_rx_fifo_filter_type_t _flexcan_rx_fifo_config::idFilterType

The FlexCAN Legacy Rx FIFO Filter type.

◆  [1/2]

uint32_t { ... } ::idhit

◆ idhit [2/2]

uint32_t _flexcan_frame::idhit

◆  [1/2]

uint32_t { ... } ::length

CAN frame data length in bytes (Range: 0~8).

◆ length [2/2]

uint32_t _flexcan_frame::length

CAN frame data length in bytes (Range: 0~8).

◆ maxMbNum

uint8_t _flexcan_config::maxMbNum

The maximum number of Message Buffers used by user.

◆ mbFrameBuf

flexcan_frame_t* volatile _flexcan_handle::mbFrameBuf[CAN_WORD1_COUNT]

The buffer for received CAN data from Message Buffers.

◆ mbIdx

uint8_t _flexcan_mb_transfer::mbIdx

The index of Message buffer used to transfer Message.

◆ mbState

volatile uint8_t _flexcan_handle::mbState[CAN_WORD1_COUNT]

Message Buffer transfer state.

◆ phaseSeg1

uint8_t _flexcan_timing_config::phaseSeg1

Classic CAN or CAN FD nominal phase Segment 1.

◆ phaseSeg2

uint8_t _flexcan_timing_config::phaseSeg2

Classic CAN or CAN FD nominal phase Segment 2.

◆ preDivider

uint16_t _flexcan_timing_config::preDivider

Classic CAN or CAN FD nominal phase bit rate prescaler.

◆ priority

flexcan_rx_fifo_priority_t _flexcan_rx_fifo_config::priority

The FlexCAN Legacy Rx FIFO receive priority.

◆ propSeg

uint8_t _flexcan_timing_config::propSeg

Classic CAN or CAN FD nominal phase Propagation Segment.

◆ rJumpwidth

uint8_t _flexcan_timing_config::rJumpwidth

Classic CAN or CAN FD nominal phase Re-sync Jump Width.

◆ rxFifoFrameBuf

flexcan_frame_t* volatile _flexcan_handle::rxFifoFrameBuf

The buffer for received CAN data from Legacy Rx FIFO.

◆ rxFifoFrameNum

size_t _flexcan_handle::rxFifoFrameNum

The number of CAN messages remaining to be received from Legacy or Ehanced Rx FIFO.

◆ rxFifoState

volatile uint8_t _flexcan_handle::rxFifoState

Rx FIFO transfer state.

◆ rxFifoTransferTotalNum

size_t _flexcan_handle::rxFifoTransferTotalNum

Total CAN Message number need to be received from Legacy or Ehanced Rx FIFO.

◆ timestamp [1/3]

uint32_t _flexcan_frame::timestamp

FlexCAN internal Free-Running Counter Time Stamp.

◆  [2/3]

uint32_t { ... } ::timestamp

FlexCAN internal Free-Running Counter Time Stamp.

◆ timestamp [3/3]

volatile uint32_t _flexcan_handle::timestamp[CAN_WORD1_COUNT]

Mailbox transfer timestamp.

◆  [1/3]

uint32_t { ... } ::type

CAN Frame Type(DATA or REMOTE).

◆ type [2/3]

uint32_t _flexcan_frame::type

CAN Frame Type(DATA or REMOTE).

◆ type [3/3]

flexcan_frame_type_t _flexcan_rx_mb_config::type

CAN Frame Type(Data or Remote).

◆ userData

void* _flexcan_handle::userData

FlexCAN callback function parameter.

◆ wakeupSrc

flexcan_wake_up_source_t _flexcan_config::wakeupSrc

Wake up source selection.