| Kinetis SDK API Reference Manual 1.0.0-beta Freescale Semiconductor, Inc.

- Introduction
- Related Pages
- API Usage

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Enumerations
FlexCAN HAL driver
Controller Area Network (FlexCAN)

The section describes the programming interface of the FlexCAN HAL driver. More...

## Data Structures
struct | flexcan_id_table_t
| FlexCAN RX FIFO ID filter table structure. More...
struct | flexcan_berr_counter_t
| FlexCAN bus error counters. More...
struct | flexcan_mb_code_status_tx_t
| FlexCAN MB code and status for transmitting. More...
struct | flexcan_mb_code_status_rx_t
| FlexCAN MB code and status for receiving. More...
struct | flexcan_rx_fifo_config_t
| FlexCAN Rx FIFO configuration. More...
struct | flexcan_mb_t
| FlexCAN message buffer structure. More...
struct | flexcan_user_config_t
| FlexCAN configuration. More...
struct | flexcan_time_segment_t
| FlexCAN timing related structures. More...

## Enumerations
enum | _flexcan_constants { kFlexCanMessageSize = 8 }
| FlexCAN constants. More...
enum | _flexcan_err_status { kFlexCan_RxWrn = 0x0080, kFlexCan_TxWrn = 0x0100, kFlexCan_StfErr = 0x0200, kFlexCan_FrmErr = 0x0400, kFlexCan_CrcErr = 0x0800, kFlexCan_AckErr = 0x1000, kFlexCan_Bit0Err = 0x2000, kFlexCan_Bit1Err = 0x4000 }
| 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 }
| FlexCAN status return codes.
enum | flexcan_operation_modes_t { kFlexCanNormalMode, kFlexCanListenOnlyMode, kFlexCanLoopBackMode, kFlexCanFreezeMode, kFlexCanDisableMode }
| FlexCAN operation modes. More...
enum | flexcan_mb_code_rx_t { kFlexCanRX_Inactive = 0x0, kFlexCanRX_Full = 0x2, kFlexCanRX_Empty = 0x4, kFlexCanRX_Overrun = 0x6, kFlexCanRX_Busy = 0x8, kFlexCanRX_Ranswer = 0xA, kFlexCanRX_NotUsed = 0xF }
| FlexCAN message buffer CODE for Rx buffers. More...
enum | flexcan_mb_code_tx_t { kFlexCanTX_Inactive = 0x08, kFlexCanTX_Abort = 0x09, kFlexCanTX_Data = 0x0C, kFlexCanTX_Remote = 0x1C, kFlexCanTX_Tanswer = 0x0E, kFlexCanTX_NotUsed = 0xF }
| FlexCAN message buffer CODE FOR Tx buffers. More...
enum | flexcan_mb_transmission_type_t { kFlexCanMBStatusType_TX, kFlexCanMBStatusType_TXRemote, kFlexCanMBStatusType_RX, kFlexCanMBStatusType_RXRemote, kFlexCanMBStatusType_RXTXRemote }
| FlexCAN message buffer transmission types. More...
enum | flexcan_rx_fifo_id_element_format_t { kFlexCanRxFifoIdElementFormat_A, kFlexCanRxFifoIdElementFormat_B, kFlexCanRxFifoIdElementFormat_C, kFlexCanRxFifoIdElementFormat_D }
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 { kFlexCanRxMask_Global, kFlexCanRxMask_Individual }
| FlexCAN RX mask type. More...
enum | flexcan_mb_id_type_t { kFlexCanMbId_Std, kFlexCanMbId_Ext }
| FlexCAN MB ID type. More...
enum | flexcan_clk_source_t { kFlexCanClkSource_Osc, kFlexCanClkSource_Ipbus }
| FlexCAN clock source. More...
enum | flexcan_int_type_t { kFlexCanInt_Buf, kFlexCanInt_Err, kFlexCanInt_Boff, kFlexCanInt_Wakeup, kFlexCanInt_Txwarning, kFlexCanInt_Rxwarning }
| FlexCAN error interrupt types. More...

