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

Overview

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  operation_mode_t {
  kDMIC_OperationModePoll = 0U,
  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_io_t {
  kDMIC_PdmDual = 0U,
  kDMIC_PdmStereo = 4U,
  kDMIC_PdmBypass = 3U,
  kDMIC_PdmBypassClk0 = 1U,
  kDMIC_PdmBypassClk1 = 2U
}
 DMIC IO configiration. More...
 
enum  dmic_channel_t {
  kDMIC_Channel0 = 0U,
  kDMIC_Channel1 = 1U
}
 DMIC Channel number. More...
 
enum  dmic_phy_sample_rate_t {
  kDMIC_PhyFullSpeed = 0U,
  kDMIC_PhyHalfSpeed = 1U
}
 DMIC and decimator sample rates. More...
 
enum  _dmic_status {
  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 transfer status. More...
 

Functions

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_ConfigIO (DMIC_Type *base, dmic_io_t config)
 Configure DMIC io. More...
 
void DMIC_SetOperationMode (DMIC_Type *base, operation_mode_t mode)
 Set DMIC operating mode. 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_Use2fs (DMIC_Type *base, bool use2fs)
 Configure Clock scaling. 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 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...
 
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...
 

DMIC version

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

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...
 

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, 0, 0))

Typedef Documentation

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

Enumeration Type Documentation

Enumerator
kDMIC_OperationModePoll 

Polling mode.

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.

enum dmic_io_t
Enumerator
kDMIC_PdmDual 

Two separate pairs of PDM wires.

kDMIC_PdmStereo 

Stereo Mic.

kDMIC_PdmBypass 

Clk Bypass clocks both channels.

kDMIC_PdmBypassClk0 

Clk Bypass clocks only channel0.

kDMIC_PdmBypassClk1 

Clk Bypas clocks only channel1.

Enumerator
kDMIC_Channel0 

DMIC channel 0.

kDMIC_Channel1 

DMIC channel 1.

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.

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.

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_ConfigIO ( DMIC_Type *  base,
dmic_io_t  config 
)
Parameters
base: The base address of DMIC interface
config: DMIC io configuration
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_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_Use2fs ( DMIC_Type *  base,
bool  use2fs 
)
Parameters
base: The base address of DMIC interface
use2fs: clock scaling
Returns
Nothing
void DMIC_EnableChannnel ( DMIC_Type *  base,
uint32_t  channelmask 
)
Parameters
base: The base address of DMIC interface
channelmask: Channel selection
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 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
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.