用Mcbsp中断的方式,DDR1每接收一个数据就将数据存到缓冲区,但是再从缓冲区读取数据给DXR1到AIC23这个音频编解码器的时候出来的声音是不对的,下边是我的配置:
#pragma DATA_SECTION(buffer0,"DMARAML4") #pragma DATA_SECTION(buffer1,"DMARAML4") short buffer0[160]; short buffer1[160]; Uint16 i; static Uint16 i_count = 0; for(i=0;i<160;i++){buffer0[i] = 0;buffer1[i] = 0; } interrupt void ISRMcbspSend(void) {// int temp1,temp2;int i = 0;if(i_count == 159){memcpy(buffer1,buffer0,160);i_count = 0;}buffer0[i_count++] = McbspaRegs.DRR1.all;McbspaRegs.DXR1.all = buffer1[i_count];//放音//McbspaRegs.DXR2.all = temp2;PieCtrlRegs.PIEACK.all = 0x0020; // PieCtrlRegs.PIEIFR6.bit.INTx5 = 0; // ERTM; }
不添加缓冲区,直接收到数据,然后直接将数据给DXR1到codec,听到的声音是正确的没有问题,
我缓冲区设置的不对吧应该是,请教一下缓冲区应该怎么设置呢?