DAI Drivers API

group sof_dai_drivers

DAI Drivers API specification.



If the device does not exist it will be created.


static void dai_write(struct dai *dai, uint32_t reg, uint32_t value)
static uint32_t dai_read(struct dai *dai, uint32_t reg)
static void dai_update_bits(struct dai *dai, uint32_t reg, uint32_t mask, uint32_t value)
struct dai_group *dai_group_get(uint32_t group_id, uint32_t flags)

API to request DAI group.

Returns a DAI group for the given ID and increments the counter of DAIs in the group.

If a group for the given ID doesn’t exist, it will either return NULL or allocate a new group structure if the CREATE flag is supplied.

  • [in] group_id: Group ID

  • [in] flags: Flags (CREATE)

void dai_group_put(struct dai_group *group)

API to release DAI group.

Decrements the DAI counter inside the group.

  • [in] group: Group

static int dai_init(struct sof *sof)

API to initialize a platform DAI.

  • [in] sof: Pointer to firmware main context.

struct dai *dai_get(uint32_t type, uint32_t index, uint32_t flags)

API to request a platform DAI.

  • [in] type: Type of requested DAI.

  • [in] index: Index of requested DAI.

  • [in] flags: Flags (CREATE)

void dai_put(struct dai *dai)

API to release a platform DAI.

  • [in] dai: DAI to relese.

int dai_set_config(struct dai *dai, struct ipc_config_dai *config, void *spec_config)

Digital Audio interface formatting.

int dai_get_handshake(struct dai *dai, int direction, int stream_id)

Get Digital Audio interface DMA Handshake.

int dai_get_fifo_depth(struct dai *dai, int direction)

Get Digital Audio interface fifo depth.

uint32_t dai_get_init_delay_ms(struct dai *dai)

Get DAI initial delay in milliseconds.

int dai_get_stream_id(struct dai *dai, int direction)

Get DAI stream id.

int dai_config_dma_channel(struct comp_dev *dev, void *config)

Configure DMA channel for DAI.

void dai_dma_release(struct comp_dev *dev)

Reset DAI DMA config.

int dai_config(struct comp_dev *dev, struct ipc_config_dai *common_cfg, void *spec_cfg)

Configure DAI physical interface.

int dai_assign_group(struct comp_dev *dev, uint32_t group_id)

Assign DAI to a group for simultaneous triggering.

int dai_position(struct comp_dev *dev, struct sof_ipc_stream_posn *posn)

dai position for host driver.

void dai_dma_position_update(struct comp_dev *dev)

update dai dma position for host driver.

struct dai
#include <dai-zephyr.h>

Public Members

uint32_t index
uint32_t type
uint32_t dma_caps
uint32_t dma_dev
const struct device *dev
const struct dai_data *dd
struct timestamp_cfg
#include <dai-zephyr.h>

Public Members

uint32_t walclk_rate
int type
int direction
int index
int dma_id
int dma_chan_index
int dma_chan_count
struct timestamp_data
#include <dai-zephyr.h>

Public Members

uint64_t walclk
uint64_t sample
uint32_t walclk_rate
struct timestamp_ops
#include <dai-zephyr.h>

Public Members

int (*ts_config)(struct dai *dai, struct timestamp_cfg *cfg)
int (*ts_start)(struct dai *dai, struct timestamp_cfg *cfg)
int (*ts_stop)(struct dai *dai, struct timestamp_cfg *cfg)
int (*ts_get)(struct dai *dai, struct timestamp_cfg *cfg, struct timestamp_data *tsd)
struct dai_group
#include <dai-zephyr.h>

DAI group information.

Public Members

uint32_t group_id

Group ID.

uint32_t num_dais

Number of DAIs in this group.

uint32_t trigger_counter

Number of DAIs to receive a trigger before processing begins.

int trigger_cmd

Trigger command to propagate.

int trigger_ret

Last trigger error.

struct list_item list

Group list.

struct dai_data
#include <dai-zephyr.h>

DAI runtime data.

Public Members

struct dma_chan_data *chan
uint32_t stream_id
struct dma_sg_config config
struct dma_config *z_config
struct comp_dev *dai_dev
struct comp_buffer *dma_buffer
struct comp_buffer *local_buffer
struct timestamp_cfg ts_config
struct dai *dai
struct dma *dma
struct dai_group *group
int xrun
pcm_converter_func process
uint32_t period_bytes
uint64_t total_data_processed
struct ipc_config_dai ipc_config
void *dai_spec_config
uint64_t wallclock
bool delayed_dma_stop