PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

Functions
Functions
PDL API Reference » CAN FD (CAN with Flexible Data-Rate)

## General Description

## Functions
__STATIC_INLINE void | Cy_CANFD_Enable (CANFD_Type *base, uint32_t channelMask)
| Enables the CAN FD channels. More...
__STATIC_INLINE cy_en_canfd_status_t | Cy_CANFD_Disable (CANFD_Type *base, uint32_t channelMask)
| Disables the CAN FD channels to stop providing clocks to un-used CAN channels for power saving with this functionality. More...
__STATIC_INLINE void | Cy_CANFD_EnableMRAM (CANFD_Type *base, uint32_t channelMask, uint16_t delay)
| Switches MRAM on and enables the channels. More...
__STATIC_INLINE cy_en_canfd_status_t | Cy_CANFD_DisableMRAM (CANFD_Type *base)
| Disables the channels and switches MRAM off. More...
__STATIC_INLINE void | Cy_CANFD_SetBitrate (CANFD_Type *base, uint32_t chan, const cy_stc_canfd_bitrate_t *bitrate)
| Sets Nominal Bit Timing and Prescaler Register parameters: -Nominal Time segment after sample point; -Nominal Time segment before sample point; -Nominal Baud Rate Prescaler; -Nominal Synchronization Jump Width. More...
__STATIC_INLINE void | Cy_CANFD_SetFastBitrate (CANFD_Type *base, uint32_t chan, const cy_stc_canfd_bitrate_t *fastBitrate)
| Sets Data Bit Timing and Prescaler Register parameters for data: -Data Time segment after sample point; -Data Time segment before sample point; -Data Baud Rate Prescaler; -Data Synchronization Jump Width. More...
void | Cy_CANFD_SidFilterSetup (CANFD_Type const *base, uint32_t chan, const cy_stc_id_filter_t *filter, uint32_t index, cy_stc_canfd_context_t const *context)
| Updates the Standard Message ID Filter Element configuration in Message RAM. More...
void | Cy_CANFD_SidFiltersSetup (CANFD_Type const *base, uint32_t chan, const cy_stc_canfd_sid_filter_config_t *filterConfig, cy_stc_canfd_context_t const *context)
| Updates the Standard Message ID Filters configuration in Message RAM. More...
void | Cy_CANFD_XidFilterSetup (CANFD_Type const *base, uint32_t chan, const cy_stc_extid_filter_t *filter, uint32_t index, cy_stc_canfd_context_t const *context)
| Updates the Extended Message ID Filter Element configuration in Message RAM. More...
void | Cy_CANFD_XidFiltersSetup (CANFD_Type const *base, uint32_t chan, const cy_stc_canfd_extid_filter_config_t *filterConfig, cy_stc_canfd_context_t const *context)
| Updates the Extended Message ID Filters configuration in Message RAM. More...
cy_en_canfd_status_t | Cy_CANFD_TxBufferConfig (CANFD_Type const *base, uint32_t chan, const cy_stc_canfd_tx_buffer_t *txBuffer, uint8_t index, cy_stc_canfd_context_t const *context)
| Updates the T0 and T1 Tx buffer element parameters in Message RAM and copies data from cy_stc_canfd_tx_buffer_t structure to Message RAM. More...
uint32_t | Cy_CANFD_CalcRxBufAdrs (CANFD_Type const *base, uint32_t chan, uint32_t index, cy_stc_canfd_context_t const *context)
| Calculates the address of the RX buffer element. More...
uint32_t | Cy_CANFD_CalcRxFifoAdrs (CANFD_Type const *base, uint32_t chan, uint32_t fifoNumber, uint32_t index, cy_stc_canfd_context_t const *context)
| Calculates the address of the RX FIFO element. More...
cy_en_canfd_status_t | Cy_CANFD_GetRxBuffer (CANFD_Type const *base, uint32_t chan, const uint32_t bufferAddress, cy_stc_canfd_rx_buffer_t const *rxBuffer)
| Extracts the RX Buffer from Message RAM. More...
cy_en_canfd_status_t | Cy_CANFD_GetFIFOTop (CANFD_Type const *base, uint32_t chan, const uint8_t FIFONumber, cy_stc_canfd_rx_buffer_t const *rxBuffer)
| Extracts one RX FIFO Buffer element using the FIFO TOP register logic. More...
cy_en_canfd_status_t | Cy_CANFD_ExtractMsgFromRXBuffer (CANFD_Type *base, uint32_t chan, bool rxFIFOMsg, uint8_t msgBufOrRxFIFONum, cy_stc_canfd_rx_buffer_t const *rxBuffer, cy_stc_canfd_context_t const *context)
| Extracts one RX buffer or one FIFO buffer element. More...
void | Cy_CANFD_AckRxBuf (CANFD_Type *base, uint32_t chan, uint32_t bufNum)
| Acknowledges the data reading and makes the buffer element available for a next message. More...
void | Cy_CANFD_AckRxFifo (CANFD_Type *base, uint32_t chan, uint32_t FIFOnumber)
| Acknowledges the data reading and makes the buffer element available for a next message. More...
__STATIC_INLINE cy_en_canfd_status_t | Cy_CANFD_ConfigChangesEnable (CANFD_Type *base, uint32_t chan)
| Enables the CPU write access to the protected configuration registers of the CAN FD block and sets the CAN FD block into the initialization state. More...
__STATIC_INLINE cy_en_canfd_status_t | Cy_CANFD_ConfigChangesDisable (CANFD_Type *base, uint32_t chan)
| Disables the CPU write access to the protected configuration registers of the CAN FD block and sets the CAN FD block into the Normal Operation. More...
__STATIC_INLINE void | Cy_CANFD_TestModeConfig (CANFD_Type *base, uint32_t chan, cy_stc_canfd_test_mode_t testMode)
| Configures test mode. More...
__STATIC_INLINE void | Cy_CANFD_SetTDC (CANFD_Type *base, uint32_t chan, const cy_stc_canfd_transceiver_delay_compensation_t *tdcConfig)
| Sets the CAN FD transceiver delay compensation offset. More...
uint32_t | Cy_CANFD_GetLastError (CANFD_Type const *base, uint32_t chan)
| Returns the value of Protocol Status Register (PSR). More...
void | Cy_CANFD_IrqHandler (CANFD_Type *base, uint32_t chan, cy_stc_canfd_context_t const *context)
| CAN FD (Status/Error/Rx/Tx) interrupt ISR. More...
cy_en_canfd_status_t | Cy_CANFD_Init (CANFD_Type *base, uint32_t chan, const cy_stc_canfd_config_t *config, cy_stc_canfd_context_t *context)
| Initializes the CAN FD module. More...
cy_en_canfd_status_t | Cy_CANFD_DeInit (CANFD_Type *base, uint32_t chan, cy_stc_canfd_context_t *context)
| De-initializes the CAN FD block, returns registers values to default. More...
cy_en_canfd_status_t | Cy_CANFD_TransmitTxBuffer (CANFD_Type *base, uint32_t chan, uint8_t index)
| Starts transmission of the message prepared with Cy_CANFD_TxBufferConfig(). More...
cy_en_canfd_status_t | Cy_CANFD_UpdateAndTransmitMsgBuffer (CANFD_Type *base, uint32_t chan, const cy_stc_canfd_tx_buffer_t *txBuffer, uint8_t index, cy_stc_canfd_context_t const *context)
| Updates the T0 and T1 Tx buffer element parameters in Message RAM and copies data from cy_stc_canfd_tx_buffer_t structure to Message RAM. More...
cy_en_canfd_tx_buffer_status_t | Cy_CANFD_GetTxBufferStatus (CANFD_Type const *base, uint32_t chan, uint8_t index)
| Gets the status of the CAN FD Tx buffer. More...
__STATIC_INLINE uint32_t | Cy_CANFD_GetInterruptStatus (CANFD_Type const *base, uint32_t chan)
| Returns a status of CAN FD interrupt requests. More...
__STATIC_INLINE void | Cy_CANFD_ClearInterrupt (CANFD_Type *base, uint32_t chan, uint32_t status)
| Clears CAN FD interrupts by setting each bit. More...
__STATIC_INLINE uint32_t | Cy_CANFD_GetInterruptMask (CANFD_Type const *base, uint32_t chan)
| Returns an interrupt mask. More...
__STATIC_INLINE void | Cy_CANFD_SetInterruptMask (CANFD_Type *base, uint32_t chan, uint32_t interrupt)
| Configures which bits of the interrupt request register can trigger an interrupt event. More...
__STATIC_INLINE uint32_t | Cy_CANFD_GetInterruptLine (CANFD_Type const *base, uint32_t chan)
| Returns the interrupt signals assigned to the line m_ttcan_int0 or m_ttcan_int1. More...
__STATIC_INLINE void | Cy_CANFD_SetInterruptLine (CANFD_Type *base, uint32_t chan, uint32_t interruptLineMask)
| Configures the bits of the Interrupt Line Select Register to assign the interrupt signal to the line m_ttcan_int0 or m_ttcan_int1. More...
__STATIC_INLINE bool | Cy_CANFD_IsInterruptLineEnabled (CANFD_Type const *base, uint32_t chan, uint32_t interruptLineMask)
| Checks whether Interrupt Line 0, Interrupt Line 1 or both are enabled. More...
__STATIC_INLINE void | Cy_CANFD_EnableInterruptLine (CANFD_Type *base, uint32_t chan, uint32_t interruptLineMask)
| Configures which interrupt line is enabled (Interrupt Line 0, Interrupt Line 1 or both). More...

## Function Documentation

## ◆ Cy_CANFD_Enable()

__STATIC_INLINE void Cy_CANFD_Enable | ( | CANFD_Type * | base,
|  | uint32_t | channelMask
| ) |  |

Enables the CAN FD channels.

Note
  Call Cy_CANFD_Enable before Cy_CANFD_Init.

Parameters

  *base | The CAN FD registers structure pointer.
  channelMask | The channel mask (0-0xFF).

