Functions

group group_scb_common_functions

Functions

__STATIC_INLINE uint32_t Cy_SCB_ReadRxFifo (CySCB_Type const *base)

Reads a data element directly out of the RX FIFO.

This function does not check whether the RX FIFO has data before reading it.

Return

Data from RX FIFO.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_SetRxFifoLevel (CySCB_Type *base, uint32_t level)

Sets the RX FIFO level.

When there are more data elements in the RX FIFO than this level, the RX FIFO level interrupt is triggered.

Parameters
  • base: The pointer to the SCB instance.

  • level: When there are more data elements in the FIFO than this level, the RX level interrupt is triggered.

__STATIC_INLINE uint32_t Cy_SCB_GetNumInRxFifo (CySCB_Type const *base)

Returns the number of data elements currently in the RX FIFO.

Return

The number or data elements in RX FIFO.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE uint32_t Cy_SCB_GetRxSrValid (CySCB_Type const *base)

Returns the status of the RX FIFO Shift Register valid bit.

Return

1 - RX shift register valid; 0 - RX shift register not valid.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_ClearRxFifo (CySCB_Type *base)

Clears the RX FIFO and shifter.

note

If there is partial data in the shifter, it is cleared and lost.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_WriteTxFifo (CySCB_Type *base, uint32_t data)

Writes data directly into the TX FIFO.

This function does not check whether the TX FIFO is not full before writing into it.

Parameters
  • base: The pointer to the SCB instance.

  • data: Data to write to the TX FIFO.

__STATIC_INLINE void Cy_SCB_SetTxFifoLevel (CySCB_Type *base, uint32_t level)

Sets the TX FIFO level.

When there are fewer data elements in the TX FIFO than this level, the TX FIFO level interrupt is triggered.

Parameters
  • base: The pointer to the SCB instance.

  • level: When there are fewer data elements in the FIFO than this level, the TX level interrupt is triggered.

__STATIC_INLINE uint32_t Cy_SCB_GetNumInTxFifo (CySCB_Type const *base)

Returns the number of data elements currently in the TX FIFO.

Return

The number or data elements in the TX FIFO.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE uint32_t Cy_SCB_GetTxSrValid (CySCB_Type const *base)

Returns the status of the TX FIFO Shift Register valid bit.

Return

1 - TX shift register valid; 0 - TX shift register not valid.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE bool Cy_SCB_IsTxComplete (CySCB_Type const *base)

Checks whether the TX FIFO and Shifter are empty and there is no more data to send.

Return

If true, transmission complete. If false, transmission is not complete.

Parameters
  • base: Pointer to SPI the SCB instance.

__STATIC_INLINE void Cy_SCB_ClearTxFifo (CySCB_Type *base)

Clears the TX FIFO.

note

The TX FIFO clear operation also clears the shift register. Thus the shifter could be cleared in the middle of a data element transfer. Thia results in "ones" being sent on the bus for the remainder of the transfer.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_SetByteMode (CySCB_Type *base, bool byteMode)

Sets whether the RX and TX FIFOs are in byte mode.

The FIFOs are either 16-bit wide or 8-bit wide (byte mode). When the FIFO is in byte mode it is twice as deep. See the device datasheet for FIFO depths.

Parameters
  • base: The pointer to the SCB instance.

  • byteMode: If true, TX and RX FIFOs are 8-bit wide. If false, the FIFOs are 16-bit wide.

__STATIC_INLINE uint32_t Cy_SCB_GetInterruptCause (CySCB_Type const *base)

Returns the mask of bits showing the source of the current triggered interrupt.

This is useful for modes of operation where an interrupt can be generated by conditions in multiple interrupt source registers.

Return

The mask with the OR of the following conditions that have been triggered. See SCB Interrupt Causes for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE uint32_t Cy_SCB_GetRxInterruptStatus (CySCB_Type const *base)

Returns the RX interrupt request register.

This register contains the current status of the RX interrupt sources.

Return

The current status of the RX interrupt sources. Each constant is a bit field value. The value returned may have multiple bits set to indicate the current status. See RX Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_SetRxInterruptMask (CySCB_Type *base, uint32_t interruptMask)

