S32 SDK

Detailed Description

Data Structures

struct  flexcan_id_table_t
 FlexCAN RX FIFO ID filter table structure Implements : flexcan_id_table_t_Class. More...
 
struct  flexcan_buserr_counter_t
 FlexCAN bus error counters Implements : flexcan_buserr_counter_t_Class. More...
 
struct  flexcan_msgbuff_code_status_t
 FlexCAN Message Buffer code and status for transmit and receive Implements : flexcan_msgbuff_code_status_t_Class. More...
 
struct  flexcan_msgbuff_t
 FlexCAN message buffer structure Implements : flexcan_msgbuff_t_Class. More...
 
struct  flexcan_time_segment_t
 FlexCAN timing related structures Implements : flexcan_time_segment_t_Class. More...
 
struct  flexcan_pn_id_filter_t
 Pretended Networking ID filter. More...
 
struct  flexcan_pn_payload_filter_t
 Pretended Networking payload filter. More...
 
struct  flexcan_pn_config_t
 Pretended Networking configuration structure Implements : flexcan_pn_config_t_Class. More...
 

Macros

#define CAN_ID_EXT_MASK   0x3FFFFu
 
#define CAN_ID_EXT_SHIFT   0
 
#define CAN_ID_EXT_WIDTH   18
 
#define CAN_ID_STD_MASK   0x1FFC0000u
 
#define CAN_ID_STD_SHIFT   18
 
#define CAN_ID_STD_WIDTH   11
 
#define CAN_ID_PRIO_MASK   0xE0000000u
 
#define CAN_ID_PRIO_SHIFT   29
 
#define CAN_ID_PRIO_WIDTH   3
 
#define CAN_CS_TIME_STAMP_MASK   0xFFFFu
 
#define CAN_CS_TIME_STAMP_SHIFT   0
 
#define CAN_CS_TIME_STAMP_WIDTH   16
 
#define CAN_CS_DLC_MASK   0xF0000u
 
#define CAN_CS_DLC_SHIFT   16
 
#define CAN_CS_DLC_WIDTH   4
 
#define CAN_CS_RTR_MASK   0x100000u
 
#define CAN_CS_RTR_SHIFT   20
 
#define CAN_CS_RTR_WIDTH   1
 
#define CAN_CS_IDE_MASK   0x200000u
 
#define CAN_CS_IDE_SHIFT   21
 
#define CAN_CS_IDE_WIDTH   1
 
#define CAN_CS_SRR_MASK   0x400000u
 
#define CAN_CS_SRR_SHIFT   22
 
#define CAN_CS_SRR_WIDTH   1
 
#define CAN_CS_CODE_MASK   0xF000000u
 
#define CAN_CS_CODE_SHIFT   24
 
#define CAN_CS_CODE_WIDTH   4
 
#define CAN_MB_EDL_MASK   0x80000000u
 
#define CAN_MB_BRS_MASK   0x40000000u
 

Enumerations

enum  flexcan_operation_modes_t {
  FLEXCAN_NORMAL_MODE, FLEXCAN_LISTEN_ONLY_MODE, FLEXCAN_LOOPBACK_MODE, FLEXCAN_FREEZE_MODE,
  FLEXCAN_DISABLE_MODE
}
 FlexCAN operation modes Implements : flexcan_operation_modes_t_Class. More...
 
enum  {
  FLEXCAN_RX_INACTIVE = 0x0, FLEXCAN_RX_FULL = 0x2, FLEXCAN_RX_EMPTY = 0x4, FLEXCAN_RX_OVERRUN = 0x6,
  FLEXCAN_RX_BUSY = 0x8, FLEXCAN_RX_RANSWER = 0xA, FLEXCAN_RX_NOT_USED = 0xF
}
 FlexCAN message buffer CODE for Rx buffers. More...
 
enum  {
  FLEXCAN_TX_INACTIVE = 0x08, FLEXCAN_TX_ABORT = 0x09, FLEXCAN_TX_DATA = 0x0C, FLEXCAN_TX_REMOTE = 0x1C,
  FLEXCAN_TX_TANSWER = 0x0E, FLEXCAN_TX_NOT_USED = 0xF
}
 FlexCAN message buffer CODE FOR Tx buffers. More...
 
enum  {
  FLEXCAN_MB_STATUS_TYPE_TX, FLEXCAN_MB_STATUS_TYPE_TX_REMOTE, FLEXCAN_MB_STATUS_TYPE_RX, FLEXCAN_MB_STATUS_TYPE_RX_REMOTE,
  FLEXCAN_MB_STATUS_TYPE_RX_TX_REMOTE
}
 FlexCAN message buffer transmission types. More...
 
enum  flexcan_fd_payload_size_t { FLEXCAN_PAYLOAD_SIZE_8 = 0, FLEXCAN_PAYLOAD_SIZE_16, FLEXCAN_PAYLOAD_SIZE_32, FLEXCAN_PAYLOAD_SIZE_64 }
 FlexCAN payload sizes Implements : flexcan_fd_payload_size_t_Class. More...
 
enum  flexcan_rx_fifo_id_element_format_t { FLEXCAN_RX_FIFO_ID_FORMAT_A, FLEXCAN_RX_FIFO_ID_FORMAT_B, FLEXCAN_RX_FIFO_ID_FORMAT_C, FLEXCAN_RX_FIFO_ID_FORMAT_D }
 ID formats for RxFIFO Implements : flexcan_rx_fifo_id_element_format_t_Class. More...
 
enum  flexcan_rx_mask_type_t { FLEXCAN_RX_MASK_GLOBAL, FLEXCAN_RX_MASK_INDIVIDUAL }
 FlexCAN RX mask type. Implements : flexcan_rx_mask_type_t_Class. More...
 
