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

Overview

Data Structures

struct  tfa9896BiquadM_t
 biquadm More...
 
struct  tfa9896FilterM_t
 filter More...
 
struct  tfa9896_StateInfoLive_t
 status info live More...
 
struct  tfa9896SPKRBST_SpkrModel_t
 speaker mode More...
 
struct  tfa9896_audio_format_t
 Audio format configuration. More...
 
struct  tfa9896_config_t
 Initialize structure of TFA9896. More...
 
struct  tfa9896_handle_t
 tfa9896 handler More...
 

Macros

#define TFA_I2C_BITRATE   (400000U)
 TFA I2S bit clock.
 
#define TFA9896_I2C_HANDLER_SIZE   (CODEC_I2C_MASTER_HANDLER_SIZE)
 tfa9896 handle size
 

Typedefs

typedef int int24
 type definition
 

Enumerations

enum  _tfa9896_error {
  kStatus_TFA9896_Ok = MAKE_STATUS(kStatusGroup_Generic, 0),
  kStatus_TFA9896_DSP_not_running = MAKE_STATUS(kStatusGroup_Generic, 1),
  kStatus_TFA9896_Bad_Parameter = MAKE_STATUS(kStatusGroup_Generic, 2),
  kStatus_TFA9896_NotOpen,
  kStatus_TFA9896_OutOfHandles = MAKE_STATUS(kStatusGroup_Generic, 4),
  kStatus_TFA9896_StateTimedOut,
  kStatus_TFA9896_RpcBase = MAKE_STATUS(kStatusGroup_Generic, 100),
  kStatus_TFA9896_RpcBusy = MAKE_STATUS(kStatusGroup_Generic, 101),
  kStatus_TFA9896_RpcModId = MAKE_STATUS(kStatusGroup_Generic, 102),
  kStatus_TFA9896_RpcParamId = MAKE_STATUS(kStatusGroup_Generic, 103),
  kStatus_TFA9896_RpcInfoId = MAKE_STATUS(kStatusGroup_Generic, 104),
  kStatus_TFA9896_RpcNotAllowedSpeaker,
  kStatus_TFA9896_Not_Implemented = MAKE_STATUS(kStatusGroup_Generic, 106),
  kStatus_TFA9896_Not_Supported = MAKE_STATUS(kStatusGroup_Generic, 107),
  kStatus_TFA9896_I2C_Fatal,
  kStatus_TFA9896_I2C_NonFatal,
  kStatus_TFA9896_Other = MAKE_STATUS(kStatusGroup_Generic, 1000)
}
 status flag More...
 
enum  tfa9896_DMEM_t {
  DMEM_PMEM = 0,
  DMEM_XMEM = 1,
  DMEM_YMEM = 2,
  DMEM_IOMEM = 3
}
 mute dmem More...
 
enum  tfa9896_mute_t
 mute status
 
enum  tfa9896_SpeakerBoostStatusFlagsLive_t
 speaker boost status flag
 
enum  tfa9896_bit_width_t { ktfa9896_BitWidth16 = 0x0 }
 Bit width. More...
 
enum  tfa9896_protocol_t { kTFA9896_ProtocolI2S = 0x2 }
 The audio data transfer protocol. More...
 
enum  tfa9896_sample_rate_t
 Sample rate. More...
 

Functions

uint16_t TFA9896_isFactory (tfa9896_handle_t *handle)
 check if TFA9896 Hardware factory registers are set . More...
 
uint16_t TFA9896_GetBits (tfa9896_handle_t *handle, const uint16_t bf)
 get TFA9896 bitfield value . More...
 
status_t TFA9896_SetBits (tfa9896_handle_t *handle, const uint16_t bf, const uint16_t value)
 set TFA9896 bitfield value . More...
 
status_t TFA9896_DSP_System_Stable (tfa9896_handle_t *handle, int *ready)
 wait for DSP to be stable before RPC communictaons . More...
 
