I used the EDMA_DRV_ConfigLoopTransfer function in the KSDK to setup a DMA transfer from the ADC to a ping-pong buffer like so:
status = EDMA_DRV_ConfigLoopTransfer( &edma_chan_state0,
edma_transfer_descriptors1,
kEDMAPeripheralToMemory,
(uint32_t)&ADC0->R[0],
(uint32_t)&edma_buffer0,
2, /* size to be transferred on every DMA write/read */
2, /* bytesOnEachRequest */
sizeof( edma_buffer0 ), /* Total length of Memory in bytes */
2 /* Num Descriptors */ );
I also have a callback interrupt that signals that a transfer was completed.
status = EDMA_DRV_InstallCallback( &edma_chan_state0,
edma0_callback,
&edma_chan_state0 );
It all seems to work (PDB triggering the ADC) and I am collecting samples in my buffers, but how do I know which buffer is the last filled one?