Classes
fsl_wm8960.h File Reference
#include "fsl_codec_i2c.h"
#include "fsl_common.h"
Include dependency graph for fsl_wm8960.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _wm8960_audio_format
 wm8960 audio format More...
 
struct  _wm8960_handle
 wm8960 codec handler More...
 
struct  wm8960_config
 Initialize structure of WM8960. More...
 

Driver version

enum  _wm8960_audio_bit_width { kWM8960_AudioBitWidth16bit = 16U, kWM8960_AudioBitWidth20bit = 20U, kWM8960_AudioBitWidth24bit = 24U, kWM8960_AudioBitWidth32bit = 32U }
 audio bit width More...
 
enum  _wm8960_input {
  kWM8960_InputClosed = 0, kWM8960_InputSingleEndedMic = 1, kWM8960_InputDifferentialMicInput2 = 2, kWM8960_InputDifferentialMicInput3 = 3,
  kWM8960_InputLineINPUT2 = 4, kWM8960_InputLineINPUT3 = 5
}
 wm8960 input source More...
 
enum  _wm8960_module {
  kWM8960_ModuleADC = 0, kWM8960_ModuleDAC = 1, kWM8960_ModuleVREF = 2, kWM8960_ModuleHP = 3,
  kWM8960_ModuleMICB = 4, kWM8960_ModuleMIC = 5, kWM8960_ModuleLineIn = 6, kWM8960_ModuleLineOut = 7,
  kWM8960_ModuleSpeaker = 8, kWM8960_ModuleOMIX = 9
}
 Modules in WM8960 board. More...
 
enum  _wm8960_play_channel { kWM8960_HeadphoneLeft = 1, kWM8960_HeadphoneRight = 2, kWM8960_SpeakerLeft = 4, kWM8960_SpeakerRight = 8 }
 wm8960 play channel More...
 
enum  _wm8960_play_source { kWM8960_PlaySourcePGA = 1, kWM8960_PlaySourceInput = 2, kWM8960_PlaySourceDAC = 4 }
 wm8960 play source More...
 
enum  _wm8960_protocol {
  kWM8960_BusI2S = 2, kWM8960_BusLeftJustified = 1, kWM8960_BusRightJustified = 0, kWM8960_BusPCMA = 3,
  kWM8960_BusPCMB = 3 | (1 << 4)
}
 The audio data transfer protocol choice. WM8960 only supports I2S format and PCM format. More...
 
enum  _wm8960_route { kWM8960_RouteBypass = 0, kWM8960_RoutePlayback = 1, kWM8960_RoutePlaybackandRecord = 2, kWM8960_RouteRecord = 5 }
 WM8960 data route. Only provide some typical data route, not all route listed. Note: Users cannot combine any routes, once a new route is set, the previous one would be replaced. More...
 
enum  _wm8960_sample_rate {
  kWM8960_AudioSampleRate8KHz = 8000U, kWM8960_AudioSampleRate11025Hz = 11025U, kWM8960_AudioSampleRate12KHz = 12000U, kWM8960_AudioSampleRate16KHz = 16000U,
  kWM8960_AudioSampleRate22050Hz = 22050U, kWM8960_AudioSampleRate24KHz = 24000U, kWM8960_AudioSampleRate32KHz = 32000U, kWM8960_AudioSampleRate44100Hz = 44100U,
  kWM8960_AudioSampleRate48KHz = 48000U, kWM8960_AudioSampleRate96KHz = 96000U, kWM8960_AudioSampleRate192KHz = 192000U, kWM8960_AudioSampleRate384KHz = 384000U
}
 audio sample rate definition More...
 
#define FSL_WM8960_DRIVER_VERSION   (MAKE_VERSION(2, 1, 1))
 CLOCK driver version 2.1.1. More...
 
#define WM8960_3D   0x10
 
#define WM8960_ADDCTL1   0x17
 
#define WM8960_ADDCTL2   0x18
 
#define WM8960_ADDCTL3   0x1b
 
#define WM8960_ADDCTL4   0x30
 
#define WM8960_ALC1   0x11
 
#define WM8960_ALC2   0x12
 
#define WM8960_ALC3   0x13
 
