public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
From: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
To: ecos-patches@sourceware.org
Subject: Re: LPC2xxx patch for support of vectored interrupt controller
Date: Mon, 20 Aug 2007 15:14:00 -0000	[thread overview]
Message-ID: <20070820151336.GA1125@grumpf.hope-2000.org> (raw)
In-Reply-To: <20070817171322.GB26081@grumpf.hope-2000.org>

[-- Attachment #1: Type: text/plain, Size: 902 bytes --]

On Fri, Aug 17, 2007 at 07:13:23PM +0200, Hans Rosenfeld wrote:
> On Fri, Aug 17, 2007 at 04:02:09PM +0200, Hans Rosenfeld wrote:
> > A less simple solution would be to fix the drivers and the kintr0 test
> > to use configurable priorities. If it wouldn't involve kintr0 I would
> > just do that.

I did some minor changes intr0 and kintr0 to use a configurable
interrupt priority, which should be set to 16 for LPC2xxx systems.

There is another change required to the LPC2xxx HAL. The above tests
use hal_interrupt_configure() on some random interrupt vector, but this
function contains a assertion to make sure that only external interrupts
are configures. I think it would be better to change this assertion into
a simple test, so that calling hal_interrupt_configure() with an
un-configurable interrupt vector just does nothing.


-- 
%SYSTEM-F-ANARCHISM, The operating system has been overthrown

[-- Attachment #2: priorities-kernel.diff --]
[-- Type: text/plain, Size: 4969 bytes --]

Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/ChangeLog,v
retrieving revision 1.143
diff -u -r1.143 ChangeLog
--- ChangeLog	2 Jul 2007 11:49:09 -0000	1.143
+++ ChangeLog	20 Aug 2007 14:54:14 -0000
@@ -1,3 +1,8 @@
+2007-08-20  Hans Rosenfeld  <rosenfeld@grumpf.hope-2000.org>
+
+	* cdl/kernel.cdl, tests/intr0.cxx, tests/kintr0.cxx: Added option
+	to set the interrupt priority used by the intr0 and kintr0 tests.
+
 2007-07-02  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/debug/dbg_gdb.cxx: 
Index: cdl/kernel.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/cdl/kernel.cdl,v
retrieving revision 1.21
diff -u -r1.21 kernel.cdl
--- cdl/kernel.cdl	8 Jan 2007 16:20:13 -0000	1.21
+++ cdl/kernel.cdl	20 Aug 2007 14:54:15 -0000
@@ -317,7 +317,7 @@
                 the set of global flags if present."
         }
 
-        cdl_option CYGPKG_KERNEL_TESTS {
+        cdl_component CYGPKG_KERNEL_TESTS {
             display "Kernel tests"
             flavor  data
             no_define
@@ -330,6 +330,16 @@
             }
             description   "
                 This option specifies the set of tests for the eCos kernel."
+
+            cdl_option CYGNUM_KERNEL_INTR_TEST_PRIO {
+                display       "interrupt priority used by intr0/kintr0 test"
+                flavor        booldata
+                default_value 0
+                legal_values  0 to 16
+                description   "The intr0 and kintr0 tests create several interrupts.
+                               This option selects the interrupt priority to be used
+                               for these interrupts."
+            }
         }
     }
 }
Index: tests/intr0.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/tests/intr0.cxx,v
retrieving revision 1.13
diff -u -r1.13 intr0.cxx
--- tests/intr0.cxx	11 Aug 2006 09:29:31 -0000	1.13
+++ tests/intr0.cxx	20 Aug 2007 14:54:15 -0000
@@ -60,6 +60,14 @@
 
 #include "testaux.hxx"
 
+#ifdef CYGNUM_KERNEL_INTR_TEST_PRIO
+#define PRIO_0 CYGNUM_KERNEL_INTR_TEST_PRIO
+#define PRIO_1 CYGNUM_KERNEL_INTR_TEST_PRIO
+#else
+#define PRIO_0 0
+#define PRIO_1 1
+#endif
+
 static cyg_ISR isr0, isr1;
 static cyg_DSR dsr0, dsr1;
 
@@ -97,7 +105,7 @@
 
 static bool flash( void )
 {
-    Cyg_Interrupt intr0 = Cyg_Interrupt(CYGNUM_HAL_ISR_MIN, 0, (CYG_ADDRWORD)333, isr0, dsr0 );
+    Cyg_Interrupt intr0 = Cyg_Interrupt(CYGNUM_HAL_ISR_MIN, PRIO_0, (CYG_ADDRWORD)333, isr0, dsr0 );
 
     return true;
 }
@@ -134,13 +142,13 @@
     HAL_INTERRUPT_IN_USE( lvl1, in_use );
     Cyg_Interrupt* intr0 = NULL;
     if (!in_use)
-        intr0 = new((void *)&intr0_obj[0]) Cyg_Interrupt( lvl1, 1, (CYG_ADDRWORD)777, isr0, dsr0 );
+        intr0 = new((void *)&intr0_obj[0]) Cyg_Interrupt( lvl1, PRIO_1, (CYG_ADDRWORD)777, isr0, dsr0 );
      
     cyg_vector lvl2 = CYGNUM_HAL_ISR_MIN + ( 15 % CYGNUM_HAL_ISR_COUNT);
     HAL_INTERRUPT_IN_USE( lvl2, in_use );
     Cyg_Interrupt* intr1 = NULL;
     if (!in_use && lvl1 != lvl2)
