[PATCH] Added interrupt handler for DMA channel 0, 1 & 2

Mudit Jain muditjain18011995 at gmail.com
Tue Aug 23 15:19:02 UTC 2016


Hi Pavel,

I have the latest GIT master synced and have cherry-picked my changes on
top of that.

Regarding the change you have suggested :
DMA     : https://github.com/spark1729/rtems/commits/DMA_RPI
Mailbox : https://github.com/spark1729/rtems/commits/MAILBOX_RPI

Is this what you suggested right ?

I have updated the blog with the information regarding the patches
submitted : Blog <http://rtemsgsoc2016-mudit.blogspot.in/>
This also has information on the status as well as the plan of action in
the future.

Blog Posts :
Regarding DMA : Link
<http://rtemsgsoc2016-mudit.blogspot.in/2016/08/dma-direct-memory-access-for-rpi.html?view=flipcard>

Regarding SD card Driver : Link
<http://rtemsgsoc2016-mudit.blogspot.in/2016/08/porting-sd-card-driver-from-freebsd-to.html?view=flipcard>
Regarding Mailbox : Link
<http://rtemsgsoc2016-mudit.blogspot.in/2016/08/mailbox-interface-for-rpi.html?view=flipcard>

Thanks
Mudit Jain


On Mon, Aug 22, 2016 at 3:47 AM, Pavel Pisa <ppisa4lists at pikron.com> wrote:

