RTEMS 6.1-rc4
Loading...
Searching...
No Matches
Data Structures
PDM Driver

Data Structures

struct  _pdm_channel_config
 PDM channel configurations. More...
 
struct  _pdm_config
 PDM user configuration structure. More...
 
struct  _pdm_hwvad_config
 PDM voice activity detector user configuration structure. More...
 
struct  _pdm_hwvad_noise_filter
 PDM voice activity detector noise filter user configuration structure. More...
 
struct  _pdm_hwvad_zero_cross_detector
 PDM voice activity detector zero cross detector configuration structure. More...
 
struct  _pdm_transfer
 PDM SDMA transfer structure. More...
 
struct  _pdm_hwvad_notification
 PDM HWVAD notification structure. More...
 
struct  _pdm_handle
 PDM handle structure. More...
 

Driver version

enum  {
  kStatus_PDM_Busy = MAKE_STATUS(kStatusGroup_PDM, 0) , kStatus_PDM_FIFO_ERROR = MAKE_STATUS(kStatusGroup_PDM, 2) , kStatus_PDM_QueueFull = MAKE_STATUS(kStatusGroup_PDM, 3) , kStatus_PDM_Idle = MAKE_STATUS(kStatusGroup_PDM, 4) ,
  kStatus_PDM_Output_ERROR = MAKE_STATUS(kStatusGroup_PDM, 5) , kStatus_PDM_ChannelConfig_Failed = MAKE_STATUS(kStatusGroup_PDM, 6) , kStatus_PDM_HWVAD_VoiceDetected = MAKE_STATUS(kStatusGroup_PDM, 7) , kStatus_PDM_HWVAD_Error = MAKE_STATUS(kStatusGroup_PDM, 8)
}
 PDM return status. More...
 
enum  _pdm_interrupt_enable { kPDM_ErrorInterruptEnable = PDM_CTRL_1_ERREN_MASK , kPDM_FIFOInterruptEnable = PDM_CTRL_1_DISEL(2U) }
 The PDM interrupt enable flag. More...
 
enum  _pdm_internal_status {
  kPDM_StatusDfBusyFlag = (int)PDM_STAT_BSY_FIL_MASK , kPDM_StatusFIRFilterReady = PDM_STAT_FIR_RDY_MASK , kPDM_StatusCh0FifoDataAvaliable = PDM_STAT_CH0F_MASK , kPDM_StatusCh1FifoDataAvaliable = PDM_STAT_CH1F_MASK ,
  kPDM_StatusCh2FifoDataAvaliable = PDM_STAT_CH2F_MASK , kPDM_StatusCh3FifoDataAvaliable = PDM_STAT_CH3F_MASK , kPDM_StatusCh4FifoDataAvaliable = PDM_STAT_CH4F_MASK , kPDM_StatusCh5FifoDataAvaliable = PDM_STAT_CH5F_MASK ,
  kPDM_StatusCh6FifoDataAvaliable = PDM_STAT_CH6F_MASK , kPDM_StatusCh7FifoDataAvaliable = PDM_STAT_CH7F_MASK
}
 The PDM status. More...
 
enum  _pdm_channel_enable_mask {
  kPDM_EnableChannel0 = PDM_STAT_CH0F_MASK , kPDM_EnableChannel1 = PDM_STAT_CH1F_MASK , kPDM_EnableChannel2 = PDM_STAT_CH2F_MASK , kPDM_EnableChannel3 = PDM_STAT_CH3F_MASK ,
  kPDM_EnableChannel4 = PDM_STAT_CH4F_MASK , kPDM_EnableChannel5 = PDM_STAT_CH5F_MASK , kPDM_EnableChannel6 = PDM_STAT_CH6F_MASK , kPDM_EnableChannel7 = PDM_STAT_CH7F_MASK ,
  kPDM_EnableChannelAll
}
 PDM channel enable mask. More...
 
enum  _pdm_fifo_status {
  kPDM_FifoStatusUnderflowCh0 = PDM_FIFO_STAT_FIFOUND0_MASK , kPDM_FifoStatusUnderflowCh1 = PDM_FIFO_STAT_FIFOUND1_MASK , kPDM_FifoStatusUnderflowCh2 = PDM_FIFO_STAT_FIFOUND2_MASK , kPDM_FifoStatusUnderflowCh3 = PDM_FIFO_STAT_FIFOUND3_MASK ,
  kPDM_FifoStatusUnderflowCh4 = PDM_FIFO_STAT_FIFOUND4_MASK , kPDM_FifoStatusUnderflowCh5 = PDM_FIFO_STAT_FIFOUND5_MASK , kPDM_FifoStatusUnderflowCh6 = PDM_FIFO_STAT_FIFOUND6_MASK , kPDM_FifoStatusUnderflowCh7 = PDM_FIFO_STAT_FIFOUND6_MASK ,
  kPDM_FifoStatusOverflowCh0 = PDM_FIFO_STAT_FIFOOVF0_MASK , kPDM_FifoStatusOverflowCh1 = PDM_FIFO_STAT_FIFOOVF1_MASK , kPDM_FifoStatusOverflowCh2 = PDM_FIFO_STAT_FIFOOVF2_MASK , kPDM_FifoStatusOverflowCh3 = PDM_FIFO_STAT_FIFOOVF3_MASK ,
  kPDM_FifoStatusOverflowCh4 = PDM_FIFO_STAT_FIFOOVF4_MASK , kPDM_FifoStatusOverflowCh5 = PDM_FIFO_STAT_FIFOOVF5_MASK , kPDM_FifoStatusOverflowCh6 = PDM_FIFO_STAT_FIFOOVF6_MASK , kPDM_FifoStatusOverflowCh7 = PDM_FIFO_STAT_FIFOOVF7_MASK
}
 The PDM fifo status. More...
 
