Classes
SAM Control Area Network (MCAN) Low Level Driver

Classes

struct  mcan_config
 MCAN configuration structure. More...
 
struct  mcan_module
 MCAN software device instance structure. More...
 

Module Setting

enum  mcan_timeout_mode { MCAN_TIMEOUT_CONTINUES = MCAN_TOCC_TOS_CONTINUOUS, MCAN_TIMEOUT_TX_EVEN_FIFO = MCAN_TOCC_TOS_TX_EV_TIMEOUT, MCAN_TIMEOUT_RX_FIFO_0 = MCAN_TOCC_TOS_RX0_EV_TIMEOUT, MCAN_TIMEOUT_RX_FIFO_1 = MCAN_TOCC_TOS_RX1_EV_TIMEOUT }
 Can time out modes. More...
 
enum  mcan_nonmatching_frames_action { MCAN_NONMATCHING_FRAMES_FIFO_0, MCAN_NONMATCHING_FRAMES_FIFO_1, MCAN_NONMATCHING_FRAMES_REJECT }
 Can nonmatching frames action. More...
 
static void mcan_get_config_defaults (struct mcan_config *const config)
 Initializes an MCAN configuration structure to defaults. More...
 
void mcan_init (struct mcan_module *const module_inst, Mcan *hw, struct mcan_config *config)
 initialize can module. More...
 
void mcan_set_baudrate (Mcan *hw, uint32_t baudrate)
 Set MCAN baudrate. More...
 
void mcan_fd_set_baudrate (Mcan *hw, uint32_t baudrate)
 Set MCAN_FD baudrate. More...
 
void mcan_start (struct mcan_module *const module_inst)
 start can module after initialization. More...
 
void mcan_stop (struct mcan_module *const module_inst)
 stop mcan module when bus off occurs More...
 
void mcan_enable_fd_mode (struct mcan_module *const module_inst)
 switch mcan module into fd mode. More...
 
void mcan_disable_fd_mode (struct mcan_module *const module_inst)
 disable fd mode of mcan module. More...
 
void mcan_enable_restricted_operation_mode (struct mcan_module *const module_inst)
 enable restricted mode of mcan module. More...
 
void mcan_disable_restricted_operation_mode (struct mcan_module *const module_inst)
 disable restricted mode of mcan module. More...
 
void mcan_enable_bus_monitor_mode (struct mcan_module *const module_inst)
 enable bus monitor mode of mcan module. More...
 
void mcan_disable_bus_monitor_mode (struct mcan_module *const module_inst)
 disable bus monitor mode of mcan module. More...
 
void mcan_enable_sleep_mode (struct mcan_module *const module_inst)
 enable sleep mode of mcan module. More...
 
void mcan_disable_sleep_mode (struct mcan_module *const module_inst)
 disable sleep mode of mcan module. More...
 
void mcan_enable_test_mode (struct mcan_module *const module_inst)
 enable test mode of mcan module. More...
 
void mcan_disable_test_mode (struct mcan_module *const module_inst)
 disable test mode of mcan module. More...
 
static uint16_t mcan_read_timestamp_count_value (struct mcan_module *const module_inst)
 Can read timestamp count value. More...
 
static uint16_t mcan_read_timeout_count_value (struct mcan_module *const module_inst)
 Can read timeout count value. More...
 
static uint32_t mcan_read_error_count (struct mcan_module *const module_inst)
 Can read error count. More...
 
static uint32_t mcan_read_protocal_status (struct mcan_module *const module_inst)
 Can read protocol status. More...
 

Rx Handling

