MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Files

file  fsl_dmic.h
 

Data Structures

struct  dmic_channel_config_t
 DMIC Channel configuration structure. More...
 

Typedefs

typedef void(* dmic_callback_t )(void)
 DMIC Callback function. More...
 
typedef void(* dmic_hwvad_callback_t )(void)
 HWVAD Callback function. More...
 

Enumerations

enum  {
  kStatus_DMIC_Busy = MAKE_STATUS(kStatusGroup_DMIC, 0),
  kStatus_DMIC_Idle = MAKE_STATUS(kStatusGroup_DMIC, 1),
  kStatus_DMIC_OverRunError = MAKE_STATUS(kStatusGroup_DMIC, 2),
  kStatus_DMIC_UnderRunError = MAKE_STATUS(kStatusGroup_DMIC, 3)
}
 _dmic_status DMIC transfer status. More...
 
enum  operation_mode_t {
  kDMIC_OperationModeInterrupt = 1U,
  kDMIC_OperationModeDma = 2U
}
 DMIC different operation modes. More...
 
enum  stereo_side_t {
  kDMIC_Left = 0U,
  kDMIC_Right = 1U
}
 DMIC left/right values. More...
 
enum  pdm_div_t {
  kDMIC_PdmDiv1 = 0U,
  kDMIC_PdmDiv2 = 1U,
  kDMIC_PdmDiv3 = 2U,
  kDMIC_PdmDiv4 = 3U,
  kDMIC_PdmDiv6 = 4U,
  kDMIC_PdmDiv8 = 5U,
  kDMIC_PdmDiv12 = 6U,
  kDMIC_PdmDiv16 = 7U,
  kDMIC_PdmDiv24 = 8U,
  kDMIC_PdmDiv32 = 9U,
  kDMIC_PdmDiv48 = 10U,
  kDMIC_PdmDiv64 = 11U,
  kDMIC_PdmDiv96 = 12U,
  kDMIC_PdmDiv128 = 13U
}
 DMIC Clock pre-divider values. More...
 
enum  compensation_t {
  kDMIC_CompValueZero = 0U,
  kDMIC_CompValueNegativePoint16 = 1U,
  kDMIC_CompValueNegativePoint15 = 2U,
  kDMIC_CompValueNegativePoint13 = 3U
}
 Pre-emphasis Filter coefficient value for 2FS and 4FS modes. More...
 
enum  dc_removal_t {
  kDMIC_DcNoRemove = 0U,
  kDMIC_DcCut155 = 1U,
  kDMIC_DcCut78 = 2U,
  kDMIC_DcCut39 = 3U
}
 DMIC DC filter control values. More...
 
enum  dmic_channel_t {
  kDMIC_Channel0 = 0U,
  kDMIC_Channel1 = 1U,
  kDMIC_Channel2 = 2U,
  kDMIC_Channel3 = 3U,
  kDMIC_Channel4 = 4U,
  kDMIC_Channel5 = 5U,
  kDMIC_Channel6 = 6U,
  kDMIC_Channel7 = 7U
}
 DMIC Channel number. More...
 
enum  {
  kDMIC_EnableChannel0 = 1 << 0U,
  kDMIC_EnableChannel1 = 1 << 1U,
  kDMIC_EnableChannel2 = 1 << 2U,
  kDMIC_EnableChannel3 = 1 << 3U,
  kDMIC_EnableChannel4 = 1 << 4U,
  kDMIC_EnableChannel5 = 1 << 5U,
  kDMIC_EnableChannel6 = 1 << 6U,
  kDMIC_EnableChannel7 = 1 << 7U
}
 _dmic_channel_mask DMIC Channel mask. More...
 
enum  dmic_phy_sample_rate_t {
  kDMIC_PhyFullSpeed = 0U,
  kDMIC_PhyHalfSpeed = 1U
}
 DMIC and decimator sample rates. More...
 

DMIC version

#define FSL_DMIC_DRIVER_VERSION   (MAKE_VERSION(2, 3, 0))
 DMIC driver version 2.3.0. More...
 

Initialization and deinitialization

