![]() |
RAFW Flexible Software Package Documentation
Release v2.0.1
|
|
Functions | |
| fsp_err_t | R_DMIC_W_Open (dmic_ctrl_t *const p_ctrl, dmic_cfg_t const *const p_cfg) |
| fsp_err_t | R_DMIC_W_Write (dmic_ctrl_t *const p_ctrl, void const *const p_src, uint32_t const bytes) |
| fsp_err_t | R_DMIC_W_Read (dmic_ctrl_t *const p_ctrl, void *const p_dest, uint32_t const bytes) |
| fsp_err_t | R_DMIC_W_WriteRead (dmic_ctrl_t *const p_ctrl, void const *const p_src, void *const p_dest, uint32_t const bytes) |
| fsp_err_t | R_DMIC_W_Stop (dmic_ctrl_t *const p_ctrl) |
| fsp_err_t | R_DMIC_W_Mute (dmic_ctrl_t *const p_ctrl, dmic_mute_t const mute_enable) |
| fsp_err_t | R_DMIC_W_StatusGet (dmic_ctrl_t *const p_ctrl, dmic_status_t *const p_status) |
| fsp_err_t | R_DMIC_W_Close (dmic_ctrl_t *const p_ctrl) |
| fsp_err_t | R_DMIC_W_CallbackSet (dmic_ctrl_t *const p_api_ctrl, void(*p_callback)(dmic_callback_args_t *), void const *const p_context, dmic_callback_args_t *const p_callback_memory) |
Driver for the DMIC peripheral on RAFW MCUs. This module implements the DMIC Interface.
The DMIC module supports the following features:
| Configuration | Options | Default | Description |
|---|---|---|---|
| Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
| Configuration | Options | Default | Description |
|---|---|---|---|
| Name | Name must be a valid C symbol | g_dmic0 | Module name. |
| Clock[Hz] (available only in Master mode) | Value must be a non-negative integer | 3072000 | Specify the DMIC clock in Hz. |
| Operating Mode (Master/Slave) |
| Master Mode | Select if the MCU is DMIC master or slave. |
| Data Directioon (Input/Output) |
| INPUT | Select DMIC data direction. |
| Swap Channel (Enable/Disable) |
| Enable | Swap channel enable |
| DMIC internal delay |
| 0ns | Select DMIC data delay. |
| Receive Interrupt Priority | MCU Specific Options | Select the receive interrupt priority. | |
| Callback | Name must be a valid C symbol | g_dmic0_callback | A user callback function must be provided. This will be called from the interrupt service routine (ISR) upon DMIC transaction completion reporting the transaction status. |
The DMIC peripheral runs on FPLLCLK. The FPLLCLK frequency can be configured on the Clocks tab of the RAFW Configuration editor. The DMIC audio clock can optionally be supplied from an external source through the DMIC_CLK pin in slave mode.
The DMIC uses the following pins:
A DMIC interface has 2 channels (Left/Right) of data.
PDM(Pulse Density Modulation) data is supported.
The audio clock is only required for master mode.
768,000 <= DMIC clock (Hz) <= 4096000
The audio clock source can come from:
This is an example of the DMIC-I2S loopback in an application.
Data Structures | |
| struct | dmic_instance_ctrl_t |
| struct | dmic_extended_cfg_t |
Enumerations | |
| enum | dmic_audio_clock_t |
| struct dmic_instance_ctrl_t |
Channel instance control block. DO NOT INITIALIZE. Initialization occurs when dmic_api_t::open is called.
| struct dmic_extended_cfg_t |
I2S configuration extension. This extension is optional.
| Data Fields | ||
|---|---|---|
| dmic_audio_clock_t | audio_clock | Audio clock source, default is I2S_W_AUDIO_CLOCK_CRYSTAL. |
| enum dmic_audio_clock_t |
| fsp_err_t R_DMIC_W_Open | ( | dmic_ctrl_t *const | p_ctrl, |
| dmic_cfg_t const *const | p_cfg | ||
| ) |
Opens the DMIC. Implements dmic_api_t::open.
This function sets this clock divisor and the configurations specified in dmic_cfg_t. It also opens the timer and transfer instances if they are provided.
| FSP_SUCCESS | Ready for DMIC communication. |
| FSP_ERR_ASSERTION | The pointer to p_ctrl or p_cfg is null. |
| FSP_ERR_ALREADY_OPEN | The control block has already been opened. |
| FSP_ERR_IP_CHANNEL_NOT_PRESENT | Channel number is not available on this MCU. |
| fsp_err_t R_DMIC_W_Write | ( | dmic_ctrl_t *const | p_ctrl, |
| void const *const | p_src, | ||
| uint32_t const | bytes | ||
| ) |
Writes data buffer to DMIC. Implements dmic_api_t::write.
This function resets the transfer if the transfer interface is used, or writes the length of data that fits in the FIFO then stores the remaining write buffer in the control block to be written in the ISR.
Write() cannot be called if another write(), read() or writeRead() operation is in progress. Write can be called when the DMIC is idle, or after the DMIC_EVENT_TX_EMPTY event.
| FSP_SUCCESS | Write initiated successfully. |
| FSP_ERR_ASSERTION | The pointer to p_ctrl or p_src was null, or bytes requested was 0. |
| FSP_ERR_IN_USE | Another transfer is in progress, data was not written. |
| FSP_ERR_NOT_OPEN | The channel is not opened. |
| FSP_ERR_UNDERFLOW | A transmit underflow error is pending. Wait for the DMIC to go idle before resuming communication. |
| fsp_err_t R_DMIC_W_Read | ( | dmic_ctrl_t *const | p_ctrl, |
| void *const | p_dest, | ||
| uint32_t const | bytes | ||
| ) |
Reads data into provided buffer. Implements dmic_api_t::read.
This function resets the transfer if the transfer interface is used, or reads the length of data available in the FIFO then stores the remaining read buffer in the control block to be filled in the ISR.
Read() cannot be called if another write(), read() or writeRead() operation is in progress. Read can be called when the DMIC is idle, or after the DMIC_EVENT_RX_FULL event.
| FSP_SUCCESS | Read initiated successfully. |
| FSP_ERR_IN_USE | Peripheral is in the wrong mode or not idle. |
| FSP_ERR_ASSERTION | The pointer to p_ctrl or p_dest was null, or bytes requested was 0. |
| FSP_ERR_NOT_OPEN | The channel is not opened. |
| FSP_ERR_OVERFLOW | A receive overflow error is pending. Wait for the DMIC to go idle before resuming communication. |
| fsp_err_t R_DMIC_W_WriteRead | ( | dmic_ctrl_t *const | p_ctrl, |
| void const *const | p_src, | ||
| void *const | p_dest, | ||
| uint32_t const | bytes | ||
| ) |
Writes from source buffer and reads data into destination buffer. Implements dmic_api_t::writeRead.
writeRead() cannot be called if another write(), read() or writeRead() operation is in progress. writeRead() can be called when the DMIC is idle, or after the DMIC_EVENT_RX_FULL event.
| FSP_SUCCESS | Write and read initiated successfully. |
| FSP_ERR_IN_USE | Peripheral is in the wrong mode or not idle. |
| FSP_ERR_ASSERTION | An input parameter was invalid. |
| FSP_ERR_NOT_OPEN | The channel is not opened. |
| FSP_ERR_UNDERFLOW | A transmit underflow error is pending. Wait for the DMIC to go idle before resuming communication. |
| FSP_ERR_OVERFLOW | A receive overflow error is pending. Wait for the DMIC to go idle before resuming communication. |
| fsp_err_t R_DMIC_W_Stop | ( | dmic_ctrl_t *const | p_ctrl | ) |
Stops DMIC. Implements dmic_api_t::stop.
This function disables both transmission and reception, and disables any transfer instances used.
The DMIC will stop on the next frame boundary. Do not restart DMIC until it is idle.
| FSP_SUCCESS | DMIC communication stop request issued. |
| FSP_ERR_ASSERTION | The pointer to p_ctrl was null. |
| FSP_ERR_NOT_OPEN | The channel is not opened. |
| fsp_err_t R_DMIC_W_Mute | ( | dmic_ctrl_t *const | p_ctrl, |
| dmic_mute_t const | mute_enable | ||
| ) |
Mutes DMIC on the next frame boundary. Implements dmic_api_t::mute.
Data is still written while mute is enabled, but the transmit line outputs zeros.
| FSP_SUCCESS | Transmission is muted. |
| FSP_ERR_ASSERTION | The pointer to p_ctrl was null. |
| FSP_ERR_NOT_OPEN | The channel is not opened. |
| fsp_err_t R_DMIC_W_StatusGet | ( | dmic_ctrl_t *const | p_ctrl, |
| dmic_status_t *const | p_status | ||
| ) |
Gets DMIC status and stores it in provided pointer p_status. Implements dmic_api_t::statusGet.
| FSP_SUCCESS | Information stored successfully. |
| FSP_ERR_ASSERTION | The p_instance_ctrl or p_status parameter was null. |
| FSP_ERR_NOT_OPEN | The channel is not opened. |
| fsp_err_t R_DMIC_W_Close | ( | dmic_ctrl_t *const | p_ctrl | ) |
Closes DMIC. Implements dmic_api_t::close.
This function powers down the DMIC and closes the lower level timer and transfer drivers if they are used.
| FSP_SUCCESS | Device closed successfully. |
| FSP_ERR_ASSERTION | The pointer to p_ctrl was null. |
| FSP_ERR_NOT_OPEN | The channel is not opened. |
| fsp_err_t R_DMIC_W_CallbackSet | ( | dmic_ctrl_t *const | p_api_ctrl, |
| void(*)(dmic_callback_args_t *) | p_callback, | ||
| void const *const | p_context, | ||
| dmic_callback_args_t *const | p_callback_memory | ||
| ) |
Updates the user callback and has option of providing memory for callback structure. Implements dmic_api_t::callbackSet
| FSP_SUCCESS | Callback updated successfully. |
| FSP_ERR_ASSERTION | A required pointer is NULL. |
| FSP_ERR_NOT_OPEN | The control block has not been opened. |
| FSP_ERR_NO_CALLBACK_MEMORY | p_callback is non-secure and p_callback_memory is either secure or NULL. |