Writes the RX interrupt mask register.

This register configures which bits from the RX interrupt request register can trigger an interrupt event.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: Enabled RX interrupt sources. See RX Interrupt Statuses.

__STATIC_INLINE uint32_t Cy_SCB_GetRxInterruptMask (CySCB_Type const *base)

Returns the RX interrupt mask register.

This register specifies which bits from the RX interrupt request register trigger can an interrupt event.

Return

Enabled RX interrupt sources. See RX Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE uint32_t Cy_SCB_GetRxInterruptStatusMasked (CySCB_Type const *base)

Returns the RX interrupt masked request register.

This register contains a logical AND of corresponding bits from the RX interrupt request and mask registers. This function is intended to be used in the interrupt service routine to identify which of the enabled RX interrupt sources caused the interrupt event.

Return

The current status of enabled RX interrupt sources. See RX Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_ClearRxInterrupt (CySCB_Type *base, uint32_t interruptMask)

Clears the RX interrupt sources in the interrupt request register.

note

  • CY_SCB_INTR_RX_FIFO_LEVEL interrupt source is not cleared when the RX FIFO has more entries than the level.

  • CY_SCB_INTR_RX_NOT_EMPTY interrupt source is not cleared when the RX FIFO is not empty.

  • CY_SCB_INTR_RX_FULL interrupt source is not cleared when the RX FIFO is full.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: The RX interrupt sources to be cleared. See RX Interrupt Statuses for the set of constants.

__STATIC_INLINE void Cy_SCB_SetRxInterrupt (CySCB_Type *base, uint32_t interruptMask)

Sets the RX interrupt sources in the interrupt request register.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: The RX interrupt sources to set in the RX interrupt request register. See RX Interrupt Statuses for the set of constants.

__STATIC_INLINE uint32_t Cy_SCB_GetTxInterruptStatus (CySCB_Type const *base)

Returns the TX interrupt request register.

This register contains the current status of the TX interrupt sources.

Return

The current status of TX interrupt sources. Each constant is a bit field value. The value returned may have multiple bits set to indicate the current status. See TX Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_SetTxInterruptMask (CySCB_Type *base, uint32_t interruptMask)

Writes the TX interrupt mask register.

This register configures which bits from the TX interrupt request register can trigger an interrupt event.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: Enabled TX interrupt sources. See TX Interrupt Statuses for the set of constants.

__STATIC_INLINE uint32_t Cy_SCB_GetTxInterruptMask (CySCB_Type const *base)

Returns the TX interrupt mask register.

This register specifies which bits from the TX interrupt request register can trigger an interrupt event.

Return

Enabled TX interrupt sources. See TX Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE uint32_t Cy_SCB_GetTxInterruptStatusMasked (CySCB_Type const *base)

Returns the TX interrupt masked request register.

This register contains a logical AND of corresponding bits from the TX interrupt request and mask registers. This function is intended to be used in the interrupt service routine to identify which of enabled TX interrupt sources caused the interrupt event.

Return

The current status of enabled TX interrupt sources. See TX Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_ClearTxInterrupt (CySCB_Type *base, uint32_t interruptMask)

Clears the TX interrupt sources in the interrupt request register.

note

  • CY_SCB_INTR_TX_FIFO_LEVEL interrupt source is not cleared when the TX FIFO has fewer entries than the TX level.

  • CY_SCB_INTR_TX_NOT_FULL interrupt source is not cleared when the TX FIFO has empty entries in the TX FIFO.

  • CY_SCB_INTR_TX_EMPTY interrupt source is not cleared when the TX FIFO is empty.

  • CY_SCB_INTR_TX_UNDERFLOW interrupt source is not cleared when the TX FIFO is empty. Put data into the TX FIFO before clearing it.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: The TX interrupt sources to be cleared. See TX Interrupt Statuses for the set of constants.

__STATIC_INLINE void Cy_SCB_SetTxInterrupt (CySCB_Type *base, uint32_t interruptMask)

Sets TX interrupt sources in the interrupt request register.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: The TX interrupt sources to set in the TX interrupt request register. See TX Interrupt Statuses for the set of constants.

