Intel® Quark™ Microcontroller Software Interface  1.4.0
Intel® Quark™ Microcontroller BSP
I2S

I2S. More...

Data Structures

struct  qm_i2s_buffer_link
 Ring buffer link definition. More...
 
struct  qm_i2s_channel_cfg_data_t
 I2S controller configuration. More...
 
struct  qm_i2s_clock_cfg_data_t
 I2S Clock Configuration. More...
 

Typedefs

typedef struct qm_i2s_buffer_link qm_i2s_buffer_link_t
 Ring buffer link definition.
 

Enumerations

enum  qm_i2s_master_slave_t { QM_I2S_MASTER = 0, QM_I2S_SLAVE }
 I2S master/slave configuration. More...
 
enum  qm_i2s_audio_stream_t { QM_I2S_AUDIO_STREAM_TRANSMIT = 0, QM_I2S_AUDIO_STREAM_RECEIVE }
 I2S Audio stream identifiers. More...
 
enum  qm_i2s_audio_format_t { QM_I2S_AUDIO_FORMAT_I2S_MODE = 0, QM_I2S_AUDIO_FORMAT_RIGHT_J, QM_I2S_AUDIO_FORMAT_LEFT_J, QM_I2S_AUDIO_FORMAT_DSP_MODE }
 I2S audio formats. More...
 
enum  qm_i2s_sample_resolution_t {
  QM_I2S_12_BIT_SAMPLE_RESOLUTION = 12, QM_I2S_13_BIT_SAMPLE_RESOLUTION = 13, QM_I2S_14_BIT_SAMPLE_RESOLUTION = 14, QM_I2S_15_BIT_SAMPLE_RESOLUTION = 15,
  QM_I2S_16_BIT_SAMPLE_RESOLUTION = 16, QM_I2S_17_BIT_SAMPLE_RESOLUTION = 17, QM_I2S_18_BIT_SAMPLE_RESOLUTION = 18, QM_I2S_19_BIT_SAMPLE_RESOLUTION = 19,
  QM_I2S_20_BIT_SAMPLE_RESOLUTION = 20, QM_I2S_21_BIT_SAMPLE_RESOLUTION = 21, QM_I2S_22_BIT_SAMPLE_RESOLUTION = 22, QM_I2S_23_BIT_SAMPLE_RESOLUTION = 23,
  QM_I2S_24_BIT_SAMPLE_RESOLUTION = 24, QM_I2S_25_BIT_SAMPLE_RESOLUTION = 25, QM_I2S_26_BIT_SAMPLE_RESOLUTION = 26, QM_I2S_27_BIT_SAMPLE_RESOLUTION = 27,
  QM_I2S_28_BIT_SAMPLE_RESOLUTION = 28, QM_I2S_29_BIT_SAMPLE_RESOLUTION = 29, QM_I2S_30_BIT_SAMPLE_RESOLUTION = 30, QM_I2S_31_BIT_SAMPLE_RESOLUTION = 31,
  QM_I2S_32_BIT_SAMPLE_RESOLUTION = 32
}
 I2S Audio sample resolution. More...
 
enum  qm_i2s_audio_rate_t {
  QM_I2S_RATE_4000KHZ = 0, QM_I2S_RATE_8000KHZ, QM_I2S_RATE_11025KHZ, QM_I2S_RATE_16000KHZ,
  QM_I2S_RATE_22050KHZ, QM_I2S_RATE_32000KHZ, QM_I2S_RATE_44100KHZ, QM_I2S_RATE_48000KHZ
}
 I2S Audio rates available. More...
 
enum  qm_i2s_buffer_mode_t { QM_I2S_TERMINATED_BUFFER = 0, QM_I2S_RING_BUFFER }
 I2S Audio buffer termination. More...
 
enum  qm_i2s_clk_src_t { QM_I2S_INT_CLK = 0, QM_I2S_MCLK }
 I2S Reference Clock Source Select. More...
 
enum  qm_i2s_status_t {
  QM_I2S_FIFO_OVERFLOW = BIT(0), QM_I2S_FIFO_UNDERRUN = BIT(1), QM_I2S_TX_FIFO_FULL = BIT(2), QM_I2S_TX_FIFO_ALMOST_FULL = BIT(3),
  QM_I2S_TX_FIFO_ALMOST_EMPTY = BIT(4), QM_I2S_TX_FIFO_EMPTY = BIT(5), QM_I2S_RX_FIFO_FULL = BIT(6), QM_I2S_RX_FIFO_ALMOST_FULL = BIT(7),
  QM_I2S_RX_FIFO_ALMOST_EMPTY = BIT(8), QM_I2S_RX_FIFO_EMPTY = BIT(9), QM_I2S_DMA_ERROR = BIT(10), QM_I2S_DMA_COMPLETE = BIT(11)
}
 I2S status type. More...
 