-        intr1 = new((void *)&intr1_obj[0]) Cyg_Interrupt( lvl2, 1, 888, isr1, dsr1 );
+        intr1 = new((void *)&intr1_obj[0]) Cyg_Interrupt( lvl2, PRIO_1, 888, isr1, dsr1 );
 
     // Check these functions at least exist
     Cyg_Interrupt::disable_interrupts();
Index: tests/kintr0.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/tests/kintr0.c,v
retrieving revision 1.12
diff -u -r1.12 kintr0.c
--- tests/kintr0.c	11 Aug 2006 09:29:31 -0000	1.12
+++ tests/kintr0.c	20 Aug 2007 14:54:15 -0000
@@ -61,6 +61,14 @@
 
 #include "testaux.h"
 
+#ifdef CYGNUM_KERNEL_INTR_TEST_PRIO
+#define PRIO_0 CYGNUM_KERNEL_INTR_TEST_PRIO
+#define PRIO_1 CYGNUM_KERNEL_INTR_TEST_PRIO
+#else
+#define PRIO_0 0
+#define PRIO_1 1
+#endif
+
 static cyg_interrupt intr_obj[2];
 
 static cyg_handle_t intr0, intr1;
@@ -103,7 +111,7 @@
     cyg_handle_t handle;
     cyg_interrupt intr;
 
-    cyg_interrupt_create(CYGNUM_HAL_ISR_MIN, 0, (cyg_addrword_t)333, 
+    cyg_interrupt_create(CYGNUM_HAL_ISR_MIN, PRIO_0, (cyg_addrword_t)333, 
                          isr0, dsr0, &handle, &intr );
     cyg_interrupt_delete(handle);
 
@@ -156,13 +164,13 @@
     HAL_INTERRUPT_IN_USE( lvl1, in_use );
     intr0 = 0;
     if (!in_use)
-        cyg_interrupt_create(lvl1, 1, (cyg_addrword_t)777, isr0, dsr0, 
+        cyg_interrupt_create(lvl1, PRIO_1, (cyg_addrword_t)777, isr0, dsr0, 
                              &intr0, &intr_obj[0]);
     
     HAL_INTERRUPT_IN_USE( lvl2, in_use );
     intr1 = 0;
     if (!in_use && lvl1 != lvl2)
-        cyg_interrupt_create(lvl2, 1, 888, isr1, dsr1, &intr1, &intr_obj[1]);
+        cyg_interrupt_create(lvl2, PRIO_1, 888, isr1, dsr1, &intr1, &intr_obj[1]);
 
     // Check these functions at least exist
 

[-- Attachment #3: hal_interrupt_configure.diff --]
[-- Type: text/plain, Size: 787 bytes --]

Index: lpc2xxx_misc.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/lpc2xxx/var/current/src/lpc2xxx_misc.c,v
retrieving revision 1.5
diff -u -r1.5 lpc2xxx_misc.c
--- lpc2xxx_misc.c	30 Jul 2007 18:09:47 -0000	1.5
+++ lpc2xxx_misc.c	20 Aug 2007 14:46:32 -0000
@@ -355,8 +355,9 @@
     cyg_uint32 regval, saved_vpbdiv;
 
     // Only external interrupts are configurable	
-    CYG_ASSERT(vector <= CYGNUM_HAL_INTERRUPT_EINT3 &&
-               vector >= CYGNUM_HAL_INTERRUPT_EINT0 , "Invalid vector");
+    if(vector < CYGNUM_HAL_INTERRUPT_EINT0 ||
+       vector > CYGNUM_HAL_INTERRUPT_EINT3)
+            return;
 
     // Map int vector to corresponding bit (0..3)
     vector = 1 << (vector - CYGNUM_HAL_INTERRUPT_EINT0);

  parent reply	other threads:[~2007-08-20 15:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-10  6:11 uwe.kindler
2007-07-30 18:10 ` Andrew Lunn
2007-08-17 14:02 ` Hans Rosenfeld
2007-08-17 17:14   ` Hans Rosenfeld
2007-08-20  5:52     ` cetoni GmbH - Uwe Kindler
2007-08-20 15:14     ` Hans Rosenfeld [this message]
2007-08-22  8:25       ` Andrew Lunn
     [not found]         ` <20070822084026.GA2126@grumpf.hope-2000.org>
     [not found]           ` <20070822091803.GH31057@lunn.ch>
     [not found]             ` <20070822095228.GD2126@grumpf.hope-2000.org>
     [not found]               ` <20070822100626.GJ31057@lunn.ch>
     [not found]                 ` <20070822105132.GF2126@grumpf.hope-2000.org>
     [not found]                   ` <20070822111216.GL31057@lunn.ch>
2007-08-22 13:47                     ` [ECOS] " Hans Rosenfeld
     [not found]                       ` <20070822151524.GN31057@lunn.ch>
2007-08-22 17:55                         ` Hans Rosenfeld
2007-08-22 18:31                           ` Bart Veer
2007-08-23 10:57                             ` Hans Rosenfeld
2007-08-23 11:03                               ` Hans Rosenfeld
2007-09-15 14:45                                 ` Andrew Lunn
2007-08-21  6:12 cetoni GmbH - Uwe Kindler
2007-08-21  7:36 ` Hans Rosenfeld
2007-08-22  8:42 ` Andrew Lunn
2007-08-22  9:23   ` Hans Rosenfeld
2007-08-22  9:45     ` Andrew Lunn
2007-08-22  9:49     ` cetoni GmbH - Uwe Kindler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070820151336.GA1125@grumpf.hope-2000.org \
    --to=rosenfeld@grumpf.hope-2000.org \
    --cc=ecos-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).