I2S#

Modules#

sl_i2s_version_t

sl_i2s_xfer_config_t

Enumerations#

enum
SL_I2S_SEND_COMPLETE = ARM_SAI_EVENT_SEND_COMPLETE
SL_I2S_RECEIVE_COMPLETE = ARM_SAI_EVENT_RECEIVE_COMPLETE
SL_I2S_TX_UNDERFLOW = ARM_SAI_EVENT_TX_UNDERFLOW
SL_I2S_RX_OVERFLOW = ARM_SAI_EVENT_RX_OVERFLOW
SL_I2S_FRAME_ERROR = ARM_SAI_EVENT_FRAME_ERROR
}

Enumeration for different I2S callback events.

enum
SL_I2S_POWER_OFF = ARM_POWER_OFF
SL_I2S_LOW_POWER = ARM_POWER_LOW
SL_I2S_FULL_POWER = ARM_POWER_FULL
}

Enumeration for I2S power state.

enum
SL_I2S_MASTER = ARM_SAI_MODE_MASTER
SL_I2S_SLAVE = ARM_SAI_MODE_SLAVE
}

Enumeration for I2S Primary and Secondary modes.

enum
SL_I2S_PROTOCOL = ARM_SAI_PROTOCOL_I2S
SL_PCM_PROTOCOL = 0
}

Enumeration for SAI protocol type.

enum
SL_I2S_SYNC = ARM_SAI_SYNCHRONOUS
SL_I2S_ASYNC = ARM_SAI_ASYNCHRONOUS
}

Enumeration for I2S SYNC/ASYNC modes.

enum
SL_I2S_TRANSMIT = ARM_SAI_CONFIGURE_TX
SL_I2S_RECEIVE = ARM_SAI_CONFIGURE_RX
SL_I2S_TRANSMIT_CONTROL = ARM_SAI_CONTROL_TX
SL_I2S_RECEIVE_CONTROL = ARM_SAI_CONTROL_RX
SL_I2S_SEND_ABORT = ARM_SAI_ABORT_SEND
SL_I2S_RECEIVE_ABORT = ARM_SAI_ABORT_RECEIVE
}

Enumeration for I2S transfer type.

enum
SL_I2S_DATA_SIZE16 = 16
SL_I2S_DATA_SIZE32 = 32
}

Enumeration for I2S transfer data size.

enum
SL_I2S_RESOLUTION_12 = 12
SL_I2S_RESOLUTION_16 = 16
SL_I2S_RESOLUTION_20 = 20
SL_I2S_RESOLUTION_24 = 24
SL_I2S_RESOLUTION_32 = 32
}

Enumeration for I2S audio data resolutions.

enum
SL_I2S_SAMPLING_RATE_8000 = 8000
SL_I2S_SAMPLING_RATE_11025 = 11025
SL_I2S_SAMPLING_RATE_16000 = 16000
SL_I2S_SAMPLING_RATE_22050 = 22050
SL_I2S_SAMPLING_RATE_24000 = 24000
SL_I2S_SAMPLING_RATE_32000 = 32000
SL_I2S_SAMPLING_RATE_44100 = 44100
SL_I2S_SAMPLING_RATE_48000 = 48000
SL_I2S_SAMPLING_RATE_88200 = 88200
SL_I2S_SAMPLING_RATE_96000 = 96000
SL_I2S_SAMPLING_RATE_192000 = 192000
}

Enumeration for I2S sample rates.

Typedefs#

typedef ARM_SAI_SignalEvent_t

Renamed signal event structure.

typedef ARM_SAI_STATUS

Renamed status structure.

typedef ARM_DRIVER_SAI

Renamed I2S driver structure.

typedef const void *

Created I2S handle type.

Functions#

sl_status_t
sl_si91x_i2s_init(uint32_t i2s_instance, sl_i2s_handle_t *i2s_handle)

Initialize the I2S.

sl_status_t
sl_si91x_i2s_deinit(sl_i2s_handle_t *i2s_handle)

Uninitialize I2S peripheral.

sl_status_t
sl_si91x_i2s_configure_power_mode(sl_i2s_handle_t i2s_handle, sl_i2s_power_state_t state)

Change the power mode of I2S, the supported modes are POWER_OFF - I2S peripheral clocks and I2S DMA channel is disabled.

sl_status_t
sl_si91x_i2s_config_transmit_receive(sl_i2s_handle_t i2s_handle, sl_i2s_xfer_config_t *xfer_config)