> Hello Mudit,
>
> please, send information what is RTEMS GIT revision are
> your changes based on. See comment below
>
> On Saturday 20 of August 2016 17:04:19 Mudit Jain wrote:
> > Added macros for DMA channels 0-12
> > Added interrupt handlers for DMA 0, 1 & 2
> >
> > The added IRQs are in accordance with the
> > BCM Peripherals Datasheet and also have been verified
> > with the linux source code for RPi
> > ---
> >  c/src/lib/libbsp/arm/raspberrypi/include/irq.h | 17 ++++++++++
> >  c/src/lib/libbsp/arm/raspberrypi/irq/irq.c     | 45
> > ++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)
> >
> > diff --git a/c/src/lib/libbsp/arm/raspberrypi/include/irq.h
> > b/c/src/lib/libbsp/arm/raspberrypi/include/irq.h index 8436c2d..50616e1
> > 100644
> > --- a/c/src/lib/libbsp/arm/raspberrypi/include/irq.h
> > +++ b/c/src/lib/libbsp/arm/raspberrypi/include/irq.h
> > @@ -35,6 +35,23 @@
> >
> >  #define BCM2835_INTC_TOTAL_IRQ       64 + 8
> >
> > +/* DMA Interrupt is routed to IRQ 16 for DMA Channel 0,
> > +   IRQ 17 for Channel 1, and so on till IRQ 28 for Channel 12.
> > + */
> > +
> > +#define BCM2835_IRQ_ID_DMA_CH0       16
> > +#define BCM2835_IRQ_ID_DMA_CH1       17
> > +#define BCM2835_IRQ_ID_DMA_CH2       18
> > +#define BCM2835_IRQ_ID_DMA_CH3       19
> > +#define BCM2835_IRQ_ID_DMA_CH4       20
> > +#define BCM2835_IRQ_ID_DMA_CH5       21
> > +#define BCM2835_IRQ_ID_DMA_CH6       22
> > +#define BCM2835_IRQ_ID_DMA_CH7       23
> > +#define BCM2835_IRQ_ID_DMA_CH8       24
> > +#define BCM2835_IRQ_ID_DMA_CH9       25
> > +#define BCM2835_IRQ_ID_DMA_CH10      26
> > +#define BCM2835_IRQ_ID_DMA_CH11      27
> > +#define BCM2835_IRQ_ID_DMA_CH12      28
> >
> >  #define BCM2835_IRQ_ID_AUX           29
> >  #define BCM2835_IRQ_ID_SPI_SLAVE     43
> > diff --git a/c/src/lib/libbsp/arm/raspberrypi/irq/irq.c
> > b/c/src/lib/libbsp/arm/raspberrypi/irq/irq.c index 7b3b2be..3279b35
> 100644
> > --- a/c/src/lib/libbsp/arm/raspberrypi/irq/irq.c
> > +++ b/c/src/lib/libbsp/arm/raspberrypi/irq/irq.c
> > @@ -64,6 +64,21 @@ void bsp_interrupt_dispatch(void)
> >    {
> >        vector = BCM2835_IRQ_ID_UART;
> >    }
> > +  /* DMA 0 */
> > +  else if ( BCM2835_REG(BCM2835_IRQ_PENDING1) & BCM2835_BIT(16) )
> > +  {
> > +      vector = BCM2835_IRQ_ID_DMA_CH0;
> > +  }
> > +  /* DMA 1 */
> > +  else if ( BCM2835_REG(BCM2835_IRQ_PENDING1) & BCM2835_BIT(17) )
> > +  {
> > +      vector = BCM2835_IRQ_ID_DMA_CH1;
> > +  }
> > +  /* DMA 2 */
> > +  else if ( BCM2835_REG(BCM2835_IRQ_PENDING1) & BCM2835_BIT(18) )
> > +  {
> > +      vector = BCM2835_IRQ_ID_DMA_CH2;
> > +  }
>
> I hope, I have eliminated need for all these individual peripherals
> specific code in raspberrypi/irq/irq.c .
> See the commit
>
> https://git.rtems.org/rtems/commit/c/src/lib/libbsp/arm/
> raspberrypi/irq/irq.c?id=d216c5d6a2325551accb836429a6ac9cc2b2f4b7
>
> Try rebase your changes for other files to actual RTEMS GIT master.
> If there is some problem which prevents to your code to run
> with master then it is necessary to find what is broken
> on master. I try to help with it.
>
> May it be that there is some problem with irq.c code, I have
> tested it only by timer IRQ because other are not used by mater yet.
> But code written the way that it should be fully generic by now.
> It should support all 72 interrupt sources.
>
> >    /* GPIO 0*/
> >    else if ( BCM2835_REG(BCM2835_IRQ_PENDING2) & BCM2835_BIT(17) )
> >    {
> > @@ -114,6 +129,21 @@ rtems_status_code
> > bsp_interrupt_vector_enable(rtems_vector_number vector) {
> >        BCM2835_REG(BCM2835_IRQ_ENABLE2) =  BCM2835_BIT(25);
> >    }
> > +  /* DMA 0 */
> > +  else if ( vector == BCM2835_IRQ_ID_DMA_CH0 )
> > +  {
> > +      BCM2835_REG(BCM2835_IRQ_ENABLE1) =  BCM2835_BIT(16);
> > +  }
> > +  /* DMA 1 */
> > +  else if ( vector == BCM2835_IRQ_ID_DMA_CH1 )
> > +  {
> > +      BCM2835_REG(BCM2835_IRQ_ENABLE1) =  BCM2835_BIT(17);
> > +  }
> > +  /* DMA 2 */
> > +  else if ( vector == BCM2835_IRQ_ID_DMA_CH2 )
> > +  {
> > +      BCM2835_REG(BCM2835_IRQ_ENABLE1) =  BCM2835_BIT(18);
> > +  }
>
> Should be solved by master already.
>
> >    /* GPIO 0 */
> >    else if ( vector == BCM2835_IRQ_ID_GPIO_0 )
> >    {
> > @@ -164,6 +194,21 @@ rtems_status_code
> > bsp_interrupt_vector_disable(rtems_vector_number vector) {
> >        BCM2835_REG(BCM2835_IRQ_DISABLE2) = BCM2835_BIT(25);
> >    }
> > +  /* DMA 0 */
> > +  else if ( vector == BCM2835_IRQ_ID_DMA_CH0 )
> > +  {
> > +      BCM2835_REG(BCM2835_IRQ_DISABLE1) = BCM2835_BIT(16);
> > +  }
> > +  /* DMA 1 */
> > +  else if ( vector == BCM2835_IRQ_ID_DMA_CH1 )
> > +  {
> > +      BCM2835_REG(BCM2835_IRQ_DISABLE1) = BCM2835_BIT(17);
> > +  }
> > +  /* DMA 2 */
> > +  else if ( vector == BCM2835_IRQ_ID_DMA_CH2 )
> > +  {
> > +      BCM2835_REG(BCM2835_IRQ_DISABLE1) = BCM2835_BIT(18);
> > +  }
>
> Should be solved by master already.
>
> >    /* GPIO 0 */
> >    else if ( vector == BCM2835_IRQ_ID_GPIO_0 )
> >    {
>
> If you have problem with rebase then you can format patch,
> use editor to delete parts concerning files which should
> be untouched, then reset some branch back before patch series
> or to master and then apply modified patches.
> Again, I can help.
>
> I would be happy if you write some summary about testing, which
> attempts has been done, what worked, what failed and what has
> not been tested. Ideally, it should be done for work
> on your branch before rebase and after rebase to master.
>
> Best wishes,
>
>                Pavel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20160823/fa28ada2/attachment-0002.html>


More information about the devel mailing list