 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		| // Init buffers
for (u32Idx = 0; u32Idx < DMA_SIZE; ++u32Idx)
{
g_bufferSrc[u32Idx] = u32Idx;
g_bufferDest[u32Idx]= 0;
}
Channel0_TC = 0;
Channel0_Err = 0;
NVIC_DisableIRQ(DMA_IRQn);
NVIC_SetPriority(DMA_IRQn, ((0x01<<3)|0x01));
GPDMA_Init();
LPC_GPDMA->CONFIG = 1;// enable the GPDMA controller
LPC_GPDMA->SYNC &= ~(1<<4);        // enable synchro
    LPC_GPDMA->C0SRCADDR  = (uint32_t) &g_bufferSrc[0];
    LPC_GPDMA->C0DESTADDR = (uint32_t) &g_bufferDest[0];//(LPC_DAC->CR);
    LPC_GPDMA->C0LLI      = 0; // linked lists for ch0
    LPC_GPDMA->C0CONTROL  = DMA_SIZE   // transfer size (0 - 11) = 64
                            | (0 << 12)            // source burst size (12 - 14) = 1
                            | (0 << 15)            // destination burst size (15 - 17) = 1
                            | (1 << 18)            // source width (18 - 20) = 32 bit
                            | (1 << 21)            // destination width (21 - 23) = 32 bit
                            | (0 << 24)            // source AHB select (24) = AHB 0
                            | (1 << 25)            // destination AHB select (25) = AHB 1
                            | (1 << 26)            // source increment (26) = increment
                            | (1 << 27)            // destination increment (27) = increment
                            | (0 << 28)            // mode select (28) = access in user mode
                            | (0 << 29)            // (29) = access not bufferable
                            | (0 << 30)            // (30) = access not cacheable
                            | (1 << 31);           // terminal count interrupt disabled
    LPC_GPDMA->C0CONFIG   =  0   // channel disabled (0)
                            | (0 << 1) // source peripheral (1 - 5) = none
                            | (4 << 6)// destination peripheral (6 - 10) = Timer 1 Match 1
                            | (1 << 11)// flow control (11 - 13) = mem to per
                            | (1 << 14)// (14) = mask out error interrupt
                            | (1 << 15)// (15) = mask out terminal count interrupt
                            | (0 << 16)// (16) = no locked transfers
                            | (0 << 18);// (27) = no HALT
GPDMA_ChannelCmd(0, ENABLE);
NVIC_EnableIRQ(DMA_IRQn);
TIM_Cmd(LPC_TIMER1, ENABLE);
while ((Channel0_TC == 0) && (Channel0_Err == 0)); | 
 
					
				
		
 lpcware
		
			lpcware
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		