Configure transmitter/Receiver parameters for I2S transfer.

sl_status_t
sl_si91x_i2s_transmit_data(sl_i2s_handle_t i2s_handle, const void *data, uint32_t size)

Configure I2S tx DMA channel descriptors and trigger dma transfer.

sl_status_t
sl_si91x_i2s_receive_data(sl_i2s_handle_t i2s_handle, const void *data, uint32_t size)

Configure I2S rx DMA channel descriptors and enable dma channel to recieve data.

sl_status_t
sl_si91x_i2s_register_event_callback(sl_i2s_handle_t i2s_handle, sl_i2s_signal_event_t callback_event)

Register the user callback function.

sl_status_t
sl_si91x_i2s_unregister_event_callback(sl_i2s_handle_t i2s_handle)

Un-register the user callback function.

uint32_t
sl_si91x_i2s_get_transmit_data_count(sl_i2s_handle_t i2s_handle)

Get the transmit data count of I2S.

uint32_t
sl_si91x_i2s_get_receive_data_count(sl_i2s_handle_t i2s_handle)

Get the receive data count of I2S.

Get the release, sqa, and dev version of I2S.

sl_si91x_i2s_get_status(sl_i2s_handle_t i2s_handle)

Get following transfer status of I2S,.

sl_status_t
sl_si91x_i2s_end_transfer(sl_i2s_handle_t i2s_handle, sl_i2s_xfer_type_t abort_type)

Abort I2S Tx/Rx operations.

Enumeration Documentation#

i2s_event_typedef_t#

i2s_event_typedef_t

Enumeration for different I2S callback events.

Enumerator
SL_I2S_SEND_COMPLETE

Send complete event.

SL_I2S_RECEIVE_COMPLETE

Receive lost event.

SL_I2S_TX_UNDERFLOW

Tx underflow event.

SL_I2S_RX_OVERFLOW

Rx Overflow event.

SL_I2S_FRAME_ERROR

Frame error event.


Definition at line 56 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_i2s_power_state_t#

sl_i2s_power_state_t

Enumeration for I2S power state.

Enumerator
SL_I2S_POWER_OFF

Power mode OFF.

SL_I2S_LOW_POWER

Low power mode.

SL_I2S_FULL_POWER

Full power mode.


Definition at line 65 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_i2s_mode_t#

sl_i2s_mode_t

Enumeration for I2S Primary and Secondary modes.

Enumerator
SL_I2S_MASTER

I2S primary mode.

SL_I2S_SLAVE

I2S secondary mode.


Definition at line 72 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_sai_protocol_t#

sl_sai_protocol_t

Enumeration for SAI protocol type.

Enumerator
SL_I2S_PROTOCOL

I2S protocol.

SL_PCM_PROTOCOL

PCM protocol, currently not supported in the driver.


Definition at line 78 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_i2s_sync_t#

sl_i2s_sync_t

Enumeration for I2S SYNC/ASYNC modes.

Enumerator
SL_I2S_SYNC

I2S synchronous mode.

SL_I2S_ASYNC

I2S asynchronous mode.


Definition at line 84 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_i2s_xfer_type_t#

sl_i2s_xfer_type_t

Enumeration for I2S transfer type.

Enumerator
SL_I2S_TRANSMIT

I2S transmit.

SL_I2S_RECEIVE

I2S receive.

SL_I2S_TRANSMIT_CONTROL

I2S receive.

SL_I2S_RECEIVE_CONTROL

I2S receive.

SL_I2S_SEND_ABORT

I2S abort transmit.

SL_I2S_RECEIVE_ABORT

I2S abort receive.


Definition at line 90 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_i2s_xfer_size_t#

sl_i2s_xfer_size_t

Enumeration for I2S transfer data size.

Enumerator
SL_I2S_DATA_SIZE16

16 bits

SL_I2S_DATA_SIZE32

32 bits


Definition at line 100 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_i2s_data_resolution_t#

sl_i2s_data_resolution_t

Enumeration for I2S audio data resolutions.

Enumerator
SL_I2S_RESOLUTION_12

12 bit resolution

SL_I2S_RESOLUTION_16

16 bit resolution

SL_I2S_RESOLUTION_20

20 bit resolution

SL_I2S_RESOLUTION_24

24 bit resolution

SL_I2S_RESOLUTION_32

32 bit resolution


Definition at line 106 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_i2s_sampling_rate_t#

sl_i2s_sampling_rate_t

Enumeration for I2S sample rates.

Enumerator
SL_I2S_SAMPLING_RATE_8000