enum  flexcan_msgbuff_id_type_t { FLEXCAN_MSG_ID_STD, FLEXCAN_MSG_ID_EXT }
 FlexCAN Message Buffer ID type Implements : flexcan_msgbuff_id_type_t_Class. More...
 
enum  flexcan_clk_source_t { FLEXCAN_CLK_SOURCE_SOSCDIV2, FLEXCAN_CLK_SOURCE_SYS }
 FlexCAN clock source Implements : flexcan_clk_source_t_Class. More...
 
enum  flexcan_int_type_t { FLEXCAN_INT_RX_WARNING = CAN_CTRL1_RWRNMSK_MASK, FLEXCAN_INT_TX_WARNING = CAN_CTRL1_TWRNMSK_MASK, FLEXCAN_INT_ERR = CAN_CTRL1_ERRMSK_MASK, FLEXCAN_INT_BUSOFF = CAN_CTRL1_BOFFMSK_MASK }
 FlexCAN error interrupt types Implements : flexcan_int_type_t_Class. More...
 
enum  flexcan_pn_filter_combination_t { FLEXCAN_FILTER_ID, FLEXCAN_FILTER_ID_PAYLOAD, FLEXCAN_FILTER_ID_NTIMES, FLEXCAN_FILTER_ID_PAYLOAD_NTIMES }
 Pretended Networking filtering combinations. More...
 
enum  flexcan_pn_filter_selection_t { FLEXCAN_FILTER_MATCH_EXACT, FLEXCAN_FILTER_MATCH_GEQ, FLEXCAN_FILTER_MATCH_LEQ, FLEXCAN_FILTER_MATCH_RANGE }
 Pretended Networking matching schemes. More...
 

Configuration

void FLEXCAN_HAL_Enable (CAN_Type *base)
 Enables FlexCAN controller. More...
 
void FLEXCAN_HAL_Disable (CAN_Type *base)
 Disables FlexCAN controller. More...
 
void FLEXCAN_HAL_SelectClock (CAN_Type *base, flexcan_clk_source_t clk)
 Selects the clock source for FlexCAN. More...
 
static bool FLEXCAN_HAL_GetClock (const CAN_Type *base)
 Reads the clock source for FlexCAN Protocol Engine (PE). More...
 
void FLEXCAN_HAL_Init (CAN_Type *base)
 Initializes the FlexCAN controller. More...
 
void FLEXCAN_HAL_SetTimeSegments (CAN_Type *base, const flexcan_time_segment_t *timeSeg)
 Sets the FlexCAN time segments for setting up bit rate. More...
 
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. More...
 
void FLEXCAN_HAL_GetTimeSegments (const CAN_Type *base, flexcan_time_segment_t *timeSeg)
 Gets the FlexCAN time segments to calculate the bit rate. More...
 
void FLEXCAN_HAL_ExitFreezeMode (CAN_Type *base)
 Un freezes the FlexCAN module. More...
 
void FLEXCAN_HAL_EnterFreezeMode (CAN_Type *base)
 Freezes the FlexCAN module. More...
 
void FLEXCAN_HAL_SetOperationMode (CAN_Type *base, flexcan_operation_modes_t mode)
 Set operation mode. More...
 
void FLEXCAN_HAL_ExitOperationMode (CAN_Type *base, flexcan_operation_modes_t mode)
 Exit operation mode. More...
 
void FLEXCAN_HAL_SetFDEnabled (CAN_Type *base, bool enable)
 Enables/Disables Flexible Data rate (if supported). More...
 
bool FLEXCAN_HAL_IsFDEnabled (const CAN_Type *base)
 Checks if the Flexible Data rate feature is enabled. More...
 
void FLEXCAN_HAL_SetPayloadSize (CAN_Type *base, flexcan_fd_payload_size_t payloadSize)
 Sets the payload size of the MBs. More...
 
uint8_t FLEXCAN_HAL_GetPayloadSize (const CAN_Type *base)
 Gets the payload size of the MBs. More...
 

Data transfer

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. More...
 
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. More...
 
status_t FLEXCAN_HAL_GetMsgBuff (CAN_Type *base, uint32_t msgBuffIdx, flexcan_msgbuff_t *msgBuff)
 Gets the FlexCAN message buffer fields. More...
 
status_t FLEXCAN_HAL_LockRxMsgBuff (CAN_Type *base, uint32_t msgBuffIdx)
 Locks the FlexCAN Rx message buffer. More...
 
static void FLEXCAN_HAL_UnlockRxMsgBuff (const CAN_Type *base)
 Unlocks the FlexCAN Rx message buffer. More...
 
status_t FLEXCAN_HAL_EnableRxFifo (CAN_Type *base, uint32_t numOfFilters)
 Enables the Rx FIFO. More...
 
void FLEXCAN_HAL_DisableRxFifo (CAN_Type *base)
 Disables the Rx FIFO. More...
 
static bool FLEXCAN_HAL_IsRxFifoEnabled (const CAN_Type *base)
 Checks if Rx FIFO is enabled. More...
 
void FLEXCAN_HAL_SetRxFifoFilterNum (CAN_Type *base, uint32_t number)
 Sets the number of the Rx FIFO filters. More...
 
status_t FLEXCAN_HAL_SetMaxMsgBuffNum (CAN_Type *base, uint32_t maxMsgBuffNum)
 Sets the maximum number of Message Buffers. More...
 
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. More...
 
void FLEXCAN_HAL_ReadRxFifo (const CAN_Type *base, flexcan_msgbuff_t *rxFifo)
 Gets the FlexCAN Rx FIFO data. More...
 

Interrupts

status_t FLEXCAN_HAL_SetMsgBuffIntCmd (CAN_Type *base, uint32_t msgBuffIdx, bool enable)
 Enables/Disables the FlexCAN Message Buffer interrupt. More...
 