#define WM8960_APOP1   0x1c
 
#define WM8960_APOP2   0x1d
 
typedef struct _wm8960_audio_format wm8960_audio_format_t
 wm8960 audio format More...
 
#define WM8960_BYPASS1   0x2d
 
#define WM8960_BYPASS2   0x2e
 
#define WM8960_CACHEREGNUM   56
 Cache register number. More...
 
#define WM8960_CLASSD1   0x31
 
#define WM8960_CLASSD3   0x33
 
#define WM8960_CLOCK1   0x4
 
#define WM8960_CLOCK2   0x8
 
typedef struct wm8960_config wm8960_config_t
 Initialize structure of WM8960. More...
 
status_t WM8960_ConfigDataFormat (wm8960_handle_t *handle, uint32_t sysclk, uint32_t sample_rate, uint32_t bits)
 Configure the data format of audio data. More...
 
#define WM8960_DACCTL1   0x5
 
#define WM8960_DACCTL2   0x6
 
status_t WM8960_Deinit (wm8960_handle_t *handle)
 Deinit the WM8960 codec. More...
 
uint32_t WM8960_GetVolume (wm8960_handle_t *handle, wm8960_module_t module)
 Get the volume of different modules in WM8960. More...
 
typedef struct _wm8960_handle wm8960_handle_t
 wm8960 codec handler More...
 
#define WM8960_I2C_ADDR   0x1A
 WM8960 I2C address. More...
 
#define WM8960_I2C_BAUDRATE   (100000U)
 WM8960 I2C baudrate. More...
 
#define WM8960_I2C_HANDLER_SIZE   CODEC_I2C_MASTER_HANDLER_SIZE
 wm8960 handle size More...
 
#define WM8960_IFACE1   0x7
 
#define WM8960_IFACE1_ADCCH_NORMAL   0x00
 
#define WM8960_IFACE1_ADCCH_SWAP   0x01
 
#define WM8960_IFACE1_ALRSWAP(x)   ((x << WM8960_IFACE1_ALRSWAP_SHIFT) & WM8960_IFACE1_ALRSWAP_MASK)
 
#define WM8960_IFACE1_ALRSWAP_MASK   0x100
 WM8960_IFACE1 ALRSWAP bit. More...
 
#define WM8960_IFACE1_ALRSWAP_SHIFT   0x08
 
#define WM8960_IFACE1_BCLK_INVERT   0x01
 
#define WM8960_IFACE1_BCLK_NONINVERT   0x00
 
#define WM8960_IFACE1_BCLKINV(x)   ((x << WM8960_IFACE1_BCLKINV_SHIFT) & WM8960_IFACE1_BCLKINV_MASK)
 
#define WM8960_IFACE1_BCLKINV_MASK   0x80
 WM8960_IFACE1 BCLKINV bit. More...
 
#define WM8960_IFACE1_BCLKINV_SHIFT   0x07
 
#define WM8960_IFACE1_DACCH_NORMAL   0x00
 
#define WM8960_IFACE1_DACCH_SWAP   0x01
 
#define WM8960_IFACE1_DLRSWAP(x)   ((x << WM8960_IFACE1_DLRSWAP_SHIFT) & WM8960_IFACE1_DLRSWAP_MASK)
 
#define WM8960_IFACE1_DLRSWAP_MASK   0x20
 WM8960_IFACE1 DLRSWAP bit. More...
 
#define WM8960_IFACE1_DLRSWAP_SHIFT   0x05
 
#define WM8960_IFACE1_DSP_MODEA   0x00
 
#define WM8960_IFACE1_DSP_MODEB   0x01
 
#define WM8960_IFACE1_FORMAT(x)   ((x << WM8960_IFACE1_FORMAT_SHIFT) & WM8960_IFACE1_FORMAT_MASK)
 
#define WM8960_IFACE1_FORMAT_DSP   0x03
 
#define WM8960_IFACE1_FORMAT_I2S   0x02
 
#define WM8960_IFACE1_FORMAT_LJ   0x01
 
#define WM8960_IFACE1_FORMAT_MASK   0x03
 WM8960_IFACE1 FORMAT bits. More...
 
#define WM8960_IFACE1_FORMAT_RJ   0x00
 
