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

Overview

Data Structures

struct  da7212_pll_config_t
 da7212 pll configuration More...
 
struct  da7212_audio_format_t
 da7212 audio format More...
 
struct  da7212_config_t
 DA7212 configure structure. More...
 
struct  da7212_handle_t
 da7212 codec handler More...
 

Macros

#define DA7212_I2C_HANDLER_SIZE   CODEC_I2C_MASTER_HANDLER_SIZE
 da7212 handle size
 
#define DA7212_ADDRESS   (0x1A)
 DA7212 I2C address.
 
#define DA7212_HEADPHONE_MAX_VOLUME_VALUE   0x3FU
 da7212 volume setting range
 

Enumerations

enum  da7212_Input_t {
  kDA7212_Input_AUX = 0x0,
  kDA7212_Input_MIC1_Dig,
  kDA7212_Input_MIC1_An,
  kDA7212_Input_MIC2
}
 DA7212 input source select. More...
 
enum  _da7212_play_channel {
  kDA7212_HeadphoneLeft = 1U,
  kDA7212_HeadphoneRight = 2U,
  kDA7212_Speaker = 4U
}
 da7212 play channel More...
 
enum  da7212_Output_t {
  kDA7212_Output_HP = 0x0,
  kDA7212_Output_SP
}
 DA7212 output device select. More...
 
enum  _da7212_module {
  kDA7212_ModuleADC,
  kDA7212_ModuleDAC,
  kDA7212_ModuleHeadphone,
  kDA7212_ModuleSpeaker
}
 DA7212 module. More...
 
enum  da7212_dac_source_t {
  kDA7212_DACSourceADC = 0x0U,
  kDA7212_DACSourceInputStream = 0x3U
}
 DA7212 functionality. More...
 
enum  da7212_volume_t {
  kDA7212_DACGainMute = 0x7,
  kDA7212_DACGainM72DB = 0x17,
  kDA7212_DACGainM60DB = 0x1F,
  kDA7212_DACGainM54DB = 0x27,
  kDA7212_DACGainM48DB = 0x2F,
  kDA7212_DACGainM42DB = 0x37,
  kDA7212_DACGainM36DB = 0x3F,
  kDA7212_DACGainM30DB = 0x47,
  kDA7212_DACGainM24DB = 0x4F,
  kDA7212_DACGainM18DB = 0x57,
  kDA7212_DACGainM12DB = 0x5F,
  kDA7212_DACGainM6DB = 0x67,
  kDA7212_DACGain0DB = 0x6F,
  kDA7212_DACGain6DB = 0x77,
  kDA7212_DACGain12DB = 0x7F
}
 DA7212 volume. More...
 
enum  da7212_protocol_t {
  kDA7212_BusI2S = 0x0,
  kDA7212_BusLeftJustified,
  kDA7212_BusRightJustified,
  kDA7212_BusDSPMode
}
 The audio data transfer protocol choice. More...
 
enum  da7212_sys_clk_source_t {
  kDA7212_SysClkSourceMCLK = 0U,
  kDA7212_SysClkSourcePLL = 1U << 14
}
 da7212 system clock source More...
 
enum  da7212_pll_clk_source_t { kDA7212_PLLClkSourceMCLK = 0U }
 DA7212 pll clock source. More...
 
enum  da7212_pll_out_clk_t {
  kDA7212_PLLOutputClk11289600 = 11289600U,
  kDA7212_PLLOutputClk12288000 = 12288000U
}
 DA7212 output clock frequency. More...
 
enum  da7212_master_bits_t {
  kDA7212_MasterBits32PerFrame = 0U,
  kDA7212_MasterBits64PerFrame = 1U,
  kDA7212_MasterBits128PerFrame = 2U,
  kDA7212_MasterBits256PerFrame = 3U
}
 master mode bits per frame More...
 

Functions

status_t DA7212_Init (da7212_handle_t *handle, da7212_config_t *codecConfig)
 DA7212 initialize function. More...
 
status_t DA7212_ConfigAudioFormat (da7212_handle_t *handle, uint32_t masterClock_Hz, uint32_t sampleRate_Hz, uint32_t dataBits)
 Set DA7212 audio format. More...
 
status_t DA7212_SetPLLConfig (da7212_handle_t *handle, da7212_pll_config_t *config)
 DA7212 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...
 
void DA7212_ChangeHPVolume (da7212_handle_t *handle, da7212_volume_t volume)
 Set DA7212 playback volume. More...
 
void DA7212_Mute (da7212_handle_t *handle, bool isMuted)
 Mute or unmute DA7212. More...
 
void DA7212_ChangeInput (da7212_handle_t *handle, da7212_Input_t DA7212_Input)
 Set the input data source of DA7212. More...
 
void DA7212_ChangeOutput (da7212_handle_t *handle, da7212_Output_t DA7212_Output)
 Set the output device of DA7212. More...
 
