⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aic23.c

📁 ACI23 Codec芯片驱动
💻 C
字号:
//###########################################################################
// FILE:	AIC23.c
// TITLE:	TLV320AIC23B Driver Functions
//
// DESCRIPTION: 
//   This file includes functions for initializing the AIC23 codec. You may
//   modify/add to these functions to suit your application if desired.
//
// History: Ver0.1,Octomber 15,2008 by Alex Zhang 
//###########################################################################

#include "AIC23.h"

// Power down control 
unsigned int SoftPowerDown (void)
{
	// Power down: In/Out/DAC/ADC/Mic,Leave AIC23 device, osc, clks on 
    return (POWDCTL|(AIC23OUT|AIC23DAC|AIC23ADC|AIC23MIC|AIC23LINE));        
}

//Power up all modules
unsigned int FullPowerUp (void)
{          
    return (POWDCTL|0x0000);   
}

// Power up all modules except microphone    
unsigned int NoMicPowerUp (void)
{           
    return (POWDCTL|AIC23MIC);  
}

// Left Line Input Volume Control    
unsigned int Linput_VolCtrl (unsigned int Volume)
{  
    return (LRS|LLINVCTL|Volume);
}

// Right Line Input Volume Control
unsigned int Rinput_VolCtrl (unsigned int Volume)
{  
    return (RLS|RLINVCTL|Volume);
}

// Left Headphone Volume Control
unsigned int Lhp_VolCtrl (unsigned int Volume)
{    
    return (LRS|LHVCTL|LZC|Volume);
}

// Right Headphone Volume Control
unsigned int Rhp_VolCtrl (unsigned int Volume)
{    
    return (RLS|RHVCTL|RZC|Volume);
}

//Analog audio path control:turn on DAC,no mic
unsigned int NomicaAudPath (void)
{
	// Turn on DAC, mute mic
    return 	(AAUDCTL|DAC|MICMUTE);     
}

//Analog Audio Path Control:turn on DAC,mic and 20dB mic boost
unsigned int AnaAudPath (void)
{
    return (AAUDCTL|DAC|MICINSEL|MICBOOST); // Turn on DAC, mic
}

// Digital audio path control
unsigned int DigAudioPath (void)
{
   // DAC mute, de-emph, ADC HP filter all disabled            
    return (DAUDCTL|0x0000);          
}

// Digital audio interface format
unsigned int DspDigAudInterface (unsigned int Iwl)
{
	// AIC23 master mode, DSP mode,Iwl-bit data,LRP=1
	unsigned int RetVal = DAUDINTF|(AIC23MS|FORDSP|LRP);
	switch(Iwl)
	{
		case 0:
			RetVal |= IWL16B;
			break;
		case 4:
			RetVal |= IWL20B;
			break;
		case 8:
			RetVal |= IWL24B;
			break;
		case 12:
			RetVal |= IWL32B;
			break;
		default:
			break;
	}   
    return (RetVal);         
}

// Digital audio interface format
unsigned int I2SDigAudInterface (unsigned int Iwl)
{
	// AIC23 master mode, I2S mode,32-bit data,LRP=0 right channel high
	unsigned int RetVal = DAUDINTF|(AIC23MS|FORI2S|LRPZRO);
	switch(Iwl)
	{
		case 0:
			RetVal |= IWL16B;
			break;
		case 4:
			RetVal |= IWL20B;
			break;
		case 8:
			RetVal |= IWL24B;
			break;
		case 12:
			RetVal |= IWL32B;
			break;
		default:
			break;
	}    
    return (RetVal);         
}

//set sample rate register,using USB Mode
unsigned int UsbSamplerateCtrl (unsigned int RateCtrl)
{
	//  USB clock - 48 kHz sample rate in USB mode
    return (SMPLRCTL|(USB|RateCtrl)); 
}

//set sample rate register,using normal mode 
unsigned int ClkSamplerateCtrl (unsigned int RateCtrl)
{
	// external clock - 48 kHz sample rate in external clock (12.288 MHz) mode	
    return (SMPLRCTL|RateCtrl);      
}

// Digital Interface Activation
unsigned int DigAct (void)
{                        
    return (DIGINTFACT|ACT);           // Activate
} 

//Reset AIC23
unsigned int ResetAic23 (void)
{
    return (RESETREG|RES);
}

//end of file



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -