I need your help again...
I'm developing a new project, I have to interface an external codec (but first I'll use the WM8960) and I need to transmit and receive blocks of 128 word(32 bits) in a continuous mode to and from the CODEC.
I use the DMA channel 1 to receive and the DMA channel 0 to transmit; I configured the TCD registers but I don't know how to link the interrupt routines to the DMA; this is the DMA setting:
//DMA0_IRQn interrupt handler transmit
void INT_0_IRQHANDLER(void){
EDMA_ClearChannelStatusFlags((DMA_Type *)0x400E8000, 0, kEDMA_InterruptFlag);
}
//DMA0_IRQn interrupt handler receive
void INT_1_IRQHANDLER(void){
EDMA_ClearChannelStatusFlags((DMA_Type *)0x400E8000, 1, kEDMA_InterruptFlag);
}
//DMA channel 1, receive
DMAmystruct.SADDR=(__IO uint32_t)((uint32_t)I2S1_RDR0);
DMAmystruct.SOFF=0;
DMAmystruct.ATTR=0x22;
DMAmystruct.NBYTES=4;
DMAmystruct.SLAST=0;
DMAmystruct.DADDR=(__IO uint32_t)i2s2_rx_buffer;
DMAmystruct.DOFF=4;
DMAmystruct.CITER=256;
DMAmystruct.DLAST_SGA=-1024;
DMAmystruct.BITER=256;
DMAmystruct.CSR=0x02; //Interrupt on major loop completion
EDMA_InstallTCD(mydmabase,1,mytcd); //Install I2S receive DMA channel 1
//DMA channel 0, transmit
DMAmystruct.SADDR=(__IO uint32_t)i2s2_rx_buffer;
DMAmystruct.SOFF=4;
DMAmystruct.ATTR=0x22;
DMAmystruct.NBYTES=4;
DMAmystruct.SLAST=-1024;
DMAmystruct.DADDR=(__IO uint32_t)((uint32_t)I2S1_TDR0);
DMAmystruct.DOFF=0;
DMAmystruct.CITER=256;
DMAmystruct.DLAST_SGA=0;
DMAmystruct.BITER=256;
DMAmystruct.CSR=0x02; //Interrupt on major loop completion
EDMA_InstallTCD(mydmabase,0,mytcd); //Install I2S transmit DMA channel 0
Thanks, Luigi