144 #if FEATURE_CAN_HAS_PE_CLKSRC_SELECT
206 #if FEATURE_CAN_HAS_PRETENDED_NETWORKING
219 uint8_t payload1[8U];
221 uint8_t payload2[8U];
259 #define CAN_ID_EXT_MASK 0x3FFFFu
260 #define CAN_ID_EXT_SHIFT 0
261 #define CAN_ID_EXT_WIDTH 18
263 #define CAN_ID_STD_MASK 0x1FFC0000u
264 #define CAN_ID_STD_SHIFT 18
265 #define CAN_ID_STD_WIDTH 11
267 #define CAN_ID_PRIO_MASK 0xE0000000u
268 #define CAN_ID_PRIO_SHIFT 29
269 #define CAN_ID_PRIO_WIDTH 3
271 #define CAN_CS_TIME_STAMP_MASK 0xFFFFu
272 #define CAN_CS_TIME_STAMP_SHIFT 0
273 #define CAN_CS_TIME_STAMP_WIDTH 16
275 #define CAN_CS_DLC_MASK 0xF0000u
276 #define CAN_CS_DLC_SHIFT 16
277 #define CAN_CS_DLC_WIDTH 4
279 #define CAN_CS_RTR_MASK 0x100000u
280 #define CAN_CS_RTR_SHIFT 20
281 #define CAN_CS_RTR_WIDTH 1
283 #define CAN_CS_IDE_MASK 0x200000u
284 #define CAN_CS_IDE_SHIFT 21
285 #define CAN_CS_IDE_WIDTH 1
287 #define CAN_CS_SRR_MASK 0x400000u
288 #define CAN_CS_SRR_SHIFT 22
289 #define CAN_CS_SRR_WIDTH 1
291 #define CAN_CS_CODE_MASK 0xF000000u
292 #define CAN_CS_CODE_SHIFT 24
293 #define CAN_CS_CODE_WIDTH 4
295 #define CAN_MB_EDL_MASK 0x80000000u
296 #define CAN_MB_BRS_MASK 0x40000000u
303 #if defined(__cplusplus)
326 #if FEATURE_CAN_HAS_PE_CLKSRC_SELECT
472 const uint8_t *msgData);
517 uint32_t msgBuffIdx);
581 uint32_t maxMsgBuffNum);
625 uint32_t msgBuffIdx,
bool enable);
663 uint32_t msgBuffIdx);
676 return (base->
IFLAG1 & mask);
884 #if FEATURE_CAN_HAS_DMA_ENABLE
947 #if FEATURE_CAN_HAS_PRETENDED_NETWORKING
982 #if defined(__cplusplus)
status_t FLEXCAN_HAL_SetRxFifoDMA(CAN_Type *base, bool enable)
Enables/Disables the DMA support for RxFIFO.
void FLEXCAN_HAL_SetRxMsgBuffGlobalExtMask(CAN_Type *base, uint32_t extMask)
Sets the FlexCAN RX Message Buffer global extended mask.
void FLEXCAN_HAL_SetTimeSegmentsCbt(CAN_Type *base, const flexcan_time_segment_t *timeSeg)
Sets the FlexCAN time segments for setting up bit rate for FD BRS.
void FLEXCAN_HAL_ClearErrIntStatusFlag(CAN_Type *base)
Clears all other interrupts in ERRSTAT register (Error, Busoff, Wakeup).
Pretended Networking ID filter.
void FLEXCAN_HAL_ConfigPN(CAN_Type *base, const flexcan_pn_config_t *pnConfig)
Configures the Pretended Networking mode.
void FLEXCAN_HAL_SetTimeSegments(CAN_Type *base, const flexcan_time_segment_t *timeSeg)
Sets the FlexCAN time segments for setting up bit rate.
void FLEXCAN_HAL_GetTimeSegments(const CAN_Type *base, flexcan_time_segment_t *timeSeg)
Gets the FlexCAN time segments to calculate the bit rate.
void FLEXCAN_HAL_SetTDCOffset(CAN_Type *base, bool enable, uint8_t offset)
Enables/Disables the Transceiver Delay Compensation feature and sets the Transceiver Delay Compensati...
void FLEXCAN_HAL_DisableRxFifo(CAN_Type *base)
Disables the Rx FIFO.
#define CAN_IMASK1_BUF31TO0M_MASK
void FLEXCAN_HAL_ExitFreezeMode(CAN_Type *base)
Un freezes the FlexCAN module.
void FLEXCAN_HAL_Enable(CAN_Type *base)
Enables FlexCAN controller.
FlexCAN bus error counters Implements : flexcan_buserr_counter_t_Class.
status_t FLEXCAN_HAL_EnableRxFifo(CAN_Type *base, uint32_t numOfFilters)
Enables the Rx FIFO.
bool FLEXCAN_HAL_IsFDEnabled(const CAN_Type *base)
Checks if the Flexible Data rate feature is enabled.
#define CAN_RXFIR_IDHIT_MASK
static uint32_t FLEXCAN_HAL_GetAllMsgBuffIntStatusFlag(const CAN_Type *base)
Gets all FlexCAN Message Buffer interrupt flags.
uint8_t FLEXCAN_HAL_GetPayloadSize(const CAN_Type *base)
Gets the payload size of the MBs.
status_t FLEXCAN_HAL_GetMsgBuff(CAN_Type *base, uint32_t msgBuffIdx, flexcan_msgbuff_t *msgBuff)
Gets the FlexCAN message buffer fields.
status_t FLEXCAN_HAL_SetMsgBuffIntCmd(CAN_Type *base, uint32_t msgBuffIdx, bool enable)
Enables/Disables the FlexCAN Message Buffer interrupt.
void FLEXCAN_HAL_Disable(CAN_Type *base)
Disables FlexCAN controller.
flexcan_pn_filter_combination_t filterComb
status_t FLEXCAN_HAL_LockRxMsgBuff(CAN_Type *base, uint32_t msgBuffIdx)
Locks the FlexCAN Rx message buffer.
#define CAN_CTRL1_CLKSRC_MASK
uint8_t FLEXCAN_HAL_GetMsgBuffIntStatusFlag(const CAN_Type *base, uint32_t msgBuffIdx)
Gets the individual FlexCAN MB interrupt flag.
void FLEXCAN_HAL_SetRxFifoGlobalStdMask(CAN_Type *base, uint32_t stdMask)
Sets the FlexCAN RX FIFO global standard mask.
static uint32_t FLEXCAN_HAL_GetErrStatus(const CAN_Type *base)
Gets error and status.
void FLEXCAN_HAL_EnterFreezeMode(CAN_Type *base)
Freezes the FlexCAN module.
#define CAN_FDCTRL_TDCFAIL_MASK
void FLEXCAN_HAL_SetSelfReception(CAN_Type *base, bool enable)
Enables/Disables the Self Reception feature.
static bool FLEXCAN_HAL_GetClock(const CAN_Type *base)
Reads the clock source for FlexCAN Protocol Engine (PE).
#define CAN_MCR_RFEN_MASK
#define CAN_MCR_PNET_EN_MASK
void FLEXCAN_HAL_SetErrIntCmd(CAN_Type *base, flexcan_int_type_t errType, bool enable)
Enables error interrupt of the FlexCAN module.
flexcan_int_type_t
FlexCAN error interrupt types Implements : flexcan_int_type_t_Class.
flexcan_pn_id_filter_t idFilter2
void FLEXCAN_HAL_SetRxMsgBuff15StdMask(CAN_Type *base, uint32_t stdMask)
Sets the FlexCAN Rx Message Buffer BUF15 standard mask.
flexcan_pn_payload_filter_t payloadFilter
void FLEXCAN_HAL_SetOperationMode(CAN_Type *base, flexcan_operation_modes_t mode)
Set operation mode.
void FLEXCAN_HAL_SetRxMsgBuffGlobalStdMask(CAN_Type *base, uint32_t stdMask)
Sets the FlexCAN Rx Message Buffer global standard mask.
FlexCAN timing related structures Implements : flexcan_time_segment_t_Class.
void FLEXCAN_HAL_SetRxMaskType(CAN_Type *base, flexcan_rx_mask_type_t type)
Sets the Rx masking type.
flexcan_pn_filter_combination_t
Pretended Networking filtering combinations.
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
static void FLEXCAN_HAL_UnlockRxMsgBuff(const CAN_Type *base)
Unlocks the FlexCAN Rx message buffer.
flexcan_operation_modes_t
FlexCAN operation modes Implements : flexcan_operation_modes_t_Class.
#define CAN_CTRL1_TWRNMSK_MASK
void FLEXCAN_HAL_SetRxFifoFilter(CAN_Type *base, flexcan_rx_fifo_id_element_format_t idFormat, const flexcan_id_table_t *idFilterTable)
Sets the FlexCAN Rx FIFO fields.
static bool FLEXCAN_HAL_IsRxFifoEnabled(const CAN_Type *base)
Checks if Rx FIFO is enabled.
void FLEXCAN_HAL_SetRxFifoFilterNum(CAN_Type *base, uint32_t number)
Sets the number of the Rx FIFO filters.
flexcan_rx_fifo_id_element_format_t
ID formats for RxFIFO Implements : flexcan_rx_fifo_id_element_format_t_Class.
void FLEXCAN_HAL_ReadRxFifo(const CAN_Type *base, flexcan_msgbuff_t *rxFifo)
Gets the FlexCAN Rx FIFO data.
status_t FLEXCAN_HAL_SetRxMsgBuff(CAN_Type *base, uint32_t msgBuffIdx, const flexcan_msgbuff_code_status_t *cs, uint32_t msgId)
Sets the FlexCAN message buffer fields for receiving.
FlexCAN message buffer structure Implements : flexcan_msgbuff_t_Class.
#define CAN_CTRL1_ERRMSK_MASK
flexcan_msgbuff_id_type_t msgIdType
#define CAN_FDCTRL_TDCVAL_MASK
FlexCAN RX FIFO ID filter table structure Implements : flexcan_id_table_t_Class.
flexcan_pn_filter_selection_t
Pretended Networking matching schemes.
static void FLEXCAN_HAL_SetPN(CAN_Type *base, bool enable)
Enables/Disables the Pretended Networking mode.
#define CAN_CTRL1_RWRNMSK_MASK
status_t FLEXCAN_HAL_SetRxIndividualStdMask(CAN_Type *base, uint32_t msgBuffIdx, uint32_t stdMask)
Sets the FlexCAN Rx individual standard mask for ID filtering in the Rx MBs and the Rx FIFO...
Pretended Networking configuration structure Implements : flexcan_pn_config_t_Class.
#define CAN_RXFIR_IDHIT_SHIFT
void FLEXCAN_HAL_Init(CAN_Type *base)
Initializes the FlexCAN controller.
status_t FLEXCAN_HAL_SetTxMsgBuff(CAN_Type *base, uint32_t msgBuffIdx, const flexcan_msgbuff_code_status_t *cs, uint32_t msgId, const uint8_t *msgData)
Sets the FlexCAN message buffer fields for transmitting.
#define CAN_FDCTRL_TDCFAIL_SHIFT
static void FLEXCAN_HAL_ClearTDCFail(CAN_Type *base)
Clears the TDC Fail flag.
status_t FLEXCAN_HAL_SetMaxMsgBuffNum(CAN_Type *base, uint32_t maxMsgBuffNum)
Sets the maximum number of Message Buffers.
void FLEXCAN_HAL_GetWMB(const CAN_Type *base, uint8_t wmbIndex, flexcan_msgbuff_t *wmb)
Extracts one of the frames which triggered the wake up event.
void FLEXCAN_HAL_ExitOperationMode(CAN_Type *base, flexcan_operation_modes_t mode)
Exit operation mode.
void FLEXCAN_HAL_SelectClock(CAN_Type *base, flexcan_clk_source_t clk)
Selects the clock source for FlexCAN.
flexcan_msgbuff_id_type_t
FlexCAN Message Buffer ID type Implements : flexcan_msgbuff_id_type_t_Class.
flexcan_clk_source_t
FlexCAN clock source Implements : flexcan_clk_source_t_Class.
static uint8_t FLEXCAN_HAL_GetTDCValue(const CAN_Type *base)
Gets the value of the Transceiver Delay Compensation.
void FLEXCAN_HAL_SetRxMsgBuff14ExtMask(CAN_Type *base, uint32_t extMask)
Sets the FlexCAN RX Message Buffer BUF14 extended mask.
void FLEXCAN_HAL_SetRxMsgBuff15ExtMask(CAN_Type *base, uint32_t extMask)
Sets the FlexCAN RX MB BUF15 extended mask.
void FLEXCAN_HAL_SetPayloadSize(CAN_Type *base, flexcan_fd_payload_size_t payloadSize)
Sets the payload size of the MBs.
#define CAN_CTRL1_CLKSRC_SHIFT
static void FLEXCAN_HAL_ClearMsgBuffIntStatusFlag(CAN_Type *base, uint32_t flag)
Clears the interrupt flag of the message buffers.
static uint32_t FLEXCAN_HAL_GetFreezeAck(const CAN_Type *base)
Gets the value of FlexCAN freeze ACK.
void FLEXCAN_HAL_SetStuffBitCount(CAN_Type *base, bool enable)
Enables/Disables the Stuff Bit Count for CAN FD frames.
flexcan_fd_payload_size_t
FlexCAN payload sizes Implements : flexcan_fd_payload_size_t_Class.
static uint32_t FLEXCAN_HAL_GetRxFifoHitIdAcceptanceFilter(const CAN_Type *base)
Gets the FlexCAN ID acceptance filter hit indicator on Rx FIFO.
#define CAN_MCR_FRZACK_SHIFT
flexcan_rx_mask_type_t
FlexCAN RX mask type. Implements : flexcan_rx_mask_type_t_Class.
#define CAN_MCR_RFEN_SHIFT
void FLEXCAN_HAL_GetErrCounter(const CAN_Type *base, flexcan_buserr_counter_t *errCount)
Gets the transmit error counter and receives the error counter.
#define CAN_CTRL1_BOFFMSK_MASK
void FLEXCAN_HAL_SetRxFifoGlobalExtMask(CAN_Type *base, uint32_t extMask)
Sets the FlexCAN Rx FIFO global extended mask.
Pretended Networking payload filter.
flexcan_pn_filter_selection_t idFilterType
flexcan_pn_id_filter_t idFilter1
#define CAN_FDCTRL_TDCVAL_SHIFT
FlexCAN Message Buffer code and status for transmit and receive Implements : flexcan_msgbuff_code_sta...
#define CAN_MCR_PNET_EN(x)
#define CAN_MCR_FRZACK_MASK
flexcan_pn_filter_selection_t payloadFilterType
status_t FLEXCAN_HAL_SetRxIndividualExtMask(CAN_Type *base, uint32_t msgBuffIdx, uint32_t extMask)
Sets the FlexCAN Rx individual extended mask for ID filtering in the Rx Message Buffers and the Rx FI...
static bool FLEXCAN_HAL_GetTDCFail(const CAN_Type *base)
Gets the value of the TDC Fail flag.
void FLEXCAN_HAL_SetFDEnabled(CAN_Type *base, bool enable)
Enables/Disables Flexible Data rate (if supported).
void FLEXCAN_HAL_SetRxMsgBuff14StdMask(CAN_Type *base, uint32_t stdMask)
Sets the FlexCAN RX Message Buffer BUF14 standard mask.