LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
IP: I2S register block and driver

Data Structures

struct  IP_I2S_001_Type
 I2S register block structure. More...
 

Macros

#define I2S_WORDWIDTH_8   (0UL << 0)
 I2S configuration parameter defines.
 
#define I2S_WORDWIDTH_16   (1UL << 0)
 
#define I2S_WORDWIDTH_32   (3UL << 0)
 
#define I2S_STEREO   (0UL << 2)
 
#define I2S_MONO   (1UL << 2)
 
#define I2S_MASTER_MODE   (0UL << 5)
 
#define I2S_SLAVE_MODE   (1UL << 5)
 
#define I2S_STOP_ENABLE   (0UL << 3)
 
#define I2S_STOP_DISABLE   (1UL << 3)
 
#define I2S_RESET_ENABLE   (1UL << 4)
 
#define I2S_RESET_DISABLE   (0UL << 4)
 
#define I2S_MUTE_ENABLE   (1UL << 15)
 
#define I2S_MUTE_DISABLE   (0UL << 15)
 
#define I2S_DAO_WORDWIDTH_8   ((uint32_t) (0)) /** 8 bit */
 Macro defines for DAO-Digital Audio Output register.
 
#define I2S_DAO_WORDWIDTH_16   ((uint32_t) (1)) /** 16 bit */
 
#define I2S_DAO_WORDWIDTH_32   ((uint32_t) (3)) /** 32 bit */
 
#define I2S_DAO_WORDWIDTH_MASK   ((uint32_t) (3))
 
#define I2S_DAO_MONO   ((uint32_t) (1 << 2))
 
#define I2S_DAO_STOP   ((uint32_t) (1 << 3))
 
#define I2S_DAO_RESET   ((uint32_t) (1 << 4))
 
#define I2S_DAO_SLAVE   ((uint32_t) (1 << 5))
 
#define I2S_DAO_WS_HALFPERIOD(n)   ((uint32_t) ((n & 0x1FF) << 6))
 
#define I2S_DAO_WS_HALFPERIOD_MASK   ((uint32_t) ((0x1FF) << 6))
 
#define I2S_DAO_MUTE   ((uint32_t) (1 << 15))
 
#define I2S_DAI_WORDWIDTH_8   ((uint32_t) (0)) /** 8 bit */
 Macro defines for DAI-Digital Audio Input register.
 
#define I2S_DAI_WORDWIDTH_16   ((uint32_t) (1)) /** 16 bit */
 
#define I2S_DAI_WORDWIDTH_32   ((uint32_t) (3)) /** 32 bit */
 
#define I2S_DAI_WORDWIDTH_MASK   ((uint32_t) (3))
 
#define I2S_DAI_MONO   ((uint32_t) (1 << 2))
 
#define I2S_DAI_STOP   ((uint32_t) (1 << 3))
 
#define I2S_DAI_RESET   ((uint32_t) (1 << 4))
 
#define I2S_DAI_SLAVE   ((uint32_t) (1 << 5))
 
#define I2S_DAI_WS_HALFPERIOD(n)   ((uint32_t) ((n & 0x1FF) << 6))
 
#define I2S_DAI_WS_HALFPERIOD_MASK   ((uint32_t) ((0x1FF) << 6))
 
#define I2S_STATE_IRQ   ((uint32_t) (1))
 Macro defines for STAT register (Status Feedback register)
 
#define I2S_STATE_DMA1   ((uint32_t) (1 << 1))
 
#define I2S_STATE_DMA2   ((uint32_t) (1 << 2))
 
#define I2S_STATE_RX_LEVEL(n)   ((uint32_t) ((n & 1F) << 8))
 
#define I2S_STATE_TX_LEVEL(n)   ((uint32_t) ((n & 1F) << 16))
 
#define I2S_DMA1_RX_ENABLE   ((uint32_t) (1))
 Macro defines for DMA1 register (DMA1 Configuration register)
 