#define WM8960_IFACE1_FORMAT_SHIFT   0x00
 
#define WM8960_IFACE1_LRCLK_INVERT_POL   0x01
 
#define WM8960_IFACE1_LRCLK_NORMAL_POL   0x00
 
#define WM8960_IFACE1_LRP(x)   ((x << WM8960_IFACE1_LRP_SHIFT) & WM8960_IFACE1_LRP_MASK)
 
#define WM8960_IFACE1_LRP_MASK   0x10
 WM8960_IFACE1 LRP bit. More...
 
#define WM8960_IFACE1_LRP_SHIFT   0x04
 
#define WM8960_IFACE1_MASTER   0x01
 
#define WM8960_IFACE1_MS(x)   ((x << WM8960_IFACE1_MS_SHIFT) & WM8960_IFACE1_MS_MASK)
 
#define WM8960_IFACE1_MS_MASK   0x40
 WM8960_IFACE1 MS bit. More...
 
#define WM8960_IFACE1_MS_SHIFT   0x06
 
#define WM8960_IFACE1_SLAVE   0x00
 
#define WM8960_IFACE1_WL(x)   ((x << WM8960_IFACE1_WL_SHIFT) & WM8960_IFACE1_WL_MASK)
 
#define WM8960_IFACE1_WL_16BITS   0x00
 
#define WM8960_IFACE1_WL_20BITS   0x01
 
#define WM8960_IFACE1_WL_24BITS   0x02
 
#define WM8960_IFACE1_WL_32BITS   0x03
 
#define WM8960_IFACE1_WL_MASK   0x0C
 WM8960_IFACE1 WL bits. More...
 
#define WM8960_IFACE1_WL_SHIFT   0x02
 
#define WM8960_IFACE2   0x9
 
#define WM8960_INBMIX1   0x2b
 
#define WM8960_INBMIX2   0x2c
 
status_t WM8960_Init (wm8960_handle_t *handle, const wm8960_config_t *wm8960Config)
 WM8960 initialize function. More...
 
typedef enum _wm8960_input wm8960_input_t
 wm8960 input source More...
 
#define WM8960_LADC   0x15
 
#define WM8960_LDAC   0xa
 
#define WM8960_LINPATH   0x20
 
#define WM8960_LINVOL   0x0
 Define the register address of WM8960. More...
 
#define WM8960_LOUT1   0x2
 
#define WM8960_LOUT2   0x28
 
#define WM8960_LOUTMIX   0x22
 
status_t WM8960_ModifyReg (wm8960_handle_t *handle, uint8_t reg, uint16_t mask, uint16_t val)
 Modify some bits in the register using I2C. More...
 
typedef enum _wm8960_module wm8960_module_t
 Modules in WM8960 board. More...
 
#define WM8960_MONO   0x2a
 
#define WM8960_MONOMIX1   0x26
 
#define WM8960_MONOMIX2   0x27
 
#define WM8960_NOISEG   0x14
 
typedef enum _wm8960_play_source wm8960_play_source_t
 wm8960 play source More...
 
#define WM8960_PLL1   0x34
 
#define WM8960_PLL2   0x35
 
#define WM8960_PLL3   0x36
 
#define WM8960_PLL4   0x37
 
#define WM8960_POWER1   0x19
 
#define WM8960_POWER1_ADCL_MASK   0x08
 
#define WM8960_POWER1_ADCL_SHIFT   0x03
 
#define WM8960_POWER1_ADCR_MASK   0x0
 
#define WM8960_POWER1_ADCR_SHIFT   0x02
 
#define WM8960_POWER1_AINL_MASK   0x20
 
#define WM8960_POWER1_AINL_SHIFT   0x05
 
#define WM8960_POWER1_AINR_MASK   0x10
 
#define WM8960_POWER1_AINR_SHIFT   0x04
 
#define WM8960_POWER1_DIGENB_MASK   0x01
 
#define WM8960_POWER1_DIGENB_SHIFT   0x00
 
#define WM8960_POWER1_MICB_MASK   0x02
 
#define WM8960_POWER1_MICB_SHIFT   0x01
 
#define WM8960_POWER1_VREF_MASK   0x40
 WM8960_POWER1. More...
 
