ARM DSR()-s in non-kernel mode

Andrew Lunn andrew@lunn.ch
Sat Nov 20 15:22:00 GMT 2004


On Fri, Nov 19, 2004 at 04:58:07PM +0200, Jani Monoses wrote:
> Hello
> 
> this is what I had to do to get DSR's firing when not using the kernel.
> It seems to work but I am not sure if it's enough.Could somebody familiar 
> with ARM vectors.S comment?

It looks OK, but really Nick or Mark needs to comment.

Since this seems like a bug i have extended
hal/common/current/test/intr to call he DSR. This should hopefully
pick up on any other HALs which have the same problem. It works fine
on synth.

        Andrew

-------------- next part --------------
Index: hal/common/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/common/current/ChangeLog,v
retrieving revision 1.106
diff -u -r1.106 ChangeLog
--- hal/common/current/ChangeLog	22 Aug 2004 12:06:40 -0000	1.106
+++ hal/common/current/ChangeLog	20 Nov 2004 15:19:40 -0000
@@ -1,3 +1,8 @@
+2004-11-20  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* tests/intr.c: Make the ISR call the DSR to make sure this works
+	correctly.
+
 2004-08-22  Gary Thomas  <gary@mlbassoc.com>
 
 	* doc/porting.sgml: Replace [very misleading dated] comments
Index: hal/common/current/tests/intr.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/common/current/tests/intr.c,v
retrieving revision 1.10
diff -u -r1.10 intr.c
--- hal/common/current/tests/intr.c	23 May 2002 23:02:50 -0000	1.10
+++ hal/common/current/tests/intr.c	20 Nov 2004 15:19:40 -0000
@@ -74,6 +74,7 @@
 // -------------------------------------------------------------------------
 
 volatile cyg_count32 ticks = 0;
+volatile cyg_count32 dsr_ticks = 0;
 static cyg_interrupt intr;
 static cyg_handle_t  intr_handle;
 
@@ -91,18 +92,26 @@
     
     ticks++;
 
-    return CYG_ISR_HANDLED;
+    return CYG_ISR_CALL_DSR;
 }
 
 // -------------------------------------------------------------------------
 
+void dsr( cyg_uint32 vector, cyg_ucount32 count, CYG_ADDRWORD data )
+{
+    CYG_TEST_CHECK( ISR_DATA == data , "Bad data passed to DSR");
+    CYG_TEST_CHECK( CYGNUM_HAL_INTERRUPT_RTC == vector ,
+                    "Bad vector passed to DSR");
+
+    dsr_ticks += count;
+}
 
 void intr_main( void )
 {
     CYG_INTERRUPT_STATE oldints;
 
     cyg_drv_interrupt_create(CYGNUM_HAL_INTERRUPT_RTC, 1,
-                             ISR_DATA, isr, NULL, &intr_handle, &intr);
+                             ISR_DATA, isr, dsr, &intr_handle, &intr);
     cyg_drv_interrupt_attach(intr_handle);
     HAL_CLOCK_INITIALIZE( CYGNUM_HAL_RTC_PERIOD );
     cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_RTC);
@@ -114,6 +123,9 @@
         
     }
 
+
+    CYG_TEST_CHECK( dsr_ticks == 10, "DSR not called sufficient times");
+    
     HAL_DISABLE_INTERRUPTS(oldints);
 
     CYG_TEST_PASS_FINISH("HAL interrupt test");


More information about the Ecos-patches mailing list