enum  _pdm_output_status {
  kPDM_OutputStatusUnderFlowCh0 = PDM_OUT_STAT_OUTUNF0_MASK , kPDM_OutputStatusUnderFlowCh1 = PDM_OUT_STAT_OUTUNF1_MASK , kPDM_OutputStatusUnderFlowCh2 = PDM_OUT_STAT_OUTUNF2_MASK , kPDM_OutputStatusUnderFlowCh3 = PDM_OUT_STAT_OUTUNF3_MASK ,
  kPDM_OutputStatusUnderFlowCh4 = PDM_OUT_STAT_OUTUNF4_MASK , kPDM_OutputStatusUnderFlowCh5 = PDM_OUT_STAT_OUTUNF5_MASK , kPDM_OutputStatusUnderFlowCh6 = PDM_OUT_STAT_OUTUNF6_MASK , kPDM_OutputStatusUnderFlowCh7 = PDM_OUT_STAT_OUTUNF7_MASK ,
  kPDM_OutputStatusOverFlowCh0 = PDM_OUT_STAT_OUTOVF0_MASK , kPDM_OutputStatusOverFlowCh1 = PDM_OUT_STAT_OUTOVF1_MASK , kPDM_OutputStatusOverFlowCh2 = PDM_OUT_STAT_OUTOVF2_MASK , kPDM_OutputStatusOverFlowCh3 = PDM_OUT_STAT_OUTOVF3_MASK ,
  kPDM_OutputStatusOverFlowCh4 = PDM_OUT_STAT_OUTOVF4_MASK , kPDM_OutputStatusOverFlowCh5 = PDM_OUT_STAT_OUTOVF5_MASK , kPDM_OutputStatusOverFlowCh6 = PDM_OUT_STAT_OUTOVF6_MASK , kPDM_OutputStatusOverFlowCh7 = PDM_OUT_STAT_OUTOVF7_MASK
}
 The PDM output status. More...
 
enum  _pdm_dc_remover { kPDM_DcRemoverCutOff21Hz = 0U , kPDM_DcRemoverCutOff83Hz = 1U , kPDM_DcRemoverCutOff152Hz = 2U , kPDM_DcRemoverBypass = 3U }
 PDM DC remover configurations. More...
 
enum  _pdm_df_quality_mode {
  kPDM_QualityModeMedium = 0U , kPDM_QualityModeHigh = 1U , kPDM_QualityModeLow = 7U , kPDM_QualityModeVeryLow0 = 6U ,
  kPDM_QualityModeVeryLow1 = 5U , kPDM_QualityModeVeryLow2 = 4U
}
 PDM decimation filter quality mode. More...
 
enum  _pdm_qulaity_mode_k_factor { kPDM_QualityModeHighKFactor = 1U , kPDM_QualityModeMediumKFactor = 2U , kPDM_QualityModeLowKFactor = 4U , kPDM_QualityModeVeryLow2KFactor = 8U }
 PDM quality mode K factor. More...
 
enum  _pdm_df_output_gain {
  kPDM_DfOutputGain0 = 0U , kPDM_DfOutputGain1 = 1U , kPDM_DfOutputGain2 = 2U , kPDM_DfOutputGain3 = 3U ,
  kPDM_DfOutputGain4 = 4U , kPDM_DfOutputGain5 = 5U , kPDM_DfOutputGain6 = 6U , kPDM_DfOutputGain7 = 7U ,
  kPDM_DfOutputGain8 = 8U , kPDM_DfOutputGain9 = 9U , kPDM_DfOutputGain10 = 0xAU , kPDM_DfOutputGain11 = 0xBU ,
  kPDM_DfOutputGain12 = 0xCU , kPDM_DfOutputGain13 = 0xDU , kPDM_DfOutputGain14 = 0xEU , kPDM_DfOutputGain15 = 0xFU
}
 PDM decimation filter output gain. More...
 
enum  _pdm_data_width { kPDM_DataWdith16 = 2U }
 PDM data width. More...
 
enum  _pdm_hwvad_interrupt_enable { kPDM_HwvadErrorInterruptEnable = PDM_VAD0_CTRL_1_VADERIE_MASK , kPDM_HwvadInterruptEnable = PDM_VAD0_CTRL_1_VADIE_MASK }
 PDM voice activity detector interrupt type. More...
 
enum  _pdm_hwvad_int_status { kPDM_HwvadStatusInputSaturation = PDM_VAD0_STAT_VADINSATF_MASK , kPDM_HwvadStatusVoiceDetectFlag = PDM_VAD0_STAT_VADIF_MASK }
 The PDM hwvad interrupt status flag. More...
 
enum  _pdm_hwvad_hpf_config { kPDM_HwvadHpfBypassed = 0x0U , kPDM_HwvadHpfCutOffFreq1750Hz = 0x1U , kPDM_HwvadHpfCutOffFreq215Hz = 0x2U , kPDM_HwvadHpfCutOffFreq102Hz = 0x3U }
 High pass filter configure cut-off frequency. More...
 
