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

Overview

Data Structures

struct  ak4497_dsd_config_t
 Initialize DSD mode structure of AK4497. More...
 
struct  ak4497_pcm_config_t
 Initialize PCM mode structure of AK4497. More...
 
struct  ak4497_config_t
 Initialize structure of AK4497. More...
 
struct  ak4497_handle_t
 ak4497 codec handler More...
 

Macros

#define AK4497_I2C_HANDLER_SIZE   CODEC_I2C_MASTER_HANDLER_SIZE
 ak4497 handle size
 
#define AK4497_CONTROL1   (0x00U)
 define the registers offset of AK4497. More...
 
#define AK4497_CONTROL1_RSTN_MASK   (0x1U)
 define BIT info of AK4497. More...
 
#define AK4497_I2C_ADDR   (0x11U)
 AK4497 I2C address. More...
 
#define AK4497_I2C_BITRATE   (100000U)
 AK4497 i2c baudrate.
 

Enumerations

enum  ak4497_mode_t
 The AK4497 playback mode.
 
enum  ak4497_data_channel_mode_t {
  kAK4497_NormalMode = 0x0,
  kAK4497_ExchangeMode = 0x1
}
 The Data selection of L-channel and R-channel for DSD mode, defined by SELLR bit. More...
 
enum  ak4497_dsd_input_path_t {
  kAK4497_Path0 = 0x0,
  kAK4497_Path1 = 0x1
}
 The data path select for DSD mode. More...
 
enum  ak4497_dsd_mclk_t {
  kAK4497_mclk512fs = 0x0,
  kAK4497_mclk768fs = 0x1
}
 The MCLK select for DSD mode, defined by DCKS bit. More...
 
enum  ak4497_dsd_dclk_t {
  kAK4497_dclk64fs = 0x0,
  kAK4497_dclk128fs = 0x1,
  kAK4497_dclk256fs = 0x2,
  kAK4497_dclk512fs = 0x3
}
 The DCLK select for DSD mode, defined by DSDSEL[1:0]. More...
 
enum  ak4497_dsd_playback_path_t {
  kAK4497_NormalPath = 0x0,
  kAK4497_VolumeBypass = 0x1
}
 DSD playback path. More...
 
enum  ak4497_dsd_data_mute_t
 DSD mute flag.
 
enum  ak4497_dsd_dclk_polarity_t {
  kAK4497_FallingEdge = 0x0,
  kAK4497_RisingEdge = 0x1
}
 DSD bclk polarity. More...
 
enum  ak4497_pcm_samplefreqmode_t {
  kAK4497_ManualSettingMode = 0x0,
  kAK4497_AutoSettingMode = 0x1,
  kAK4497_FsAutoDetectMode = 0x2
}
 The sampling frequency mode for PCM and EXDF mode, defined by CR01[AFSD], CR00[ACKS]. More...
 
enum  ak4497_pcm_samplefreqselect_t {
  kAK4497_NormalSpeed = 0x0,
  kAK4497_DoubleSpeed = 0x1,
  kAK4497_QuadSpeed = 0x2,
  kAK4497_OctSpeed = 0x4,
  kAK4497_HexSpeed = 0x5
}
 The sampling speed select, defined by DFS[2:0]. More...
 
enum  ak4497_pcm_sdata_format_t {
  kAK4497_16BitLSB = 0x0,
  kAK4497_20BitLSB = 0x1,
  kAK4497_24BitMSB = 0x2,
  kAK4497_16_24BitI2S = 0x3,
  kAK4497_24BitLSB = 0x4,
  kAK4497_32BitLSB = 0x5,
  kAK4497_32BitMSB = 0x6,
  kAK4497_32BitI2S = 0x7
}
 The audio data interface modes, defined by DIF[2:0]. More...
 
enum  ak4497_pcm_tdm_mode_t {
  kAK4497_Normal = 0x0,
  kAK4497_TDM128 = 0x1,
  kAK4497_TDM256 = 0x2,
  kAK4497_TDM512 = 0x3
}
 The TDM mode select, defined by TDM[1:0]. More...
 
