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

Overview

Data Structures

struct  ak4458_dac_config_t
 Initialize DAC configuration structure of AK4458 since it has 4 DAC modules. More...
 
struct  ak4458_dsd_config_t
 Initialize DSD mode structure of AK4458. More...
 
struct  ak4458_pcm_config_t
 Initialize PCM mode structure of AK4458. More...
 
struct  ak4458_config_t
 Initialize structure of AK4458. More...
 

Macros

#define AK4458_CONTROL1   (0x00)
 define the registers offset of AK4458. More...
 
#define AK4458_CONTROL1_RSTN_MASK   (0x1U)
 define the registers offset of AK4458. More...
 
#define AK4458_I2C_ADDR   (0x10)
 AK4458 I2C address. More...
 
#define AK4458_DAC_NUM   (4U)
 The numbers of DAC for AK4458.
 

Enumerations

enum  ak4458_mode_t
 The AK4458 playback mode.
 
enum  ak4458_dac_selection_t
 The DAC output enable selection of AK4458 AK4458 has 4 DAC modules, using DacMask to select which one to be used.
 
enum  ak4458_output_phase_mode_t {
  kAK4458_AllDisable = 0x0,
  kAK4458_JustRchEnable = 0x1,
  kAK4458_JustLchEnable = 0x2,
  kAK4458_AllEnable = 0x3
}
 The AOUTR output phase inverting, defined by INVL,INVR. More...
 
enum  ak4458_dac_mode_t {
  kAK4458_Stereo = 0x0,
  kAK4458_Mono = 0x1
}
 The DAC mode, defined by MONO bit. More...
 
enum  ak4458_data_channel_mode_t {
  kAK4458_NormalMode = 0x0,
  kAK4458_ExchangeMode = 0x1
}
 The Data selection of L-channel and R-channel for DSD mode, defined by SELLR bit. More...
 
enum  ak4458_dsd_mclk_t {
  kAK4458_mclk512fs = 0x0,
  kAK4458_mclk768fs = 0x1
}
 The MCLK select for DSD mode, defined by DCKS bit. More...
 
enum  ak4458_dsd_dclk_t {
  kAK4458_dclk64fs = 0x0,
  kAK4458_dclk128fs = 0x1,
  kAK4458_dclk256fs = 0x2
}
 The DCLK select for DSD mode, defined by DSDSEL[1:0]. More...
 
enum  ak4458_dsd_playback_path_t {
  kAK4458_NormalPath = 0x0,
  kAK4458_VolumeBypass = 0x1
}
 DSD playback path. More...
 
enum  ak4458_dsd_data_mute_t
 DSD mute flag.
 
enum  ak4458_dsd_dclk_polarity_t {
  kAK4458_FallingEdge = 0x0,
  kAK4458_RisingEdge = 0x1
}
 DSD bclk polarity. More...
 
enum  ak4458_pcm_samplefreqmode_t {
  kAK4458_ManualSettingMode = 0x0,
  kAK4458_AutoSettingMode = 0x1
}
 The sampling frequency mode for PCM and EXDF mode, defined by CR01[AFSD], CR00[ACKS]. More...
 
enum  ak4458_pcm_samplefreqselect_t {
  kAK4458_NormalSpeed = 0x0,
  kAK4458_DoubleSpeed = 0x1,
  kAK4458_QuadSpeed = 0x2,
  kAK4458_OctSpeed = 0x4,
  kAK4458_HexSpeed = 0x5
}
 The sampling speed select, defined by DFS[2:0]. More...
 
enum  ak4458_pcm_sdata_format_t {
  kAK4458_16BitLSB = 0x0,
  kAK4458_20BitLSB = 0x1,
  kAK4458_24BitMSB = 0x2,
  kAK4458_16_24BitI2S = 0x3,
  kAK4458_24BitLSB = 0x4,
  kAK4458_32BitLSB = 0x5,
  kAK4458_32BitMSB = 0x6,
  kAK4458_32BitI2S = 0x7
}
 The audio data interface modes, defined by DIF[2:0]. More...
 
enum  ak4458_pcm_tdm_mode_t {
  kAK4458_Normal = 0x0,
  kAK4458_TDM128 = 0x1,
  kAK4458_TDM256 = 0x2,
  kAK4458_TDM512 = 0x3
}
 The TDM mode select, defined by TDM[1:0]. More...
 