enum  mcan_interrupt_source {
  MCAN_RX_FIFO_0_NEW_MESSAGE = MCAN_IE_RF0NE, MCAN_RX_FIFO_0_WATERMARK = MCAN_IE_RF0WE, MCAN_RX_FIFO_0_FULL = MCAN_IE_RF0FE, MCAN_RX_FIFO_0_LOST_MESSAGE = MCAN_IE_RF0LE,
  MCAN_RX_FIFO_1_NEW_MESSAGE = MCAN_IE_RF1NE, MCAN_RX_FIFO_1_WATERMARK = MCAN_IE_RF1WE, MCAN_RX_FIFO_1_FULL = MCAN_IE_RF1FE, MCAN_RX_FIFO_1_MESSAGE_LOST = MCAN_IE_RF1LE,
  MCAN_RX_HIGH_PRIORITY_MESSAGE = MCAN_IE_HPME, MCAN_TIMESTAMP_COMPLETE = MCAN_IE_TCE, MCAN_TX_CANCELLATION_FINISH = MCAN_IE_TCFE, MCAN_TX_FIFO_EMPTY = MCAN_IE_TFEE,
  MCAN_TX_EVENT_FIFO_NEW_ENTRY = MCAN_IE_TEFNE, MCAN_TX_EVENT_FIFO_WATERMARK = MCAN_IE_TEFWE, MCAN_TX_EVENT_FIFO_FULL = MCAN_IE_TEFFE, MCAN_TX_EVENT_FIFO_ELEMENT_LOST = MCAN_IE_TEFLE,
  MCAN_TIMESTAMP_WRAPAROUND = MCAN_IE_TSWE, MCAN_MESSAGE_RAM_ACCESS_FAILURE = MCAN_IE_MRAFE, MCAN_TIMEOUT_OCCURRED = MCAN_IE_TOOE, MCAN_RX_BUFFER_NEW_MESSAGE = MCAN_IE_DRXE,
  MCAN_ERROR_LOGGING_OVERFLOW = MCAN_IE_ELOE, MCAN_ERROR_PASSIVE = MCAN_IE_EPE, MCAN_WARNING_STATUS = MCAN_IE_EWE, MCAN_BUS_OFF = MCAN_IE_BOE,
  MCAN_WATCHDOG = MCAN_IE_WDIE, MCAN_CRC_ERROR = MCAN_IE_CRCEE, MCAN_BIT_ERROR = MCAN_IE_BEE, MCAN_ACKNOWLEDGE_ERROR = MCAN_IE_ACKEE,
  MCAN_FORMAT_ERROR = MCAN_IE_FOEE, MCAN_STUFF_ERROR = MCAN_IE_STEE
}
 Can module interrupt source. More...
 
static uint32_t mcan_read_high_priority_message_status (struct mcan_module *const module_inst)
 Read high priority message status. More...
 
static bool mcan_rx_get_buffer_status (struct mcan_module *const module_inst, uint32_t index)
 Get Rx buffer status. More...
 
static void mcan_rx_clear_buffer_status (struct mcan_module *const module_inst, uint32_t index)
 Clear Rx buffer status. More...
 
static uint32_t mcan_rx_get_fifo_status (struct mcan_module *const module_inst, bool fifo_number)
 Get Rx FIFO status. More...
 
static void mcan_rx_fifo_acknowledge (struct mcan_module *const module_inst, bool fifo_number, uint32_t index)
 Set Rx acknowledge. More...
 
static void mcan_get_standard_message_filter_element_default (struct mcan_standard_message_filter_element *sd_filter)
 Get the standard message filter default value. More...
 
enum status_code mcan_set_rx_standard_filter (struct mcan_module *const module_inst, struct mcan_standard_message_filter_element *sd_filter, uint32_t index)
 set standard receive CAN ID. More...
 
static void mcan_get_extended_message_filter_element_default (struct mcan_extended_message_filter_element *et_filter)
 Get the extended message filter default value. More...
 
enum status_code mcan_set_rx_extended_filter (struct mcan_module *const module_inst, struct mcan_extended_message_filter_element *et_filter, uint32_t index)
 set extended receive CAN ID. More...
 
enum status_code mcan_get_rx_buffer_element (struct mcan_module *const module_inst, struct mcan_rx_element_buffer *rx_element, uint32_t index)
 get dedicated rx buffer element . More...
 
enum status_code mcan_get_rx_fifo_0_element (struct mcan_module *const module_inst, struct mcan_rx_element_fifo_0 *rx_element, uint32_t index)
 get FIFO rx buffer element . More...
 
enum status_code mcan_get_rx_fifo_1_element (struct mcan_module *const module_inst, struct mcan_rx_element_fifo_1 *rx_element, uint32_t index)
 get FIFO rx buffer element . More...
 
static uint32_t mcan_tx_get_fifo_queue_status (struct mcan_module *const module_inst)
 Get Tx FIFO/Queue status. More...
 
static uint32_t mcan_tx_get_pending_status (struct mcan_module *const module_inst)
 Get Tx buffer request pending status. More...
 