uint32_t DMIC_GetInstance (DMIC_Type *base)
 Get the DMIC instance from peripheral base address. More...
 
void DMIC_Init (DMIC_Type *base)
 Turns DMIC Clock on. More...
 
void DMIC_DeInit (DMIC_Type *base)
 Turns DMIC Clock off. More...
 
void DMIC_SetOperationMode (DMIC_Type *base, operation_mode_t mode)
 Set DMIC operating mode. More...
 
void DMIC_Use2fs (DMIC_Type *base, bool use2fs)
 Configure Clock scaling. More...
 

Channel configuration

void DMIC_CfgChannelDc (DMIC_Type *base, dmic_channel_t channel, dc_removal_t dc_cut_level, uint32_t post_dc_gain_reduce, bool saturate16bit)
 Configure DMIC channel. More...
 
static void DMIC_EnableChannelSignExtend (DMIC_Type *base, dmic_channel_t channel, bool enable)
 Enbale channel sign extend which allows processing of 24bit audio data on 32bit machines. More...
 
void DMIC_ConfigChannel (DMIC_Type *base, dmic_channel_t channel, stereo_side_t side, dmic_channel_config_t *channel_config)
 Configure DMIC channel. More...
 
void DMIC_EnableChannnel (DMIC_Type *base, uint32_t channelmask)
 Enable a particualr channel. More...
 
void DMIC_FifoChannel (DMIC_Type *base, uint32_t channel, uint32_t trig_level, uint32_t enable, uint32_t resetn)
 Configure fifo settings for DMIC channel. More...
 
static void DMIC_EnableChannelInterrupt (DMIC_Type *base, dmic_channel_t channel, bool enable)
 Enable a particualr channel interrupt request. More...
 
static void DMIC_EnableChannelDma (DMIC_Type *base, dmic_channel_t channel, bool enable)
 Enable a particualr channel dma request. More...
 
static void DMIC_EnableChannelFifo (DMIC_Type *base, dmic_channel_t channel, bool enable)
 Enable a particualr channel fifo. More...
 
static void DMIC_DoFifoReset (DMIC_Type *base, dmic_channel_t channel)
 Channel fifo reset. More...
 
static uint32_t DMIC_FifoGetStatus (DMIC_Type *base, uint32_t channel)
 Get FIFO status. More...
 
static void DMIC_FifoClearStatus (DMIC_Type *base, uint32_t channel, uint32_t mask)
 Clear FIFO status. More...
 
static uint32_t DMIC_FifoGetData (DMIC_Type *base, uint32_t channel)
 Get FIFO data. More...
 
static uint32_t DMIC_FifoGetAddress (DMIC_Type *base, uint32_t channel)
 Get FIFO address. More...
 

Register callback.

void DMIC_EnableIntCallback (DMIC_Type *base, dmic_callback_t cb)
 Enable callback. More...
 
void DMIC_DisableIntCallback (DMIC_Type *base, dmic_callback_t cb)
 Disable callback. More...
 

HWVAD

static void DMIC_SetGainNoiseEstHwvad (DMIC_Type *base, uint32_t value)
 Sets the gain value for the noise estimator. More...
 
static void DMIC_SetGainSignalEstHwvad (DMIC_Type *base, uint32_t value)
 Sets the gain value for the signal estimator. More...
 
static void DMIC_SetFilterCtrlHwvad (DMIC_Type *base, uint32_t value)
 Sets the hwvad filter cutoff frequency parameter. More...
 
static void DMIC_SetInputGainHwvad (DMIC_Type *base, uint32_t value)
 Sets the input gain of hwvad. More...
 
static void DMIC_CtrlClrIntrHwvad (DMIC_Type *base, bool st10)
 Clears hwvad internal interrupt flag. More...
 
static void DMIC_FilterResetHwvad (DMIC_Type *base, bool rstt)
 Resets hwvad filters. More...
 
static uint16_t DMIC_GetNoiseEnvlpEst (DMIC_Type *base)
 Gets the value from output of the filter z7. More...
 
void DMIC_HwvadEnableIntCallback (DMIC_Type *base, dmic_hwvad_callback_t vadcb)
 Enable hwvad callback. More...
 
