Macros | Functions
fsl_wm8904.c File Reference
#include "fsl_wm8904.h"
Include dependency graph for fsl_wm8904.c:

Go to the source code of this file.

Macros

#define WM8904_MAP_BITWIDTH(x)   (x == kWM8904_BitWidth16 ? 16 : x == kWM8904_BitWidth20 ? 20 : x == kWM8904_BitWidth24 ? 24 : 32)
 
#define WM8904_MAP_DAC_ADC_VOLUME(volume)   (volume * (255 / 100U))
 wm8904 volume mapping More...
 
#define WM8904_MAP_HEADPHONE_LINEOUT_VOLUME(volume)   (volume > 0x3FU ? 0x3FU : volume)
 
#define WM8904_MAP_PGA_VOLUME(volume)   (volume > 0x1FU ? 0x1FU : volume)
 
#define WM8904_MAP_SAMPLERATE(x)
 
#define WM8904_SWAP_UINT16_BYTE_SEQUENCE(x)   (__REV16(x))
 

Functions

status_t WM8904_CheckAudioFormat (wm8904_handle_t *handle, wm8904_audio_format_t *format, uint32_t mclkFreq)
 check and update the audio data format. This api is used check the fsRatio setting based on the mclk and sample rate, if fsRatio setting is not correct, it will correct it according to mclk and sample rate. More...
 
status_t WM8904_Deinit (wm8904_handle_t *handle)
 Deinitializes the WM8904 codec. More...
 
status_t WM8904_EnableADCTDMMode (wm8904_handle_t *handle, wm8904_timeslot_t timeSlot)
 Enable WM8904 ADC time slot. More...
 
status_t WM8904_EnableDACTDMMode (wm8904_handle_t *handle, wm8904_timeslot_t timeSlot)
 Enable WM8904 DAC time slot. More...
 
void WM8904_GetDefaultConfig (wm8904_config_t *config)
 Fills the configuration structure with default values. More...
 
status_t WM8904_Init (wm8904_handle_t *handle, wm8904_config_t *wm8904Config)
 Initializes WM8904. More...
 
status_t WM8904_ModifyRegister (wm8904_handle_t *handle, uint8_t reg, uint16_t mask, uint16_t value)
 WM8904 modify register. More...
 
status_t WM8904_ReadRegister (wm8904_handle_t *handle, uint8_t reg, uint16_t *value)
 WM8904 write register. More...
 
status_t WM8904_SelectLRCPolarity (wm8904_handle_t *handle, uint32_t polarity)
 Select LRC polarity. More...
 
status_t WM8904_SeMasterClock (wm8904_handle_t *handle, uint32_t sysclk, uint32_t sampleRate, uint32_t bitWidth)
 Sets WM8904 master clock configuration. More...
 
status_t WM8904_SetAudioFormat (wm8904_handle_t *handle, uint32_t sysclk, uint32_t sampleRate, uint32_t bitWidth)
 Sets the audio data format. More...
 
status_t WM8904_SetChannelMute (wm8904_handle_t *handle, uint32_t channel, bool isMute)
 Sets the channel mute. More...
 
status_t WM8904_SetChannelVolume (wm8904_handle_t *handle, uint32_t channel, uint32_t volume)
 Sets the channel output volume. More...
 
status_t WM8904_SetFLLConfig (wm8904_handle_t *handle, wm8904_fll_config_t *config)
 WM8904 set PLL configuration This function will enable the GPIO1 FLL clock output function, so user can see the generated fll output clock frequency from WM8904 GPIO1. More...
 
status_t WM8904_SetMasterSlave (wm8904_handle_t *handle, bool master)
 Sets WM8904 as master or slave. More...
 
status_t WM8904_SetModulePower (wm8904_handle_t *handle, wm8904_module_t module, bool isEnabled)
 
status_t WM8904_SetMute (wm8904_handle_t *handle, bool muteLeft, bool muteRight)
 Sets the headphone output mute. More...
 
status_t WM8904_SetPlay (wm8904_handle_t *handle, uint32_t playSource)
 SET the WM8904 play source. More...
 
