M480 BSP V3.05.005
The Board Support Package for M480 Series
Macros | Functions

Macros

#define I2S_ENABLE_TXDMA(i2s)
 Enable I2S Tx DMA function. I2S requests DMA to transfer data to Tx FIFO. More...
 
#define I2S_DISABLE_TXDMA(i2s)
 Disable I2S Tx DMA function. I2S requests DMA to transfer data to Tx FIFO. More...
 
#define I2S_ENABLE_RXDMA(i2s)
 Enable I2S Rx DMA function. I2S requests DMA to transfer data from Rx FIFO. More...
 
#define I2S_DISABLE_RXDMA(i2s)
 Disable I2S Rx DMA function. I2S requests DMA to transfer data from Rx FIFO. More...
 
#define I2S_ENABLE_TX(i2s)
 Enable I2S Tx function . More...
 
#define I2S_DISABLE_TX(i2s)
 Disable I2S Tx function . More...
 
#define I2S_ENABLE_RX(i2s)
 Enable I2S Rx function . More...
 
#define I2S_DISABLE_RX(i2s)
 Disable I2S Rx function . More...
 
#define I2S_ENABLE_TX_MUTE(i2s)
 Enable Tx Mute function . More...
 
#define I2S_DISABLE_TX_MUTE(i2s)
 Disable Tx Mute function . More...
 
#define I2S_CLR_TX_FIFO(i2s)
 Clear Tx FIFO. Internal pointer is reset to FIFO start point. More...
 
#define I2S_CLR_RX_FIFO(i2s)
 Clear Rx FIFO. Internal pointer is reset to FIFO start point. More...
 
#define I2S_WRITE_TX_FIFO(i2s, u32Data)
 Write data to I2S Tx FIFO. More...
 
#define I2S_READ_RX_FIFO(i2s)
 Read Rx FIFO. More...
 
#define I2S_GET_INT_FLAG(i2s, u32Mask)
 This function gets the interrupt flag according to the mask parameter. More...
 
#define I2S_CLR_INT_FLAG(i2s, u32Mask)
 This function clears the interrupt flag according to the mask parameter. More...
 
#define I2S_GET_ZC_INT_FLAG(i2s, u32Mask)
 This function gets the zero crossing interrupt flag according to the mask parameter. More...
 
#define I2S_CLR_ZC_INT_FLAG(i2s, u32Mask)
 This function clears the zero crossing interrupt flag according to the mask parameter. More...
 
#define I2S_GET_TX_FIFO_LEVEL(i2s)
 Get transmit FIFO level. More...
 
#define I2S_GET_RX_FIFO_LEVEL(i2s)
 Get receive FIFO level. More...
 

Functions

__STATIC_INLINE void I2S_ENABLE_TX_ZCD (I2S_T *i2s, uint32_t u32ChMask)
 Enable zero cross detect function. More...
 
__STATIC_INLINE void I2S_DISABLE_TX_ZCD (I2S_T *i2s, uint32_t u32ChMask)
 Disable zero cross detect function. More...
 
__STATIC_INLINE void I2S_SET_MONO_RX_CHANNEL (I2S_T *i2s, uint32_t u32Ch)
 This function sets the recording source channel when mono mode is used. More...
 
void I2S_Close (I2S_T *i2s)
 Disable I2S function and I2S clock. More...
 
void I2S_EnableInt (I2S_T *i2s, uint32_t u32Mask)
 This function enables the interrupt according to the mask parameter. More...
 
void I2S_DisableInt (I2S_T *i2s, uint32_t u32Mask)
 This function disables the interrupt according to the mask parameter. More...
 
uint32_t I2S_EnableMCLK (I2S_T *i2s, uint32_t u32BusClock)
 Enable MCLK . More...
 
void I2S_DisableMCLK (I2S_T *i2s)
 Disable MCLK . More...
 
void I2S_SetFIFO (I2S_T *i2s, uint32_t u32TxThreshold, uint32_t u32RxThreshold)
 Configure FIFO threshold setting. More...
 