#define I2S_DMA1_TX_ENABLE   ((uint32_t) (1 << 1))
 
#define I2S_DMA1_RX_DEPTH(n)   ((uint32_t) ((n & 0x1F) << 8))
 
#define I2S_DMA1_TX_DEPTH(n)   ((uint32_t) ((n & 0x1F) << 16))
 
#define I2S_DMA2_RX_ENABLE   ((uint32_t) (1))
 Macro defines for DMA2 register (DMA2 Configuration register)
 
#define I2S_DMA2_TX_ENABLE   ((uint32_t) (1 << 1))
 
#define I2S_DMA2_RX_DEPTH(n)   ((uint32_t) ((n & 0x1F) << 8))
 
#define I2S_DMA2_TX_DEPTH(n)   ((uint32_t) ((n & 0x1F) << 16))
 
#define I2S_IRQ_RX_ENABLE   ((uint32_t) (1))
 Macro defines for IRQ register (Interrupt Request Control register)
 
#define I2S_IRQ_TX_ENABLE   ((uint32_t) (1 << 1))
 
#define I2S_IRQ_RX_DEPTH(n)   ((uint32_t) ((n & 0x0F) << 8))
 
#define I2S_IRQ_RX_DEPTH_MASK   ((uint32_t) ((0x0F) << 8))
 
#define I2S_IRQ_TX_DEPTH(n)   ((uint32_t) ((n & 0x0F) << 16))
 
#define I2S_IRQ_TX_DEPTH_MASK   ((uint32_t) ((0x0F) << 16))
 
#define I2S_TXRATE_Y_DIVIDER(n)   ((uint32_t) (n & 0xFF))
 Macro defines for TXRATE/RXRATE register (Transmit/Receive Clock Rate register)
 
#define I2S_TXRATE_X_DIVIDER(n)   ((uint32_t) ((n & 0xFF) << 8))
 
#define I2S_RXRATE_Y_DIVIDER(n)   ((uint32_t) (n & 0xFF))
 
#define I2S_RXRATE_X_DIVIDER(n)   ((uint32_t) ((n & 0xFF) << 8))
 
#define I2S_TXBITRATE(n)   ((uint32_t) (n & 0x3F))
 Macro defines for TXBITRATE & RXBITRATE register (Transmit/Receive Bit Rate register)
 
#define I2S_RXBITRATE(n)   ((uint32_t) (n & 0x3F))
 
#define I2S_TXMODE_CLKSEL(n)   ((uint32_t) (n & 0x03))
 Macro defines for TXMODE/RXMODE register (Transmit/Receive Mode Control register)
 
#define I2S_TXMODE_4PIN_ENABLE   ((uint32_t) (1 << 2))
 
#define I2S_TXMODE_MCENA   ((uint32_t) (1 << 3))
 
#define I2S_RXMODE_CLKSEL(n)   ((uint32_t) (n & 0x03))
 
#define I2S_RXMODE_4PIN_ENABLE   ((uint32_t) (1 << 2))
 
#define I2S_RXMODE_MCENA   ((uint32_t) (1 << 3))
 

Enumerations

enum  IP_I2S_TRxMode_Type { I2S_TX_MODE, I2S_RX_MODE }
 I2S transmit/receive mode for configuration. More...
 
enum  IP_I2S_DMARequestNumber_Type { IP_I2S_DMA_REQUEST_NUMBER_1, IP_I2S_DMA_REQUEST_NUMBER_2 }
 I2S DMA request channel define. More...
 

Functions

void IP_I2S_Init (IP_I2S_001_Type *pI2S)
 Initialize for I2S.
 
void IP_I2S_DeInit (IP_I2S_001_Type *pI2S)
 Shutdown I2S.
 
void IP_I2S_SetWordWidth (IP_I2S_001_Type *pI2S, uint8_t TRMode, uint32_t wordwidth)
 Selects the number of bytes in data.
 
void IP_I2S_SetMono (IP_I2S_001_Type *pI2S, uint8_t TRMode, uint32_t mono)
 Set I2S data format is monaural or stereo.
 