Functions

int qm_i2s_dma_channel_config (const qm_i2s_t i2s, const qm_i2s_audio_stream_t audio_stream, const qm_i2s_channel_cfg_data_t *const config)
 Function to configure specified I2S controller stream Configuration parameters must be valid or an error is returned - see return values below. More...
 
int qm_i2s_channel_disable (const qm_i2s_t i2s, const qm_i2s_audio_stream_t audio_stream)
 Function to place I2S controller into a disabled state. More...
 
int qm_i2s_set_clock_config (const qm_i2s_t i2s, const qm_i2s_clock_cfg_data_t *const i2s_clk_cfg)
 Function to configure and enable I2S clocks Configuration parameters must be valid or an error is returned - see return values below. More...
 
int qm_i2s_dma_transfer (const qm_i2s_t i2s, const qm_i2s_audio_stream_t audio_stream)
 Function to transmit a block of data to the specified I2S channel. More...
 
int qm_i2s_dma_transfer_terminate (const qm_i2s_t i2s, qm_i2s_channel_cfg_data_t *const config)
 Terminate the current DMA transfer on the given I2S peripheral channel. More...
 

Detailed Description

I2S.

Enumeration Type Documentation

I2S audio formats.

Enumerator
QM_I2S_AUDIO_FORMAT_I2S_MODE 

I2S Mode audio format.

QM_I2S_AUDIO_FORMAT_RIGHT_J 

Right justified audio format.

QM_I2S_AUDIO_FORMAT_LEFT_J 

Left justified audio format.

QM_I2S_AUDIO_FORMAT_DSP_MODE 

DSP mode audio format.

Definition at line 38 of file qm_i2s.h.

I2S Audio rates available.

Enumerator
QM_I2S_RATE_4000KHZ 

4kHz audio rate

QM_I2S_RATE_8000KHZ 

8kHz audio rate

QM_I2S_RATE_11025KHZ 

11.025kHz audio rate

QM_I2S_RATE_16000KHZ 

16kHz audio rate

QM_I2S_RATE_22050KHZ 

22.05kHz audio rate

QM_I2S_RATE_32000KHZ 

32kHz audio rate

QM_I2S_RATE_44100KHZ 

44.1kHz audio rate

QM_I2S_RATE_48000KHZ 

48kHz audio rate

Definition at line 96 of file qm_i2s.h.

I2S Audio stream identifiers.

Enumerator
QM_I2S_AUDIO_STREAM_TRANSMIT 

Playback audio stream.

QM_I2S_AUDIO_STREAM_RECEIVE 

Capture audio stream.

Definition at line 30 of file qm_i2s.h.

I2S Audio buffer termination.

Enumerator
QM_I2S_TERMINATED_BUFFER 

Used for single audio playback/recording.

QM_I2S_RING_BUFFER 

Used for continuous audio playback/recording.

Definition at line 110 of file qm_i2s.h.

I2S Reference Clock Source Select.

Enumerator
QM_I2S_INT_CLK 

Use internal clock.

QM_I2S_MCLK 

Take in clock from external source.

Definition at line 119 of file qm_i2s.h.

I2S master/slave configuration.

Enumerator
QM_I2S_MASTER 

Master configuration selection.

QM_I2S_SLAVE 

Slave configuration selection.

Definition at line 22 of file qm_i2s.h.

I2S Audio sample resolution.

Resolution ranges between 12 bits and 32 bits.

Enumerator
QM_I2S_12_BIT_SAMPLE_RESOLUTION 

12 bits audio sample resolution

QM_I2S_13_BIT_SAMPLE_RESOLUTION 

13 bits audio sample resolution

QM_I2S_14_BIT_SAMPLE_RESOLUTION 

14 bits audio sample resolution

QM_I2S_15_BIT_SAMPLE_RESOLUTION 

15 bits audio sample resolution

QM_I2S_16_BIT_SAMPLE_RESOLUTION 

16 bits audio sample resolution

QM_I2S_17_BIT_SAMPLE_RESOLUTION 

17 bits audio sample resolution

QM_I2S_18_BIT_SAMPLE_RESOLUTION 

18 bits audio sample resolution

QM_I2S_19_BIT_SAMPLE_RESOLUTION 

19 bits audio sample resolution

QM_I2S_20_BIT_SAMPLE_RESOLUTION 

20 bits audio sample resolution

QM_I2S_21_BIT_SAMPLE_RESOLUTION 

21 bits audio sample resolution