static enum status_code mcan_tx_transfer_request (struct mcan_module *const module_inst, uint32_t trig_mask)
 Tx buffer add transfer request. More...
 
static enum status_code mcan_tx_cancel_request (struct mcan_module *const module_inst, uint32_t trig_mask)
 Set Tx Queue operation. More...
 
static uint32_t mcan_tx_get_transmission_status (struct mcan_module *const module_inst)
 Get Tx transmission status. More...
 
static uint32_t mcan_tx_get_cancellation_status (struct mcan_module *const module_inst)
 Get Tx cancellation status. More...
 
static uint32_t mcan_tx_get_event_fifo_status (struct mcan_module *const module_inst)
 Get Tx event FIFO status. More...
 
static void mcan_tx_event_fifo_acknowledge (struct mcan_module *const module_inst, uint32_t index)
 Set Tx Queue operation. More...
 
static void mcan_get_tx_buffer_element_defaults (struct mcan_tx_element *tx_element)
 Get the default transfer buffer element. More...
 
enum status_code mcan_set_tx_buffer_element (struct mcan_module *const module_inst, struct mcan_tx_element *tx_element, uint32_t index)
 set dedicated transmit buffer element . More...
 
enum status_code mcan_get_tx_event_fifo_element (struct mcan_module *const module_inst, struct mcan_tx_event_element *tx_event_element, uint32_t index)
 set FIFO transmit buffer element . More...
 
static void mcan_enable_interrupt (struct mcan_module *const module_inst, const enum mcan_interrupt_source source)
 Enable MCAN interrupt. More...
 
static void mcan_disable_interrupt (struct mcan_module *const module_inst, const enum mcan_interrupt_source source)
 Disable MCAN interrupt. More...
 
static uint32_t mcan_read_interrupt_status (struct mcan_module *const module_inst)
 Get MCAN interrupt status. More...
 
static void mcan_clear_interrupt_status (struct mcan_module *const module_inst, const enum mcan_interrupt_source source)
 Clear MCAN interrupt status. More...
 

Detailed Description

This driver for AtmelĀ® | SMART SAM devices provides an low level interface for the configuration and management of the device's Control Area Network functionality.

Note
Since "The Control Area Network (CAN) performs communication according to ISO 11898-1 (Bosch CAN specification 2.0 part A,B) and to Bosch CAN FD specification V1.0", the driver is focus on the MAC layer and try to offer the APIs which can be used by upper application layer.

For storage of Rx/Tx messages and for storage of the filter configuration, a message RAM is needed to the CAN module. In this driver, the message RAM is static allocated, the related setting is defined and can be changed in the module configuration file "conf_mcan.h".

The following peripherals are used by this module:

The following devices can use this module:

The outline of this documentation is as follows:

Prerequisites

There are no prerequisites for this module.

Module Overview

This driver provides an interface for the Control Area Network Controller functions on the device.

Special Considerations

There are no special considerations for this module.

Extra Information

For extra information see asfdoc_sam_mcan_extra. This includes:

Examples

For a list of examples related to this driver, see Examples for MCAN Driver.

API Overview

Enumeration Type Documentation

◆ mcan_interrupt_source

Can module interrupt source.

Enum for the interrupt source.

Enumerator
MCAN_RX_FIFO_0_NEW_MESSAGE 

Rx FIFO 0 New Message Interrupt Enable.

MCAN_RX_FIFO_0_WATERMARK 

Rx FIFO 0 Watermark Reached Interrupt Enable.

MCAN_RX_FIFO_0_FULL 

Rx FIFO 0 Full Interrupt Enable.

MCAN_RX_FIFO_0_LOST_MESSAGE 

Rx FIFO 0 Message Lost Interrupt Enable.

MCAN_RX_FIFO_1_NEW_MESSAGE 

Rx FIFO 1 New Message Interrupt Enable.

MCAN_RX_FIFO_1_WATERMARK 

Rx FIFO 1 Watermark Reached Interrupt Enable.

MCAN_RX_FIFO_1_FULL 

Rx FIFO 1 Full Interrupt Enable.

MCAN_RX_FIFO_1_MESSAGE_LOST 

Rx FIFO 1 Message Lost Interrupt Enable.

MCAN_RX_HIGH_PRIORITY_MESSAGE 

High Priority Message Interrupt Enable.

MCAN_TIMESTAMP_COMPLETE 