void IP_I2S_SetMasterSlaveMode (IP_I2S_001_Type *pI2S, uint8_t TRMode, uint32_t mode)
 Set I2S interface in master/slave mode.
 
void IP_I2S_SetBitRate (IP_I2S_001_Type *pI2S, uint8_t TRMode, uint32_t mclk_divider)
 Set the clock frequency for I2S interface.
 
void IP_I2S_SetXYDivider (IP_I2S_001_Type *pI2S, uint8_t TRMode, uint8_t x_divider, uint8_t y_devider)
 Set the MCLK rate by using a fractional rate generator, dividing down the frequency of PCLK.
 
void IP_I2S_SetWS_Halfperiod (IP_I2S_001_Type *pI2S, uint8_t TRMode, uint32_t ws_halfperiod)
 Set word select (WS) half period.
 
void IP_I2S_ModeConfig (IP_I2S_001_Type *pI2S, uint8_t TRMode, uint32_t clksel, uint32_t fpin, uint32_t mcena)
 Set the I2S operating modes.
 
uint8_t IP_I2S_GetLevel (IP_I2S_001_Type *pI2S, uint8_t TRMode)
 Get the current level of the Transmit/Receive FIFO.
 
void IP_I2S_Send (IP_I2S_001_Type *pI2S, uint32_t data)
 Send a 32-bit data to TXFIFO for transmition.
 
uint32_t IP_I2S_Receive (IP_I2S_001_Type *pI2S)
 Get received data from RXFIFO.
 
void IP_I2S_Start (IP_I2S_001_Type *pI2S, uint8_t TRMode)
 Start the I2S.
 
void IP_I2S_Pause (IP_I2S_001_Type *pI2S, uint8_t TRMode)
 Disables accesses on FIFOs, places the transmit channel in mute mode.
 
void IP_I2S_Mute (IP_I2S_001_Type *pI2S, FunctionalState NewState)
 Transmit channel sends only zeroes.
 
void IP_I2S_Stop (IP_I2S_001_Type *pI2S, uint8_t TRMode)
 Stop I2S asynchronously.
 
void IP_I2S_SetFIFODepthDMA (IP_I2S_001_Type *pI2S, uint8_t TRMode, IP_I2S_DMARequestNumber_Type DMANum, uint32_t depth)
 Set the FIFO level on which to create an DMA request.
 
void IP_I2S_DMACmd (IP_I2S_001_Type *pI2S, IP_I2S_DMARequestNumber_Type DMANum, uint8_t TRMode, FunctionalState NewState)
 Enable/Disable DMA for the I2S.
 
void IP_I2S_InterruptCmd (IP_I2S_001_Type *pI2S, uint8_t TRMode, FunctionalState NewState)
 Enable/Disable interrupt for the I2S.
 
void IP_I2S_SetFIFODepthIRQ (IP_I2S_001_Type *pI2S, uint8_t TRMode, uint32_t depth)
 Set the FIFO level on which to create an irq request.
 
Status IP_I2S_GetIntStatus (IP_I2S_001_Type *pI2S, uint8_t TRMode)
 Get the status of I2S interrupt.
 

Detailed Description

Macro Definition Documentation

#define I2S_DAI_MONO   ((uint32_t) (1 << 2))

I2S control mono or stereo format

Definition at line 123 of file i2s_001.h.

#define I2S_DAI_RESET   ((uint32_t) (1 << 4))

I2S control reset mode

Definition at line 127 of file i2s_001.h.

#define I2S_DAI_SLAVE   ((uint32_t) (1 << 5))

I2S control master/slave mode

Definition at line 129 of file i2s_001.h.

#define I2S_DAI_STOP   ((uint32_t) (1 << 3))

I2S control stop mode

Definition at line 125 of file i2s_001.h.

#define I2S_DAI_WORDWIDTH_16   ((uint32_t) (1)) /** 16 bit */