status_t TFA9896_ClearOneTimeCalibration (tfa9896_handle_t *handle)
 clear MTP regsiters to prepare calibraion . More...
 
status_t TFA9896_SetOneTimeCalibration (tfa9896_handle_t *handle)
 set calibartion once registers. More...
 
status_t TFA9896_SetFactoryValues (tfa9896_handle_t *handle)
 set MTP factory values . More...
 
status_t TFA9896_CheckICROMversion (tfa9896_handle_t *handle, const unsigned char patchheader[])
 check DSP patch suitability to the TFA9896 device . More...
 
status_t TFA9896_ProcessPatchFile (tfa9896_handle_t *handle, int length, const unsigned char *bytes)
 load DSP patch to DSP memeory . More...
 
status_t TFA9896_DSPWriteTables (tfa9896_handle_t *handle)
 set DSP memery table . More...
 
status_t TFA9896_DspWriteConfig (tfa9896_handle_t *handle, int length, const unsigned char *pConfigBytes)
 write DSP config file to DSP memery . More...
 
status_t TFA9896_DspWriteSpeakerParameters (tfa9896_handle_t *handle, int length, const unsigned char *pSpeakerBytes)
 write DSP speaker file to DSP memery . More...
 
status_t TFA9896_DspWritePreset (tfa9896_handle_t *handle, int length, const unsigned char *pPresetBytes)
 write DSP preset file to DSP memery . More...
 
status_t TFA9896_Write_FilterBank (tfa9896_handle_t *handle, tfa9896FilterM_t *filter)
 write DSP filter params to DSP memery . More...
 
status_t TFA9896_WaitCalibrateDone (tfa9896_handle_t *handle, int *calibrateDone)
 wait calibration to be finalized . More...
 
status_t TFA9896_DspGetCalibrationImpedance (tfa9896_handle_t *handle, float *pRe25)
 retrieve calibration impedance value and expose it to user. More...
 
status_t TFA9896_PrintCalibration (tfa9896_handle_t *handle)
 print calibration value . More...
 
status_t TFA9896_DSP_Write_Mem_Word (tfa9896_handle_t *handle, unsigned short address, int value, int memtype)
 write word to IOMEM DSP memeory . More...
 
status_t TFA9896_ReadRegister (tfa9896_handle_t *handle, uint8_t subaddress, unsigned short *value)
 read a hardware regsiter . More...
 
status_t TFA9896_WriteRegister (tfa9896_handle_t *handle, uint8_t subaddress, uint16_t value)
 write a hardware register . More...
 
status_t TFA9896_SetMute (tfa9896_handle_t *handle, tfa9896_mute_t mute)
 mute/unmute TFA9896 codec More...
 
status_t TFA9896_SetVolume (tfa9896_handle_t *handle, uint8_t volume_level)
 Set amplifier volume. More...
 
status_t TFA9896_SetOVPBypass (tfa9896_handle_t *handle)
 set OVP in bypass . More...
 
status_t TFA9896_Init (tfa9896_handle_t *handle, tfa9896_config_t *tfa9896Config)
 Initialize TFA9896. More...
 
status_t TFA9896_Deinit (tfa9896_handle_t *handle)
 DeInitilize TFA9896. More...
 
status_t TFA9896_SetFormat (tfa9896_handle_t *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth)
 set audio input format . More...
 
void TFA9896_Powerdown (tfa9896_handle_t *handle, int powerdown)
 power-on/off TFA98xx device. More...
 

Data Structure Documentation

struct tfa9896BiquadM_t
struct tfa9896FilterM_t

Data Fields

uint8_t type
 (== enum FilterTypes, assure 8bits length)
 
struct tfa9896_StateInfoLive_t
struct tfa9896SPKRBST_SpkrModel_t
struct tfa9896_audio_format_t

Data Fields

tfa9896_sample_rate_t sampleRate
 Sample rate.
 
tfa9896_bit_width_t bitWidth
 Bit width.
 
struct tfa9896_config_t