8kHz

SL_I2S_SAMPLING_RATE_11025

11.025kHz

SL_I2S_SAMPLING_RATE_16000

16kHz

SL_I2S_SAMPLING_RATE_22050

22.05kHz

SL_I2S_SAMPLING_RATE_24000

24kHz

SL_I2S_SAMPLING_RATE_32000

32kHz

SL_I2S_SAMPLING_RATE_44100

44.1kHz

SL_I2S_SAMPLING_RATE_48000

48kHz

SL_I2S_SAMPLING_RATE_88200

88.2kHz

SL_I2S_SAMPLING_RATE_96000

96kHz

SL_I2S_SAMPLING_RATE_192000

192kHz


Definition at line 115 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

Typedef Documentation#

sl_i2s_signal_event_t#

typedef ARM_SAI_SignalEvent_t sl_i2s_signal_event_t

Renamed signal event structure.


Definition at line 50 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_i2s_status_t#

typedef ARM_SAI_STATUS sl_i2s_status_t

Renamed status structure.


Definition at line 51 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_i2s_driver_t#

typedef ARM_DRIVER_SAI sl_i2s_driver_t

Renamed I2S driver structure.


Definition at line 52 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_i2s_handle_t#

typedef const void* sl_i2s_handle_t

Created I2S handle type.


Definition at line 53 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

Function Documentation#

sl_si91x_i2s_init#

sl_status_t sl_si91x_i2s_init (uint32_t i2s_instance, sl_i2s_handle_t * i2s_handle)

Initialize the I2S.

Parameters
[in]i2s_instance

instance , 0 - I2S0 1 - I2S1

[in]i2s_handle

Double Pointer to the I2S driver handle

Pass the address of the pointer for storing the I2S handle, which can be used in future for other function calls.

  • Pre-conditions:

    • none

Returns

  • status 0 if successful, else error code as follow

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid

    • SL_STATUS_NULL_POINTER (0x0022) - Invalid null pointer received as argument

    • SL_STATUS_BUSY (0x0004) - Driver is busy


Definition at line 166 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_si91x_i2s_deinit#

sl_status_t sl_si91x_i2s_deinit (sl_i2s_handle_t * i2s_handle)

Uninitialize I2S peripheral.

Parameters
[in]i2s_handle

Pointer to the I2S driver handle

This will also disable the DMA instance used for I2S transfer. This API needs to be called only if the I2S peripheral is initialized before using sl_si91x_i2s_init().

Returns

  • status 0 if successful, else error code as follow

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid

    • SL_STATUS_NULL_POINTER (0x0022) - Invalid null pointer received as argument


Definition at line 182 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_si91x_i2s_configure_power_mode#

sl_status_t sl_si91x_i2s_configure_power_mode (sl_i2s_handle_t i2s_handle, sl_i2s_power_state_t state)

Change the power mode of I2S, the supported modes are POWER_OFF - I2S peripheral clocks and I2S DMA channel is disabled.

Parameters
[in]i2s_handle

Pointer to the I2S driver handle

[in]state

state, SL_I2S_POWER_OFF/SL_I2S_FULL_POWER

FULL_POWER - Enable I2S peripheral clocks and configure I2S DMA channel.

Returns

  • status 0 if successful, else error code as follow

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid

    • SL_STATUS_NULL_POINTER (0x0022) - Invalid null pointer received as argument


Definition at line 200 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_si91x_i2s_config_transmit_receive#

sl_status_t sl_si91x_i2s_config_transmit_receive (sl_i2s_handle_t i2s_handle, sl_i2s_xfer_config_t * xfer_config)

Configure transmitter/Receiver parameters for I2S transfer.

Parameters
[in]i2s_handle

Pointer to the I2S driver handle

[in]xfer_config

of structure which stores transfer parameters

DMA transmit and receive configurations. Configuring transfer_type to SL_I2S_TRANSMIT will configure Tx channel and SL_I2S_RECEIVE will configure Rx channel. receiving data.

Returns

  • status 0 if successful, else error code as follow

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid

    • SL_STATUS_NULL_POINTER (0x0022) - Invalid null pointer received as argument


Definition at line 221 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_si91x_i2s_transmit_data#

sl_status_t sl_si91x_i2s_transmit_data (sl_i2s_handle_t i2s_handle, const void * data, uint32_t size)

Configure I2S tx DMA channel descriptors and trigger dma transfer.

Parameters
[in]i2s_handle

Pointer to the I2S driver handle