Transmission Completed Interrupt Enable.

MCAN_TX_CANCELLATION_FINISH 

Transmission Cancellation Finished Interrupt Enable.

MCAN_TX_FIFO_EMPTY 

Tx FIFO Empty Interrupt Enable.

MCAN_TX_EVENT_FIFO_NEW_ENTRY 

Tx Event FIFO New Entry Interrupt Enable.

MCAN_TX_EVENT_FIFO_WATERMARK 

Tx Event FIFO Watermark Reached Interrupt Enable.

MCAN_TX_EVENT_FIFO_FULL 

Tx Event FIFO Full Interrupt Enable.

MCAN_TX_EVENT_FIFO_ELEMENT_LOST 

Tx Event FIFO Element Lost Interrupt Enable.

MCAN_TIMESTAMP_WRAPAROUND 

Timestamp Wraparound Interrupt Enable.

MCAN_MESSAGE_RAM_ACCESS_FAILURE 

Message RAM Access Failure Interrupt Enable.

MCAN_TIMEOUT_OCCURRED 

Timeout Occurred Interrupt Enable.

MCAN_RX_BUFFER_NEW_MESSAGE 

Message stored to Dedicated Rx Buffer Interrupt Enable.

MCAN_ERROR_LOGGING_OVERFLOW 

Error Logging Overflow Interrupt Enable.

MCAN_ERROR_PASSIVE 

Error Passive Interrupt Enable.

MCAN_WARNING_STATUS 

Warning Status Interrupt Enable.

MCAN_BUS_OFF 

Bus_Off Status Interrupt Enable.

MCAN_WATCHDOG 

Watchdog Interrupt Enable.

MCAN_CRC_ERROR 

CRC Error Interrupt Enable

MCAN_BIT_ERROR 

Bit Error Interrupt Enable.

MCAN_ACKNOWLEDGE_ERROR 

Acknowledge Error Interrupt Enable .

MCAN_FORMAT_ERROR 

Format Error Interrupt Enable

MCAN_STUFF_ERROR 

Stuff Error Interrupt Enable

Definition at line 1079 of file drivers/mcan/mcan.h.

◆ mcan_nonmatching_frames_action

Can nonmatching frames action.

Enumerator
MCAN_NONMATCHING_FRAMES_FIFO_0 

Accept in Rx FIFO 0.

MCAN_NONMATCHING_FRAMES_FIFO_1 

Accept in Rx FIFO 1.

MCAN_NONMATCHING_FRAMES_REJECT 

Reject.

Definition at line 526 of file drivers/mcan/mcan.h.

◆ mcan_timeout_mode

Can time out modes.

Enumerator
MCAN_TIMEOUT_CONTINUES 

Continuous operation.

MCAN_TIMEOUT_TX_EVEN_FIFO 

Timeout controlled by TX Event FIFO.

MCAN_TIMEOUT_RX_FIFO_0 

Timeout controlled by Rx FIFO 0.

MCAN_TIMEOUT_RX_FIFO_1 

Timeout controlled by Rx FIFO 1.

Definition at line 511 of file drivers/mcan/mcan.h.

Function Documentation

◆ mcan_clear_interrupt_status()

static void mcan_clear_interrupt_status ( struct mcan_module *const  module_inst,
const enum mcan_interrupt_source  source 
)
inlinestatic

Clear MCAN interrupt status.

Parameters
[in]module_instPointer to the MCAN software instance struct
[in]sourceInterrupt source type
Returns
Bit mask of interrupt status value.

Definition at line 1185 of file drivers/mcan/mcan.h.

◆ mcan_disable_bus_monitor_mode()

void mcan_disable_bus_monitor_mode ( struct mcan_module *const  module_inst)

disable bus monitor mode of mcan module.

Parameters
module_instMCAN instance

Definition at line 479 of file mcan.c.

◆ mcan_disable_fd_mode()

void mcan_disable_fd_mode ( struct mcan_module *const  module_inst)

disable fd mode of mcan module.

Parameters
module_instMCAN instance

Definition at line 415 of file mcan.c.

◆ mcan_disable_interrupt()

static void mcan_disable_interrupt ( struct mcan_module *const  module_inst,
const enum mcan_interrupt_source  source 
)
inlinestatic

Disable MCAN interrupt.

