PDK API Guide for J721E

Introduction

Application Interfaces provided by PCM3168 Audio Codec library.

Functions

Board_STATUS Board_pcm3168Config (void *handle, uint8_t slaveAddr)
 This function is used to configure the PCM3168A codec. More...
 
Board_STATUS Board_pcm3168RegRead (void *handle, uint8_t slaveAddr, uint8_t regAddr, uint8_t *regData)
 This function is used to read the Codec register value. More...
 
Board_STATUS Board_pcm3168RegWrite (void *handle, uint8_t slaveAddr, uint8_t regAddr, uint8_t *regData)
 This function is used to write the register data to the PCM Codec. More...
 
Board_STATUS Board_pcm3168ModeCtrl (void *handle, uint8_t slaveAddr, uint8_t modeCtrl)
 This function is used to set the mode control register reset to the default value 0 - Writes default value to mode control register 1 - Normal operation. More...
 
Board_STATUS Board_pcm3168Reset (void *handle, uint8_t slaveAddr, uint8_t modeCtrl)
 This function is used to control the system reset 0 - Restarts the system by resyncronizing the system clock and sampling clock 1 - Normal operation. More...
 
Board_STATUS Board_pcm3168SamplingModeSel (void *handle, uint8_t slaveAddr, uint8_t samplingMode, uint8_t cfgMode)
 This function is used to control the sampling mode of DAC/ADC 00 - Auto 01 - Single rate 10 - Dual rate 11 - Reserved for ADC 11 - Quad rate for DAC. More...
 
Board_STATUS Board_pcm3168DACPwrSaveModeSel (void *handle, uint8_t slaveAddr, uint8_t pwrSaveMode)
 This function is used to control the power save mode of DAC/ADC operation 0 - Power-save enable mode 1 - Power-save disable mode. More...
 
Board_STATUS Board_pcm3168ADCPwrSaveModeSel (void *handle, uint8_t slaveAddr, uint8_t pwrSaveMode)
 This function is used to control the power save mode of ADC operation 0 - normal operation 1 - power-save mode. More...
 
Board_STATUS Board_pcm3168MasterSlaveModeSel (void *handle, uint8_t slaveAddr, uint8_t mscfgMode, uint8_t cfgMode)
 This function is used to control the audio interface mode. More...
 
Board_STATUS Board_pcm3168AudioFmtSel (void *handle, uint8_t slaveAddr, uint8_t fmt, uint8_t cfgMode)
 This function is used to control the audio interface format. 000 - 24-bit I2S format 001 - 24-bit left-justified format 010 - 24-bit right-justified format 011 - 16-bit right-justified format 100 - 24-bit I2S mode DSP format 101 - 24-bit left-justified mode DSP format 110 - 24-bit I2S mode TDM format 111 - 24-bit left-justified mode TDM format Below modes support only for DAC configuration 1000 - 24-bit high-speed I2S mode TDM format 1001 - 24-bit high-speed left-justified mode TDM format. More...
 
Board_STATUS Board_pcm3168DACOperationalCtrl (void *handle, uint8_t slaveAddr, uint8_t opMode)
 This function is used to control the DAC operation mode. More...
 
Board_STATUS Board_pcm3168SoftMuteCtrl (void *handle, uint8_t slaveAddr, uint8_t chanNum, uint8_t muteCtrl, uint8_t cfgMode)
 This function is used to enable or disable the Soft Mute function for the corresponding DAC/ADC outputs 0 - Mute Disabled 1 - Mute Enabled. More...
 
Board_STATUS Board_pcm3168AttnLevelSet (void *handle, uint8_t slaveAddr, uint8_t chanNum, uint8_t attLevel, uint8_t cfgMode)
 This function is used to set the attenuation level for each channel independently. More...
 

Function Documentation

Board_STATUS Board_pcm3168Config ( void *  handle,
uint8_t  slaveAddr 
)

This function is used to configure the PCM3168A codec.

All the registers of PCM code shall be configured to default value by this function.

