MTB CAT1 Peripheral driver library

General Description

Functions

cy_en_tdm_status_t Cy_AudioTDM_Init (TDM_STRUCT_Type *base, cy_stc_tdm_config_t const *config)
 Initializes the TDM module in accordance with a configuration structure. More...
 
void Cy_AudioTDM_DeInit (TDM_STRUCT_Type *base)
 Deinitialize the TDM block. More...
 
__STATIC_INLINE void Cy_AudioTDM_EnableTx (TDM_TX_STRUCT_Type *base)
 Starts an I2S/TDM transmission. More...
 
__STATIC_INLINE void Cy_AudioTDM_DisableTx (TDM_TX_STRUCT_Type *base)
 Stops an I2S/TDM transmission. More...
 
__STATIC_INLINE void Cy_AudioTDM_EnableRx (TDM_RX_STRUCT_Type *base)
 Starts an I2S/TDM transmission. More...
 
__STATIC_INLINE void Cy_AudioTDM_DisableRx (TDM_RX_STRUCT_Type *base)
 Stops an I2S/TDM transmission. More...
 
__STATIC_INLINE void Cy_AudioTDM_WriteTxData (TDM_TX_STRUCT_Type *base, uint32_t data)
 Writes data to the TX FIFO. More...
 
__STATIC_INLINE void Cy_AudioTDM_FreezeTxFifo (TDM_TX_STRUCT_Type *base)
 Freezes the TX FIFO. More...
 
__STATIC_INLINE void Cy_AudioTDM_UnfreezeTxFifo (TDM_TX_STRUCT_Type *base)
 Unfreezes the TX FIFO. More...
 
__STATIC_INLINE void Cy_AudioTDM_MuteTxFifo (TDM_TX_STRUCT_Type *base)
 Mutes the TX FIFO. More...
 
__STATIC_INLINE void Cy_AudioTDM_ActivateTx (TDM_TX_STRUCT_Type *base)
 Activate/start the TX FIFO. More...
 
__STATIC_INLINE void Cy_AudioTDM_DeActivateTx (TDM_TX_STRUCT_Type *base)
 Stop the TX FIFO. More...
 
__STATIC_INLINE void Cy_AudioTDM_ReplayTxFifo (TDM_TX_STRUCT_Type *base)
 Replay functionality (used when FREEZE is '1' or in case of a FIFO underflow event). More...
 
__STATIC_INLINE uint8_t Cy_AudioTDM_GetNumInTxFifo (TDM_TX_STRUCT_Type *base)
 Gets the number of used words in the TX FIFO., Number of used/occupied entries in the TX FIFO. More...
 
__STATIC_INLINE uint8_t Cy_AudioTDM_GetTxReadPointer (TDM_TX_STRUCT_Type *base)
 Get the TX FIFO Read Pointer. More...
 
__STATIC_INLINE uint8_t Cy_AudioTDM_GetTxWritePointer (TDM_TX_STRUCT_Type *base)
 Get the TX FIFO Write Pointer. More...
 
__STATIC_INLINE void Cy_AudioTDM_EnableTxTestMode (TDM_TX_STRUCT_Type *base)
 Enables the test mode. More...
 
__STATIC_INLINE void Cy_AudioTDM_DisableTxTestMode (TDM_TX_STRUCT_Type *base)
 Disables Test mode. More...
 
__STATIC_INLINE uint32_t Cy_AudioTDM_ReadRxData (TDM_RX_STRUCT_Type *base)
 Read Rx data from the Rx FIFO. More...
 
__STATIC_INLINE void Cy_AudioTDM_FreezeRxFifo (TDM_RX_STRUCT_Type *base)
 Freeze RX FIFO. More...
 
__STATIC_INLINE void Cy_AudioTDM_UnfreezeRxFifo (TDM_RX_STRUCT_Type *base)
 UnFreeze Rx FIFO. More...
 
__STATIC_INLINE void Cy_AudioTDM_ActivateRx (TDM_RX_STRUCT_Type *base)
 Start Rx FIFO. More...
 
__STATIC_INLINE void Cy_AudioTDM_DeActivateRx (TDM_RX_STRUCT_Type *base)
 Stop Rx FIFO. More...
 
__STATIC_INLINE uint32_t Cy_AudioTDM_ReadSilentRXFifo (TDM_RX_STRUCT_Type *base)
 When the RX FIFO is empty, a read from this register returns "0". More...
 
__STATIC_INLINE uint8_t Cy_AudioTDM_GetNumInRxFifo (TDM_RX_STRUCT_Type *base)
 Reads RX FIFO status. More...
 