QM_I2S_22_BIT_SAMPLE_RESOLUTION 

22 bits audio sample resolution

QM_I2S_23_BIT_SAMPLE_RESOLUTION 

23 bits audio sample resolution

QM_I2S_24_BIT_SAMPLE_RESOLUTION 

24 bits audio sample resolution

QM_I2S_25_BIT_SAMPLE_RESOLUTION 

25 bits audio sample resolution

QM_I2S_26_BIT_SAMPLE_RESOLUTION 

26 bits audio sample resolution

QM_I2S_27_BIT_SAMPLE_RESOLUTION 

27 bits audio sample resolution

QM_I2S_28_BIT_SAMPLE_RESOLUTION 

28 bits audio sample resolution

QM_I2S_29_BIT_SAMPLE_RESOLUTION 

29 bits audio sample resolution

QM_I2S_30_BIT_SAMPLE_RESOLUTION 

30 bits audio sample resolution

QM_I2S_31_BIT_SAMPLE_RESOLUTION 

31 bits audio sample resolution

QM_I2S_32_BIT_SAMPLE_RESOLUTION 

32 bits audio sample resolution

Definition at line 48 of file qm_i2s.h.

I2S status type.

Enumerator
QM_I2S_FIFO_OVERFLOW 

Indicates that a FIFO overflow error was detected.

QM_I2S_FIFO_UNDERRUN 

Indicates that a FIFO underrun error was detected.

QM_I2S_TX_FIFO_FULL 

Indicates TX FIFO full interrupt occurred.

QM_I2S_TX_FIFO_ALMOST_FULL 

Indicates TX FIFO almost full interrupt occurred.

QM_I2S_TX_FIFO_ALMOST_EMPTY 

Indicates TX FIFO almost empty interrupt occurred.

QM_I2S_TX_FIFO_EMPTY 

Indicates TX FIFO empty interrupt occurred.

QM_I2S_RX_FIFO_FULL 

Indicates RX FIFO full interrupt occurred.

QM_I2S_RX_FIFO_ALMOST_FULL 

Indicates RX FIFO almost full interrupt occurred.

QM_I2S_RX_FIFO_ALMOST_EMPTY 

Indicates RX FIFO almost empty interrupt occurred.

QM_I2S_RX_FIFO_EMPTY 

Indicates RX FIFO empty interrupt occurred.

QM_I2S_DMA_ERROR 

Indicates that a DMA error was detected.

QM_I2S_DMA_COMPLETE 

Indicates that DMA operation was completed.

Definition at line 127 of file qm_i2s.h.

Function Documentation

int qm_i2s_channel_disable ( const qm_i2s_t  i2s,
const qm_i2s_audio_stream_t  audio_stream 
)

Function to place I2S controller into a disabled state.

This function assumes that there is no pending transaction on the I2S interface in question. It is the responsibility of the calling application to do so.

Parameters
[in]i2sI2S controller identifier
[in]audio_streamI2S audio_stream identifier
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.
int qm_i2s_dma_channel_config ( const qm_i2s_t  i2s,
const qm_i2s_audio_stream_t  audio_stream,
const qm_i2s_channel_cfg_data_t *const  config 
)

Function to configure specified I2S controller stream Configuration parameters must be valid or an error is returned - see return values below.

Parameters
[in]i2sI2S controller identifier
[in]audio_streamI2S audio_stream identifier
[in]configPointer to configuration structure
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.
int qm_i2s_dma_transfer ( const qm_i2s_t  i2s,
const qm_i2s_audio_stream_t  audio_stream 
)

Function to transmit a block of data to the specified I2S channel.

Parameters
[in]i2sI2S controller identifier
[in]audio_streamI2S audio_stream identifier
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.
int qm_i2s_dma_transfer_terminate ( const qm_i2s_t  i2s,
qm_i2s_channel_cfg_data_t *const  config 
)

Terminate the current DMA transfer on the given I2S peripheral channel.

Terminate the current DMA transfer on the I2S channel. This will cause the relevant callbacks to be invoked.

In the case the user is doing a continuous transfer using a circular linked list, it might be useful to fine control at which point in the linked list that we stop the transfer. To do this, set the relevant linked list item's "next" item to NULL.

Parameters
[in]i2sI2S controller identifier
[in]configPointer to configuration structure
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.
int qm_i2s_set_clock_config ( const qm_i2s_t  i2s,
const qm_i2s_clock_cfg_data_t *const  i2s_clk_cfg 
)

Function to configure and enable I2S clocks Configuration parameters must be valid or an error is returned - see return values below.

Parameters
[in]i2sI2S controller identifier
[in]i2s_clk_cfgI2S Clock configuration
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.