void ProcessDciRxSamples(unsigned int * DciRxBuffer);

unsigned int dci1TxBuffA[16] __attribute__((space(dma)));
unsigned int dci1TxBuffB[16] __attribute__((space(dma)));

/*=============================================================================
_DMA0Init(): Initialise DMA0 for DCI Data Transmission 
=============================================================================*/
// DMA0 configuration
// Direction: Read from DMA RAM and write to peripheral address 0x298 (TXBUF0 register)
// AMODE: Register Indirect with Post-Increment mode
// MODE: Continuous, Ping-Pong Enabled
// IRQ: DCI
void dma0Init(void)
{

	DMA0CON = 0x2002;					
	DMA0CNT = 15;						
	DMA0REQ = 0x003C;					

	DMA0PAD = (volatile unsigned int) &TXBUF0;
	DMA0STA= __builtin_dmaoffset(dci1TxBuffA);
	DMA0STB= __builtin_dmaoffset(dci1TxBuffB);
	
	
	IFS0bits.DMA0IF  = 0;			// Clear DMA interrupt
	IEC0bits.DMA0IE  = 1;			// Enable DMA interrupt
	DMA0CONbits.CHEN = 1;			// Enable DMA Channel	
}


/*=============================================================================
_DMA0Interrupt(): DCI Transmit Interrupt Handler
=============================================================================*/
unsigned int RxDmaBuffer = 0;

void __attribute__((interrupt, no_auto_psv)) _DMA0Interrupt(void)
{
		tglPin();					// Toggle PORTA, BIT0	   		

        IFS0bits.DMA0IF = 0;		//Clear the DMA0 Interrupt Flag
}