Definition at line 119 of file i2s_001.h.

#define I2S_DAI_WORDWIDTH_32   ((uint32_t) (3)) /** 32 bit */

Definition at line 120 of file i2s_001.h.

#define I2S_DAI_WORDWIDTH_8   ((uint32_t) (0)) /** 8 bit */

Macro defines for DAI-Digital Audio Input register.

I2S wordwide - the number of bytes in data

Definition at line 118 of file i2s_001.h.

#define I2S_DAI_WORDWIDTH_MASK   ((uint32_t) (3))

Definition at line 121 of file i2s_001.h.

#define I2S_DAI_WS_HALFPERIOD (   n)    ((uint32_t) ((n & 0x1FF) << 6))

I2S word select half period minus one (9 bits)

Definition at line 131 of file i2s_001.h.

#define I2S_DAI_WS_HALFPERIOD_MASK   ((uint32_t) ((0x1FF) << 6))

Definition at line 132 of file i2s_001.h.

#define I2S_DAO_MONO   ((uint32_t) (1 << 2))

I2S control mono or stereo format

Definition at line 100 of file i2s_001.h.

#define I2S_DAO_MUTE   ((uint32_t) (1 << 15))

I2S control mute mode

Definition at line 111 of file i2s_001.h.

#define I2S_DAO_RESET   ((uint32_t) (1 << 4))

I2S control reset mode

Definition at line 104 of file i2s_001.h.

#define I2S_DAO_SLAVE   ((uint32_t) (1 << 5))

I2S control master/slave mode

Definition at line 106 of file i2s_001.h.

#define I2S_DAO_STOP   ((uint32_t) (1 << 3))

I2S control stop mode

Definition at line 102 of file i2s_001.h.

#define I2S_DAO_WORDWIDTH_16   ((uint32_t) (1)) /** 16 bit */

Definition at line 96 of file i2s_001.h.

#define I2S_DAO_WORDWIDTH_32   ((uint32_t) (3)) /** 32 bit */

Definition at line 97 of file i2s_001.h.

#define I2S_DAO_WORDWIDTH_8   ((uint32_t) (0)) /** 8 bit */

Macro defines for DAO-Digital Audio Output register.

I2S wordwide - the number of bytes in data

Definition at line 95 of file i2s_001.h.

#define I2S_DAO_WORDWIDTH_MASK   ((uint32_t) (3))

Definition at line 98 of file i2s_001.h.

#define I2S_DAO_WS_HALFPERIOD (   n)    ((uint32_t) ((n & 0x1FF) << 6))

I2S word select half period minus one

Definition at line 108 of file i2s_001.h.

#define I2S_DAO_WS_HALFPERIOD_MASK   ((uint32_t) ((0x1FF) << 6))

Definition at line 109 of file i2s_001.h.

#define I2S_DMA1_RX_DEPTH (   n)    ((uint32_t) ((n & 0x1F) << 8))

I2S set FIFO level that trigger a receive DMA request on DMA1

Definition at line 158 of file i2s_001.h.

#define I2S_DMA1_RX_ENABLE   ((uint32_t) (1))

Macro defines for DMA1 register (DMA1 Configuration register)

I2S control DMA1 for I2S receive

Definition at line 154 of file i2s_001.h.

#define I2S_DMA1_TX_DEPTH (   n)    ((uint32_t) ((n & 0x1F) << 16))

I2S set FIFO level that trigger a transmit DMA request on DMA1

Definition at line 160 of file i2s_001.h.

#define I2S_DMA1_TX_ENABLE   ((uint32_t) (1 << 1))

I2S control DMA1 for I2S transmit

Definition at line 156 of file i2s_001.h.

#define I2S_DMA2_RX_DEPTH (   n)    ((uint32_t) ((n & 0x1F) << 8))

I2S set FIFO level that trigger a receive DMA request on DMA1

Definition at line 171 of file i2s_001.h.

#define I2S_DMA2_RX_ENABLE   ((uint32_t) (1))