Function Usage
  /* Scenario: The CAN FD block and channel must be enabled. */
  uint32_t channelMask = 0x00000001UL; /* Enable the first channel */
  Cy_CANFD_Enable(CANFD0, channelMask);
  Cy_CANFD_Enable
  __STATIC_INLINE void Cy_CANFD_Enable(CANFD_Type *base, uint32_t channelMask)
  Enables the CAN FD channels.
  Definition: cy_canfd.h:1148

## ◆ Cy_CANFD_Disable()

__STATIC_INLINE cy_en_canfd_status_t Cy_CANFD_Disable | ( | CANFD_Type * | base,
|  | uint32_t | channelMask
| ) |  |

Disables the CAN FD channels to stop providing clocks to un-used CAN channels for power saving with this functionality.

Note
  Call Cy_CANFD_Disable only after Cy_CANFD_DeInit. Do not access the CAN FD registers until calling Cy_CANFD_Enable again.

Parameters

  *base | The CAN FD registers structure pointer.
  channelMask | The channel mask (0-0xFF).

Function Usage
  /* Scenario: CAN FD no longer in use, a channel or channels must be switched off */
  uint32_t channelMask = 0x00000001UL; /* Disable first channel */
  if(CY_CANFD_SUCCESS != Cy_CANFD_Disable(CANFD0, channelMask))
  {
  /* Insert error handling */
  }
  CY_CANFD_SUCCESS
  @ CY_CANFD_SUCCESS
  Returned successful.
  Definition: cy_canfd.h:427
  Cy_CANFD_Disable
  __STATIC_INLINE cy_en_canfd_status_t Cy_CANFD_Disable(CANFD_Type *base, uint32_t channelMask)
  Disables the CAN FD channels to stop providing clocks to un-used CAN channels for power saving with t...
  Definition: cy_canfd.h:1180

## ◆ Cy_CANFD_EnableMRAM()

__STATIC_INLINE void Cy_CANFD_EnableMRAM | ( | CANFD_Type * | base,
|  | uint32_t | channelMask,
|  | uint16_t | delay
| ) |  |

Switches MRAM on and enables the channels.

Parameters

  *base | The CAN FD registers structure pointer.
  channelMask | The channel mask (0-0xFF).
  delay | The delay in usec to wait power up time before MRAM can be used. Recommended value is 150 CPU cycles or 6 usec for the 25 MHz CPU clock.

Function Usage
  /* Scenario: Switches MRAM on and enables specified channels. */
  uint32_t channelMask = 0x00000001UL; /* Enables the first channel */
  uint16_t delay = 0x0006U; /* A delay in usec before the MRAM can be used */
  Cy_CANFD_EnableMRAM(CANFD0, channelMask, delay);
  Cy_CANFD_EnableMRAM
  __STATIC_INLINE void Cy_CANFD_EnableMRAM(CANFD_Type *base, uint32_t channelMask, uint16_t delay)
  Switches MRAM on and enables the channels.
  Definition: cy_canfd.h:1229

## ◆ Cy_CANFD_DisableMRAM()

__STATIC_INLINE cy_en_canfd_status_t Cy_CANFD_DisableMRAM | ( | CANFD_Type * | base | ) |

Disables the channels and switches MRAM off.

Parameters

  *base | The CAN FD registers structure pointer.

Function Usage
  /* Scenario: Disables all the channels and switches off the MRAM to save power. */
  Cy_CANFD_DisableMRAM(CANFD0);
  Cy_CANFD_DisableMRAM
  __STATIC_INLINE cy_en_canfd_status_t Cy_CANFD_DisableMRAM(CANFD_Type *base)
  Disables the channels and switches MRAM off.
  Definition: cy_canfd.h:1259

## ◆ Cy_CANFD_SetBitrate()

__STATIC_INLINE void Cy_CANFD_SetBitrate | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | const cy_stc_canfd_bitrate_t * | bitrate
| ) |  |

Sets Nominal Bit Timing and Prescaler Register parameters: -Nominal Time segment after sample point; -Nominal Time segment before sample point; -Nominal Baud Rate Prescaler; -Nominal Synchronization Jump Width.

Note
  Before calling the Cy_CANFD_SetBitrate() function, the Cy_CANFD_ConfigChangesEnable() function must be called to set bits CCCR.CCE and CCCR.INIT. It is recommended to call Cy_CANFD_ConfigChangesDisable() after updating Bitrate.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  *bitrate | cy_stc_canfd_bitrate_t

Function Usage
  /* Scenario: Changes the Nominal Bit Timing or Prescaler Register parameters after the CAN FD block is initialized. */
  cy_stc_canfd_bitrate_t bitrateConfig =
  {
  /* .prescaler */ 10u - 1u,
  /* .timeSegment1 */ 5u - 1u,
  /* .timeSegment2 */ 2u - 1u,
  /* .syncJumpWidth */ 2u - 1u
  };
  Cy_CANFD_ConfigChangesEnable(CANFD0, 0UL);
  Cy_CANFD_SetBitrate(CANFD0, 0UL, &bitrateConfig);
  Cy_CANFD_ConfigChangesDisable(CANFD0, 0UL);
  cy_stc_canfd_bitrate_t
  CAN FD bitrate.
  Definition: cy_canfd.h:854
  Cy_CANFD_SetBitrate
  __STATIC_INLINE void Cy_CANFD_SetBitrate(CANFD_Type *base, uint32_t chan, const cy_stc_canfd_bitrate_t *bitrate)
  Sets Nominal Bit Timing and Prescaler Register parameters: -Nominal Time segment after sample point; ...
  Definition: cy_canfd.h:1302
  Cy_CANFD_ConfigChangesDisable
  __STATIC_INLINE cy_en_canfd_status_t Cy_CANFD_ConfigChangesDisable(CANFD_Type *base, uint32_t chan)
  Disables the CPU write access to the protected configuration registers of the CAN FD block and sets t...
  Definition: cy_canfd.h:1441
  Cy_CANFD_ConfigChangesEnable
  __STATIC_INLINE cy_en_canfd_status_t Cy_CANFD_ConfigChangesEnable(CANFD_Type *base, uint32_t chan)
  Enables the CPU write access to the protected configuration registers of the CAN FD block and sets th...
  Definition: cy_canfd.h:1395

## ◆ Cy_CANFD_SetFastBitrate()

__STATIC_INLINE void Cy_CANFD_SetFastBitrate | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | const cy_stc_canfd_bitrate_t * | fastBitrate
| ) |  |

Sets Data Bit Timing and Prescaler Register parameters for data: -Data Time segment after sample point; -Data Time segment before sample point; -Data Baud Rate Prescaler; -Data Synchronization Jump Width.

Note
  Before calling the Cy_CANFD_SetFastBitrate() function, the Cy_CANFD_ConfigChangesEnable() function must be called to set bits CCCR.CCE and CCCR.INIT. It is recommended to call Cy_CANFD_ConfigChangesDisable() after updating Bitrate.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  *fastBitrate | cy_stc_canfd_bitrate_t

Function Usage
  /* Scenario: Changes the Data Bit Timing or Prescaler Register parameters after the CAN FD block is initialized. */
  cy_stc_canfd_bitrate_t bitrateConfig =
  {
  /* .prescaler */ 5u - 1u,
  /* .timeSegment1 */ 5u - 1u,
  /* .timeSegment2 */ 2u - 1u,
  /* .syncJumpWidth */ 2u - 1u
  };
  Cy_CANFD_ConfigChangesEnable(CANFD0, 0UL);
  Cy_CANFD_SetFastBitrate(CANFD0, 0UL, &bitrateConfig);
  Cy_CANFD_ConfigChangesDisable(CANFD0, 0UL);
  Cy_CANFD_SetFastBitrate
  __STATIC_INLINE void Cy_CANFD_SetFastBitrate(CANFD_Type *base, uint32_t chan, const cy_stc_canfd_bitrate_t *fastBitrate)
  Sets Data Bit Timing and Prescaler Register parameters for data: -Data Time segment after sample poin...
  Definition: cy_canfd.h:1346

## ◆ Cy_CANFD_SidFilterSetup()

void Cy_CANFD_SidFilterSetup | ( | CANFD_Type const * | base,
|  | uint32_t | chan,
|  | const cy_stc_id_filter_t * | filter,
|  | uint32_t | index,
|  | cy_stc_canfd_context_t const * | context
| ) |  |

Updates the Standard Message ID Filter Element configuration in Message RAM.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  *filter | The SID Filter register element structure.
  index | The SID filter index.
  *context | The pointer to the context structure cy_stc_canfd_context_t allocated by the user. The structure is used during the CAN FD operation for internal configuration and data retention. The user must not modify anything in this structure.

Function Usage
  /* Scenario: Updates the Standard Message ID Filter Element configuration in the Message RAM. */
  static const cy_stc_id_filter_t filter =
  {
  /* .sfid2 */ 0x00000010UL,
  /* .sfid1 */ 0x00000020UL,
  /* .sfec */ CY_CANFD_SFEC_STORE_RX_FIFO_0,
  /* .sft */ CY_CANFD_SFT_RANGE_SFID1_SFID2
  };
  cy_stc_canfd_context_t context = {0}; /* This is a shared context buffer, unique for each channel */
  Cy_CANFD_SidFilterSetup(CANFD0, 0UL, &filter, 0UL, &context);
  cy_stc_canfd_context_t
  Context structure.
  Definition: cy_canfd.h:1015
  cy_stc_id_filter_t
  Message ID filter register.
  Definition: cy_canfd.h:824
  CY_CANFD_SFT_RANGE_SFID1_SFID2
  @ CY_CANFD_SFT_RANGE_SFID1_SFID2
  The range filter from SFID1 to SFID2 (SFID2 >= SFID1)
  Definition: cy_canfd.h:561
  CY_CANFD_SFEC_STORE_RX_FIFO_0
  @ CY_CANFD_SFEC_STORE_RX_FIFO_0
  Store in Rx FIFO 0 if the filter matches.
  Definition: cy_canfd.h:547
  Cy_CANFD_SidFilterSetup
  void Cy_CANFD_SidFilterSetup(CANFD_Type const *base, uint32_t chan, const cy_stc_id_filter_t *filter, uint32_t index, cy_stc_canfd_context_t const *context)
  Updates the Standard Message ID Filter Element configuration in Message RAM.
  Definition: cy_canfd.c:895