enum  _pdm_hwvad_filter_status { kPDM_HwvadInternalFilterNormalOperation = 0U , kPDM_HwvadInternalFilterInitial = PDM_VAD0_CTRL_1_VADST10_MASK }
 HWVAD internal filter status. More...
 
enum  _pdm_hwvad_zcd_result { kPDM_HwvadResultOREnergyBasedDetection , kPDM_HwvadResultANDEnergyBasedDetection }
 PDM voice activity detector zero cross detector result. More...
 
typedef enum _pdm_dc_remover pdm_dc_remover_t
 PDM DC remover configurations.
 
typedef enum _pdm_df_quality_mode pdm_df_quality_mode_t
 PDM decimation filter quality mode.
 
typedef enum _pdm_df_output_gain pdm_df_output_gain_t
 PDM decimation filter output gain.
 
typedef struct _pdm_channel_config pdm_channel_config_t
 PDM channel configurations.
 
typedef struct _pdm_config pdm_config_t
 PDM user configuration structure.
 
typedef enum _pdm_hwvad_hpf_config pdm_hwvad_hpf_config_t
 High pass filter configure cut-off frequency.
 
typedef enum _pdm_hwvad_filter_status pdm_hwvad_filter_status_t
 HWVAD internal filter status.
 
typedef struct _pdm_hwvad_config pdm_hwvad_config_t
 PDM voice activity detector user configuration structure.
 
typedef struct _pdm_hwvad_noise_filter pdm_hwvad_noise_filter_t
 PDM voice activity detector noise filter user configuration structure.
 
typedef enum _pdm_hwvad_zcd_result pdm_hwvad_zcd_result_t
 PDM voice activity detector zero cross detector result.
 
typedef struct _pdm_hwvad_zero_cross_detector pdm_hwvad_zero_cross_detector_t
 PDM voice activity detector zero cross detector configuration structure.
 
typedef struct _pdm_transfer pdm_transfer_t
 PDM SDMA transfer structure.
 
typedef struct _pdm_handle pdm_handle_t
 PDM handle.
 
typedef void(* pdm_transfer_callback_t) (PDM_Type *base, pdm_handle_t *handle, status_t status, void *userData)
 PDM transfer callback prototype.
 
typedef void(* pdm_hwvad_callback_t) (status_t status, void *userData)
 PDM HWVAD callback prototype.
 
typedef struct _pdm_hwvad_notification pdm_hwvad_notification_t
 PDM HWVAD notification structure.
 
#define FSL_PDM_DRIVER_VERSION   (MAKE_VERSION(2, 8, 0))
 
#define PDM_XFER_QUEUE_SIZE   (4U)
 PDM XFER QUEUE SIZE.
 

Initialization and deinitialization

void PDM_Init (PDM_Type *base, const pdm_config_t *config)
 Initializes the PDM peripheral.
 
void PDM_Deinit (PDM_Type *base)
 De-initializes the PDM peripheral.
 
void PDM_SetChannelConfig (PDM_Type *base, uint32_t channel, const pdm_channel_config_t *config)
 PDM one channel configurations.
 
status_t PDM_SetSampleRateConfig (PDM_Type *base, uint32_t sourceClock_HZ, uint32_t sampleRate_HZ)
 PDM set sample rate.
 
status_t PDM_SetSampleRate (PDM_Type *base, uint32_t enableChannelMask, pdm_df_quality_mode_t qualityMode, uint8_t osr, uint32_t clkDiv)
 PDM set sample rate.
 
uint32_t PDM_GetInstance (PDM_Type *base)
 Get the instance number for PDM.
 

Interrupts

void PDM_EnableInterrupts (PDM_Type *base, uint32_t mask)
 Enables the PDM interrupt requests.
 

Bus Operations

void PDM_ReadFifo (PDM_Type *base, uint32_t startChannel, uint32_t channelNums, void *buffer, size_t size, uint32_t dataWidth)
 PDM read fifo.
 
void PDM_SetChannelGain (PDM_Type *base, uint32_t channel, pdm_df_output_gain_t gain)
 Set the PDM channel gain.
 

Voice Activity Detector

void PDM_SetHwvadConfig (PDM_Type *base, const pdm_hwvad_config_t *config)
 Configure voice activity detector.
 
void PDM_SetHwvadSignalFilterConfig (PDM_Type *base, bool enableMaxBlock, uint32_t signalGain)
 Configure voice activity detector signal filter.
 
void PDM_SetHwvadNoiseFilterConfig (PDM_Type *base, const pdm_hwvad_noise_filter_t *config)
 Configure voice activity detector noise filter.
 
void PDM_SetHwvadZeroCrossDetectorConfig (PDM_Type *base, const pdm_hwvad_zero_cross_detector_t *config)
 Configure voice activity detector zero cross detector.
 
void PDM_SetHwvadInEnvelopeBasedMode (PDM_Type *base, const pdm_hwvad_config_t *hwvadConfig, const pdm_hwvad_noise_filter_t *noiseConfig, const pdm_hwvad_zero_cross_detector_t *zcdConfig, uint32_t signalGain)
 set HWVAD in envelope based mode . Recommand configurations,
 
void PDM_SetHwvadInEnergyBasedMode (PDM_Type *base, const pdm_hwvad_config_t *hwvadConfig, const pdm_hwvad_noise_filter_t *noiseConfig, const pdm_hwvad_zero_cross_detector_t *zcdConfig, uint32_t signalGain)
 