enum  ak4497_pcm_sds_select_t
 The audio data slot selection, defined by SDS[2:0].
 
enum  ak4497_module_ctrl_cmd_t { kAK4497_ModuleSwitchI2SInInterface = 0U }
 audio codec module control cmd More...
 
enum  {
  kAK4497_ModuleI2SInInterfacePCM = 0U,
  kAK4497_ModuleI2SInInterfaceDSD = 1U
}
 audio codec module digital interface More...
 

Functions

void AK4497_DefaultConfig (ak4497_config_t *config)
 Default initializes AK4497. More...
 
status_t AK4497_Init (ak4497_handle_t *handle, ak4497_config_t *config)
 Initializes AK4497. More...
 
status_t AK4497_SetEncoding (ak4497_handle_t *handle, uint8_t format)
 Set the codec PCM mode or DSD mode based on the format info. More...
 
status_t AK4497_ConfigDataFormat (ak4497_handle_t *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth)
 Configure the data format of audio data. More...
 
status_t AK4497_SetVolume (ak4497_handle_t *handle, uint8_t value)
 Set the volume of different modules in AK4497. More...
 
status_t AK4497_GetVolume (ak4497_handle_t *handle, uint8_t *value)
 Get the volume of different modules in AK4497. More...
 
status_t AK4497_ModuleControl (ak4497_handle_t *handle, ak4497_module_ctrl_cmd_t cmd, uint32_t data)
 AK4497 codec module control. More...
 
status_t AK4497_Deinit (ak4497_handle_t *handle)
 Deinit the AK4497 codec. More...
 
status_t AK4497_WriteReg (ak4497_handle_t *handle, uint8_t reg, uint8_t val)
 Write register to AK4497 using I2C. More...
 
status_t AK4497_ReadReg (ak4497_handle_t *handle, uint8_t reg, uint8_t *val)
 Read register from AK4497 using I2C. More...
 
status_t AK4497_ModifyReg (ak4497_handle_t *handle, uint8_t reg, uint8_t mask, uint8_t val)
 Modify some bits in the register using I2C. More...
 

Driver version

#define FSL_AK4497_DRIVER_VERSION   (MAKE_VERSION(2, 1, 2))
 CLOCK driver version 2.1.2.
 

Data Structure Documentation

struct ak4497_dsd_config_t
struct ak4497_pcm_config_t
struct ak4497_config_t

Data Fields

uint8_t slaveAddress
 code device slave address
 
codec_i2c_config_t i2cConfig
 i2c bus configuration
 
struct ak4497_handle_t

Data Fields

ak4497_config_tconfig
 ak4497 config pointer
 
uint8_t i2cHandle [AK4497_I2C_HANDLER_SIZE]
 i2c handle
 

Macro Definition Documentation

#define AK4497_CONTROL1   (0x00U)
#define AK4497_CONTROL1_RSTN_MASK   (0x1U)
#define AK4497_I2C_ADDR   (0x11U)

Enumeration Type Documentation

Enumerator
kAK4497_NormalMode 

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

kAK4497_ExchangeMode 

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

Enumerator
kAK4497_Path0 

Pin 16,17,19 used.

kAK4497_Path1 

Pin 3,4,5 used.

Enumerator
kAK4497_mclk512fs 

MCLK equals 512fs.

kAK4497_mclk768fs 

MCLK equals 768fs.

Enumerator
kAK4497_dclk64fs 

DCLK equals 64fs.

kAK4497_dclk128fs 

DCLK equals 128fs.

kAK4497_dclk256fs 

DCLK equals 256fs.

kAK4497_dclk512fs 

DCLK equals 512fs.

Enumerator
kAK4497_NormalPath 

Normal path mode.

kAK4497_VolumeBypass 

Volume Bypass mode.

Enumerator
kAK4497_FallingEdge 

DSD data is output from DCLK falling edge.

kAK4497_RisingEdge 

DSD data is output from DCLK rising edge.

Enumerator
kAK4497_ManualSettingMode 

Manual setting mode.

kAK4497_AutoSettingMode 

Auto setting mode.

kAK4497_FsAutoDetectMode 

Auto detect mode.

Enumerator
kAK4497_NormalSpeed 

8kHZ ~ 54kHZ

kAK4497_DoubleSpeed 

54kHZ ~ 108kHZ

kAK4497_QuadSpeed 

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

kAK4497_OctSpeed 

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

kAK4497_HexSpeed 

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

Enumerator
kAK4497_16BitLSB 

16-bit LSB justified

kAK4497_20BitLSB 

20-bit LSB justified

kAK4497_24BitMSB 

24-bit MSB justified

kAK4497_16_24BitI2S 

16 and 24-bit I2S compatible

kAK4497_24BitLSB 

24-bit LSB justified

kAK4497_32BitLSB 

32-bit LSB justified

kAK4497_32BitMSB 

32-bit MSB justified

kAK4497_32BitI2S 

32-bit I2S compatible

Enumerator
kAK4497_Normal 

Normal mode.

kAK4497_TDM128 

BCLK is fixed to 128fs.

kAK4497_TDM256 

BCLK is fixed to 256fs.

kAK4497_TDM512 

BCLK is fixed to 512fs.

Enumerator
kAK4497_ModuleSwitchI2SInInterface 

module digital interface siwtch.

anonymous enum

Enumerator
kAK4497_ModuleI2SInInterfacePCM 

Pcm interface.

kAK4497_ModuleI2SInInterfaceDSD 

DSD interface.

Function Documentation

void AK4497_DefaultConfig ( ak4497_config_t config)
Parameters
configAK4497 configure structure.
status_t AK4497_Init ( ak4497_handle_t handle,
ak4497_config_t config 
)
Parameters
handleAK4497 handle structure.
configAK4497 configure structure.
status_t AK4497_SetEncoding ( ak4497_handle_t handle,
uint8_t  format 
)

This function would configure the codec playback mode.

Parameters
handleAK4497 handle structure pointer.
formatinfo.
status_t AK4497_ConfigDataFormat ( ak4497_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
handleAK4497 handle structure pointer.
mclksystem clock of the codec which can be generated by MCLK or PLL output.
sampleRateSample rate of audio file running in AK4497.
bitWidthBit depth of audio file.
status_t AK4497_SetVolume ( ak4497_handle_t handle,
uint8_t  value 
)

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

Parameters
handleAK4497 handle structure.
valueVolume value need to be set.
status_t AK4497_GetVolume ( ak4497_handle_t handle,
uint8_t *  value 
)

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

Parameters
handleAK4497 handle structure.
valuevolume value
Returns
value value of the module.
status_t AK4497_ModuleControl ( ak4497_handle_t handle,
ak4497_module_ctrl_cmd_t  cmd,
uint32_t  data 
)
Parameters
handleAK4497 handle structure pointer.
cmdmodule control command, support cmd kAK4497_ModuleSwitchDigitalInterface.
datacontrol data, support data kCODEC_ModuleDigitalInterfacePCM/kCODEC_ModuleDigitalInterfaceDSD.
status_t AK4497_Deinit ( ak4497_handle_t handle)

This function close all modules in AK4497 to save power.

Parameters
handleAK4497 handle structure pointer.
status_t AK4497_WriteReg ( ak4497_handle_t handle,
uint8_t  reg,
uint8_t  val 
)
Parameters
handleAK4497 handle structure.
regThe register address in AK4497.
valValue needs to write into the register.
status_t AK4497_ReadReg ( ak4497_handle_t handle,
uint8_t  reg,
uint8_t *  val 
)
Parameters
handleAK4497 handle structure.
regThe register address in AK4497.
valValue written to.
status_t AK4497_ModifyReg ( ak4497_handle_t handle,
uint8_t  reg,
uint8_t  mask,
uint8_t  val 
)
Parameters
handleAK4497 handle structure.
regThe register address in AK4497.
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.