Parameters
[in]module_instPointer to the MCAN software instance struct
[in]sourceInterrupt source type

Definition at line 1160 of file drivers/mcan/mcan.h.

◆ mcan_disable_restricted_operation_mode()

void mcan_disable_restricted_operation_mode ( struct mcan_module *const  module_inst)

disable restricted mode of mcan module.

Parameters
module_instMCAN instance

Definition at line 451 of file mcan.c.

◆ mcan_disable_sleep_mode()

void mcan_disable_sleep_mode ( struct mcan_module *const  module_inst)

disable sleep mode of mcan module.

Parameters
module_instMCAN instance

Definition at line 505 of file mcan.c.

◆ mcan_disable_test_mode()

void mcan_disable_test_mode ( struct mcan_module *const  module_inst)

disable test mode of mcan module.

Parameters
module_instMCAN instance

Definition at line 537 of file mcan.c.

◆ mcan_enable_bus_monitor_mode()

void mcan_enable_bus_monitor_mode ( struct mcan_module *const  module_inst)

enable bus monitor mode of mcan module.

Parameters
module_instMCAN instance

Definition at line 463 of file mcan.c.

◆ mcan_enable_fd_mode()

void mcan_enable_fd_mode ( struct mcan_module *const  module_inst)

switch mcan module into fd mode.

Parameters
module_instMCAN instance

Definition at line 394 of file mcan.c.

◆ mcan_enable_interrupt()

static void mcan_enable_interrupt ( struct mcan_module *const  module_inst,
const enum mcan_interrupt_source  source 
)
inlinestatic

Enable MCAN interrupt.

Parameters
[in]module_instPointer to the MCAN software instance struct
[in]sourceInterrupt source type

Definition at line 1148 of file drivers/mcan/mcan.h.

◆ mcan_enable_restricted_operation_mode()

void mcan_enable_restricted_operation_mode ( struct mcan_module *const  module_inst)

enable restricted mode of mcan module.

Parameters
module_instMCAN instance

Definition at line 434 of file mcan.c.

◆ mcan_enable_sleep_mode()

void mcan_enable_sleep_mode ( struct mcan_module *const  module_inst)

enable sleep mode of mcan module.

Parameters
module_instMCAN instance

Definition at line 490 of file mcan.c.

◆ mcan_enable_test_mode()

void mcan_enable_test_mode ( struct mcan_module *const  module_inst)

enable test mode of mcan module.

Parameters
module_instMCAN instance

Definition at line 520 of file mcan.c.

◆ mcan_fd_set_baudrate()

void mcan_fd_set_baudrate ( Mcan hw,
uint32_t  baudrate 
)

Set MCAN_FD baudrate.

Parameters
[in]hwPointer to the MCAN_FD module instance
[in]baudrateMCAN_FD baudrate

Definition at line 340 of file mcan.c.

◆ mcan_get_config_defaults()

static void mcan_get_config_defaults ( struct mcan_config *const  config)
inlinestatic

Initializes an MCAN configuration structure to defaults.

Initializes a given MCAN configuration struct to a set of known default values. This function should be called on any new instance of the configuration struct before being modified by the user application.

The default configuration is as follows:

  • Not run in standby mode
  • Disable Watchdog
  • Transmit pause enabled
  • Edge filtering during bus integration enabled
  • Protocol exception handling enabled
  • Automatic retransmission enabled
  • Clock stop request disabled
  • Clock stop acknowledge disabled
  • Timestamp Counter Prescaler 1
  • Timeout Period with 0xFFFF
  • Timeout Mode: Continuous operation
  • Disable Timeout
  • Transmitter Delay Compensation Offset is 0
  • Transmitter Delay Compensation Filter Window Length is 0
  • Reject nonmatching standard frames
  • Reject nonmatching extended frames
  • Reject remote standard frames
  • Reject remote extended frames
  • Extended ID Mask is 0x1FFFFFFF
  • Rx FIFO 0 Operation Mode: overwrite
  • Disable Rx FIFO 0 Watermark
  • Rx FIFO 1 Operation Mode: overwrite
  • Disable Rx FIFO 1 Watermark
  • Tx FIFO/Queue Mode: FIFO
  • Disable Tx Event FIFO Watermark
Parameters
[out]configPointer to configuration struct to initialize to default values

Definition at line 652 of file drivers/mcan/mcan.h.