__STATIC_INLINE uint8_t Cy_AudioTDM_GetRxReadPointer (TDM_RX_STRUCT_Type *base)
 Reads RX FIFO Read Pointer RX FIFO read pointer: FIFO location from which a data is read. More...
 
__STATIC_INLINE uint8_t Cy_AudioTDM_GetRxWritePointer (TDM_RX_STRUCT_Type *base)
 Reads RX FIFO Write Pointer RX FIFO write pointer: FIFO location at which a new data is written by the hardware. More...
 
__STATIC_INLINE void Cy_AudioTDM_EnableRxTestMode (TDM_RX_STRUCT_Type *base)
 Enables Test mode (intended to be used with (master transmitter, slave receiver) configuration). More...
 
__STATIC_INLINE void Cy_AudioTDM_DisableRxTestMode (TDM_RX_STRUCT_Type *base)
 Disable RX test mode. More...
 
__STATIC_INLINE void Cy_AudioTDM_ClearTxInterrupt (TDM_TX_STRUCT_Type *base, uint32_t interrupt)
 Clear TX interrupt. More...
 
__STATIC_INLINE void Cy_AudioTDM_SetTxInterrupt (TDM_TX_STRUCT_Type *base, uint32_t interrupt)
 Set the Tx Interrupt. More...
 
__STATIC_INLINE uint32_t Cy_AudioTDM_GetTxInterruptMask (TDM_TX_STRUCT_Type *base)
 Get TX interrupt Mask. More...
 
__STATIC_INLINE void Cy_AudioTDM_SetTxInterruptMask (TDM_TX_STRUCT_Type *base, uint32_t interrupt)
 Set TX interrupt Mask. More...
 
__STATIC_INLINE uint32_t Cy_AudioTDM_GetTxInterruptStatusMasked (TDM_TX_STRUCT_Type *base)
 Reflects a bitwise AND between the INTR_TX and INTR_TX_MASK registers. More...
 
__STATIC_INLINE void Cy_AudioTDM_SetTxTriggerInterruptMask (TDM_TX_STRUCT_Type *base)
 Sets TX interrupt Mask. More...
 
__STATIC_INLINE void Cy_AudioTDM_ClearTxTriggerInterruptMask (TDM_TX_STRUCT_Type *base)
 Clears TX interrupt Mask. More...
 
__STATIC_INLINE void Cy_AudioTDM_ClearRxInterrupt (TDM_RX_STRUCT_Type *base, uint32_t interrupt)
 Clears RX interrupt. More...
 
__STATIC_INLINE void Cy_AudioTDM_SetRxInterrupt (TDM_RX_STRUCT_Type *base, uint32_t interrupt)
 Sets RX interrupt. More...
 
__STATIC_INLINE uint32_t Cy_AudioTDM_GetRxInterruptMask (TDM_RX_STRUCT_Type *base)
 Returns RX interrupt Mask. More...
 
__STATIC_INLINE void Cy_AudioTDM_SetRxInterruptMask (TDM_RX_STRUCT_Type *base, uint32_t interrupt)
 Sets RX interrupt Mask. More...
 
__STATIC_INLINE uint32_t Cy_AudioTDM_GetRxInterruptStatusMasked (TDM_RX_STRUCT_Type *base)
 Returns a bitwise AND between the INTR_RX and INTR_RX_MASK registers. More...
 
__STATIC_INLINE void Cy_AudioTDM_SetRxTriggerInterruptMask (TDM_RX_STRUCT_Type *base)
 Sets Rx Interrupt Mask. More...
 
__STATIC_INLINE void Cy_AudioTDM_ClearRxTriggerInterruptMask (TDM_RX_STRUCT_Type *base)
 Clear RX interrupt Mask. More...
 

Function Documentation

◆ Cy_AudioTDM_Init()

cy_en_tdm_status_t Cy_AudioTDM_Init ( TDM_STRUCT_Type *  base,
cy_stc_tdm_config_t const *  config 
)

Initializes the TDM module in accordance with a configuration structure.