void PDM_EnableHwvadInterruptCallback (PDM_Type *base, pdm_hwvad_callback_t vadCallback, void *userData, bool enable)
 Enable/Disable hwvad callback.
 

Transactional

void PDM_TransferCreateHandle (PDM_Type *base, pdm_handle_t *handle, pdm_transfer_callback_t callback, void *userData)
 Initializes the PDM handle.
 
status_t PDM_TransferSetChannelConfig (PDM_Type *base, pdm_handle_t *handle, uint32_t channel, const pdm_channel_config_t *config, uint32_t format)
 PDM set channel transfer config.
 
status_t PDM_TransferReceiveNonBlocking (PDM_Type *base, pdm_handle_t *handle, pdm_transfer_t *xfer)
 Performs an interrupt non-blocking receive transfer on PDM.
 
void PDM_TransferAbortReceive (PDM_Type *base, pdm_handle_t *handle)
 Aborts the current IRQ receive.
 
void PDM_TransferHandleIRQ (PDM_Type *base, pdm_handle_t *handle)
 Tx interrupt handler.
 

Detailed Description

Macro Definition Documentation

◆ FSL_PDM_DRIVER_VERSION

#define FSL_PDM_DRIVER_VERSION   (MAKE_VERSION(2, 8, 0))

Version 2.8.0

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

PDM return status.

Enumerator
kStatus_PDM_Busy 

PDM is busy.

kStatus_PDM_FIFO_ERROR 

PDM FIFO underrun or overflow

kStatus_PDM_QueueFull 

PDM FIFO underrun or overflow

kStatus_PDM_Idle 

PDM is idle

kStatus_PDM_Output_ERROR 

PDM is output error

kStatus_PDM_ChannelConfig_Failed 

PDM channel config failed

kStatus_PDM_HWVAD_VoiceDetected 

PDM hwvad voice detected

kStatus_PDM_HWVAD_Error 

PDM hwvad error

◆ _pdm_channel_enable_mask

PDM channel enable mask.

Enumerator
kPDM_EnableChannel0 

channgel 0 enable mask

kPDM_EnableChannel1 

channgel 1 enable mask

kPDM_EnableChannel2 

channgel 2 enable mask

kPDM_EnableChannel3 

channgel 3 enable mask

kPDM_EnableChannel4 

channgel 4 enable mask

kPDM_EnableChannel5 

channgel 5 enable mask

kPDM_EnableChannel6 

channgel 6 enable mask

kPDM_EnableChannel7 

channgel 7 enable mask

◆ _pdm_data_width

PDM data width.

Enumerator
kPDM_DataWdith16 

PDM data width 16bit

◆ _pdm_dc_remover

PDM DC remover configurations.

Enumerator
kPDM_DcRemoverCutOff21Hz 

DC remover cut off 21HZ

kPDM_DcRemoverCutOff83Hz 

DC remover cut off 83HZ

kPDM_DcRemoverCutOff152Hz 

DC remover cut off 152HZ

kPDM_DcRemoverBypass 

DC remover bypass

◆ _pdm_df_output_gain

PDM decimation filter output gain.

Enumerator
kPDM_DfOutputGain0 

Decimation filter output gain 0

kPDM_DfOutputGain1 

Decimation filter output gain 1

kPDM_DfOutputGain2 

Decimation filter output gain 2

kPDM_DfOutputGain3 

Decimation filter output gain 3

kPDM_DfOutputGain4 

Decimation filter output gain 4

kPDM_DfOutputGain5 

Decimation filter output gain 5

kPDM_DfOutputGain6 

Decimation filter output gain 6

kPDM_DfOutputGain7 

Decimation filter output gain 7

kPDM_DfOutputGain8 

Decimation filter output gain 8

kPDM_DfOutputGain9 

Decimation filter output gain 9

kPDM_DfOutputGain10 

Decimation filter output gain 10

kPDM_DfOutputGain11 

Decimation filter output gain 11

kPDM_DfOutputGain12 

Decimation filter output gain 12

kPDM_DfOutputGain13 

Decimation filter output gain 13

kPDM_DfOutputGain14 

Decimation filter output gain 14

kPDM_DfOutputGain15 

Decimation filter output gain 15

◆ _pdm_df_quality_mode

PDM decimation filter quality mode.

Enumerator
kPDM_QualityModeMedium 

quality mode memdium

kPDM_QualityModeHigh 

quality mode high

kPDM_QualityModeLow 

quality mode low

kPDM_QualityModeVeryLow0 

quality mode very low0

kPDM_QualityModeVeryLow1 

quality mode very low1

kPDM_QualityModeVeryLow2 

quality mode very low2

◆ _pdm_fifo_status

The PDM fifo status.

Enumerator
kPDM_FifoStatusUnderflowCh0 

channel0 fifo status underflow

kPDM_FifoStatusUnderflowCh1 

channel1 fifo status underflow

kPDM_FifoStatusUnderflowCh2 

channel2 fifo status underflow

kPDM_FifoStatusUnderflowCh3 

channel3 fifo status underflow

kPDM_FifoStatusUnderflowCh4 

channel4 fifo status underflow

kPDM_FifoStatusUnderflowCh5 

channel5 fifo status underflow

kPDM_FifoStatusUnderflowCh6 

channel6 fifo status underflow

kPDM_FifoStatusUnderflowCh7 

channel7 fifo status underflow

kPDM_FifoStatusOverflowCh0 