◆ mcan_get_extended_message_filter_element_default()

static void mcan_get_extended_message_filter_element_default ( struct mcan_extended_message_filter_element et_filter)
inlinestatic

Get the extended message filter default value.

The default configuration is as follows:

  • Classic filter: SFID1 = filter, SFID2 = mask
  • Store in Rx FIFO 1 if filter matches
  • SFID2 = 0x1FFFFFFFul
  • SFID1 = 0x0ul
Parameters
[out]et_filterPointer to extended filter element struct to initialize to default values

Definition at line 900 of file drivers/mcan/mcan.h.

◆ mcan_get_rx_buffer_element()

enum status_code mcan_get_rx_buffer_element ( struct mcan_module *const  module_inst,
struct mcan_rx_element_buffer rx_element,
uint32_t  index 
)

get dedicated rx buffer element .

Parameters
module_instMCAN instance
rx_elementstructure of element
indexCAN messages memory index for receiving CAN ID
Returns
status code.

Definition at line 599 of file mcan.c.

◆ mcan_get_rx_fifo_0_element()

enum status_code mcan_get_rx_fifo_0_element ( struct mcan_module *const  module_inst,
struct mcan_rx_element_fifo_0 rx_element,
uint32_t  index 
)

get FIFO rx buffer element .

Parameters
module_instMCAN instance
rx_elementstructure of element
indexCAN messages memory index for receiving CAN ID
Returns
status code.

Definition at line 622 of file mcan.c.

◆ mcan_get_rx_fifo_1_element()

enum status_code mcan_get_rx_fifo_1_element ( struct mcan_module *const  module_inst,
struct mcan_rx_element_fifo_1 rx_element,
uint32_t  index 
)

get FIFO rx buffer element .

Parameters
module_instMCAN instance
rx_elementstructure of element
indexCAN messages memory index for receiving CAN ID
Returns
status code.

Definition at line 645 of file mcan.c.

◆ mcan_get_standard_message_filter_element_default()

static void mcan_get_standard_message_filter_element_default ( struct mcan_standard_message_filter_element sd_filter)
inlinestatic

Get the standard message filter default value.

The default configuration is as follows:

  • Classic filter: SFID1 = filter, SFID2 = mask
  • Store in Rx FIFO 0 if filter matches
  • SFID2 = 0x7FFul
  • SFID1 = 0x0ul
Parameters
[out]sd_filterPointer to standard filter element struct to initialize to default values

Definition at line 875 of file drivers/mcan/mcan.h.

◆ mcan_get_tx_buffer_element_defaults()

static void mcan_get_tx_buffer_element_defaults ( struct mcan_tx_element tx_element)
inlinestatic

Get the default transfer buffer element.

The default configuration is as follows:

  • 11-bit standard identifier
  • Transmit data frame
  • ID = 0x0ul
  • Store Tx events
  • Frame transmitted in Classic MCAN format
  • Data Length Code is 8
Parameters
[out]tx_elementPointer to transfer element struct to initialize to default values

Definition at line 1058 of file drivers/mcan/mcan.h.

◆ mcan_get_tx_event_fifo_element()

enum status_code mcan_get_tx_event_fifo_element ( struct mcan_module *const  module_inst,
struct mcan_tx_event_element tx_event_element,
uint32_t  index 
)

set FIFO transmit buffer element .

Parameters
module_instMCAN instance
tx_elementstructure of element
indexCAN messages memory index for transmitting CAN ID
Returns
status code.

Definition at line 700 of file mcan.c.

◆ mcan_init()

void mcan_init ( struct mcan_module *const  module_inst,
Mcan hw,
struct mcan_config config 
)

initialize can module.

Parameters
module_instMCAN instance
hwBase address of MCAN.
configdefault configuration .

Definition at line 270 of file mcan.c.

◆ mcan_read_error_count()

static uint32_t mcan_read_error_count ( struct mcan_module *const  module_inst)
inlinestatic

Can read error count.

Parameters
[in]module_instPointer to the MCAN software instance struct
Returns
Error count value.

Definition at line 742 of file drivers/mcan/mcan.h.

◆ mcan_read_high_priority_message_status()

static uint32_t mcan_read_high_priority_message_status ( struct mcan_module *const  module_inst)
inlinestatic

Read high priority message status.

