- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a single DMA channel that has two TDs. The configuration is as follows.
The DMA interrupt gets called each time one of the TDs is finished. In the ISR, I want to know how to determine which buffer was last filled and should be processed.
I have attempted the following but not sure if it is correct.
CyDmaTdSetConfiguration(DMA_1_TD[0], TFR_CNT, DMA_1_TD[1], ...
CyDmaTdSetConfiguration(DMA_1_TD[1], TFR_CNT, DMA_1_TD[0], ...
CyDmaTdSetAddress(DMA_1_TD[0], LO16((uint32)ADC_SAR_1_SAR_WRK0_PTR), LO16((uint32)&dest_buf0[0]));
CyDmaTdSetAddress(DMA_1_TD[1], LO16((uint32)ADC_SAR_1_SAR_WRK0_PTR), LO16((uint32)&dest_buf1[0]));
CY_ISR(ISR_DMA_DONE_ADC)
{
CyDmaChStatus(DMA_1_Chan, ¤tTD, NULL);
if (currentTD == DMA_1_TD[0])
//process dest buf 0...
else if (currentTD == DMA_1_TD[1])
//process dest buf 1
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Probably, the order should be the opposite; when ISR fired, the currentTD will mark the next TD already
- if (currentTD == DMA_1_TD[0])
- //process dest buf 1...
- else if (currentTD == DMA_1_TD[1])
- //process dest buf 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Probably, the order should be the opposite; when ISR fired, the currentTD will mark the next TD already
- if (currentTD == DMA_1_TD[0])
- //process dest buf 1...
- else if (currentTD == DMA_1_TD[1])
- //process dest buf 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Post1 is correct i think.