## ◆ Cy_CANFD_SidFiltersSetup()

void Cy_CANFD_SidFiltersSetup | ( | CANFD_Type const * | base,
|  | uint32_t | chan,
|  | const cy_stc_canfd_sid_filter_config_t * | filterConfig,
|  | cy_stc_canfd_context_t const * | context
| ) |  |

Updates the Standard Message ID Filters configuration in Message RAM.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  filterConfig | The Standard ID filter configuration structure.
  context | The pointer to the context structure cy_stc_canfd_context_t allocated by the user. The structure is used during the CAN FD operation for internal configuration and data retention. The user must not modify anything in this structure.

## ◆ Cy_CANFD_XidFilterSetup()

void Cy_CANFD_XidFilterSetup | ( | CANFD_Type const * | base,
|  | uint32_t | chan,
|  | const cy_stc_extid_filter_t * | filter,
|  | uint32_t | index,
|  | cy_stc_canfd_context_t const * | context
| ) |  |

Updates the Extended Message ID Filter Element configuration in Message RAM.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  filter | The XID Filter register element structure.
  index | The XID filter index.
  context | The pointer to the context structure cy_stc_canfd_context_t allocated by the user. The structure is used during the CAN FD operation for internal configuration and data retention. The user must not modify anything in this structure.

Function Usage
  /* Scenario: Updates the Extended Message ID Filter Element configuration in the Message RAM. */
  cy_stc_canfd_context_t context = {0};
  cy_stc_canfd_f0_t filterF0Config =
  {
  /* .efid1 */ 0x00010010UL,
  /* .efec */ CY_CANFD_EFEC_STORE_RX_FIFO_1
  };
  cy_stc_canfd_f1_t filterF1Config =
  {
  /* .efid2 */ 0x00010020UL,
  /* .eft */ CY_CANFD_EFT_DUAL_ID
  };
  /* extIdFilter */
  cy_stc_extid_filter_t filter =
  {
  /* .f0_f */ &filterF0Config,
  /* .f1_f */ &filterF1Config
  };
  Cy_CANFD_XidFilterSetup(CANFD0, 0UL, &filter, 0UL, &context);
  cy_stc_canfd_f0_t
  F0 register.
  Definition: cy_canfd.h:833
  cy_stc_canfd_f1_t
  F1 register.
  Definition: cy_canfd.h:840
  cy_stc_extid_filter_t
  Extended message ID filter register.
  Definition: cy_canfd.h:847
  CY_CANFD_EFEC_STORE_RX_FIFO_1
  @ CY_CANFD_EFEC_STORE_RX_FIFO_1
  Store in Rx FIFO 1 if the filter matches.
  Definition: cy_canfd.h:572
  CY_CANFD_EFT_DUAL_ID
  @ CY_CANFD_EFT_DUAL_ID
  The Dual ID filter for EFID1 or EFID2.
  Definition: cy_canfd.h:586
  Cy_CANFD_XidFilterSetup
  void Cy_CANFD_XidFilterSetup(CANFD_Type const *base, uint32_t chan, const cy_stc_extid_filter_t *filter, uint32_t index, cy_stc_canfd_context_t const *context)
  Updates the Extended Message ID Filter Element configuration in Message RAM.
  Definition: cy_canfd.c:997

## ◆ Cy_CANFD_XidFiltersSetup()

void Cy_CANFD_XidFiltersSetup | ( | CANFD_Type const * | base,
|  | uint32_t | chan,
|  | const cy_stc_canfd_extid_filter_config_t * | filterConfig,
|  | cy_stc_canfd_context_t const * | context
| ) |  |

Updates the Extended Message ID Filters configuration in Message RAM.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  filterConfig | The Extended ID filter configuration structure.
  context | The pointer to the context structure cy_stc_canfd_context_t allocated by the user. The structure is used during the CAN FD operation for internal configuration and data retention. The user must not modify anything in this structure.

## ◆ Cy_CANFD_TxBufferConfig()

cy_en_canfd_status_t Cy_CANFD_TxBufferConfig | ( | CANFD_Type const * | base,
|  | uint32_t | chan,
|  | const cy_stc_canfd_tx_buffer_t * | txBuffer,
|  | uint8_t | index,
|  | cy_stc_canfd_context_t const * | context
| ) |  |

Updates the T0 and T1 Tx buffer element parameters in Message RAM and copies data from cy_stc_canfd_tx_buffer_t structure to Message RAM.

Note
  Function Cy_CANFD_Init() must be called before setting up an identifier and enabling this message buffer.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  *txBuffer | The Tx Buffer configuration structure.
  index | the message buffer index (0-31).
  context | The pointer to the context structure cy_stc_canfd_context_t allocated by the user. The structure is used during the CAN FD operation for internal configuration and data retention. The user must not modify anything in this structure.

Returns
  cy_en_canfd_status_t

Function Usage
  /* Scenario: Configure a transmit buffer for the CAN FD transmit operation */
  cy_stc_canfd_context_t context = {0}; /* This is a shared context structure, it is unique for each channel.
  * It must be global
  */
  uint8_t index = 0U; /* Tx Buffer Element number */
  cy_stc_canfd_t0_t t0fConfig =
  {
  /* .id */ 0x00000055UL,
  /* .rtr */ CY_CANFD_RTR_DATA_FRAME,
  /* .xtd */ CY_CANFD_XTD_STANDARD_ID,
  /* .esi */ CY_CANFD_ESI_ERROR_PASSIVE
  };
  cy_stc_canfd_t1_t t1fConfig =
  {
  /* .dlc */ 15U,
  /* .brs */ true,
  /* .fdf */ CY_CANFD_FDF_CAN_FD_FRAME,
  /* .efc */ false,
  /* .mm */ 0UL
  };
  uint32_t data[16] =
  {
  0x00000000, 0x11111111, 0x22222222, 0x33333333,
  0x44444444, 0x55555555, 0x66666666, 0x77777777,
  0x88888888, 0x99999999, 0xAAAAAAAA, 0xBBBBBBBB,
  0xCCCCCCCC, 0xDDDDDDDD, 0xEEEEEEEE, 0xFFFFFFFF
  };
  const cy_stc_canfd_tx_buffer_t txBufferConfig =
  {
  /* .t0_f */ &t0fConfig,
  /* .t1_f */ &t1fConfig,
  /* data_area_f */ data
  };
  if(CY_CANFD_SUCCESS != Cy_CANFD_TxBufferConfig(CANFD0, 0UL, &txBufferConfig, index, &context))
  {
  /* Insert error handling */
  }
  cy_stc_canfd_t0_t
  T0 register.
  Definition: cy_canfd.h:795
  cy_stc_canfd_t1_t
  T1 register.
  Definition: cy_canfd.h:806
  cy_stc_canfd_tx_buffer_t
  Tx buffer register.
  Definition: cy_canfd.h:816
  CY_CANFD_ESI_ERROR_PASSIVE
  @ CY_CANFD_ESI_ERROR_PASSIVE
  The transmitting node is error passive.
  Definition: cy_canfd.h:526
  CY_CANFD_XTD_STANDARD_ID
  @ CY_CANFD_XTD_STANDARD_ID
  The 11-bit standard identifier.
  Definition: cy_canfd.h:518
  CY_CANFD_FDF_CAN_FD_FRAME
  @ CY_CANFD_FDF_CAN_FD_FRAME
  The CAN FD frame format (new DLC-coding and CRC)
  Definition: cy_canfd.h:533
  CY_CANFD_RTR_DATA_FRAME
  @ CY_CANFD_RTR_DATA_FRAME
  The received frame is a data frame.
  Definition: cy_canfd.h:511
  Cy_CANFD_TxBufferConfig
  cy_en_canfd_status_t Cy_CANFD_TxBufferConfig(CANFD_Type const *base, uint32_t chan, const cy_stc_canfd_tx_buffer_t *txBuffer, uint8_t index, cy_stc_canfd_context_t const *context)
  Updates the T0 and T1 Tx buffer element parameters in Message RAM and copies data from cy_stc_canfd_t...
  Definition: cy_canfd.c:1712

## ◆ Cy_CANFD_CalcRxBufAdrs()

uint32_t Cy_CANFD_CalcRxBufAdrs | ( | CANFD_Type const * | base,
|  | uint32_t | chan,
|  | uint32_t | index,
|  | cy_stc_canfd_context_t const * | context
| ) |  |

Calculates the address of the RX buffer element.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  index | The message buffer index for reception (0-63).
  context | The pointer to the context structure cy_stc_canfd_context_t allocated by the user. The structure is used during the CAN FD operation for internal configuration and data retention. The user must not modify anything in this structure.

Returns
  The message buffer address corresponding to the index. Can be 0 if the index is invalid.