## Configuration
flexcan_status_t | flexcan_hal_enable (uint8_t instance)
| Enables FlexCAN controller. More...
flexcan_status_t | flexcan_hal_disable (uint8_t instance)
| Disables FlexCAN controller. More...
static bool | flexcan_hal_is_enabled (uint8_t instance)
| Checks whether the FlexCAN is enabled or disabled. More...
flexcan_status_t | flexcan_hal_sw_reset (uint8_t instance)
| Resets the FlexCAN controller. More...
flexcan_status_t | flexcan_hal_select_clk (uint8_t instance, flexcan_clk_source_t clk)
| Selects the clock source for FlexCAN. More...
flexcan_status_t | flexcan_hal_init (uint8_t instance, const flexcan_user_config_t *data)
| Initializes the FlexCAN controller. More...
void | flexcan_hal_set_time_segments (uint8_t instance, flexcan_time_segment_t *time_seg)
| Sets the FlexCAN time segments for setting up bit rate. More...
void | flexcan_hal_get_time_segments (uint8_t instance, flexcan_time_segment_t *time_seg)
| Gets the FlexCAN time segments to calculate the bit rate. More...
void | flexcan_hal_exit_freeze_mode (uint8_t instance)
| Un freezes the FlexCAN module. More...
void | flexcan_hal_enter_freeze_mode (uint8_t instance)
| Freezes the FlexCAN module. More...
flexcan_status_t | flexcan_hal_enable_operation_mode (uint8_t instance, flexcan_operation_modes_t mode)
| Enables operation mode. More...
flexcan_status_t | flexcan_hal_disable_operation_mode (uint8_t instance, flexcan_operation_modes_t mode)
| Disables operation mode. More...

## Data transfer
flexcan_status_t | flexcan_hal_set_mb_tx (uint8_t instance, const flexcan_user_config_t *data, uint32_t mb_idx, flexcan_mb_code_status_tx_t *cs, uint32_t msg_id, uint8_t *mb_data)
| Sets the FlexCAN message buffer fields for transmitting. More...
flexcan_status_t | flexcan_hal_set_mb_rx (uint8_t instance, const flexcan_user_config_t *data, uint32_t mb_idx, flexcan_mb_code_status_rx_t *cs, uint32_t msg_id)
| Set the FlexCAN message buffer fields for receiving. More...
flexcan_status_t | flexcan_hal_get_mb (uint8_t instance, const flexcan_user_config_t *data, uint32_t mb_idx, flexcan_mb_t *mb)
| Gets the FlexCAN message buffer fields. More...
flexcan_status_t | flexcan_hal_lock_rx_mb (uint8_t instance, const flexcan_user_config_t *data, uint32_t mb_idx)
| Locks the FlexCAN Rx message buffer. More...
static void | flexcan_hal_unlock_rx_mb (uint8_t instance)
| Unlocks the FlexCAN Rx message buffer. More...
void | flexcan_hal_enable_rx_fifo (uint8_t instance)
| Enables the Rx FIFO. More...
void | flexcan_hal_disable_rx_fifo (uint8_t instance)
| Disables the Rx FIFO. More...
void | flexcan_hal_set_rx_fifo_filters_number (uint8_t instance, uint32_t number)
| Sets the number of the Rx FIFO filters. More...
void | flexcan_hal_set_max_mb_number (uint8_t instance, const flexcan_user_config_t *data)
| Sets the maximum number of Message Buffers. More...
flexcan_status_t | flexcan_hal_set_id_filter_table_elements (uint8_t instance, const flexcan_user_config_t *data, flexcan_rx_fifo_id_element_format_t id_format, flexcan_id_table_t *id_filter_table)
| Sets the Rx FIFO ID filter table elements. More...
flexcan_status_t | flexcan_hal_set_rx_fifo (uint8_t instance, const flexcan_user_config_t *data, flexcan_rx_fifo_id_element_format_t id_format, flexcan_id_table_t *id_filter_table)
| Sets the FlexCAN Rx FIFO fields. More...
flexcan_status_t | flexcan_hal_read_fifo (uint8_t instance, flexcan_mb_t *rx_fifo)
| Gets the FlexCAN Rx FIFO data. More...