void DMIC_HwvadDisableIntCallback (DMIC_Type *base, dmic_hwvad_callback_t vadcb)
 Disable callback. More...
 

Detailed Description


Data Structure Documentation

struct dmic_channel_config_t

Data Fields

pdm_div_t divhfclk
 DMIC Clock pre-divider values.
 
uint32_t osr
 oversampling rate(CIC decimation rate) for PCM
 
int32_t gainshft
 4FS PCM data gain control
 
compensation_t preac2coef
 Pre-emphasis Filter coefficient value for 2FS.
 
compensation_t preac4coef
 Pre-emphasis Filter coefficient value for 4FS.
 
dc_removal_t dc_cut_level
 DMIC DC filter control values. More...
 
uint32_t post_dc_gain_reduce
 Fine gain adjustment in the form of a number of bits to downshift.
 
dmic_phy_sample_rate_t sample_rate
 DMIC and decimator sample rates.
 
bool saturate16bit
 Selects 16-bit saturation. More...
 
bool enableSignExtend
 sign extend feature which allows processing of 24bit audio data on 32bit machine
 

Field Documentation

dc_removal_t dmic_channel_config_t::dc_cut_level
bool dmic_channel_config_t::saturate16bit

0 means results roll over if out range and do not saturate. 1 means if the result overflows, it saturates at 0xFFFF for positive overflow and 0x8000 for negative overflow.

Macro Definition Documentation

#define FSL_DMIC_DRIVER_VERSION   (MAKE_VERSION(2, 3, 0))

Typedef Documentation

typedef void(* dmic_callback_t)(void)
typedef void(* dmic_hwvad_callback_t)(void)

Enumeration Type Documentation

anonymous enum
Enumerator
kStatus_DMIC_Busy 

DMIC is busy.

kStatus_DMIC_Idle 

DMIC is idle.

kStatus_DMIC_OverRunError 

DMIC over run Error.

kStatus_DMIC_UnderRunError 

DMIC under run Error.

Enumerator
kDMIC_OperationModeInterrupt 

Interrupt mode.

kDMIC_OperationModeDma 

DMA mode.

Enumerator
kDMIC_Left 

Left Stereo channel.

kDMIC_Right 

Right Stereo channel.

enum pdm_div_t
Enumerator
kDMIC_PdmDiv1 

DMIC pre-divider set in divide by 1.

kDMIC_PdmDiv2 

DMIC pre-divider set in divide by 2.

kDMIC_PdmDiv3 

DMIC pre-divider set in divide by 3.

kDMIC_PdmDiv4 

DMIC pre-divider set in divide by 4.

kDMIC_PdmDiv6 

DMIC pre-divider set in divide by 6.

kDMIC_PdmDiv8 

DMIC pre-divider set in divide by 8.

kDMIC_PdmDiv12 

DMIC pre-divider set in divide by 12.

kDMIC_PdmDiv16 

DMIC pre-divider set in divide by 16.

kDMIC_PdmDiv24 

DMIC pre-divider set in divide by 24.

kDMIC_PdmDiv32 

DMIC pre-divider set in divide by 32.

kDMIC_PdmDiv48 

DMIC pre-divider set in divide by 48.

kDMIC_PdmDiv64 

DMIC pre-divider set in divide by 64.

kDMIC_PdmDiv96 

DMIC pre-divider set in divide by 96.

kDMIC_PdmDiv128 

DMIC pre-divider set in divide by 128.

Enumerator
kDMIC_CompValueZero 

Compensation 0.

kDMIC_CompValueNegativePoint16 

Compensation -0.16.

kDMIC_CompValueNegativePoint15 

Compensation -0.15.

kDMIC_CompValueNegativePoint13 

Compensation -0.13.

Enumerator
kDMIC_DcNoRemove 

Flat response no filter.

kDMIC_DcCut155 

Cut off Frequency is 155 Hz.

kDMIC_DcCut78 

Cut off Frequency is 78 Hz.

kDMIC_DcCut39 

Cut off Frequency is 39 Hz.

Enumerator
kDMIC_Channel0 

DMIC channel 0.

kDMIC_Channel1 