status_t DA7212_SetChannelVolume (da7212_handle_t *handle, uint32_t channel, uint32_t volume)
 Set module volume. More...
 
status_t DA7212_SetChannelMute (da7212_handle_t *handle, uint32_t channel, bool isMute)
 Set module mute. More...
 
status_t DA7212_SetProtocol (da7212_handle_t *handle, da7212_protocol_t protocol)
 Set protocol for DA7212. More...
 
status_t DA7212_SetMasterModeBits (da7212_handle_t *handle, uint32_t bitWidth)
 Set master mode bits per frame for DA7212. More...
 
status_t DA7212_WriteRegister (da7212_handle_t *handle, uint8_t u8Register, uint8_t u8RegisterData)
 Write a register for DA7212. More...
 
status_t DA7212_ReadRegister (da7212_handle_t *handle, uint8_t u8Register, uint8_t *pu8RegisterData)
 Get a register value of DA7212. More...
 
status_t DA7212_Deinit (da7212_handle_t *handle)
 Deinit DA7212. More...
 

Driver version

#define FSL_DA7212_DRIVER_VERSION   (MAKE_VERSION(2, 2, 2))
 CLOCK driver version 2.2.2. More...
 

Data Structure Documentation

struct da7212_pll_config_t

Data Fields

da7212_pll_clk_source_t source
 pll reference clock source
 
uint32_t refClock_HZ
 pll reference clock frequency
 
da7212_pll_out_clk_t outputClock_HZ
 pll output clock frequency
 
struct da7212_audio_format_t

Data Fields

uint32_t mclk_HZ
 master clock frequency
 
uint32_t sampleRate
 sample rate
 
uint32_t bitWidth
 bit width
 
bool isBclkInvert
 bit clock intervet
 
struct da7212_config_t

Data Fields

bool isMaster
 If DA7212 is master, true means master, false means slave. More...
 
da7212_protocol_t protocol
 Audio bus format, can be I2S, LJ, RJ or DSP mode. More...
 
da7212_dac_source_t dacSource
 DA7212 data source. More...
 
da7212_audio_format_t format
 audio format
 
uint8_t slaveAddress
 device address
 
codec_i2c_config_t i2cConfig
 i2c configuration
 
da7212_sys_clk_source_t sysClkSource
 system clock source
 
da7212_pll_config_tpll
 pll configuration
 

Field Documentation

bool da7212_config_t::isMaster
da7212_protocol_t da7212_config_t::protocol
da7212_dac_source_t da7212_config_t::dacSource
struct da7212_handle_t

Data Fields

da7212_config_tconfig
 da7212 config pointer
 
uint8_t i2cHandle [DA7212_I2C_HANDLER_SIZE]
 i2c handle
 

Macro Definition Documentation

#define FSL_DA7212_DRIVER_VERSION   (MAKE_VERSION(2, 2, 2))

Enumeration Type Documentation

Enumerator
kDA7212_Input_AUX 

Input from AUX.

kDA7212_Input_MIC1_Dig 

Input from MIC1 Digital.

kDA7212_Input_MIC1_An 

Input from Mic1 Analog.

kDA7212_Input_MIC2 

Input from MIC2.

Enumerator
kDA7212_HeadphoneLeft 

headphone left

kDA7212_HeadphoneRight 

headphone right

kDA7212_Speaker 

speaker channel

Enumerator
kDA7212_Output_HP 

Output to headphone.

kDA7212_Output_SP 

Output to speaker.

Enumerator
kDA7212_ModuleADC 

module ADC

kDA7212_ModuleDAC 

module DAC

kDA7212_ModuleHeadphone 

module headphone

kDA7212_ModuleSpeaker 

module speaker

Enumerator
kDA7212_DACSourceADC 

DAC source from ADC.

kDA7212_DACSourceInputStream 

DAC source from.

Enumerator
kDA7212_DACGainMute 

Mute DAC.

kDA7212_DACGainM72DB 

DAC volume -72db.

kDA7212_DACGainM60DB 

DAC volume -60db.

kDA7212_DACGainM54DB 

DAC volume -54db.

kDA7212_DACGainM48DB 

DAC volume -48db.

kDA7212_DACGainM42DB 

DAC volume -42db.

kDA7212_DACGainM36DB 

DAC volume -36db.

kDA7212_DACGainM30DB 

DAC volume -30db.

kDA7212_DACGainM24DB 

DAC volume -24db.

kDA7212_DACGainM18DB 

DAC volume -18db.

kDA7212_DACGainM12DB 

DAC volume -12db.

kDA7212_DACGainM6DB 

DAC volume -6bb.

kDA7212_DACGain0DB 

DAC volume +0db.

kDA7212_DACGain6DB 

DAC volume +6db.