void FLEXCAN_HAL_SetErrIntCmd (CAN_Type *base, flexcan_int_type_t errType, bool enable)
 Enables error interrupt of the FlexCAN module. More...
 

Status

static uint32_t FLEXCAN_HAL_GetFreezeAck (const CAN_Type *base)
 Gets the value of FlexCAN freeze ACK. More...
 
uint8_t FLEXCAN_HAL_GetMsgBuffIntStatusFlag (const CAN_Type *base, uint32_t msgBuffIdx)
 Gets the individual FlexCAN MB interrupt flag. More...
 
static uint32_t FLEXCAN_HAL_GetAllMsgBuffIntStatusFlag (const CAN_Type *base)
 Gets all FlexCAN Message Buffer interrupt flags. More...
 
static void FLEXCAN_HAL_ClearMsgBuffIntStatusFlag (CAN_Type *base, uint32_t flag)
 Clears the interrupt flag of the message buffers. More...
 
void FLEXCAN_HAL_GetErrCounter (const CAN_Type *base, flexcan_buserr_counter_t *errCount)
 Gets the transmit error counter and receives the error counter. More...
 
static uint32_t FLEXCAN_HAL_GetErrStatus (const CAN_Type *base)
 Gets error and status. More...
 
void FLEXCAN_HAL_ClearErrIntStatusFlag (CAN_Type *base)
 Clears all other interrupts in ERRSTAT register (Error, Busoff, Wakeup). More...
 

Mask

void FLEXCAN_HAL_SetRxMaskType (CAN_Type *base, flexcan_rx_mask_type_t type)
 Sets the Rx masking type. More...
 
void FLEXCAN_HAL_SetRxFifoGlobalStdMask (CAN_Type *base, uint32_t stdMask)
 Sets the FlexCAN RX FIFO global standard mask. More...
 
void FLEXCAN_HAL_SetRxFifoGlobalExtMask (CAN_Type *base, uint32_t extMask)
 Sets the FlexCAN Rx FIFO global extended mask. More...
 
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. More...
 
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 FIFO. More...
 
void FLEXCAN_HAL_SetRxMsgBuffGlobalStdMask (CAN_Type *base, uint32_t stdMask)
 Sets the FlexCAN Rx Message Buffer global standard mask. More...
 
void FLEXCAN_HAL_SetRxMsgBuff14StdMask (CAN_Type *base, uint32_t stdMask)
 Sets the FlexCAN RX Message Buffer BUF14 standard mask. More...
 
void FLEXCAN_HAL_SetRxMsgBuff15StdMask (CAN_Type *base, uint32_t stdMask)
 Sets the FlexCAN Rx Message Buffer BUF15 standard mask. More...
 
void FLEXCAN_HAL_SetRxMsgBuffGlobalExtMask (CAN_Type *base, uint32_t extMask)
 Sets the FlexCAN RX Message Buffer global extended mask. More...
 
void FLEXCAN_HAL_SetRxMsgBuff14ExtMask (CAN_Type *base, uint32_t extMask)
 Sets the FlexCAN RX Message Buffer BUF14 extended mask. More...
 
void FLEXCAN_HAL_SetRxMsgBuff15ExtMask (CAN_Type *base, uint32_t extMask)
 Sets the FlexCAN RX MB BUF15 extended mask. More...
 
static uint32_t FLEXCAN_HAL_GetRxFifoHitIdAcceptanceFilter (const CAN_Type *base)
 Gets the FlexCAN ID acceptance filter hit indicator on Rx FIFO. More...
 
void FLEXCAN_HAL_SetStuffBitCount (CAN_Type *base, bool enable)
 Enables/Disables the Stuff Bit Count for CAN FD frames. More...
 
void FLEXCAN_HAL_SetSelfReception (CAN_Type *base, bool enable)
 Enables/Disables the Self Reception feature. More...
 
status_t FLEXCAN_HAL_SetRxFifoDMA (CAN_Type *base, bool enable)
 Enables/Disables the DMA support for RxFIFO. More...
 
