ClearPending(BIT_DMA2); rINTMOD = 0x0; // initialize philips UDA1341 chip init_1341(PLAY);
// set BDMA interrupt pISR_DMA2 = (unsigned)dma2_done; rINTMSK &= ~(BIT_DMA2); // initialize variables f_nDMADone = 0; //DMA2 Initialize rDISRCC2 = (0<<1) + (0<<0); //AHB, Increment rDISRC2 = ((INT32T)(pWavFile)); rDIDSTC2 = (1<<1) + (1<<0); //APB, Fixed rDIDST2 = ((INT32T)IISFIFO); //IISFIFO rDCON2 = (1<<31)+(0<<30)+(1<<29)+(0<<28)+(0<<27)+(0<<24)+(1<<23)+(0<<22)+(1<<20)+nSoundLen/2; //Handshake, sync PCLK, TC int, single tx, single service, I2SSDO, I2S request, //Auto-reload, half-word, size/2 rDMASKTRIG2 = (0<<2)+(1<<1)+0; //No-stop, DMA2 channel on, No-sw trigger
//IIS Initialize //Master,Tx,L-ch=low,iis,16bit ch.,CDCLK=384fs,IISCLK=32fs rIISCON = (1<<5)+(0<<4)+(0<<3)+(1<<2)+(1<<1); rIISMOD = (0<<8) + (2<<6) + (0<<5) + (0<<4) + (1<<3) + (1<<2) + (1<<0); rIISPSR = (2<<5) + 2; //Prescaler_A/B=3 //Tx DMA enable,Rx DMA disable,Tx not idle,Rx idle,prescaler enable,stop rIISFCON = (1<<15) + (1<<13); //Tx DMA,Tx FIFO --> start piling.... rIISCON |= 0x1; // enable IIS while( f_nDMADone == 0); rINTMSK |= BIT_DMA2; rIISCON = 0x0; // IIS stop
void __irq dma2_done(void) { ClearPending(BIT_DMA2); // clear pending bit f_nDMADone = 1; }
不懂为什么一到while( f_nDMADone == 0); 程序就跑飞呢? |