## Interrupts
flexcan_status_t | flexcan_hal_enable_mb_interrupt (uint8_t instance, const flexcan_user_config_t *data, uint32_t mb_idx)
| Enables the FlexCAN Message Buffer interrupt. More...
flexcan_status_t | flexcan_hal_disable_mb_interrupt (uint8_t instance, const flexcan_user_config_t *data, uint32_t mb_idx)
| Disables the FlexCAN Message Buffer interrupt. More...
void | flexcan_hal_enable_error_interrupt (uint8_t instance)
| Enables error interrupt of the FlexCAN module. More...
void | flexcan_hal_disable_error_interrupt (uint8_t instance)
| Disables error interrupt of the FlexCAN module. More...
void | flexcan_hal_enable_bus_off_interrupt (uint8_t instance)
| Enables Bus off interrupt of the FlexCAN module. More...
void | flexcan_hal_disable_bus_off_interrupt (uint8_t instance)
| Disables Bus off interrupt of the FlexCAN module. More...
void | flexcan_hal_enable_wakeup_interrupt (uint8_t instance)
| Enables Wakeup interrupt of the FlexCAN module. More...
void | flexcan_hal_disable_wakeup_interrupt (uint8_t instance)
| Disables Wakeup interrupt of the FlexCAN module. More...
void | flexcan_hal_enable_tx_warning_interrupt (uint8_t instance)
| Enables TX warning interrupt of the FlexCAN module. More...
void | flexcan_hal_disable_tx_warning_interrupt (uint8_t instance)
| Disables TX warning interrupt of the FlexCAN module. More...
void | flexcan_hal_enable_rx_warning_interrupt (uint8_t instance)
| Enables RX warning interrupt of the FlexCAN module. More...
void | flexcan_hal_disable_rx_warning_interrupt (uint8_t instance)
| Disables RX warning interrupt of the FlexCAN module. More...

## Status
static uint32_t | flexcan_hal_get_freeze_ack (uint8_t instance)
| Gets the value of FlexCAN freeze ACK. More...
uint8_t | flexcan_hal_get_mb_int_flag (uint8_t instance, const flexcan_user_config_t *data, uint32_t mb_idx)
| Gets the individual FlexCAN MB interrupt flag. More...
static uint32_t | flexcan_hal_get_all_mb_int_flags (uint8_t instance)
| Gets all FlexCAN MB interrupt flags. More...
static void | flexcan_hal_clear_mb_int_flag (uint8_t instance, uint32_t reg_val)
| Clears the interrupt flag of the message buffers. More...
void | flexcan_hal_get_err_counter (uint8_t instance, flexcan_berr_counter_t *err_cnt)
| Gets the transmit error counter and receives the error counter. More...
static uint32_t | flexcan_hal_get_err_status (uint8_t instance)
| Gets error and status. More...
void | flexcan_hal_clear_err_interrupt_status (uint8_t instance)
| Clears all other interrupts in ERRSTAT register (Error, Busoff, Wakeup). More...

## Mask
void | flexcan_hal_set_mask_type (uint8_t instance, flexcan_rx_mask_type_t type)
| Sets the Rx masking type. More...
void | flexcan_hal_set_rx_fifo_global_std_mask (uint8_t instance, uint32_t std_mask)
| Sets the FlexCAN RX FIFO global standard mask. More...
void | flexcan_hal_set_rx_fifo_global_ext_mask (uint8_t instance, uint32_t ext_mask)
| Sets the FlexCAN Rx FIFO global extended mask. More...
flexcan_status_t | flexcan_hal_set_rx_individual_std_mask (uint8_t instance, const flexcan_user_config_t *data, uint32_t mb_idx, uint32_t std_mask)
| Sets the FlexCAN Rx individual standard mask for ID filtering in the Rx MBs and the Rx FIFO. More...
flexcan_status_t | flexcan_hal_set_rx_individual_ext_mask (uint8_t instance, const flexcan_user_config_t *data, uint32_t mb_idx, uint32_t ext_mask)
| Sets the FlexCAN Rx individual extended mask for ID filtering in the Rx MBs and the Rx FIFO. More...
void | flexcan_hal_set_rx_mb_global_std_mask (uint8_t instance, uint32_t std_mask)
| Sets the FlexCAN Rx MB global standard mask. More...
void | flexcan_hal_set_rx_mb_buf14_std_mask (uint8_t instance, uint32_t std_mask)
| Sets the FlexCAN RX MB BUF14 standard mask. More...
void | flexcan_hal_set_rx_mb_buf15_std_mask (uint8_t instance, uint32_t std_mask)
| Sets the FlexCAN Rx MB BUF15 standard mask. More...
void | flexcan_hal_set_rx_mb_global_ext_mask (uint8_t instance, uint32_t ext_mask)
| Sets the FlexCAN RX MB global extended mask. More...
void | flexcan_hal_set_rx_mb_buf14_ext_mask (uint8_t instance, uint32_t ext_mask)
| Sets the FlexCAN RX MB BUF14 extended mask. More...
void | flexcan_hal_set_rx_mb_buf15_ext_mask (uint8_t instance, uint32_t ext_mask)
| Sets the FlexCAN RX MB BUF15 extended mask. More...
static uint32_t | flexcan_hal_get_rx_fifo_id_acceptance_filter (uint8_t instance)
| Gets the FlexCAN ID acceptance filter hit indicator on Rx FIFO. More...