kDA7212_DACGain12DB 

DAC volume +12db.

Enumerator
kDA7212_BusI2S 

I2S Type.

kDA7212_BusLeftJustified 

Left justified.

kDA7212_BusRightJustified 

Right Justified.

kDA7212_BusDSPMode 

DSP mode.

Enumerator
kDA7212_SysClkSourceMCLK 

da7212 system clock soure from MCLK

kDA7212_SysClkSourcePLL 

da7212 system clock soure from pLL

Enumerator
kDA7212_PLLClkSourceMCLK 

DA7212 PLL clock source from MCLK.

Enumerator
kDA7212_PLLOutputClk11289600 

output 112896000U

kDA7212_PLLOutputClk12288000 

output 12288000U

Enumerator
kDA7212_MasterBits32PerFrame 

master mode bits32 per frame

kDA7212_MasterBits64PerFrame 

master mode bits64 per frame

kDA7212_MasterBits128PerFrame 

master mode bits128 per frame

kDA7212_MasterBits256PerFrame 

master mode bits256 per frame

Function Documentation

status_t DA7212_Init ( da7212_handle_t handle,
da7212_config_t codecConfig 
)
Parameters
handleDA7212 handle pointer.
codecConfigCodec configure structure. This parameter can be NULL, if NULL, set as default settings. The default setting:
* sgtl_init_t codec_config
* codec_config.route = kDA7212_RoutePlayback
* codec_config.bus = kDA7212_BusI2S
* codec_config.isMaster = false
*
status_t DA7212_ConfigAudioFormat ( da7212_handle_t handle,
uint32_t  masterClock_Hz,
uint32_t  sampleRate_Hz,
uint32_t  dataBits 
)
Parameters
handleDA7212 handle pointer.
masterClock_HzMaster clock frequency in Hz. If DA7212 is slave, use the frequency of master, if DA7212 as master, it should be 1228000 while sample rate frequency is 8k/12K/16K/24K/32K/48K/96K, 11289600 whie sample rate is 11.025K/22.05K/44.1K
sampleRate_HzSample rate frequency in Hz.
dataBitsHow many bits in a word of a audio frame, DA7212 only supports 16/20/24/32 bits.
status_t DA7212_SetPLLConfig ( da7212_handle_t handle,
da7212_pll_config_t config 
)
Parameters
handleDA7212 handler pointer.
configPLL configuration pointer.
void DA7212_ChangeHPVolume ( da7212_handle_t handle,
da7212_volume_t  volume 
)
Parameters
handleDA7212 handle pointer.
volumeThe volume of playback.
void DA7212_Mute ( da7212_handle_t handle,
bool  isMuted 
)
Parameters
handleDA7212 handle pointer.
isMutedTrue means mute, false means unmute.
void DA7212_ChangeInput ( da7212_handle_t handle,
da7212_Input_t  DA7212_Input 
)
Parameters
handleDA7212 handle pointer.
DA7212_InputInput data source.
void DA7212_ChangeOutput ( da7212_handle_t handle,
da7212_Output_t  DA7212_Output 
)
Parameters
handleDA7212 handle pointer.
DA7212_OutputOutput device of DA7212.
status_t DA7212_SetChannelVolume ( da7212_handle_t handle,
uint32_t  channel,
uint32_t  volume 
)
Parameters
handleDA7212 handle pointer.
channelshoule be a value of _da7212_channel.
volumevolume range 0 - 0x3F mapped to range -57dB - 6dB.
status_t DA7212_SetChannelMute ( da7212_handle_t handle,
uint32_t  channel,
bool  isMute 
)
Parameters
handleDA7212 handle pointer.
channelshoule be a value of _da7212_channel.
isMutetrue is mute, false is unmute.
status_t DA7212_SetProtocol ( da7212_handle_t handle,
da7212_protocol_t  protocol 
)
Parameters
handleDA7212 handle pointer.
protocolda7212_protocol_t.
status_t DA7212_SetMasterModeBits ( da7212_handle_t handle,
uint32_t  bitWidth 
)
Parameters
handleDA7212 handle pointer.
bitWidthaudio data bitwidth.
status_t DA7212_WriteRegister ( da7212_handle_t handle,
uint8_t  u8Register,
uint8_t  u8RegisterData 
)
Parameters
handleDA7212 handle pointer.
u8RegisterDA7212 register address to be written.
u8RegisterDataData to be written into regsiter
status_t DA7212_ReadRegister ( da7212_handle_t handle,
uint8_t  u8Register,
uint8_t *  pu8RegisterData 
)
Parameters
handleDA7212 handle pointer.
u8RegisterDA7212 register address to be read.
pu8RegisterDataPointer where the read out value to be stored.
status_t DA7212_Deinit ( da7212_handle_t handle)
Parameters
handleDA7212 handle pointer.