channel0 fifo status overflow

kPDM_FifoStatusOverflowCh1 

channel1 fifo status overflow

kPDM_FifoStatusOverflowCh2 

channel2 fifo status overflow

kPDM_FifoStatusOverflowCh3 

channel3 fifo status overflow

kPDM_FifoStatusOverflowCh4 

channel4 fifo status overflow

kPDM_FifoStatusOverflowCh5 

channel5 fifo status overflow

kPDM_FifoStatusOverflowCh6 

channel6 fifo status overflow

kPDM_FifoStatusOverflowCh7 

channel7 fifo status overflow

◆ _pdm_hwvad_filter_status

HWVAD internal filter status.

Enumerator
kPDM_HwvadInternalFilterNormalOperation 

internal filter ready for normal operation

kPDM_HwvadInternalFilterInitial 

interla filter are initial

◆ _pdm_hwvad_hpf_config

High pass filter configure cut-off frequency.

Enumerator
kPDM_HwvadHpfBypassed 

High-pass filter bypass

kPDM_HwvadHpfCutOffFreq1750Hz 

High-pass filter cut off frequency 1750HZ

kPDM_HwvadHpfCutOffFreq215Hz 

High-pass filter cut off frequency 215HZ

kPDM_HwvadHpfCutOffFreq102Hz 

High-pass filter cut off frequency 102HZ

◆ _pdm_hwvad_int_status

The PDM hwvad interrupt status flag.

Enumerator
kPDM_HwvadStatusInputSaturation 

HWVAD saturation condition

kPDM_HwvadStatusVoiceDetectFlag 

HWVAD voice detect interrupt triggered

◆ _pdm_hwvad_interrupt_enable

PDM voice activity detector interrupt type.

Enumerator
kPDM_HwvadErrorInterruptEnable 

PDM channel HWVAD error interrupt enable.

kPDM_HwvadInterruptEnable 

PDM channel HWVAD interrupt

◆ _pdm_hwvad_zcd_result

PDM voice activity detector zero cross detector result.

Enumerator
kPDM_HwvadResultOREnergyBasedDetection 

zero cross detector result will be OR with energy based detection

kPDM_HwvadResultANDEnergyBasedDetection 

zero cross detector result will be AND with energy based detection

◆ _pdm_internal_status

The PDM status.

Enumerator
kPDM_StatusDfBusyFlag 

Decimation filter is busy processing data

kPDM_StatusFIRFilterReady 

FIR filter data is ready

kPDM_StatusCh0FifoDataAvaliable 

channel 0 fifo data reached watermark level

kPDM_StatusCh1FifoDataAvaliable 

channel 1 fifo data reached watermark level

kPDM_StatusCh2FifoDataAvaliable 

channel 2 fifo data reached watermark level

kPDM_StatusCh3FifoDataAvaliable 

channel 3 fifo data reached watermark level

kPDM_StatusCh4FifoDataAvaliable 

channel 4 fifo data reached watermark level

kPDM_StatusCh5FifoDataAvaliable 

channel 5 fifo data reached watermark level

kPDM_StatusCh6FifoDataAvaliable 

channel 6 fifo data reached watermark level

kPDM_StatusCh7FifoDataAvaliable 

channel 7 fifo data reached watermark level

◆ _pdm_interrupt_enable

The PDM interrupt enable flag.

Enumerator
kPDM_ErrorInterruptEnable 

PDM channel error interrupt enable.

kPDM_FIFOInterruptEnable 

PDM channel FIFO interrupt

◆ _pdm_output_status

The PDM output status.

Enumerator
kPDM_OutputStatusUnderFlowCh0 

channel0 output status underflow

kPDM_OutputStatusUnderFlowCh1 

channel1 output status underflow

kPDM_OutputStatusUnderFlowCh2 

channel2 output status underflow

kPDM_OutputStatusUnderFlowCh3 

channel3 output status underflow

kPDM_OutputStatusUnderFlowCh4 

channel4 output status underflow

kPDM_OutputStatusUnderFlowCh5 

channel5 output status underflow

kPDM_OutputStatusUnderFlowCh6 

channel6 output status underflow

kPDM_OutputStatusUnderFlowCh7 

channel7 output status underflow

kPDM_OutputStatusOverFlowCh0 

channel0 output status overflow

kPDM_OutputStatusOverFlowCh1 

channel1 output status overflow

kPDM_OutputStatusOverFlowCh2 

channel2 output status overflow

kPDM_OutputStatusOverFlowCh3 

channel3 output status overflow

kPDM_OutputStatusOverFlowCh4 

channel4 output status overflow

kPDM_OutputStatusOverFlowCh5 

channel5 output status overflow

kPDM_OutputStatusOverFlowCh6 

channel6 output status overflow

kPDM_OutputStatusOverFlowCh7 

channel7 output status overflow

◆ _pdm_qulaity_mode_k_factor

PDM quality mode K factor.

Enumerator
kPDM_QualityModeHighKFactor 

high quality mode K factor = 1 / 2

kPDM_QualityModeMediumKFactor 

medium/very low0 quality mode K factor = 2 / 2

kPDM_QualityModeLowKFactor 

low/very low1 quality mode K factor = 4 / 2

kPDM_QualityModeVeryLow2KFactor 

very low2 quality mode K factor = 8 / 2

Function Documentation

◆ PDM_Deinit()

void PDM_Deinit ( PDM_Type base)

De-initializes the PDM peripheral.

