Kinetis SDK v.1.2 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages

Overview

This section describes the programming interface of the FlexCAN HAL driver.

Data Structures

struct  flexcan_id_table_t
 FlexCAN RX FIFO ID filter table structure. More...
 
struct  flexcan_buserr_counter_t
 FlexCAN bus error counters. More...
 
struct  flexcan_msgbuff_code_status_t
 FlexCAN Message Buffer code and status for transmit and receive. More...
 
struct  flexcan_msgbuff_t
 FlexCAN message buffer structure. More...
 
struct  flexcan_time_segment_t
 FlexCAN timing related structures. More...
 

Macros

#define RxFifoOcuppiedFirstMsgBuff   6U
 
#define RxFifoOcuppiedLastMsgBuff(x)   (5 + (x + 1) * 8 / 4)
 
#define RxFifoFilterElementNum(x)   ((x + 1) * 8)
 
#define FlexCanRxFifoAcceptRemoteFrame   1U
 
#define FlexCanRxFifoAcceptExtFrame   1U
 

Enumerations

enum  _flexcan_constants { kFlexCanMessageSize = 8 }
 FlexCAN constants. More...
 
enum  _flexcan_err_status {
  kFlexCanRxWrn = 0x0080U,
  kFlexCanTxWrn = 0x0100U,
  kFlexCanStfErr = 0x0200U,
  kFlexCanFrmErr = 0x0400U,
  kFlexCanCrcErr = 0x0800U,
  kFlexCanAckErr = 0x1000U,
  kFlexCanBit0Err = 0x2000U,
  kFlexCanBit1Err = 0x4000U
}
 The Status enum is used to report current status of the FlexCAN interface. More...
 
enum  flexcan_status_t {
  kStatus_FLEXCAN_Success = 0,
  kStatus_FLEXCAN_OutOfRange,
  kStatus_FLEXCAN_UnknownProperty,
  kStatus_FLEXCAN_InvalidArgument,
  kStatus_FLEXCAN_Fail,
  kStatus_FLEXCAN_TimeOut,
  kStatus_FLEXCAN_TxBusy,
  kStatus_FLEXCAN_RxBusy,
  kStatus_FLEXCAN_NoTransmitInProgress,
  kStatus_FLEXCAN_NoReceiveInProgress
}
 FlexCAN status return codes.
 
enum  flexcan_operation_modes_t {
  kFlexCanNormalMode,
  kFlexCanListenOnlyMode,
  kFlexCanLoopBackMode,
  kFlexCanFreezeMode,
  kFlexCanDisableMode
}
 FlexCAN operation modes. More...
 
enum  flexcan_msgbuff_code_rx_t {
  kFlexCanRXInactive = 0x0,
  kFlexCanRXFull = 0x2,
  kFlexCanRXEmpty = 0x4,
  kFlexCanRXOverrun = 0x6,
  kFlexCanRXBusy = 0x8,
  kFlexCanRXRanswer = 0xA,
  kFlexCanRXNotUsed = 0xF
}
 FlexCAN message buffer CODE for Rx buffers. More...
 
enum  flexcan_msgbuff_code_tx_t {
  kFlexCanTXInactive = 0x08,
  kFlexCanTXAbort = 0x09,
  kFlexCanTXData = 0x0C,
  kFlexCanTXRemote = 0x1C,
  kFlexCanTXTanswer = 0x0E,
  kFlexCanTXNotUsed = 0xF
}
 FlexCAN message buffer CODE FOR Tx buffers. More...
 
enum  flexcan_msgbuff_transmission_type_t {
  kFlexCanMBStatusTypeTX,
  kFlexCanMBStatusTypeTXRemote,
  kFlexCanMBStatusTypeRX,
  kFlexCanMBStatusTypeRXRemote,
  kFlexCanMBStatusTypeRXTXRemote
}
 FlexCAN message buffer transmission types. More...
 
