Audio DMIC¶
Overview¶
The audio DMIC interface provides access to digital microphones.
API Reference¶
-
group
audio_dmic_interface
Abstraction for digital microphones.
Enums
-
enum
dmic_state
¶ DMIC driver states
Values:
-
enumerator
DMIC_STATE_UNINIT
¶
-
enumerator
DMIC_STATE_INITIALIZED
¶
-
enumerator
DMIC_STATE_CONFIGURED
¶
-
enumerator
DMIC_STATE_ACTIVE
¶
-
enumerator
DMIC_STATE_PAUSED
¶
-
enumerator
Functions
-
static inline 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
Returns the map of PDM controller and LEFT/RIGHT channel shifted to the bit position corresponding to the input logical channel value
- Return
Bit-map containing the PDM and L/R channel information
- Parameters
channel
: The logical channel numberpdm
: The PDM hardware controller numberlr
: LEFT/RIGHT channel within the chosen PDM hardware controller
-
static inline 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
Returns the PDM controller and LEFT/RIGHT channel corresponding to the channel map and the logical channel provided as input
- Return
none
- Parameters
channel_map_lo
: Lower order/significant bits of the channel mapchannel_map_hi
: Higher order/significant bits of the channel mapchannel
: The logical channel numberpdm
: Pointer to the PDM hardware controller numberlr
: Pointer to the LEFT/RIGHT channel within the PDM controller
-
static inline 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
Returns the bit-map of clock skew value shifted to the bit position corresponding to the input PDM controller value
- Return
Bit-map containing the clock skew information
- Parameters
pdm
: The PDM hardware controller numberskew
: The skew to apply for the clock output from the PDM controller
-
static inline int
dmic_configure
(const struct device *dev, struct dmic_cfg *cfg)¶ Configure the DMIC driver and controller(s)
Configures the DMIC driver device according to the number of channels, channel mapping, PDM I/O configuration, PCM stream configuration, etc.
- Return
0 on success, a negative error code on failure
- Parameters
dev
: Pointer to the device structure for DMIC driver instancecfg
: Pointer to the structure containing the DMIC configuration
-
static inline int
dmic_trigger
(const struct device *dev, enum dmic_trigger cmd) Send a command to the DMIC driver
Sends a command to the driver to perform a specific action
- Return
0 on success, a negative error code on failure
- Parameters
dev
: Pointer to the device structure for DMIC driver instancecmd
: The command to be sent to the driver instance
-
static inline int
dmic_read
(const struct device *dev, uint8_t stream, void **buffer, size_t *size, int32_t timeout)¶ Read received decimated PCM data stream
Optionally waits for audio to be received and provides the received audio buffer from the requested stream
- Return
0 on success, a negative error code on failure
- Parameters
dev
: Pointer to the device structure for DMIC driver instancestream
: Stream identifierbuffer
: Pointer to the received buffer addresssize
: Pointer to the received buffer sizetimeout
: Timeout in milliseconds to wait in case audio is not yet received, or SYS_FOREVER_MS
-
struct
pdm_io_cfg
¶ - #include <dmic.h>
PDM Input/Output signal configuration
-
struct
pcm_stream_cfg
¶ - #include <dmic.h>
Configuration of the PCM streams to be output by the PDM hardware
-
struct
pdm_chan_cfg
¶ - #include <dmic.h>
Mapping/ordering of the PDM channels to logical PCM output channel
-
struct
dmic_cfg
¶ - #include <dmic.h>
Input configuration structure for the DMIC configuration API
-
enum