This API gates the PDM clock. The PDM module can't operate unless PDM_Init is called to enable the clock.

Parameters
basePDM base pointer

brief De-initializes the PDM peripheral.

This API gates the PDM clock. The PDM module can't operate unless PDM_Init is called to enable the clock.

param base PDM base pointer

◆ PDM_EnableHwvadInterruptCallback()

void PDM_EnableHwvadInterruptCallback ( PDM_Type base,
pdm_hwvad_callback_t  vadCallback,
void *  userData,
bool  enable 
)

Enable/Disable hwvad callback.

This function enable/disable the hwvad interrupt for the selected PDM peripheral.

Parameters
baseBase address of the PDM peripheral.
vadCallbackcallback Pointer to store callback function, should be NULL when disable.
userDatauser data.
enabletrue is enable, false is disable.
Return values
None.

brief Enable/Disable hwvad callback.

This function enable/disable the hwvad interrupt for the selected PDM peripheral.

param base Base address of the PDM peripheral. param vadCallback callback Pointer to store callback function, should be NULL when disable. param userData user data. param enable true is enable, false is disable. retval None.

◆ PDM_EnableInterrupts()

void PDM_EnableInterrupts ( PDM_Type base,
uint32_t  mask 
)

Enables the PDM interrupt requests.

Parameters
basePDM base pointer
maskinterrupt source The parameter can be a combination of the following sources if defined.
  • kPDM_ErrorInterruptEnable
  • kPDM_FIFOInterruptEnable
brief Enables the PDM interrupt requests.

param base PDM base pointer param mask interrupt source The parameter can be a combination of the following sources if defined. arg kPDM_ErrorInterruptEnable arg kPDM_FIFOInterruptEnable

◆ PDM_GetInstance()

uint32_t PDM_GetInstance ( PDM_Type base)

Get the instance number for PDM.

Parameters
basePDM base pointer.

◆ PDM_Init()

void PDM_Init ( PDM_Type base,
const pdm_config_t config 
)

Initializes the PDM peripheral.

Ungates the PDM clock, resets the module, and configures PDM with a configuration structure. The configuration structure can be custom filled or set with default values by PDM_GetDefaultConfig().

Note
This API should be called at the beginning of the application to use the PDM driver. Otherwise, accessing the PDM module can cause a hard fault because the clock is not enabled.
Parameters
basePDM base pointer
configPDM configuration structure.

brief Initializes the PDM peripheral.

Ungates the PDM clock, resets the module, and configures PDM with a configuration structure. The configuration structure can be custom filled or set with default values by PDM_GetDefaultConfig().

note This API should be called at the beginning of the application to use the PDM driver. Otherwise, accessing the PDM module can cause a hard fault because the clock is not enabled.

param base PDM base pointer param config PDM configuration structure.

◆ PDM_ReadFifo()

void PDM_ReadFifo ( PDM_Type base,
uint32_t  startChannel,
uint32_t  channelNums,
void *  buffer,
size_t  size,
uint32_t  dataWidth 
)

PDM read fifo.

Note
: This function support 16 bit only for IP version that only supports 16bit.
Parameters
basePDM base pointer.
startChannelstart channel number.
channelNumstotal enabled channelnums.
bufferreceived buffer address.
sizenumber of samples to read.
dataWidthsample width.

brief PDM read fifo. Note: This function support 16 bit only for IP version that only supports 16bit.

param base PDM base pointer. param startChannel start channel number. param channelNums total enabled channelnums. param buffer received buffer address. param size number of samples to read. param dataWidth sample width.

◆ PDM_SetChannelConfig()

void PDM_SetChannelConfig ( PDM_Type base,
uint32_t  channel,
const pdm_channel_config_t config 
)

PDM one channel configurations.

Parameters
basePDM base pointer
configPDM channel configurations.
channelchannel number. after completing the current frame in debug mode.

brief PDM one channel configurations.

param base PDM base pointer param config PDM channel configurations. param channel channel number. after completing the current frame in debug mode.

◆ PDM_SetChannelGain()

void PDM_SetChannelGain ( PDM_Type base,
uint32_t  channel,
pdm_df_output_gain_t  gain 
)

Set the PDM channel gain.

Please note for different quality mode, the valid gain value is different, reference RM for detail.

Parameters
basePDM base pointer.
channelPDM channel index.
gainchannel gain, the register gain value range is 0 - 15.

brief Set the PDM channel gain.

Please note for different quality mode, the valid gain value is different, reference RM for detail. param base PDM base pointer. param channel PDM channel index. param gain channel gain, the register gain value range is 0 - 15.

◆ PDM_SetHwvadConfig()

void PDM_SetHwvadConfig ( PDM_Type base,
const pdm_hwvad_config_t config 
)

Configure voice activity detector.

Parameters
basePDM base pointer
configVoice activity detector configure structure pointer .

brief Configure voice activity detector.

param base PDM base pointer param config Voice activity detector configure structure pointer .

◆ PDM_SetHwvadInEnergyBasedMode()

void PDM_SetHwvadInEnergyBasedMode ( PDM_Type base,
const pdm_hwvad_config_t hwvadConfig,
const pdm_hwvad_noise_filter_t noiseConfig,
const pdm_hwvad_zero_cross_detector_t zcdConfig,
uint32_t  signalGain 
)

