我的程序如下,现象是无法向iis的iisfif寄存器写入wav数据,不知道为什么? #include "44b.h"
#define uint16 unsigned short int #define uint32 unsigned long int #define IIS_fifoready ((rIISCON&0x80)==0x0)
//wav_play函数 void wav_play(uint32 wavaddress) { //定义局部变量 uint32 i; uint16 *WavComment; WavComment=(uint16 *)wavaddress; WavComment+=0x2800; /*初始化IIS*/ rCLKCON=0x7ff8;/*允许IIS时钟和GPIO时钟*/ /*rPCONC=0x000000ff;//设置GPIO管脚为IIS功能脚 rPUPC=0x???;//禁止上拉的功能*/ rPLLCON=(0x69<<12)|(0x17<<4)|0;//设置MCLK=45.1584MHZ*/ rIISCON=0x02;//dma disable;iisclk generate;prescaler enable rIISMOD=0x89;//master mode;transmit mode;low for left channel;iis compatible format;8 bits;256fs;32fs rIISPSR=0x33;//division factor=3 rIISFCON=0x200;//normal access mode;fifo enable; //开始IIS操作 rIISCON|=0x1; while(i<0xffffff) { if(IIS_fifoready) { for(i=0;i<8;i++) {*IISFIF = (*WavComment); WavComment++;} } } }
void IIS_play(void) { //定义wav特性的数据结构 /*struct { uint32 wavsize; uint16 wavChannels; uint32 wavSamplesPerSec; uint32 wavAvgBytesPerSec; uint16 wavBitsPerSample; }wavspec; */ uint32 address=0x0c100000; UART_Init(); wav_play(address);/*0x0c100000为音乐文件的首地址*/ }
/**************LED实验***************/ void Delay(int a) { int b; for(b=0;b<=a;b++) ; }
void Led_Display(void) { rPDATC = 0x22; Delay(1000000); rPDATC = 0x40; Delay(1000000); rPDATC = 0x44; Delay(1000000); }
/*进行GPIO口的初始化*/ void Gpio_Init(void) { rPCONA=0x1FF; /* rPDATA= */ rPCONB=0x7FF; /* rPDATB= */ rPCONC=0xFFFA0054; rPUPC=0xFCFD; /* rPDATC= */ rPCOND=0xAA00; rPUPD=0xFF; /* rPDATD= */ rPCONE=0x20428; rPUPE=0xFF; /* rPDATE= */ rPCONF=0x249000; rPUPF=0x1FF; /* rPDATF= */ rPCONG=0x0000; rPUPG=0xFF; /* rPDATG= */ rSPUCR=0x7; /* rEXTINT= rEXTINTPND= */ }
/**************************************************************************** 【功能说明】系统主函数 ****************************************************************************/ void Main(void) { while(1) { Gpio_Init(); Led_Display(); IIS_play(); } }
|