[rtems commit] bsp/arm: SMP support for a9mpcore_clock_cleanup()

Sebastian Huber sebh at rtems.org
Thu Mar 13 15:15:49 UTC 2014


Module:    rtems
Branch:    master
Commit:    34568acf68aa8894c4e81a1528e850e97d6dd834
Changeset: http://git.rtems.org/rtems/commit/?id=34568acf68aa8894c4e81a1528e850e97d6dd834

Author:    Ralf Kirchner <ralf.kirchner at embedded-brains.de>
Date:      Wed Mar  5 09:14:59 2014 +0100

bsp/arm: SMP support for a9mpcore_clock_cleanup()

---

 .../libbsp/arm/shared/arm-a9mpcore-clock-config.c  |   22 ++++++++++++++++---
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c b/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
index e32657d..f2ffd5f 100644
--- a/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
+++ b/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
@@ -105,17 +105,31 @@ CPU_Counter_ticks _CPU_Counter_read(void)
   return gt->cntrlower;
 }
 
-static void a9mpcore_clock_cleanup(void)
+static void a9mpcore_clock_cleanup_isr(void *arg)
 {
   volatile a9mpcore_gt *gt = A9MPCORE_GT;
-  rtems_status_code sc;
+
+  (void) arg;
 
   gt->ctrl &= A9MPCORE_GT_CTRL_TMR_EN;
   gt->irqst = A9MPCORE_GT_IRQST_EFLG;
+}
 
-  sc = rtems_interrupt_handler_remove(
+static void a9mpcore_clock_cleanup(void)
+{
+  rtems_status_code sc;
+
+  /*
+   * The relevant registers / bits of the global timer are banked and chances
+   * are on an SPM system, that we are executing on the wrong CPU to reset
+   * them. Thus we will have the actual cleanup done with the next clock tick.
+   * The ISR will execute on the right CPU for the cleanup.
+   */
+  sc = rtems_interrupt_handler_install(
     A9MPCORE_IRQ_GT,
-    (rtems_interrupt_handler) Clock_isr,
+    "Clock",
+    RTEMS_INTERRUPT_REPLACE,
+    a9mpcore_clock_cleanup_isr,
     NULL
   );
   if (sc != RTEMS_SUCCESSFUL) {




More information about the vc mailing list