enum  ak4458_pcm_sds_select_t
 The audio data slot selection, defined by SDS[2:0].
 
enum  ak4458_pcm_deemphasis_mode_t {
  kAK4458_Fs44100 = 0x0,
  kAK4458_Off = 0x1,
  kAK4458_Fs48000 = 0x2,
  kAK4458_Fs32000 = 0x3
}
 The De-emphasis filter, defined by DEM[1:0], the mode only valid in PCM Normal Speed Mode. More...
 

Functions

void AK4458_DefaultConfig (ak4458_config_t *config)
 Default initializes AK4458. More...
 
status_t AK4458_Init (codec_handle_t *handle, void *config)
 Initializes AK4458. More...
 
status_t AK4458_SetEncoding (codec_handle_t *handle, uint8_t format)
 Set the codec PCM mode or DSD mode based on the format info. More...
 
status_t AK4458_ConfigDataFormat (codec_handle_t *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth)
 Configure the data format of audio data. More...
 
status_t AK4458_SetDAC1Volume (codec_handle_t *handle, uint8_t value)
 Set the volume of different modules in AK4458. More...
 
status_t AK4458_GetDAC1Volume (codec_handle_t *handle, uint8_t *value)
 Get the volume of DAC1 in AK4458. More...
 
status_t AK4458_ModuleControl (codec_handle_t *handle, codec_module_ctrl_cmd_t cmd, uint32_t data)
 AK4497 codec module control. More...
 
status_t AK4458_Deinit (codec_handle_t *handle)
 Deinit the AK4458 codec. More...
 
status_t AK4458_WriteReg (codec_handle_t *handle, uint8_t reg, uint8_t val)
 Write register to AK4458 using I2C. More...
 
status_t AK4458_ReadReg (codec_handle_t *handle, uint8_t reg, uint8_t *val)
 Read register from AK4458 using I2C. More...
 
status_t AK4458_ModifyReg (codec_handle_t *handle, uint8_t reg, uint8_t mask, uint8_t val)
 Modify some bits in the register using I2C. More...
 

Variables

const codec_operation_t ak4458_ops
 aak4458 operation function pointer
 

Driver version

#define FSL_AK4458_DRIVER_VERSION   (MAKE_VERSION(2, 1, 0))
 CLOCK driver version 2.1.0.
 

Data Structure Documentation

struct ak4458_dac_config_t
struct ak4458_dsd_config_t
struct ak4458_pcm_config_t
struct ak4458_config_t

Macro Definition Documentation

#define AK4458_CONTROL1   (0x00)
#define AK4458_CONTROL1_RSTN_MASK   (0x1U)
#define AK4458_I2C_ADDR   (0x10)

Enumeration Type Documentation

Enumerator
kAK4458_AllDisable 

Disable.

kAK4458_JustRchEnable 

Just R-channel enable output phase inverting.

kAK4458_JustLchEnable 

Just L-channel enable output phase inverting.

kAK4458_AllEnable 

All enable output phase inverting.

Enumerator
kAK4458_Stereo 

Sterreo mode.

kAK4458_Mono 

MONO mode.

Enumerator
kAK4458_NormalMode 

L-channel output L-channel data, R-channel output R-channel data.

kAK4458_ExchangeMode 

L-channel output R-channel data, R-channel output L-channel data.

Enumerator
kAK4458_mclk512fs 

MCLK equals 512fs.

kAK4458_mclk768fs 

MCLK equals 768fs.

Enumerator
kAK4458_dclk64fs 

DCLK equals 64fs.

kAK4458_dclk128fs 

DCLK equals 128fs.

kAK4458_dclk256fs 

DCLK equals 256fs.

Enumerator
kAK4458_NormalPath 

Normal path mode.

kAK4458_VolumeBypass 

Volume Bypass mode.

Enumerator
kAK4458_FallingEdge 

DSD data is output from DCLK falling edge.

kAK4458_RisingEdge 

DSD data is output from DCLK rising edge.

Enumerator
kAK4458_ManualSettingMode 

Manual setting mode.

kAK4458_AutoSettingMode 

Auto setting mode.

Enumerator
kAK4458_NormalSpeed 

8kHZ ~ 54kHZ

kAK4458_DoubleSpeed 

54kHZ ~ 108kHZ

