#pragma DATA_SECTION(DMABuf1,"DMARAML4");
#pragma DATA_SECTION(DMABuf2,"DMARAML5");
volatile Uint16 DMABuf1[1024];
volatile Uint16 DMABuf2[1024];
volatile Uint16 *DMADest;
volatile Uint16 *DMASource;
Uint16 i,j;
//interrupt void local_DINTCH1_ISR(void);
void main(void)
{
Uint16 i;
InitSysCtrl();
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
DMAInitialize();
// Initialize Tables
for (i=0; i<BUF_SIZE; i++)
{
DMABuf1[i] = 0;
DMABuf2[i] = i;
}
// Configure DMA Channel
DMADest = &DMABuf1[0];
DMASource = &DMABuf2[0];
DMACH1AddrConfig(DMADest,DMASource);
DMACH1BurstConfig(31,2,2); //Will set up to use 32-bit datasize, pointers are based on 16-bit words
DMACH1TransferConfig(31,2,2); //so need to increment by 2 to grab the correct location
DMACH1WrapConfig(0xFFFF,0,0xFFFF,0);
// DMACH1ModeConfig(0,PERINT_ENABLE,ONESHOT_ENABLE,CONT_DISABLE,SYNC_DISABLE,SYNC_SRC,OVRFLOW_DISABLE,THIRTYTWO_BIT,CHINT_END,0);
DmaRegs.CH1.MODE.bit.ONESHOT=1;
DmaRegs.CH1.MODE.bit.DATASIZE=1;
DmaRegs.CH1.MODE.bit.PERINTSEL=0;
DmaRegs.CH1.CONTROL.bit.PERINTFRC=1;
DmaRegs.CH1.MODE.bit.PERINTE=1;
// Clear any spurious flags:
DmaRegs.CH1.CONTROL.bit.PERINTCLR = 1; // Clear any spurious interrupt flags
DmaRegs.CH1.CONTROL.bit.SYNCCLR = 1; // Clear any spurious sync flags
DmaRegs.CH1.CONTROL.bit.ERRCLR = 1;
StartDMACH1();
while(1)
{
DmaRegs.CH1.CONTROL.bit.PERINTFRC = 1;
j = 0;
if(DmaRegs.CH1.CONTROL.bit.PERINT**==1)
j = 1;
for(i=0;i<1000;i++);
i=0;
}
}
我设置了PERINTFRC = 1,但是始终也没检测到PERINT**=1的情况。就是说虽然给定了PERINTFRC =1,但是PERINTFRC =1事件并没有让PERINT**=1,从而没有启动DMA.
请您帮我查查程序,看看其中初始化程序是哪儿没设置好。小女子万分感谢! 呵呵 |