DSP 5509音频信号低通滤波Word文档下载推荐.docx
《DSP 5509音频信号低通滤波Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《DSP 5509音频信号低通滤波Word文档下载推荐.docx(16页珍藏版)》请在冰豆网上搜索。
//#defineNH31
unsignedintuLED[10]={0x0db,0x50,0x6b,0x73,0xf0,0x0b3,0x0bb,0x51,0x0fb,0x0f3};
DATA*aic23data,*voicedata;
//voiceinput&
outputdatapointer
DATA*dbptr/*=&
db[0]*/;
//lopassfliterbuffer
DATA*dbptrhi;
//hipassfliterbuffer
//voidDelay(unsignedintnDelay);
//延时子程序
voidaic_init();
//initaic23
unsignedinttime=0;
unsignedinttemp_key,temp_key1,firflag;
//keybuffer&
fliterselectflag
/**********************************************************************************************************/
voiddelay(Uint32k)//truedelayfunc
{
while(k--);
}
/***********************************************************************************************************/
voiddealkey()//keyfunc
temp_key=keyboard;
//readkeydata
temp_key=temp_key&
0x00ff;
if(0xff!
=temp_key)//compare
{
temp_key1=temp_key;
delay(150);
if(temp_key==temp_key1)
{
//time++;
//keycode[time]=temp_key;
switch(temp_key)
case0x0fb:
{
LBDS1=0x75;
//L
//recordflag=1;
firflag=0;
//0:
lowpass
}
break;
case0x0f7:
{
LBDS1=0x56;
//replayflag=1;
case0x0ef:
LBDS1=0x07;
//H
//stopflag=1;
firflag=1;
//1:
highpass
case0x0df:
LBDS1=0;
//overflag=1;
case0x0bf:
LBDS1=0x0ff-uLED[5];
//LEDjustforfun
case0x07f:
LBDS1=0x0ff-uLED[6];
case0x0fd:
LBDS1=0x0ff-uLED[7];
case0x0fe:
LBDS1=0x0ff-uLED[8];
default:
break;
}
/*********************************************************************************************************/
/****************************************************************************************************************/
/*锁相环的设置*/
PLL_ConfigmyConfig={
0,//IAI:
thePLLlocksusingthesameprocessthatwasunderway
//beforetheidlemodewasentered
1,//IOB:
IfthePLLindicatesabreakinthephaselock,
//itswitchestoitsbypassmodeandrestartsthePLLphase-locking
//sequence
24,//PLLmultiplyvalue;
multiply24times
1//Divideby2PLLdividevalue;
itcanbeeitherPLLdividevalue
//(whenPLLisenabled),orBypass-modedividevalue
//(PLLinbypassmode,ifPLLmultiplyvalueissetto1)
};
EMIF_Configemiffig={
0x221,//EGCR:
theMEMFREQ=00,theclockforthememoryisequaltocpufrequence
//theWPE=0,forbidenthewritingpostingwhenwedebugtheEMIF
//theMEMCEN=1,thememoryclockisreflectedontheCLKMEMpin
//theNOHOLD=1,HOLDrequestsarenotrecognizedbytheEMIF
0xFFFF,//EMI_RST:
anywritetothisregisterresetstheEMIFstatemachine
0x3FFF,//CE0_1:
CE0spacecontrolregister1
//MTYPE=011,SynchronousDRAM(SDRAM),16-bitdatabuswidth
0xFFFF,//CE0_2:
CE0spacecontrolregister2
0x00FF,//CE0_3:
CE0spacecontrolregister3
//TIMEOUT=0xFF;
0x3FFF,//CE1_1:
0xFFFF,//CE1_2:
0x00FF,//CE1_3:
0x1FFF,//CE2_1:
0xFFFF,//CE2_2:
0x00FF,//CE2_3:
0x1FFF,//CE3_1:
0xFFFF,//CE3_2:
0x00FF,//CE3_3:
0x2911,//SDC1:
SDRAMcontrolregister1
//TRC=8
//SDSIZE=0;
SDWID=0
//RFEN=1
//TRCD=2
//TRP=2
0x0410,//SDPER:
SDRAMperiodregister
//7ns*4096
0x07FF,//SDINIT:
SDRAMinitializationregister
//anywritetothisregistertoinittheallCEspaces,
//doitafterhardwareresetorpoweruptheC55xdevice
0x0131//SDC2:
SDRAMcontrolregister2
//SDACC=0;
//TMRD=01;
//TRAS=0101;
//TACTV2ACTV=0001;
};
MCBSP_ConfigMcbsptest;
/*McBSPset,weusemcbsp1tosendandrecievethedatabetweenDSPandAIC23*/
MCBSP_ConfigMcbsp1Config={
MCBSP_SPCR1_RMK(
MCBSP_SPCR1_DLB_OFF,/*DLB=0,禁止自闭环方式*/
MCBSP_SPCR1_RJUST_LZF,/*RJUST=2*/
MCBSP_SPCR1_CLKSTP_DISABLE,/*CLKSTP=0*/
MCBSP_SPCR1_DXENA_ON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R2_DEFAULT,
MCBSP_MCR1_DEFAULT,
MCBSP_MCR2_DEFAULT,
MCBSP_PCR_RMK(
MCBSP_PCR_IDLEEN_RESET,/*IDLEEN=0*/
MCBSP_PCR_XIOEN_SP,/*XIOEN=0*/
MCBSP_PCR_RIOEN_SP,/*RIOEN=0*/
MCBSP_PCR_FSXM_EXTERNAL,/*FSXM=0*/
MCBSP_PCR_FSRM_EXTERNAL,/*FSRM=0*/
0,/*DXSTAT=N/A*/
MCBSP_PCR_CLKXM_INPUT,/*CLKXM=0*/
MCBSP_PCR_CLKRM_INPUT,/*CLKRM=0*/
MCBSP_PCR_SCLKME_NO,/*SCLKME=0*/
MCBSP_PCR_FSXP_ACTIVEHIGH,/*FSXP=0*/
MCBSP_PCR_FSRP_ACTIVEHIGH,/*FSRP=1*/
MCBSP_PCR_CLKXP_FALLING,/*CLKXP=1*/
MCBSP_PCR_CLKRP_RISING/*CLKRP=1*/
MCBSP_RCERA_DEFAULT,
MCBSP_RCERB_DEFAULT,
MCBSP_RCERC_DEFAULT,
MCBSP_RCERD_DEFAULT,
MCBSP_RCERE_DEFAULT,
MCBSP_RCERF_DEFAULT,
MCBSP_RCERG_DEFAULT,
MCBSP_RCERH_DEFAULT,
MCBSP_XCERA_DEFAULT,
MCBSP_XCERB_DEFAULT,
MCBSP_XCERC_DEFAULT,
MCBSP_XCERD_DEFAULT,
MCBSP_XCERE_DEFAULT,
MCBSP_XCERF_DEFAULT,
MCBSP_XCERG_DEFAULT,
MCBSP_XCERH_DEFAULT
MCBSP_HandlehMcbsp;
/*ThisnextstructshowshowtousetheI2CAPI*/
/*CreateandinitializeanI2Cinitializationstructure*/
I2C_SetupI2Cinit={
0,/*7bitaddressmode*/
0,/*ownaddress-don'
tcareifmaster*/
7,/*clkoutvalue(Mhz)*/
400,/*anumberbetween10and400*/
0,/*numberofbits/bytetobereceivedortransmitted(8)*/
0,/*DLBmodeon*/
1/*FREEmodeofoperationon*/
I2C_ConfigtestI2C;
//allconfigbitzero,itworks
//I2C:
addr7bit+data9bit
/*数字音频接口格式设置//seetlv320a23bdatasheet
AIC23为主模式,数据为DSP模式,数据长度16位*/
Uint16digital_audio_inteface_format[2]={0x0e,0x53};
/*AIC23的波特率设置,0x23采样率为44.1K,0x0c采样率为8K*/
Uint16sample_rate_control[2]={0x10,0x0c};
/*AIC23寄存器复位*/
Uint16reset[2]={0x1e,0x00};
/*AIC23节电方式设置,所有部分均所与工作状态*/
Uint16power_down_control[2]={0x0c,0x01};
/*AIC23模拟音频的控制
DAC使能,ADC输入选择为MIC*/
Uint16analog_aduio_path_control[2]={0x08,0x14};
/*AIC23数字音频通路的控制*/
Uint16digital_audio_path_control[2]={0x0a,0x05};
/*AIC23数字接口的使能*/
Uint16digital_interface_activation[2]={0x12,0x01};
/*AIC23左通路音频调节*/
//Uint16left_line_input_volume_control[2]={0x00,0x17};
/*AIC23右通路音频调节*/
//Uint16right_line_input_volume_control[2]={0x02,0x17};
/*AIC23耳机左通路音频调节*/
Uint16left_headphone_volume_control[2]={0x05,0x79};
/*AIC23耳机右通路音频调节*/
Uint16right_headphone_volume_control[2]={0x07,0x79};
/*定义McBSP的句柄*/
Uint16i2c_status;
//Uint16temp;
//Uint16nin=0,bcount=0;
//longdec_sour,dec_temp;
voidmain(void)
i2c_status=1;
//i2cstatus
CSL_init();
//initcsl
CHIP_RSET(XBSR,0x0a01);
GPIO_RSET(IODIR,0xFF);
/*设置系统的运行速度为144MHz*/
PLL_config(&
myConfig);
EMIF_config(&
emiffig);
//setsdram
dbptr=(short*)0x021000;
//pointtosdram
dbptrhi=(short*)0x022000;
I2C_RSET(I2CMDR,0);
/*设置预分频寄存器,I2C的modeclockis12MHz*/
delay(100);
I2C_RSET(I2CSAR,0x001A);
I2C_RSET(I2CMDR,0x0620);
I2C_setup(&
I2Cinit);
/*设置I2C的Materclock*/
I2C_RSET(I2CCLKL,100);
I2C_RSET(I2CCLKH,100);
I2C_getConfig(&
testI2C);
/*初始化McBSP1*/
hMcbsp=MCBSP_open(MCBSP_PORT1,MCBSP_OPEN_RESET);
/*设置McBSP0*/
MCBSP_config(hMcbsp,&
Mcbsp1Config);
/*启动McBSP0*/
MCBSP_start(hMcbsp,
MCBSP_RCV_START|MC