Macro defines for DMA2 register (DMA2 Configuration register)

I2S control DMA2 for I2S receive

Definition at line 167 of file i2s_001.h.

#define I2S_DMA2_TX_DEPTH (   n)    ((uint32_t) ((n & 0x1F) << 16))

I2S set FIFO level that trigger a transmit DMA request on DMA1

Definition at line 173 of file i2s_001.h.

#define I2S_DMA2_TX_ENABLE   ((uint32_t) (1 << 1))

I2S control DMA1 for I2S transmit

Definition at line 169 of file i2s_001.h.

#define I2S_IRQ_RX_DEPTH (   n)    ((uint32_t) ((n & 0x0F) << 8))

I2S set the FIFO level on which to create an irq request

Definition at line 184 of file i2s_001.h.

#define I2S_IRQ_RX_DEPTH_MASK   ((uint32_t) ((0x0F) << 8))

Definition at line 185 of file i2s_001.h.

#define I2S_IRQ_RX_ENABLE   ((uint32_t) (1))

Macro defines for IRQ register (Interrupt Request Control register)

I2S control I2S receive interrupt

Definition at line 180 of file i2s_001.h.

#define I2S_IRQ_TX_DEPTH (   n)    ((uint32_t) ((n & 0x0F) << 16))

I2S set the FIFO level on which to create an irq request

Definition at line 187 of file i2s_001.h.

#define I2S_IRQ_TX_DEPTH_MASK   ((uint32_t) ((0x0F) << 16))

Definition at line 188 of file i2s_001.h.

#define I2S_IRQ_TX_ENABLE   ((uint32_t) (1 << 1))

I2S control I2S transmit interrupt

Definition at line 182 of file i2s_001.h.

#define I2S_MASTER_MODE   (0UL << 5)

I2S Master/Slave mode bit

Definition at line 78 of file i2s_001.h.

#define I2S_MONO   (1UL << 2)

Definition at line 76 of file i2s_001.h.

#define I2S_MUTE_DISABLE   (0UL << 15)

Definition at line 88 of file i2s_001.h.

#define I2S_MUTE_ENABLE   (1UL << 15)

I2S Mute bit

Definition at line 87 of file i2s_001.h.

#define I2S_RESET_DISABLE   (0UL << 4)

Definition at line 85 of file i2s_001.h.

#define I2S_RESET_ENABLE   (1UL << 4)

I2S Reset bit

Definition at line 84 of file i2s_001.h.

#define I2S_RXBITRATE (   n)    ((uint32_t) (n & 0x3F))

Definition at line 208 of file i2s_001.h.

#define I2S_RXMODE_4PIN_ENABLE   ((uint32_t) (1 << 2))

I2S Receive control 4-pin mode

Definition at line 223 of file i2s_001.h.

#define I2S_RXMODE_CLKSEL (   n)    ((uint32_t) (n & 0x03))

I2S Receive select clock source

Definition at line 221 of file i2s_001.h.

#define I2S_RXMODE_MCENA   ((uint32_t) (1 << 3))

I2S Receive control the TX_MCLK output

Definition at line 225 of file i2s_001.h.

#define I2S_RXRATE_X_DIVIDER (   n)    ((uint32_t) ((n & 0xFF) << 8))

I2S Receive MCLK rate denominator

Definition at line 201 of file i2s_001.h.

#define I2S_RXRATE_Y_DIVIDER (   n)    ((uint32_t) (n & 0xFF))

I2S Receive MCLK rate denominator

Definition at line 199 of file i2s_001.h.

#define I2S_SLAVE_MODE   (1UL << 5)

Definition at line 79 of file i2s_001.h.

#define I2S_STATE_DMA1   ((uint32_t) (1 << 1))

I2S Status Receive or Transmit DMA1

Definition at line 141 of file i2s_001.h.

#define I2S_STATE_DMA2   ((uint32_t) (1 << 2))

I2S Status Receive or Transmit DMA2