enum  flexcan_rx_fifo_id_element_format_t {
  kFlexCanRxFifoIdElementFormatA,
  kFlexCanRxFifoIdElementFormatB,
  kFlexCanRxFifoIdElementFormatC,
  kFlexCanRxFifoIdElementFormatD
}
 
enum  flexcan_rx_fifo_id_filter_num_t {
  kFlexCanRxFifoIDFilters_8 = 0x0,
  kFlexCanRxFifoIDFilters_16 = 0x1,
  kFlexCanRxFifoIDFilters_24 = 0x2,
  kFlexCanRxFifoIDFilters_32 = 0x3,
  kFlexCanRxFifoIDFilters_40 = 0x4,
  kFlexCanRxFifoIDFilters_48 = 0x5,
  kFlexCanRxFifoIDFilters_56 = 0x6,
  kFlexCanRxFifoIDFilters_64 = 0x7,
  kFlexCanRxFifoIDFilters_72 = 0x8,
  kFlexCanRxFifoIDFilters_80 = 0x9,
  kFlexCanRxFifoIDFilters_88 = 0xA,
  kFlexCanRxFifoIDFilters_96 = 0xB,
  kFlexCanRxFifoIDFilters_104 = 0xC,
  kFlexCanRxFifoIDFilters_112 = 0xD,
  kFlexCanRxFifoIDFilters_120 = 0xE,
  kFlexCanRxFifoIDFilters_128 = 0xF
}
 FlexCAN Rx FIFO filters number. More...
 
enum  flexcan_rx_mask_type_t {
  kFlexCanRxMaskGlobal,
  kFlexCanRxMaskIndividual
}
 FlexCAN RX mask type. More...
 
enum  flexcan_msgbuff_id_type_t {
  kFlexCanMsgIdStd,
  kFlexCanMsgIdExt
}
 FlexCAN Message Buffer ID type. More...
 
enum  flexcan_clk_source_t {
  kFlexCanClkSourceOsc,
  kFlexCanClkSourceIpbus
}
 FlexCAN clock source. More...
 
enum  flexcan_int_type_t {
  kFlexCanIntRxwarning = CAN_CTRL1_RWRNMSK_MASK,
  kFlexCanIntTxwarning = CAN_CTRL1_TWRNMSK_MASK,
  kFlexCanIntErr = CAN_CTRL1_ERRMSK_MASK,
  kFlexCanIntBusoff = CAN_CTRL1_BOFFMSK_MASK,
  kFlexCanIntWakeup = CAN_MCR_WAKMSK_MASK
}
 FlexCAN error interrupt types. More...
 

Configuration

flexcan_status_t FLEXCAN_HAL_Enable (CAN_Type *base)
 Enables FlexCAN controller. More...
 
flexcan_status_t FLEXCAN_HAL_Disable (CAN_Type *base)
 Disables FlexCAN controller. More...
 
flexcan_status_t FLEXCAN_HAL_SelectClock (CAN_Type *base, flexcan_clk_source_t clk)
 Selects the clock source for FlexCAN. More...
 
static bool FLEXCAN_HAL_GetClock (CAN_Type *base)
 Reads the clock source for FlexCAN Protocol Engine (PE). More...
 
flexcan_status_t FLEXCAN_HAL_Init (CAN_Type *base)
 Initializes the FlexCAN controller. More...
 
void FLEXCAN_HAL_SetTimeSegments (CAN_Type *base, flexcan_time_segment_t *timeSeg)
 Sets the FlexCAN time segments for setting up bit rate. More...
 
