![]() |
RAFW Flexible Software Package Documentation
Release v2.0.1
|
|
Interface for DMIC audio communication.
The DMIC (Digital Microphone) interface provides APIs and definitions for DMIC audio communication.
Data Structures | |
| struct | dmic_callback_args_t |
| struct | dmic_status_t |
| struct | dmic_cfg_t |
| struct | dmic_api_t |
| struct | dmic_instance_t |
Typedefs | |
| typedef void | dmic_ctrl_t |
Enumerations | |
| enum | dmic_direction_t |
| enum | dmic_mode_t |
| enum | dmic_delay_t |
| enum | dmic_event_t |
| enum | dmic_mute_t |
| enum | dmic_state_t |
| struct dmic_callback_args_t |
Callback function parameter data
| Data Fields | ||
|---|---|---|
| void const * | p_context |
Placeholder for user data. Set in dmic_api_t::open function in dmic_cfg_t. |
| dmic_event_t | event | The event can be used to identify what caused the callback (overflow or error). |
| struct dmic_status_t |
DMIC status.
| Data Fields | ||
|---|---|---|
| dmic_state_t | state | Current DMIC state. |
| struct dmic_cfg_t |
User configuration structure, used in open function
Data Fields | |
| uint32_t | channel |
| dmic_direction_t | direction |
| DMIC direction. | |
| dmic_mode_t | mode |
| DMIC operation mode. | |
| dmic_delay_t | delay |
| DMIC internal delay. | |
| bool | swap_channel |
| DMIC L/R channel swap. | |
| uint32_t | clk_frequency |
| DMIC clock. | |
| transfer_instance_t const * | p_transfer_rx |
| void(* | p_callback )(dmic_callback_args_t *p_args) |
| void const * | p_context |
| void const * | p_extend |
| Extension parameter for hardware specific settings. | |
| uint8_t | rxi_ipl |
| Receive interrupt priority. | |
| uint8_t | idle_err_ipl |
| Idle/Error interrupt priority. | |
| IRQn_Type | rxi_irq |
| Receive IRQ number. | |
| IRQn_Type | int_irq |
| Idle/Error IRQ number. | |
| uint32_t dmic_cfg_t::channel |
Select a channel corresponding to the channel number of the hardware.
| transfer_instance_t const* dmic_cfg_t::p_transfer_rx |
To use DMA for receiving link a Transfer instance here. Set to NULL if unused.
| void(* dmic_cfg_t::p_callback) (dmic_callback_args_t *p_args) |
Callback provided when an DMIC ISR occurs. Set to NULL for no CPU interrupt.
| void const* dmic_cfg_t::p_context |
Placeholder for user data. Passed to the user callback in dmic_callback_args_t.
| struct dmic_api_t |
DMIC functions implemented at the HAL layer will follow this API.
Data Fields | |
| fsp_err_t(* | open )(dmic_ctrl_t *const p_ctrl, dmic_cfg_t const *const p_cfg) |
| fsp_err_t(* | stop )(dmic_ctrl_t *const p_ctrl) |
| fsp_err_t(* | mute )(dmic_ctrl_t *const p_ctrl, dmic_mute_t const mute_enable) |
| fsp_err_t(* | write )(dmic_ctrl_t *const p_ctrl, void const *const p_src, uint32_t const bytes) |
| fsp_err_t(* | read )(dmic_ctrl_t *const p_ctrl, void *const p_dest, uint32_t const bytes) |
| fsp_err_t(* | writeRead )(dmic_ctrl_t *const p_ctrl, void const *const p_src, void *const p_dest, uint32_t const bytes) |
| fsp_err_t(* | statusGet )(dmic_ctrl_t *const p_ctrl, dmic_status_t *const p_status) |
| fsp_err_t(* | close )(dmic_ctrl_t *const p_ctrl) |
| fsp_err_t(* | callbackSet )(dmic_ctrl_t *const p_ctrl, void(*p_callback)(dmic_callback_args_t *), void const *const p_context, dmic_callback_args_t *const p_callback_memory) |
| fsp_err_t(* dmic_api_t::open) (dmic_ctrl_t *const p_ctrl, dmic_cfg_t const *const p_cfg) |
Initial configuration.
| [in] | p_ctrl | Pointer to control block. Must be declared by user. Elements set here. |
| [in] | p_cfg | Pointer to configuration structure. All elements of this structure must be set by user. |
| fsp_err_t(* dmic_api_t::stop) (dmic_ctrl_t *const p_ctrl) |
Stop communication. Communication is stopped when callback is called with DMIC_EVENT_IDLE.
| [in] | p_ctrl | Control block set in dmic_api_t::open call for this instance. |
| fsp_err_t(* dmic_api_t::mute) (dmic_ctrl_t *const p_ctrl, dmic_mute_t const mute_enable) |
Enable or disable mute.
| [in] | p_ctrl | Control block set in dmic_api_t::open call for this instance. |
| [in] | mute_enable | Whether to enable or disable mute. |
| fsp_err_t(* dmic_api_t::write) (dmic_ctrl_t *const p_ctrl, void const *const p_src, uint32_t const bytes) |
Write DMIC data. All transmit data is queued when callback is called with DMIC_EVENT_TX_EMPTY. Transmission is complete when callback is called with DMIC_EVENT_IDLE.
| [in] | p_ctrl | Control block set in dmic_api_t::open call for this instance. |
| [in] | p_src | Buffer of PCM samples. Must be 4 byte aligned. |
| [in] | bytes | Number of bytes in the buffer. Recommended requesting a multiple of 8 bytes. If not a multiple of 8, padding 0s will be added to transmission to make it a multiple of 8. |
| fsp_err_t(* dmic_api_t::read) (dmic_ctrl_t *const p_ctrl, void *const p_dest, uint32_t const bytes) |
Read DMIC data. Reception is complete when callback is called with DMIC_EVENT_RX_EMPTY.
| [in] | p_ctrl | Control block set in dmic_api_t::open call for this instance. |
| [in] | p_dest | Buffer to store PCM samples. Must be 4 byte aligned. |
| [in] | bytes | Number of bytes in the buffer. Recommended requesting a multiple of 8 bytes. If not a multiple of 8, receive will stop at the multiple of 8 below requested bytes. |
| fsp_err_t(* dmic_api_t::writeRead) (dmic_ctrl_t *const p_ctrl, void const *const p_src, void *const p_dest, uint32_t const bytes) |
Simultaneously write and read DMIC data. Transmission and reception are complete when callback is called with DMIC_EVENT_IDLE.
| [in] | p_ctrl | Control block set in dmic_api_t::open call for this instance. |
| [in] | p_src | Buffer of PCM samples. Must be 4 byte aligned. |
| [in] | p_dest | Buffer to store PCM samples. Must be 4 byte aligned. |
| [in] | bytes | Number of bytes in the buffers. Recommended requesting a multiple of 8 bytes. If not a multiple of 8, padding 0s will be added to transmission to make it a multiple of 8, and receive will stop at the multiple of 8 below requested bytes. |
| fsp_err_t(* dmic_api_t::statusGet) (dmic_ctrl_t *const p_ctrl, dmic_status_t *const p_status) |
Get current status and store it in provided pointer p_status.
| [in] | p_ctrl | Control block set in dmic_api_t::open call for this instance. |
| [out] | p_status | Current status of the driver. |
| fsp_err_t(* dmic_api_t::close) (dmic_ctrl_t *const p_ctrl) |
Allows driver to be reconfigured and may reduce power consumption.
| [in] | p_ctrl | Control block set in dmic_api_t::open call for this instance. |
| fsp_err_t(* dmic_api_t::callbackSet) (dmic_ctrl_t *const p_ctrl, void(*p_callback)(dmic_callback_args_t *), void const *const p_context, dmic_callback_args_t *const p_callback_memory) |
Specify callback function and optional context pointer and working memory pointer.
| [in] | p_ctrl | Pointer to the DMIC control block. |
| [in] | p_callback | Callback function |
| [in] | p_context | Pointer to send to callback function |
| [in] | p_working_memory | Pointer to volatile memory where callback structure can be allocated. Callback arguments allocated here are only valid during the callback. |
| struct dmic_instance_t |
This structure encompasses everything that is needed to use an instance of this interface.
| Data Fields | ||
|---|---|---|
| dmic_ctrl_t * | p_ctrl | Pointer to the control structure for this instance. |
| dmic_cfg_t const * | p_cfg | Pointer to the configuration structure for this instance. |
| dmic_api_t const * | p_api | Pointer to the API structure for this instance. |
| typedef void dmic_ctrl_t |
DMIC control block. Allocate an instance specific control block to pass into the DMIC API calls.
| enum dmic_direction_t |
| enum dmic_mode_t |
| enum dmic_delay_t |
| enum dmic_event_t |
| enum dmic_mute_t |
| enum dmic_state_t |
Possible status values returned by dmic_api_t::statusGet.
| Enumerator | |
|---|---|
| DMIC_STATE_IN_USE | DMIC is in use. |
| DMIC_STATE_STOPPED | DMIC is stopped. |