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

Overview

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...
 

Data Structure Documentation

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
 

Field Documentation

cs42448_func_mode cs42448_config_t::ADCMode
cs42448_func_mode cs42448_config_t::DACMode
struct cs42448_handle_t

Data Fields

cs42448_config_tconfig
 cs42448 config pointer
 
uint8_t i2cHandle [CS42448_I2C_HANDLER_SIZE]
 i2c handle pointer
 

Macro Definition Documentation

#define FSL_CS42448_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
#define CS42448_ID   0x01U
#define CS42448_I2C_ADDR   0x48U

Enumeration Type Documentation

Enumerator
kCS42448_ModeMasterSSM 

master single speed mode

kCS42448_ModeMasterDSM 

master dual speed mode

kCS42448_ModeMasterQSM 

master quad speed mode

kCS42448_ModeSlave 

master single speed mode

Enumerator
kCS42448_ModuleDACPair1 

DAC pair1 (AOUT1 and AOUT2) module in CS42448.

kCS42448_ModuleDACPair2 

DAC pair2 (AOUT3 and AOUT4) module in CS42448.

kCS42448_ModuleDACPair3 

DAC pair3 (AOUT5 and AOUT6) module in CS42448.

kCS42448_ModuleDACPair4 

DAC pair4 (AOUT7 and AOUT8) module in CS42448.

kCS42448_ModuleADCPair1 

ADC pair1 (AIN1 and AIN2) module in CS42448.

kCS42448_ModuleADCPair2 

ADC pair2 (AIN3 and AIN4) module in CS42448.

Enumerator
kCS42448_BusLeftJustified 

Left justified format, up to 24 bits.

kCS42448_BusI2S 

I2S format, up to 24 bits.

kCS42448_BusRightJustified 

Right justified, can support 16bits and 24 bits.

kCS42448_BusOL1 

One-Line #1 mode.

kCS42448_BusOL2 

One-Line #2 mode.

kCS42448_BusTDM 

TDM mode.

anonymous enum

Enumerator
kCS42448_AOUT1 

aout1

kCS42448_AOUT2 

aout2

kCS42448_AOUT3 

aout3

kCS42448_AOUT4 

aout4

kCS42448_AOUT5 

aout5

kCS42448_AOUT6 

aout6

kCS42448_AOUT7 

aout7

kCS42448_AOUT8 

aout8

Function Documentation

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

Parameters
handleCS42448 handle structure.
configCS42448 configuration structure.
status_t CS42448_Deinit ( cs42448_handle_t handle)

This function close all modules in CS42448 to save power.

Parameters
handleCS42448 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.

Parameters
handleCS42448 handle structure.
protocolAudio data transfer protocol.
bitWidthbit width
void CS42448_SetFuncMode ( cs42448_handle_t handle,
cs42448_func_mode  mode 
)
Deprecated:
api, Do not use it anymore. It has been superceded by CS42448_SelectFunctionalMode.
Parameters
handleCS42448 handle structure.
modedifferenht working mode of CS42448.
status_t CS42448_SelectFunctionalMode ( cs42448_handle_t handle,
cs42448_func_mode  adcMode,
cs42448_func_mode  dacMode 
)
Parameters
handleCS42448 handle structure.
adcModedifferenht working mode of CS42448.
dacModedifferenht 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.

Parameters
handleCS42448 handle structure.
channelAOUT channel, it shall be 1~8.
volumeVolume 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.

Parameters
handleCS42448 handle structure.
channelAIN channel, it shall be 1~4.
volumeVolume 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.

Parameters
handleCS42448 handle structure.
channelAOUT 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.

Parameters
handleCS42448 handle structure.
channelAIN channel, it shall be 1~4.
status_t CS42448_SetMute ( cs42448_handle_t handle,
uint8_t  channelMask 
)
Parameters
handleCS42448 handle structure.
channelMaskChannel 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 
)
Parameters
handleCS42448 handle structure.
channelreference _cs42448_play_channel.
isMutetrue is mute, falase is unmute.
status_t CS42448_SetModule ( cs42448_handle_t handle,
cs42448_module_t  module,
bool  isEnabled 
)
Parameters
handleCS42448 handle structure.
moduleModule expected to enable.
isEnabledEnable 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.

Parameters
handleCS42448 handle structure pointer.
mclkMaster clock frequency of I2S.
sample_rateSample 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.
bitsBit 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 
)
Parameters
handleCS42448 handle structure.
regThe register address in CS42448.
valValue needs to write into the register.
status_t CS42448_ReadReg ( cs42448_handle_t handle,
uint8_t  reg,
uint8_t *  val 
)
Parameters
handleCS42448 handle structure.
regThe register address in CS42448.
valValue written to.
status_t CS42448_ModifyReg ( cs42448_handle_t handle,
uint8_t  reg,
uint8_t  mask,
uint8_t  val 
)
Parameters
handleCS42448 handle structure.
regThe register address in CS42448.
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.