Data Fields

tfa9896_protocol_t protocol
 Audio transfer protocol.
 
tfa9896_audio_format_t format
 Audio format.
 
bool master
 true is master, false is slave
 
uint8_t slaveAddress
 slave address
 
codec_i2c_config_t i2cConfig
 i2c bus configuration
 
uint8_t calibrate
 user handles calibration!
 
struct tfa9896_handle_t

Data Fields

tfa9896_config_tconfig
 tfa9896 config pointer
 

Enumeration Type Documentation

Enumerator
kStatus_TFA9896_Ok 

kStatus_TFA9896_Ok = 0,

kStatus_TFA9896_DSP_not_running 

communication with the DSP failed, presumably because DSP not running kStatus_TFA9896_DSP_not_running

kStatus_TFA9896_Bad_Parameter 

kStatus_TFA9896_Bad_Parameter

kStatus_TFA9896_NotOpen 

kStatus_TFA9896_NotOpen, the given handle is not open

kStatus_TFA9896_OutOfHandles 

too many handles

kStatus_TFA9896_StateTimedOut 

the expected response did not occur within the expected time Tfa9896_Error_StateTimedOut, the expected response did not occur within the expected time

kStatus_TFA9896_RpcBase 

kStatus_TFA9896_RpcBase = 100,

kStatus_TFA9896_RpcBusy 

kStatus_TFA9896_RpcBusy = 101,

kStatus_TFA9896_RpcModId 

kStatus_TFA9896_RpcModId = 102,

kStatus_TFA9896_RpcParamId 

kStatus_TFA9896_RpcParamId = 103

kStatus_TFA9896_RpcInfoId 

kStatus_TFA9896_RpcInfoId = 104

kStatus_TFA9896_RpcNotAllowedSpeaker 

kStatus_TFA9896_RpcNotAllowedSpeaker = 105

kStatus_TFA9896_Not_Implemented 

kStatus_TFA9896_Not_Implemented

kStatus_TFA9896_Not_Supported 

kStatus_TFA9896_Not_Supported

kStatus_TFA9896_I2C_Fatal 

Fatal I2C error occurred kStatus_TFA9896_I2C_Fatal.

kStatus_TFA9896_I2C_NonFatal 

Nonfatal I2C error, and retry count reached.

kStatus_TFA9896_Other 

kStatus_TFA9896_Other = 1000

Enumerator
DMEM_PMEM 

pmem

DMEM_XMEM 

xmem

DMEM_YMEM 

ymem

DMEM_IOMEM 

iomem

Enumerator
ktfa9896_BitWidth16 

16 bits

Enumerator
kTFA9896_ProtocolI2S 

I2S type.

Function Documentation

