![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
Data Structures | |
struct | cs42448_audio_format_t |
cs42448 audio format More... | |
struct | cs42448_config_t |
Initialize structure of CS42448. More... | |
struct | cs42448_handle_t |
cs42448 handler More... | |
Macros | |
#define | CS42448_I2C_HANDLER_SIZE CODEC_I2C_MASTER_HANDLER_SIZE |
CS42448 handle size. | |
#define | CS42448_ID 0x01U |
Define the register address of CS42448. More... | |
#define | CS42448_AOUT_MAX_VOLUME_VALUE 0xFFU |
CS42448 volume setting range. | |
#define | CS42448_CACHEREGNUM 28U |
Cache register number. | |
#define | CS42448_I2C_ADDR 0x48U |
CS42448 I2C address. More... | |
#define | CS42448_I2C_BITRATE (100000U) |
CS42448 I2C baudrate. | |
Typedefs | |
typedef void(* | cs42448_reset )(bool state) |
cs42448 reset function pointer | |
Enumerations | |
enum | cs42448_func_mode { kCS42448_ModeMasterSSM = 0x0, kCS42448_ModeMasterDSM = 0x1, kCS42448_ModeMasterQSM = 0x2, kCS42448_ModeSlave = 0x3 } |
CS42448 support modes. More... | |
enum | cs42448_module_t { kCS42448_ModuleDACPair1 = 0x2, kCS42448_ModuleDACPair2 = 0x4, kCS42448_ModuleDACPair3 = 0x8, kCS42448_ModuleDACPair4 = 0x10, kCS42448_ModuleADCPair1 = 0x20, kCS42448_ModuleADCPair2 = 0x40 } |
Modules in CS42448 board. More... | |
enum | cs42448_bus_t { kCS42448_BusLeftJustified = 0x0, kCS42448_BusI2S = 0x1, kCS42448_BusRightJustified = 0x2, kCS42448_BusOL1 = 0x4, kCS42448_BusOL2 = 0x5, kCS42448_BusTDM = 0x6 } |
CS42448 supported audio bus type. More... | |
enum | { kCS42448_AOUT1 = 1U, kCS42448_AOUT2 = 2U, kCS42448_AOUT3 = 3U, kCS42448_AOUT4 = 4U, kCS42448_AOUT5 = 5U, kCS42448_AOUT6 = 6U, kCS42448_AOUT7 = 7U, kCS42448_AOUT8 = 8U } |
CS424488 play channel. More... | |
Functions | |
status_t | CS42448_Init (cs42448_handle_t *handle, cs42448_config_t *config) |
CS42448 initialize function. More... | |
status_t | CS42448_Deinit (cs42448_handle_t *handle) |
Deinit the CS42448 codec. More... | |
status_t | CS42448_SetProtocol (cs42448_handle_t *handle, cs42448_bus_t protocol, uint32_t bitWidth) |
Set the audio transfer protocol. More... | |
void | CS42448_SetFuncMode (cs42448_handle_t *handle, cs42448_func_mode mode) |
Set CS42448 to differernt working mode. More... | |
status_t | CS42448_SelectFunctionalMode (cs42448_handle_t *handle, cs42448_func_mode adcMode, cs42448_func_mode dacMode) |
Set CS42448 to differernt functional mode. More... | |
status_t | CS42448_SetAOUTVolume (cs42448_handle_t *handle, uint8_t channel, uint8_t volume) |
Set the volume of different modules in CS42448. More... | |
status_t | CS42448_SetAINVolume (cs42448_handle_t *handle, uint8_t channel, uint8_t volume) |
Set the volume of different modules in CS42448. More... | |
uint8_t | CS42448_GetAOUTVolume (cs42448_handle_t *handle, uint8_t channel) |
Get the volume of different AOUT channel in CS42448. More... | |
uint8_t | CS42448_GetAINVolume (cs42448_handle_t *handle, uint8_t channel) |
Get the volume of different AIN channel in CS42448. More... | |
status_t | CS42448_SetMute (cs42448_handle_t *handle, uint8_t channelMask) |
Mute modules in CS42448. More... | |
status_t | CS42448_SetChannelMute (cs42448_handle_t *handle, uint8_t channel, bool isMute) |
Mute channel modules in CS42448. More... | |
status_t | CS42448_SetModule (cs42448_handle_t *handle, cs42448_module_t module, bool isEnabled) |
Enable/disable expected devices. More... | |
status_t | CS42448_ConfigDataFormat (cs42448_handle_t *handle, uint32_t mclk, uint32_t sample_rate, uint32_t bits) |
Configure the data format of audio data. More... | |
status_t | CS42448_WriteReg (cs42448_handle_t *handle, uint8_t reg, uint8_t val) |
Write register to CS42448 using I2C. More... | |
status_t | CS42448_ReadReg (cs42448_handle_t *handle, uint8_t reg, uint8_t *val) |
Read register from CS42448 using I2C. More... | |
status_t | CS42448_ModifyReg (cs42448_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_CS42448_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
cs42448 driver version 2.0.0. More... | |
struct cs42448_audio_format_t |
Data Fields | |
uint32_t | mclk_HZ |
master clock frequency | |
uint32_t | sampleRate |
sample rate | |
uint32_t | bitWidth |
bit width | |
struct cs42448_config_t |
Data Fields | |
cs42448_bus_t | bus |
Audio transfer protocol. | |
cs42448_audio_format_t | format |
cs42448 audio format | |
cs42448_func_mode | ADCMode |
CS42448 ADC function mode. More... | |
cs42448_func_mode | DACMode |
CS42448 DAC function mode. More... | |
bool | master |
true is master, false is slave | |
codec_i2c_config_t | i2cConfig |
i2c bus configuration | |
uint8_t | slaveAddress |
slave address | |
cs42448_reset | reset |
reset function pointer | |
cs42448_func_mode cs42448_config_t::ADCMode |
cs42448_func_mode cs42448_config_t::DACMode |
struct cs42448_handle_t |
Data Fields | |
cs42448_config_t * | config |
cs42448 config pointer | |
uint8_t | i2cHandle [CS42448_I2C_HANDLER_SIZE] |
i2c handle pointer | |
#define FSL_CS42448_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
#define CS42448_ID 0x01U |
#define CS42448_I2C_ADDR 0x48U |
enum cs42448_func_mode |
enum cs42448_module_t |
enum cs42448_bus_t |
anonymous enum |
status_t CS42448_Init | ( | cs42448_handle_t * | handle, |
cs42448_config_t * | config | ||
) |
The second parameter is NULL to CS42448 in this version. If users want to change the settings, they have to use cs42448_write_reg() or cs42448_modify_reg() to set the register value of CS42448. Note: If the codec_config is NULL, it would initialize CS42448 using default settings. The default setting: codec_config->bus = kCS42448_BusI2S codec_config->ADCmode = kCS42448_ModeSlave codec_config->DACmode = kCS42448_ModeSlave
handle | CS42448 handle structure. |
config | CS42448 configuration structure. |
status_t CS42448_Deinit | ( | cs42448_handle_t * | handle | ) |
This function close all modules in CS42448 to save power.
handle | CS42448 handle structure pointer. |
status_t CS42448_SetProtocol | ( | cs42448_handle_t * | handle, |
cs42448_bus_t | protocol, | ||
uint32_t | bitWidth | ||
) |
CS42448 only supports I2S, left justified, right justified, PCM A, PCM B format.
handle | CS42448 handle structure. |
protocol | Audio data transfer protocol. |
bitWidth | bit width |
void CS42448_SetFuncMode | ( | cs42448_handle_t * | handle, |
cs42448_func_mode | mode | ||
) |
handle | CS42448 handle structure. |
mode | differenht working mode of CS42448. |
status_t CS42448_SelectFunctionalMode | ( | cs42448_handle_t * | handle, |
cs42448_func_mode | adcMode, | ||
cs42448_func_mode | dacMode | ||
) |
handle | CS42448 handle structure. |
adcMode | differenht working mode of CS42448. |
dacMode | differenht working mode of CS42448. |
status_t CS42448_SetAOUTVolume | ( | cs42448_handle_t * | handle, |
uint8_t | channel, | ||
uint8_t | volume | ||
) |
This function would set the volume of CS42448 modules. Uses need to appoint the module. The function assume that left channel and right channel has the same volume.
handle | CS42448 handle structure. |
channel | AOUT channel, it shall be 1~8. |
volume | Volume value need to be set. |
status_t CS42448_SetAINVolume | ( | cs42448_handle_t * | handle, |
uint8_t | channel, | ||
uint8_t | volume | ||
) |
This function would set the volume of CS42448 modules. Uses need to appoint the module. The function assume that left channel and right channel has the same volume.
handle | CS42448 handle structure. |
channel | AIN channel, it shall be 1~4. |
volume | Volume value need to be set. |
uint8_t CS42448_GetAOUTVolume | ( | cs42448_handle_t * | handle, |
uint8_t | channel | ||
) |
This function gets the volume of CS42448 modules. Uses need to appoint the module. The function assume that left channel and right channel has the same volume.
handle | CS42448 handle structure. |
channel | AOUT channel, it shall be 1~8. |
uint8_t CS42448_GetAINVolume | ( | cs42448_handle_t * | handle, |
uint8_t | channel | ||
) |
This function gets the volume of CS42448 modules. Uses need to appoint the module. The function assume that left channel and right channel has the same volume.
handle | CS42448 handle structure. |
channel | AIN channel, it shall be 1~4. |
status_t CS42448_SetMute | ( | cs42448_handle_t * | handle, |
uint8_t | channelMask | ||
) |
handle | CS42448 handle structure. |
channelMask | Channel mask for mute. Mute channel 0, it shall be 0x1, while mute channel 0 and 1, it shall be 0x3. Mute all channel, it shall be 0xFF. Each bit represent one channel, 1 means mute, 0 means unmute. |
status_t CS42448_SetChannelMute | ( | cs42448_handle_t * | handle, |
uint8_t | channel, | ||
bool | isMute | ||
) |
handle | CS42448 handle structure. |
channel | reference _cs42448_play_channel. |
isMute | true is mute, falase is unmute. |
status_t CS42448_SetModule | ( | cs42448_handle_t * | handle, |
cs42448_module_t | module, | ||
bool | isEnabled | ||
) |
handle | CS42448 handle structure. |
module | Module expected to enable. |
isEnabled | Enable or disable moudles. |
status_t CS42448_ConfigDataFormat | ( | cs42448_handle_t * | handle, |
uint32_t | mclk, | ||
uint32_t | sample_rate, | ||
uint32_t | bits | ||
) |
This function would configure the registers about the sample rate, bit depths.
handle | CS42448 handle structure pointer. |
mclk | Master clock frequency of I2S. |
sample_rate | Sample rate of audio file running in CS42448. CS42448 now supports 8k, 11.025k, 12k, 16k, 22.05k, 24k, 32k, 44.1k, 48k and 96k sample rate. |
bits | Bit depth of audio file (CS42448 only supports 16bit, 20bit, 24bit and 32 bit in HW). |
status_t CS42448_WriteReg | ( | cs42448_handle_t * | handle, |
uint8_t | reg, | ||
uint8_t | val | ||
) |
handle | CS42448 handle structure. |
reg | The register address in CS42448. |
val | Value needs to write into the register. |
status_t CS42448_ReadReg | ( | cs42448_handle_t * | handle, |
uint8_t | reg, | ||
uint8_t * | val | ||
) |
handle | CS42448 handle structure. |
reg | The register address in CS42448. |
val | Value written to. |
status_t CS42448_ModifyReg | ( | cs42448_handle_t * | handle, |
uint8_t | reg, | ||
uint8_t | mask, | ||
uint8_t | val | ||
) |
handle | CS42448 handle structure. |
reg | The register address in CS42448. |
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. |