brief set HWVAD in energy based mode . Recommand configurations, code static const pdm_hwvad_config_t hwvadConfig = { .channel = 0, .initializeTime = 10U, .cicOverSampleRate = 0U, .inputGain = 0U, .frameTime = 10U, .cutOffFreq = kPDM_HwvadHpfBypassed, .enableFrameEnergy = true, .enablePreFilter = true, };

static const pdm_hwvad_noise_filter_t noiseFilterConfig = { .enableAutoNoiseFilter = true, .enableNoiseMin = false, .enableNoiseDecimation = false, .noiseFilterAdjustment = 0U, .noiseGain = 7U, .enableNoiseDetectOR = false, }; code param base PDM base pointer. param hwvadConfig internal filter status. param noiseConfig Voice activity detector noise filter configure structure pointer. param zcdConfig Voice activity detector zero cross detector configure structure pointer . param signalGain signal gain value, signal gain value should be properly according to application.

◆ PDM_SetHwvadInEnvelopeBasedMode()

void PDM_SetHwvadInEnvelopeBasedMode ( PDM_Type base,
const pdm_hwvad_config_t hwvadConfig,
const pdm_hwvad_noise_filter_t noiseConfig,
const pdm_hwvad_zero_cross_detector_t zcdConfig,
uint32_t  signalGain 
)

set HWVAD in envelope based mode . Recommand configurations,

static const pdm_hwvad_config_t hwvadConfig = {
.channel = 0,
.initializeTime = 10U,
.cicOverSampleRate = 0U,
.inputGain = 0U,
.frameTime = 10U,
.cutOffFreq = kPDM_HwvadHpfBypassed,
.enableFrameEnergy = false,
.enablePreFilter = true,
};
static const pdm_hwvad_noise_filter_t noiseFilterConfig = {
.enableNoiseMin = true,
.enableNoiseDecimation = true,
.noiseFilterAdjustment = 0U,
.noiseGain = 7U,
.enableNoiseDetectOR = true,
};
@ kPDM_HwvadHpfBypassed
Definition: fsl_pdm.h:290
PDM voice activity detector user configuration structure.
Definition: fsl_pdm.h:305
uint8_t channel
Definition: fsl_pdm.h:306
PDM voice activity detector noise filter user configuration structure.
Definition: fsl_pdm.h:319
bool enableAutoNoiseFilter
Definition: fsl_pdm.h:320
Parameters
basePDM base pointer.
hwvadConfiginternal filter status.
noiseConfigVoice activity detector noise filter configure structure pointer.
zcdConfigVoice activity detector zero cross detector configure structure pointer .
signalGainsignal gain value.

brief set HWVAD in envelope based mode . Recommand configurations, code static const pdm_hwvad_config_t hwvadConfig = { .channel = 0, .initializeTime = 10U, .cicOverSampleRate = 0U, .inputGain = 0U, .frameTime = 10U, .cutOffFreq = kPDM_HwvadHpfBypassed, .enableFrameEnergy = false, .enablePreFilter = true, };

static const pdm_hwvad_noise_filter_t noiseFilterConfig = { .enableAutoNoiseFilter = false, .enableNoiseMin = true, .enableNoiseDecimation = true, .noiseFilterAdjustment = 0U, .noiseGain = 7U, .enableNoiseDetectOR = true, }; code param base PDM base pointer. param hwvadConfig internal filter status. param noiseConfig Voice activity detector noise filter configure structure pointer. param zcdConfig Voice activity detector zero cross detector configure structure pointer . param signalGain signal gain value.

◆ PDM_SetHwvadNoiseFilterConfig()

void PDM_SetHwvadNoiseFilterConfig ( PDM_Type base,
const pdm_hwvad_noise_filter_t config 
)

Configure voice activity detector noise filter.

Parameters
basePDM base pointer
configVoice activity detector noise filter configure structure pointer .

brief Configure voice activity detector noise filter.

param base PDM base pointer param config Voice activity detector noise filter configure structure pointer .

◆ PDM_SetHwvadSignalFilterConfig()

void PDM_SetHwvadSignalFilterConfig ( PDM_Type base,
bool  enableMaxBlock,
uint32_t  signalGain 
)

Configure voice activity detector signal filter.

Parameters
basePDM base pointer
enableMaxBlockIf signal maximum block enabled.
signalGainGain value for the signal energy.

brief Configure voice activity detector signal filter.

param base PDM base pointer param enableMaxBlock If signal maximum block enabled. param signalGain Gain value for the signal energy.

◆ PDM_SetHwvadZeroCrossDetectorConfig()

void PDM_SetHwvadZeroCrossDetectorConfig ( PDM_Type base,
const pdm_hwvad_zero_cross_detector_t config 
)

Configure voice activity detector zero cross detector.

Parameters
basePDM base pointer
configVoice activity detector zero cross detector configure structure pointer .

brief Configure voice activity detector zero cross detector.

param base PDM base pointer param config Voice activity detector zero cross detector configure structure pointer .

◆ PDM_SetSampleRate()

status_t PDM_SetSampleRate ( PDM_Type base,
uint32_t  enableChannelMask,
pdm_df_quality_mode_t  qualityMode,
uint8_t  osr,
uint32_t  clkDiv 
)

PDM set sample rate.

Deprecated:
Do not use this function. It has been superceded by PDM_SetSampleRateConfig
Parameters
basePDM base pointer
enableChannelMaskPDM channel enable mask.
qualityModequality mode.
osrcic oversample rate
clkDivclock divider

brief PDM set sample rate.