void I2S_ConfigureTDM (I2S_T *i2s, uint32_t u32ChannelWidth, uint32_t u32ChannelNum, uint32_t u32SyncWidth)
 Configure PCM(TDM) function parameters, such as channel width, channel number and sync pulse width. More...
 
uint32_t I2S_Open (I2S_T *i2s, uint32_t u32MasterSlave, uint32_t u32SampleRate, uint32_t u32WordWidth, uint32_t u32MonoData, uint32_t u32DataFormat)
 This function configures some parameters of I2S interface for general purpose use. The sample rate may not be used from the parameter, it depends on system's clock settings, but real sample rate used by system will be returned for reference. More...
 
static uint32_t I2S_GetSourceClockFreq (I2S_T *i2s)
 This function is used to get I2S source clock frequency. More...
 

Detailed Description

Macro Definition Documentation

◆ I2S_CLR_INT_FLAG

#define I2S_CLR_INT_FLAG (   i2s,
  u32Mask 
)

This function clears the interrupt flag according to the mask parameter.

Parameters
[in]i2sis the base address of I2S module.
[in]u32Maskis the mask for the all interrupt flags.
Returns
none

Definition at line 295 of file i2s.h.

◆ I2S_CLR_RX_FIFO

#define I2S_CLR_RX_FIFO (   i2s)

Clear Rx FIFO. Internal pointer is reset to FIFO start point.

Parameters
[in]i2sis the base address of I2S module.
Returns
none

Definition at line 244 of file i2s.h.

◆ I2S_CLR_TX_FIFO

#define I2S_CLR_TX_FIFO (   i2s)

Clear Tx FIFO. Internal pointer is reset to FIFO start point.

Parameters
[in]i2sis the base address of I2S module.
Returns
none

Definition at line 236 of file i2s.h.

◆ I2S_CLR_ZC_INT_FLAG

#define I2S_CLR_ZC_INT_FLAG (   i2s,
  u32Mask 
)

This function clears the zero crossing interrupt flag according to the mask parameter.

Parameters
[in]i2sis the base address of I2S module.
[in]u32Maskis the mask for the all interrupt flags.
Returns
none

Definition at line 313 of file i2s.h.

◆ I2S_DISABLE_RX

#define I2S_DISABLE_RX (   i2s)

Disable I2S Rx function .

Parameters
[in]i2sis the base address of I2S module.
Returns
none

Definition at line 212 of file i2s.h.

◆ I2S_DISABLE_RXDMA

#define I2S_DISABLE_RXDMA (   i2s)

Disable I2S Rx DMA function. I2S requests DMA to transfer data from Rx FIFO.

Parameters
[in]i2sis the base address of I2S module.
Returns
none

Definition at line 180 of file i2s.h.

◆ I2S_DISABLE_TX

#define I2S_DISABLE_TX (   i2s)

Disable I2S Tx function .

Parameters
[in]i2sis the base address of I2S module.
Returns
none

Definition at line 196 of file i2s.h.

◆ I2S_DISABLE_TX_MUTE

#define I2S_DISABLE_TX_MUTE (   i2s)

Disable Tx Mute function .

Parameters
[in]i2sis the base address of I2S module.
Returns
none

Definition at line 228 of file i2s.h.

◆ I2S_DISABLE_TXDMA

#define I2S_DISABLE_TXDMA (   i2s)

Disable I2S Tx DMA function. I2S requests DMA to transfer data to Tx FIFO.

Parameters
[in]i2sis the base address of I2S module.
Returns
none

Definition at line 164 of file i2s.h.

◆ I2S_ENABLE_RX

#define I2S_ENABLE_RX (   i2s)

Enable I2S Rx function .

Parameters
[in]i2sis the base address of I2S module.
Returns
none

Definition at line 204 of file i2s.h.

◆ I2S_ENABLE_RXDMA

#define I2S_ENABLE_RXDMA (   i2s)

Enable I2S Rx DMA function. I2S requests DMA to transfer data from Rx FIFO.

Parameters
[in]i2sis the base address of I2S module.
Returns
none

Definition at line 172 of file i2s.h.

◆ I2S_ENABLE_TX