#define WM8960_POWER1_VREF_SHIFT   0x06
 
#define WM8960_POWER2   0x1a
 
#define WM8960_POWER2_DACL_MASK   0x100
 WM8960_POWER2. More...
 
#define WM8960_POWER2_DACL_SHIFT   0x08
 
#define WM8960_POWER2_DACR_MASK   0x80
 
#define WM8960_POWER2_DACR_SHIFT   0x07
 
#define WM8960_POWER2_LOUT1_MASK   0x40
 
#define WM8960_POWER2_LOUT1_SHIFT   0x06
 
#define WM8960_POWER2_ROUT1_MASK   0x20
 
#define WM8960_POWER2_ROUT1_SHIFT   0x05
 
#define WM8960_POWER2_SPKL_MASK   0x10
 
#define WM8960_POWER2_SPKL_SHIFT   0x04
 
#define WM8960_POWER2_SPKR_MASK   0x08
 
#define WM8960_POWER2_SPKR_SHIFT   0x03
 
#define WM8960_POWER3   0x2f
 
#define WM8960_POWER3_LMIC_MASK   0x20
 
#define WM8960_POWER3_LMIC_SHIFT   0x05
 
#define WM8960_POWER3_LOMIX_MASK   0x08
 
#define WM8960_POWER3_LOMIX_SHIFT   0x03
 
#define WM8960_POWER3_RMIC_MASK   0x10
 
#define WM8960_POWER3_RMIC_SHIFT   0x04
 
#define WM8960_POWER3_ROMIX_MASK   0x04
 
#define WM8960_POWER3_ROMIX_SHIFT   0x02
 
typedef enum _wm8960_protocol wm8960_protocol_t
 The audio data transfer protocol choice. WM8960 only supports I2S format and PCM format. More...
 
#define WM8960_RADC   0x16
 
#define WM8960_RDAC   0xb
 
status_t WM8960_ReadReg (uint8_t reg, uint16_t *val)
 Read register from WM8960 using I2C. More...
 
#define WM8960_RESET   0xf
 
#define WM8960_RINPATH   0x21
 
#define WM8960_RINVOL   0x1
 
#define WM8960_ROUT1   0x3
 
#define WM8960_ROUT2   0x29
 
typedef enum _wm8960_route wm8960_route_t
 WM8960 data route. Only provide some typical data route, not all route listed. Note: Users cannot combine any routes, once a new route is set, the previous one would be replaced. More...
 
#define WM8960_ROUTMIX   0x25
 
status_t WM8960_SetDataRoute (wm8960_handle_t *handle, wm8960_route_t route)
 Set audio data route in WM8960. More...
 
status_t WM8960_SetJackDetect (wm8960_handle_t *handle, bool isEnabled)
 Enable/disable jack detect feature. More...
 
status_t WM8960_SetLeftInput (wm8960_handle_t *handle, wm8960_input_t input)
 Set left audio input source in WM8960. More...
 
void WM8960_SetMasterSlave (wm8960_handle_t *handle, bool master)
 Set WM8960 as master or slave. More...
 
status_t WM8960_SetModule (wm8960_handle_t *handle, wm8960_module_t module, bool isEnabled)
 Enable/disable expected devices. More...
 
status_t WM8960_SetMute (wm8960_handle_t *handle, wm8960_module_t module, bool isEnabled)
 Mute modules in WM8960. More...
 
status_t WM8960_SetPlay (wm8960_handle_t *handle, uint32_t playSource)
 SET the WM8960 play source. More...
 
status_t WM8960_SetProtocol (wm8960_handle_t *handle, wm8960_protocol_t protocol)
 Set the audio transfer protocol. More...
 
status_t WM8960_SetRightInput (wm8960_handle_t *handle, wm8960_input_t input)
 Set right audio input source in WM8960. More...
 
status_t WM8960_SetVolume (wm8960_handle_t *handle, wm8960_module_t module, uint32_t volume)
 Set the volume of different modules in WM8960. More...
 
status_t WM8960_WriteReg (wm8960_handle_t *handle, uint8_t reg, uint16_t val)
 Write register to WM8960 using I2C. More...
 


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