Function Usage
  /* Scenario: Reads one RX buffer element. */
  uint32_t index = 0UL; /* RX buffer element index */
  bool useFIFO = false; /* true - uses FIFO buffer, false - uses RX buffer */
  uint32_t FIFOnumber = CY_CANFD_RX_FIFO0; /* FIFO number (0 or 1), if used */
  cy_stc_canfd_context_t context = {0}; /* This is a shared context structure unique for each channel
  * It must be global, initialized with Cy_CANFD_Init()
  */
  uint32_t address ; /* The address of the RX buffer in Message RAM */
  /* The members of the rxBuffer structure */
  cy_stc_canfd_r0_t r0RxBuffer; /* The R0 register structure of the RX buffer element */
  cy_stc_canfd_r1_t r1RxBuffer; /* The R1 register structure of the RX buffer element */
  uint32_t rxData[CY_CANFD_DATA_ELEMENTS_MAX]; /* The array to store RX data */
  cy_stc_canfd_rx_buffer_t rxBuffer =
  {
  /* .r0_f */ &r0RxBuffer,
  /* .r1_f */ &r1RxBuffer,
  /* .data_area_f */ rxData
  };
  if (useFIFO)
  {
  address = Cy_CANFD_CalcRxFifoAdrs(CANFD0, 0UL, FIFOnumber, index, &context);
  }
  else
  {
  address = Cy_CANFD_CalcRxBufAdrs(CANFD0, 0UL, index, &context);
  }
  if(CY_CANFD_SUCCESS == (Cy_CANFD_GetRxBuffer(CANFD0, 0UL, address, &rxBuffer)))
  {
  if (useFIFO)
  {
  Cy_CANFD_AckRxFifo(CANFD0, 0UL, FIFOnumber);
  }
  else
  {
  Cy_CANFD_AckRxBuf(CANFD0, 0UL, index);
  }
  }
  else
  {
  /* Insert error handling */
  }
  cy_stc_canfd_r0_t
  R0 register.
  Definition: cy_canfd.h:767
  cy_stc_canfd_r1_t
  R1 register.
  Definition: cy_canfd.h:776
  cy_stc_canfd_rx_buffer_t
  Rx buffer.
  Definition: cy_canfd.h:787
  Cy_CANFD_CalcRxFifoAdrs
  uint32_t Cy_CANFD_CalcRxFifoAdrs(CANFD_Type const *base, uint32_t chan, uint32_t fifoNumber, uint32_t index, cy_stc_canfd_context_t const *context)
  Calculates the address of the RX FIFO element.
  Definition: cy_canfd.c:838
  Cy_CANFD_GetRxBuffer
  cy_en_canfd_status_t Cy_CANFD_GetRxBuffer(CANFD_Type const *base, uint32_t chan, const uint32_t bufferAddress, cy_stc_canfd_rx_buffer_t const *rxBuffer)
  Extracts the RX Buffer from Message RAM.
  Definition: cy_canfd.c:1104
  Cy_CANFD_AckRxFifo
  void Cy_CANFD_AckRxFifo(CANFD_Type *base, uint32_t chan, uint32_t FIFOnumber)
  Acknowledges the data reading and makes the buffer element available for a next message.
  Definition: cy_canfd.c:1434
  Cy_CANFD_AckRxBuf
  void Cy_CANFD_AckRxBuf(CANFD_Type *base, uint32_t chan, uint32_t bufNum)
  Acknowledges the data reading and makes the buffer element available for a next message.
  Definition: cy_canfd.c:1396
  Cy_CANFD_CalcRxBufAdrs
  uint32_t Cy_CANFD_CalcRxBufAdrs(CANFD_Type const *base, uint32_t chan, uint32_t index, cy_stc_canfd_context_t const *context)
  Calculates the address of the RX buffer element.
  Definition: cy_canfd.c:727
  CY_CANFD_RX_FIFO0
  #define CY_CANFD_RX_FIFO0
  FIFO number 0.
  Definition: cy_canfd.h:268

## ◆ Cy_CANFD_CalcRxFifoAdrs()

uint32_t Cy_CANFD_CalcRxFifoAdrs | ( | CANFD_Type const * | base,
|  | uint32_t | chan,
|  | uint32_t | fifoNumber,
|  | uint32_t | index,
|  | cy_stc_canfd_context_t const * | context
| ) |  |

Calculates the address of the RX FIFO element.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  fifoNumber | The FIFO number (0 or 1).
  index | The Message buffer index for the reception (0-63).
  context | The pointer to the context structure cy_stc_canfd_context_t allocated by the user. The structure is used during the CAN FD operation for internal configuration and data retention. The user must not modify anything in this structure.

Returns
  The Message buffer address corresponding to the index. Can be 0 if the index is invalid.

Function Usage
  /* Scenario: Reads one RX buffer element. */
  uint32_t index = 0UL; /* RX buffer element index */
  bool useFIFO = false; /* true - uses FIFO buffer, false - uses RX buffer */
  uint32_t FIFOnumber = CY_CANFD_RX_FIFO0; /* FIFO number (0 or 1), if used */
  cy_stc_canfd_context_t context = {0}; /* This is a shared context structure unique for each channel
  * It must be global, initialized with Cy_CANFD_Init()
  */
  uint32_t address ; /* The address of the RX buffer in Message RAM */
  /* The members of the rxBuffer structure */
  cy_stc_canfd_r0_t r0RxBuffer; /* The R0 register structure of the RX buffer element */
  cy_stc_canfd_r1_t r1RxBuffer; /* The R1 register structure of the RX buffer element */
  uint32_t rxData[CY_CANFD_DATA_ELEMENTS_MAX]; /* The array to store RX data */
  cy_stc_canfd_rx_buffer_t rxBuffer =
  {
  /* .r0_f */ &r0RxBuffer,
  /* .r1_f */ &r1RxBuffer,
  /* .data_area_f */ rxData
  };
  if (useFIFO)
  {
  address = Cy_CANFD_CalcRxFifoAdrs(CANFD0, 0UL, FIFOnumber, index, &context);
  }
  else
  {
  address = Cy_CANFD_CalcRxBufAdrs(CANFD0, 0UL, index, &context);
  }
  if(CY_CANFD_SUCCESS == (Cy_CANFD_GetRxBuffer(CANFD0, 0UL, address, &rxBuffer)))
  {
  if (useFIFO)
  {
  Cy_CANFD_AckRxFifo(CANFD0, 0UL, FIFOnumber);
  }
  else
  {
  Cy_CANFD_AckRxBuf(CANFD0, 0UL, index);
  }
  }
  else
  {
  /* Insert error handling */
  }

## ◆ Cy_CANFD_GetRxBuffer()

cy_en_canfd_status_t Cy_CANFD_GetRxBuffer | ( | CANFD_Type const * | base,
|  | uint32_t | chan,
|  | const uint32_t | bufferAddress,
|  | cy_stc_canfd_rx_buffer_t const * | rxBuffer
| ) |  |

Extracts the RX Buffer from Message RAM.

Note
  Remember to clear the NDAT register bits after the RX buffer is read.
  Remember to acknowledge the FIFO buffer after reading one FIFO element.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  bufferAddress | The Rx, FIFO 0 or FIFO 1 Buffer element address in CAN Message RAM.
  *rxBuffer | The Rx Buffer structure in RAM.

Returns
  cy_en_canfd_status_t

Function Usage
  /* Scenario: Reads one RX buffer element. */
  uint32_t index = 0UL; /* RX buffer element index */
  bool useFIFO = false; /* true - uses FIFO buffer, false - uses RX buffer */
  uint32_t FIFOnumber = CY_CANFD_RX_FIFO0; /* FIFO number (0 or 1), if used */
  cy_stc_canfd_context_t context = {0}; /* This is a shared context structure unique for each channel
  * It must be global, initialized with Cy_CANFD_Init()
  */
  uint32_t address ; /* The address of the RX buffer in Message RAM */
  /* The members of the rxBuffer structure */
  cy_stc_canfd_r0_t r0RxBuffer; /* The R0 register structure of the RX buffer element */
  cy_stc_canfd_r1_t r1RxBuffer; /* The R1 register structure of the RX buffer element */
  uint32_t rxData[CY_CANFD_DATA_ELEMENTS_MAX]; /* The array to store RX data */
  cy_stc_canfd_rx_buffer_t rxBuffer =
  {
  /* .r0_f */ &r0RxBuffer,
  /* .r1_f */ &r1RxBuffer,
  /* .data_area_f */ rxData
  };
  if (useFIFO)
  {
  address = Cy_CANFD_CalcRxFifoAdrs(CANFD0, 0UL, FIFOnumber, index, &context);
  }
  else
  {
  address = Cy_CANFD_CalcRxBufAdrs(CANFD0, 0UL, index, &context);
  }
  if(CY_CANFD_SUCCESS == (Cy_CANFD_GetRxBuffer(CANFD0, 0UL, address, &rxBuffer)))
  {
  if (useFIFO)
  {
  Cy_CANFD_AckRxFifo(CANFD0, 0UL, FIFOnumber);
  }
  else
  {
  Cy_CANFD_AckRxBuf(CANFD0, 0UL, index);
  }
  }
  else
  {
  /* Insert error handling */
  }

## ◆ Cy_CANFD_GetFIFOTop()

cy_en_canfd_status_t Cy_CANFD_GetFIFOTop | ( | CANFD_Type const * | base,
|  | uint32_t | chan,
|  | const uint8_t | FIFONumber,
|  | cy_stc_canfd_rx_buffer_t const * | rxBuffer
| ) |  |

Extracts one RX FIFO Buffer element using the FIFO TOP register logic.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  FIFONumber | The CY_CANFD_RX_FIFO0 or CY_CANFD_RX_FIFO1, FIFO Buffer number.
  *rxBuffer | The Rx Buffer structure in RAM.

Returns
  cy_en_canfd_status_t

Function Usage
  /* Scenario: Reads one RX FIFO0 element using the FIFO TOP register logic. */
  uint32_t FIFONumber = 0; /* 0 - read FIFO0, 1 - read FIFO1 */
  /* The members of the rxBuffer structure */
  cy_stc_canfd_r0_t r0RxBuffer; /* The R0 register structure of the RX buffer element */
  cy_stc_canfd_r1_t r1RxBuffer; /* The R1 register structure of the RX buffer element */
  uint32_t rxData[CY_CANFD_DATA_ELEMENTS_MAX]; /* The array to store RX data */
  cy_stc_canfd_rx_buffer_t rxBuffer =
  {
  /* .r0_f */ &r0RxBuffer,
  /* .r1_f */ &r1RxBuffer,
  /* .data_area_f */ rxData
  };
  if(CY_CANFD_SUCCESS != (Cy_CANFD_GetFIFOTop(CANFD0, 0UL, FIFONumber, &rxBuffer)))
  {
  /* Insert error handling */
  }
  Cy_CANFD_GetFIFOTop
  cy_en_canfd_status_t Cy_CANFD_GetFIFOTop(CANFD_Type const *base, uint32_t chan, const uint8_t FIFONumber, cy_stc_canfd_rx_buffer_t const *rxBuffer)
  Extracts one RX FIFO Buffer element using the FIFO TOP register logic.
  Definition: cy_canfd.c:1186