void FLEXCAN_HAL_SetTDCOffset (CAN_Type *base, bool enable, uint8_t offset)
 Enables/Disables the Transceiver Delay Compensation feature and sets the Transceiver Delay Compensation Offset (offset value to be added to the measured transceiver's loop delay in order to define the position of the delayed comparison point when bit rate switching is active). More...
 
static uint8_t FLEXCAN_HAL_GetTDCValue (const CAN_Type *base)
 Gets the value of the Transceiver Delay Compensation. More...
 
static bool FLEXCAN_HAL_GetTDCFail (const CAN_Type *base)
 Gets the value of the TDC Fail flag. More...
 
static void FLEXCAN_HAL_ClearTDCFail (CAN_Type *base)
 Clears the TDC Fail flag. More...
 
void FLEXCAN_HAL_ConfigPN (CAN_Type *base, const flexcan_pn_config_t *pnConfig)
 Configures the Pretended Networking mode. More...
 
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. More...
 
static void FLEXCAN_HAL_SetPN (CAN_Type *base, bool enable)
 Enables/Disables the Pretended Networking mode. More...
 

Macro Definition Documentation

#define CAN_CS_CODE_MASK   0xF000000u

Definition at line 291 of file flexcan_hal.h.

#define CAN_CS_CODE_SHIFT   24

Definition at line 292 of file flexcan_hal.h.

#define CAN_CS_CODE_WIDTH   4

Definition at line 293 of file flexcan_hal.h.

#define CAN_CS_DLC_MASK   0xF0000u

Definition at line 275 of file flexcan_hal.h.

#define CAN_CS_DLC_SHIFT   16

Definition at line 276 of file flexcan_hal.h.

#define CAN_CS_DLC_WIDTH   4

Definition at line 277 of file flexcan_hal.h.

#define CAN_CS_IDE_MASK   0x200000u

Definition at line 283 of file flexcan_hal.h.

#define CAN_CS_IDE_SHIFT   21

Definition at line 284 of file flexcan_hal.h.

#define CAN_CS_IDE_WIDTH   1

Definition at line 285 of file flexcan_hal.h.

#define CAN_CS_RTR_MASK   0x100000u

Definition at line 279 of file flexcan_hal.h.

#define CAN_CS_RTR_SHIFT   20

Definition at line 280 of file flexcan_hal.h.

#define CAN_CS_RTR_WIDTH   1

Definition at line 281 of file flexcan_hal.h.

#define CAN_CS_SRR_MASK   0x400000u

Definition at line 287 of file flexcan_hal.h.

#define CAN_CS_SRR_SHIFT   22

Definition at line 288 of file flexcan_hal.h.

#define CAN_CS_SRR_WIDTH   1

Definition at line 289 of file flexcan_hal.h.

#define CAN_CS_TIME_STAMP_MASK   0xFFFFu

Definition at line 271 of file flexcan_hal.h.

#define CAN_CS_TIME_STAMP_SHIFT   0

Definition at line 272 of file flexcan_hal.h.

#define CAN_CS_TIME_STAMP_WIDTH   16

Definition at line 273 of file flexcan_hal.h.

#define CAN_ID_EXT_MASK   0x3FFFFu

Definition at line 259 of file flexcan_hal.h.

#define CAN_ID_EXT_SHIFT   0

Definition at line 260 of file flexcan_hal.h.

#define CAN_ID_EXT_WIDTH   18

Definition at line 261 of file flexcan_hal.h.

#define CAN_ID_PRIO_MASK   0xE0000000u

Definition at line 267 of file flexcan_hal.h.

#define CAN_ID_PRIO_SHIFT   29

Definition at line 268 of file flexcan_hal.h.

#define CAN_ID_PRIO_WIDTH   3

Definition at line 269 of file flexcan_hal.h.

#define CAN_ID_STD_MASK   0x1FFC0000u

Definition at line 263 of file flexcan_hal.h.

#define CAN_ID_STD_SHIFT   18

Definition at line 264 of file flexcan_hal.h.

#define CAN_ID_STD_WIDTH   11

Definition at line 265 of file flexcan_hal.h.

#define CAN_MB_BRS_MASK   0x40000000u

Definition at line 296 of file flexcan_hal.h.

#define CAN_MB_EDL_MASK   0x80000000u

Definition at line 295 of file flexcan_hal.h.

Enumeration Type Documentation

anonymous enum

FlexCAN message buffer CODE for Rx buffers.

Enumerator
FLEXCAN_RX_INACTIVE 

MB is not active.

FLEXCAN_RX_FULL 

MB is full.

FLEXCAN_RX_EMPTY 

MB is active and empty.

FLEXCAN_RX_OVERRUN 

MB is overwritten into a full buffer.

FLEXCAN_RX_BUSY 

FlexCAN is updating the contents of the MB.

FLEXCAN_RX_RANSWER 

The CPU must not access the MB. A frame was configured to recognize a Remote Request Frame

FLEXCAN_RX_NOT_USED 

and transmit a Response Frame in return. Not used

Definition at line 63 of file flexcan_hal.h.

anonymous enum

FlexCAN message buffer CODE FOR Tx buffers.

Enumerator
FLEXCAN_TX_INACTIVE 

MB is not active.

FLEXCAN_TX_ABORT 

MB is aborted.

FLEXCAN_TX_DATA 

MB is a TX Data Frame(MB RTR must be 0).

FLEXCAN_TX_REMOTE 

MB is a TX Remote Request Frame (MB RTR must be 1).

FLEXCAN_TX_TANSWER 

MB is a TX Response Request Frame from.

FLEXCAN_TX_NOT_USED 

an incoming Remote Request Frame. Not used

Definition at line 76 of file flexcan_hal.h.

anonymous enum

FlexCAN message buffer transmission types.

Enumerator
FLEXCAN_MB_STATUS_TYPE_TX 

Transmit MB

FLEXCAN_MB_STATUS_TYPE_TX_REMOTE 

Transmit remote request MB

FLEXCAN_MB_STATUS_TYPE_RX 

Receive MB

FLEXCAN_MB_STATUS_TYPE_RX_REMOTE 

Receive remote request MB

FLEXCAN_MB_STATUS_TYPE_RX_TX_REMOTE 

FlexCAN remote frame receives remote request and

transmits MB.

Definition at line 87 of file flexcan_hal.h.

FlexCAN clock source Implements : flexcan_clk_source_t_Class.

Enumerator
FLEXCAN_CLK_SOURCE_SOSCDIV2 

Clock divider 2 for System OSC

FLEXCAN_CLK_SOURCE_SYS 

Sys clock

Definition at line 148 of file flexcan_hal.h.

FlexCAN payload sizes Implements : flexcan_fd_payload_size_t_Class.

Enumerator
FLEXCAN_PAYLOAD_SIZE_8 

FlexCAN message buffer payload size in bytes

FLEXCAN_PAYLOAD_SIZE_16 

FlexCAN message buffer payload size in bytes

FLEXCAN_PAYLOAD_SIZE_32 

FlexCAN message buffer payload size in bytes

FLEXCAN_PAYLOAD_SIZE_64 

FlexCAN message buffer payload size in bytes

Definition at line 99 of file flexcan_hal.h.

FlexCAN error interrupt types Implements : flexcan_int_type_t_Class.

Enumerator
FLEXCAN_INT_RX_WARNING 

RX warning interrupt

FLEXCAN_INT_TX_WARNING 

TX warning interrupt

FLEXCAN_INT_ERR 

Error interrupt

FLEXCAN_INT_BUSOFF 

Bus off interrupt

Definition at line 157 of file flexcan_hal.h.

FlexCAN Message Buffer ID type Implements : flexcan_msgbuff_id_type_t_Class.

Enumerator
FLEXCAN_MSG_ID_STD 

Standard ID

FLEXCAN_MSG_ID_EXT 

Extended ID

Definition at line 139 of file flexcan_hal.h.

FlexCAN operation modes Implements : flexcan_operation_modes_t_Class.

Enumerator
FLEXCAN_NORMAL_MODE 

Normal mode or user mode

FLEXCAN_LISTEN_ONLY_MODE 

Listen-only mode

FLEXCAN_LOOPBACK_MODE 

Loop-back mode

FLEXCAN_FREEZE_MODE 

Freeze mode

FLEXCAN_DISABLE_MODE 

Module disable mode

Definition at line 54 of file flexcan_hal.h.

Pretended Networking filtering combinations.

Enumerator
FLEXCAN_FILTER_ID 

Message ID filtering only

FLEXCAN_FILTER_ID_PAYLOAD 

Message ID filtering and payload filtering

FLEXCAN_FILTER_ID_NTIMES 

Message ID filtering occurring a specified number of times

FLEXCAN_FILTER_ID_PAYLOAD_NTIMES 

Message ID filtering and payload filtering a specified number of times

Definition at line 225 of file flexcan_hal.h.

Pretended Networking matching schemes.

Enumerator
FLEXCAN_FILTER_MATCH_EXACT 

Match an exact target value.

FLEXCAN_FILTER_MATCH_GEQ 

Match greater than or equal to a specified target value.

FLEXCAN_FILTER_MATCH_LEQ 

Match less than or equal to a specified target value.

FLEXCAN_FILTER_MATCH_RANGE 

Match inside a range, greater than or equal to a specified lower limit and smaller than or equal a specified upper limit.

Definition at line 233 of file flexcan_hal.h.

ID formats for RxFIFO Implements : flexcan_rx_fifo_id_element_format_t_Class.

Enumerator
FLEXCAN_RX_FIFO_ID_FORMAT_A 

One full ID (standard and extended) per ID Filter Table

FLEXCAN_RX_FIFO_ID_FORMAT_B 

element. Two full standard IDs or two partial 14-bit (standard and

FLEXCAN_RX_FIFO_ID_FORMAT_C 

extended) IDs per ID Filter Table element. Four partial 8-bit Standard IDs per ID Filter Table

FLEXCAN_RX_FIFO_ID_FORMAT_D 

element. All frames rejected.

Definition at line 109 of file flexcan_hal.h.

FlexCAN RX mask type. Implements : flexcan_rx_mask_type_t_Class.

Enumerator
FLEXCAN_RX_MASK_GLOBAL 

Rx global mask

FLEXCAN_RX_MASK_INDIVIDUAL 

Rx individual mask

Definition at line 131 of file flexcan_hal.h.

Function Documentation

void FLEXCAN_HAL_ClearErrIntStatusFlag ( CAN_Type base)

Clears all other interrupts in ERRSTAT register (Error, Busoff, Wakeup).

Parameters
baseThe FlexCAN base address

Definition at line 1337 of file flexcan_hal.c.

static void FLEXCAN_HAL_ClearMsgBuffIntStatusFlag ( CAN_Type base,
uint32_t  flag 
)
inlinestatic

Clears the interrupt flag of the message buffers.

Parameters
baseThe FlexCAN base address
flagThe value to be written to the interrupt flag1 register. Implements : FLEXCAN_HAL_ClearMsgBuffIntStatusFlag_Activity

Definition at line 686 of file flexcan_hal.h.

static void FLEXCAN_HAL_ClearTDCFail ( CAN_Type base)
inlinestatic

Clears the TDC Fail flag.

Parameters
baseThe FlexCAN base address Implements : FLEXCAN_HAL_ClearTDCFail_Activity

Definition at line 942 of file flexcan_hal.h.

void FLEXCAN_HAL_ConfigPN ( CAN_Type base,
const flexcan_pn_config_t pnConfig 
)

Configures the Pretended Networking mode.

Parameters
baseThe FlexCAN base address
pnConfigThe pretended networking configuration
void FLEXCAN_HAL_Disable ( CAN_Type base)

Disables FlexCAN controller.

Parameters
baseThe FlexCAN base address

Definition at line 408 of file flexcan_hal.c.

void FLEXCAN_HAL_DisableRxFifo ( CAN_Type base)

Disables the Rx FIFO.

Parameters
baseThe FlexCAN base address

Definition at line 991 of file flexcan_hal.c.

void FLEXCAN_HAL_Enable ( CAN_Type base)

Enables FlexCAN controller.

Parameters
baseThe FlexCAN base address

Definition at line 386 of file flexcan_hal.c.

status_t FLEXCAN_HAL_EnableRxFifo ( CAN_Type base,
uint32_t  numOfFilters 
)

Enables the Rx FIFO.

Parameters
baseThe FlexCAN base address
numOfFiltersThe number of Rx FIFO filters
Returns
The status of the operation
Return values
STATUS_SUCCESSRxFIFO was successfully enabled
STATUS_ERRORRxFIFO could not be enabled (e.g. the FD feature was enabled, and these two features are not compatible)

Definition at line 947 of file flexcan_hal.c.

void FLEXCAN_HAL_EnterFreezeMode ( CAN_Type base)

Freezes the FlexCAN module.

Parameters
baseThe FlexCAN base address

Definition at line 1288 of file flexcan_hal.c.

void FLEXCAN_HAL_ExitFreezeMode ( CAN_Type base)

Un freezes the FlexCAN module.

Parameters
baseThe FlexCAN base address

Definition at line 1272 of file flexcan_hal.c.

void FLEXCAN_HAL_ExitOperationMode ( CAN_Type base,
flexcan_operation_modes_t  mode 
)

Exit operation mode.

Parameters
baseThe FlexCAN base address
modeExit An operation mode

Definition at line 1722 of file flexcan_hal.c.

static uint32_t FLEXCAN_HAL_GetAllMsgBuffIntStatusFlag ( const CAN_Type base)
inlinestatic

Gets all FlexCAN Message Buffer interrupt flags.

Parameters
baseThe FlexCAN base address
Returns
all MB interrupt flags Implements : FLEXCAN_HAL_GetAllMsgBuffIntStatusFlag_Activity

Definition at line 672 of file flexcan_hal.h.

static bool FLEXCAN_HAL_GetClock ( const CAN_Type base)
inlinestatic

Reads the clock source for FlexCAN Protocol Engine (PE).

Parameters
baseThe FlexCAN base address
Returns
0: if clock source is oscillator clock, 1: if clock source is peripheral clock Implements : FLEXCAN_HAL_GetClock_Activity

Definition at line 342 of file flexcan_hal.h.

void FLEXCAN_HAL_GetErrCounter ( const CAN_Type base,
flexcan_buserr_counter_t errCount 
)

Gets the transmit error counter and receives the error counter.

Parameters
baseThe FlexCAN base address
errCountTransmit error counter and receive error counter

Definition at line 1319 of file flexcan_hal.c.

static uint32_t FLEXCAN_HAL_GetErrStatus ( const CAN_Type base)
inlinestatic

Gets error and status.

Parameters
baseThe FlexCAN base address
Returns
The current error and status Implements : FLEXCAN_HAL_GetErrStatus_Activity

Definition at line 711 of file flexcan_hal.h.

static uint32_t FLEXCAN_HAL_GetFreezeAck ( const CAN_Type base)
inlinestatic

Gets the value of FlexCAN freeze ACK.

Parameters
baseThe FlexCAN base address
Returns
freeze ACK state (1-freeze mode, 0-not in freeze mode). Implements : FLEXCAN_HAL_GetFreezeAck_Activity

Definition at line 649 of file flexcan_hal.h.

status_t FLEXCAN_HAL_GetMsgBuff ( CAN_Type base,
uint32_t  msgBuffIdx,
flexcan_msgbuff_t msgBuff 
)

Gets the FlexCAN message buffer fields.

Parameters
baseThe FlexCAN base address
msgBuffIdxIndex of the message buffer
msgBuffThe fields of the message buffer
Returns
STATUS_SUCCESS if successful; STATUS_FLEXCAN_MB_OUT_OF_RANGE if the index of the message buffer is invalid

Definition at line 838 of file flexcan_hal.c.

uint8_t FLEXCAN_HAL_GetMsgBuffIntStatusFlag ( const CAN_Type base,
uint32_t  msgBuffIdx 
)

Gets the individual FlexCAN MB interrupt flag.

Parameters
baseThe FlexCAN base address
msgBuffIdxIndex of the message buffer
Returns
the individual Message Buffer interrupt flag (0 and 1 are the flag value)

Definition at line 1304 of file flexcan_hal.c.

uint8_t FLEXCAN_HAL_GetPayloadSize ( const CAN_Type base)

Gets the payload size of the MBs.

Parameters
baseThe FlexCAN base address
Returns
The payload size in bytes

Definition at line 1836 of file flexcan_hal.c.

static uint32_t FLEXCAN_HAL_GetRxFifoHitIdAcceptanceFilter ( const CAN_Type base)
inlinestatic

Gets the FlexCAN ID acceptance filter hit indicator on Rx FIFO.

Parameters
baseThe FlexCAN base address
Returns
RX FIFO information Implements : FLEXCAN_HAL_GetRxFifoHitIdAcceptanceFilter_Activity

Definition at line 855 of file flexcan_hal.h.

static bool FLEXCAN_HAL_GetTDCFail ( const CAN_Type base)
inlinestatic

Gets the value of the TDC Fail flag.

Parameters
baseThe FlexCAN base address
Returns
If true, indicates that the TDC mechanism is out of range, unable to compensate the transceiver's loop delay and successfully compare the delayed received bits to the transmitted ones. Implements : FLEXCAN_HAL_GetTDCFail_Activity

Definition at line 931 of file flexcan_hal.h.

static uint8_t FLEXCAN_HAL_GetTDCValue ( const CAN_Type base)
inlinestatic

Gets the value of the Transceiver Delay Compensation.

Parameters
baseThe FlexCAN base address
Returns
The value of the transceiver loop delay measured from the transmitted EDL to R0 transition edge to the respective received one added to the TDCOFF value specified by FLEXCAN_HAL_SetTDCOffset. Implements : FLEXCAN_HAL_GetTDCValue_Activity

Definition at line 917 of file flexcan_hal.h.

void FLEXCAN_HAL_GetTimeSegments ( const CAN_Type base,
flexcan_time_segment_t timeSeg 
)

Gets the FlexCAN time segments to calculate the bit rate.

Parameters
baseThe FlexCAN base address
timeSegFlexCAN time segments read for bit rate

Definition at line 578 of file flexcan_hal.c.

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.

Parameters
baseThe FlexCAN base address
wmbIndexThe index of the message buffer to be extracted.
wmbPointer to the message buffer structure where the frame will be saved.
void FLEXCAN_HAL_Init ( CAN_Type base)

Initializes the FlexCAN controller.

Parameters
baseThe FlexCAN base address

Definition at line 450 of file flexcan_hal.c.

bool FLEXCAN_HAL_IsFDEnabled ( const CAN_Type base)

Checks if the Flexible Data rate feature is enabled.

Parameters
baseThe FlexCAN base address
Returns
true if enabled; false if disabled

Definition at line 1790 of file flexcan_hal.c.

static bool FLEXCAN_HAL_IsRxFifoEnabled ( const CAN_Type base)
inlinestatic

Checks if Rx FIFO is enabled.

Parameters
baseThe FlexCAN base address
Returns
RxFifo status (true = enabled / false = disabled) Implements : FLEXCAN_HAL_IsRxFifoEnabled_Activity

Definition at line 557 of file flexcan_hal.h.

status_t FLEXCAN_HAL_LockRxMsgBuff ( CAN_Type base,
uint32_t  msgBuffIdx 
)

Locks the FlexCAN Rx message buffer.

Parameters
baseThe FlexCAN base address
msgBuffIdxIndex of the message buffer
Returns
STATUS_SUCCESS if successful; STATUS_FLEXCAN_MB_OUT_OF_RANGE if the index of the message buffer is invalid

Definition at line 918 of file flexcan_hal.c.

void FLEXCAN_HAL_ReadRxFifo ( const CAN_Type base,
flexcan_msgbuff_t rxFifo 
)

Gets the FlexCAN Rx FIFO data.

Parameters
baseThe FlexCAN base address
rxFifoThe FlexCAN receive FIFO data

Definition at line 1358 of file flexcan_hal.c.

void FLEXCAN_HAL_SelectClock ( CAN_Type base,
flexcan_clk_source_t  clk 
)

Selects the clock source for FlexCAN.

Parameters
baseThe FlexCAN base address
clkThe FlexCAN clock source
void FLEXCAN_HAL_SetErrIntCmd ( CAN_Type base,
flexcan_int_type_t  errType,
bool  enable 
)

Enables error interrupt of the FlexCAN module.

Parameters
baseThe FlexCAN base address
errTypeThe interrupt type
enablechoose enable or disable

Definition at line 1247 of file flexcan_hal.c.

void FLEXCAN_HAL_SetFDEnabled ( CAN_Type base,
bool  enable 
)

Enables/Disables Flexible Data rate (if supported).

Parameters
baseThe FlexCAN base address
enabletrue to enable; false to disable

Definition at line 1771 of file flexcan_hal.c.

status_t FLEXCAN_HAL_SetMaxMsgBuffNum ( CAN_Type base,
uint32_t  maxMsgBuffNum 
)

Sets the maximum number of Message Buffers.

Parameters
baseThe FlexCAN base address
maxMsgBuffNumMaximum number of message buffers
Returns
STATUS_SUCCESS if successful; STATUS_FLEXCAN_MB_OUT_OF_RANGE if the index of the message buffer is invalid

Definition at line 1033 of file flexcan_hal.c.

status_t FLEXCAN_HAL_SetMsgBuffIntCmd ( CAN_Type base,
uint32_t  msgBuffIdx,
bool  enable 
)

Enables/Disables the FlexCAN Message Buffer interrupt.

Parameters
baseThe FlexCAN base address
msgBuffIdxIndex of the message buffer
enablechoose enable or disable
Returns
STATUS_SUCCESS if successful; STATUS_FLEXCAN_MB_OUT_OF_RANGE if the index of the message buffer is invalid

Definition at line 1210 of file flexcan_hal.c.

void FLEXCAN_HAL_SetOperationMode ( CAN_Type base,
flexcan_operation_modes_t  mode 
)

Set operation mode.

Parameters
baseThe FlexCAN base address
modeSet an operation mode

Definition at line 1671 of file flexcan_hal.c.

void FLEXCAN_HAL_SetPayloadSize ( CAN_Type base,
flexcan_fd_payload_size_t  payloadSize 
)

Sets the payload size of the MBs.

Parameters
baseThe FlexCAN base address
payloadSizeThe payload size

Definition at line 1802 of file flexcan_hal.c.

static void FLEXCAN_HAL_SetPN ( CAN_Type base,
bool  enable 
)
inlinestatic

Enables/Disables the Pretended Networking mode.

Parameters
baseThe FlexCAN base address
enableEnable/Disable Pretending Networking Implements : FLEXCAN_HAL_SetPN_Activity

Definition at line 973 of file flexcan_hal.h.

status_t FLEXCAN_HAL_SetRxFifoDMA ( CAN_Type base,
bool  enable 
)

Enables/Disables the DMA support for RxFIFO.

Parameters
baseThe FlexCAN base address
enableEnable/Disable DMA support
Returns
STATUS_SUCCESS if successfully enabled; STATUS_ERROR if not enabled (due to the RxFIFO feature being disabled).
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.

Parameters
baseThe FlexCAN base address
idFormatThe format of the Rx FIFO ID Filter Table Elements
idFilterTableThe ID filter table elements which contain RTR bit, IDE bit, and RX message ID.

Definition at line 1090 of file flexcan_hal.c.

void FLEXCAN_HAL_SetRxFifoFilterNum ( CAN_Type base,
uint32_t  number 
)

Sets the number of the Rx FIFO filters.

Parameters
baseThe FlexCAN base address
numberThe number of Rx FIFO filters

Definition at line 1011 of file flexcan_hal.c.

void FLEXCAN_HAL_SetRxFifoGlobalExtMask ( CAN_Type base,
uint32_t  extMask 
)

Sets the FlexCAN Rx FIFO global extended mask.

Parameters
baseThe FlexCAN base address
extMaskExtended mask

Definition at line 1455 of file flexcan_hal.c.

void FLEXCAN_HAL_SetRxFifoGlobalStdMask ( CAN_Type base,
uint32_t  stdMask 
)

Sets the FlexCAN RX FIFO global standard mask.

Parameters
baseThe FlexCAN base address
stdMaskStandard mask

Definition at line 1434 of file flexcan_hal.c.

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

Parameters
baseThe FlexCAN base address
msgBuffIdxIndex of the message buffer
extMaskIndividual extended mask
Returns
STATUS_SUCCESS if successful; STATUS_FLEXCAN_MB_OUT_OF_RANGE if the index of the message buffer is invalid

Definition at line 1510 of file flexcan_hal.c.

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.

Parameters
baseThe FlexCAN base address
msgBuffIdxIndex of the message buffer
stdMaskIndividual standard mask
Returns
STATUS_SUCCESS if successful; STATUS_FLEXCAN_MB_OUT_OF_RANGE if the index of the message buffer is invalid

Definition at line 1476 of file flexcan_hal.c.

void FLEXCAN_HAL_SetRxMaskType ( CAN_Type base,
flexcan_rx_mask_type_t  type 
)

Sets the Rx masking type.

Parameters
baseThe FlexCAN base address
typeThe FlexCAN Rx mask type

Definition at line 1404 of file flexcan_hal.c.

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.

Parameters
baseThe FlexCAN base address
msgBuffIdxIndex of the message buffer
csCODE/status values (RX)
msgIdID of the message to receive
Returns
STATUS_SUCCESS if successful; STATUS_FLEXCAN_MB_OUT_OF_RANGE if the index of the message buffer is invalid

Definition at line 752 of file flexcan_hal.c.

void FLEXCAN_HAL_SetRxMsgBuff14ExtMask ( CAN_Type base,
uint32_t  extMask 
)

Sets the FlexCAN RX Message Buffer BUF14 extended mask.

Parameters
baseThe FlexCAN base address
extMaskExtended mask

Definition at line 1628 of file flexcan_hal.c.

void FLEXCAN_HAL_SetRxMsgBuff14StdMask ( CAN_Type base,
uint32_t  stdMask 
)

Sets the FlexCAN RX Message Buffer BUF14 standard mask.

Parameters
baseThe FlexCAN base address
stdMaskStandard mask

Definition at line 1565 of file flexcan_hal.c.

void FLEXCAN_HAL_SetRxMsgBuff15ExtMask ( CAN_Type base,
uint32_t  extMask 
)

Sets the FlexCAN RX MB BUF15 extended mask.

Parameters
baseThe FlexCAN base address
extMaskExtended mask

Definition at line 1649 of file flexcan_hal.c.

void FLEXCAN_HAL_SetRxMsgBuff15StdMask ( CAN_Type base,
uint32_t  stdMask 
)

Sets the FlexCAN Rx Message Buffer BUF15 standard mask.

Parameters
baseThe FlexCAN base address
stdMaskStandard mask

Definition at line 1586 of file flexcan_hal.c.

void FLEXCAN_HAL_SetRxMsgBuffGlobalExtMask ( CAN_Type base,
uint32_t  extMask 
)

Sets the FlexCAN RX Message Buffer global extended mask.

Parameters
baseThe FlexCAN base address
extMaskExtended mask

Definition at line 1607 of file flexcan_hal.c.

void FLEXCAN_HAL_SetRxMsgBuffGlobalStdMask ( CAN_Type base,
uint32_t  stdMask 
)

Sets the FlexCAN Rx Message Buffer global standard mask.

Parameters
baseThe FlexCAN base address
stdMaskStandard mask

Definition at line 1543 of file flexcan_hal.c.

void FLEXCAN_HAL_SetSelfReception ( CAN_Type base,
bool  enable 
)

Enables/Disables the Self Reception feature.

If enabled, FlexCAN is allowed to receive frames transmitted by itself.

Parameters
baseThe FlexCAN base address
enableEnable/Disable Self Reception

Definition at line 1882 of file flexcan_hal.c.

void FLEXCAN_HAL_SetStuffBitCount ( CAN_Type base,
bool  enable 
)

Enables/Disables the Stuff Bit Count for CAN FD frames.

If enabled, the modulo 8 count of variable stuff bits inserted plus the respective parity bit (even parity calculated over the 3-bit modulo 8 count) are combined as the 4-bit Stuff Count field and inserted before the CRC Sequence field. CRC calculation extends beyond the end of Data field and takes the Stuff Count field bits into account.

Parameters
baseThe FlexCAN base address
enableEnable/Disable Stuff Bit Count

Definition at line 1861 of file flexcan_hal.c.

void FLEXCAN_HAL_SetTDCOffset ( CAN_Type base,
bool  enable,
uint8_t  offset 
)

Enables/Disables the Transceiver Delay Compensation feature and sets the Transceiver Delay Compensation Offset (offset value to be added to the measured transceiver's loop delay in order to define the position of the delayed comparison point when bit rate switching is active).

Parameters
baseThe FlexCAN base address
enableEnable/Disable Transceiver Delay Compensation
offsetTransceiver Delay Compensation Offset

Definition at line 1925 of file flexcan_hal.c.

void FLEXCAN_HAL_SetTimeSegments ( CAN_Type base,
const flexcan_time_segment_t timeSeg 
)

Sets the FlexCAN time segments for setting up bit rate.

Parameters
baseThe FlexCAN base address
timeSegFlexCAN time segments, which need to be set for the bit rate.

Definition at line 493 of file flexcan_hal.c.

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.

Parameters
baseThe FlexCAN base address
timeSegFlexCAN time segments, which need to be set for the bit rate.

Definition at line 547 of file flexcan_hal.c.

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.

Parameters
baseThe FlexCAN base address
msgBuffIdxIndex of the message buffer
csCODE/status values (TX)
msgIdID of the message to transmit
msgDataBytes of the FlexCAN message
Returns
STATUS_SUCCESS if successful; STATUS_FLEXCAN_MB_OUT_OF_RANGE if the index of the message buffer is invalid

Definition at line 603 of file flexcan_hal.c.

static void FLEXCAN_HAL_UnlockRxMsgBuff ( const CAN_Type base)
inlinestatic

Unlocks the FlexCAN Rx message buffer.

Parameters
baseThe FlexCAN base address Implements : FLEXCAN_HAL_UnlockRxMsgBuff_Activity

Definition at line 525 of file flexcan_hal.h.