This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

system clock interrupt priority


A processor I ported to recently has an interrupt controller with a
slightly unusual requirement: every unmasked interrupt source must be
given a unique priority, or strange things happen when two interrupts
go off at the same time. For the various device drivers this was easy
enough to support, but the kernel registers an interrupt handler for
the system clock and so I needed a way of controlling the priority
used for that.

The patch below adds a new configuration option
CYGNUM_KERNEL_COUNTERS_CLOCK_ISR_PRIORITY and uses it in the
appropriate place. The default value for this option looks for another
option CYGNUM_HAL_KERNEL_COUNTERS_CLOCK_ISR_DEFAULT_PRIORITY. On
existing targets that will not be defined so the code reverts to the
old priority 1. On targets where the interrupt priorities must be
controlled more carefully the processor or platform HAL can define
suitable defaults for all devices, including the system clock, and the
user can still override these as appropriate.

Bart

Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/ChangeLog,v
retrieving revision 1.119
diff -u -r1.119 ChangeLog
--- ChangeLog	16 Apr 2004 03:33:59 -0000	1.119
+++ ChangeLog	8 Aug 2004 21:07:40 -0000
@@ -1,3 +1,10 @@
+2004-08-08  Bart Veer  <bartv@ecoscentric.com>
+
+	* cdl/counters.cdl: add new option for the clock interrupt
+	priority.
+
+	* src/common/clock.cxx (Cyg_RealTimeClock): use this option.
+
 2004-04-15  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* tests/fptest.c (do_test): Silence aliasing warning when breaking

Index: cdl/counters.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/cdl/counters.cdl,v
retrieving revision 1.7
diff -u -r1.7 counters.cdl
--- cdl/counters.cdl	24 Jul 2003 20:27:29 -0000	1.7
+++ cdl/counters.cdl	8 Aug 2004 21:08:23 -0000
@@ -64,6 +64,24 @@
         completely."
 }
 
+cdl_option CYGNUM_KERNEL_COUNTERS_CLOCK_ISR_PRIORITY {
+    display		"Interrupt priority for the real-time clock"
+    active_if		CYGVAR_KERNEL_COUNTERS_CLOCK
+    flavor		data
+    default_value	{ is_loaded(CYGNUM_HAL_KERNEL_COUNTERS_CLOCK_ISR_DEFAULT_PRIORITY) ?
+ 	                      CYGNUM_HAL_KERNEL_COUNTERS_CLOCK_ISR_DEFAULT_PRIORITY : 1 }
+    description "
+        The implementation of the kernel's real-time clock typically
+        involves installing an interrupt handler on a suitable hardware
+        timer. This option controls the priority level used for that
+        interrupt. On most platforms the value is not important because 
+        the clock ISR leaves most of the work to be done by the DSR. 
+        However some processors have interrupt controllers with special
+        requirements for the interrupt priorities, in which case
+        application developers must be able to manipulate the clock's
+        priority."
+}
+
 cdl_interface CYGINT_KERNEL_COUNTERS {
     requires 1 == CYGINT_KERNEL_COUNTERS
     no_define


Index: src/common/clock.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/src/common/clock.cxx,v
retrieving revision 1.20
diff -u -r1.20 clock.cxx
--- src/common/clock.cxx	13 Oct 2003 17:20:18 -0000	1.20
+++ src/common/clock.cxx	8 Aug 2004 21:10:02 -0000
@@ -831,7 +831,9 @@
 
 Cyg_RealTimeClock::Cyg_RealTimeClock()
     : Cyg_Clock(rtc_resolution),
-      interrupt(CYGNUM_HAL_INTERRUPT_RTC, 1, (CYG_ADDRWORD)this, isr, dsr)
+      interrupt(CYGNUM_HAL_INTERRUPT_RTC,
+                CYGNUM_KERNEL_COUNTERS_CLOCK_ISR_PRIORITY,
+                (CYG_ADDRWORD)this, isr, dsr)
 {
     CYG_REPORT_FUNCTION();
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]