## ◆ Cy_CANFD_ExtractMsgFromRXBuffer()

cy_en_canfd_status_t Cy_CANFD_ExtractMsgFromRXBuffer | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | bool | rxFIFOMsg,
|  | uint8_t | msgBufOrRxFIFONum,
|  | cy_stc_canfd_rx_buffer_t const * | rxBuffer,
|  | cy_stc_canfd_context_t const * | context
| ) |  |

Extracts one RX buffer or one FIFO buffer element.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  rxFIFOMsg | The buffer to read: True for FIFO buffers and False for RX buffers.
  msgBufOrRxFIFONum | The RX buffer element index or FIFO buffer number.
  *rxBuffer | The Rx buffer structure in RAM.
  context | The pointer to the context structure cy_stc_canfd_context_t allocated by the user. The structure is used during the CAN FD operation for internal configuration and data retention. The user must not modify anything in this structure.

Returns
  cy_en_canfd_status_t

Function Usage
  /* Scenario: Reads one RX buffer element. */
  cy_stc_canfd_context_t context = {0}; /* This is a shared context structure unique for each channel
  * It must be global, initialized with Cy_CANFD_Init()
  */
  uint8_t msgBufOrRxFIFONum = 0; /* RX buffer element index or FIFO number*/
  bool rxFIFOMsg = false; /* True for FIFO buffers anf False for RX buffers */
  /* The members of the rxBuffer structure */
  cy_stc_canfd_r0_t r0RxBuffer; /* The R0 register structure of the RX buffer element */
  cy_stc_canfd_r1_t r1RxBuffer; /* The R1 register structure of the RX buffer element */
  uint32_t rxData[CY_CANFD_DATA_ELEMENTS_MAX]; /* The array to store RX data */
  cy_stc_canfd_rx_buffer_t rxBuffer =
  {
  /* .r0_f */ &r0RxBuffer,
  /* .r1_f */ &r1RxBuffer,
  /* .data_area_f */ rxData
  };
  if(CY_CANFD_SUCCESS != (Cy_CANFD_ExtractMsgFromRXBuffer(CANFD0, 0UL,
  rxFIFOMsg, msgBufOrRxFIFONum,
  &rxBuffer, &context)))
  {
  /* Insert error handling */
  }
  Cy_CANFD_ExtractMsgFromRXBuffer
  cy_en_canfd_status_t Cy_CANFD_ExtractMsgFromRXBuffer(CANFD_Type *base, uint32_t chan, bool rxFIFOMsg, uint8_t msgBufOrRxFIFONum, cy_stc_canfd_rx_buffer_t const *rxBuffer, cy_stc_canfd_context_t const *context)
  Extracts one RX buffer or one FIFO buffer element.
  Definition: cy_canfd.c:1284

## ◆ Cy_CANFD_AckRxBuf()

void Cy_CANFD_AckRxBuf | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | uint32_t | bufNum
| ) |  |

Acknowledges the data reading and makes the buffer element available for a next message.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  bufNum | The RX buffer element index.

Function Usage
  /* Scenario: Reads one RX buffer element. */
  uint32_t index = 0UL; /* RX buffer element index */
  bool useFIFO = false; /* true - uses FIFO buffer, false - uses RX buffer */
  uint32_t FIFOnumber = CY_CANFD_RX_FIFO0; /* FIFO number (0 or 1), if used */
  cy_stc_canfd_context_t context = {0}; /* This is a shared context structure unique for each channel
  * It must be global, initialized with Cy_CANFD_Init()
  */
  uint32_t address ; /* The address of the RX buffer in Message RAM */
  /* The members of the rxBuffer structure */
  cy_stc_canfd_r0_t r0RxBuffer; /* The R0 register structure of the RX buffer element */
  cy_stc_canfd_r1_t r1RxBuffer; /* The R1 register structure of the RX buffer element */
  uint32_t rxData[CY_CANFD_DATA_ELEMENTS_MAX]; /* The array to store RX data */
  cy_stc_canfd_rx_buffer_t rxBuffer =
  {
  /* .r0_f */ &r0RxBuffer,
  /* .r1_f */ &r1RxBuffer,
  /* .data_area_f */ rxData
  };
  if (useFIFO)
  {
  address = Cy_CANFD_CalcRxFifoAdrs(CANFD0, 0UL, FIFOnumber, index, &context);
  }
  else
  {
  address = Cy_CANFD_CalcRxBufAdrs(CANFD0, 0UL, index, &context);
  }
  if(CY_CANFD_SUCCESS == (Cy_CANFD_GetRxBuffer(CANFD0, 0UL, address, &rxBuffer)))
  {
  if (useFIFO)
  {
  Cy_CANFD_AckRxFifo(CANFD0, 0UL, FIFOnumber);
  }
  else
  {
  Cy_CANFD_AckRxBuf(CANFD0, 0UL, index);
  }
  }
  else
  {
  /* Insert error handling */
  }

## ◆ Cy_CANFD_AckRxFifo()

void Cy_CANFD_AckRxFifo | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | uint32_t | FIFOnumber
| ) |  |

Acknowledges the data reading and makes the buffer element available for a next message.

Note
  Do not use this function with Cy_CANFD_GetFIFOTop(). FIFO top logic takes care on updating the FIFO read pointer buffer with hardware.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  FIFOnumber | The RX buffer element index.

Function Usage
  /* Scenario: Reads one RX buffer element. */
  uint32_t index = 0UL; /* RX buffer element index */
  bool useFIFO = false; /* true - uses FIFO buffer, false - uses RX buffer */
  uint32_t FIFOnumber = CY_CANFD_RX_FIFO0; /* FIFO number (0 or 1), if used */
  cy_stc_canfd_context_t context = {0}; /* This is a shared context structure unique for each channel
  * It must be global, initialized with Cy_CANFD_Init()
  */
  uint32_t address ; /* The address of the RX buffer in Message RAM */
  /* The members of the rxBuffer structure */
  cy_stc_canfd_r0_t r0RxBuffer; /* The R0 register structure of the RX buffer element */
  cy_stc_canfd_r1_t r1RxBuffer; /* The R1 register structure of the RX buffer element */
  uint32_t rxData[CY_CANFD_DATA_ELEMENTS_MAX]; /* The array to store RX data */
  cy_stc_canfd_rx_buffer_t rxBuffer =
  {
  /* .r0_f */ &r0RxBuffer,
  /* .r1_f */ &r1RxBuffer,
  /* .data_area_f */ rxData
  };
  if (useFIFO)
  {
  address = Cy_CANFD_CalcRxFifoAdrs(CANFD0, 0UL, FIFOnumber, index, &context);
  }
  else
  {
  address = Cy_CANFD_CalcRxBufAdrs(CANFD0, 0UL, index, &context);
  }
  if(CY_CANFD_SUCCESS == (Cy_CANFD_GetRxBuffer(CANFD0, 0UL, address, &rxBuffer)))
  {
  if (useFIFO)
  {
  Cy_CANFD_AckRxFifo(CANFD0, 0UL, FIFOnumber);
  }
  else
  {
  Cy_CANFD_AckRxBuf(CANFD0, 0UL, index);
  }
  }
  else
  {
  /* Insert error handling */
  }

## ◆ Cy_CANFD_ConfigChangesEnable()

__STATIC_INLINE cy_en_canfd_status_t Cy_CANFD_ConfigChangesEnable | ( | CANFD_Type * | base,
|  | uint32_t | chan
| ) |  |

Enables the CPU write access to the protected configuration registers of the CAN FD block and sets the CAN FD block into the initialization state.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.

Returns
  cy_en_canfd_status_t

Function Usage
  /* Scenario: Enable the CPU Write access to the protected configuration registers */
  if(CY_CANFD_SUCCESS != Cy_CANFD_ConfigChangesEnable(CANFD0, 0UL))
  {
  /* Insert error handling */
  }

## ◆ Cy_CANFD_ConfigChangesDisable()

__STATIC_INLINE cy_en_canfd_status_t Cy_CANFD_ConfigChangesDisable | ( | CANFD_Type * | base,
|  | uint32_t | chan
| ) |  |

Disables the CPU write access to the protected configuration registers of the CAN FD block and sets the CAN FD block into the Normal Operation.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.

Returns
  cy_en_canfd_status_t

Function Usage
  /* Scenario: Disables the CPU Write access to the protected configuration
  * registers of the CAN FD block.
  */
  if(CY_CANFD_SUCCESS != Cy_CANFD_ConfigChangesDisable(CANFD0, 0UL))
  {
  /* Insert error handling */
  }

## ◆ Cy_CANFD_TestModeConfig()

__STATIC_INLINE void Cy_CANFD_TestModeConfig | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | cy_stc_canfd_test_mode_t | testMode
| ) |  |

Configures test mode.

Note
  The Cy_CANFD_ConfigChangesEnable must be called before calling this function to enable the configuration changes.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  testMode | cy_stc_canfd_test_mode_t

Function Usage
  /* Scenario: Configures Test mode to use the external loop back to receive
  * the sent data back.
  */
  Cy_CANFD_TestModeConfig(CANFD0, 0UL, CY_CANFD_TEST_MODE_EXTERNAL_LOOP_BACK);
  CY_CANFD_TEST_MODE_EXTERNAL_LOOP_BACK
  @ CY_CANFD_TEST_MODE_EXTERNAL_LOOP_BACK
  The External Loop Back Mode.
  Definition: cy_canfd.h:596
  Cy_CANFD_TestModeConfig
  __STATIC_INLINE void Cy_CANFD_TestModeConfig(CANFD_Type *base, uint32_t chan, cy_stc_canfd_test_mode_t testMode)
  Configures test mode.
  Definition: cy_canfd.h:1485

## ◆ Cy_CANFD_SetTDC()

__STATIC_INLINE void Cy_CANFD_SetTDC | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | const cy_stc_canfd_transceiver_delay_compensation_t * | tdcConfig
| ) |  |

Sets the CAN FD transceiver delay compensation offset.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  *tdcConfig | The CAN FD transceiver delay compensation offset configuration.

