![]() |
S32 SDK
|
#include <assert.h>
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "device_registers.h"
#include "status.h"
Go to the source code of this file.
Data Structures | |
struct | flexcan_id_table_t |
FlexCAN RX FIFO ID filter table structure Implements : flexcan_id_table_t_Class. More... | |
struct | flexcan_buserr_counter_t |
FlexCAN bus error counters Implements : flexcan_buserr_counter_t_Class. More... | |
struct | flexcan_msgbuff_code_status_t |
FlexCAN Message Buffer code and status for transmit and receive Implements : flexcan_msgbuff_code_status_t_Class. More... | |
struct | flexcan_msgbuff_t |
FlexCAN message buffer structure Implements : flexcan_msgbuff_t_Class. More... | |
struct | flexcan_time_segment_t |
FlexCAN timing related structures Implements : flexcan_time_segment_t_Class. More... | |
struct | flexcan_pn_id_filter_t |
Pretended Networking ID filter. More... | |
struct | flexcan_pn_payload_filter_t |
Pretended Networking payload filter. More... | |
struct | flexcan_pn_config_t |
Pretended Networking configuration structure Implements : flexcan_pn_config_t_Class. More... | |
Macros | |
#define | CAN_ID_EXT_MASK 0x3FFFFu |
#define | CAN_ID_EXT_SHIFT 0 |
#define | CAN_ID_EXT_WIDTH 18 |
#define | CAN_ID_STD_MASK 0x1FFC0000u |
#define | CAN_ID_STD_SHIFT 18 |
#define | CAN_ID_STD_WIDTH 11 |
#define | CAN_ID_PRIO_MASK 0xE0000000u |
#define | CAN_ID_PRIO_SHIFT 29 |
#define | CAN_ID_PRIO_WIDTH 3 |
#define | CAN_CS_TIME_STAMP_MASK 0xFFFFu |
#define | CAN_CS_TIME_STAMP_SHIFT 0 |
#define | CAN_CS_TIME_STAMP_WIDTH 16 |
#define | CAN_CS_DLC_MASK 0xF0000u |
#define | CAN_CS_DLC_SHIFT 16 |
#define | CAN_CS_DLC_WIDTH 4 |
#define | CAN_CS_RTR_MASK 0x100000u |
#define | CAN_CS_RTR_SHIFT 20 |
#define | CAN_CS_RTR_WIDTH 1 |
#define | CAN_CS_IDE_MASK 0x200000u |
#define | CAN_CS_IDE_SHIFT 21 |
#define | CAN_CS_IDE_WIDTH 1 |
#define | CAN_CS_SRR_MASK 0x400000u |
#define | CAN_CS_SRR_SHIFT 22 |
#define | CAN_CS_SRR_WIDTH 1 |
#define | CAN_CS_CODE_MASK 0xF000000u |
#define | CAN_CS_CODE_SHIFT 24 |
#define | CAN_CS_CODE_WIDTH 4 |
#define | CAN_MB_EDL_MASK 0x80000000u |
#define | CAN_MB_BRS_MASK 0x40000000u |
Functions | |
Configuration | |
void | FLEXCAN_HAL_Enable (CAN_Type *base) |
Enables FlexCAN controller. More... | |
void | FLEXCAN_HAL_Disable (CAN_Type *base) |
Disables FlexCAN controller. More... | |
void | FLEXCAN_HAL_SelectClock (CAN_Type *base, flexcan_clk_source_t clk) |
Selects the clock source for FlexCAN. More... | |
static bool | FLEXCAN_HAL_GetClock (const CAN_Type *base) |
Reads the clock source for FlexCAN Protocol Engine (PE). More... | |
void | FLEXCAN_HAL_Init (CAN_Type *base) |
Initializes the FlexCAN controller. More... | |
void | FLEXCAN_HAL_SetTimeSegments (CAN_Type *base, const flexcan_time_segment_t *timeSeg) |
Sets the FlexCAN time segments for setting up bit rate. More... | |
void | FLEXCAN_HAL_SetTimeSegmentsCbt (CAN_Type *base, const flexcan_time_segment_t *timeSeg) |
Sets the FlexCAN time segments for setting up bit rate for FD BRS. More... | |
void | FLEXCAN_HAL_GetTimeSegments (const CAN_Type *base, flexcan_time_segment_t *timeSeg) |
Gets the FlexCAN time segments to calculate the bit rate. More... | |
void | FLEXCAN_HAL_ExitFreezeMode (CAN_Type *base) |
Un freezes the FlexCAN module. More... | |
void | FLEXCAN_HAL_EnterFreezeMode (CAN_Type *base) |
Freezes the FlexCAN module. More... | |
void | FLEXCAN_HAL_SetOperationMode (CAN_Type *base, flexcan_operation_modes_t mode) |
Set operation mode. More... | |
void | FLEXCAN_HAL_ExitOperationMode (CAN_Type *base, flexcan_operation_modes_t mode) |
Exit operation mode. More... | |
void | FLEXCAN_HAL_SetFDEnabled (CAN_Type *base, bool enable) |
Enables/Disables Flexible Data rate (if supported). More... | |
bool | FLEXCAN_HAL_IsFDEnabled (const CAN_Type *base) |
Checks if the Flexible Data rate feature is enabled. More... | |
void | FLEXCAN_HAL_SetPayloadSize (CAN_Type *base, flexcan_fd_payload_size_t payloadSize) |
Sets the payload size of the MBs. More... | |
uint8_t | FLEXCAN_HAL_GetPayloadSize (const CAN_Type *base) |
Gets the payload size of the MBs. More... | |
Data transfer | |
status_t | FLEXCAN_HAL_SetTxMsgBuff (CAN_Type *base, uint32_t msgBuffIdx, const flexcan_msgbuff_code_status_t *cs, uint32_t msgId, const uint8_t *msgData) |
Sets the FlexCAN message buffer fields for transmitting. More... | |
status_t | FLEXCAN_HAL_SetRxMsgBuff (CAN_Type *base, uint32_t msgBuffIdx, const flexcan_msgbuff_code_status_t *cs, uint32_t msgId) |
Sets the FlexCAN message buffer fields for receiving. More... | |
status_t | FLEXCAN_HAL_GetMsgBuff (CAN_Type *base, uint32_t msgBuffIdx, flexcan_msgbuff_t *msgBuff) |
Gets the FlexCAN message buffer fields. More... | |
status_t | FLEXCAN_HAL_LockRxMsgBuff (CAN_Type *base, uint32_t msgBuffIdx) |
Locks the FlexCAN Rx message buffer. More... | |
static void | FLEXCAN_HAL_UnlockRxMsgBuff (const CAN_Type *base) |
Unlocks the FlexCAN Rx message buffer. More... | |
status_t | FLEXCAN_HAL_EnableRxFifo (CAN_Type *base, uint32_t numOfFilters) |
Enables the Rx FIFO. More... | |
void | FLEXCAN_HAL_DisableRxFifo (CAN_Type *base) |
Disables the Rx FIFO. More... | |
static bool | FLEXCAN_HAL_IsRxFifoEnabled (const CAN_Type *base) |
Checks if Rx FIFO is enabled. More... | |
void | FLEXCAN_HAL_SetRxFifoFilterNum (CAN_Type *base, uint32_t number) |
Sets the number of the Rx FIFO filters. More... | |
status_t | FLEXCAN_HAL_SetMaxMsgBuffNum (CAN_Type *base, uint32_t maxMsgBuffNum) |
Sets the maximum number of Message Buffers. More... | |
void | FLEXCAN_HAL_SetRxFifoFilter (CAN_Type *base, flexcan_rx_fifo_id_element_format_t idFormat, const flexcan_id_table_t *idFilterTable) |
Sets the FlexCAN Rx FIFO fields. More... | |
void | FLEXCAN_HAL_ReadRxFifo (const CAN_Type *base, flexcan_msgbuff_t *rxFifo) |
Gets the FlexCAN Rx FIFO data. More... | |
Interrupts | |
status_t | FLEXCAN_HAL_SetMsgBuffIntCmd (CAN_Type *base, uint32_t msgBuffIdx, bool enable) |
Enables/Disables the FlexCAN Message Buffer interrupt. More... | |
void | FLEXCAN_HAL_SetErrIntCmd (CAN_Type *base, flexcan_int_type_t errType, bool enable) |
Enables error interrupt of the FlexCAN module. More... | |
Status | |
static uint32_t | FLEXCAN_HAL_GetFreezeAck (const CAN_Type *base) |
Gets the value of FlexCAN freeze ACK. More... | |
uint8_t | FLEXCAN_HAL_GetMsgBuffIntStatusFlag (const CAN_Type *base, uint32_t msgBuffIdx) |
Gets the individual FlexCAN MB interrupt flag. More... | |
static uint32_t | FLEXCAN_HAL_GetAllMsgBuffIntStatusFlag (const CAN_Type *base) |
Gets all FlexCAN Message Buffer interrupt flags. More... | |
static void | FLEXCAN_HAL_ClearMsgBuffIntStatusFlag (CAN_Type *base, uint32_t flag) |
Clears the interrupt flag of the message buffers. More... | |
void | FLEXCAN_HAL_GetErrCounter (const CAN_Type *base, flexcan_buserr_counter_t *errCount) |
Gets the transmit error counter and receives the error counter. More... | |
static uint32_t | FLEXCAN_HAL_GetErrStatus (const CAN_Type *base) |
Gets error and status. More... | |
void | FLEXCAN_HAL_ClearErrIntStatusFlag (CAN_Type *base) |
Clears all other interrupts in ERRSTAT register (Error, Busoff, Wakeup). More... | |
Mask | |
void | FLEXCAN_HAL_SetRxMaskType (CAN_Type *base, flexcan_rx_mask_type_t type) |
Sets the Rx masking type. More... | |
void | FLEXCAN_HAL_SetRxFifoGlobalStdMask (CAN_Type *base, uint32_t stdMask) |
Sets the FlexCAN RX FIFO global standard mask. More... | |
void | FLEXCAN_HAL_SetRxFifoGlobalExtMask (CAN_Type *base, uint32_t extMask) |
Sets the FlexCAN Rx FIFO global extended mask. More... | |
status_t | FLEXCAN_HAL_SetRxIndividualStdMask (CAN_Type *base, uint32_t msgBuffIdx, uint32_t stdMask) |
Sets the FlexCAN Rx individual standard mask for ID filtering in the Rx MBs and the Rx FIFO. More... | |
status_t | FLEXCAN_HAL_SetRxIndividualExtMask (CAN_Type *base, uint32_t msgBuffIdx, uint32_t extMask) |
Sets the FlexCAN Rx individual extended mask for ID filtering in the Rx Message Buffers and the Rx FIFO. More... | |
void | FLEXCAN_HAL_SetRxMsgBuffGlobalStdMask (CAN_Type *base, uint32_t stdMask) |
Sets the FlexCAN Rx Message Buffer global standard mask. More... | |
void | FLEXCAN_HAL_SetRxMsgBuff14StdMask (CAN_Type *base, uint32_t stdMask) |
Sets the FlexCAN RX Message Buffer BUF14 standard mask. More... | |
void | FLEXCAN_HAL_SetRxMsgBuff15StdMask (CAN_Type *base, uint32_t stdMask) |
Sets the FlexCAN Rx Message Buffer BUF15 standard mask. More... | |
void | FLEXCAN_HAL_SetRxMsgBuffGlobalExtMask (CAN_Type *base, uint32_t extMask) |
Sets the FlexCAN RX Message Buffer global extended mask. More... | |
void | FLEXCAN_HAL_SetRxMsgBuff14ExtMask (CAN_Type *base, uint32_t extMask) |
Sets the FlexCAN RX Message Buffer BUF14 extended mask. More... | |
void | FLEXCAN_HAL_SetRxMsgBuff15ExtMask (CAN_Type *base, uint32_t extMask) |
Sets the FlexCAN RX MB BUF15 extended mask. More... | |
static uint32_t | FLEXCAN_HAL_GetRxFifoHitIdAcceptanceFilter (const CAN_Type *base) |
Gets the FlexCAN ID acceptance filter hit indicator on Rx FIFO. More... | |
void | FLEXCAN_HAL_SetStuffBitCount (CAN_Type *base, bool enable) |
Enables/Disables the Stuff Bit Count for CAN FD frames. More... | |
void | FLEXCAN_HAL_SetSelfReception (CAN_Type *base, bool enable) |
Enables/Disables the Self Reception feature. More... | |
status_t | FLEXCAN_HAL_SetRxFifoDMA (CAN_Type *base, bool enable) |
Enables/Disables the DMA support for RxFIFO. More... | |
void | FLEXCAN_HAL_SetTDCOffset (CAN_Type *base, bool enable, uint8_t offset) |
Enables/Disables the Transceiver Delay Compensation feature and sets the Transceiver Delay Compensation Offset (offset value to be added to the measured transceiver's loop delay in order to define the position of the delayed comparison point when bit rate switching is active). More... | |
static uint8_t | FLEXCAN_HAL_GetTDCValue (const CAN_Type *base) |
Gets the value of the Transceiver Delay Compensation. More... | |
static bool | FLEXCAN_HAL_GetTDCFail (const CAN_Type *base) |
Gets the value of the TDC Fail flag. More... | |
static void | FLEXCAN_HAL_ClearTDCFail (CAN_Type *base) |
Clears the TDC Fail flag. More... | |
void | FLEXCAN_HAL_ConfigPN (CAN_Type *base, const flexcan_pn_config_t *pnConfig) |
Configures the Pretended Networking mode. More... | |
void | FLEXCAN_HAL_GetWMB (const CAN_Type *base, uint8_t wmbIndex, flexcan_msgbuff_t *wmb) |
Extracts one of the frames which triggered the wake up event. More... | |
static void | FLEXCAN_HAL_SetPN (CAN_Type *base, bool enable) |
Enables/Disables the Pretended Networking mode. More... | |