Definition at line 143 of file i2s_001.h.

#define I2S_STATE_IRQ   ((uint32_t) (1))

Macro defines for STAT register (Status Feedback register)

I2S Status Receive or Transmit Interrupt

Definition at line 139 of file i2s_001.h.

#define I2S_STATE_RX_LEVEL (   n)    ((uint32_t) ((n & 1F) << 8))

I2S Status Current level of the Receive FIFO (5 bits)

Definition at line 145 of file i2s_001.h.

#define I2S_STATE_TX_LEVEL (   n)    ((uint32_t) ((n & 1F) << 16))

I2S Status Current level of the Transmit FIFO (5 bits)

Definition at line 147 of file i2s_001.h.

#define I2S_STEREO   (0UL << 2)

I2S Channel bit

Definition at line 75 of file i2s_001.h.

#define I2S_STOP_DISABLE   (1UL << 3)

Definition at line 82 of file i2s_001.h.

#define I2S_STOP_ENABLE   (0UL << 3)

I2S Stop bit

Definition at line 81 of file i2s_001.h.

#define I2S_TXBITRATE (   n)    ((uint32_t) (n & 0x3F))

Macro defines for TXBITRATE & RXBITRATE register (Transmit/Receive Bit Rate register)

Definition at line 207 of file i2s_001.h.

#define I2S_TXMODE_4PIN_ENABLE   ((uint32_t) (1 << 2))

I2S Transmit control 4-pin mode

Definition at line 217 of file i2s_001.h.

#define I2S_TXMODE_CLKSEL (   n)    ((uint32_t) (n & 0x03))

Macro defines for TXMODE/RXMODE register (Transmit/Receive Mode Control register)

I2S Transmit select clock source (2 bits)

Definition at line 215 of file i2s_001.h.

#define I2S_TXMODE_MCENA   ((uint32_t) (1 << 3))

I2S Transmit control the TX_MCLK output

Definition at line 219 of file i2s_001.h.

#define I2S_TXRATE_X_DIVIDER (   n)    ((uint32_t) ((n & 0xFF) << 8))

I2S Transmit MCLK rate denominator

Definition at line 197 of file i2s_001.h.

#define I2S_TXRATE_Y_DIVIDER (   n)    ((uint32_t) (n & 0xFF))

Macro defines for TXRATE/RXRATE register (Transmit/Receive Clock Rate register)

I2S Transmit MCLK rate denominator

Definition at line 195 of file i2s_001.h.

#define I2S_WORDWIDTH_16   (1UL << 0)

Definition at line 72 of file i2s_001.h.

#define I2S_WORDWIDTH_32   (3UL << 0)

Definition at line 73 of file i2s_001.h.

#define I2S_WORDWIDTH_8   (0UL << 0)

I2S configuration parameter defines.

I2S Wordwidth bit

Definition at line 71 of file i2s_001.h.

Enumeration Type Documentation

I2S DMA request channel define.

Enumerator:
IP_I2S_DMA_REQUEST_NUMBER_1 
IP_I2S_DMA_REQUEST_NUMBER_2 

Definition at line 238 of file i2s_001.h.

I2S transmit/receive mode for configuration.

Enumerator:
I2S_TX_MODE 
I2S_RX_MODE 

Definition at line 230 of file i2s_001.h.

Function Documentation

void IP_I2S_DeInit ( IP_I2S_001_Type pI2S)

Shutdown I2S.

Parameters
pI2S: The base of I2S peripheral on the chip
Returns
Nothing Reset all relative registers (DMA, transmit/receive control, interrupt) to default value

Definition at line 55 of file i2s_001.c.

void IP_I2S_DMACmd ( IP_I2S_001_Type pI2S,
IP_I2S_DMARequestNumber_Type  DMANum,
uint8_t  TRMode,
FunctionalState  NewState 
)

Enable/Disable DMA for the I2S.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
DMANum: I2S DMA request number, should be
  • IP_I2S_DMA_REQUEST_NUMBER_1
  • IP_I2S_DMA_REQUEST_NUMBER_2
