17#ifndef ZEPHYR_INCLUDE_AUDIO_DMIC_H_
18#define ZEPHYR_INCLUDE_AUDIO_DMIC_H_
189 int (*configure)(
const struct device *dev,
struct dmic_cfg *config);
191 int (*read)(
const struct device *dev,
uint8_t stream,
void **buffer,
192 size_t *size,
int32_t timeout);
210 return ((((pdm &
BIT_MASK(3)) << 1) | lr) <<
231 channel_map = (channel < 8) ? channel_map_lo : channel_map_hi;
232 channel_map >>= ((channel &
BIT_MASK(3)) * 4U);
234 *pdm = (channel >> 1) &
BIT_MASK(3);
268 const struct _dmic_ops *api =
269 (
const struct _dmic_ops *)dev->
api;
271 return api->configure(dev, cfg);
287 const struct _dmic_ops *api =
288 (
const struct _dmic_ops *)dev->
api;
290 return api->trigger(dev,
cmd);
312 const struct _dmic_ops *api =
313 (
const struct _dmic_ops *)dev->
api;
315 return api->read(dev, stream, buffer, size, timeout);
#define BIT_MASK(n)
Definition: adc.h:14
static int dmic_configure(const struct device *dev, struct dmic_cfg *cfg)
Configure the DMIC driver and controller(s)
Definition: dmic.h:265
dmic_trigger
DMIC driver trigger commands.
Definition: dmic.h:56
static uint32_t dmic_build_channel_map(uint8_t channel, uint8_t pdm, enum pdm_lr lr)
Build the channel map to populate struct pdm_chan_cfg.
Definition: dmic.h:207
static int dmic_read(const struct device *dev, uint8_t stream, void **buffer, size_t *size, int32_t timeout)
Read received decimated PCM data stream.
Definition: dmic.h:308
pdm_lr
PDM Channels LEFT / RIGHT.
Definition: dmic.h:67
static void dmic_parse_channel_map(uint32_t channel_map_lo, uint32_t channel_map_hi, uint8_t channel, uint8_t *pdm, enum pdm_lr *lr)
Helper function to parse the channel map in pdm_chan_cfg.
Definition: dmic.h:226
dmic_state
DMIC driver states.
Definition: dmic.h:45
static uint32_t dmic_build_clk_skew_map(uint8_t pdm, uint8_t skew)
Build a bit map of clock skew values for each PDM channel.
Definition: dmic.h:249
@ DMIC_TRIGGER_START
Start stream.
Definition: dmic.h:58
@ DMIC_TRIGGER_PAUSE
Pause stream.
Definition: dmic.h:59
@ DMIC_TRIGGER_RELEASE
Release paused stream.
Definition: dmic.h:60
@ DMIC_TRIGGER_RESET
Reset stream.
Definition: dmic.h:61
@ DMIC_TRIGGER_STOP
Stop stream.
Definition: dmic.h:57
@ PDM_CHAN_RIGHT
Right channel.
Definition: dmic.h:69
@ PDM_CHAN_LEFT
Left channel.
Definition: dmic.h:68
@ DMIC_STATE_PAUSED
Paused.
Definition: dmic.h:50
@ DMIC_STATE_UNINIT
Uninitialized.
Definition: dmic.h:46
@ DMIC_STATE_CONFIGURED
Configured.
Definition: dmic.h:48
@ DMIC_STATE_INITIALIZED
Initialized.
Definition: dmic.h:47
@ DMIC_STATE_ACTIVE
Active.
Definition: dmic.h:49
static void cmd(uint32_t command)
Execute a display list command by co-processor engine.
Definition: ft8xx_reference_api.h:153
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__INT32_TYPE__ int32_t
Definition: stdint.h:74
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
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
Input configuration structure for the DMIC configuration API.
Definition: dmic.h:175
struct pcm_stream_cfg * streams
Array of pcm_stream_cfg for application to provide configuration for each stream.
Definition: dmic.h:181
struct pdm_chan_cfg channel
Definition: dmic.h:182
struct pdm_io_cfg io
Definition: dmic.h:176
Configuration of the PCM streams to be output by the PDM hardware.
Definition: dmic.h:113
uint16_t block_size
PCM sample block size per transfer.
Definition: dmic.h:119
uint8_t pcm_width
PCM sample width of stream.
Definition: dmic.h:117
struct k_mem_slab * mem_slab
SLAB for DMIC driver to allocate buffers for stream.
Definition: dmic.h:121
uint32_t pcm_rate
PCM sample rate of stream.
Definition: dmic.h:115
Mapping/ordering of the PDM channels to logical PCM output channel.
Definition: dmic.h:145
uint32_t req_chan_map_lo
Channels 0 to 7.
Definition: dmic.h:150
uint32_t req_chan_map_hi
Channels 8 to 15.
Definition: dmic.h:151
uint8_t act_num_chan
Actual number of channels that the driver could configure.
Definition: dmic.h:165
uint32_t act_chan_map_lo
Channels 0 to 7.
Definition: dmic.h:158
uint8_t act_num_streams
Actual number of streams that the driver could configure.
Definition: dmic.h:169
uint32_t act_chan_map_hi
Channels 8 to 15.
Definition: dmic.h:159
uint8_t req_num_chan
Requested number of channels.
Definition: dmic.h:163
uint8_t req_num_streams
Requested number of streams for each channel.
Definition: dmic.h:167
PDM Input/Output signal configuration.
Definition: dmic.h:75
uint8_t min_pdm_clk_dc
Minimum duty cycle in % supported by the mic.
Definition: dmic.h:85
uint8_t pdm_clk_pol
Bit mask to optionally invert PDM clock.
Definition: dmic.h:97
uint32_t max_pdm_clk_freq
Maximum clock frequency supported by the mic.
Definition: dmic.h:83
uint32_t pdm_clk_skew
Collection of clock skew values for each PDM port.
Definition: dmic.h:101
uint8_t max_pdm_clk_dc
Maximum duty cycle in % supported by the mic.
Definition: dmic.h:87
uint8_t pdm_data_pol
Bit mask to optionally invert mic data.
Definition: dmic.h:99
uint32_t min_pdm_clk_freq
Minimum clock frequency supported by the mic.
Definition: dmic.h:81