## Data Structure Documentation

struct flexcan_id_table_t

### Data Fields
bool | is_remote_mb
| Remote frame.
bool | is_extended_mb
| Extended frame.
uint32_t * | id_filter
| Rx FIFO ID filter elements.

struct flexcan_berr_counter_t

### Data Fields
uint16_t | txerr
| Transmit error counter.
uint16_t | rxerr
| Receive error counter.

struct flexcan_mb_code_status_tx_t

### Data Fields
flexcan_mb_code_tx_t | code
| MB code for Tx buffers.
flexcan_mb_id_type_t | msg_id_type
| Type of message ID (standard or extended)
uint32_t | data_length
| Length of Data in Bytes.
uint32_t | substitute_remote
| Substitute remote request (used only in.
uint32_t | remote_transmission
| extended format) More...
bool | local_priority_enable
| 1 if enable it; 0 if disable it
uint32_t | local_priority_val
| Local priority value [0..2].

#### Field Documentation

uint32_t flexcan_mb_code_status_tx_t::remote_transmission

Remote transmission request

struct flexcan_mb_code_status_rx_t

### Data Fields
flexcan_mb_code_rx_t | code
| MB code for Rx buffers.
flexcan_mb_id_type_t | msg_id_type
| Type of message ID (standard or extended)
uint32_t | data_length
| Length of Data in Bytes.
uint32_t | substitute_remote
| Substitute remote request (used only in.
uint32_t | remote_transmission
| extended format) More...
bool | local_priority_enable
| 1 if enable it; 0 if disable it
uint32_t | local_priority_val
| Local priority value [0..2].

#### Field Documentation

uint32_t flexcan_mb_code_status_rx_t::remote_transmission

Remote transmission request

struct flexcan_rx_fifo_config_t

### Data Fields
flexcan_mb_id_type_t | msg_id_type
| Type of message ID.
uint32_t | data_length
| (standard or extended) More...
uint32_t | substitute_remote
| Substitute remote request (used.
uint32_t | remote_transmission
| only in extended format) More...
flexcan_rx_fifo_id_element_format_t | id_filter_number
| The number of Rx FIFO ID filters.

#### Field Documentation

uint32_t flexcan_rx_fifo_config_t::data_length

Length of Data in Bytes

uint32_t flexcan_rx_fifo_config_t::remote_transmission

Remote transmission request

struct flexcan_mb_t

### Data Fields
uint32_t | cs
| Code and Status.
uint32_t | msg_id
| Message Buffer ID.
uint8_t | data [kFlexCanMessageSize]
| Bytes of the FlexCAN message.

struct flexcan_user_config_t

### Data Fields
uint32_t | num_mb
| The number of Message Buffers needed.
uint32_t | max_num_mb
| The maximum number of Message Buffers.
flexcan_rx_fifo_id_filter_num_t | num_id_filters
| The number of Rx FIFO ID filters needed.
bool | is_rx_fifo_needed
| 1 if needed; 0 if not
bool | is_rx_mb_needed
| 1 if needed; 0 if not

struct flexcan_time_segment_t