__STATIC_INLINE uint32_t Cy_SCB_GetMasterInterruptStatus (CySCB_Type const *base)

Returns the master interrupt request register.

This register contains the current status of the master interrupt sources.

Return

The current status of the master interrupt sources. Each constant is a bit field value. The value returned may have multiple bits set to indicate the current status. See Master Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_SetMasterInterruptMask (CySCB_Type *base, uint32_t interruptMask)

Writes the master interrupt mask register.

This register specifies which bits from the master interrupt request register can trigger an interrupt event.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: The master interrupt sources to be enable. See Master Interrupt Statuses for the set of constants.

__STATIC_INLINE uint32_t Cy_SCB_GetMasterInterruptMask (CySCB_Type const *base)

Returns the master interrupt mask register.

This register specifies which bits from the master interrupt request register can trigger an interrupt event.

Return

Enabled master interrupt sources. See Master Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE uint32_t Cy_SCB_GetMasterInterruptStatusMasked (CySCB_Type const *base)

Returns the master interrupt masked request register.

This register contains a logical AND of corresponding bits from the master interrupt request and mask registers. This function is intended to be used in the interrupt service routine to identify which of the enabled master interrupt sources caused the interrupt event.

Return

The current status of enabled master interrupt sources. See Master Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_ClearMasterInterrupt (CySCB_Type *base, uint32_t interruptMask)

Clears master interrupt sources in the interrupt request register.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: The master interrupt sources to be cleared. See Master Interrupt Statuses for the set of constants.

__STATIC_INLINE void Cy_SCB_SetMasterInterrupt (CySCB_Type *base, uint32_t interruptMask)

Sets master interrupt sources in the interrupt request register.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: The master interrupt sources to set in the master interrupt request register. See Master Interrupt Statuses for the set of constants.

__STATIC_INLINE uint32_t Cy_SCB_GetSlaveInterruptStatus (CySCB_Type const *base)

Returns the slave interrupt request register.

This register contains the current status of the slave interrupt sources.

Return

The current status of the slave interrupt sources. Each constant is a bit field value. The value returned may have multiple bits set to indicate the current status. See Slave Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_SetSlaveInterruptMask (CySCB_Type *base, uint32_t interruptMask)

Writes slave interrupt mask register.

This register specifies which bits from the slave interrupt request register can trigger an interrupt event.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: Enabled slave interrupt sources. See Slave Interrupt Statuses for the set of constants.

__STATIC_INLINE uint32_t Cy_SCB_GetSlaveInterruptMask (CySCB_Type const *base)

Returns the slave interrupt mask register.

This register specifies which bits from the slave interrupt request register can trigger an interrupt event.

Return

Enabled slave interrupt sources. See Slave Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE uint32_t Cy_SCB_GetSlaveInterruptStatusMasked (CySCB_Type const *base)

Returns the slave interrupt masked request register.

This register contains a logical AND of corresponding bits from the slave interrupt request and mask registers. This function is intended to be used in the interrupt service routine to identify which of enabled slave interrupt sources caused the interrupt event.

Return

The current status of enabled slave interrupt sources. See Slave Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_ClearSlaveInterrupt (CySCB_Type *base, uint32_t interruptMask)

Clears the slave interrupt sources in the interrupt request register.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: Slave interrupt sources to be cleared. See Slave Interrupt Statuses for the set of constants.

__STATIC_INLINE void Cy_SCB_SetSlaveInterrupt (CySCB_Type *base, uint32_t interruptMask)

Sets slave interrupt sources in the interrupt request register.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: The slave interrupt sources to set in the slave interrupt request register See Slave Interrupt Statuses for the set of constants.

__STATIC_INLINE uint32_t Cy_SCB_GetI2CInterruptStatus (CySCB_Type const *base)

Returns the I2C interrupt request register.

This register contains the current status of the I2C interrupt sources.

Return

The current status of the I2C interrupt sources. Each constant is a bit field value. The value returned may have multiple bits set to indicate the current status. See Slave Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_SetI2CInterruptMask (CySCB_Type *base, uint32_t interruptMask)

Writes the I2C interrupt mask register.