#define I2S_ENABLE_TX (   i2s)

Enable I2S Tx function .

Parameters
[in]i2sis the base address of I2S module.
Returns
none

Definition at line 188 of file i2s.h.

◆ I2S_ENABLE_TX_MUTE

#define I2S_ENABLE_TX_MUTE (   i2s)

Enable Tx Mute function .

Parameters
[in]i2sis the base address of I2S module.
Returns
none

Definition at line 220 of file i2s.h.

◆ I2S_ENABLE_TXDMA

#define I2S_ENABLE_TXDMA (   i2s)

Enable I2S Tx DMA function. I2S requests DMA to transfer data to Tx FIFO.

Parameters
[in]i2sis the base address of I2S module.
Returns
none

Definition at line 156 of file i2s.h.

◆ I2S_GET_INT_FLAG

#define I2S_GET_INT_FLAG (   i2s,
  u32Mask 
)

This function gets the interrupt flag according to the mask parameter.

Parameters
[in]i2sis the base address of I2S module.
[in]u32Maskis the mask for the all interrupt flags.
Returns
The masked bit value of interrupt flag.

Definition at line 286 of file i2s.h.

◆ I2S_GET_RX_FIFO_LEVEL

#define I2S_GET_RX_FIFO_LEVEL (   i2s)

Get receive FIFO level.

Parameters
[in]i2sis the base address of I2S module.
Returns
FIFO level

Definition at line 329 of file i2s.h.

◆ I2S_GET_TX_FIFO_LEVEL

#define I2S_GET_TX_FIFO_LEVEL (   i2s)

Get transmit FIFO level.

Parameters
[in]i2sis the base address of I2S module.
Returns
FIFO level

Definition at line 321 of file i2s.h.

◆ I2S_GET_ZC_INT_FLAG

#define I2S_GET_ZC_INT_FLAG (   i2s,
  u32Mask 
)

This function gets the zero crossing interrupt flag according to the mask parameter.

Parameters
[in]i2sis the base address of I2S module.
[in]u32Maskis the mask for the all interrupt flags.
Returns
The masked bit value of interrupt flag.

Definition at line 304 of file i2s.h.

◆ I2S_READ_RX_FIFO

#define I2S_READ_RX_FIFO (   i2s)

Read Rx FIFO.

Parameters
[in]i2sis the base address of I2S module.
Returns
Data in Rx FIFO.

Definition at line 277 of file i2s.h.

◆ I2S_WRITE_TX_FIFO

#define I2S_WRITE_TX_FIFO (   i2s,
  u32Data 
)

Write data to I2S Tx FIFO.

Parameters
[in]i2sis the base address of I2S module.
[in]u32DataThe data written to FIFO.
Returns
none

Definition at line 269 of file i2s.h.

Function Documentation

◆ I2S_Close()

void I2S_Close ( I2S_T i2s)

Disable I2S function and I2S clock.

Parameters
[in]i2sis the base address of I2S module.
Returns
none

Definition at line 123 of file i2s.c.

◆ I2S_ConfigureTDM()

void I2S_ConfigureTDM ( I2S_T i2s,
uint32_t  u32ChannelWidth,
uint32_t  u32ChannelNum,
uint32_t  u32SyncWidth 
)

Configure PCM(TDM) function parameters, such as channel width, channel number and sync pulse width.

Parameters
[in]i2sThe pointer of the specified I2S module.
[in]u32ChannelWidthChannel width. Valid values are:
[in]u32ChannelNumChannel number. Valid values are:
[in]u32SyncWidthWidth for sync pulse. Valid values are:
Returns
None

Set TX FIFO threshold and RX FIFO threshold configurations.

Definition at line 236 of file i2s.c.

◆ I2S_DISABLE_TX_ZCD()

__STATIC_INLINE void I2S_DISABLE_TX_ZCD ( I2S_T i2s,
uint32_t  u32ChMask 
)

Disable zero cross detect function.