### Data Fields
uint32_t | propseg
| Propagation segment.
uint32_t | pseg1
| Phase segment 1.
uint32_t | pseg2
| Phase segment 2.
uint32_t | pre_divider
| Clock pre divider.
uint32_t | rjw
| Resync jump width.

## Enumeration Type Documentation

enum _flexcan_constants

Enumerator
kFlexCanMessageSize | FlexCAN message buffer data size in bytes.

enum _flexcan_err_status

Enumerator
kFlexCan_RxWrn | Reached warning level for RX errors.
kFlexCan_TxWrn | Reached warning level for TX errors.
kFlexCan_StfErr | Stuffing Error.
kFlexCan_FrmErr | Form Error.
kFlexCan_CrcErr | Cyclic Redundancy Check Error.
kFlexCan_AckErr | Received no ACK on transmission.
kFlexCan_Bit0Err | Unable to send dominant bit.
kFlexCan_Bit1Err | Unable to send recessive bit.

enum flexcan_operation_modes_t

Enumerator
kFlexCanNormalMode | Normal mode or user mode.
kFlexCanListenOnlyMode | Listen-only mode.
kFlexCanLoopBackMode | Loop-back mode.
kFlexCanFreezeMode | Freeze mode.
kFlexCanDisableMode | Module disable mode.

enum flexcan_mb_code_rx_t

Enumerator
kFlexCanRX_Inactive | MB is not active.
kFlexCanRX_Full | MB is full.
kFlexCanRX_Empty | MB is active and empty.
kFlexCanRX_Overrun | MB is overwritten into a full buffer.
kFlexCanRX_Busy | FlexCAN is updating the contents of the MB.
kFlexCanRX_Ranswer | The CPU must not access the MB. A frame was configured to recognize a Remote Request Frame
kFlexCanRX_NotUsed | and transmit a Response Frame in return. Not used

enum flexcan_mb_code_tx_t

Enumerator
kFlexCanTX_Inactive | MB is not active.
kFlexCanTX_Abort | MB is aborted.
kFlexCanTX_Data | MB is a TX Data Frame(MB RTR must be 0).
kFlexCanTX_Remote | MB is a TX Remote Request Frame (MB RTR must be 1).
kFlexCanTX_Tanswer | MB is a TX Response Request Frame from.
kFlexCanTX_NotUsed | an incoming Remote Request Frame. Not used

enum flexcan_mb_transmission_type_t

Enumerator
kFlexCanMBStatusType_TX | Transmit MB.
kFlexCanMBStatusType_TXRemote | Transmit remote request MB.
kFlexCanMBStatusType_RX | Receive MB.
kFlexCanMBStatusType_RXRemote | Receive remote request MB.
kFlexCanMBStatusType_RXTXRemote | FlexCAN remote frame receives remote request and.

enum flexcan_rx_fifo_id_element_format_t

Enumerator
kFlexCanRxFifoIdElementFormat_A | One full ID (standard and extended) per ID Filter Table.
kFlexCanRxFifoIdElementFormat_B | element. Two full standard IDs or two partial 14-bit (standard and
kFlexCanRxFifoIdElementFormat_C | extended) IDs per ID Filter Table element. Four partial 8-bit Standard IDs per ID Filter Table
kFlexCanRxFifoIdElementFormat_D | element. All frames rejected.

enum flexcan_rx_fifo_id_filter_num_t

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

enum flexcan_rx_mask_type_t

Enumerator
kFlexCanRxMask_Global | Rx global mask.
kFlexCanRxMask_Individual | Rx individual mask.

enum flexcan_mb_id_type_t

Enumerator
kFlexCanMbId_Std | Standard ID.
kFlexCanMbId_Ext | Extended ID.

enum flexcan_clk_source_t

Enumerator
kFlexCanClkSource_Osc | Oscillator clock.
kFlexCanClkSource_Ipbus | Peripheral clock.

enum flexcan_int_type_t

Enumerator
kFlexCanInt_Buf | OR'd message buffers interrupt.
kFlexCanInt_Err | Error interrupt.
kFlexCanInt_Boff | Bus off interrupt.
kFlexCanInt_Wakeup | Wakeup interrupt.
kFlexCanInt_Txwarning | TX warning interrupt.
kFlexCanInt_Rxwarning | RX warning interrupt.

