how can I abort an EDMA that is in progress?
I have a situation that I will need to abort a EDMA transfer if it takes too long.
while I am polling the IPR bit for completion, if I detect a timeout I need to
abort the current EDMA transfer and do what ever EDMA cleanup needed
so a different EDMA transfer can be done.
here is high level code example:
CSL_edma3Init(NULL)
handle = CSL_edma3Open(&obj, edmaNum, NULL, &status);
channelHandle = CSL_edma3ChannelOpen(&channelObj, edmaNum, &channelAttr, &status);
CSL_edma3HwChannelSetupQue(channelHandle, evtQue)
CSL_edma3MapDMAChannelToParamBlock (handle, dmaChannel, paramNum);
paramHandle = CSL_edma3GetParamHandle(channelHandle, paramNum, &status);
CSL_edma3ParamSetup(paramHandle, ¶mSetup)
CSL_edma3HwControl(handle, CSL_EDMA3_CMD_INTR_ENABLE, &cmdIntr);
CSL_edma3HwChannelControl(channelHandle, CSL_EDMA3_CMD_CHANNEL_SET, NULL);
// poll IPR bit for completion
do { CSL_edma3GetHwStatus(handle, CSL_EDMA3_QUERY_INTRPEND, &cmdIntr); } while ((!(cmdIntr.intr & chIPRBit)) && (timeoutFlag==0));
if (timeoutFlag == 1) { // HOW TO ABORT EDMA TRANSFER }
CSL_edma3HwControl(handle, CSL_EDMA3_CMD_INTRPEND_CLEAR, &cmdIntr);
CSL_edma3ChannelClose(channelHandle)
CSL_edma3Close(handle)
thanks in advance for any help,
lwmcgl
Lyndon,
Once in the Transfer Controller's Queue it can not be canceled w/o flushing the queue itself.
Best Regards,
Chad
------------------------------------------------------------------------------------------------------------
Please click the Verify Answer button on this post if it answers your question.
Adding to Chad's point.
If an EDMA Transfer request is taking more time than expected for completing the transfer, then there can be two reasons for this to happen:
1) EDMA TR encounters an error condition and the DSP CPU should handle this EDMA TC error condition. Please, refer to section 4.3.4 "Error Registers" of the Keystone EDMA3 users guide.
2) There is congestion in the TeraNet or at the memory end point (DDR3, MSMC or L2) interface and you need to re-visit your traffic scenario in this case.
I hope this helps.
Thanks,
Karthik
-------------------------------------------------------------------------------------------------------------------------------
If you need more help, please reply back. If this answers the question, please click Verify Answer , below.
Thank you both for your replies.
My issue is that I have a lower priority task start a DMA transfer
while the DMA transfer is being done, a higher priority task
is started and needs to do a DMA transfer also, so I was looking
for a way to stop the current lower priority DMA transfer so the
higher priority DMA could start.
forgot,
also, one of my other requirements is that if the
DMA transfer takes more time than allocated
I need to stop/abort the DMA transfer.
thanks again,
Hi Lyndon,
As Chad mentioned previously, it is not possible to cancel or abort a EDMA transfer request, which is already submitted to the transfer controller queue. One possible way to perform DMA transfers at different priority is to use separate transfer controllers (in other words TC queue) for each of the DMA transfers. There are totally 10 transfer controllers in Keystone devices.
Another point which I like to add here is that, please select the DMA transfer timeout values always to be the worst case values for your current traffic scenario.
I hope this helps
Another solution to your problem could be to break the low priority transfer into many smaller transfers.
If you are transferring 16KB, for example, with ACNT=4 and BCNT = 4096 and CCNT=1 and SYNCDIM=ABSYNC, this would be submitted as a single TR. Instead, break this into 16 separate TRs by using ACNT=4 and BCNT = 256 and CCNT=16 and SYNCDIM=ABSYNC, with ITCCHEN=1 and TCC=<this DMA channel number> and TCCMODE=NORMAL.
With this, if the higher priority transfer is requested, it will only have to wait behind at most 1024 bytes being transferred on the lower priority transfer. Make that even smaller if you need to. This will increase the total time to do the lower priority transfer, but that does not sound like an issue for you.
Regards,RandyP
Search for answers, Ask a question, click Verify when complete, Help others, Learn more.
Thanks again for your replies,
I think the best solution will be to break up the lower priority DMA
transfer so a higher priority task can come in and do a transfer
in-between the lower priority transfers.