Parameters
handle[IN] I2C driver handle
slaveAddr[IN] Codec slave address
Returns
BOARD_SOK in case of success or appropriate error code.
Board_STATUS Board_pcm3168RegRead ( void *  handle,
uint8_t  slaveAddr,
uint8_t  regAddr,
uint8_t *  regData 
)

This function is used to read the Codec register value.

Parameters
handle[IN] I2C instance handle.
slaveAddr[IN] Codec Slave Address
regAddr[IN] register Address of the Codec
regData[IN/OUT] register Data
Returns
BOARD_SOK in case of success or appropriate error code.
Board_STATUS Board_pcm3168RegWrite ( void *  handle,
uint8_t  slaveAddr,
uint8_t  regAddr,
uint8_t *  regData 
)

This function is used to write the register data to the PCM Codec.

Parameters
handle[IN] I2C instance handle.
slaveAddr[IN] Codec Slave Address
regAddr[IN] register Address of the Codec
regData[OUT] register Data
Returns
BOARD_SOK in case of success or appropriate error code.
Board_STATUS Board_pcm3168ModeCtrl ( void *  handle,
uint8_t  slaveAddr,
uint8_t  modeCtrl 
)

This function is used to set the mode control register reset to the default value 0 - Writes default value to mode control register 1 - Normal operation.


Reset Control register - 0x40

Parameters
handle[IN] I2C driver handle
slaveAddr[IN] Codec slave address
modeCtrl[IN] Mode control register reset for the ADC and DAC
Returns
BOARD_SOK in case of success or appropriate error code.
Board_STATUS Board_pcm3168Reset ( void *  handle,
uint8_t  slaveAddr,
uint8_t  modeCtrl 
)

This function is used to control the system reset 0 - Restarts the system by resyncronizing the system clock and sampling clock 1 - Normal operation.


Reset Control register - 0x40

Parameters
handle[IN] I2C driver handle
slaveAddr[IN] Codec slave address
modeCtrl[IN] System reset for the ADC and DAC
Returns
BOARD_SOK in case of success or appropriate error code.
Board_STATUS Board_pcm3168SamplingModeSel ( void *  handle,
uint8_t  slaveAddr,
uint8_t  samplingMode,
uint8_t  cfgMode 
)

This function is used to control the sampling mode of DAC/ADC 00 - Auto 01 - Single rate 10 - Dual rate 11 - Reserved for ADC 11 - Quad rate for DAC.


DAC : Reset Control register - 0x40
ADC : ADC Sampling Mode register - 0x50

Parameters
handle[IN] I2C driver handle
slaveAddr[IN] Codec slave address
samplingMode[IN] Sampling mode select
cfgMode[IN] Configure ADC/DAC channel
Returns
BOARD_SOK in case of success or appropriate error code.
Board_STATUS Board_pcm3168DACPwrSaveModeSel ( void *  handle,
uint8_t  slaveAddr,
uint8_t  pwrSaveMode 
)

This function is used to control the power save mode of DAC/ADC operation 0 - Power-save enable mode 1 - Power-save disable mode.


DAC : DAC Control 1 register - 0x41
ADC : ADC Control 2 register - 0x52

Parameters
handle[IN] I2C driver handle
slaveAddr[IN] Codec slave address
pwrSaveMode[IN] Power-save mode select
Returns
BOARD_SOK in case of success or appropriate error code.
Board_STATUS Board_pcm3168ADCPwrSaveModeSel ( void *  handle,
uint8_t  slaveAddr,
uint8_t  pwrSaveMode 
)

This function is used to control the power save mode of ADC operation 0 - normal operation 1 - power-save mode.


ADC Control 2 register - 0x52

Parameters
handle[IN] I2C driver handle
slaveAddr[IN] Codec slave address
pwrSaveMode[IN] Power-save mode select
Returns
BOARD_SOK in case of success or appropriate error code.
Board_STATUS Board_pcm3168MasterSlaveModeSel ( void *  handle,
uint8_t  slaveAddr,
uint8_t  mscfgMode,
uint8_t  cfgMode 
)

