LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
CHIP: LPC17xx/40xx I2S driver

Detailed Description

Data Structures

struct  Chip_I2S_Audio_Format_T
 I2S Audio Format Structure. More...
 

Macros

#define I2S_DMA_REQUEST_NUMBER_1   IP_I2S_DMA_REQUEST_NUMBER_1
 
#define I2S_DMA_REQUEST_NUMBER_2   IP_I2S_DMA_REQUEST_NUMBER_2
 

Functions

void Chip_I2S_Init (LPC_I2S_T *pI2S)
 Initialize for I2S.
 
void Chip_I2S_DeInit (LPC_I2S_T *pI2S)
 Shutdown I2S.
 
STATIC INLINE void Chip_I2S_Send (LPC_I2S_T *pI2S, uint32_t data)
 Send a 32-bit data to TXFIFO for transmition.
 
STATIC INLINE uint32_t Chip_I2S_Receive (LPC_I2S_T *pI2S)
 Get received data from RXFIFO.
 
STATIC INLINE void Chip_I2S_Start (LPC_I2S_T *pI2S, uint8_t TRMode)
 Start the I2S.
 
STATIC INLINE void Chip_I2S_Pause (LPC_I2S_T *pI2S, uint8_t TRMode)
 Disables accesses on FIFOs, places the transmit channel in mute mode.
 
STATIC INLINE void Chip_I2S_EnableMute (LPC_I2S_T *pI2S)
 Mute the Transmit channel.
 
STATIC INLINE void Chip_I2S_DisableMute (LPC_I2S_T *pI2S)
 Un-Mute the I2S channel.
 
STATIC INLINE void Chip_I2S_Stop (LPC_I2S_T *pI2S, uint8_t TRMode)
 Stop I2S asynchronously.
 
STATIC INLINE void Chip_I2S_ModeConfig (LPC_I2S_T *pI2S, uint8_t TRMode, uint32_t clksel, uint32_t fpin, uint32_t mcena)
 Set the I2S operating modes.
 
STATIC INLINE uint8_t Chip_I2S_GetLevel (LPC_I2S_T *pI2S, uint8_t TRMode)
 Get the current level of the Transmit/Receive FIFO.
 
Status Chip_I2S_Config (LPC_I2S_T *pI2S, uint8_t TRMode, Chip_I2S_Audio_Format_T *audio_format)
 Configure I2S for Audio Format input.
 
void Chip_I2S_Int_Cmd (LPC_I2S_T *pI2S, uint8_t TRMode, FunctionalState NewState, uint8_t FIFO_Depth)
 Enable/Disable Interrupt with a specific FIFO depth.
 
void Chip_I2S_DMA_Cmd (LPC_I2S_T *pI2S, uint8_t TRMode, uint8_t DMANum, FunctionalState NewState, uint8_t FIFO_Depth)
 Enable/Disable DMA with a specific FIFO depth.
 

Macro Definition Documentation

#define I2S_DMA_REQUEST_NUMBER_1   IP_I2S_DMA_REQUEST_NUMBER_1

Definition at line 44 of file i2s_17xx_40xx.h.

#define I2S_DMA_REQUEST_NUMBER_2   IP_I2S_DMA_REQUEST_NUMBER_2

Definition at line 45 of file i2s_17xx_40xx.h.

Function Documentation

Status Chip_I2S_Config ( LPC_I2S_T pI2S,
uint8_t  TRMode,
Chip_I2S_Audio_Format_T audio_format 
)

Configure I2S for Audio Format input.

Parameters
pI2S: The base I2S peripheral on the chip
TRMode: Mode Rx/Tx
audio_format: Audio Format
Returns
SUCCESS or ERROR

Definition at line 65 of file i2s_17xx_40xx.c.

void Chip_I2S_DeInit ( LPC_I2S_T pI2S)

Shutdown I2S.

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

Definition at line 58 of file i2s_17xx_40xx.c.

STATIC INLINE void Chip_I2S_DisableMute ( LPC_I2S_T pI2S)

Un-Mute the I2S channel.

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

Definition at line 132 of file i2s_17xx_40xx.h.

void Chip_I2S_DMA_Cmd ( LPC_I2S_T pI2S,
uint8_t  TRMode,
uint8_t  DMANum,
FunctionalState  NewState,
uint8_t  FIFO_Depth 
)

Enable/Disable DMA with a specific FIFO depth.

Parameters
pI2S: The base I2S peripheral on the chip
TRMode: Mode Rx/Tx
DMANum: Should be
  • IP_I2S_DMA_REQUEST_NUMBER_1 : Using DMA1
  • IP_I2S_DMA_REQUEST_NUMBER_2 : Using DMA2
NewState: ENABLE or DISABLE interrupt
FIFO_Depth: FIFO level creating an irq request
Returns
Nothing

Definition at line 148 of file i2s_17xx_40xx.c.

STATIC INLINE void Chip_I2S_EnableMute ( LPC_I2S_T pI2S)

Mute the Transmit channel.

Parameters
pI2S: The base of I2S peripheral on the chip
Returns
Nothing
Note
The data output from I2S transmit channel is always zeroes

Definition at line 122 of file i2s_17xx_40xx.h.

STATIC INLINE uint8_t Chip_I2S_GetLevel ( LPC_I2S_T 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 177 of file i2s_17xx_40xx.h.

void Chip_I2S_Init ( LPC_I2S_T pI2S)

Initialize for I2S.

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

Definition at line 51 of file i2s_17xx_40xx.c.

void Chip_I2S_Int_Cmd ( LPC_I2S_T pI2S,
uint8_t  TRMode,
FunctionalState  NewState,
uint8_t  FIFO_Depth 
)

Enable/Disable Interrupt with a specific FIFO depth.

Parameters
pI2S: The base I2S peripheral on the chip
TRMode: Mode Rx/Tx
NewState: ENABLE or DISABLE interrupt
FIFO_Depth: FIFO level creating an irq request
Returns
Nothing

Definition at line 141 of file i2s_17xx_40xx.c.

STATIC INLINE void Chip_I2S_ModeConfig ( LPC_I2S_T 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
Note
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 162 of file i2s_17xx_40xx.h.

STATIC INLINE void Chip_I2S_Pause ( LPC_I2S_T 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 111 of file i2s_17xx_40xx.h.

STATIC INLINE uint32_t Chip_I2S_Receive ( LPC_I2S_T pI2S)

Get received data from RXFIFO.

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

Definition at line 89 of file i2s_17xx_40xx.h.

STATIC INLINE void Chip_I2S_Send ( LPC_I2S_T 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
Note
The function writes to TXFIFO without checking any condition.

Definition at line 78 of file i2s_17xx_40xx.h.

STATIC INLINE void Chip_I2S_Start ( LPC_I2S_T 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 100 of file i2s_17xx_40xx.h.

STATIC INLINE void Chip_I2S_Stop ( LPC_I2S_T 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
Note
Pause, resets the transmit channel and FIFO asynchronously

Definition at line 144 of file i2s_17xx_40xx.h.