This register specifies which bits from the I2C interrupt request register can trigger an interrupt event.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: Enabled I2C interrupt sources. See I2C Interrupt Statuses for the set of constants.

__STATIC_INLINE uint32_t Cy_SCB_GetI2CInterruptMask (CySCB_Type const *base)

Returns the I2C interrupt mask register.

This register specifies which bits from the I2C interrupt request register can trigger an interrupt event.

Return

Enabled I2C interrupt sources. See I2C Interrupt Statuses.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE uint32_t Cy_SCB_GetI2CInterruptStatusMasked (CySCB_Type const *base)

Returns the I2C interrupt masked request register.

This register contains a logical AND of corresponding bits from I2C interrupt request and mask registers. This function is intended to be used in the interrupt service routine to identify which of enabled I2C interrupt sources caused the interrupt event.

Return

The current status of enabled I2C interrupt sources. See I2C Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_ClearI2CInterrupt (CySCB_Type *base, uint32_t interruptMask)

Clears I2C interrupt sources in the interrupt request register.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: The I2C interrupt sources to be cleared. See I2C Interrupt Statuses for the set of constants.

__STATIC_INLINE uint32_t Cy_SCB_GetSpiInterruptStatus (CySCB_Type const *base)

Returns the SPI interrupt request register.

This register contains the current status of the SPI interrupt sources.

Return

The current status of SPI interrupt sources. Each constant is a bit field value. The value returned may have multiple bits set to indicate the current status See SPI Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_SetSpiInterruptMask (CySCB_Type *base, uint32_t interruptMask)

Writes the SPI interrupt mask register.

This register specifies which bits from the SPI interrupt request register can trigger an interrupt event.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: Enabled SPI interrupt sources. See SPI Interrupt Statuses for the set of constants.

__STATIC_INLINE uint32_t Cy_SCB_GetSpiInterruptMask (CySCB_Type const *base)

Returns the SPI interrupt mask register.

This register specifies which bits from the SPI interrupt request register can trigger an interrupt event.

Return

Enabled SPI interrupt sources. See SPI Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE uint32_t Cy_SCB_GetSpiInterruptStatusMasked (CySCB_Type const *base)

Returns the SPI interrupt masked request register.

This register contains a logical AND of corresponding bits from the SPI interrupt request and mask registers. This function is intended to be used in the interrupt service routine to identify which of enabled SPI interrupt sources caused the interrupt event.

Return

The current status of enabled SPI interrupt sources. See SPI Interrupt Statuses for the set of constants.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE void Cy_SCB_ClearSpiInterrupt (CySCB_Type *base, uint32_t interruptMask)

Clears SPI interrupt sources in the interrupt request register.

Parameters
  • base: The pointer to the SCB instance.

  • interruptMask: The SPI interrupt sources to be cleared. See SPI Interrupt Statuses for the set of constants.

__STATIC_INLINE void Cy_SCB_SetMemWidth (CySCB_Type *base, uint32_t MemWidthMode)

Sets the RX and TX FIFOs byte mode/halfword/word mode.

The FIFOs are either 8-bit(byte),16-bit(halfword) or 32-bit (word) wide. See the device datasheet for FIFO depths.

note

This API is available for CAT1B devices.

Parameters
  • base: The pointer to the SCB instance.

  • MemWidthMode: If 0x0, TX and RX FIFOs are 8-bit wide. If 0x1, the FIFOs are 16-bit wide. If 0x2, the FIFOs are 32-bit wide.

__STATIC_INLINE uint32_t Cy_SCB_Get_RxDataWidth (CySCB_Type const *base)

Returns the RX data width.

note

This API is available for CAT1B devices.

Return

RX data width.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE bool Cy_SCB_IsTxDataWidthByte (CySCB_Type const *base)

Returns true if the TX data width is a byte (8 bits).

Return

If true, the TX data width is a byte (8 bits). Otherwise, false.

Parameters
  • base: The pointer to the SCB instance.

__STATIC_INLINE uint32_t Cy_SCB_Get_TxDataWidth (CySCB_Type const *base)

Returns the TX data width.

note

This API is available for CAT1B devices.

Return

The TX data width.

Parameters
  • base: The pointer to the SCB instance.