Kinetis SDK v.1.3 API Reference Manual
Rev. 0
Freescale Semiconductor, Inc.
|
This section describes the programming interface of the FlexCAN HAL driver.
Data Structures | |
struct | flexcan_id_table_t |
FlexCAN receive 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... | |
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) |
Unfreezes 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) |
Sets operation mode. More... | |
flexcan_status_t | FLEXCAN_HAL_ExitOperationMode (CAN_Type *base, flexcan_operation_modes_t mode) |
Exits 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 receive message buffer. More... | |
static uint32_t | FLEXCAN_HAL_UnlockRxMsgBuff (CAN_Type *base) |
Unlocks the FlexCAN receive message buffer. More... | |
void | FLEXCAN_HAL_EnableRxFifo (CAN_Type *base, uint32_t numOfFilters) |
Enables the receive FIFO. More... | |
void | FLEXCAN_HAL_DisableRxFifo (CAN_Type *base) |
Disables the receive FIFO. More... | |
void | FLEXCAN_HAL_SetRxFifoFilterNum (CAN_Type *base, uint32_t number) |
Sets the number of the receive FIFO filters. More... | |
void | FLEXCAN_HAL_SetMaxMsgBuffNum (CAN_Type *base, uint32_t maxMsgBuffNum) |
Sets the number of the last message buffer. 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 receive FIFO fields. More... | |
flexcan_status_t | FLEXCAN_HAL_ReadRxFifo (CAN_Type *base, flexcan_msgbuff_t *rxFifo) |
Gets the FlexCAN receive 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 the error interrupt of the FlexCAN module. More... | |
Status | |
static uint32_t | FLEXCAN_HAL_GetFreezeAck (CAN_Type *base) |
Gets the value of the 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 an error and status. More... | |
void | FLEXCAN_HAL_ClearErrIntStatusFlag (CAN_Type *base) |
Clears all other interrupts in ERRSTAT register (Error, Busoff, and Wakeup). More... | |
Mask | |
void | FLEXCAN_HAL_SetRxMaskType (CAN_Type *base, flexcan_rx_mask_type_t type) |
Sets the receive masking type. More... | |
void | FLEXCAN_HAL_SetRxFifoGlobalStdMask (CAN_Type *base, uint32_t stdMask) |
Sets the FlexCAN receive FIFO global standard mask. More... | |
void | FLEXCAN_HAL_SetRxFifoGlobalExtMask (CAN_Type *base, uint32_t extMask) |
Sets the FlexCAN receive FIFO global extended mask. More... | |
flexcan_status_t | FLEXCAN_HAL_SetRxIndividualStdMask (CAN_Type *base, uint32_t msgBuffIdx, uint32_t stdMask) |
Sets the FlexCAN receive individual standard mask for ID filtering in the receive MBs and the receive FIFO. More... | |
flexcan_status_t | FLEXCAN_HAL_SetRxIndividualExtMask (CAN_Type *base, uint32_t msgBuffIdx, uint32_t extMask) |
Sets the FlexCAN receive individual extended mask for ID filtering in the receive Message Buffers and the receive FIFO. More... | |
void | FLEXCAN_HAL_SetRxMsgBuffGlobalStdMask (CAN_Type *base, uint32_t stdMask) |
Sets the FlexCAN receive Message Buffer global standard mask. More... | |
void | FLEXCAN_HAL_SetRxMsgBuff14StdMask (CAN_Type *base, uint32_t stdMask) |
Sets the FlexCAN receive Message Buffer BUF14 standard mask. More... | |
void | FLEXCAN_HAL_SetRxMsgBuff15StdMask (CAN_Type *base, uint32_t stdMask) |
Sets the FlexCAN receive Message Buffer BUF15 standard mask. More... | |
void | FLEXCAN_HAL_SetRxMsgBuffGlobalExtMask (CAN_Type *base, uint32_t extMask) |
Sets the FlexCAN receive Message Buffer global extended mask. More... | |
void | FLEXCAN_HAL_SetRxMsgBuff14ExtMask (CAN_Type *base, uint32_t extMask) |
Sets the FlexCAN receive Message Buffer BUF14 extended mask. More... | |
void | FLEXCAN_HAL_SetRxMsgBuff15ExtMask (CAN_Type *base, uint32_t extMask) |
Sets the FlexCAN receive MB BUF15 extended mask. More... | |
static uint32_t | FLEXCAN_HAL_GetRxFifoHitIdAcceptanceFilter (CAN_Type *base) |
Gets the FlexCAN ID acceptance filter hit indicator on receive FIFO. More... | |
struct flexcan_id_table_t |
Data Fields | |
bool | isRemoteFrame |
Remote frame. | |
bool | isExtendedFrame |
Extended frame. | |
uint32_t * | idFilter |
Receive FIFO ID filter elements. | |
struct flexcan_buserr_counter_t |
struct flexcan_msgbuff_code_status_t |
Data Fields | |
uint32_t | code |
MB code for transmit or receive buffers. More... | |
flexcan_msgbuff_id_type_t | msgIdType |
Type of message ID (standard or extended) | |
uint32_t | dataLen |
Length of Data in Bytes. | |
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. | |
enum _flexcan_constants |
enum _flexcan_err_status |
enum flexcan_clk_source_t |
enum flexcan_int_type_t |
flexcan_status_t FLEXCAN_HAL_Enable | ( | CAN_Type * | base | ) |
base | The FlexCAN base address |
flexcan_status_t FLEXCAN_HAL_Disable | ( | CAN_Type * | base | ) |
base | The FlexCAN base address |
flexcan_status_t FLEXCAN_HAL_SelectClock | ( | CAN_Type * | base, |
flexcan_clk_source_t | clk | ||
) |
base | The FlexCAN base address |
clk | The FlexCAN clock source |
|
inlinestatic |
base | The FlexCAN base address |
flexcan_status_t FLEXCAN_HAL_Init | ( | CAN_Type * | base | ) |
base | The FlexCAN base address |
void FLEXCAN_HAL_SetTimeSegments | ( | CAN_Type * | base, |
flexcan_time_segment_t * | timeSeg | ||
) |
base | The FlexCAN base address |
timeSeg | FlexCAN time segments, which need to be set for the bit rate. |
void FLEXCAN_HAL_GetTimeSegments | ( | CAN_Type * | base, |
flexcan_time_segment_t * | timeSeg | ||
) |
base | The FlexCAN base address |
timeSeg | FlexCAN time segments read for bit rate |
void FLEXCAN_HAL_ExitFreezeMode | ( | CAN_Type * | base | ) |
base | The FlexCAN base address |
void FLEXCAN_HAL_EnterFreezeMode | ( | CAN_Type * | base | ) |
base | The FlexCAN base address |
flexcan_status_t FLEXCAN_HAL_SetOperationMode | ( | CAN_Type * | base, |
flexcan_operation_modes_t | mode | ||
) |
base | The FlexCAN base address |
mode | Set an operation mode |
flexcan_status_t FLEXCAN_HAL_ExitOperationMode | ( | CAN_Type * | base, |
flexcan_operation_modes_t | mode | ||
) |
base | The FlexCAN base address |
mode | Exit An operation mode |
flexcan_status_t FLEXCAN_HAL_SetTxMsgBuff | ( | CAN_Type * | base, |
uint32_t | msgBuffIdx, | ||
flexcan_msgbuff_code_status_t * | cs, | ||
uint32_t | msgId, | ||
uint8_t * | msgData | ||
) |
base | The FlexCAN base address |
msgBuffIdx | Index of the message buffer |
cs | CODE/status values (TX) |
msgId | ID of the message to transmit |
msgData | Bytes of the FlexCAN message |
flexcan_status_t FLEXCAN_HAL_SetRxMsgBuff | ( | CAN_Type * | base, |
uint32_t | msgBuffIdx, | ||
flexcan_msgbuff_code_status_t * | cs, | ||
uint32_t | msgId | ||
) |
base | The FlexCAN base address |
msgBuffIdx | Index of the message buffer |
cs | CODE/status values (RX) |
msgId | ID of the message to receive |
flexcan_status_t FLEXCAN_HAL_GetMsgBuff | ( | CAN_Type * | base, |
uint32_t | msgBuffIdx, | ||
flexcan_msgbuff_t * | msgBuff | ||
) |
base | The FlexCAN base address |
msgBuffIdx | Index of the message buffer |
msgBuff | The fields of the message buffer |
flexcan_status_t FLEXCAN_HAL_LockRxMsgBuff | ( | CAN_Type * | base, |
uint32_t | msgBuffIdx | ||
) |
base | The FlexCAN base address |
msgBuffIdx | Index of the message buffer |
|
inlinestatic |
base | The FlexCAN base address |
void FLEXCAN_HAL_EnableRxFifo | ( | CAN_Type * | base, |
uint32_t | numOfFilters | ||
) |
base | The FlexCAN base address |
numOfFilters | The number of receive FIFO filters |
void FLEXCAN_HAL_DisableRxFifo | ( | CAN_Type * | base | ) |
base | The FlexCAN base address |
void FLEXCAN_HAL_SetRxFifoFilterNum | ( | CAN_Type * | base, |
uint32_t | number | ||
) |
base | The FlexCAN base address |
number | The number of receive FIFO filters |
void FLEXCAN_HAL_SetMaxMsgBuffNum | ( | CAN_Type * | base, |
uint32_t | maxMsgBuffNum | ||
) |
base | The FlexCAN base address |
maxMsgBuffNum | Number of the last Message Buffer |
flexcan_status_t FLEXCAN_HAL_SetRxFifoFilter | ( | CAN_Type * | base, |
flexcan_rx_fifo_id_element_format_t | idFormat, | ||
flexcan_id_table_t * | idFilterTable | ||
) |
base | The FlexCAN base address |
idFormat | The format of the receive FIFO ID Filter Table Elements |
idFilterTable | The ID filter table elements which contain RTR bit, IDE bit, and receive message ID. |
flexcan_status_t FLEXCAN_HAL_ReadRxFifo | ( | CAN_Type * | base, |
flexcan_msgbuff_t * | rxFifo | ||
) |
base | The FlexCAN base address |
rxFifo | The FlexCAN receive FIFO data |
flexcan_status_t FLEXCAN_HAL_SetMsgBuffIntCmd | ( | CAN_Type * | base, |
uint32_t | msgBuffIdx, | ||
bool | enable | ||
) |
base | The FlexCAN base address |
msgBuffIdx | Index of the message buffer |
enable | choose enable or disable |
void FLEXCAN_HAL_SetErrIntCmd | ( | CAN_Type * | base, |
flexcan_int_type_t | errType, | ||
bool | enable | ||
) |
base | The FlexCAN base address |
errType | The interrupt type |
enable | choose enable or disable |
|
inlinestatic |
base | The FlexCAN base address |
uint8_t FLEXCAN_HAL_GetMsgBuffIntStatusFlag | ( | CAN_Type * | base, |
uint32_t | msgBuffIdx | ||
) |
base | The FlexCAN base address |
msgBuffIdx | Index of the message buffer |
|
inlinestatic |
base | The FlexCAN base address |
|
inlinestatic |
base | The FlexCAN base address |
flag | The value to be written to the interrupt flag1 register. |
void FLEXCAN_HAL_GetErrCounter | ( | CAN_Type * | base, |
flexcan_buserr_counter_t * | errCount | ||
) |
base | The FlexCAN base address |
errCount | Transmit error counter and receive error counter |
|
inlinestatic |
base | The FlexCAN base address |
void FLEXCAN_HAL_ClearErrIntStatusFlag | ( | CAN_Type * | base | ) |
base | The FlexCAN base address |
void FLEXCAN_HAL_SetRxMaskType | ( | CAN_Type * | base, |
flexcan_rx_mask_type_t | type | ||
) |
base | The FlexCAN base address |
type | The FlexCAN receive mask type |
void FLEXCAN_HAL_SetRxFifoGlobalStdMask | ( | CAN_Type * | base, |
uint32_t | stdMask | ||
) |
base | The FlexCAN base address |
stdMask | Standard mask |
void FLEXCAN_HAL_SetRxFifoGlobalExtMask | ( | CAN_Type * | base, |
uint32_t | extMask | ||
) |
base | The FlexCAN base address |
extMask | Extended mask |
flexcan_status_t FLEXCAN_HAL_SetRxIndividualStdMask | ( | CAN_Type * | base, |
uint32_t | msgBuffIdx, | ||
uint32_t | stdMask | ||
) |
base | The FlexCAN base address |
msgBuffIdx | Index of the message buffer |
stdMask | Individual standard mask |
flexcan_status_t FLEXCAN_HAL_SetRxIndividualExtMask | ( | CAN_Type * | base, |
uint32_t | msgBuffIdx, | ||
uint32_t | extMask | ||
) |
base | The FlexCAN base address |
msgBuffIdx | Index of the message buffer |
extMask | Individual extended mask |
void FLEXCAN_HAL_SetRxMsgBuffGlobalStdMask | ( | CAN_Type * | base, |
uint32_t | stdMask | ||
) |
base | The FlexCAN base address |
stdMask | Standard mask |
void FLEXCAN_HAL_SetRxMsgBuff14StdMask | ( | CAN_Type * | base, |
uint32_t | stdMask | ||
) |
base | The FlexCAN base address |
stdMask | Standard mask |
void FLEXCAN_HAL_SetRxMsgBuff15StdMask | ( | CAN_Type * | base, |
uint32_t | stdMask | ||
) |
base | The FlexCAN base address |
stdMask | Standard mask |
void FLEXCAN_HAL_SetRxMsgBuffGlobalExtMask | ( | CAN_Type * | base, |
uint32_t | extMask | ||
) |
base | The FlexCAN base address |
extMask | Extended mask |
void FLEXCAN_HAL_SetRxMsgBuff14ExtMask | ( | CAN_Type * | base, |
uint32_t | extMask | ||
) |
base | The FlexCAN base address |
extMask | Extended mask |
void FLEXCAN_HAL_SetRxMsgBuff15ExtMask | ( | CAN_Type * | base, |
uint32_t | extMask | ||
) |
base | The FlexCAN base address |
extMask | Extended mask |
|
inlinestatic |
base | The FlexCAN base address |