Precondition
If the TDM module is initialized previously, the Cy_AudioTDM_DeInit() must be called before calling this function.
Parameters
baseThe pointer to the TDM instance address.
configThe pointer to a configuration structure.
Returns
error / status code. See cy_en_tdm_status_t.
Function Usage
/* Scenario: Setup a duplex 16-bit TDM interface */
cy_stc_tdm_config_tx_t tdm_lpbk_tx_config =
{
.enable = true,
.masterMode = CY_TDM_DEVICE_MASTER,
.wordSize = CY_TDM_SIZE_16,
.format = CY_TDM_LEFT,
.clkDiv = 16,
.sckPolarity = CY_TDM_CLK,
.fsyncPolarity = CY_TDM_SIGN,
.fsyncFormat = CY_TDM_CH_PERIOD,
.channelNum = 2,
.channelSize = 16,
.fifoTriggerLevel = 36,
.chEn = 0x3,
.signalInput = 0,
.i2sMode = true,
};
cy_stc_tdm_config_rx_t tdm_lpbk_rx_config =
{
.enable = true,
.masterMode = CY_TDM_DEVICE_SLAVE,
.wordSize = CY_TDM_SIZE_16,
.signExtend = CY_ZERO_EXTEND,
.format = CY_TDM_LEFT,
.clkDiv = 16,
.sckPolarity = CY_TDM_CLK,
.fsyncPolarity = CY_TDM_SIGN,
.lateSample = false,
.fsyncFormat = CY_TDM_CH_PERIOD,
.channelNum = 2,
.channelSize = 16,
.fifoTriggerLevel = 32,
.chEn = 0x3,
.signalInput = 0,
.i2sMode = true,
};
const cy_stc_tdm_config_t tdm_lpbk_config =
{
.tx_config = &tdm_lpbk_tx_config,
.rx_config = &tdm_lpbk_rx_config,
};
if(CY_TDM_SUCCESS != Cy_AudioTDM_Init(TDM_STRUCT0, &tdm_lpbk_config))
{
/* Insert error handling */
}
/* Clear possible pending interrupts */
Cy_AudioTDM_ClearTxInterrupt(TDM_STRUCT0_TX, CY_TDM_INTR_TX_MASK);
Cy_AudioTDM_ClearRxInterrupt(TDM_STRUCT0_RX, CY_TDM_INTR_RX_MASK);
/* Enable interrupts */
Cy_AudioTDM_SetTxInterruptMask(TDM_STRUCT0_TX, CY_TDM_INTR_TX_MASK);
Cy_AudioTDM_SetRxInterruptMask(TDM_STRUCT0_RX, CY_TDM_INTR_RX_MASK);
/* Enable the TDM interface */
Cy_AudioTDM_EnableRx(TDM_STRUCT0_RX);
Cy_AudioTDM_EnableTx(TDM_STRUCT0_TX);

◆ Cy_AudioTDM_DeInit()

void Cy_AudioTDM_DeInit ( TDM_STRUCT_Type *  base)

Deinitialize the TDM block.

Parameters
basebase
Function Usage
/* Scenario: The TDM block is initialized/working and then no longer used or needs to be deinit */
Cy_AudioTDM_DeInit (TDM_STRUCT0);

◆ Cy_AudioTDM_EnableTx()

__STATIC_INLINE void Cy_AudioTDM_EnableTx ( TDM_TX_STRUCT_Type *  base)

Starts an I2S/TDM transmission.

Interrupt enabling (by the Cy_AudioTDM_SetTxInterrupt) is required after this function call, in case if any I2S/TDM interrupts are used in the application.

Precondition
Cy_AudioTDM_Init() must be called before.
Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: the TDM block is initialized to operate in TX mode
and its interrupt mask has been configured (if used).
The TX FIFOs are prepared and the block is ready to be enabled for TX communication.*/
Cy_AudioTDM_EnableTx (TDM_STRUCT0_TX);

◆ Cy_AudioTDM_DisableTx()

__STATIC_INLINE void Cy_AudioTDM_DisableTx ( TDM_TX_STRUCT_Type *  base)

Stops an I2S/TDM transmission.

Precondition
TX interrupt disabling (by the Cy_AudioTDM_SetTxInterrupt) is required prior to this function call, in case any TX I2S/TDM interrupts are used.
Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: The TDM transmission is running and no longer required
so needs to be turned off. */
Cy_AudioTDM_DisableTx (TDM_STRUCT0_TX);
/* Disable all the TX interrupts here */

◆ Cy_AudioTDM_EnableRx()

__STATIC_INLINE void Cy_AudioTDM_EnableRx ( TDM_RX_STRUCT_Type *  base)

Starts an I2S/TDM transmission.

Interrupt enabling (by the Cy_AudioTDM_SetRxInterrupt) is required after this function call, in case if any I2S/TDM interrupts are used in the application.