uint16_t TFA9896_isFactory ( tfa9896_handle_t handle)
Parameters
handleTFA9896 codec handle.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
uint16_t TFA9896_GetBits ( tfa9896_handle_t handle,
const uint16_t  bf 
)
Parameters
handleTFA9896 codec handle.
bfto be read
Returns
Returns 16 bits read value.
status_t TFA9896_SetBits ( tfa9896_handle_t handle,
const uint16_t  bf,
const uint16_t  value 
)
Parameters
handleTFA9896 codec handle.
bfto be set
valueto be set
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_DSP_System_Stable ( tfa9896_handle_t handle,
int *  ready 
)
Parameters
handleTFA9896 codec handle.
readyDSP system stable status.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_ClearOneTimeCalibration ( tfa9896_handle_t handle)
Parameters
handleTFA9896 codec handle.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_SetOneTimeCalibration ( tfa9896_handle_t handle)
Parameters
handleTFA9896 codec handle.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_SetFactoryValues ( tfa9896_handle_t handle)
Parameters
handleTFA9896 codec handle.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_CheckICROMversion ( tfa9896_handle_t handle,
const unsigned char  patchheader[] 
)
Parameters
handleTFA9896 codec handle.
patchheaderpattern to check with.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_ProcessPatchFile ( tfa9896_handle_t handle,
int  length,
const unsigned char *  bytes 
)
Parameters
handleTFA9896 codec handle.
lengthof the patch.
bytesthat contains patch data.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_DSPWriteTables ( tfa9896_handle_t handle)
Parameters
handleTFA9896 codec handle.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_DspWriteConfig ( tfa9896_handle_t handle,
int  length,
const unsigned char *  pConfigBytes 
)
Parameters
handleTFA9896 codec handle.
lengthof the config.
pConfigBytesthat contains config data.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_DspWriteSpeakerParameters ( tfa9896_handle_t handle,
int  length,
const unsigned char *  pSpeakerBytes 
)
Parameters
handleTFA9896 codec handle.
lengthof the speaker data.
pSpeakerBytesthat contains speaker data.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_DspWritePreset ( tfa9896_handle_t handle,
int  length,
const unsigned char *  pPresetBytes 
)
Parameters
handleTFA9896 codec handle.
lengthof the preset data.
pPresetBytesthat contains preset data.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_Write_FilterBank ( tfa9896_handle_t handle,
tfa9896FilterM_t filter 
)
Parameters
handleTFA9896 codec handle.
filterof the filter data.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_WaitCalibrateDone ( tfa9896_handle_t handle,
int *  calibrateDone 
)
Parameters
handleTFA9896 codec handle.
calibrateDonecalibration done flag.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_DspGetCalibrationImpedance ( tfa9896_handle_t handle,
float *  pRe25 
)
Parameters
handleTFA9896 codec handle.
pRe25calibration value.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_PrintCalibration ( tfa9896_handle_t handle)
Parameters
handleTFA9896 codec handle.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_DSP_Write_Mem_Word ( tfa9896_handle_t handle,
unsigned short  address,
int  value,
int  memtype 
)
Parameters
handleTFA9896 codec handle.
addressto be written.
valuevalue write.
memtypeto be written.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_ReadRegister ( tfa9896_handle_t handle,
uint8_t  subaddress,
unsigned short *  value 
)
Parameters
handleTFA9896 codec handle.
subaddressregister address.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
Parameters
handleTFA98xx codec handle.
subaddressregister address.
valueread out register value.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_WriteRegister ( tfa9896_handle_t handle,
uint8_t  subaddress,
uint16_t  value 
)
Parameters
handleTFA9896 codec handle.
subaddressregister address.
valuevalue to write.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
Parameters
handleTFA98xx codec handle.
subaddressregister address.
valuevalue to write.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_SetMute ( tfa9896_handle_t handle,
tfa9896_mute_t  mute 
)

mute/unmute TFA98XX codec

Parameters
handleTFA9896 codec handle.
mutemute mode.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
Parameters
handleTFA98xx codec handle.
mutemute mode.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_SetVolume ( tfa9896_handle_t handle,
uint8_t  volume_level 
)
Parameters
handleTFA9896 codec handle.
volume_levelvolume level.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_SetOVPBypass ( tfa9896_handle_t handle)
Parameters
handleTFA98xx codec handle.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_Init ( tfa9896_handle_t handle,
tfa9896_config_t tfa9896Config 
)
Parameters
handleTFA98xx codec handle.
tfa9896ConfigCodec configuration.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_Deinit ( tfa9896_handle_t handle)
Parameters
handleTFA98xx codec handle.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
status_t TFA9896_SetFormat ( tfa9896_handle_t handle,
uint32_t  mclk,
uint32_t  sampleRate,
uint32_t  bitWidth 
)
Parameters
handleTFA98xx codec handle.
mclkmaster clock frequency
sampleRateto be set.
bitWidthto be set.
Returns
Returns kStatus_TFA9896_Ok if success, otherwise returns error code.
void TFA9896_Powerdown ( tfa9896_handle_t handle,
int  powerdown 
)
Parameters
handleTFA98xx codec handle.
powerdownto on/off