NewState: ENABLE or DISABLE DMA
Returns
Nothing

Definition at line 226 of file i2s_001.c.

Status IP_I2S_GetIntStatus ( IP_I2S_001_Type pI2S,
uint8_t  TRMode 
)

Get the status of I2S interrupt.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
Returns
I2S interrupt status, SET or RESET

Definition at line 319 of file i2s_001.c.

uint8_t IP_I2S_GetLevel ( IP_I2S_001_Type pI2S,
uint8_t  TRMode 
)

Get the current level of the Transmit/Receive FIFO.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
Returns
Current level of the Transmit/Receive FIFO

Definition at line 154 of file i2s_001.c.

void IP_I2S_Init ( IP_I2S_001_Type pI2S)

Initialize for I2S.

Parameters
pI2S: The base of I2S peripheral on the chip
Returns
Nothing

Definition at line 51 of file i2s_001.c.

void IP_I2S_InterruptCmd ( IP_I2S_001_Type pI2S,
uint8_t  TRMode,
FunctionalState  NewState 
)

Enable/Disable interrupt for the I2S.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
NewState: ENABLE or DISABLE Interrupt
Returns
Nothing Interrupt request is generated when rx_depth_irq <= rx_level or tx_depth_irq >= tx_level

Definition at line 294 of file i2s_001.c.

void IP_I2S_ModeConfig ( IP_I2S_001_Type pI2S,
uint8_t  TRMode,
uint32_t  clksel,
uint32_t  fpin,
uint32_t  mcena 
)

Set the I2S operating modes.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
clksel: Clock source selection for the receive bit clock divider
fpin: Receive 4-pin mode selection
mcena: Enable for the RX_MCLK output
Returns
Nothing In addition to master and slave modes, which are independently configurable for the transmitter and the receiver, several different clock sources are possible, including variations that share the clock and/or WS between the transmitter and receiver. It also allows using I2S with fewer pins, typically four.

Definition at line 143 of file i2s_001.c.

void IP_I2S_Mute ( IP_I2S_001_Type pI2S,
FunctionalState  NewState 
)

Transmit channel sends only zeroes.

Parameters
pI2S: The base of I2S peripheral on the chip
NewState: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
Returns
Nothing The data output from I2S transmit channel is always zeroes

Definition at line 201 of file i2s_001.c.

void IP_I2S_Pause ( IP_I2S_001_Type pI2S,
uint8_t  TRMode 
)

Disables accesses on FIFOs, places the transmit channel in mute mode.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
Returns
Nothing

Definition at line 190 of file i2s_001.c.

uint32_t IP_I2S_Receive ( IP_I2S_001_Type pI2S)

Get received data from RXFIFO.

Parameters
pI2S: The base of I2S peripheral on the chip
Returns
Data received in RXFIFO The function reads from RXFIFO without checking any condition.

Definition at line 173 of file i2s_001.c.

void IP_I2S_Send ( IP_I2S_001_Type pI2S,
uint32_t  data 
)

Send a 32-bit data to TXFIFO for transmition.

Parameters
pI2S: The base of I2S peripheral on the chip
data: Data to be transmited
Returns
Nothing The function writes to TXFIFO without checking any condition.

Definition at line 167 of file i2s_001.c.

void IP_I2S_SetBitRate ( IP_I2S_001_Type pI2S,
uint8_t  TRMode,
uint32_t  mclk_divider 
)

Set the clock frequency for I2S interface.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
mclk_divider: Clock divider. This value plus one is used to divide MCLK to produce the clock frequency for I2S interface
Returns
Nothing The value depends on the audio sample rate desired and the data size and format(stereo/mono) used. For example, a 48 kHz sample rate for 16-bit stereo data requires a bit rate of 48 000 x 16 x 2 = 1.536 MHz. So the mclk_divider should be MCLK/1.536 MHz