## Function Documentation

flexcan_status_t flexcan_hal_enable | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

Returns
  0 if successful; non-zero failed

flexcan_status_t flexcan_hal_disable | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

Returns
  0 if successful; non-zero failed

static bool flexcan_hal_is_enabled | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FlexCAN instance number

Returns
  State of FlexCAN enable(0)/disable(1)

flexcan_status_t flexcan_hal_sw_reset | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

Returns
  0 if successful; non-zero failed

flexcan_status_t flexcan_hal_select_clk | ( | uint8_t | instance,
|  | flexcan_clk_source_t | clk
| ) |  |

Parameters

  instance | The FlexCAN instance number
  clk | The FlexCAN clock source

Returns
  0 if successful; non-zero failed

flexcan_status_t flexcan_hal_init | ( | uint8_t | instance,
|  | const flexcan_user_config_t * | data
| ) |  |

Parameters

  instance | The FlexCAN instance number
  data | The FlexCAN platform data.

Returns
  0 if successful; non-zero failed

void flexcan_hal_set_time_segments | ( | uint8_t | instance,
|  | flexcan_time_segment_t * | time_seg
| ) |  |

Parameters

  instance | The FlexCAN instance number
  time_seg | FlexCAN time segments, which need to be set for the bit rate.

Returns
  0 if successful; non-zero failed

void flexcan_hal_get_time_segments | ( | uint8_t | instance,
|  | flexcan_time_segment_t * | time_seg
| ) |  |

Parameters

  instance | The FlexCAN instance number
  time_seg | FlexCAN time segments read for bit rate

Returns
  0 if successful; non-zero failed

void flexcan_hal_exit_freeze_mode | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

Returns
  0 if successful; non-zero failed.

void flexcan_hal_enter_freeze_mode | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

flexcan_status_t flexcan_hal_enable_operation_mode | ( | uint8_t | instance,
|  | flexcan_operation_modes_t | mode
| ) |  |

Parameters

  instance | The FlexCAN instance number
  mode | An operation mode to be enabled

Returns
  0 if successful; non-zero failed.

flexcan_status_t flexcan_hal_disable_operation_mode | ( | uint8_t | instance,
|  | flexcan_operation_modes_t | mode
| ) |  |

Parameters

  instance | The FlexCAN instance number
  mode | An operation mode to be disabled

Returns
  0 if successful; non-zero failed.

flexcan_status_t flexcan_hal_set_mb_tx | ( | uint8_t | instance,
|  | const flexcan_user_config_t * | data,
|  | uint32_t | mb_idx,
|  | flexcan_mb_code_status_tx_t * | cs,
|  | uint32_t | msg_id,
|  | uint8_t * | mb_data
| ) |  |

Parameters

  instance | The FlexCAN instance number
  data | The FlexCAN platform data
  mb_idx | Index of the message buffer
  cs | CODE/status values (TX)
  msg_id | ID of the message to transmit
  mb_data | Bytes of the FlexCAN message

Returns
  0 if successful; non-zero failed

flexcan_status_t flexcan_hal_set_mb_rx | ( | uint8_t | instance,
|  | const flexcan_user_config_t * | data,
|  | uint32_t | mb_idx,
|  | flexcan_mb_code_status_rx_t * | cs,
|  | uint32_t | msg_id
| ) |  |

Parameters

  instance | The FlexCAN instance number
  data | The FlexCAN platform data
  mb_idx | Index of the message buffer
  cs | CODE/status values (RX)
  msg_id | ID of the message to receive

Returns
  0 if successful; non-zero failed

flexcan_status_t flexcan_hal_get_mb | ( | uint8_t | instance,
|  | const flexcan_user_config_t * | data,
|  | uint32_t | mb_idx,
|  | flexcan_mb_t * | mb
| ) |  |

Parameters

  instance | The FlexCAN instance number
  data | The FlexCAN platform data
  mb_idx | Index of the message buffer
  mb | The fields of the message buffer

Returns
  0 if successful; non-zero failed

