www.pudn.com > DSP5502_audio_loopback.rar > CODEC.h


 
//************************************************************// 
// 
//Filename:	CODEC.h 
//Function:	Define data stucture and function used by CODEC 
// 
//************************************************************// 
 
#ifndef CODEC_H 
#define CODEC_H 
 
/*Left line input channel volume control*/ 
#define   	Codec_LLIVC_LPS(x)   	((0<<1)+x) 
#define     LLIVC_LIM(x)	(x<<7)	//Left line input mute 
#define 	LLIVC_LIV(x)	x		//Left line input volume control(10111=0 db default) 
 
/*Right line input channel volume control*/	 
#define   	Codec_RLIVC_RLS(x)		((1<<1)+x) 
#define     RLIVC_RIM(x)	(x<<7)	//Right line input mute 
#define 	RLIVC_RIV(x)	x		//Right line input volume control(10111=0 db default) 
 
/*Left channel headphone volume control*/	 
#define   	Codec_LHPVC_LRS(x)   	((2<<1)+x) 
#define     LHPVC_LZC(x)	(x<<7)	//Left-channel zero-cross detect 
#define     LHPVC_LHV(x)	x		//Left Headphone volme control(1111001=0db default) 
 
/*Rihgt channel headphone volume control*/	 
#define   	Codec_RHPVC_RLS(x)   	((3<<1)+x) 
#define     LHPVC_RZC(x)	(x<<7)	//Reft-channel zero-cross detect 
#define     LHPVC_RHV(x)	x		//Reft Headphone volme control(1111001=0db default) 
 
/*Analog audio path control*/	 
#define    	Codec_AAPC_STA2(x)    	((4<<1)+x) 
#define    	AAPC_STA10(x)	(x<<6)	//Added Sidetone 1-0bit 
#define    	AAPC_STE(x)		(x<<5)	//Sidetone enable bit 
#define    	AAPC_DAC(x)		(x<<4)	//DAC select 
#define    	AAPC_BYP(x)		(x<<3)	//Bypass 
#define    	AAPC_INSEL(x)	(x<<2)	//Input select for ADC 
#define    	AAPC_MICM(x)	(x<<1)	//Microphone mute 
#define    	AAPC_MICB(x)	x		//Microphone boost  0=db	1=20db 
 
/*Digital audio path control*/	 
#define   	Codec_DAPC_REV    	0x0a 
#define   	DAPC_DACM(x)	(x<<3)	//DAC sofe mute 
#define   	DAPC_DEEMP(x)	(x<<1)	//De-emphasis control  
#define   	DAPC_ADCHP(x)	x		//ADC highpass filter 
 
/*Power down control*/	 
#define   	Codec_PDC_REV     	0x0c 
#define   	PDC_OFF(x)		(x<<7)	//Device power	 
#define   	PDC_CLK(x)		(x<<6)	//Clock 
#define   	PDC_OSC(x)		(x<<5)	//Oscillator 
#define   	PDC_OUT(x)		(x<<4)	//Output 
#define   	PDC_DAC(x)		(x<<3)	//DAC 
#define   	PDC_ADC(x)		(x<<2)	//ADC 
#define   	PDC_MIC(x)		(x<<1)	//Microphone input 
#define   	PDC_LINE(x)		x		//Line input 
#define 	PDC_DEFAULT		0x0 
 
/*Digital audio interface format*/	 
#define    	Codec_DAIF_REV    	0x0e	 
#define		DAIF_MS(x)		(x<<6)	//Master/slave mode 
#define		DAIF_LRSWAP(x)	(x<<5)	//DAC left/right swap 
#define		DAIF_LRP(x)		(x<<4)	//DAC left/right phase 
#define		DAIF_IWL(x)		(x<<2)	//Input bit length 
#define		DAIF_FOR(x)		x		//Data format 
 
/*Sample rate control*/	 
#define 	Codec_SRC_REV     	0x10 
#define 	SRC_CLKIN(x)	(x<<6)	//Clock input divider 
#define 	SRC_CLKOUT(x)	(x<<7)	//Clock output divider 
#define 	SRC_SR(x)		(x<<2)	//Sampling rate control 
#define 	SRC_BOSR(x)		(x<<1)	//Base oversampling rate 
#define 	SRC_USB(x)		x		//Clock mode select 0=normal 1=USB 
 
/*Digital interface activation*/	 
#define     Codec_DIA_REV       0x12 
#define   	DIA_ACT(x)		x		//Activate interface 0=inactive 
 
/*Reset register*/	 
#define     Codec_RST_REV   	0x1e	 
#define		RST_RES		    0		//Write 00000000 to this register triggers reset 
 
 
#endif 
 
//------------------------------------------------------------------// 
//	No	More 
//------------------------------------------------------------------//