Parameters
[in]module_instPointer to the MCAN software instance struct
Returns
High priority message status value.

Definition at line 775 of file drivers/mcan/mcan.h.

◆ mcan_read_interrupt_status()

static uint32_t mcan_read_interrupt_status ( struct mcan_module *const  module_inst)
inlinestatic

Get MCAN interrupt status.

Parameters
[in]module_instPointer to the MCAN software instance struct

Definition at line 1171 of file drivers/mcan/mcan.h.

◆ mcan_read_protocal_status()

static uint32_t mcan_read_protocal_status ( struct mcan_module *const  module_inst)
inlinestatic

Can read protocol status.

Parameters
[in]module_instPointer to the MCAN software instance struct
Returns
protocol status value.

Definition at line 755 of file drivers/mcan/mcan.h.

◆ mcan_read_timeout_count_value()

static uint16_t mcan_read_timeout_count_value ( struct mcan_module *const  module_inst)
inlinestatic

Can read timeout count value.

Parameters
[in]module_instPointer to the MCAN software instance struct
Returns
Timeout count value.

Definition at line 729 of file drivers/mcan/mcan.h.

◆ mcan_read_timestamp_count_value()

static uint16_t mcan_read_timestamp_count_value ( struct mcan_module *const  module_inst)
inlinestatic

Can read timestamp count value.

Parameters
[in]module_instPointer to the MCAN software instance struct
Returns
Timestamp count value.

Definition at line 716 of file drivers/mcan/mcan.h.

◆ mcan_rx_clear_buffer_status()

static void mcan_rx_clear_buffer_status ( struct mcan_module *const  module_inst,
uint32_t  index 
)
inlinestatic

Clear Rx buffer status.

Parameters
[in]module_instPointer to the MCAN software instance struct
[in]indexIndex offset in Rx buffer

Definition at line 818 of file drivers/mcan/mcan.h.

◆ mcan_rx_fifo_acknowledge()

static void mcan_rx_fifo_acknowledge ( struct mcan_module *const  module_inst,
bool  fifo_number,
uint32_t  index 
)
inlinestatic

Set Rx acknowledge.

Parameters
[in]module_instPointer to the MCAN software instance struct
[in]fifo_numberRx FIFO 0 or 1
[in]indexIndex offset in FIFO

Definition at line 854 of file drivers/mcan/mcan.h.

◆ mcan_rx_get_buffer_status()

static bool mcan_rx_get_buffer_status ( struct mcan_module *const  module_inst,
uint32_t  index 
)
inlinestatic

Get Rx buffer status.

Parameters
[in]module_instPointer to the MCAN software instance struct
[in]indexIndex offset in Rx buffer
Returns
Rx buffer status value.
Return values
trueRx Buffer updated from new message.
falseRx Buffer not updated.

Definition at line 792 of file drivers/mcan/mcan.h.

◆ mcan_rx_get_fifo_status()

static uint32_t mcan_rx_get_fifo_status ( struct mcan_module *const  module_inst,
bool  fifo_number 
)
inlinestatic

Get Rx FIFO status.

Parameters
[in]module_instPointer to the MCAN software instance struct
[in]fifo_numberRx FIFO 0 or 1
Returns
Rx FIFO status value.

Definition at line 837 of file drivers/mcan/mcan.h.

◆ mcan_set_baudrate()

void mcan_set_baudrate ( Mcan hw,
uint32_t  baudrate 
)

Set MCAN baudrate.

Parameters
[in]hwPointer to the MCAN module instance
[in]baudrateMCAN baudrate

Definition at line 311 of file mcan.c.

◆ mcan_set_rx_extended_filter()

enum status_code mcan_set_rx_extended_filter ( struct mcan_module *const  module_inst,
struct mcan_extended_message_filter_element et_filter,
uint32_t  index 
)

set extended receive CAN ID.

Parameters
module_instMCAN instance
sd_filterstructure of extended CAN ID
indexCAN messages memory index for different CAN ID
Returns
status code.

Definition at line 574 of file mcan.c.

◆ mcan_set_rx_standard_filter()

enum status_code mcan_set_rx_standard_filter ( struct mcan_module *const  module_inst,
struct mcan_standard_message_filter_element sd_filter,
uint32_t  index 
)

set standard receive CAN ID.

Parameters
module_instMCAN instance
sd_filterstructure of CAN ID
indexCAN messages memory index for different CAN ID
Returns
status code.