Precondition
Cy_AudioTDM_Init() must be called before.
Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: The TDM block is initialized to operate in RX mode
and its interrupt mask has been configured (if used).
The RX FIFO is cleared and ready for data reception. */
Cy_AudioTDM_EnableRx (TDM_STRUCT0_RX);

◆ Cy_AudioTDM_DisableRx()

__STATIC_INLINE void Cy_AudioTDM_DisableRx ( TDM_RX_STRUCT_Type *  base)

Stops an I2S/TDM transmission.

Precondition
TX interrupt disabling (by the Cy_AudioTDM_SetRxInterrupt) is required prior to this function call, in case any TX I2S/TDM interrupts are used.
Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: The TDM reception is running and no longer required
so needs to be turned off. */
Cy_AudioTDM_DisableRx (TDM_STRUCT0_RX);

◆ Cy_AudioTDM_WriteTxData()

__STATIC_INLINE void Cy_AudioTDM_WriteTxData ( TDM_TX_STRUCT_Type *  base,
uint32_t  data 
)

Writes data to the TX FIFO.

Increases the TX FIFO level.

Parameters
baseThe pointer to the I2S/TDM instance address.
dataData to be written to the TX FIFO.
Function Usage
Cy_AudioTDM_WriteTxData(TDM_STRUCT0_TX, 1UL); /* The last word in the Tx FIFO is 0x00000001. */
Cy_AudioTDM_WriteTxData(TDM_STRUCT0_TX, 2UL); /* Now the last word in the Tx FIFO is 0x00000002,
and previous is 0x00000001. */

◆ Cy_AudioTDM_FreezeTxFifo()

__STATIC_INLINE void Cy_AudioTDM_FreezeTxFifo ( TDM_TX_STRUCT_Type *  base)

Freezes the TX FIFO.

This function is for debug purposes. HW uses a constant PCM data value of "0" or the previous channel PCM data is replayed. Freeze does not advance the FIFO read pointer (the FIFO data is not used).

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: Need to freeze the Tx FIFO for debugging purposes */
Cy_AudioTDM_FreezeTxFifo (TDM_STRUCT0_TX);
/* Now the read pointer of the Tx FIFO will be not affected by HW. */

◆ Cy_AudioTDM_UnfreezeTxFifo()

__STATIC_INLINE void Cy_AudioTDM_UnfreezeTxFifo ( TDM_TX_STRUCT_Type *  base)

Unfreezes the TX FIFO.

This function is for debug purposes. HW uses TX FIFO data and advances the FIFO read pointer.

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: The Tx FIFO was previously frozen and now needs to be unfrozen */
Cy_AudioTDM_UnfreezeTxFifo (TDM_STRUCT0_TX);
/* Now the Tx FIFO works as usually. */

◆ Cy_AudioTDM_MuteTxFifo()

__STATIC_INLINE void Cy_AudioTDM_MuteTxFifo ( TDM_TX_STRUCT_Type *  base)

Mutes the TX FIFO.

HW uses a constant PCM data value of "0". Mute does advance the FIFO read pointer.

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: The TDM transmission is running and there is a need be muted */
Cy_AudioTDM_MuteTxFifo (TDM_STRUCT0_TX);

◆ Cy_AudioTDM_ActivateTx()

__STATIC_INLINE void Cy_AudioTDM_ActivateTx ( TDM_TX_STRUCT_Type *  base)

Activate/start the TX FIFO.

This will set the transmitter state to on.

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: The TDM transmission is paused and there is a need be resumed */
Cy_AudioTDM_ActivateTx (TDM_STRUCT0_TX);
/* FIFO transmission is activated. */

◆ Cy_AudioTDM_DeActivateTx()

__STATIC_INLINE void Cy_AudioTDM_DeActivateTx ( TDM_TX_STRUCT_Type *  base)

Stop the TX FIFO.

This will set the transmitter state to off.

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: The TDM transmission is paused and FIFO transmission is disabled. */
Cy_AudioTDM_DeActivateTx (TDM_STRUCT0_TX);
/* FIFO transmission is deactivated. */

◆ Cy_AudioTDM_ReplayTxFifo()

__STATIC_INLINE void Cy_AudioTDM_ReplayTxFifo ( TDM_TX_STRUCT_Type *  base)

Replay functionality (used when FREEZE is '1' or in case of a FIFO underflow event).

HW uses the previous PCM data value.

Parameters
baseThe pointer to the I2S/TDM instance address.

◆ Cy_AudioTDM_GetNumInTxFifo()