## ◆ Cy_CANFD_GetLastError()

uint32_t Cy_CANFD_GetLastError | ( | CANFD_Type const * | base,
|  | uint32_t | chan
| ) |  |

Returns the value of Protocol Status Register (PSR).

Use the Protocol Status Register (PSR) masks to extract necessary fields from the register.
Use the cy_en_canfd_LEC_t enumeration to interpret LEC and DLEC fields.
Use the cy_en_canfd_PSR_ACT_t enumeration to interpret the ACT field.

Note
  Protocol Status Register has reset on read fields. Reading the register will clear the bits PXE, RFDF, RBRS and RESI, and set DLEC[2:0] and LEC[2:0].

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.

Returns
  Content of the Protocol Status Register (PSR).

## ◆ Cy_CANFD_IrqHandler()

void Cy_CANFD_IrqHandler | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | cy_stc_canfd_context_t const * | context
| ) |  |

CAN FD (Status/Error/Rx/Tx) interrupt ISR.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  context | The pointer to the context structure cy_stc_canfd_context_t allocated by the user. The structure is used during the CAN FD operation for internal configuration and data retention. The user must not modify anything in this structure.

## ◆ Cy_CANFD_Init()

cy_en_canfd_status_t Cy_CANFD_Init | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | const cy_stc_canfd_config_t * | config,
|  | cy_stc_canfd_context_t * | context
| ) |  |

Initializes the CAN FD module.

Note
  The function does not enable the Tx Event FIFO but reserves 10 Tx Event FIFO elements in Message RAM.
  The function enables the "Message stored to Rx Buffer", "Rx FIFO 1 New Message" and "Rx FIFO 0 New Message" interrupt events only. Other interrupts can be configured with the Cy_CANFD_SetInterruptMask() function.
  If the channel was disabled, call Cy_CANFD_Enable before calling Cy_CANFD_Init.
  Call this function only after all debug messages reception is completed.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  *config | The pointer to the CAN FD configuration structure.
  *context | The pointer to the context structure cy_stc_canfd_context_t allocated by the user. The structure is used during the CAN FD operation for internal configuration and data retention. User must not modify anything in this structure.

Returns
  cy_en_canfd_status_t

Function Usage
  /* Scenario: Initialize the CAN FD block with predefined settings to:
  - Receive the frames with ID = 0x10 into RX buffer element #0 in Massage RAM;
  - Receive the frames with ID = 0x20 into RX buffer element #1 in Massage RAM;
  - Receive the frames with ID = 0x10010 into RX buffer element #2 in Massage RAM;
  - Receive the frames with ID = 0x10020 into RX buffer element #3 in Massage RAM;
  - Receive the frames with non-Matching Standard IDs into RX FIFO#0 in Massage RAM;
  - Receive the frames with non-Matching Extended IDs into RX FIFO#1 in Massage RAM;
  - Transmit two TX buffers.
  */
  #define MESSAGE_ID0 (0x00000001UL)
  #define MESSAGE_ID1 (0x00000010UL)
  #define MESSAGE_ID2 (0x00000020UL)
  #define RX_BUFFER_ELEMENT_1 (0x0UL)
  #define RX_BUFFER_ELEMENT_2 (0x1UL)
  #define MESSAGE_ID3 (0x00010010UL)
  #define MESSAGE_ID4 (0x00010020UL)
  #define RX_BUFFER_ELEMENT_3 (0x2UL)
  #define RX_BUFFER_ELEMENT_4 (0x3UL)
  cy_stc_canfd_context_t context = {0}; /* This is a shared context structure, it is unique for each channel.
  * It must be global
  */
  cy_stc_canfd_bitrate_t bitrateConfig =
  {
  /* .prescaler */ 10u - 1u,
  /* .timeSegment1 */ 5u - 1u,
  /* .timeSegment2 */ 2u - 1u,
  /* .syncJumpWidth */ 2u - 1u
  };
  cy_stc_canfd_bitrate_t fastBitrateConfig =
  {
  /* .prescaler */ 5u - 1u,
  /* .timeSegment1 */ 5u - 1u,
  /* .timeSegment2 */ 2u - 1u,
  /* .syncJumpWidth */ 2u - 1u
  };
  cy_stc_canfd_transceiver_delay_compensation_t tdcConfig =
  {
  /* .tdcEnabled */ false,
  /* .tdcOffset */ 0,
  /* .tdcFilterWindow */ 0
  };
  static const cy_stc_id_filter_t stdIdFilters[] =
  {
  /* stdIdFilter[0] */
  {
  /* .sfid2 */ RX_BUFFER_ELEMENT_1,
  /* .sfid1 */ MESSAGE_ID1,
  /* .sfec */ CY_CANFD_SFEC_STORE_RX_BUFFER,
  /* .sft */ CY_CANFD_SFT_CLASSIC_FILTER
  },
  /* stdIdFilter[1] */
  {
  /* .sfid2 */ RX_BUFFER_ELEMENT_2,
  /* .sfid1 */ MESSAGE_ID2,
  /* .sfec */ CY_CANFD_SFEC_STORE_RX_BUFFER,
  /* .sft */ CY_CANFD_SFT_CLASSIC_FILTER
  }
  };
  cy_stc_canfd_f0_t filter0F0Config =
  {
  /* .efid1 */ MESSAGE_ID3,
  /* .efec */ CY_CANFD_EFEC_STORE_RX_BUFFER
  };
  cy_stc_canfd_f1_t filter0F1Config =
  {
  /* .efid2 */ RX_BUFFER_ELEMENT_3,
  /* .eft */ CY_CANFD_EFT_CLASSIC_FILTER
  };
  cy_stc_canfd_f0_t filter1F0Config =
  {
  /* .efid1 */ MESSAGE_ID4,
  /* .efec */ CY_CANFD_EFEC_STORE_RX_BUFFER
  };
  cy_stc_canfd_f1_t filter1F1Config =
  {
  /* .efid2 */ RX_BUFFER_ELEMENT_4,
  /* .eft */ CY_CANFD_EFT_CLASSIC_FILTER
  };
  const cy_stc_extid_filter_t extIdFilters[] =
  {
  /* extIdFilter[0] */
  {
  /* .f0_f */ &filter0F0Config,
  /* .f1_f */ &filter0F1Config
  },
  /* extIdFilter[1] */
  {
  /* .f0_f */ &filter1F0Config,
  /* .f1_f */ &filter1F1Config
  }
  };
  cy_stc_canfd_sid_filter_config_t sidFiltersConfig =
  {
  /* .numberOfSIDFilters */ sizeof(stdIdFilters) / sizeof(stdIdFilters[0]),
  /* .sidFilter */ stdIdFilters,
  };
  cy_stc_canfd_extid_filter_config_t extidFiltersConfig =
  {
  /* numberOfEXTIDFilters */ sizeof(extIdFilters) / sizeof(extIdFilters[0]),
  /* extidFilter */ extIdFilters,
  /* extIDANDMask */ 0x1fffffffUL
  };
  cy_stc_canfd_global_filter_config_t globalFilterConfig =
  {
  /* .nonMatchingFramesStandard */ CY_CANFD_ACCEPT_IN_RXFIFO_0,
  /* .nonMatchingFramesExtended */ CY_CANFD_ACCEPT_IN_RXFIFO_1,
  /* .rejectRemoteFramesStandard */ true,
  /* .rejectRemoteFramesExtended */ true
  };
  cy_en_canfd_fifo_config_t rxFifo0Config =
  {
  /* mode */ CY_CANFD_FIFO_MODE_BLOCKING,
  /* watermark */ 1U,
  /* numberOfFifoElements */ 2U,
  /* topPointerLogicEnabled */ false
  };
  cy_en_canfd_fifo_config_t rxFifo1Config =
  {
  /* mode */ CY_CANFD_FIFO_MODE_BLOCKING,
  /* watermark */ 4U,
  /* numberOfFifoElements */ 5U,
  /* topPointerLogicEnabled */ false
  };
  const cy_stc_canfd_config_t config =
  {
  /* .txCallback */ NULL,
  /* .rxCallback */ NULL,
  /* .errorCallback */ NULL,
  /* .canFDMode */ true,
  /* .bitrate */ &bitrateConfig,
  /* .fastBitrate */ &fastBitrateConfig,
  /* .tdcConfig */ &tdcConfig,
  /* .sidFilterConfig */ &sidFiltersConfig,
  /* .extidFilterConfig */ &extidFiltersConfig,
  /* .globalFilterConfig */ &globalFilterConfig,
  /* .rxBufferDataSize */ CY_CANFD_BUFFER_DATA_SIZE_64,
  /* .rxFIFO1DataSize */ CY_CANFD_BUFFER_DATA_SIZE_64,
  /* .rxFIFO0DataSize */ CY_CANFD_BUFFER_DATA_SIZE_64,
  /* .txBufferDataSize */ CY_CANFD_BUFFER_DATA_SIZE_64,
  /* .rxFIFO0Config */ &rxFifo0Config,
  /* .rxFIFO1Config */ &rxFifo1Config,
  /* .noOfRxBuffers */ 0x4U,
  /* .noOfTxBuffers */ 0x2U,
  /* .messageRAMaddress */ CY_CAN0MRAM_BASE,
  /* .messageRAMsize */ 8192U
  };
  if(CY_CANFD_SUCCESS != Cy_CANFD_Init (CANFD0, 0U, &config, &context))
  {
  /* Insert error handling */
  }
  cy_en_canfd_fifo_config_t
  Rx FIFO configuration.
  Definition: cy_canfd.h:895
  cy_stc_canfd_config_t
  CAN FD configuration.
  Definition: cy_canfd.h:968
  cy_stc_canfd_extid_filter_config_t
  Extended ID filter configuration.
  Definition: cy_canfd.h:878
  cy_stc_canfd_global_filter_config_t
  Global filter configuration.
  Definition: cy_canfd.h:886
  cy_stc_canfd_sid_filter_config_t
  Standard ID filter configuration.
  Definition: cy_canfd.h:871
  cy_stc_canfd_transceiver_delay_compensation_t
  CAN FD transceiver delay compensation offset configuration.
  Definition: cy_canfd.h:863
  CY_CANFD_FIFO_MODE_BLOCKING
  @ CY_CANFD_FIFO_MODE_BLOCKING
  FIFO blocking mode.
  Definition: cy_canfd.h:458
  CY_CANFD_SFT_CLASSIC_FILTER
  @ CY_CANFD_SFT_CLASSIC_FILTER
  The Classic filter: SFID1 = filter, SFID2 = mask.
  Definition: cy_canfd.h:563
  CY_CANFD_EFEC_STORE_RX_BUFFER
  @ CY_CANFD_EFEC_STORE_RX_BUFFER
  Store into Rx Buffer or as debug message, configuration of EFT[1:0] ignored.
  Definition: cy_canfd.h:577
  CY_CANFD_EFT_CLASSIC_FILTER
  @ CY_CANFD_EFT_CLASSIC_FILTER
  The Classic filter: EFID1 = filter, EFID2 = mask.
  Definition: cy_canfd.h:587
  CY_CANFD_BUFFER_DATA_SIZE_64
  @ CY_CANFD_BUFFER_DATA_SIZE_64
  64 byte data field
  Definition: cy_canfd.h:452
  CY_CANFD_ACCEPT_IN_RXFIFO_0
  @ CY_CANFD_ACCEPT_IN_RXFIFO_0
  Accept in Rx FIFO 0.
  Definition: cy_canfd.h:465
  CY_CANFD_ACCEPT_IN_RXFIFO_1
  @ CY_CANFD_ACCEPT_IN_RXFIFO_1
  Accept in Rx FIFO 1.
  Definition: cy_canfd.h:466
  CY_CANFD_SFEC_STORE_RX_BUFFER
  @ CY_CANFD_SFEC_STORE_RX_BUFFER
  Store into Rx Buffer or as debug message, configuration of SFT[1:0] ignored.
  Definition: cy_canfd.h:553
  Cy_CANFD_Init
  cy_en_canfd_status_t Cy_CANFD_Init(CANFD_Type *base, uint32_t chan, const cy_stc_canfd_config_t *config, cy_stc_canfd_context_t *context)
  Initializes the CAN FD module.
  Definition: cy_canfd.c:261