flexcan_status_t flexcan_hal_lock_rx_mb | ( | uint8_t | instance,
|  | const flexcan_user_config_t * | data,
|  | uint32_t | mb_idx
| ) |  |

Parameters

  instance | The FlexCAN instance number
  data | The FlexCAN platform data
  mb_idx | Index of the message buffer

Returns
  0 if successful; non-zero failed

static void flexcan_hal_unlock_rx_mb | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FlexCAN instance number

Returns
  0 if successful; non-zero failed

void flexcan_hal_enable_rx_fifo | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

void flexcan_hal_disable_rx_fifo | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

void flexcan_hal_set_rx_fifo_filters_number | ( | uint8_t | instance,
|  | uint32_t | number
| ) |  |

Parameters

  instance | The FlexCAN instance number
  number | The number of Rx FIFO filters

void flexcan_hal_set_max_mb_number | ( | uint8_t | instance,
|  | const flexcan_user_config_t * | data
| ) |  |

Parameters

  instance | The FlexCAN instance number
  data | The FlexCAN platform data

flexcan_status_t flexcan_hal_set_id_filter_table_elements | ( | uint8_t | instance,
|  | const flexcan_user_config_t * | data,
|  | flexcan_rx_fifo_id_element_format_t | id_format,
|  | flexcan_id_table_t * | id_filter_table
| ) |  |

Parameters

  instance | The FlexCAN instance number
  data | The FlexCAN platform data
  id_format | The format of the Rx FIFO ID Filter Table Elements
  id_filter_table | The ID filter table elements which contain if RTR bit, IDE bit and RX message ID need to be set.

Returns
  0 if successful; non-zero failed.

flexcan_status_t flexcan_hal_set_rx_fifo | ( | uint8_t | instance,
|  | const flexcan_user_config_t * | data,
|  | flexcan_rx_fifo_id_element_format_t | id_format,
|  | flexcan_id_table_t * | id_filter_table
| ) |  |

Parameters

  instance | The FlexCAN instance number
  data | The FlexCAN platform data
  id_format | The format of the Rx FIFO ID Filter Table Elements
  id_filter_table | The 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_read_fifo | ( | uint8_t | instance,
|  | flexcan_mb_t * | rx_fifo
| ) |  |

Parameters

  instance | The FlexCAN instance number
  rx_fifo | The FlexCAN receive FIFO data

Returns
  0 if successful; non-zero failed.

flexcan_status_t flexcan_hal_enable_mb_interrupt | ( | uint8_t | instance,
|  | const flexcan_user_config_t * | data,
|  | uint32_t | mb_idx
| ) |  |

Parameters

  instance | The FlexCAN instance number
  data | The FlexCAN platform data
  mb_idx | Index of the message buffer

Returns
  0 if successful; non-zero failed

flexcan_status_t flexcan_hal_disable_mb_interrupt | ( | uint8_t | instance,
|  | const flexcan_user_config_t * | data,
|  | uint32_t | mb_idx
| ) |  |

Parameters

  instance | The FlexCAN instance number
  data | The FlexCAN platform data
  mb_idx | Index of the message buffer

Returns
  0 if successful; non-zero failed

void flexcan_hal_enable_error_interrupt | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

void flexcan_hal_disable_error_interrupt | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

void flexcan_hal_enable_bus_off_interrupt | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

void flexcan_hal_disable_bus_off_interrupt | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

void flexcan_hal_enable_wakeup_interrupt | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

void flexcan_hal_disable_wakeup_interrupt | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

void flexcan_hal_enable_tx_warning_interrupt | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

void flexcan_hal_disable_tx_warning_interrupt | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

void flexcan_hal_enable_rx_warning_interrupt | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

void flexcan_hal_disable_rx_warning_interrupt | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

static uint32_t flexcan_hal_get_freeze_ack | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FlexCAN instance number

Returns
  freeze ACK state (1-freeze mode, 0-not in freeze mode).

uint8_t flexcan_hal_get_mb_int_flag | ( | uint8_t | instance,
|  | const flexcan_user_config_t * | data,
|  | uint32_t | mb_idx
| ) |  |

Parameters

  instance | The FlexCAN instance number
  data | The FlexCAN platform data
  mb_idx | Index of the message buffer