status_t WM8904_SetProtocol (wm8904_handle_t *handle, wm8904_protocol_t protocol)
 Sets the audio data transfer protocol. More...
 
status_t WM8904_SetRecord (wm8904_handle_t *handle, uint32_t recordSource)
 SET the WM8904 record source. More...
 
status_t WM8904_SetRecordChannel (wm8904_handle_t *handle, uint32_t leftRecordChannel, uint32_t rightRecordChannel)
 SET the WM8904 record source. More...
 
status_t WM8904_SetVolume (wm8904_handle_t *handle, uint16_t volumeLeft, uint16_t volumeRight)
 Sets the module output volume. More...
 
static status_t WM8904_UpdateFormat (wm8904_handle_t *handle, wm8904_audio_format_t *format)
 WM8904 update format. More...
 
static status_t WM8904_WaitOnWriteSequencer (wm8904_handle_t *handle)
 WM8904 wait on write sequencer. More...
 
status_t WM8904_WriteRegister (wm8904_handle_t *handle, uint8_t reg, uint16_t value)
 WM8904 write register. More...
 

Macro Definition Documentation

◆ WM8904_MAP_BITWIDTH

#define WM8904_MAP_BITWIDTH (   x)    (x == kWM8904_BitWidth16 ? 16 : x == kWM8904_BitWidth20 ? 20 : x == kWM8904_BitWidth24 ? 24 : 32)

Definition at line 29 of file fsl_wm8904.c.

◆ WM8904_MAP_DAC_ADC_VOLUME

#define WM8904_MAP_DAC_ADC_VOLUME (   volume)    (volume * (255 / 100U))

wm8904 volume mapping

Definition at line 17 of file fsl_wm8904.c.

◆ WM8904_MAP_HEADPHONE_LINEOUT_VOLUME

#define WM8904_MAP_HEADPHONE_LINEOUT_VOLUME (   volume)    (volume > 0x3FU ? 0x3FU : volume)

Definition at line 19 of file fsl_wm8904.c.

◆ WM8904_MAP_PGA_VOLUME

#define WM8904_MAP_PGA_VOLUME (   volume)    (volume > 0x1FU ? 0x1FU : volume)

Definition at line 18 of file fsl_wm8904.c.

◆ WM8904_MAP_SAMPLERATE

#define WM8904_MAP_SAMPLERATE (   x)
Value:
8000U : \
12000U : \
16000U : \
x == kWM8904_SampleRate24kHz ? 24000U : x == kWM8904_SampleRate32kHz ? 32000U : 48000U)

Definition at line 21 of file fsl_wm8904.c.

◆ WM8904_SWAP_UINT16_BYTE_SEQUENCE

#define WM8904_SWAP_UINT16_BYTE_SEQUENCE (   x)    (__REV16(x))

Definition at line 20 of file fsl_wm8904.c.

Function Documentation

◆ WM8904_UpdateFormat()

static status_t WM8904_UpdateFormat ( wm8904_handle_t handle,
wm8904_audio_format_t format 
)
static

WM8904 update format.

Parameters
handleWM8904 handle structure.
formatformat configurations.
Returns
kStatus_Success, else failed.

Definition at line 66 of file fsl_wm8904.c.

◆ WM8904_WaitOnWriteSequencer()

static status_t WM8904_WaitOnWriteSequencer ( wm8904_handle_t handle)
static

WM8904 wait on write sequencer.

Parameters
handleWM8904 handle structure.
Returns
kStatus_Success, else failed.

Definition at line 108 of file fsl_wm8904.c.

kWM8904_SampleRate16kHz
@ kWM8904_SampleRate16kHz
Definition: fsl_wm8904.h:165
kWM8904_SampleRate12kHz
@ kWM8904_SampleRate12kHz
Definition: fsl_wm8904.h:164
kWM8904_SampleRate8kHz
@ kWM8904_SampleRate8kHz
Definition: fsl_wm8904.h:163
kWM8904_SampleRate24kHz
@ kWM8904_SampleRate24kHz
Definition: fsl_wm8904.h:166
kWM8904_SampleRate32kHz
@ kWM8904_SampleRate32kHz
Definition: fsl_wm8904.h:167


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:57