Definition at line 551 of file mcan.c.

◆ mcan_set_tx_buffer_element()

enum status_code mcan_set_tx_buffer_element ( struct mcan_module *const  module_inst,
struct mcan_tx_element tx_element,
uint32_t  index 
)

set dedicated transmit buffer element .

Parameters
module_instMCAN instance
tx_elementstructure of element
indexCAN messages memory index for transmitting CAN ID
Returns
status code.

Definition at line 668 of file mcan.c.

◆ mcan_start()

void mcan_start ( struct mcan_module *const  module_inst)

start can module after initialization.

Parameters
module_instMCAN instance

Definition at line 368 of file mcan.c.

◆ mcan_stop()

void mcan_stop ( struct mcan_module *const  module_inst)

stop mcan module when bus off occurs

Parameters
module_instMCAN instance

Definition at line 381 of file mcan.c.

◆ mcan_tx_cancel_request()

static enum status_code mcan_tx_cancel_request ( struct mcan_module *const  module_inst,
uint32_t  trig_mask 
)
inlinestatic

Set Tx Queue operation.

Parameters
[in]module_instPointer to the MCAN software instance struct
[in]trig_maskThe mask value to cancel transfer buffer
Returns
Status of the result.
Return values
STATUS_OKSet the transfer request.
STATUS_BUSYThe module is in configuration.

Definition at line 984 of file drivers/mcan/mcan.h.

◆ mcan_tx_event_fifo_acknowledge()

static void mcan_tx_event_fifo_acknowledge ( struct mcan_module *const  module_inst,
uint32_t  index 
)
inlinestatic

Set Tx Queue operation.

Parameters
[in]module_instPointer to the MCAN software instance struct
[in]indexIndex for the transfer FIFO

Definition at line 1039 of file drivers/mcan/mcan.h.

◆ mcan_tx_get_cancellation_status()

static uint32_t mcan_tx_get_cancellation_status ( struct mcan_module *const  module_inst)
inlinestatic

Get Tx cancellation status.

Parameters
[in]module_instPointer to the MCAN software instance struct
Returns
Bit mask of Tx cancellation status value.

Definition at line 1014 of file drivers/mcan/mcan.h.

◆ mcan_tx_get_event_fifo_status()

static uint32_t mcan_tx_get_event_fifo_status ( struct mcan_module *const  module_inst)
inlinestatic

Get Tx event FIFO status.

Parameters
[in]module_instPointer to the MCAN software instance struct
Returns
Tx event FIFO status value.

Definition at line 1027 of file drivers/mcan/mcan.h.

◆ mcan_tx_get_fifo_queue_status()

static uint32_t mcan_tx_get_fifo_queue_status ( struct mcan_module *const  module_inst)
inlinestatic

Get Tx FIFO/Queue status.

Parameters
[in]module_instPointer to the MCAN software instance struct
Returns
Tx FIFO/Queue status value.

Definition at line 933 of file drivers/mcan/mcan.h.

◆ mcan_tx_get_pending_status()

static uint32_t mcan_tx_get_pending_status ( struct mcan_module *const  module_inst)
inlinestatic

Get Tx buffer request pending status.

Parameters
[in]module_instPointer to the MCAN software instance struct
Returns
Bit mask of Tx buffer request pending status value.

Definition at line 946 of file drivers/mcan/mcan.h.

◆ mcan_tx_get_transmission_status()

static uint32_t mcan_tx_get_transmission_status ( struct mcan_module *const  module_inst)
inlinestatic

Get Tx transmission status.

Parameters
[in]module_instPointer to the MCAN software instance struct
Returns
Bit mask of Tx transmission status value.

Definition at line 1001 of file drivers/mcan/mcan.h.

◆ mcan_tx_transfer_request()

static enum status_code mcan_tx_transfer_request ( struct mcan_module *const  module_inst,
uint32_t  trig_mask 
)
inlinestatic

Tx buffer add transfer request.

Parameters
[in]module_instPointer to the MCAN software instance struct
[in]trig_maskThe mask value to trigger transfer buffer
Returns
Status of the result.
Return values
STATUS_OKSet the transfer request.
STATUS_ERR_BUSYThe module is in configuration.

Definition at line 963 of file drivers/mcan/mcan.h.



inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:18:01