Returns
  the individual MB interrupt flag (0 and 1 are the flag value)

static uint32_t flexcan_hal_get_all_mb_int_flags | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FlexCAN instance number

Returns
  all MB interrupt flags

static void flexcan_hal_clear_mb_int_flag | ( | uint8_t | instance,
|  | uint32_t | reg_val
| ) |  |
| inline static

Parameters

  instance | The FlexCAN instance number
  reg_val | The value to be written to the interrupt flag1 register.

void flexcan_hal_get_err_counter | ( | uint8_t | instance,
|  | flexcan_berr_counter_t * | err_cnt
| ) |  |

Parameters

  instance | The FlexCAN instance number
  err_cnt | Transmit error counter and receive error counter

static uint32_t flexcan_hal_get_err_status | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FlexCAN instance number

Returns
  The current error and status

void flexcan_hal_clear_err_interrupt_status | ( | uint8_t | instance | ) |

Parameters

  instance | The FlexCAN instance number

void flexcan_hal_set_mask_type | ( | uint8_t | instance,
|  | flexcan_rx_mask_type_t | type
| ) |  |

Parameters

  instance | The FlexCAN instance number
  type | The FlexCAN Rx mask type

void flexcan_hal_set_rx_fifo_global_std_mask | ( | uint8_t | instance,
|  | uint32_t | std_mask
| ) |  |

Parameters

  instance | The FlexCAN instance number
  std_mask | Standard mask

void flexcan_hal_set_rx_fifo_global_ext_mask | ( | uint8_t | instance,
|  | uint32_t | ext_mask
| ) |  |

Parameters

  instance | The FlexCAN instance number
  ext_mask | Extended mask

flexcan_status_t flexcan_hal_set_rx_individual_std_mask | ( | uint8_t | instance,
|  | const flexcan_user_config_t * | data,
|  | uint32_t | mb_idx,
|  | uint32_t | std_mask
| ) |  |

Parameters

  instance | The FlexCAN instance number
  data | The FlexCAN platform data
  mb_idx | Index of the message buffer
  std_mask | Individual standard mask

Returns
  0 if successful; non-zero failed

flexcan_status_t flexcan_hal_set_rx_individual_ext_mask | ( | uint8_t | instance,
|  | const flexcan_user_config_t * | data,
|  | uint32_t | mb_idx,
|  | uint32_t | ext_mask
| ) |  |

Parameters

  instance | The FlexCAN instance number
  data | The FlexCAN platform data
  mb_idx | Index of the message buffer
  ext_mask | Individual extended mask

Returns
  0 if successful; non-zero failed

void flexcan_hal_set_rx_mb_global_std_mask | ( | uint8_t | instance,
|  | uint32_t | std_mask
| ) |  |

Parameters

  instance | The FlexCAN instance number
  std_mask | Standard mask

void flexcan_hal_set_rx_mb_buf14_std_mask | ( | uint8_t | instance,
|  | uint32_t | std_mask
| ) |  |

Parameters

  instance | The FlexCAN instance number
  std_mask | Standard mask

void flexcan_hal_set_rx_mb_buf15_std_mask | ( | uint8_t | instance,
|  | uint32_t | std_mask
| ) |  |

Parameters

  instance | The FlexCAN instance number
  std_mask | Standard mask

Returns
  0 if successful; non-zero failed

void flexcan_hal_set_rx_mb_global_ext_mask | ( | uint8_t | instance,
|  | uint32_t | ext_mask
| ) |  |

Parameters

  instance | The FlexCAN instance number
  ext_mask | Extended mask

void flexcan_hal_set_rx_mb_buf14_ext_mask | ( | uint8_t | instance,
|  | uint32_t | ext_mask
| ) |  |

Parameters

  instance | The FlexCAN instance number
  ext_mask | Extended mask

void flexcan_hal_set_rx_mb_buf15_ext_mask | ( | uint8_t | instance,
|  | uint32_t | ext_mask
| ) |  |

Parameters

  instance | The FlexCAN instance number
  ext_mask | Extended mask

static uint32_t flexcan_hal_get_rx_fifo_id_acceptance_filter | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FlexCAN instance number

Returns
  RX FIFO information