I'm facing I strange situation about DMA that I like to share, asking if you see a better solution than the one I implemeted.
At reset the association between DMA channel (16) and DMA request (32) line is one-one,
made by registers DREQASI. So:
CH REQ
0 0
1 1
2 2
3 3
4 4
5 5
... ...
15 15
Now if for example you want to use line MIB3 line 2 and 3, you see that they are linked to dma req line 4 and 5 (table 6-32 of SPNS177D).
To use these requests, they must be mapped to a dma channel. So for example I chose DMA_CH2 and DMA_CH3,
and I call
dmaReqAssign(DMA_CH2, 4)
dmaReqAssign(DMA_CH3, 5)
The association table now is
CH REQ
0 0
1 1
2 4
3 5
4 4
5 5
... ...
15 15
Now the problem starts arising: see for example REQ4, it triggers DMA_CH2 (this is what I wanted) and DMA_CH4 (unwanted/side-effect).
This does nothing if DMA_CH4 is unused. And even if it would be used, probably you would call dmaReqAssign(DMA_CH4, REQx) and
the double association would disappear.
But now suppose that (as I did), you use DMA_CH4 in chain of DMA_CH3, so there is not a physical REQ associated to DMA_CH4, it is triggered by DMA_CH3. Having no physical REQ associated I didn't call dmaReqAssign(DMA_CH4, REQx) because there is no REQx.
This way the table keeps double association and DMA_CH4 is triggered twice: by REQ4 (unwanted) and by chain of DMA_CH3.
I don't see any clear way to manage this situation:
- Can initialize all the table, calling dmaReqAssign on all DMA channels to an unused REQ (not very elegant, the bomb is hidden)
- Call dmaReqAssign(DMA_CH4, REQx) only on the chained channel (even if it is useless) using as REQx an unused REQ (not very elegant, the bomb is hidden)
Is there a clear way that I don't see? Any suggestions?
I would prefer to set a value that says "not linked to a REQ" on a DMA_CH cutting the link if a DMA_CH is not bound to a REQ line (like happens when you use DMA chain).
By the way the philosophy of registers DREQASI seems the opposite of what I expected: you say for a channel which is the req associated, I expected to say for a req which is the channel to trigger (following the "flow "of the trigger).
Thanks,
Valerio