This function is used to control the audio interface mode.

000 - SlaveMode 001 - Master mode, 768 fS 010 - Master mode, 512 fS 011 - Master mode, 384 fS 100 - Master mode, 256 fS Below modes supports only for DAC operation 101 - Master mode, 192 fS 110 - Master mode, 128 fS


DAC: DAC Control 1 register - 0x41
ADC: ADC Control 1 register - 0x51

Parameters
handle[IN] I2C driver handle
slaveAddr[IN] Codec slave address
mscfgMode[IN] Master/slave mode select
cfgMode[IN] Configure ADC/DAC channel
Returns
BOARD_SOK in case of success or appropriate error code.
Board_STATUS Board_pcm3168AudioFmtSel ( void *  handle,
uint8_t  slaveAddr,
uint8_t  fmt,
uint8_t  cfgMode 
)

This function is used to control the audio interface format. 000 - 24-bit I2S format 001 - 24-bit left-justified format 010 - 24-bit right-justified format 011 - 16-bit right-justified format 100 - 24-bit I2S mode DSP format 101 - 24-bit left-justified mode DSP format 110 - 24-bit I2S mode TDM format 111 - 24-bit left-justified mode TDM format Below modes support only for DAC configuration 1000 - 24-bit high-speed I2S mode TDM format 1001 - 24-bit high-speed left-justified mode TDM format.


DAC: DAC Control 1 register - 0x41
ADC: ADC Control 1 register - 0x51

Parameters
handle[IN] I2C driver handle
slaveAddr[IN] Codec slave address
fmt[IN] Audio format
cfgMode[IN] Configure ADC/DAC channel
Returns
BOARD_SOK in case of success or appropriate error code.
Board_STATUS Board_pcm3168DACOperationalCtrl ( void *  handle,
uint8_t  slaveAddr,
uint8_t  opMode 
)

This function is used to control the DAC operation mode.

In operation disable mode,the DAC output is cut off from DIN with a fade-out sequence, and the internal DAC data is reset. DAC output is forced into VCOMDA if PSMDA = 1 DAC output is forced into AGNDDA and goes into a power-down state if PSMDA = 0. In normal operating mode, a fade-in sequence is applied on the DAC output in resume process. 0 - Normal mode 1 - Operation disable with or without power save


DAC Control 2 register - 0x42

Parameters
handle[IN] I2C driver handle
slaveAddr[IN] Codec slave address
opMode[IN] Enable/Disable the power-save mode
Returns
BOARD_SOK in case of success or appropriate error code.
Board_STATUS Board_pcm3168SoftMuteCtrl ( void *  handle,
uint8_t  slaveAddr,
uint8_t  chanNum,
uint8_t  muteCtrl,
uint8_t  cfgMode 
)

This function is used to enable or disable the Soft Mute function for the corresponding DAC/ADC outputs 0 - Mute Disabled 1 - Mute Enabled.


DAC: DAC Soft Mute register - 0x44
ADC: ADC Soft Mute register - 0x55

Parameters
handle[IN] I2C driver handle
slaveAddr[IN] Codec slave address
chanNum[IN] Channel Number to configure 0 - All channels by default
muteCtrl[IN] Soft mute enable or disable
cfgMode[IN] Configure ADC/DAC channel
Returns
BOARD_SOK in case of success or appropriate error code.
Board_STATUS Board_pcm3168AttnLevelSet ( void *  handle,
uint8_t  slaveAddr,
uint8_t  chanNum,
uint8_t  attLevel,
uint8_t  cfgMode 
)

This function is used to set the attenuation level for each channel independently.


DAC :DAC Attenuation register - 0x47
ADC :ADC Attenuation register - 0x58

Parameters
handle[IN] I2C driver handle
slaveAddr[IN] Codec slave address
chanNum[IN] Channel Number to configure 0 - All channels by default
attLevel[IN] Attenuation level
cfgMode[IN] Configure ADC/DAC channel
Returns
BOARD_SOK in case of success or appropriate error code.