__STATIC_INLINE uint8_t Cy_AudioTDM_GetNumInTxFifo ( TDM_TX_STRUCT_Type *  base)

Gets the number of used words in the TX FIFO., Number of used/occupied entries in the TX FIFO.

The field value is in the range [0, 128]. When "0", the FIFO is empty. When "128", the FIFO is full.

Parameters
baseThe pointer to the I2S/TDM instance address.
Returns
The current number of used words in the TX FIFO.
Function Usage
/* Gets the number of used words in the TX FIFO.,
* Number of used/occupied entries in the TX FIFO. The field value is in the range [0, 128].
* When "0", the FIFO is empty. When "128", the FIFO is full. */
if (126UL > Cy_AudioTDM_GetNumInTxFifo(TDM_STRUCT0_TX))
{
/* There are more than 2 empty words in the TX FIFO,
so load the next TDM frame using Cy_AudioTDM_WriteTxData */
}

◆ Cy_AudioTDM_GetTxReadPointer()

__STATIC_INLINE uint8_t Cy_AudioTDM_GetTxReadPointer ( TDM_TX_STRUCT_Type *  base)

Get the TX FIFO Read Pointer.

TX FIFO read pointer: FIFO location from which a data is read. This functionality is intended for debugging purposes.

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: Need to check the Tx FIFO read pointer */
uint8_t readPointer = Cy_AudioTDM_GetTxReadPointer(TDM_STRUCT0_TX);
/* readPointer now contains the read pointer of the Tx FIFO.
The Tx FIFO read pointer increments when transmission is enabled and
HW takes a data word from FIFO into the transmitter */

◆ Cy_AudioTDM_GetTxWritePointer()

__STATIC_INLINE uint8_t Cy_AudioTDM_GetTxWritePointer ( TDM_TX_STRUCT_Type *  base)

Get the TX FIFO Write Pointer.

TX FIFO write pointer: FIFO location at which a new data is written by the hardware. This functionality is intended for debugging purposes.

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: Need to check the Tx FIFO write pointer */
uint8_t writePointer = Cy_AudioTDM_GetTxWritePointer(TDM_STRUCT0_TX);
/* writePointer now contains the write pointer of the Tx FIFO.
The Tx FIFO write pointer increments when a data word is written into the
FIFO by \ref Cy_AudioTDM_WriteTxData. */

◆ Cy_AudioTDM_EnableTxTestMode()

__STATIC_INLINE void Cy_AudioTDM_EnableTxTestMode ( TDM_TX_STRUCT_Type *  base)

Enables the test mode.

Used for debugging purposes only. Tx and Rx test modes cannot be enabled simultaneously.

Parameters
baseThe pointer to the I2S/TDM instance address.

◆ Cy_AudioTDM_DisableTxTestMode()

__STATIC_INLINE void Cy_AudioTDM_DisableTxTestMode ( TDM_TX_STRUCT_Type *  base)

Disables Test mode.

Parameters
baseThe pointer to the I2S/TDM instance address.

◆ Cy_AudioTDM_ReadRxData()

__STATIC_INLINE uint32_t Cy_AudioTDM_ReadRxData ( TDM_RX_STRUCT_Type *  base)

Read Rx data from the Rx FIFO.

Data (PCM sample) read from the RX FIFO. Reading removes the data from the RX FIFO. Reading from an empty RX FIFO activates FIFO_UNDERFLOW interrupt.

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: Need to get two data words from the Rx FIFO */
uint32_t data[2];
data[0] = Cy_AudioTDM_ReadRxData(TDM_STRUCT0_RX); /* The data[0] contains the first word from the Rx FIFO */
data[1] = Cy_AudioTDM_ReadRxData(TDM_STRUCT0_RX); /* The data[1] contains the next word
(which is actually the first now) from the Rx FIFO */

◆ Cy_AudioTDM_FreezeRxFifo()

__STATIC_INLINE void Cy_AudioTDM_FreezeRxFifo ( TDM_RX_STRUCT_Type *  base)

Freeze RX FIFO.

HW writes from the RX FIFO have no effect: freeze will not advance the FIFO write pointer. This functionality is intended for debugging purposes.

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: Need to freeze the Rx FIFO */
Cy_AudioTDM_FreezeRxFifo(TDM_STRUCT0_RX);
/* Now the write pointer of the Rx FIFO will be not affected by HW. */

◆ Cy_AudioTDM_UnfreezeRxFifo()

__STATIC_INLINE void Cy_AudioTDM_UnfreezeRxFifo ( TDM_RX_STRUCT_Type *  base)