void FLEXCAN_HAL_GetTimeSegments (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...
 
flexcan_status_t FLEXCAN_HAL_SetOperationMode (CAN_Type *base, flexcan_operation_modes_t mode)
 Set operation mode. More...
 
flexcan_status_t FLEXCAN_HAL_ExitOperationMode (CAN_Type *base, flexcan_operation_modes_t mode)
 Exit operation mode. More...
 

Data transfer

flexcan_status_t FLEXCAN_HAL_SetTxMsgBuff (CAN_Type *base, uint32_t msgBuffIdx, flexcan_msgbuff_code_status_t *cs, uint32_t msgId, uint8_t *msgData)
 Sets the FlexCAN message buffer fields for transmitting. More...
 
flexcan_status_t FLEXCAN_HAL_SetRxMsgBuff (CAN_Type *base, uint32_t msgBuffIdx, flexcan_msgbuff_code_status_t *cs, uint32_t msgId)
 Sets the FlexCAN message buffer fields for receiving. More...
 
flexcan_status_t FLEXCAN_HAL_GetMsgBuff (CAN_Type *base, uint32_t msgBuffIdx, flexcan_msgbuff_t *msgBuff)
 Gets the FlexCAN message buffer fields. More...
 
flexcan_status_t FLEXCAN_HAL_LockRxMsgBuff (CAN_Type *base, uint32_t msgBuffIdx)
 Locks the FlexCAN Rx message buffer. More...
 
static uint32_t FLEXCAN_HAL_UnlockRxMsgBuff (CAN_Type *base)
 Unlocks the FlexCAN Rx message buffer. More...
 
void 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...
 
void FLEXCAN_HAL_SetRxFifoFilterNum (CAN_Type *base, uint32_t number)
 Sets the number of the Rx FIFO filters. More...
 
void FLEXCAN_HAL_SetMaxMsgBuffNum (CAN_Type *base, uint32_t maxMsgBuffNum)
 Sets the maximum number of Message Buffers. More...
 
flexcan_status_t FLEXCAN_HAL_SetRxFifoFilter (CAN_Type *base, flexcan_rx_fifo_id_element_format_t idFormat, flexcan_id_table_t *idFilterTable)
 Sets the FlexCAN Rx FIFO fields. More...
 
flexcan_status_t FLEXCAN_HAL_ReadRxFifo (CAN_Type *base, flexcan_msgbuff_t *rxFifo)
 Gets the FlexCAN Rx FIFO data. More...
 

Interrupts

flexcan_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 (CAN_Type *base)
 Gets the value of FlexCAN freeze ACK. More...
 
uint8_t FLEXCAN_HAL_GetMsgBuffIntStatusFlag (CAN_Type *base, uint32_t msgBuffIdx)
 Gets the individual FlexCAN MB interrupt flag. More...
 
static uint32_t FLEXCAN_HAL_GetAllMsgBuffIntStatusFlag (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 (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 (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...
 
flexcan_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...
 
flexcan_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 (CAN_Type *base)
 Gets the FlexCAN ID acceptance filter hit indicator on Rx FIFO. More...
 

Data Structure Documentation

struct flexcan_id_table_t

Data Fields

bool isRemoteFrame
 Remote frame.
 
bool isExtendedFrame
 Extended frame.
 
uint32_t * idFilter
 Rx FIFO ID filter elements.
 
struct flexcan_buserr_counter_t

Data Fields

uint16_t txerr
 Transmit error counter.
 
uint16_t rxerr
 Receive error counter.
 
struct flexcan_msgbuff_code_status_t

Data Fields

uint32_t code
 MB code for TX or RX buffers. More...
 
flexcan_msgbuff_id_type_t msgIdType
 Type of message ID (standard or extended)
 
uint32_t dataLen
 Length of Data in Bytes.
 

Field Documentation

uint32_t flexcan_msgbuff_code_status_t::code

Defined by flexcan_mb_code_rx_t and flexcan_mb_code_tx_t

struct flexcan_msgbuff_t

Data Fields

uint32_t cs
 Code and Status.
 
uint32_t msgId
 Message Buffer ID.
 
uint8_t data [kFlexCanMessageSize]
 Bytes of the FlexCAN message.
 
struct flexcan_time_segment_t

Data Fields

uint32_t propSeg
 Propagation segment.
 
uint32_t phaseSeg1
 Phase segment 1.
 
uint32_t phaseSeg2
 Phase segment 2.
 
uint32_t preDivider
 Clock pre divider.
 
uint32_t rJumpwidth
 Resync jump width.
 

Enumeration Type Documentation

Enumerator
kFlexCanMessageSize 

FlexCAN message buffer data size in bytes.

Enumerator
kFlexCanRxWrn 

Reached warning level for RX errors.

kFlexCanTxWrn 

Reached warning level for TX errors.

kFlexCanStfErr 

Stuffing Error.

kFlexCanFrmErr 

Form Error.

kFlexCanCrcErr 

Cyclic Redundancy Check Error.

kFlexCanAckErr 

Received no ACK on transmission.

kFlexCanBit0Err 

Unable to send dominant bit.

kFlexCanBit1Err 

Unable to send recessive bit.

Enumerator
kFlexCanNormalMode 

Normal mode or user mode.

kFlexCanListenOnlyMode 

Listen-only mode.

kFlexCanLoopBackMode 

Loop-back mode.

kFlexCanFreezeMode 

Freeze mode.

kFlexCanDisableMode 

Module disable mode.

Enumerator
kFlexCanRXInactive 

MB is not active.

kFlexCanRXFull 

MB is full.

kFlexCanRXEmpty 

MB is active and empty.

kFlexCanRXOverrun 

MB is overwritten into a full buffer.

kFlexCanRXBusy 

FlexCAN is updating the contents of the MB.

kFlexCanRXRanswer 

The CPU must not access the MB.

A frame was configured to recognize a Remote Request Frame

kFlexCanRXNotUsed 

and transmit a Response Frame in return.

Not used

Enumerator
kFlexCanTXInactive 

MB is not active.

kFlexCanTXAbort 

MB is aborted.

kFlexCanTXData 

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

kFlexCanTXRemote 

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

kFlexCanTXTanswer 

MB is a TX Response Request Frame from.

kFlexCanTXNotUsed 

an incoming Remote Request Frame.

Not used

Enumerator
kFlexCanMBStatusTypeTX 

Transmit MB.

kFlexCanMBStatusTypeTXRemote 

Transmit remote request MB.

kFlexCanMBStatusTypeRX 

Receive MB.

kFlexCanMBStatusTypeRXRemote 

Receive remote request MB.

kFlexCanMBStatusTypeRXTXRemote 

FlexCAN remote frame receives remote request and.

transmits MB.

Enumerator
kFlexCanRxFifoIdElementFormatA 

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

kFlexCanRxFifoIdElementFormatB 

element.

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

kFlexCanRxFifoIdElementFormatC 

extended) IDs per ID Filter Table element.

Four partial 8-bit Standard IDs per ID Filter Table

kFlexCanRxFifoIdElementFormatD 

element.

All frames rejected.

Enumerator
kFlexCanRxFifoIDFilters_8 

8 Rx FIFO Filters.

kFlexCanRxFifoIDFilters_16 

16 Rx FIFO Filters.

kFlexCanRxFifoIDFilters_24 

24 Rx FIFO Filters.

kFlexCanRxFifoIDFilters_32 

32 Rx FIFO Filters.

kFlexCanRxFifoIDFilters_40 

40 Rx FIFO Filters.

kFlexCanRxFifoIDFilters_48 

48 Rx FIFO Filters.

kFlexCanRxFifoIDFilters_56 

56 Rx FIFO Filters.

kFlexCanRxFifoIDFilters_64 

64 Rx FIFO Filters.

kFlexCanRxFifoIDFilters_72 

72 Rx FIFO Filters.

kFlexCanRxFifoIDFilters_80 

80 Rx FIFO Filters.

kFlexCanRxFifoIDFilters_88 

88 Rx FIFO Filters.

kFlexCanRxFifoIDFilters_96 

96 Rx FIFO Filters.

kFlexCanRxFifoIDFilters_104 

104 Rx FIFO Filters.

kFlexCanRxFifoIDFilters_112 

112 Rx FIFO Filters.

kFlexCanRxFifoIDFilters_120 

120 Rx FIFO Filters.

kFlexCanRxFifoIDFilters_128 

128 Rx FIFO Filters.

Enumerator
kFlexCanRxMaskGlobal 

Rx global mask.

kFlexCanRxMaskIndividual 

Rx individual mask.

Enumerator
kFlexCanMsgIdStd 

Standard ID.

kFlexCanMsgIdExt 

Extended ID.

Enumerator
kFlexCanClkSourceOsc 

Oscillator clock.

kFlexCanClkSourceIpbus 

Peripheral clock.

Enumerator
kFlexCanIntRxwarning 

RX warning interrupt.

kFlexCanIntTxwarning 

TX warning interrupt.

kFlexCanIntErr 

Error interrupt.

kFlexCanIntBusoff 

Bus off interrupt.

kFlexCanIntWakeup 

Wake up interrupt.

Function Documentation

flexcan_status_t FLEXCAN_HAL_Enable ( CAN_Type *  base)
Parameters
baseThe FlexCAN base address
Returns
0 if successful; non-zero failed
flexcan_status_t FLEXCAN_HAL_Disable ( CAN_Type *  base)
Parameters
baseThe FlexCAN base address
Returns
0 if successful; non-zero failed
flexcan_status_t FLEXCAN_HAL_SelectClock ( CAN_Type *  base,
flexcan_clk_source_t  clk 
)
Parameters
baseThe FlexCAN base address
clkThe FlexCAN clock source
Returns
0 if successful; non-zero failed
static bool FLEXCAN_HAL_GetClock ( CAN_Type *  base)
inlinestatic
Parameters
baseThe FlexCAN base address
Returns
0: if clock source is oscillator clock, 1: if clock source is peripheral clock
flexcan_status_t FLEXCAN_HAL_Init ( CAN_Type *  base)
Parameters
baseThe FlexCAN base address
Returns
0 if successful; non-zero failed
void FLEXCAN_HAL_SetTimeSegments ( CAN_Type *  base,
flexcan_time_segment_t timeSeg 
)
Parameters
baseThe FlexCAN base address
timeSegFlexCAN time segments, which need to be set for the bit rate.
Returns
0 if successful; non-zero failed
void FLEXCAN_HAL_GetTimeSegments ( CAN_Type *  base,
flexcan_time_segment_t timeSeg 
)
Parameters
baseThe FlexCAN base address
timeSegFlexCAN time segments read for bit rate
Returns
0 if successful; non-zero failed
void FLEXCAN_HAL_ExitFreezeMode ( CAN_Type *  base)
Parameters
baseThe FlexCAN base address
Returns
0 if successful; non-zero failed.
void FLEXCAN_HAL_EnterFreezeMode ( CAN_Type *  base)
Parameters
baseThe FlexCAN base address
flexcan_status_t FLEXCAN_HAL_SetOperationMode ( CAN_Type *  base,
flexcan_operation_modes_t  mode 
)
Parameters
baseThe FlexCAN base address
modeSet an operation mode
Returns
0 if successful; non-zero failed.
flexcan_status_t FLEXCAN_HAL_ExitOperationMode ( CAN_Type *  base,
flexcan_operation_modes_t  mode 
)
Parameters
baseThe FlexCAN base address
modeExit An operation mode
Returns
0 if successful; non-zero failed.
flexcan_status_t FLEXCAN_HAL_SetTxMsgBuff ( CAN_Type *  base,
uint32_t  msgBuffIdx,
flexcan_msgbuff_code_status_t cs,
uint32_t  msgId,
uint8_t *  msgData 
)
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
0 if successful; non-zero failed
flexcan_status_t FLEXCAN_HAL_SetRxMsgBuff ( CAN_Type *  base,
uint32_t  msgBuffIdx,
flexcan_msgbuff_code_status_t cs,
uint32_t  msgId 
)
Parameters
baseThe FlexCAN base address
msgBuffIdxIndex of the message buffer
csCODE/status values (RX)
msgIdID of the message to receive
Returns
0 if successful; non-zero failed
flexcan_status_t FLEXCAN_HAL_GetMsgBuff ( CAN_Type *  base,
uint32_t  msgBuffIdx,
flexcan_msgbuff_t msgBuff 
)
Parameters
baseThe FlexCAN base address
msgBuffIdxIndex of the message buffer
msgBuffThe fields of the message buffer
Returns
0 if successful; non-zero failed
flexcan_status_t FLEXCAN_HAL_LockRxMsgBuff ( CAN_Type *  base,
uint32_t  msgBuffIdx 
)
Parameters
baseThe FlexCAN base address
msgBuffIdxIndex of the message buffer
Returns
0 if successful; non-zero failed
static uint32_t FLEXCAN_HAL_UnlockRxMsgBuff ( CAN_Type *  base)
inlinestatic
Parameters
baseThe FlexCAN base address
Returns
0 if successful; non-zero failed
void FLEXCAN_HAL_EnableRxFifo ( CAN_Type *  base,
uint32_t  numOfFilters 
)
Parameters
baseThe FlexCAN base address
numOfFiltersThe number of Rx FIFO filters
void FLEXCAN_HAL_DisableRxFifo ( CAN_Type *  base)
Parameters
baseThe FlexCAN base address
void FLEXCAN_HAL_SetRxFifoFilterNum ( CAN_Type *  base,
uint32_t  number 
)
Parameters
baseThe FlexCAN base address
numberThe number of Rx FIFO filters
void FLEXCAN_HAL_SetMaxMsgBuffNum ( CAN_Type *  base,
uint32_t  maxMsgBuffNum 
)
Parameters
baseThe FlexCAN base address
maxMsgBuffNumMaximum number of message buffers
flexcan_status_t FLEXCAN_HAL_SetRxFifoFilter ( CAN_Type *  base,
flexcan_rx_fifo_id_element_format_t  idFormat,
flexcan_id_table_t idFilterTable 
)
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.
Returns
0 if successful; non-zero failed.
flexcan_status_t FLEXCAN_HAL_ReadRxFifo ( CAN_Type *  base,
flexcan_msgbuff_t rxFifo 
)
Parameters
baseThe FlexCAN base address
rxFifoThe FlexCAN receive FIFO data
Returns
0 if successful; non-zero failed.
flexcan_status_t FLEXCAN_HAL_SetMsgBuffIntCmd ( CAN_Type *  base,
uint32_t  msgBuffIdx,
bool  enable 
)
Parameters
baseThe FlexCAN base address
msgBuffIdxIndex of the message buffer
enablechoose enable or disable
Returns
0 if successful; non-zero failed
void FLEXCAN_HAL_SetErrIntCmd ( CAN_Type *  base,
flexcan_int_type_t  errType,
bool  enable 
)
Parameters
baseThe FlexCAN base address
errTypeThe interrupt type
enablechoose enable or disable
static uint32_t FLEXCAN_HAL_GetFreezeAck ( CAN_Type *  base)
inlinestatic
Parameters
baseThe FlexCAN base address
Returns
freeze ACK state (1-freeze mode, 0-not in freeze mode).
uint8_t FLEXCAN_HAL_GetMsgBuffIntStatusFlag ( CAN_Type *  base,
uint32_t  msgBuffIdx 
)
Parameters
baseThe FlexCAN base address
msgBuffIdxIndex of the message buffer
Returns
the individual Message Buffer interrupt flag (0 and 1 are the flag value)
static uint32_t FLEXCAN_HAL_GetAllMsgBuffIntStatusFlag ( CAN_Type *  base)
inlinestatic
Parameters
baseThe FlexCAN base address
Returns
all MB interrupt flags
static void FLEXCAN_HAL_ClearMsgBuffIntStatusFlag ( CAN_Type *  base,
uint32_t  flag 
)
inlinestatic
Parameters
baseThe FlexCAN base address
flagThe value to be written to the interrupt flag1 register.
void FLEXCAN_HAL_GetErrCounter ( CAN_Type *  base,
flexcan_buserr_counter_t errCount 
)
Parameters
baseThe FlexCAN base address
errCountTransmit error counter and receive error counter
static uint32_t FLEXCAN_HAL_GetErrStatus ( CAN_Type *  base)
inlinestatic
Parameters
baseThe FlexCAN base address
Returns
The current error and status
void FLEXCAN_HAL_ClearErrIntStatusFlag ( CAN_Type *  base)
Parameters
baseThe FlexCAN base address
void FLEXCAN_HAL_SetRxMaskType ( CAN_Type *  base,
flexcan_rx_mask_type_t  type 
)
Parameters
baseThe FlexCAN base address
typeThe FlexCAN Rx mask type
void FLEXCAN_HAL_SetRxFifoGlobalStdMask ( CAN_Type *  base,
uint32_t  stdMask 
)
Parameters
baseThe FlexCAN base address
stdMaskStandard mask
void FLEXCAN_HAL_SetRxFifoGlobalExtMask ( CAN_Type *  base,
uint32_t  extMask 
)
Parameters
baseThe FlexCAN base address
extMaskExtended mask
flexcan_status_t FLEXCAN_HAL_SetRxIndividualStdMask ( CAN_Type *  base,
uint32_t  msgBuffIdx,
uint32_t  stdMask 
)
Parameters
baseThe FlexCAN base address
msgBuffIdxIndex of the message buffer
stdMaskIndividual standard mask
Returns
0 if successful; non-zero failed
flexcan_status_t FLEXCAN_HAL_SetRxIndividualExtMask ( CAN_Type *  base,
uint32_t  msgBuffIdx,
uint32_t  extMask 
)
Parameters
baseThe FlexCAN base address
msgBuffIdxIndex of the message buffer
extMaskIndividual extended mask
Returns
0 if successful; non-zero failed
void FLEXCAN_HAL_SetRxMsgBuffGlobalStdMask ( CAN_Type *  base,
uint32_t  stdMask 
)
Parameters
baseThe FlexCAN base address
stdMaskStandard mask
void FLEXCAN_HAL_SetRxMsgBuff14StdMask ( CAN_Type *  base,
uint32_t  stdMask 
)
Parameters
baseThe FlexCAN base address
stdMaskStandard mask
void FLEXCAN_HAL_SetRxMsgBuff15StdMask ( CAN_Type *  base,
uint32_t  stdMask 
)
Parameters
baseThe FlexCAN base address
stdMaskStandard mask
Returns
0 if successful; non-zero failed
void FLEXCAN_HAL_SetRxMsgBuffGlobalExtMask ( CAN_Type *  base,
uint32_t  extMask 
)
Parameters
baseThe FlexCAN base address
extMaskExtended mask
void FLEXCAN_HAL_SetRxMsgBuff14ExtMask ( CAN_Type *  base,
uint32_t  extMask 
)
Parameters
baseThe FlexCAN base address
extMaskExtended mask
void FLEXCAN_HAL_SetRxMsgBuff15ExtMask ( CAN_Type *  base,
uint32_t  extMask 
)
Parameters
baseThe FlexCAN base address
extMaskExtended mask
static uint32_t FLEXCAN_HAL_GetRxFifoHitIdAcceptanceFilter ( CAN_Type *  base)
inlinestatic
Parameters
baseThe FlexCAN base address
Returns
RX FIFO information