I2S#
Modules#
Enumerations#
Enumeration for different I2S callback events.
Enumeration for I2S power state.
Enumeration for I2S Primary and Secondary modes.
Enumeration for SAI protocol type.
Enumeration for I2S SYNC/ASYNC modes.
Enumeration for I2S transfer type.
Enumeration for I2S transfer data size.
Enumeration for I2S audio data resolutions.
Enumeration for I2S sample rates.
Typedefs#
Renamed signal event structure.
Renamed status structure.
Renamed I2S driver structure.
Created I2S handle type.
Functions#
Initialize the I2S.
Uninitialize I2S peripheral.
Change the power mode of I2S, the supported modes are POWER_OFF - I2S peripheral clocks and I2S DMA channel is disabled.
Configure transmitter/Receiver parameters for I2S transfer.
Configure I2S tx DMA channel descriptors and trigger dma transfer.
Configure I2S rx DMA channel descriptors and enable dma channel to recieve data.
Register the user callback function.
Un-register the user callback function.
Get the transmit data count of I2S.
Get the receive data count of I2S.
Get the release, sqa, and dev version of I2S.
Get following transfer status of I2S,.
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. |
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. |
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. |
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. |
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. |
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. |
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 |
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 |
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 |
Typedef Documentation#
sl_i2s_signal_event_t#
typedef ARM_SAI_SignalEvent_t sl_i2s_signal_event_t
Renamed signal event structure.
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | i2s_instance | instance , 0 - I2S0 1 - I2S1 |
sl_i2s_handle_t * | [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
sl_si91x_i2s_deinit#
sl_status_t sl_si91x_i2s_deinit (sl_i2s_handle_t * i2s_handle)
Uninitialize I2S peripheral.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2s_handle_t * | [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().
Pre-conditions:
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_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.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2s_handle_t | [in] | i2s_handle | Pointer to the I2S driver handle |
sl_i2s_power_state_t | [in] | state | state, SL_I2S_POWER_OFF/SL_I2S_FULL_POWER |
FULL_POWER - Enable I2S peripheral clocks and configure I2S DMA channel.
Pre-conditions:
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_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.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2s_handle_t | [in] | i2s_handle | Pointer to the I2S driver handle |
sl_i2s_xfer_config_t * | [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.
Pre-conditions:
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_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.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2s_handle_t | [in] | i2s_handle | Pointer to the I2S driver handle |
const void * | [in] | data | of transmit data |
uint32_t | [in] | size | size |
sl_si91x_i2s_config_transmit_receive() should be called with transfer_type set to SL_I2S_TRANSMIT before sending data.
Pre-conditions:
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_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.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2s_handle_t | [in] | i2s_handle | Pointer to the I2S driver handle |
const void * | [in] | data | of receive data |
uint32_t | [in] | size | size |
sl_si91x_i2s_config_transmit_receive() should be called with transfer_type set to SL_I2S_RECEIVE before receiving data.
Pre-conditions:
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_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.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2s_handle_t | [in] | i2s_handle | Pointer to the I2S driver handle |
sl_i2s_signal_event_t | [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
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2s_handle_t | [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()
Pre-conditions:
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
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2s_handle_t | [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.
Pre-conditions:
Returns
uint32_t value of the tx data count
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2s_handle_t | [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.
Pre-conditions:
Returns
uint32_t value of the rx data count
sl_si91x_i2s_get_version#
sl_i2s_version_t sl_si91x_i2s_get_version (void )
Get the release, sqa, and dev version of I2S.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | [in] |
Pre-conditions:
none
Returns
(sl_i2s_version_t) type structure
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,.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2s_handle_t | [in] | i2s_handle | Pointer to the I2S driver handle |
Frame error
Rx busy
Rx overflow
Tx busy
Tx underflow
Pre-conditions:
Returns
(sl_i2s_status_t) type structure
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_i2s_handle_t | [in] | i2s_handle | Pointer to the I2S driver handle |
sl_i2s_xfer_type_t | [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.
Pre-conditions:
sl_si91x_i2s_transmit_data/sl_si91x_i2s_receive_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