Parameters
[in]i2sis the base address of I2S module.
[in]u32ChMaskis the mask for channel number (valid value is from (1~8).
Returns
none

Definition at line 142 of file i2s.h.

◆ I2S_DisableInt()

void I2S_DisableInt ( I2S_T i2s,
uint32_t  u32Mask 
)

This function disables the interrupt according to the mask parameter.

Parameters
[in]i2sis the base address of I2S module.
[in]u32Maskis the combination of all related interrupt enable bits. Each bit corresponds to a interrupt bit.
Returns
none

Definition at line 147 of file i2s.c.

◆ I2S_DisableMCLK()

void I2S_DisableMCLK ( I2S_T i2s)

Disable MCLK .

Parameters
[in]i2sis the base address of I2S module.
Returns
none

Definition at line 196 of file i2s.c.

◆ I2S_ENABLE_TX_ZCD()

__STATIC_INLINE void I2S_ENABLE_TX_ZCD ( I2S_T i2s,
uint32_t  u32ChMask 
)

Enable zero cross detect function.

Parameters
[in]i2sis the base address of I2S module.
[in]u32ChMaskis the mask for channel number (valid value is from (1~8).
Returns
none

Definition at line 127 of file i2s.h.

◆ I2S_EnableInt()

void I2S_EnableInt ( I2S_T i2s,
uint32_t  u32Mask 
)

This function enables the interrupt according to the mask parameter.

Parameters
[in]i2sis the base address of I2S module.
[in]u32Maskis the combination of all related interrupt enable bits. Each bit corresponds to a interrupt bit.
Returns
none

Definition at line 135 of file i2s.c.

◆ I2S_EnableMCLK()

uint32_t I2S_EnableMCLK ( I2S_T i2s,
uint32_t  u32BusClock 
)

Enable MCLK .

Parameters
[in]i2sis the base address of I2S module.
[in]u32BusClockis the target MCLK clock
Returns
Actual MCLK clock

Definition at line 158 of file i2s.c.

◆ I2S_GetSourceClockFreq()

static uint32_t I2S_GetSourceClockFreq ( I2S_T i2s)
static

This function is used to get I2S source clock frequency.

Parameters
[in]i2sis the base address of I2S module.
Returns
I2S source clock frequency (Hz).

Definition at line 32 of file i2s.c.

◆ I2S_Open()

uint32_t I2S_Open ( I2S_T i2s,
uint32_t  u32MasterSlave,
uint32_t  u32SampleRate,
uint32_t  u32WordWidth,
uint32_t  u32MonoData,
uint32_t  u32DataFormat 
)

This function configures some parameters of I2S interface for general purpose use. The sample rate may not be used from the parameter, it depends on system's clock settings, but real sample rate used by system will be returned for reference.

Parameters
[in]i2sis the base address of I2S module.
[in]u32MasterSlaveI2S operation mode. Valid values are:
[in]u32SampleRateSample rate
[in]u32WordWidthData length. Valid values are:
[in]u32MonoDataSet audio data to mono or not. Valid values are:
[in]u32DataFormatData format. This is also used to select I2S or PCM(TDM) function. Valid values are:
Returns
Real sample rate.

Definition at line 91 of file i2s.c.

◆ I2S_SET_MONO_RX_CHANNEL()

__STATIC_INLINE void I2S_SET_MONO_RX_CHANNEL ( I2S_T i2s,
uint32_t  u32Ch 
)

This function sets the recording source channel when mono mode is used.

Parameters
[in]i2sis the base address of I2S module.
[in]u32Chleft or right channel. Valid values are:
Returns
none

Definition at line 255 of file i2s.h.

◆ I2S_SetFIFO()

void I2S_SetFIFO ( I2S_T i2s,
uint32_t  u32TxThreshold,
uint32_t  u32RxThreshold 
)

Configure FIFO threshold setting.

Parameters
[in]i2sThe pointer of the specified I2S module.
[in]u32TxThresholdDecides the TX FIFO threshold. It could be 0 ~ 7.
[in]u32RxThresholdDecides the RX FIFO threshold. It could be 0 ~ 7.
Returns
None

Set TX FIFO threshold and RX FIFO threshold configurations.

Definition at line 209 of file i2s.c.