DMIC channel 1.

kDMIC_Channel2 

DMIC channel 2.

kDMIC_Channel3 

DMIC channel 3.

kDMIC_Channel4 

DMIC channel 4.

kDMIC_Channel5 

DMIC channel 5.

kDMIC_Channel6 

DMIC channel 6.

kDMIC_Channel7 

DMIC channel 7.

anonymous enum
Enumerator
kDMIC_EnableChannel0 

DMIC channel 0 mask.

kDMIC_EnableChannel1 

DMIC channel 1 mask.

kDMIC_EnableChannel2 

DMIC channel 2 mask.

kDMIC_EnableChannel3 

DMIC channel 3 mask.

kDMIC_EnableChannel4 

DMIC channel 4 mask.

kDMIC_EnableChannel5 

DMIC channel 5 mask.

kDMIC_EnableChannel6 

DMIC channel 6 mask.

kDMIC_EnableChannel7 

DMIC channel 7 mask.

Enumerator
kDMIC_PhyFullSpeed 

Decimator gets one sample per each chosen clock edge of PDM interface.

kDMIC_PhyHalfSpeed 

PDM clock to Microphone is halved, decimator receives each sample twice.

Function Documentation

uint32_t DMIC_GetInstance ( DMIC_Type *  base)
Parameters
baseDMIC peripheral base address.
Returns
DMIC instance.
void DMIC_Init ( DMIC_Type *  base)
Parameters
base: DMIC base
Returns
Nothing
void DMIC_DeInit ( DMIC_Type *  base)
Parameters
base: DMIC base
Returns
Nothing
void DMIC_SetOperationMode ( DMIC_Type *  base,
operation_mode_t  mode 
)
Parameters
base: The base address of DMIC interface
mode: DMIC mode
Returns
Nothing
void DMIC_Use2fs ( DMIC_Type *  base,
bool  use2fs 
)
Parameters
base: The base address of DMIC interface
use2fs: clock scaling
Returns
Nothing
void DMIC_CfgChannelDc ( DMIC_Type *  base,
dmic_channel_t  channel,
dc_removal_t  dc_cut_level,
uint32_t  post_dc_gain_reduce,
bool  saturate16bit 
)
Parameters
base: The base address of DMIC interface
channel: DMIC channel
dc_cut_level: dc_removal_t, Cut off Frequency
post_dc_gain_reduce: Fine gain adjustment in the form of a number of bits to downshift.
saturate16bit: If selects 16-bit saturation.
static void DMIC_EnableChannelSignExtend ( DMIC_Type *  base,
dmic_channel_t  channel,
bool  enable 
)
inlinestatic
Parameters
base: The base address of DMIC interface
channel: DMIC channel
enable: true is enable sign extend, false is disable sign extend
void DMIC_ConfigChannel ( DMIC_Type *  base,
dmic_channel_t  channel,
stereo_side_t  side,
dmic_channel_config_t channel_config 
)
Parameters
base: The base address of DMIC interface
channel: DMIC channel
side: stereo_side_t, choice of left or right
channel_config: Channel configuration
Returns
Nothing
void DMIC_EnableChannnel ( DMIC_Type *  base,
uint32_t  channelmask 
)
Parameters
base: The base address of DMIC interface
channelmask,reference_dmic_channel_mask
Returns
Nothing
void DMIC_FifoChannel ( DMIC_Type *  base,
uint32_t  channel,
uint32_t  trig_level,
uint32_t  enable,
uint32_t  resetn 
)
Parameters
base: The base address of DMIC interface
channel: DMIC channel
trig_level: FIFO trigger level
enable: FIFO level
resetn: FIFO reset
Returns
Nothing
static void DMIC_EnableChannelInterrupt ( DMIC_Type *  base,
dmic_channel_t  channel,
bool  enable 
)
inlinestatic
Parameters
base: The base address of DMIC interface
channel: Channel selection
static void DMIC_EnableChannelDma ( DMIC_Type *  base,
dmic_channel_t  channel,
bool  enable 
)
inlinestatic
Parameters
base: The base address of DMIC interface
channel: Channel selection
enable: true is enable, false is disable
static void DMIC_EnableChannelFifo ( DMIC_Type *  base,
dmic_channel_t  channel,
bool  enable 
)
inlinestatic
Parameters
base: The base address of DMIC interface
channel: Channel selection
enable: true is enable, false is disable
static void DMIC_DoFifoReset ( DMIC_Type *  base,
dmic_channel_t  channel 
)
inlinestatic
Parameters
base: The base address of DMIC interface
channel: Channel selection
static uint32_t DMIC_FifoGetStatus ( DMIC_Type *  base,
uint32_t  channel 
)
inlinestatic
Parameters
base: The base address of DMIC interface
channel: DMIC channel
Returns
FIFO status
static void DMIC_FifoClearStatus ( DMIC_Type *  base,
uint32_t  channel,
uint32_t  mask 
)
inlinestatic
Parameters
base: The base address of DMIC interface
channel: DMIC channel
mask: Bits to be cleared
Returns
FIFO status
static uint32_t DMIC_FifoGetData ( DMIC_Type *  base,
uint32_t  channel 
)
inlinestatic
Parameters
base: The base address of DMIC interface
channel: DMIC channel
Returns
FIFO data
static uint32_t DMIC_FifoGetAddress ( DMIC_Type *  base,
uint32_t  channel 
)
inlinestatic
Parameters
base: The base address of DMIC interface
channel: DMIC channel
Returns
FIFO data
void DMIC_EnableIntCallback ( DMIC_Type *  base,
dmic_callback_t  cb 
)