## ◆ Cy_CANFD_DeInit()

cy_en_canfd_status_t Cy_CANFD_DeInit | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | cy_stc_canfd_context_t * | context
| ) |  |

De-initializes the CAN FD block, returns registers values to default.

Note
  Do not call Cy_CANFD_Disable before Cy_CANFD_DeInit.
  Call this function only after all debug messages reception is completed.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  *context | The pointer to the context structure cy_stc_canfd_context_t allocated by the user. The structure is used during the CAN FD operation for internal configuration and data retention. The user must not modify anything in this structure.

Returns
  cy_en_canfd_status_t

Function Usage
  /* Scenario: The CAN FD block is initialized/working and then no longer used or needs to be reset. */
  cy_stc_canfd_context_t context = {0}; /* This is a shared context structure, it is unique for each channel.
  * It must be global
  */
  if(CY_CANFD_SUCCESS != Cy_CANFD_DeInit (CANFD0, 0UL, &context))
  {
  /* Insert error handling */
  }
  Cy_CANFD_DeInit
  cy_en_canfd_status_t Cy_CANFD_DeInit(CANFD_Type *base, uint32_t chan, cy_stc_canfd_context_t *context)
  De-initializes the CAN FD block, returns registers values to default.
  Definition: cy_canfd.c:567

## ◆ Cy_CANFD_TransmitTxBuffer()

cy_en_canfd_status_t Cy_CANFD_TransmitTxBuffer | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | uint8_t | index
| ) |  |

Starts transmission of the message prepared with Cy_CANFD_TxBufferConfig().

Transmits the message immediately. Function CanFD_Init() must be called before setting up the identifier and enabling this message buffer.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  index | Message buffer index (0-31).

Returns
  cy_en_canfd_status_t

Function Usage
  /* Scenario: The TX buffer is configured with Cy_CANFD_TxBufferConfig()
  * and a message is ready to be sent.
  */
  uint8_t index = 0u; /* TX buffer index (max 31u) */
  if(CY_CANFD_SUCCESS != Cy_CANFD_TransmitTxBuffer(CANFD0, 0UL, index))
  {
  /* Insert error handling */
  }
  Cy_CANFD_TransmitTxBuffer
  cy_en_canfd_status_t Cy_CANFD_TransmitTxBuffer(CANFD_Type *base, uint32_t chan, uint8_t index)
  Starts transmission of the message prepared with Cy_CANFD_TxBufferConfig().
  Definition: cy_canfd.c:1821

## ◆ Cy_CANFD_UpdateAndTransmitMsgBuffer()

cy_en_canfd_status_t Cy_CANFD_UpdateAndTransmitMsgBuffer | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | const cy_stc_canfd_tx_buffer_t * | txBuffer,
|  | uint8_t | index,
|  | cy_stc_canfd_context_t const * | context
| ) |  |

Updates the T0 and T1 Tx buffer element parameters in Message RAM and copies data from cy_stc_canfd_tx_buffer_t structure to Message RAM.

Transmits the message immediately. Function CanFD_Init() must be called before setting up the identifier and enabling this message buffer.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  *txBuffer | The Tx Buffer configuration structure.
  index | the message buffer index (0-31).
  context | The pointer to the context structure cy_stc_canfd_context_t allocated by the user. The structure is used during the CAN FD operation for internal configuration and data retention. The user must not modify anything in this structure.

Returns
  cy_en_canfd_status_t

Function Usage
  /* Scenario: Configure a transmit buffer for the CAN FD transmit operation */
  cy_stc_canfd_context_t context = {0}; /* This is a shared context structure, it is unique for each channel.
  * It must be global
  */
  uint8_t index = 0U; /* Tx Buffer Element number */
  cy_stc_canfd_t0_t t0fConfig =
  {
  /* .id */ 0x00000055UL,
  /* .rtr */ CY_CANFD_RTR_DATA_FRAME,
  /* .xtd */ CY_CANFD_XTD_STANDARD_ID,
  /* .esi */ CY_CANFD_ESI_ERROR_PASSIVE
  };
  cy_stc_canfd_t1_t t1fConfig =
  {
  /* .dlc */ 15U,
  /* .brs */ true,
  /* .fdf */ CY_CANFD_FDF_CAN_FD_FRAME,
  /* .efc */ false,
  /* .mm */ 0UL
  };
  uint32_t data[16] =
  {
  0x00000000UL, 0x11111111UL, 0x22222222UL, 0x33333333UL,
  0x44444444UL, 0x55555555UL, 0x66666666UL, 0x77777777UL,
  0x88888888UL, 0x99999999UL, 0xAAAAAAAAUL, 0xBBBBBBBBUL,
  0xCCCCCCCCUL, 0xDDDDDDDDUL, 0xEEEEEEEEUL, 0xFFFFFFFFUL
  };
  const cy_stc_canfd_tx_buffer_t txBufferConfig =
  {
  /* .t0_f */ &t0fConfig,
  /* .t1_f */ &t1fConfig,
  /* data_area_f */ data
  };
  if(CY_CANFD_SUCCESS != Cy_CANFD_UpdateAndTransmitMsgBuffer(CANFD0, 0UL, &txBufferConfig, index, &context))
  {
  /* Insert error handling */
  }
  Cy_CANFD_UpdateAndTransmitMsgBuffer
  cy_en_canfd_status_t Cy_CANFD_UpdateAndTransmitMsgBuffer(CANFD_Type *base, uint32_t chan, const cy_stc_canfd_tx_buffer_t *txBuffer, uint8_t index, cy_stc_canfd_context_t const *context)
  Updates the T0 and T1 Tx buffer element parameters in Message RAM and copies data from cy_stc_canfd_t...
  Definition: cy_canfd.c:1874

## ◆ Cy_CANFD_GetTxBufferStatus()

cy_en_canfd_tx_buffer_status_t Cy_CANFD_GetTxBufferStatus | ( | CANFD_Type const * | base,
|  | uint32_t | chan,
|  | uint8_t | index
| ) |  |

Gets the status of the CAN FD Tx buffer.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  index | Message buffer index (0-31).

Returns
  cy_en_canfd_status_t

Function Usage
  /* Scenario: Checks if the buffer was transmitted. */
  uint8_t index = 0u; /* TX buffer index (max 31u) */
  if (CY_CANFD_TX_BUFFER_TRANSMIT_OCCURRED == Cy_CANFD_GetTxBufferStatus(CANFD0, 0UL, index))
  {
  /* The buffer with index 0 was transmitted */
  }
  CY_CANFD_TX_BUFFER_TRANSMIT_OCCURRED
  @ CY_CANFD_TX_BUFFER_TRANSMIT_OCCURRED
  Transmission occurred.
  Definition: cy_canfd.h:437
  Cy_CANFD_GetTxBufferStatus
  cy_en_canfd_tx_buffer_status_t Cy_CANFD_GetTxBufferStatus(CANFD_Type const *base, uint32_t chan, uint8_t index)
  Gets the status of the CAN FD Tx buffer.
  Definition: cy_canfd.c:1912

## ◆ Cy_CANFD_GetInterruptStatus()

__STATIC_INLINE uint32_t Cy_CANFD_GetInterruptStatus | ( | CANFD_Type const * | base,
|  | uint32_t | chan
| ) |  |

Returns a status of CAN FD interrupt requests.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.

Returns
  uint32_t The bit mask of the Interrupt Status. Valid masks can be found in RX Interrupt masks, TX Interrupt masks and Error Interrupt masks.

Function Usage
  /* Scenario: Checks for a new message in the RX buffer. */
  uint32_t status;
  status = Cy_CANFD_GetInterruptStatus(CANFD0, 0UL);
  if (0 != (status & CY_CANFD_RX_BUFFER_NEW_MESSAGE))
  {
  /* Process the received message */
  }
  Cy_CANFD_GetInterruptStatus
  __STATIC_INLINE uint32_t Cy_CANFD_GetInterruptStatus(CANFD_Type const *base, uint32_t chan)
  Returns a status of CAN FD interrupt requests.
  Definition: cy_canfd.h:1577
  CY_CANFD_RX_BUFFER_NEW_MESSAGE
  #define CY_CANFD_RX_BUFFER_NEW_MESSAGE
  Message stored to Dedicated Rx Buffer.
  Definition: cy_canfd.h:288