deprecated Do not use this function. It has been superceded by PDM_SetSampleRateConfig param base PDM base pointer param enableChannelMask PDM channel enable mask. param qualityMode quality mode. param osr cic oversample rate param clkDiv clock divider

◆ PDM_SetSampleRateConfig()

status_t PDM_SetSampleRateConfig ( PDM_Type base,
uint32_t  sourceClock_HZ,
uint32_t  sampleRate_HZ 
)

PDM set sample rate.

Note
This function is depend on the configuration of the PDM and PDM channel, so the correct call sequence is
PDM_Init(base, pdmConfig)
PDM_SetChannelConfig(base, channel, &channelConfig)
PDM_SetSampleRateConfig(base, source, sampleRate)
status_t PDM_SetSampleRateConfig(PDM_Type *base, uint32_t sourceClock_HZ, uint32_t sampleRate_HZ)
PDM set sample rate.
Definition: fsl_pdm.c:217
void PDM_Init(PDM_Type *base, const pdm_config_t *config)
Initializes the PDM peripheral.
Definition: fsl_pdm.c:313
void PDM_SetChannelConfig(PDM_Type *base, uint32_t channel, const pdm_channel_config_t *config)
PDM one channel configurations.
Definition: fsl_pdm.c:398
Parameters
basePDM base pointer
sourceClock_HZPDM source clock frequency.
sampleRate_HZPDM sample rate.

brief PDM set sample rate.

note This function is depend on the configuration of the PDM and PDM channel, so the correct call sequence is code PDM_Init(base, pdmConfig) PDM_SetChannelConfig(base, channel, &channelConfig) PDM_SetSampleRateConfig(base, source, sampleRate) endcode param base PDM base pointer param sourceClock_HZ PDM source clock frequency. param sampleRate_HZ PDM sample rate.

◆ PDM_TransferAbortReceive()

void PDM_TransferAbortReceive ( PDM_Type base,
pdm_handle_t handle 
)

Aborts the current IRQ receive.

Note
This API can be called when an interrupt non-blocking transfer initiates to abort the transfer early.
Parameters
basePDM base pointer
handlePointer to the pdm_handle_t structure which stores the transfer state.

brief Aborts the current IRQ receive.

note This API can be called when an interrupt non-blocking transfer initiates to abort the transfer early.

param base PDM base pointer param handle Pointer to the pdm_handle_t structure which stores the transfer state.

◆ PDM_TransferCreateHandle()

void PDM_TransferCreateHandle ( PDM_Type base,
pdm_handle_t handle,
pdm_transfer_callback_t  callback,
void *  userData 
)

Initializes the PDM handle.

This function initializes the handle for the PDM transactional APIs. Call this function once to get the handle initialized.

Parameters
basePDM base pointer.
handlePDM handle pointer.
callbackPointer to the user callback function.
userDataUser parameter passed to the callback function.

brief Initializes the PDM handle.

This function initializes the handle for the PDM transactional APIs. Call this function once to get the handle initialized.

param base PDM base pointer. param handle PDM handle pointer. param callback Pointer to the user callback function. param userData User parameter passed to the callback function.

◆ PDM_TransferHandleIRQ()

void PDM_TransferHandleIRQ ( PDM_Type base,
pdm_handle_t handle 
)

Tx interrupt handler.

Parameters
basePDM base pointer.
handlePointer to the pdm_handle_t structure.

brief Tx interrupt handler.

param base PDM base pointer. param handle Pointer to the pdm_handle_t structure.

◆ PDM_TransferReceiveNonBlocking()

status_t PDM_TransferReceiveNonBlocking ( PDM_Type base,
pdm_handle_t handle,
pdm_transfer_t xfer 
)

Performs an interrupt non-blocking receive transfer on PDM.

Note
This API returns immediately after the transfer initiates. Call the PDM_RxGetTransferStatusIRQ to poll the transfer status and check whether the transfer is finished. If the return status is not kStatus_PDM_Busy, the transfer is finished.
Parameters
basePDM base pointer
handlePointer to the pdm_handle_t structure which stores the transfer state.
xferPointer to the pdm_transfer_t structure.
Return values
kStatus_SuccessSuccessfully started the data receive.
kStatus_PDM_BusyPrevious receive still not finished.

brief Performs an interrupt non-blocking receive transfer on PDM.

note This API returns immediately after the transfer initiates. Call the PDM_RxGetTransferStatusIRQ to poll the transfer status and check whether the transfer is finished. If the return status is not kStatus_PDM_Busy, the transfer is finished.

param base PDM base pointer param handle Pointer to the pdm_handle_t structure which stores the transfer state. param xfer Pointer to the pdm_transfer_t structure. retval kStatus_Success Successfully started the data receive. retval kStatus_PDM_Busy Previous receive still not finished.

◆ PDM_TransferSetChannelConfig()

status_t PDM_TransferSetChannelConfig ( PDM_Type base,
pdm_handle_t handle,
uint32_t  channel,
const pdm_channel_config_t config,
uint32_t  format 
)

PDM set channel transfer config.

Parameters
basePDM base pointer.
handlePDM handle pointer.
channelPDM channel.
configchannel config.
formatdata format, support data width configurations,_pdm_data_width.
Return values
kStatus_PDM_ChannelConfig_Failedor kStatus_Success.

brief PDM set channel transfer config.

param base PDM base pointer. param handle PDM handle pointer. param channel PDM channel. param config channel config. param format data format.