XCORE SDK
XCORE Software Development Kit
Classes | Macros | Typedefs | Enumerations
hil_i2s_core

Classes

struct  i2s_config
 
struct  i2s_callback_group_t
 

Macros

#define I2S_MAX_DATALINES   8
 
#define I2S_CHANS_PER_FRAME   2
 
#define I2S_CALLBACK_ATTR   __attribute__((fptrgroup("i2s_callback")))
 

Typedefs

typedef enum i2s_mode i2s_mode_t
 
typedef enum i2s_slave_bclk_polarity i2s_slave_bclk_polarity_t
 
typedef struct i2s_config i2s_config_t
 
typedef enum i2s_restart i2s_restart_t
 
typedef void(* i2s_init_t) (void *app_data, i2s_config_t *i2s_config)
 
typedef i2s_restart_t(* i2s_restart_check_t) (void *app_data)
 
typedef void(* i2s_receive_t) (void *app_data, size_t num_in, const int32_t *samples)
 
typedef void(* i2s_send_t) (void *app_data, size_t num_out, int32_t *samples)
 

Enumerations

enum  i2s_mode { I2S_MODE_I2S , I2S_MODE_LEFT_JUSTIFIED }
 
enum  i2s_slave_bclk_polarity { I2S_SLAVE_SAMPLE_ON_BCLK_RISING , I2S_SLAVE_SAMPLE_ON_BCLK_FALLING }
 
enum  i2s_restart { I2S_NO_RESTART = 0 , I2S_RESTART , I2S_SHUTDOWN }
 

Detailed Description

The public API for using the HIL I2S core.

Macro Definition Documentation

◆ I2S_CALLBACK_ATTR

#define I2S_CALLBACK_ATTR   __attribute__((fptrgroup("i2s_callback")))

This attribute must be specified on all I2S callback functions provided by the application.

Typedef Documentation

◆ i2s_config_t

typedef struct i2s_config i2s_config_t

I2S configuration structure.

This structure describes the configuration of an I2S bus.

◆ i2s_init_t

typedef void(* i2s_init_t) (void *app_data, i2s_config_t *i2s_config)

I2S initialization event callback.

The I2S component will call this when it first initializes on first run of after a restart.

Parameters
app_dataPoints to application specific data supplied by the application. May be used for context data specific to each I2S task instance.
i2s_configThis structure is provided if the connected component drives an I2S bus. The members of the structure should be set to the required configuration.

◆ i2s_mode_t

typedef enum i2s_mode i2s_mode_t

I2S mode.

This type is used to describe the I2S mode.

◆ i2s_receive_t

typedef void(* i2s_receive_t) (void *app_data, size_t num_in, const int32_t *samples)

Receive an incoming frame of samples.

This callback will be called when a new frame of samples is read in by the I2S task.

Parameters
app_dataPoints to application specific data supplied by the application. May be used for context data specific to each I2S task instance.
num_inThe number of input channels contained within the array.
samplesThe samples data array as signed 32-bit values. The component may not have 32-bits of accuracy (for example, many I2S codecs are 24-bit), in which case the bottom bits will be arbitrary values.

◆ i2s_restart_check_t

typedef i2s_restart_t(* i2s_restart_check_t) (void *app_data)

I2S restart check callback.

This callback is called once per frame. The application must return the required restart behavior.

Parameters
app_dataPoints to application specific data supplied by the application. May be used for context data specific to each I2S task instance.
Returns
The return value should be set to I2S_NO_RESTART, I2S_RESTART or I2S_SHUTDOWN.

◆ i2s_restart_t

typedef enum i2s_restart i2s_restart_t

Restart command type.

Restart commands that can be signalled to the I2S or TDM component.

◆ i2s_send_t

typedef void(* i2s_send_t) (void *app_data, size_t num_out, int32_t *samples)

Request an outgoing frame of samples.

This callback will be called when the I2S task needs a new frame of samples.

Parameters
app_dataPoints to application specific data supplied by the application. May be used for context data specific to each I2S task instance.
num_outThe number of output channels contained within the array.
samplesThe samples data array as signed 32-bit values. The component may not have 32-bits of accuracy (for example, many I2S codecs are 24-bit), in which case the bottom bits will be arbitrary values.

◆ i2s_slave_bclk_polarity_t

I2S slave bit clock polarity.

Standard I2S is positive, that is toggle data and LR clock on falling edge of bit clock and sample them on rising edge of bit clock. Some masters have it the other way around.

Enumeration Type Documentation

◆ i2s_mode

enum i2s_mode

I2S mode.

This type is used to describe the I2S mode.

Enumerator
I2S_MODE_I2S 

The LR clock transitions ahead of the data by one bit clock.

I2S_MODE_LEFT_JUSTIFIED 

The LR clock and data are phase aligned.

◆ i2s_restart

Restart command type.

Restart commands that can be signalled to the I2S or TDM component.

Enumerator
I2S_NO_RESTART 

Do not restart.

I2S_RESTART 

Restart the bus (causes the I2S/TDM to stop and a new init callback to occur allowing reconfiguration of the BUS).

I2S_SHUTDOWN 

Shutdown. This will cause the I2S/TDM component to exit.

◆ i2s_slave_bclk_polarity

I2S slave bit clock polarity.

Standard I2S is positive, that is toggle data and LR clock on falling edge of bit clock and sample them on rising edge of bit clock. Some masters have it the other way around.

Enumerator
I2S_SLAVE_SAMPLE_ON_BCLK_RISING 

Toggle falling, sample rising (default if not set)

I2S_SLAVE_SAMPLE_ON_BCLK_FALLING 

Toggle rising, sample falling