## ◆ Cy_CANFD_ClearInterrupt()

__STATIC_INLINE void Cy_CANFD_ClearInterrupt | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | uint32_t | status
| ) |  |

Clears CAN FD interrupts by setting each bit.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  status | The bitmask of statuses to clear. Valid masks can be found in RX Interrupt masks, TX Interrupt masks and Error Interrupt masks.

Function Usage
  /* Scenario: Clears all RX interrupts by setting corresponding bits to 1. */
  uint32_t status = (CY_CANFD_RX_BUFFER_NEW_MESSAGE | /* Message stored to Rx Buffer */
  CY_CANFD_RX_FIFO_1_NEW_MESSAGE | /* Rx FIFO 1 New Message */
  CY_CANFD_RX_FIFO_0_NEW_MESSAGE); /* Rx FIFO 0 New Message */
  Cy_CANFD_ClearInterrupt(CANFD0, 0UL, status);
  Cy_CANFD_ClearInterrupt
  __STATIC_INLINE void Cy_CANFD_ClearInterrupt(CANFD_Type *base, uint32_t chan, uint32_t status)
  Clears CAN FD interrupts by setting each bit.
  Definition: cy_canfd.h:1605
  CY_CANFD_RX_FIFO_0_NEW_MESSAGE
  #define CY_CANFD_RX_FIFO_0_NEW_MESSAGE
  Rx FIFO 0 New Message.
  Definition: cy_canfd.h:286
  CY_CANFD_RX_FIFO_1_NEW_MESSAGE
  #define CY_CANFD_RX_FIFO_1_NEW_MESSAGE
  Rx FIFO 1 New Message.
  Definition: cy_canfd.h:287

## ◆ Cy_CANFD_GetInterruptMask()

__STATIC_INLINE uint32_t Cy_CANFD_GetInterruptMask | ( | CANFD_Type const * | base,
|  | uint32_t | chan
| ) |  |

Returns an interrupt mask.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.

Returns
  uint32_t The bit field determines which status changes can cause an interrupt. Valid masks can be found in RX Interrupt masks, TX Interrupt masks and Error Interrupt masks.

Function Usage
  /* Scenario: Checks if the RX buffer interrupt is enabled. */
  if (0 != (Cy_CANFD_GetInterruptMask(CANFD0, 0UL) & CY_CANFD_RX_BUFFER_NEW_MESSAGE))
  {
  /* The RX buffer interrupt is enabled */
  }
  Cy_CANFD_GetInterruptMask
  __STATIC_INLINE uint32_t Cy_CANFD_GetInterruptMask(CANFD_Type const *base, uint32_t chan)
  Returns an interrupt mask.
  Definition: cy_canfd.h:1633

## ◆ Cy_CANFD_SetInterruptMask()

__STATIC_INLINE void Cy_CANFD_SetInterruptMask | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | uint32_t | interrupt
| ) |  |

Configures which bits of the interrupt request register can trigger an interrupt event.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  interrupt | The bit field determines which status changes can cause an interrupt. Valid masks can be found in RX Interrupt masks, TX Interrupt masks and Error Interrupt masks.

Function Usage
  /* Scenario: Enables the interrupts from the RX buffer, RX FIFO 0 and RX FIFO 1. */
  uint32_t status = (CY_CANFD_RX_BUFFER_NEW_MESSAGE | /* Message stored to Rx Buffer */
  CY_CANFD_RX_FIFO_1_NEW_MESSAGE | /* Rx FIFO 1 New Message */
  CY_CANFD_RX_FIFO_0_NEW_MESSAGE); /* Rx FIFO 0 New Message */
  Cy_CANFD_SetInterruptMask(CANFD0, 0UL, status);
  Cy_CANFD_SetInterruptMask
  __STATIC_INLINE void Cy_CANFD_SetInterruptMask(CANFD_Type *base, uint32_t chan, uint32_t interrupt)
  Configures which bits of the interrupt request register can trigger an interrupt event.
  Definition: cy_canfd.h:1662

## ◆ Cy_CANFD_GetInterruptLine()

__STATIC_INLINE uint32_t Cy_CANFD_GetInterruptLine | ( | CANFD_Type const * | base,
|  | uint32_t | chan
| ) |  |

Returns the interrupt signals assigned to the line m_ttcan_int0 or m_ttcan_int1.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.

Returns
  uint32_t The mask where 1 corresponds to the interrupt signals assigned to the line m_ttcan_int1 and 0 corresponds to m_ttcan_int0. Valid masks can be found in RX Interrupt masks, TX Interrupt masks and Error Interrupt masks.

Function Usage
  /* Scenario: Checks if Transmission Completed Interrupt uses the line m_ttcan_int1. */
  uint32_t interruptLine;
  interruptLine = Cy_CANFD_GetInterruptLine(CANFD0, 0UL);
  if (0 != (interruptLine & CY_CANFD_TRANSMISSION_COMPLETE))
  {
  /* Transmission Completed Interrupt uses the line m_ttcan_int1 */
  }
  Cy_CANFD_GetInterruptLine
  __STATIC_INLINE uint32_t Cy_CANFD_GetInterruptLine(CANFD_Type const *base, uint32_t chan)
  Returns the interrupt signals assigned to the line m_ttcan_int0 or m_ttcan_int1.
  Definition: cy_canfd.h:1692
  CY_CANFD_TRANSMISSION_COMPLETE
  #define CY_CANFD_TRANSMISSION_COMPLETE
  Transmission Completed.
  Definition: cy_canfd.h:303

## ◆ Cy_CANFD_SetInterruptLine()

__STATIC_INLINE void Cy_CANFD_SetInterruptLine | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | uint32_t | interruptLineMask
| ) |  |

Configures the bits of the Interrupt Line Select Register to assign the interrupt signal to the line m_ttcan_int0 or m_ttcan_int1.

Bit = 0: The interrupt assigned to the interrupt line m_ttcan_int0, bit = 1: The interrupt assigned to the interrupt line m_ttcan_int1.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  interruptLineMask | The mask where 1 corresponds to the interrupt signals assigned to the line m_ttcan_int1 and 0 corresponds to m_ttcan_int0. Valid masks can be found in RX Interrupt masks, TX Interrupt masks and Error Interrupt masks.

Function Usage
  /* Scenario: Sets Transmission Completed Interrupt to the interrupt
  * line m_ttcan_int1.
  */
  Cy_CANFD_SetInterruptLine(CANFD0, 0UL, Cy_CANFD_GetInterruptLine(CANFD0, 0UL) |
  CY_CANFD_TRANSMISSION_COMPLETE);
  Cy_CANFD_SetInterruptLine
  __STATIC_INLINE void Cy_CANFD_SetInterruptLine(CANFD_Type *base, uint32_t chan, uint32_t interruptLineMask)
  Configures the bits of the Interrupt Line Select Register to assign the interrupt signal to the line ...
  Definition: cy_canfd.h:1724

## ◆ Cy_CANFD_IsInterruptLineEnabled()

__STATIC_INLINE bool Cy_CANFD_IsInterruptLineEnabled | ( | CANFD_Type const * | base,
|  | uint32_t | chan,
|  | uint32_t | interruptLineMask
| ) |  |

Checks whether Interrupt Line 0, Interrupt Line 1 or both are enabled.

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  interruptLineMask | The bit mask to check which interrupt line is enabled. Can be CY_CANFD_INTERRUPT_LINE_0_EN, CY_CANFD_INTERRUPT_LINE_1_EN or (CY_CANFD_INTERRUPT_LINE_0_EN | CY_CANFD_INTERRUPT_LINE_1_EN)

Returns
  bool The bit mask of the enabled interrupt lines.

Function Usage
  /* Scenario: Checks if the interrupt line m_ttcan_int0 is enabled. */
  #define INT_LINE_MASK CY_CANFD_INTERRUPT_LINE_0_EN
  if (Cy_CANFD_IsInterruptLineEnabled(CANFD0, 0UL, INT_LINE_MASK))
  {
  /* The interrupt line m_ttcan_int0 is enabled */
  }
  Cy_CANFD_IsInterruptLineEnabled
  __STATIC_INLINE bool Cy_CANFD_IsInterruptLineEnabled(CANFD_Type const *base, uint32_t chan, uint32_t interruptLineMask)
  Checks whether Interrupt Line 0, Interrupt Line 1 or both are enabled.
  Definition: cy_canfd.h:1754

## ◆ Cy_CANFD_EnableInterruptLine()

__STATIC_INLINE void Cy_CANFD_EnableInterruptLine | ( | CANFD_Type * | base,
|  | uint32_t | chan,
|  | uint32_t | interruptLineMask
| ) |  |

Configures which interrupt line is enabled (Interrupt Line 0, Interrupt Line 1 or both).

Parameters

  *base | The pointer to a CAN FD instance.
  chan | The CAN FD channel number.
  interruptLineMask | The bit mask whose bits define interrupt lines to enable or disable.

Function Usage
  /* Scenario: Enables the interrupt line m_ttcan_int0. */
  Cy_CANFD_EnableInterruptLine(CANFD0, 0UL, CY_CANFD_INTERRUPT_LINE_0_EN);
  Cy_CANFD_EnableInterruptLine
  __STATIC_INLINE void Cy_CANFD_EnableInterruptLine(CANFD_Type *base, uint32_t chan, uint32_t interruptLineMask)
  Configures which interrupt line is enabled (Interrupt Line 0, Interrupt Line 1 or both).
  Definition: cy_canfd.h:1780
  CY_CANFD_INTERRUPT_LINE_0_EN
  #define CY_CANFD_INTERRUPT_LINE_0_EN
  Enable Interrupt Line 0.
  Definition: cy_canfd.h:359