[in]data

of transmit data

[in]size

size

sl_si91x_i2s_config_transmit_receive() should be called with transfer_type set to SL_I2S_TRANSMIT before sending data.

Returns

  • status 0 if successful, else error code as follow

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid

    • SL_STATUS_NULL_POINTER (0x0022) - Invalid null pointer received as argument


Definition at line 241 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_si91x_i2s_receive_data#

sl_status_t sl_si91x_i2s_receive_data (sl_i2s_handle_t i2s_handle, const void * data, uint32_t size)

Configure I2S rx DMA channel descriptors and enable dma channel to recieve data.

Parameters
[in]i2s_handle

Pointer to the I2S driver handle

[in]data

of receive data

[in]size

size

sl_si91x_i2s_config_transmit_receive() should be called with transfer_type set to SL_I2S_RECEIVE before receiving data.

Returns

  • status 0 if successful, else error code as follow

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid

    • SL_STATUS_NULL_POINTER (0x0022) - Invalid null pointer received as argument


Definition at line 261 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_si91x_i2s_register_event_callback#

sl_status_t sl_si91x_i2s_register_event_callback (sl_i2s_handle_t i2s_handle, sl_i2s_signal_event_t callback_event)

Register the user callback function.

Parameters
[in]i2s_handle

Pointer to the I2S driver handle

[in]callback_event

Pointer to the function which needs to be called at the time of interrupt

Transfer complete event can be notified using this callback. Callbacks should be registered before starting I2S transfer.

  • Pre-conditions:

    • none

Returns

  • status 0 if successful, else error code as follow

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer

    • SL_STATUS_BUSY (0x0004) - Driver is busy


Definition at line 278 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_si91x_i2s_unregister_event_callback#

sl_status_t sl_si91x_i2s_unregister_event_callback (sl_i2s_handle_t i2s_handle)

Un-register the user callback function.

Parameters
[in]i2s_handle

Pointer to the I2S driver handle

This function can be used only if callbacks are registered before using sl_si91x_i2s_register_event_callback()

Returns

  • status 0 if successful, else error code SL_STATUS_OK (0x0000) - Success SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid SL_STATUS_NULL_POINTER (0x0022) - Invalid null pointer received as argument


Definition at line 294 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_si91x_i2s_get_transmit_data_count#

uint32_t sl_si91x_i2s_get_transmit_data_count (sl_i2s_handle_t i2s_handle)

Get the transmit data count of I2S.

Parameters
[in]i2s_handle

Pointer to the I2S driver handle

If an active I2S transfer is started, this function can be used to get number of data bytes transfered.

Returns

  • uint32_t value of the tx data count


Definition at line 310 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_si91x_i2s_get_receive_data_count#

uint32_t sl_si91x_i2s_get_receive_data_count (sl_i2s_handle_t i2s_handle)

Get the receive data count of I2S.

Parameters
[in]i2s_handle

Pointer to the I2S driver handle

If I2S is configured for receive, this function can be used to get number of data bytes received.

Returns

  • uint32_t value of the rx data count


Definition at line 326 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_si91x_i2s_get_version#

sl_i2s_version_t sl_si91x_i2s_get_version (void )

Get the release, sqa, and dev version of I2S.

Parameters
[in]
  • Pre-conditions:

    • none

Returns


Definition at line 338 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_si91x_i2s_get_status#

sl_i2s_status_t sl_si91x_i2s_get_status (sl_i2s_handle_t i2s_handle)

Get following transfer status of I2S,.

Parameters
[in]i2s_handle

Pointer to the I2S driver handle

  1. Frame error

  2. Rx busy

  3. Rx overflow

  4. Tx busy

  5. Tx underflow

Returns

  • (sl_i2s_status_t) type structure


Definition at line 357 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h

sl_si91x_i2s_end_transfer#

sl_status_t sl_si91x_i2s_end_transfer (sl_i2s_handle_t i2s_handle, sl_i2s_xfer_type_t abort_type)

Abort I2S Tx/Rx operations.

Parameters
[in]i2s_handle

Pointer to the I2S driver handle

[in]abort_type

type, ARM_SAI_ABORT_SEND/ARM_SAI_ABORT_RECEIVE

Disable I2S clocks and DMA channel. This function need to be called after completion of I2S transmit/receive.

Returns

  • status 0 if successful, else error code as follow

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid

    • SL_STATUS_NULL_POINTER (0x0022) - Invalid null pointer received as argument


Definition at line 377 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2s.h