程序段如下 , 来自2410test程序中的2410iis.c 文件:
rINTSUBMSK |= BIT_SUB_RXD0; size = *(Buf + 0x2c) | *(Buf + 0x2d)<<8 | *(Buf + 0x2e)<<16 | *(Buf + 0x2f)<<24; size = (size>>1)<<1;
fs = *(Buf + 0x1c) | *(Buf + 0x1d)<<8 | *(Buf + 0x1e)<<16 | *(Buf + 0x1f)<<24;
Uart_Printf("Sample Size = 0x%x\n",size/2); Uart_Printf("Sampling Frequency = %d Hz\n",fs); Uart_Printf("\n[ Now play the wave file .....]\n"); Uart_Printf("If you want to mute or no mute push the 'EIN0' key repeatedly\n");
Init1341(PLAY);
//DMA2 Initialize rDISRC2 = (int)(Buf + 0x30+1765674); //0x31000030~(Remove header) rDISRCC2 = (0<<1) + (0<<0); //The source is in the system bus(AHB), Increment rDIDST2 = ((U32)IISFIFO); //IISFIFO rDIDSTC2 = (1<<1) + (1<<0); //The destination is in the peripheral bus(APB), Fixed rDCON2 = (1<<31)+(0<<30)+(1<<29)+(0<<28)+(0<<27)+(0<<24)+(1<<23)+(0<<22)+(0<<20)+(size/4);
//Handshake[31], Sync PCLK[30], CURR_TC Interrupt Request[29], Single Tx[28], Single service[27], //I2SSDO[26:24], DMA source selected[23],Auto-reload[22], Half-word[21:20], size/2[19:0] rDMASKTRIG2 = (0<<2) + (1<<1) + (0<<0); //No-stop[2], DMA2 channel On[1], No-sw trigger[0]
//IIS Initialize if(fs==44100) //11.2896MHz(256fs) { // rIISPSR = (4<<5) + 4; //Prescaler A,B=4 <- FCLK 112.896MHz(1:2:2) rIISPSR = (2<<5) + 2; //Prescaler A,B=2 <- FCLK 135.4752MHz(1:2:4) // rIISPSR = (4<<5) + 4; //Prescaler A,B=4 <- FCLK 225.792MHz(226MHz)(1:2:4) } else //fs=22050, 5.6448MHz(256fs) { // rIISPSR = (9<<5) + 9; //Prescaler A,B=9 <- FCLK 112.896MHz(1:2:2) rIISPSR = (5<<5) + 5; //Prescaler A,B=5 <- FCLK 135.4752MHz(1:2:4) // rIISPSR = (9<<5) + 9; //Prescaler A,B=9 <- FCLK 225.792MHz(226MHz)(1:2:4) } rIISCON = (1<<5) + (1<<2) + (1<<1); //Tx DMA enable[5], Rx idle[2], Prescaler enable[1] //Master mode[8],Tx mode[7:6],Low for Left Channel[5],IIS format[4],16bit ch.[3],CDCLK 256fs[2],IISCLK 32fs[1:0] rIISMOD = (0<<8) + (2<<6) + (0<<5) + (0<<4) + (1<<3) + (0<<2) + (1<<0); rIISFCON = (1<<15) + (1<<13); //Tx DMA,Tx FIFO --> start piling....
Uart_Printf("\nPress any key to exit!!!\n");
问题如下 :
rDCON2 = (1<<31)+(0<<30)+(1<<29)+(0<<28)+(0<<27)+(0<<24)+(1<<23)+(0<<22)+(0<<20)+(size/4); 中, 最后的(size/4)是用来决定传输数据多少的吧? 为什么这个数不能改成其他的? 我改成其他的后, 播发出来的声音是变调的。但如果我改成0, 反而还能正常播放.
另外, 为什么这段程序只能循环播放一段音乐, 我试着改变(size/4)的值使它能完整播发一个wav文件,却始终做不到。这个又是为什么啊。
关于2410的IIS, 哪里能找到更多的解释? 比如对那个Prescaler 的解释等 |