QORC-SDK I2S HAL

This file contains API declaration for I2S Peripheral(s)

Defines

HAL_I2S_RET_VAL

return value definitions

HAL_I2S_RET_VAL_ERROR
HAL_I2S_SUCCESS
HAL_I2S_ERROR
HAL_I2S_TX_ERROR
HAL_I2S_RX_ERROR
HAL_I2S_TIME_OUT_ERROR
HAL_I2S_BAD_PARAMETER
HAL_I2S_INVALID_STATE
I2S_CHANNELS_STEREO

I2S Stereo/Mono selection.

I2S_CHANNELS_MONO
I2S_CHANNEL_MONO_LEFT

I2S Mono Left/ Mono Right selection.

I2S_CHANNEL_MONO_RIGHT
I2S_MASTER_ASSP_RX

I2S Master/Slave in use details.

I2S_SLAVE_ASSP_TX
I2S_SLAVE_FABRIC_RX
I2S_MASTER_SLAVE_MAX

Typedefs

typedef void (*HAL_I2S_Cb_Handler_t)(uint8_t i2s_id_sel, uint32_t const *p_data_received, uint32_t *p_data_to_send, uint16_t buffer_size)

HAL_I2S_Cb_Handler_t I2S driver call back. Callback gets called after completion of Tx/Rx.

Param i2s_id_sel:

[in] I2S ID which is a identifier for the I2S.

Param p_data_received:

[in] Pointer to the buffer with received data, or NULL if the handler is for Tx only.

Param p_data_to_send:

[out] Pointer to the buffer with data sent ,or NULL if the handler is for Rx only.

Param buffer_size:

[in] Buffer size in bytes, Length of data received and/or sent. This value is always equal to half the size of the buffers set by the call ql_i2s_data_tx_rx_start function. Since it uses ping pong buffer mechanism.

typedef uint32_t (*i2s_init)(I2S_Config_t *p_i2s_cfg, HAL_I2S_Cb_Handler_t handler)

function pointers declaration to register for each i2s driver

typedef uint32_t (*i2s_buffer)(uint32_t *p_rx_buffer, uint32_t *p_tx_buffer, uint16_t buffer_size)
typedef void (*i2s_stop)(void)
typedef void (*i2s_uninit)(void)

Functions

uint32_t HAL_I2S_Init(uint8_t i2s_id_sel, I2S_Config_t *p_i2s_cfg, HAL_I2S_Cb_Handler_t handler)

HAL_I2S_Init Function for initializing the I2S driver.

Parameters:
  • i2s_id_sel[in] I2S ID which is a identifier for the I2S.

  • p_i2s_cfg[in] Pointer to the structure with initial configuration.

  • handler[in] callback for getting a callback once done with Rx/Tx.

Return values:

HAL_I2S_SUCCESS – in case of success, HAL_I2S_ERROR in case of failure.

uint32_t HAL_I2S_TX_RX_Buffer(uint8_t i2s_id_sel, uint32_t *p_rx_buffer, uint32_t *p_tx_buffer, uint16_t buffer_size)

HAL_I2S_TX_RX_Buffer Function for starting the Tx/Rx over I2S.

Parameters:
  • i2s_id_sel[in] I2S ID which is a identifier for the I2S.

  • p_rx_buffer[in] receive buffer in case of RX otherwise NULL

  • p_tx_buffer[in] transmit buffer in case of RX otherwise NULL

  • buffer_size[in] Tx/Rx buffer size in Bytes (ping pong buffer mechanism)

Return values:

HAL_I2S_SUCCESS – in case of success, else other error value defined above.

uint32_t HAL_I2S_Stop(uint8_t i2s_id_sel)

HAL_I2S_Stop Function for stopping the ongoing Rx/Tx.

Parameters:

i2s_id_sel[in] I2S ID which is a identifier for the I2S

Return values:

HAL_I2S_SUCCESS – on success else HAL_I2S_ERROR.

uint32_t HAL_I2S_Uninit(uint8_t i2s_id_sel)

HAL_I2S_Uninit Function to undo the init.

Parameters:

i2s_id_sel[in] I2S ID which is a identifier for the I2S

Return values:

HAL_I2S_SUCCESS – on success else HAL_I2S_ERROR.

uint32_t HAL_I2S_Register_Driver(uint8_t i2s_id_sel, I2S_Drv_t i2s_drv_fn)

HAL_I2S_register_driver i2s slave/master drivers should register their function using this function.

Parameters:
  • i2s_id_sel[in] I2S ID which is a identifier for the I2S

  • i2s_drv_fn[in] function pointers to be passed here from i2s drivers

Return values:

HAL_I2S_SUCCESS – on success else HAL_I2S_ERROR.

struct I2S_Config_t
#include <eoss3_hal_i2s.h>

I2S driver structure.

Public Members

uint8_t sdma_used
uint8_t i2s_wd_clk
uint8_t ch_sel
uint8_t mono_sel
struct I2S_Drv_t
#include <eoss3_hal_i2s.h>

function pointers for each i2s driver

Public Members

uint8_t i2s_state
i2s_init initfn
i2s_buffer bufferfn
i2s_stop stopfn
i2s_uninit un_initfn