12#ifndef ZEPHYR_INCLUDE_DRIVERS_DAI_H_
13#define ZEPHYR_INCLUDE_DRIVERS_DAI_H_
253__subsystem
struct dai_driver_api {
254 int (*probe)(
const struct device *dev);
255 int (*remove)(
const struct device *dev);
257 const void *bespoke_cfg);
293 const struct dai_driver_api *api = (
const struct dai_driver_api *)dev->
api;
295 return api->probe(dev);
310 const struct dai_driver_api *api = (
const struct dai_driver_api *)dev->
api;
312 return api->remove(dev);
337 const void *bespoke_cfg)
339 const struct dai_driver_api *api = (
const struct dai_driver_api *)dev->
api;
341 return api->config_set(dev, cfg, bespoke_cfg);
356 const struct dai_driver_api *api = (
const struct dai_driver_api *)dev->
api;
358 return api->config_get(dev, cfg, dir);
375 const struct dai_driver_api *api = (
const struct dai_driver_api *)dev->
api;
377 return api->get_properties(dev, dir, stream_id);
401 const struct dai_driver_api *api = (
const struct dai_driver_api *)dev->
api;
403 return api->trigger(dev, dir,
cmd);
417 const struct dai_driver_api *api = (
const struct dai_driver_api *)dev->
api;
422 return api->ts_config(dev, cfg);
436 const struct dai_driver_api *api = (
const struct dai_driver_api *)dev->
api;
441 return api->ts_start(dev, cfg);
455 const struct dai_driver_api *api = (
const struct dai_driver_api *)dev->
api;
460 return api->ts_stop(dev, cfg);
476 const struct dai_driver_api *api = (
const struct dai_driver_api *)dev->
api;
481 return api->ts_get(dev, cfg, tsd);
static int dai_config_set(const struct device *dev, const struct dai_config *cfg, const void *bespoke_cfg)
Configure operation of a DAI driver.
Definition: dai.h:335
dai_state
Interface state.
Definition: dai.h:76
static int dai_ts_start(const struct device *dev, struct dai_ts_cfg *cfg)
Starts timestamping.
Definition: dai.h:434
static int dai_probe(const struct device *dev)
Probe operation of DAI driver.
Definition: dai.h:291
static int dai_remove(const struct device *dev)
Remove operation of DAI driver.
Definition: dai.h:308
static int dai_ts_stop(const struct device *dev, struct dai_ts_cfg *cfg)
Stops timestamping.
Definition: dai.h:453
static int dai_config_get(const struct device *dev, struct dai_config *cfg, enum dai_dir dir)
Fetch configuration information of a DAI driver.
Definition: dai.h:352
static int dai_trigger(const struct device *dev, enum dai_dir dir, enum dai_trigger_cmd cmd)
Send a trigger command.
Definition: dai.h:397
static int dai_ts_config(const struct device *dev, struct dai_ts_cfg *cfg)
Configures timestamping in attached DAI.
Definition: dai.h:415
static const struct dai_properties * dai_get_properties(const struct device *dev, enum dai_dir dir, int stream_id)
Fetch properties of a DAI driver.
Definition: dai.h:371
dai_type
Types of DAI.
Definition: dai.h:45
dai_trigger_cmd
Trigger command.
Definition: dai.h:99
static int dai_ts_get(const struct device *dev, struct dai_ts_cfg *cfg, struct dai_ts_data *tsd)
Gets timestamp.
Definition: dai.h:473
dai_dir
DAI Direction.
Definition: dai.h:66
@ DAI_STATE_READY
The interface is ready to receive / transmit data.
Definition: dai.h:85
@ DAI_STATE_PRE_RUNNING
The interface is clocking but not receiving / transmitting data.
Definition: dai.h:89
@ DAI_STATE_ERROR
TX buffer underrun or RX buffer overrun has occurred.
Definition: dai.h:95
@ DAI_STATE_NOT_READY
The interface is not ready.
Definition: dai.h:83
@ DAI_STATE_RUNNING
The interface is receiving / transmitting data.
Definition: dai.h:87
@ DAI_STATE_STOPPING
The interface is draining its transmit queue.
Definition: dai.h:93
@ DAI_STATE_PAUSED
The interface paused.
Definition: dai.h:91
@ DAI_INTEL_ALH
Intel ALH.
Definition: dai.h:50
@ DAI_INTEL_HDA
Intel HD/A.
Definition: dai.h:49
@ DAI_LEGACY_I2S
Legacy I2S compatible with i2s.h.
Definition: dai.h:46
@ DAI_INTEL_ALH_NHLT
nhlt Intel ALH
Definition: dai.h:60
@ DAI_INTEL_DMIC
Intel DMIC.
Definition: dai.h:48
@ DAI_AMD_DMIC
Amd DMIC.
Definition: dai.h:55
@ DAI_INTEL_DMIC_NHLT
nhlt ssp
Definition: dai.h:58
@ DAI_AMD_BT
Amd BT.
Definition: dai.h:53
@ DAI_IMX_ESAI
i.MX ESAI
Definition: dai.h:52
@ DAI_INTEL_SSP_NHLT
nhlt ssp
Definition: dai.h:57
@ DAI_INTEL_SSP
Intel SSP.
Definition: dai.h:47
@ DAI_IMX_SAI
i.MX SAI
Definition: dai.h:51
@ DAI_AMD_SP
Amd SP.
Definition: dai.h:54
@ DAI_MEDIATEK_AFE
Mtk AFE.
Definition: dai.h:56
@ DAI_INTEL_HDA_NHLT
nhlt Intel HD/A
Definition: dai.h:59
@ DAI_TRIGGER_DRAIN
Empty the transmit queue.
Definition: dai.h:145
@ DAI_TRIGGER_DROP
Discard the transmit / receive queue.
Definition: dai.h:152
@ DAI_TRIGGER_STOP
Stop the transmission / reception of data.
Definition: dai.h:122
@ DAI_TRIGGER_COPY
Copy.
Definition: dai.h:169
@ DAI_TRIGGER_START
Start the transmission / reception of data.
Definition: dai.h:106
@ DAI_TRIGGER_PRE_START
Optional - Pre Start the transmission / reception of data.
Definition: dai.h:112
@ DAI_TRIGGER_POST_STOP
Optional - Post Stop the transmission / reception of data.
Definition: dai.h:136
@ DAI_TRIGGER_PREPARE
Prepare the queues after underrun/overrun error has occurred.
Definition: dai.h:158
@ DAI_TRIGGER_PAUSE
Pause the transmission / reception of data.
Definition: dai.h:130
@ DAI_TRIGGER_RESET
Reset.
Definition: dai.h:164
@ DAI_DIR_RX
Receive data.
Definition: dai.h:68
@ DAI_DIR_BOTH
Both receive and transmit data.
Definition: dai.h:72
@ DAI_DIR_TX
Transmit data.
Definition: dai.h:70
static void cmd(uint32_t command)
Execute a display list command by co-processor engine.
Definition: ft8xx_reference_api.h:153
#define EINVAL
Invalid argument.
Definition: errno.h:61
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT64_TYPE__ uint64_t
Definition: stdint.h:91
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Main DAI config structure.
Definition: dai.h:195
uint32_t rate
Frame clock (WS) frequency, sampling rate.
Definition: dai.h:203
uint16_t format
DAI specific data stream format.
Definition: dai.h:205
uint8_t channels
Number of audio channels, words in frame.
Definition: dai.h:201
uint8_t options
DAI specific configuration options.
Definition: dai.h:207
enum dai_type type
Type of the DAI.
Definition: dai.h:197
uint32_t dai_index
Index of the DAI.
Definition: dai.h:199
size_t block_size
Size of one RX/TX memory block (buffer) in bytes.
Definition: dai.h:211
uint16_t link_config
DAI specific link configuration.
Definition: dai.h:213
uint8_t word_size
Number of bits representing one data word.
Definition: dai.h:209
DAI properties.
Definition: dai.h:178
uint32_t dma_hs_id
DMA handshake id.
Definition: dai.h:184
uint32_t reg_init_delay
Delay for initializing registers.
Definition: dai.h:186
uint32_t fifo_address
Fifo hw address for e.g.
Definition: dai.h:180
uint32_t fifo_depth
Fifo depth.
Definition: dai.h:182
int stream_id
Stream ID.
Definition: dai.h:188
DAI timestamp configuration.
Definition: dai.h:219
int type
Type of the DAI (SSP, DMIC, HDA, etc.).
Definition: dai.h:223
int dma_chan_count
Number of channels in single DMA.
Definition: dai.h:233
int dma_chan_index
Used DMA channel index.
Definition: dai.h:231
int dma_id
DMA instance id.
Definition: dai.h:229
uint32_t walclk_rate
Rate in Hz, e.g.
Definition: dai.h:221
int direction
Direction (playback/capture)
Definition: dai.h:225
int index
Index for SSPx to select correct timestamp register.
Definition: dai.h:227
DAI timestamp data.
Definition: dai.h:239
uint64_t walclk
Wall clock.
Definition: dai.h:241
uint64_t sample
Sample count.
Definition: dai.h:243
uint32_t walclk_rate
Rate in Hz, e.g.
Definition: dai.h:245
Runtime device structure (in ROM) per driver instance.
Definition: device.h:381
const void * api
Address of the API structure exposed by the device instance.
Definition: device.h:387