UnFreeze Rx FIFO.

HW writes to the RX FIFO and advances the FIFO write pointer.

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: The Rx FIFO was previously frozen and now needs to be unfrozen */
Cy_AudioTDM_UnfreezeRxFifo(TDM_STRUCT0_RX);
/* Now the Rx FIFO works as usually. */

◆ Cy_AudioTDM_ActivateRx()

__STATIC_INLINE void Cy_AudioTDM_ActivateRx ( TDM_RX_STRUCT_Type *  base)

Start Rx FIFO.

Sets Receiver state to on.

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: The TDM Reception is paused and there is a need be resumed */
Cy_AudioTDM_ActivateRx (TDM_STRUCT0_RX);
/* FIFO reception is activated. */

◆ Cy_AudioTDM_DeActivateRx()

__STATIC_INLINE void Cy_AudioTDM_DeActivateRx ( TDM_RX_STRUCT_Type *  base)

Stop Rx FIFO.

Sets Receiver state to off.

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: The TDM reception is paused and FIFO reception is disabled. */
Cy_AudioTDM_DeActivateRx (TDM_STRUCT0_RX);
/* FIFO Reception is deactivated. */

◆ Cy_AudioTDM_ReadSilentRXFifo()

__STATIC_INLINE uint32_t Cy_AudioTDM_ReadSilentRXFifo ( TDM_RX_STRUCT_Type *  base)

