/******************** Timer DMA Request Test ********************/ void Test_TimerDma(void) { int i; rTCFG0 = rTCFG0 & ~(0xffffff) | 0x0; //Dead zone=0, Prescaler0,1 = 0 rTCFG1 = rTCFG1 & ~(0xffffff) | 0x3 << 0 | 0x1 << 20; //Mux0 1/16, DMA Request Channel 0 rTCNTB0 = 65500; rTCMPB0 = 30000; rTCNTB1 = 65500; rTCMPB1 = 30000; rTCNTB2 = 65500; rTCMPB2 = 30000; rTCNTB3 = 65500; rTCMPB3 = 30000; rTCNTB4 = 65500; rTCON = rTCON & ~(0xffffff) | 0x1<<1 | 0x1<<9 | 0x1<<13 | 0x1<<17 | 0x1<<21 ; //Manual update Uart_Printf("\nTimer 0 DMA Request Test\n\n"); rTCON = 0x1 | 0x1<<3; //Auto reload, Start for(i=0 ; i < 4 ; i++) DMA_M2M(0,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x80000,0,0); //byte,single rTCON = 0x0; //Timer Stop Uart_Printf("\nTimer 1 DMA Request Test\n\n"); rTCFG1 = rTCFG1 & ~(0xffffff) | 0x3 << 4 | 0x2 << 20; //Mux0 1/16, DMA Request Channel 2 rTCON = 0x1<<8 | 0x1<<11; //Auto reload, Start for(i=0 ; i < 4 ; i++) DMA_M2M(2,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x80000,0,0); //byte,single rTCON = 0x0; Uart_Printf("\nTimer 2 DMA Request Test\n\n"); rTCFG1 = rTCFG1 & ~(0xffffff) | 0x3 << 8 | 0x3 << 20; //Mux0 1/16, DMA Request Channel 3 rTCON = 0x1<<12 | 0x1<<15; //Auto reload, Start for(i=0 ; i < 4 ; i++) DMA_M2M(3,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x80000,0,0); //byte,single rTCON = 0x0; Uart_Printf("\nTimer 3 DMA Request Test\n\n"); rTCFG1 = rTCFG1 & ~(0xffffff) | 0x3 << 12 | 0x4 << 20; //Mux0 1/16, DMA Request Channel 0 rTCON = 0x1<<16 | 0x1<<19; //Auto reload, Start for(i=0 ; i < 4 ; i++) DMA_M2M(0,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x80000,0,0); //byte,single rTCON = 0x0; Uart_Printf("\nTimer 4 DMA Request Test\n\n"); rTCFG1 = rTCFG1 & ~(0xffffff) | 0x3 << 16 | 0x5 << 20; //Mux0 1/16, DMA Request Channel 2 rTCON = 0x1<<20 | 0x1<<22; //Auto reload, Start for(i=0 ; i < 4 ; i++) DMA_M2M(2,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x80000,0,0); //byte,single rTCON = 0x0; Uart_Printf("Press any key\n"); while(!Uart_Getch()); //Key board press check }
void Test_DMA(void) { //DMA Ch 0 _NONCACHE_STARTADDRESS = 0x30400000 DMA_M2M(0,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x80000,0,0); //byte,single DMA_M2M(0,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x40000,1,0); //halfword,single DMA_M2M(0,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x20000,2,0); //word,single DMA_M2M(0,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x20000,0,1); //byte,burst DMA_M2M(0,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x10000,1,1); //halfword,burst DMA_M2M(0,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000, 0x8000,2,1); //word,burst //DMA Ch 1 DMA_M2M(1,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x80000,0,0); //byte,single DMA_M2M(1,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x40000,1,0); //halfword,single DMA_M2M(1,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x20000,2,0); //word,single DMA_M2M(1,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x20000,0,1); //byte,burst DMA_M2M(1,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x10000,1,1); //halfword,burst DMA_M2M(1,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000, 0x8000,2,1); //word,burst //DMA Ch 2 DMA_M2M(2,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x80000,0,0); //byte,single DMA_M2M(2,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x40000,1,0); //halfword,single DMA_M2M(2,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x20000,2,0); //word,single DMA_M2M(2,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x20000,0,1); //byte,burst DMA_M2M(2,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x10000,1,1); //halfword,burst DMA_M2M(2,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000, 0x8000,2,1); //word,burst //DMA Ch 3 DMA_M2M(3,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x80000,0,0); //byte,single DMA_M2M(3,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x40000,1,0); //halfword,single DMA_M2M(3,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x20000,2,0); //word,single DMA_M2M(3,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x20000,0,1); //byte,burst DMA_M2M(3,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000,0x10000,1,1); //halfword,burst DMA_M2M(3,_NONCACHE_STARTADDRESS,_NONCACHE_STARTADDRESS+0x800000, 0x8000,2,1); //word,burst }