![]() |
MCUXpresso SDK API Reference Manual
Rev 2.16.000
NXP Semiconductors
|
The ak4497 driver provides a codec control interface.
Data Structures | |
| struct | _ak4497_dsd_config |
| Initialize DSD mode structure of AK4497. More... | |
| struct | _ak4497_pcm_config |
| Initialize PCM mode structure of AK4497. More... | |
| struct | _ak4497_config |
| Initialize structure of AK4497. More... | |
| struct | _ak4497_handle |
| 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. | |
Typedefs | |
| typedef enum _ak4497_mode | ak4497_mode_t |
| The AK4497 playback mode. | |
|
typedef enum _ak4497_data_channel_mode | ak4497_data_channel_mode_t |
| The Data selection of L-channel and R-channel for DSD mode, defined by SELLR bit. | |
| typedef enum _ak4497_dsd_input_path | ak4497_dsd_input_path_t |
| The data path select for DSD mode. | |
| typedef enum _ak4497_dsd_mclk | ak4497_dsd_mclk_t |
| The MCLK select for DSD mode, defined by DCKS bit. | |
| typedef enum _ak4497_dsd_dclk | ak4497_dsd_dclk_t |
| The DCLK select for DSD mode, defined by DSDSEL[1:0]. | |
|
typedef enum _ak4497_dsd_playback_path | ak4497_dsd_playback_path_t |
| DSD playback path. | |
| typedef enum _ak4497_dsd_data_mute | ak4497_dsd_data_mute_t |
| DSD mute flag. | |
|
typedef enum _ak4497_dsd_dclk_polarity | ak4497_dsd_dclk_polarity_t |
| DSD bclk polarity. | |
|
typedef enum _ak4497_pcm_samplefreqmode | ak4497_pcm_samplefreqmode_t |
| The sampling frequency mode for PCM and EXDF mode, defined by CR01[AFSD], CR00[ACKS]. | |
|
typedef enum _ak4497_pcm_samplefreqselect | ak4497_pcm_samplefreqselect_t |
| The sampling speed select, defined by DFS[2:0]. | |
|
typedef enum _ak4497_pcm_sdata_format | ak4497_pcm_sdata_format_t |
| The audio data interface modes, defined by DIF[2:0]. | |
| typedef enum _ak4497_pcm_tdm_mode | ak4497_pcm_tdm_mode_t |
| The TDM mode select, defined by TDM[1:0]. | |
| typedef enum _ak4497_pcm_sds_select | ak4497_pcm_sds_select_t |
| The audio data slot selection, defined by SDS[2:0]. | |
|
typedef enum _ak4497_module_ctrl_cmd | ak4497_module_ctrl_cmd_t |
| audio codec module control cmd | |
| typedef struct _ak4497_dsd_config | ak4497_dsd_config_t |
| Initialize DSD mode structure of AK4497. | |
| typedef struct _ak4497_pcm_config | ak4497_pcm_config_t |
| Initialize PCM mode structure of AK4497. | |
| typedef struct _ak4497_config | ak4497_config_t |
| Initialize structure of AK4497. | |
| typedef struct _ak4497_handle | ak4497_handle_t |
| ak4497 codec handler | |
Enumerations | |
| enum | _ak4497_mode |
| The AK4497 playback mode. | |
| enum | _ak4497_data_channel_mode { 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 { kAK4497_Path0 = 0x0, kAK4497_Path1 = 0x1 } |
| The data path select for DSD mode. More... | |
| enum | _ak4497_dsd_mclk { kAK4497_mclk512fs = 0x0, kAK4497_mclk768fs = 0x1 } |
| The MCLK select for DSD mode, defined by DCKS bit. More... | |
| enum | _ak4497_dsd_dclk { 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 { kAK4497_NormalPath = 0x0, kAK4497_VolumeBypass = 0x1 } |
| DSD playback path. More... | |
| enum | _ak4497_dsd_data_mute |
| DSD mute flag. | |
| enum | _ak4497_dsd_dclk_polarity { kAK4497_FallingEdge = 0x0, kAK4497_RisingEdge = 0x1 } |
| DSD bclk polarity. More... | |
| enum | _ak4497_pcm_samplefreqmode { 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 { 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 { 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 { 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 |
| The audio data slot selection, defined by SDS[2:0]. | |
| enum | _ak4497_module_ctrl_cmd { 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. | |
| struct _ak4497_dsd_config |
| struct _ak4497_pcm_config |
| struct _ak4497_config |
Data Fields | |
| uint8_t | slaveAddress |
| code device slave address | |
| codec_i2c_config_t | i2cConfig |
| i2c bus configuration | |
| struct _ak4497_handle |
Data Fields | |
| ak4497_config_t * | config |
| ak4497 config pointer | |
| uint8_t | i2cHandle [AK4497_I2C_HANDLER_SIZE] |
| i2c handle | |
| #define AK4497_CONTROL1 (0x00U) |
| #define AK4497_CONTROL1_RSTN_MASK (0x1U) |
| #define AK4497_I2C_ADDR (0x11U) |
| enum _ak4497_dsd_mclk |
| enum _ak4497_dsd_dclk |
| enum _ak4497_pcm_tdm_mode |
| anonymous enum |
| void AK4497_DefaultConfig | ( | ak4497_config_t * | config | ) |
| config | AK4497 configure structure. |
| status_t AK4497_Init | ( | ak4497_handle_t * | handle, |
| ak4497_config_t * | config | ||
| ) |
| handle | AK4497 handle structure. |
| config | AK4497 configure structure. |
| status_t AK4497_SetEncoding | ( | ak4497_handle_t * | handle, |
| uint8_t | format | ||
| ) |
This function would configure the codec playback mode.
| handle | AK4497 handle structure pointer. |
| format | info. |
| 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.
| handle | AK4497 handle structure pointer. |
| mclk | system clock of the codec which can be generated by MCLK or PLL output. |
| sampleRate | Sample rate of audio file running in AK4497. |
| bitWidth | Bit 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.
| handle | AK4497 handle structure. |
| value | Volume 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.
| handle | AK4497 handle structure. |
| value | volume value |
| status_t AK4497_ModuleControl | ( | ak4497_handle_t * | handle, |
| ak4497_module_ctrl_cmd_t | cmd, | ||
| uint32_t | data | ||
| ) |
| handle | AK4497 handle structure pointer. |
| cmd | module control command, support cmd kAK4497_ModuleSwitchDigitalInterface. |
| data | control 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.
| handle | AK4497 handle structure pointer. |
| status_t AK4497_WriteReg | ( | ak4497_handle_t * | handle, |
| uint8_t | reg, | ||
| uint8_t | val | ||
| ) |
| handle | AK4497 handle structure. |
| reg | The register address in AK4497. |
| val | Value needs to write into the register. |
| status_t AK4497_ReadReg | ( | ak4497_handle_t * | handle, |
| uint8_t | reg, | ||
| uint8_t * | val | ||
| ) |
| handle | AK4497 handle structure. |
| reg | The register address in AK4497. |
| val | Value written to. |
| status_t AK4497_ModifyReg | ( | ak4497_handle_t * | handle, |
| uint8_t | reg, | ||
| uint8_t | mask, | ||
| uint8_t | val | ||
| ) |
| handle | AK4497 handle structure. |
| reg | The register address in AK4497. |
| mask | The mask code for the bits want to write. The bit you want to write should be 0. |
| val | Value needs to write into the register. |