Definition at line 108 of file i2s_001.c.

void IP_I2S_SetFIFODepthDMA ( IP_I2S_001_Type pI2S,
uint8_t  TRMode,
IP_I2S_DMARequestNumber_Type  DMANum,
uint32_t  depth 
)

Set the FIFO level on which to create an DMA request.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
DMANum: I2S DMA request number, should be
  • IP_I2S_DMA_REQUEST_NUMBER_1
  • IP_I2S_DMA_REQUEST_NUMBER_2
depth: FIFO level on which to create an DMA request
Returns
Nothing DMA request is generated when rx_depth_dma <= rx_level or tx_depth_dma >= tx_level

Definition at line 267 of file i2s_001.c.

void IP_I2S_SetFIFODepthIRQ ( IP_I2S_001_Type pI2S,
uint8_t  TRMode,
uint32_t  depth 
)

Set the FIFO level on which to create an irq request.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
depth: FIFO level on which to create an irq request
Returns
Nothing

Definition at line 305 of file i2s_001.c.

void IP_I2S_SetMasterSlaveMode ( IP_I2S_001_Type pI2S,
uint8_t  TRMode,
uint32_t  mode 
)

Set I2S interface in master/slave mode.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
mode: Interface mode, should be
  • I2S_MASTER_MODE
  • I2S_SLAVE_MODE
Returns
Nothing

Definition at line 95 of file i2s_001.c.

void IP_I2S_SetMono ( IP_I2S_001_Type pI2S,
uint8_t  TRMode,
uint32_t  mono 
)

Set I2S data format is monaural or stereo.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
mono: Data channel, should be
  • I2S_STEREO
  • I2S_MONO
Returns
Nothing

Definition at line 82 of file i2s_001.c.

void IP_I2S_SetWordWidth ( IP_I2S_001_Type pI2S,
uint8_t  TRMode,
uint32_t  wordwidth 
)

Selects the number of bytes in data.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
wordwidth: Data width, should be :
  • I2S_WORDWIDTH_8
  • I2S_WORDWIDTH_16
  • I2S_WORDWIDTH_32
Returns
Nothing

Definition at line 69 of file i2s_001.c.

void IP_I2S_SetWS_Halfperiod ( IP_I2S_001_Type pI2S,
uint8_t  TRMode,
uint32_t  ws_halfperiod 
)

Set word select (WS) half period.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
ws_halfperiod: I2S word select half period minus one
Returns
Nothing The Word Select period is configured separately for I2S input and I2S output. For example: if the WS is 64clk period -> ws_halfperiod = 31

Definition at line 130 of file i2s_001.c.

void IP_I2S_SetXYDivider ( IP_I2S_001_Type pI2S,
uint8_t  TRMode,
uint8_t  x_divider,
uint8_t  y_devider 
)

Set the MCLK rate by using a fractional rate generator, dividing down the frequency of PCLK.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
x_divider: I2S transmit MCLK rate numerator
y_devider: I2S transmit MCLK rate denominator
Returns
Nothing Values of the numerator (X) and the denominator (Y) must be chosen to produce a frequency twice that desired for the transmitter MCLK, which must be an integer multiple of the transmitter bit clock rate. The equation for the fractional rate generator is: MCLK = PCLK * (X/Y) /2 Note: If the value of X or Y is 0, then no clock is generated. Also, the value of Y must be greater than or equal to X.

Definition at line 119 of file i2s_001.c.

void IP_I2S_Start ( IP_I2S_001_Type pI2S,
uint8_t  TRMode 
)

Start the I2S.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
Returns
Nothing

Definition at line 179 of file i2s_001.c.

void IP_I2S_Stop ( IP_I2S_001_Type pI2S,
uint8_t  TRMode 
)

Stop I2S asynchronously.

Parameters
pI2S: The base of I2S peripheral on the chip
TRMode: Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
Returns
Nothing Pause, resets the transmit channel and FIFO asynchronously

Definition at line 212 of file i2s_001.c.