DMA for RPi

Mudit Jain muditjain18011995 at
Sat Aug 6 11:04:52 UTC 2016

Hi all,

Github Link :

As per the suggestions I have made modifications.

1. Invalidating the cache in the rpi_dma_start
2. Adding a atomic flag in the channel structure which will be used for DMA
3. Changed the rpi_dma_init function. Now according to me the flow for
using DMA will be as follows.
      1. rpi_dma_init -> Initializes the channel structure and its members
for that particular channel, gets the physical address of the control block
structure and installs the interrupt handler.
      2. rpi_dma_allocate -> Allocates the channel if it is not busy
      3. rpi_dma_setup_dst & rpi_dma_setup_src -> These setup src and dst
parameters like dreq,width. Basically they configure the info section of
the control block structure of that particular channel.
      4. rpi_dma_setup_intr -> These will assign the handler function for
channel interrupt. This basically again updates the channel structure with
that function.
                                           Note : rpi_dma_intr is the
callback function for the interrupt controller and calls this function
      5. rpi_dma_start -> Here you provide the virtual address, the channel
to be used and the width. Internally, it converts the address to physical
address and configures the control block for that channel.
                                  It flushes and invalidates the cache and
writes the physical address of the control block to a particular register
corresponding to the channel.
      6. rpi_dma_free -> Frees the channel
4. Used rtems_cache_aligned_malloc instead of rtems_cache_coherent_allocate.
5. Have added the corresponding IRQ for DMA channel 0 to irq.h and updated
irq.c. Presently, have only added support for DMA CH0 in irq.c. Other
channels can be added in further commits.
6. Added RTEMS_COMPILER_MEMORY_BARRIER() in dma_start.

The changes are on top of the previous change and builds without any
warnings or errors.

I request people to review this and provide suggestion on what else can be

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the devel mailing list