When the RX FIFO is empty, a read from this register returns "0".

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: Need to get a data silently from the Rx FIFO (don't increment FIFO read pointer) */
uint32_t data[4];
data[0] = Cy_AudioTDM_ReadSilentRXFifo(TDM_STRUCT0_RX); /* The data[0] contains the first word from the Rx FIFO */
data[1] = Cy_AudioTDM_ReadSilentRXFifo(TDM_STRUCT0_RX); /* The data[1] contains the same first word from the Rx FIFO */
data[2] = Cy_AudioTDM_ReadRxData(TDM_STRUCT0_RX); /* The data[2] contains the same first word from the Rx FIFO */
data[3] = Cy_AudioTDM_ReadRxData(TDM_STRUCT0_RX); /* The data[3] contains the next (the first now) word from the Rx FIFO */

◆ Cy_AudioTDM_GetNumInRxFifo()

__STATIC_INLINE uint8_t Cy_AudioTDM_GetNumInRxFifo ( TDM_RX_STRUCT_Type *  base)

Reads RX FIFO status.

Number of used/occupied entries in the RX FIFO. The field value is in the range [0, 128]. When "0", the FIFO is empty. When "128", the FIFO is full.

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: Waiting for new received data, check how many data words are in the Rx FIFO */
if (2UL < Cy_AudioTDM_GetNumInRxFifo(TDM_STRUCT0_RX))
{
/* There are more than 2 data words in the RX FIFO,
so get them using Cy_AudioTDM_ReadRxData */
}

◆ Cy_AudioTDM_GetRxReadPointer()

__STATIC_INLINE uint8_t Cy_AudioTDM_GetRxReadPointer ( TDM_RX_STRUCT_Type *  base)

Reads RX FIFO Read Pointer RX FIFO read pointer: FIFO location from which a data is read.

This functionality is intended for debugging purposes.

Parameters
baseThe pointer to the I2S/TDM instance address.
Returns
The current RX Read pointer value.
Function Usage
/* Scenario: Need to check the Rx FIFO read pointer */
uint8_t readPointer = Cy_AudioTDM_GetRxReadPointer(TDM_STRUCT0_RX);
/* readPointer now contains the read pointer of the Rx FIFO.
The Rx FIFO read pointer increments when a data word is read from the
FIFO by \ref Cy_AudioTDM_ReadRxData. */

◆ Cy_AudioTDM_GetRxWritePointer()

__STATIC_INLINE uint8_t Cy_AudioTDM_GetRxWritePointer ( TDM_RX_STRUCT_Type *  base)

Reads RX FIFO Write Pointer RX FIFO write pointer: FIFO location at which a new data is written by the hardware.

This functionality is intended for debugging purposes.

Parameters
baseThe pointer to the I2S/TDM instance address.
Returns
The current RX Write pointer value.
Function Usage
/* Scenario: Need to check the Rx FIFO write pointer */
uint8_t writePointer = Cy_AudioTDM_GetRxWritePointer(TDM_STRUCT0_RX);
/* writePointer now contains the write pointer of the Rx FIFO.
The Rx FIFO write pointer increments when the TDM reception is running
and HW drops a data word into the FIFO. */

◆ Cy_AudioTDM_EnableRxTestMode()

__STATIC_INLINE void Cy_AudioTDM_EnableRxTestMode ( TDM_RX_STRUCT_Type *  base)

Enables Test mode (intended to be used with (master transmitter, slave receiver) configuration).

Both TX and RX should not be set in Test mode simultaneously.

Parameters
baseThe pointer to the I2S/TDM instance address.

◆ Cy_AudioTDM_DisableRxTestMode()

__STATIC_INLINE void Cy_AudioTDM_DisableRxTestMode ( TDM_RX_STRUCT_Type *  base)

Disable RX test mode.

Parameters
baseThe pointer to the I2S/TDM instance address.

◆ Cy_AudioTDM_ClearTxInterrupt()

__STATIC_INLINE void Cy_AudioTDM_ClearTxInterrupt ( TDM_TX_STRUCT_Type *  base,
uint32_t  interrupt 
)

Clear TX interrupt.

Parameters
baseThe pointer to the I2S/TDM instance address.
interruptinterrupt
Function Usage
/* Scenario: Inside the TDM interrupt service routine */
/* Get all the enabled pending interrupts */
uint32_t interrupt = Cy_AudioTDM_GetTxInterruptStatusMasked (TDM_STRUCT0_TX);
if (CY_TDM_INTR_TX_FIFO_TRIGGER & interrupt)
{
/* Handle the TX_FIFO_TRIGGER interrupt - fill the Tx FIFO, etc. */
}
/* Check and handle the rest of TDM interrupt types, if needed */
/* Clear the interrupt */
Cy_AudioTDM_ClearTxInterrupt(TDM_STRUCT0_TX, interrupt);

◆ Cy_AudioTDM_SetTxInterrupt()

__STATIC_INLINE void Cy_AudioTDM_SetTxInterrupt ( TDM_TX_STRUCT_Type *  base,
uint32_t  interrupt 
)

Set the Tx Interrupt.

Parameters
baseThe pointer to the I2S/TDM instance address.
interruptinterrupts to set.
Function Usage
/* Scenario: Test the CY_TDM_INTR_TX_FIFO_TRIGGER interrupt */
Cy_AudioTDM_SetTxInterrupt(TDM_STRUCT0_TX, CY_TDM_INTR_TX_FIFO_TRIGGER); /* Set the CY_TDM_INTR_TX_FIFO_TRIGGER by software */
/* Now the CY_TDM_INTR_TX_FIFO_TRIGGER interrupt should occur (if it is enabled, of course) */

◆ Cy_AudioTDM_GetTxInterruptMask()

__STATIC_INLINE uint32_t Cy_AudioTDM_GetTxInterruptMask ( TDM_TX_STRUCT_Type *  base)

Get TX interrupt Mask.

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: Need to enable the TX_EMPTY interrupt apart from all other interrupts */
uint32_t interrupt = Cy_AudioTDM_GetTxInterruptMask (TDM_STRUCT0_TX);

◆ Cy_AudioTDM_SetTxInterruptMask()

__STATIC_INLINE void Cy_AudioTDM_SetTxInterruptMask ( TDM_TX_STRUCT_Type *  base,
uint32_t  interrupt 
)

Set TX interrupt Mask.

Parameters
baseThe pointer to the I2S/TDM instance address.
interruptinterrupt
Function Usage
/* Scenario: Enable TDM interrupts (if any used) */
Cy_AudioTDM_SetTxInterruptMask (TDM_STRUCT0_TX, CY_TDM_INTR_TX_MASK);
/* Scenario: Disable TDM interrupts (if any enabled) */
Cy_AudioTDM_SetTxInterruptMask (TDM_STRUCT0_TX, 0UL); /* Disable all TDM interrupts */

◆ Cy_AudioTDM_GetTxInterruptStatusMasked()

__STATIC_INLINE uint32_t Cy_AudioTDM_GetTxInterruptStatusMasked ( TDM_TX_STRUCT_Type *  base)

Reflects a bitwise AND between the INTR_TX and INTR_TX_MASK registers.

Parameters
baseThe pointer to the I2S/TDM instance address.

◆ Cy_AudioTDM_SetTxTriggerInterruptMask()

__STATIC_INLINE void Cy_AudioTDM_SetTxTriggerInterruptMask ( TDM_TX_STRUCT_Type *  base)

Sets TX interrupt Mask.

Parameters
baseThe pointer to the I2S/TDM instance address.

◆ Cy_AudioTDM_ClearTxTriggerInterruptMask()

__STATIC_INLINE void Cy_AudioTDM_ClearTxTriggerInterruptMask ( TDM_TX_STRUCT_Type *  base)

Clears TX interrupt Mask.

Parameters
baseThe pointer to the I2S/TDM instance address.

◆ Cy_AudioTDM_ClearRxInterrupt()

__STATIC_INLINE void Cy_AudioTDM_ClearRxInterrupt ( TDM_RX_STRUCT_Type *  base,
uint32_t  interrupt 
)

Clears RX interrupt.

Parameters
baseThe pointer to the I2S/TDM instance address.
interruptinterrupt
Function Usage
/* Scenario: Inside the TDM interrupt service routine */
/* Get all the enabled pending interrupts */
uint32_t interrupt = Cy_AudioTDM_GetRxInterruptStatusMasked (TDM_STRUCT0_RX);
if (CY_TDM_INTR_RX_FIFO_TRIGGER & interrupt)
{
/* Handle the RX_FIFO_TRIGGER interrupt - READ the Rx FIFO, etc. */
}
/* Check and handle the rest of TDM interrupt types, if needed */
/* Clear the interrupt */
Cy_AudioTDM_ClearRxInterrupt(TDM_STRUCT0_RX, interrupt);

◆ Cy_AudioTDM_SetRxInterrupt()

__STATIC_INLINE void Cy_AudioTDM_SetRxInterrupt ( TDM_RX_STRUCT_Type *  base,
uint32_t  interrupt 
)

Sets RX interrupt.

Parameters
baseThe pointer to the I2S/TDM instance address.
interruptinterrupt
Function Usage
/* Scenario: Test the CY_TDM_INTR_RX_FIFO_TRIGGER interrupt */
Cy_AudioTDM_SetRxInterrupt(TDM_STRUCT0_RX, CY_TDM_INTR_RX_FIFO_TRIGGER); /* Set the CY_TDM_INTR_RX_FIFO_TRIGGER by software */
/* Now the CY_TDM_INTR_RX_FIFO_TRIGGER interrupt should occur (if it is enabled, of course) */

◆ Cy_AudioTDM_GetRxInterruptMask()

__STATIC_INLINE uint32_t Cy_AudioTDM_GetRxInterruptMask ( TDM_RX_STRUCT_Type *  base)

Returns RX interrupt Mask.

Parameters
baseThe pointer to the I2S/TDM instance address.
Function Usage
/* Scenario: Need to enable the RX interrupt */
uint32_t interrupt = Cy_AudioTDM_GetRxInterruptMask (TDM_STRUCT0_RX);

◆ Cy_AudioTDM_SetRxInterruptMask()

__STATIC_INLINE void Cy_AudioTDM_SetRxInterruptMask ( TDM_RX_STRUCT_Type *  base,
uint32_t  interrupt 
)

Sets RX interrupt Mask.

Parameters
baseThe pointer to the I2S/TDM instance address.
interruptinterrupt
Function Usage
/* Scenario: Enable TDM interrupts (if any used) */
Cy_AudioTDM_SetRxInterruptMask (TDM_STRUCT0_RX, CY_TDM_INTR_RX_MASK);
/* Scenario: Disable TDM interrupts (if any enabled) */
Cy_AudioTDM_SetRxInterruptMask (TDM_STRUCT0_RX, 0UL); /* Disable all TDM interrupts */

◆ Cy_AudioTDM_GetRxInterruptStatusMasked()

__STATIC_INLINE uint32_t Cy_AudioTDM_GetRxInterruptStatusMasked ( TDM_RX_STRUCT_Type *  base)

Returns a bitwise AND between the INTR_RX and INTR_RX_MASK registers.

Parameters
baseThe pointer to the I2S/TDM instance address.
Returns
The interrupt bit mask(s).

◆ Cy_AudioTDM_SetRxTriggerInterruptMask()

__STATIC_INLINE void Cy_AudioTDM_SetRxTriggerInterruptMask ( TDM_RX_STRUCT_Type *  base)

Sets Rx Interrupt Mask.

Parameters
baseThe pointer to the I2S/TDM instance address.

◆ Cy_AudioTDM_ClearRxTriggerInterruptMask()

__STATIC_INLINE void Cy_AudioTDM_ClearRxTriggerInterruptMask ( TDM_RX_STRUCT_Type *  base)

Clear RX interrupt Mask.

Parameters
baseThe pointer to the I2S/TDM instance address.