Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
dai.h File Reference

Public APIs for the DAI (Digital Audio Interface) bus drivers. More...

#include <errno.h>
#include <zephyr/types.h>
#include <zephyr/device.h>

Go to the source code of this file.

Data Structures

struct  dai_properties
 DAI properties. More...
 
struct  dai_config
 Main DAI config structure. More...
 
struct  dai_ts_cfg
 DAI timestamp configuration. More...
 
struct  dai_ts_data
 DAI timestamp data. More...
 

Macros

#define DAI_FORMAT_CLOCK_PROVIDER_MASK   0xf000
 Used to extract the clock configuration from the format attribute of struct dai_config.
 
#define DAI_FORMAT_PROTOCOL_MASK   0x000f
 Used to extract the protocol from the format attribute of struct dai_config.
 
#define DAI_FORMAT_CLOCK_INVERSION_MASK   0x0f00
 Used to extract the clock inversion from the format attribute of struct dai_config.
 

Enumerations

enum  dai_clock_provider { DAI_CBP_CFP = (0 << 12) , DAI_CBC_CFP = (2 << 12) , DAI_CBP_CFC = (3 << 12) , DAI_CBC_CFC = (4 << 12) }
 DAI clock configurations. More...
 
enum  dai_protocol {
  DAI_PROTO_I2S = 1 , DAI_PROTO_RIGHT_J , DAI_PROTO_LEFT_J , DAI_PROTO_DSP_A ,
  DAI_PROTO_DSP_B , DAI_PROTO_PDM
}
 DAI protocol. More...
 
enum  dai_clock_inversion { DAI_INVERSION_NB_NF = 0 , DAI_INVERSION_NB_IF = (2 << 8) , DAI_INVERSION_IB_NF = (3 << 8) , DAI_INVERSION_IB_IF = (4 << 8) }
 DAI clock inversion. More...
 
enum  dai_type {
  DAI_LEGACY_I2S = 0 , DAI_INTEL_SSP , DAI_INTEL_DMIC , DAI_INTEL_HDA ,
  DAI_INTEL_ALH , DAI_IMX_SAI , DAI_IMX_ESAI , DAI_AMD_BT ,
  DAI_AMD_SP , DAI_AMD_DMIC , DAI_MEDIATEK_AFE , DAI_INTEL_SSP_NHLT ,
  DAI_INTEL_DMIC_NHLT , DAI_INTEL_HDA_NHLT , DAI_INTEL_ALH_NHLT
}
 Types of DAI. More...
 
enum  dai_dir { DAI_DIR_TX = 0 , DAI_DIR_RX , DAI_DIR_BOTH }
 DAI Direction. More...
 
enum  dai_state {
  DAI_STATE_NOT_READY = 0 , DAI_STATE_READY , DAI_STATE_RUNNING , DAI_STATE_PRE_RUNNING ,
  DAI_STATE_PAUSED , DAI_STATE_STOPPING , DAI_STATE_ERROR
}
 Interface state. More...
 
enum  dai_trigger_cmd {
  DAI_TRIGGER_START = 0 , DAI_TRIGGER_PRE_START , DAI_TRIGGER_STOP , DAI_TRIGGER_PAUSE ,
  DAI_TRIGGER_POST_STOP , DAI_TRIGGER_DRAIN , DAI_TRIGGER_DROP , DAI_TRIGGER_PREPARE ,
  DAI_TRIGGER_RESET , DAI_TRIGGER_COPY
}
 Trigger command. More...
 

Functions

static int dai_probe (const struct device *dev)
 Probe operation of DAI driver.
 
static int dai_remove (const struct device *dev)
 Remove operation of DAI driver.
 
static int dai_config_set (const struct device *dev, const struct dai_config *cfg, const void *bespoke_cfg)
 Configure operation of a DAI driver.
 
static int dai_config_get (const struct device *dev, struct dai_config *cfg, enum dai_dir dir)
 Fetch configuration information of a DAI driver.
 
static const struct dai_propertiesdai_get_properties (const struct device *dev, enum dai_dir dir, int stream_id)
 Fetch properties of a DAI driver.
 
static int dai_trigger (const struct device *dev, enum dai_dir dir, enum dai_trigger_cmd cmd)
 Send a trigger command.
 
static int dai_ts_config (const struct device *dev, struct dai_ts_cfg *cfg)
 Configures timestamping in attached DAI.
 
static int dai_ts_start (const struct device *dev, struct dai_ts_cfg *cfg)
 Starts timestamping.
 
static int dai_ts_stop (const struct device *dev, struct dai_ts_cfg *cfg)
 Stops timestamping.
 
static int dai_ts_get (const struct device *dev, struct dai_ts_cfg *cfg, struct dai_ts_data *tsd)
 Gets timestamp.
 
static int dai_config_update (const struct device *dev, const void *bespoke_cfg, size_t size)
 Update DAI configuration at runtime.
 

Detailed Description

Public APIs for the DAI (Digital Audio Interface) bus drivers.