Showing changes from revision #2 to #3:
Added | Removed | Changed
When you use DMA_RegisterChannel to register with DMAManager, you are required to pass in a pointer to a word-aligned table of callback routines in R4. The table should be laid out as follows:
Offset | Use |
---|---|
0 | Pointer to DMA enable callback |
4 | Pointer to DMA disable callback |
8 | Pointer to DMA start callback |
12 | Pointer to DMA completed callback |
16 | Pointer to DMA sync callback |
These routines will be called by DMAManager as the transfer(s) which are queued on the channel are processed by the system.
DMAManager may call the routines in IRQ or SVC mode, with interrupts enabled or disabled. Calling DMAManager SWIs, or enabling interrupts (if disabled on entry), should be avoided as it may result in malfunction.
On entry to the routines, R12 will be the value of R5 that was passed to DMA_RegisterChannel, and R14 will be the return address. Except where noted, on exit the routines must preserve all registers, processor mode, and IRQ state. Processor flags need not be preserved, however the V flag must be set correctly if the routine is capable of returning an error.
Over the course of a normal transfer, the callbacks will be called in the following order:
However it may be the case that the sequence 2-4 is repeated multiple times, e.g. in response to DMA_SuspendTransfer and DMA_ResumeTransfer calls, or in response to a dynamic area claiming a physical RAM page which is part of the transfer.
This documentation only covers the RISC OS 5 version of the DMAManager SWIs. For other OS versions, consult the appropriate PRM volume (e.g. volume 5a).