This function enables the interrupt for the selected DMIC peripheral. The callback function is not enabled until this function is called.

Parameters
baseBase address of the DMIC peripheral.
cbcallback Pointer to store callback function.
Return values
None.
void DMIC_DisableIntCallback ( DMIC_Type *  base,
dmic_callback_t  cb 
)

This function disables the interrupt for the selected DMIC peripheral.

Parameters
baseBase address of the DMIC peripheral.
cbcallback Pointer to store callback function..
Return values
None.
static void DMIC_SetGainNoiseEstHwvad ( DMIC_Type *  base,
uint32_t  value 
)
inlinestatic
Parameters
baseDMIC base pointer
valuegain value for the noise estimator.
Return values
None.
static void DMIC_SetGainSignalEstHwvad ( DMIC_Type *  base,
uint32_t  value 
)
inlinestatic
Parameters
baseDMIC base pointer
valuegain value for the signal estimator.
Return values
None.
static void DMIC_SetFilterCtrlHwvad ( DMIC_Type *  base,
uint32_t  value 
)
inlinestatic
Parameters
baseDMIC base pointer
valuecut off frequency value.
Return values
None.
static void DMIC_SetInputGainHwvad ( DMIC_Type *  base,
uint32_t  value 
)
inlinestatic
Parameters
baseDMIC base pointer
valueinput gain value for hwvad.
Return values
None.
static void DMIC_CtrlClrIntrHwvad ( DMIC_Type *  base,
bool  st10 
)
inlinestatic
Parameters
baseDMIC base pointer
st10bit value.
Return values
None.
static void DMIC_FilterResetHwvad ( DMIC_Type *  base,
bool  rstt 
)
inlinestatic
Parameters
baseDMIC base pointer
rsttReset bit value.
Return values
None.
static uint16_t DMIC_GetNoiseEnvlpEst ( DMIC_Type *  base)
inlinestatic
Parameters
baseDMIC base pointer
Return values
outputof filter z7.
void DMIC_HwvadEnableIntCallback ( DMIC_Type *  base,
dmic_hwvad_callback_t  vadcb 
)

This function enables the hwvad interrupt for the selected DMIC peripheral. The callback function is not enabled until this function is called.

Parameters
baseBase address of the DMIC peripheral.
vadcbcallback Pointer to store callback function.
Return values
None.
void DMIC_HwvadDisableIntCallback ( DMIC_Type *  base,
dmic_hwvad_callback_t  vadcb 
)

This function disables the hwvad interrupt for the selected DMIC peripheral.

Parameters
baseBase address of the DMIC peripheral.
vadcbcallback Pointer to store callback function..
Return values
None.