kAK4458_QuadSpeed 

120kHZ ~ 216kHZ, note that value 3 also stands for Quad Speed Mode

kAK4458_OctSpeed 

384kHZ, note that value 6 also stands for Oct Speed Mode

kAK4458_HexSpeed 

768kHZ, note that value 7 also stands for Hex Speed Mode

Enumerator
kAK4458_16BitLSB 

16-bit LSB justified

kAK4458_20BitLSB 

20-bit LSB justified

kAK4458_24BitMSB 

24-bit MSB justified

kAK4458_16_24BitI2S 

16 and 24-bit I2S compatible

kAK4458_24BitLSB 

24-bit LSB justified

kAK4458_32BitLSB 

32-bit LSB justified

kAK4458_32BitMSB 

32-bit MSB justified

kAK4458_32BitI2S 

32-bit I2S compatible

Enumerator
kAK4458_Normal 

Normal mode.

kAK4458_TDM128 

BCLK is fixed to 128fs.

kAK4458_TDM256 

BCLK is fixed to 256fs.

kAK4458_TDM512 

BCLK is fixed to 512fs.

Enumerator
kAK4458_Fs44100 

Filter is available for 44.1KHzNormal mode.

kAK4458_Off 

OFF.

kAK4458_Fs48000 

Filter is available for 48KHz.

kAK4458_Fs32000 

Filter is available for 32KHz.

Function Documentation

void AK4458_DefaultConfig ( ak4458_config_t config)
Parameters
configAK4458 configure structure.
status_t AK4458_Init ( codec_handle_t *  handle,
void *  config 
)
Parameters
handleAK4458 handle structure.
configAK4458 configure structure.
status_t AK4458_SetEncoding ( codec_handle_t *  handle,
uint8_t  format 
)

This function would configure the codec playback mode.

Parameters
handleAK4458 handle structure pointer.
formatinfo.
status_t AK4458_ConfigDataFormat ( codec_handle_t *  handle,
uint32_t  mclk,
uint32_t  sampleRate,
uint32_t  bitWidth 
)

This function would configure the registers about the sample rate, bit depths.

Parameters
handleAK4458 handle structure pointer.
mclksystem clock of the codec which can be generated by MCLK or PLL output.
sampleRateSample rate of audio file running in AK4458.
bitWidthBit depth of audio file.
status_t AK4458_SetDAC1Volume ( codec_handle_t *  handle,
uint8_t  value 
)

This function would set the volume of AK4458 modules. Users need to appoint the module. The function assume that left channel and right channel has the same volume.

Parameters
handleAK4458 handle structure.
valueVolume value need to be set.
status_t AK4458_GetDAC1Volume ( codec_handle_t *  handle,
uint8_t *  value 
)

This function gets the volume of DAC1 in AK4458. Users need to appoint the module. The function assume that left channel and right channel has the same volume.

Parameters
handleAK4458 handle structure.
valueDAC volume value
Returns
value value of the module.
status_t AK4458_ModuleControl ( codec_handle_t *  handle,
codec_module_ctrl_cmd_t  cmd,
uint32_t  data 
)
Parameters
handleAK4497 handle structure pointer.
cmdmodule control command, support cmd kCODEC_ModuleSwitchDigitalInterface.
datacontrol data, support data kCODEC_ModuleDigitalInterfacePCM/kCODEC_ModuleDigitalInterfaceDSD.
status_t AK4458_Deinit ( codec_handle_t *  handle)

This function close all modules in AK4458 to save power.

Parameters
handleAK4458 handle structure pointer.
status_t AK4458_WriteReg ( codec_handle_t *  handle,
uint8_t  reg,
uint8_t  val 
)
Parameters
handleAK4458 handle structure.
regThe register address in AK4458.
valValue needs to write into the register.
status_t AK4458_ReadReg ( codec_handle_t *  handle,
uint8_t  reg,
uint8_t *  val 
)
Parameters
handleAK4458 handle structure.
regThe register address in AK4458.
valValue written to.
status_t AK4458_ModifyReg ( codec_handle_t *  handle,
uint8_t  reg,
uint8_t  mask,
uint8_t  val 
)
Parameters
handleAK4458 handle structure.
regThe register address in AK4458.
maskThe mask code for the bits want to write. The bit you want to write should be 0.
valValue needs to write into the register.