[rtems commit] Remove Clock_driver_support_shutdown_hardware()

Sebastian Huber sebh at rtems.org
Fri Jun 29 09:53:21 UTC 2018


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jun  1 07:11:12 2018 +0200

Remove Clock_driver_support_shutdown_hardware()

The aim of this clock driver hook was to stop clock tick interrupts at
some late point in the exit() procedure.

The use of atexit() pulls in malloc() which pulls in errno. It is
incompatible with the intention of the
CONFIGURE_DISABLE_NEWLIB_REENTRANCY configuration option.

The exit() function must be called from thread context, so accompanied
clock tick interrupts should cause no harm.  On the contrary, someone
may assume a normal operating system operation, e.g. working timeouts.

Remove the Clock_driver_support_shutdown_hardware() clock driver hook.

Close #3436.

---

 bsps/arm/beagle/clock/clock.c                | 24 -------------------
 bsps/arm/csb336/clock/clockdrv.c             | 13 -----------
 bsps/arm/csb337/clock/clock.c                |  5 ----
 bsps/arm/edb7312/clock/clockdrv.c            | 11 ---------
 bsps/arm/gumstix/clock/clock.c               |  5 ----
 bsps/arm/raspberrypi/clock/clockdrv.c        |  7 ------
 bsps/arm/rtl22xx/clock/clockdrv.c            | 13 -----------
 bsps/arm/shared/clock/clock-a9mpcore.c       | 35 ----------------------------
 bsps/arm/shared/clock/clock-armv7m.c         | 10 --------
 bsps/arm/shared/clock/clock-nxp-lpc.c        | 20 ----------------
 bsps/arm/smdk2410/clock/clockdrv.c           | 12 ----------
 bsps/arm/tms570/clock/clock.c                | 16 -------------
 bsps/i386/pc386/clock/ckinit.c               | 24 -------------------
 bsps/lm32/shared/clock/ckinit.c              |  7 ------
 bsps/lm32/shared/milkymist_clock/ckinit.c    |  6 -----
 bsps/m68k/av5282/clock/clock.c               |  8 -------
 bsps/m68k/gen68360/clock/clock.c             |  8 -------
 bsps/m68k/genmcf548x/clock/clock.c           |  8 -------
 bsps/m68k/mcf52235/clock/clock.c             |  8 -------
 bsps/m68k/mcf5225x/clock/clock.c             |  8 -------
 bsps/m68k/mcf5235/clock/clock.c              |  8 -------
 bsps/m68k/mcf5329/clock/clock.c              |  8 -------
 bsps/m68k/uC5282/clock/clock.c               |  8 -------
 bsps/mips/csb350/clock/clockdrv.c            |  2 --
 bsps/mips/jmr3904/clock/clockdrv.c           |  2 --
 bsps/mips/rbtx4925/clock/clockdrv.c          | 12 ----------
 bsps/mips/rbtx4938/clock/clockdrv.c          | 14 -----------
 bsps/mips/shared/clock/clockdrv.c            |  5 ----
 bsps/nios2/nios2_iss/clock/clock.c           |  8 -------
 bsps/or1k/generic_or1k/clock/clockdrv.c      | 17 --------------
 bsps/powerpc/mpc55xxevb/clock/clock-config.c | 10 --------
 bsps/powerpc/qoriq/clock/clock-config.c      | 19 ---------------
 bsps/riscv/riscv_generic/clock/clockdrv.c    |  9 -------
 bsps/shared/dev/clock/clock-simidle.c        | 25 ++++++--------------
 bsps/shared/dev/clock/clockimpl.h            | 21 +----------------
 bsps/sparc/erc32/clock/ckinit.c              |  9 -------
 bsps/sparc/leon2/clock/ckinit.c              |  6 -----
 bsps/sparc/leon3/clock/ckinit.c              |  6 -----
 bsps/sparc/shared/btimer/tlib_ckinit.c       | 14 -----------
 bsps/sparc64/shared/clock/ckinit.c           |  5 ----
 40 files changed, 8 insertions(+), 448 deletions(-)

diff --git a/bsps/arm/beagle/clock/clock.c b/bsps/arm/beagle/clock/clock.c
index d8b2062..d42b051 100644
--- a/bsps/arm/beagle/clock/clock.c
+++ b/bsps/arm/beagle/clock/clock.c
@@ -290,34 +290,10 @@ static void beagle_clock_handler_install(rtems_interrupt_handler isr)
   clock_isr = isr;
 }
 
-static void beagle_clock_cleanup(void)
-{
-  rtems_status_code sc = RTEMS_SUCCESSFUL;
-
-  /* Disable timer */
-  mmio_clear(timer->base + timer->regs->TCLR, OMAP3_TCLR_ST);
-
-  /* Remove interrupt handler */
-  sc = rtems_interrupt_handler_remove(
-    timer->irq_nr,
-    clock_isr,
-    NULL
-  );
-  if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal_error_occurred(0xdeadbeef);
-  }
-  clock_isr = NULL;
-
-  /* stop frclock */
-  mmio_clear(fr_timer->base + fr_timer->regs->TCLR, OMAP3_TCLR_ST);
-}
-
 #define Clock_driver_support_at_tick() beagle_clock_at_tick()
 #define Clock_driver_support_initialize_hardware() beagle_clock_initialize()
 #define Clock_driver_support_install_isr(isr) \
   beagle_clock_handler_install(isr)
 
-#define Clock_driver_support_shutdown_hardware() beagle_clock_cleanup()
-
 /* Include shared source clock driver code */
 #include "../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/arm/csb336/clock/clockdrv.c b/bsps/arm/csb336/clock/clockdrv.c
index ec56615..58f98d8 100644
--- a/bsps/arm/csb336/clock/clockdrv.c
+++ b/bsps/arm/csb336/clock/clockdrv.c
@@ -82,19 +82,6 @@ rtems_irq_connect_data clock_isr_data = {
      } while (0)
 
 /**
- * Do whatever you need to shut the clock down and remove the
- * interrupt handler. Since this normally only gets called on
- * RTEMS shutdown, you may not need to do anything other than
- * remove the ISR.
- */
-#define Clock_driver_support_shutdown_hardware()                        \
-  do {                                                                  \
-    /* Disable timer */ \
-    MC9328MXL_TMR1_TCTL = 0; \
-    BSP_remove_rtems_irq_handler(&clock_isr_data);                  \
-  } while (0)
-
-/**
  * Enables clock interrupt.
  *
  * If the interrupt is always on, this can be a NOP.
diff --git a/bsps/arm/csb337/clock/clock.c b/bsps/arm/csb337/clock/clock.c
index 5611144..69a3daf 100644
--- a/bsps/arm/csb337/clock/clock.c
+++ b/bsps/arm/csb337/clock/clock.c
@@ -103,11 +103,6 @@ static void Clock_driver_support_initialize_hardware(void)
     (void) st_str; /* avoid set but not used warning */ \
   } while (0)
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    BSP_remove_rtems_irq_handler(&clock_isr_data); \
-  } while (0)
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/arm/edb7312/clock/clockdrv.c b/bsps/arm/edb7312/clock/clockdrv.c
index 26839f3..8c7cc4f 100644
--- a/bsps/arm/edb7312/clock/clockdrv.c
+++ b/bsps/arm/edb7312/clock/clockdrv.c
@@ -56,17 +56,6 @@ void Clock_isr(void * arg);
     *EP7312_TC1EOI = 0xFFFFFFFF;                    \
   } while (0)
 
-#define Clock_driver_support_shutdown_hardware()    \
-  do {                                              \
-    rtems_status_code status = RTEMS_SUCCESSFUL;    \
-    status = rtems_interrupt_handler_remove(        \
-        BSP_TC1OI,                                  \
-        Clock_isr,                                  \
-        NULL                                        \
-    );                                              \
-    assert(status == RTEMS_SUCCESSFUL);             \
-  } while (0)
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/arm/gumstix/clock/clock.c b/bsps/arm/gumstix/clock/clock.c
index 0c4e1f8..c844f50 100644
--- a/bsps/arm/gumstix/clock/clock.c
+++ b/bsps/arm/gumstix/clock/clock.c
@@ -108,11 +108,6 @@ static void Clock_driver_support_initialize_hardware(void)
     XSCALE_OS_TIMER_MR0 = XSCALE_OS_TIMER_TCR + period_num; \
   } while (0)
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    BSP_remove_rtems_irq_handler(&clock_isr_data); \
-  } while (0)
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/arm/raspberrypi/clock/clockdrv.c b/bsps/arm/raspberrypi/clock/clockdrv.c
index 2f6ec5b..9954d41 100644
--- a/bsps/arm/raspberrypi/clock/clockdrv.c
+++ b/bsps/arm/raspberrypi/clock/clockdrv.c
@@ -95,17 +95,10 @@ static void raspberrypi_clock_initialize_hardware(void)
   rtems_timecounter_install(&raspberrypi_tc);
 }
 
-static void raspberrypi_clock_cleanup(void)
-{
-  bsp_interrupt_vector_disable(BCM2835_IRQ_ID_GPU_TIMER_M3);
-}
-
 #define Clock_driver_support_at_tick() raspberrypi_clock_at_tick()
 
 #define Clock_driver_support_initialize_hardware() raspberrypi_clock_initialize_hardware()
 
-#define Clock_driver_support_shutdown_hardware() raspberrypi_clock_cleanup()
-
 #define Clock_driver_support_install_isr(clock_isr) \
   raspberrypi_clock_handler_install_isr(clock_isr)
 
diff --git a/bsps/arm/rtl22xx/clock/clockdrv.c b/bsps/arm/rtl22xx/clock/clockdrv.c
index 84ab9c0..0e8fa27 100644
--- a/bsps/arm/rtl22xx/clock/clockdrv.c
+++ b/bsps/arm/rtl22xx/clock/clockdrv.c
@@ -127,19 +127,6 @@ rtems_irq_connect_data clock_isr_data = {
   } while (0)
 
 /**
- * Do whatever you need to shut the clock down and remove the
- * interrupt handler. Since this normally only gets called on
- * RTEMS shutdown, you may not need to do anything other than
- * remove the ISR.
- */
-#define Clock_driver_support_shutdown_hardware()                        \
-  do {                                                                  \
-    /* Disable timer */ \
-    T0TCR&=~0x02; \
-    BSP_remove_rtems_irq_handler(&clock_isr_data);                  \
-  } while (0)
-
-/**
  * Enables clock interrupt.
  *
  * If the interrupt is always on, this can be a NOP.
diff --git a/bsps/arm/shared/clock/clock-a9mpcore.c b/bsps/arm/shared/clock/clock-a9mpcore.c
index a68a627..05d3c09 100644
--- a/bsps/arm/shared/clock/clock-a9mpcore.c
+++ b/bsps/arm/shared/clock/clock-a9mpcore.c
@@ -169,38 +169,6 @@ CPU_Counter_ticks _CPU_Counter_read(void)
   return gt->cntrlower;
 }
 
-static void a9mpcore_clock_cleanup_isr(void *arg)
-{
-  volatile a9mpcore_gt *gt = A9MPCORE_GT;
-
-  (void) arg;
-
-  gt->ctrl &= A9MPCORE_GT_CTRL_TMR_EN;
-  gt->irqst = A9MPCORE_GT_IRQST_EFLG;
-}
-
-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,
-    "Clock",
-    RTEMS_INTERRUPT_REPLACE,
-    a9mpcore_clock_cleanup_isr,
-    NULL
-  );
-  if (sc != RTEMS_SUCCESSFUL) {
-    bsp_fatal(BSP_ARM_A9MPCORE_FATAL_CLOCK_IRQ_REMOVE);
-  }
-}
-
 #define Clock_driver_support_at_tick() \
   a9mpcore_clock_at_tick()
 
@@ -210,8 +178,5 @@ static void a9mpcore_clock_cleanup(void)
 #define Clock_driver_support_install_isr(isr) \
   a9mpcore_clock_handler_install()
 
-#define Clock_driver_support_shutdown_hardware() \
-  a9mpcore_clock_cleanup()
-
 /* Include shared source clock driver code */
 #include "../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/arm/shared/clock/clock-armv7m.c b/bsps/arm/shared/clock/clock-armv7m.c
index 2efe4c2..7a51690 100644
--- a/bsps/arm/shared/clock/clock-armv7m.c
+++ b/bsps/arm/shared/clock/clock-armv7m.c
@@ -88,22 +88,12 @@ RTEMS_SYSINIT_ITEM(
   RTEMS_SYSINIT_ORDER_FIRST
 );
 
-static void _ARMV7M_Clock_cleanup(void)
-{
-  volatile ARMV7M_Systick *systick = _ARMV7M_Systick;
-
-  systick->csr = 0;
-}
-
 #define Clock_driver_support_initialize_hardware() \
   _ARMV7M_Clock_initialize()
 
 #define Clock_driver_support_install_isr(isr) \
   _ARMV7M_Clock_handler_install()
 
-#define Clock_driver_support_shutdown_hardware() \
-  _ARMV7M_Clock_cleanup()
-
 /* Include shared source clock driver code */
 #include "../../../shared/dev/clock/clockimpl.h"
 
diff --git a/bsps/arm/shared/clock/clock-nxp-lpc.c b/bsps/arm/shared/clock/clock-nxp-lpc.c
index c551f75..feb7f83 100644
--- a/bsps/arm/shared/clock/clock-nxp-lpc.c
+++ b/bsps/arm/shared/clock/clock-nxp-lpc.c
@@ -105,31 +105,11 @@ static void lpc_clock_initialize(void)
   rtems_timecounter_install(&lpc_clock_tc);
 }
 
-static void lpc_clock_cleanup(void)
-{
-  rtems_status_code sc = RTEMS_SUCCESSFUL;
-
-  /* Disable timer */
-  lpc_clock->tcr = 0x0;
-
-  /* Remove interrupt handler */
-  sc = rtems_interrupt_handler_remove(
-    LPC_CLOCK_INTERRUPT,
-    (rtems_interrupt_handler) Clock_isr,
-    NULL
-  );
-  if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal_error_occurred(0xdeadbeef);
-  }
-}
-
 #define Clock_driver_support_at_tick() lpc_clock_at_tick()
 #define Clock_driver_support_initialize_hardware() lpc_clock_initialize()
 #define Clock_driver_support_install_isr(isr) \
   lpc_clock_handler_install()
 
-#define Clock_driver_support_shutdown_hardware() lpc_clock_cleanup()
-
 /* Include shared source clock driver code */
 #include "../../../shared/dev/clock/clockimpl.h"
 
diff --git a/bsps/arm/smdk2410/clock/clockdrv.c b/bsps/arm/smdk2410/clock/clockdrv.c
index 0430826..6e32b7d 100644
--- a/bsps/arm/smdk2410/clock/clockdrv.c
+++ b/bsps/arm/smdk2410/clock/clockdrv.c
@@ -76,18 +76,6 @@ rtems_irq_connect_data clock_isr_data = {
     } while (0)
 
 /**
- * Do whatever you need to shut the clock down and remove the
- * interrupt handler. Since this normally only gets called on
- * RTEMS shutdown, you may not need to do anything other than
- * remove the ISR.
- */
-#define Clock_driver_support_shutdown_hardware()                        \
-  do {                                                                  \
-        /* Disable timer */ \
-        BSP_remove_rtems_irq_handler(&clock_isr_data);                  \
-     } while (0)
-
-/**
  * Enables clock interrupt.
  *
  * If the interrupt is always on, this can be a NOP.
diff --git a/bsps/arm/tms570/clock/clock.c b/bsps/arm/tms570/clock/clock.c
index 2c1a54b..8290504 100644
--- a/bsps/arm/tms570/clock/clock.c
+++ b/bsps/arm/tms570/clock/clock.c
@@ -159,28 +159,12 @@ static void tms570_clock_driver_support_install_isr(
   }
 }
 
-/**
- * @brief disables RTI interrupt
- *
- * Called when closing clock driver
- *
- * @retval Void
- */
-static void tms570_clock_driver_support_shutdown_hardware( void )
-{
-  /* turn off the timer interrupts */
-  TMS570_RTI.CLEARINTENA = TMS570_RTI_CLEARINTENA_CLEAROVL0INT |
-                           TMS570_RTI_CLEARINTENA_CLEARINT0;  
-}
-
 #define Clock_driver_support_initialize_hardware \
                         tms570_clock_driver_support_initialize_hardware
 #define Clock_driver_support_at_tick \
                         tms570_clock_driver_support_at_tick
 #define Clock_driver_support_initialize_hardware \
                         tms570_clock_driver_support_initialize_hardware
-#define Clock_driver_support_shutdown_hardware \
-                        tms570_clock_driver_support_shutdown_hardware
 
 #define Clock_driver_support_install_isr(Clock_isr) \
               tms570_clock_driver_support_install_isr( Clock_isr )
diff --git a/bsps/i386/pc386/clock/ckinit.c b/bsps/i386/pc386/clock/ckinit.c
index fce267b..afd5d01 100644
--- a/bsps/i386/pc386/clock/ckinit.c
+++ b/bsps/i386/pc386/clock/ckinit.c
@@ -38,7 +38,6 @@ uint32_t pc386_clock_click_count;
 
 /* forward declaration */
 void Clock_isr(void *param);
-static void clockOff(void);
 static void Clock_isr_handler(void *param);
 
 /*
@@ -173,17 +172,6 @@ static void clockOn(void)
     calibrate_tsc();
 }
 
-static void clockOff(void)
-{
-  rtems_interrupt_lock_context lock_context;
-  rtems_interrupt_lock_acquire(&rtems_i386_i8254_access_lock, &lock_context);
-  /* reset timer mode to standard (BIOS) value */
-  outport_byte(TIMER_MODE, TIMER_SEL0 | TIMER_16BIT | TIMER_RATEGEN);
-  outport_byte(TIMER_CNTR0, 0);
-  outport_byte(TIMER_CNTR0, 0);
-  rtems_interrupt_lock_release(&rtems_i386_i8254_access_lock, &lock_context);
-} /* Clock_exit */
-
 bool Clock_isr_enabled = false;
 static void Clock_isr_handler(void *param)
 {
@@ -247,16 +235,4 @@ void Clock_driver_support_initialize_hardware(void)
   Clock_isr_enabled = true;
 }
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    rtems_status_code status; \
-    clockOff(); \
-    status = rtems_interrupt_handler_remove(  \
-      BSP_PERIODIC_TIMER, \
-      Clock_isr_handler,  \
-      NULL  \
-    );  \
-    assert(status == RTEMS_SUCCESSFUL); \
-  } while (0)
-
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/lm32/shared/clock/ckinit.c b/bsps/lm32/shared/clock/ckinit.c
index 4d235e7..4c64d47 100644
--- a/bsps/lm32/shared/clock/ckinit.c
+++ b/bsps/lm32/shared/clock/ckinit.c
@@ -65,13 +65,6 @@ static void Clock_driver_support_initialize_hardware(void)
   lm32_interrupt_unmask(CLOCK_IRQMASK);
 }
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    /* Disable clock interrupts and stop */ \
-    lm32_interrupt_unmask(CLOCK_IRQMASK); \
-    clockwrite(LM32_CLOCK_CR, LM32_CLOCK_CR_STOP); \
-  } while (0)
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/lm32/shared/milkymist_clock/ckinit.c b/bsps/lm32/shared/milkymist_clock/ckinit.c
index c138309..b10eb85 100644
--- a/bsps/lm32/shared/milkymist_clock/ckinit.c
+++ b/bsps/lm32/shared/milkymist_clock/ckinit.c
@@ -41,12 +41,6 @@ static void Clock_driver_support_initialize_hardware(void)
   bsp_interrupt_vector_enable(MM_IRQ_TIMER0);
 }
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    bsp_interrupt_vector_disable(MM_IRQ_TIMER0); \
-    MM_WRITE(MM_TIMER0_CONTROL, 0); \
-  } while (0)
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/m68k/av5282/clock/clock.c b/bsps/m68k/av5282/clock/clock.c
index f6e42f2..b1e169b 100644
--- a/bsps/m68k/av5282/clock/clock.c
+++ b/bsps/m68k/av5282/clock/clock.c
@@ -26,14 +26,6 @@
     set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware()   \
-    do {                                           \
-        MCF5282_PIT3_PCSR &= ~MCF5282_PIT_PCSR_EN; \
-    } while(0)
-
-/*
  * Set up the clock hardware
  *
  * We need to have 1 interrupt every 10,000 microseconds
diff --git a/bsps/m68k/gen68360/clock/clock.c b/bsps/m68k/gen68360/clock/clock.c
index b95ca5d..4bd3204 100644
--- a/bsps/m68k/gen68360/clock/clock.c
+++ b/bsps/m68k/gen68360/clock/clock.c
@@ -55,14 +55,6 @@ static unsigned long nsec;
     set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware() \
-    do {                       \
-        m360.pitr &= ~0xFF;    \
-    } while(0)
-
-/*
  * Set up the clock hardware
  *     The rate at which the periodic interval timer
  *     can generate interrupts is almost certainly not
diff --git a/bsps/m68k/genmcf548x/clock/clock.c b/bsps/m68k/genmcf548x/clock/clock.c
index 68b7c5f..b3a574d 100644
--- a/bsps/m68k/genmcf548x/clock/clock.c
+++ b/bsps/m68k/genmcf548x/clock/clock.c
@@ -73,14 +73,6 @@
     set_vector(_new, CLOCK_IRQ + 64, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware()                         \
-    do {                                                                 \
-        MCF548X_SLT_SCR0 &= ~(MCF548X_SLT_SCR_TEN | MCF548X_SLT_SCR_RUN | MCF548X_SLT_SCR_IEN); \
-    } while(0)
-
-/*
  * Set up the clock hardware
  *
  * We need to have 1 interrupt every 10,000 microseconds
diff --git a/bsps/m68k/mcf52235/clock/clock.c b/bsps/m68k/mcf52235/clock/clock.c
index a879a77..d5e1817 100644
--- a/bsps/m68k/mcf52235/clock/clock.c
+++ b/bsps/m68k/mcf52235/clock/clock.c
@@ -53,14 +53,6 @@ static void mcf52235_tc_tick(void)
   set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    MCF_PIT1_PCSR &= ~MCF_PIT_PCSR_EN; \
-  } while (0)
-
-/*
  * Set up the clock hardware
  *
  * We need to have 1 interrupt every rtems_configuration_get_microseconds_per_tick()
diff --git a/bsps/m68k/mcf5225x/clock/clock.c b/bsps/m68k/mcf5225x/clock/clock.c
index b01c37a..9a9c7ca 100644
--- a/bsps/m68k/mcf5225x/clock/clock.c
+++ b/bsps/m68k/mcf5225x/clock/clock.c
@@ -53,14 +53,6 @@ static void mcf5225x_tc_tick(void)
   set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    MCF_PIT1_PCSR &= ~MCF_PIT_PCSR_EN; \
-  } while (0)
-
-/*
  * Set up the clock hardware
  *
  * We need to have 1 interrupt every BSP_rtems_configuration_get_microseconds_per_tick()
diff --git a/bsps/m68k/mcf5235/clock/clock.c b/bsps/m68k/mcf5235/clock/clock.c
index db3a585..8b848de 100644
--- a/bsps/m68k/mcf5235/clock/clock.c
+++ b/bsps/m68k/mcf5235/clock/clock.c
@@ -26,14 +26,6 @@
     set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware()   \
-    do {                                           \
-        MCF5235_PIT_PCSR3 &= ~MCF5235_PIT_PCSR_EN; \
-    } while(0)
-
-/*
  * Set up the clock hardware
  *
  * We need to have 1 interrupt every 10,000 microseconds
diff --git a/bsps/m68k/mcf5329/clock/clock.c b/bsps/m68k/mcf5329/clock/clock.c
index 5638238..6ad46fe 100644
--- a/bsps/m68k/mcf5329/clock/clock.c
+++ b/bsps/m68k/mcf5329/clock/clock.c
@@ -53,14 +53,6 @@ static void mcf5329_tc_tick(void)
   set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    MCF_PIT3_PCSR &= ~MCF_PIT_PCSR_EN; \
-  } while (0)
-
-/*
  * Set up the clock hardware
  *
  * We need to have 1 interrupt every rtems_configuration_get_microseconds_per_tick()
diff --git a/bsps/m68k/uC5282/clock/clock.c b/bsps/m68k/uC5282/clock/clock.c
index 8fffdc0..b156d66 100644
--- a/bsps/m68k/uC5282/clock/clock.c
+++ b/bsps/m68k/uC5282/clock/clock.c
@@ -79,14 +79,6 @@ static void uC5282_tc_tick(void)
     set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware()   \
-    do {                                           \
-        MCF5282_PIT3_PCSR &= ~MCF5282_PIT_PCSR_EN; \
-    } while(0)
-
-/*
  * Set up the clock hardware
  *
  * f_pit = f_clk / 2^(preScaleCode+1) / N  = 1/(us_per_tick/us_per_s)
diff --git a/bsps/mips/csb350/clock/clockdrv.c b/bsps/mips/csb350/clock/clockdrv.c
index e42261e..3816bc1 100644
--- a/bsps/mips/csb350/clock/clockdrv.c
+++ b/bsps/mips/csb350/clock/clockdrv.c
@@ -83,8 +83,6 @@ void au1x00_clock_init(void)
      au1x00_clock_init(); \
   } while(0)
 
-#define Clock_driver_support_shutdown_hardware()
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/mips/jmr3904/clock/clockdrv.c b/bsps/mips/jmr3904/clock/clockdrv.c
index e0539f1..29f616f 100644
--- a/bsps/mips/jmr3904/clock/clockdrv.c
+++ b/bsps/mips/jmr3904/clock/clockdrv.c
@@ -43,8 +43,6 @@
     *((volatile uint32_t*) 0xFFFFC01C) = 0x00000700; \
   } while(0)
 
-#define Clock_driver_support_shutdown_hardware()
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/mips/rbtx4925/clock/clockdrv.c b/bsps/mips/rbtx4925/clock/clockdrv.c
index 2a3121a..395be9f 100644
--- a/bsps/mips/rbtx4925/clock/clockdrv.c
+++ b/bsps/mips/rbtx4925/clock/clockdrv.c
@@ -103,18 +103,6 @@
   } while(0)
 
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-  	uint32_t temp; \
-    temp = TX4925_REG_READ( TX4925_REG_BASE, TX4925_TIMER0_BASE + TX4925_TIMER_ITMR ); /* Disable interval timer interrupt */ \
-    temp &= ~TIMER_INT_ENABLE_MASK; \
-    TX4925_REG_WRITE( TX4925_REG_BASE, TX4925_TIMER0_BASE + TX4925_TIMER_ITMR, temp ); \
-    temp = TX4925_REG_READ( TX4925_REG_BASE, TX4925_TIMER0_BASE + TX4925_TIMER_PGMR ); /* Disable pulse generator interrupt */ \
-    temp &= ~(TPIAE | TPIBE); \
-    TX4925_REG_WRITE( TX4925_REG_BASE, TX4925_TIMER0_BASE + TX4925_TIMER_PGMR, temp ); \
-    TX4925_REG_WRITE( TX4925_REG_BASE, TX4925_TIMER0_BASE + TX4925_TIMER_TCR, 0x0 ); /* Disable timer */ \
-  } while(0)
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/mips/rbtx4938/clock/clockdrv.c b/bsps/mips/rbtx4938/clock/clockdrv.c
index 616defc..c952424 100644
--- a/bsps/mips/rbtx4938/clock/clockdrv.c
+++ b/bsps/mips/rbtx4938/clock/clockdrv.c
@@ -100,20 +100,6 @@ void new_brk_esr(void)
   } while(0)
 
 
-
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-  	uint32_t temp; \
-    temp = TX4938_REG_READ( TX4938_REG_BASE, TX4938_TIMER0_BASE + TX4938_TIMER_ITMR ); /* Disable interval timer interrupt */ \
-    temp &= ~TIMER_INT_ENABLE_MASK; \
-    TX4938_REG_WRITE( TX4938_REG_BASE, TX4938_TIMER0_BASE + TX4938_TIMER_ITMR, temp ); \
-    temp = TX4938_REG_READ( TX4938_REG_BASE, TX4938_TIMER0_BASE + TX4938_TIMER_PGMR ); /* Disable pulse generator interrupt */ \
-    temp &= ~(TPIAE | TPIBE); \
-    TX4938_REG_WRITE( TX4938_REG_BASE, TX4938_TIMER0_BASE + TX4938_TIMER_PGMR, temp ); \
-    TX4938_REG_WRITE( TX4938_REG_BASE, TX4938_TIMER0_BASE + TX4938_TIMER_TCR, 0x0 ); /* Disable timer */ \
-  } while(0)
-
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/mips/shared/clock/clockdrv.c b/bsps/mips/shared/clock/clockdrv.c
index 658666c..f1074a6 100644
--- a/bsps/mips/shared/clock/clockdrv.c
+++ b/bsps/mips/shared/clock/clockdrv.c
@@ -39,11 +39,6 @@ static uint32_t mips_timer_rate = 0;
     mips_enable_in_interrupt_mask(CLOCK_VECTOR_MASK); \
   } while(0)
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    mips_disable_in_interrupt_mask(CLOCK_VECTOR_MASK); \
-  } while (0)
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/nios2/nios2_iss/clock/clock.c b/bsps/nios2/nios2_iss/clock/clock.c
index 0ec0a71..5b9b6bb 100644
--- a/bsps/nios2/nios2_iss/clock/clock.c
+++ b/bsps/nios2/nios2_iss/clock/clock.c
@@ -22,14 +22,6 @@
   set_vector(_new, CLOCK_VECTOR, 1)
 
 /*
- * Turn off the clock
- */
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    CLOCK_REGS->control = ALTERA_AVALON_TIMER_CONTROL_STOP_MSK; \
-  } while (0)
-
-/*
  * Set up the clock hardware
  */
 static void Clock_driver_support_initialize_hardware(void)
diff --git a/bsps/or1k/generic_or1k/clock/clockdrv.c b/bsps/or1k/generic_or1k/clock/clockdrv.c
index 569421d..e2a8e4d 100644
--- a/bsps/or1k/generic_or1k/clock/clockdrv.c
+++ b/bsps/or1k/generic_or1k/clock/clockdrv.c
@@ -112,21 +112,6 @@ static void generic_or1k_clock_initialize(void)
   rtems_timecounter_install(&or1ksim_tc);
 }
 
-static void generic_or1k_clock_cleanup(void)
-{
- uint32_t sr;
-
-  sr = _OR1K_mfspr(CPU_OR1K_SPR_SR);
-
-  /* Disable tick timer exceptions */
-  _OR1K_mtspr(CPU_OR1K_SPR_SR, (sr & ~CPU_OR1K_SPR_SR_IEE)
-  & ~CPU_OR1K_SPR_SR_TEE);
-
-  /* Invalidate tick timer config registers */
-  _OR1K_mtspr(CPU_OR1K_SPR_TTCR, 0);
-  _OR1K_mtspr(CPU_OR1K_SPR_TTMR, 0);
-}
-
 CPU_Counter_ticks _CPU_Counter_difference(
   CPU_Counter_ticks second,
   CPU_Counter_ticks first
@@ -142,6 +127,4 @@ CPU_Counter_ticks _CPU_Counter_difference(
 #define Clock_driver_support_install_isr(isr) \
   generic_or1k_clock_handler_install(isr)
 
-#define Clock_driver_support_shutdown_hardware() generic_or1k_clock_cleanup()
-
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/powerpc/mpc55xxevb/clock/clock-config.c b/bsps/powerpc/mpc55xxevb/clock/clock-config.c
index 41320c8..2c2122a 100644
--- a/bsps/powerpc/mpc55xxevb/clock/clock-config.c
+++ b/bsps/powerpc/mpc55xxevb/clock/clock-config.c
@@ -235,14 +235,6 @@ static void mpc55xx_clock_initialize(void)
   );
 }
 
-static void mpc55xx_clock_cleanup(void)
-{
-  volatile PIT_RTI_CHANNEL_tag *channel =
-    &PIT_RTI.CHANNEL [MPC55XX_CLOCK_PIT_CHANNEL];
-
-  channel->TCTRL.R = 0;
-}
-
 #endif
 
 #define Clock_driver_timecounter_tick() mpc55xx_tc_tick()
@@ -250,8 +242,6 @@ static void mpc55xx_clock_cleanup(void)
   mpc55xx_clock_initialize()
 #define Clock_driver_support_install_isr(isr) \
   mpc55xx_clock_handler_install(isr)
-#define Clock_driver_support_shutdown_hardware() \
-  mpc55xx_clock_cleanup()
 
 /* Include shared source clock driver code */
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/powerpc/qoriq/clock/clock-config.c b/bsps/powerpc/qoriq/clock/clock-config.c
index 335b156..6fb28ce 100644
--- a/bsps/powerpc/qoriq/clock/clock-config.c
+++ b/bsps/powerpc/qoriq/clock/clock-config.c
@@ -144,31 +144,12 @@ static void qoriq_clock_initialize(void)
   rtems_timecounter_install(&qoriq_clock_tc);
 }
 
-static void qoriq_clock_cleanup(void)
-{
-  rtems_status_code sc = RTEMS_SUCCESSFUL;
-
-  qoriq_clock->bcr = GTBCR_CI;
-
-  sc = rtems_interrupt_handler_remove(
-    CLOCK_INTERRUPT,
-    Clock_isr,
-    NULL
-  );
-  if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal_error_occurred(0xdeadbeef);
-  }
-}
-
 #define Clock_driver_support_install_isr(clock_isr) \
   qoriq_clock_handler_install()
 
 #define Clock_driver_support_set_interrupt_affinity(online_processors) \
   bsp_interrupt_set_affinity(CLOCK_INTERRUPT, online_processors)
 
-#define Clock_driver_support_shutdown_hardware() \
-  qoriq_clock_cleanup()
-
 #endif /* QORIQ_IS_HYPERVISOR_GUEST */
 
 #define Clock_driver_support_initialize_hardware() \
diff --git a/bsps/riscv/riscv_generic/clock/clockdrv.c b/bsps/riscv/riscv_generic/clock/clockdrv.c
index 8ae50f9..340e158 100644
--- a/bsps/riscv/riscv_generic/clock/clockdrv.c
+++ b/bsps/riscv/riscv_generic/clock/clockdrv.c
@@ -104,13 +104,6 @@ static void riscv_generic_clock_initialize(void)
   rtems_timecounter_install(&riscv_generic_tc);
 }
 
-static void riscv_generic_clock_cleanup(void)
-{
-  /* Disable mtimer interrupts */
-  clear_csr(mie, MIP_MTIP);
-  clear_csr(mip, MIP_MTIP);
-}
-
 CPU_Counter_ticks _CPU_Counter_difference(
   CPU_Counter_ticks second,
   CPU_Counter_ticks first
@@ -126,6 +119,4 @@ CPU_Counter_ticks _CPU_Counter_difference(
 #define Clock_driver_support_install_isr(isr) \
   riscv_generic_clock_handler_install(isr)
 
-#define Clock_driver_support_shutdown_hardware() riscv_generic_clock_cleanup()
-
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/shared/dev/clock/clock-simidle.c b/bsps/shared/dev/clock/clock-simidle.c
index def406a..c81f894 100644
--- a/bsps/shared/dev/clock/clock-simidle.c
+++ b/bsps/shared/dev/clock/clock-simidle.c
@@ -11,17 +11,8 @@
 
 #define CLOCK_VECTOR 0
 
-volatile bool clock_driver_enabled;
-
 #define Clock_driver_support_initialize_hardware() \
-  do { \
-    clock_driver_enabled = true; \
-  } while (0)
-
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    clock_driver_enabled = false; \
-  } while (0)
+  do { } while (0)
 
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
@@ -46,14 +37,12 @@ void *clock_driver_sim_idle_body(
 )
 {
   for( ; ; ) {
-    if ( clock_driver_enabled ) {
-      Per_CPU_Control *cpu = _Thread_Dispatch_disable();
-      _ISR_Nest_level++;
-      rtems_clock_tick();
-      _ISR_Nest_level--;
-      _Thread_Dispatch_enable( cpu );
-      BSP_CLOCK_DRIVER_DELAY();
-    }
+    Per_CPU_Control *cpu = _Thread_Dispatch_disable();
+    _ISR_Nest_level++;
+    rtems_clock_tick();
+    _ISR_Nest_level--;
+    _Thread_Dispatch_enable( cpu );
+    BSP_CLOCK_DRIVER_DELAY();
   }
   return 0;   /* to avoid warning */
 }
diff --git a/bsps/shared/dev/clock/clockimpl.h b/bsps/shared/dev/clock/clockimpl.h
index 6eaa6c9..f64d6fb 100644
--- a/bsps/shared/dev/clock/clockimpl.h
+++ b/bsps/shared/dev/clock/clockimpl.h
@@ -110,7 +110,7 @@ static void Clock_driver_timecounter_tick( void )
 volatile uint32_t    Clock_driver_ticks;
 
 #ifdef Clock_driver_support_shutdown_hardware
-void Clock_exit( void );
+#error "Clock_driver_support_shutdown_hardware() is no longer supported"
 #endif
 
 /**
@@ -190,21 +190,6 @@ rtems_isr Clock_isr(
   #endif
 }
 
-#ifdef Clock_driver_support_shutdown_hardware
-/**
- *  @brief Clock_exit
- *
- *  This routine allows the clock driver to exit by masking the interrupt and
- *  disabling the clock's counter.
- */
-void Clock_exit( void )
-{
-  Clock_driver_support_shutdown_hardware();
-
-  /* do not restore old vector */
-}
-#endif
-
 /**
  * @brief Clock_initialize
  *
@@ -245,10 +230,6 @@ rtems_device_driver Clock_initialize(
    */
   Clock_driver_support_initialize_hardware();
 
-#ifdef Clock_driver_support_shutdown_hardware
-  atexit( Clock_exit );
-#endif
-
   /*
    *  If we are counting ISRs per tick, then initialize the counter.
    */
diff --git a/bsps/sparc/erc32/clock/ckinit.c b/bsps/sparc/erc32/clock/ckinit.c
index e54061a..e7c5b07 100644
--- a/bsps/sparc/erc32/clock/ckinit.c
+++ b/bsps/sparc/erc32/clock/ckinit.c
@@ -122,15 +122,6 @@ uint32_t _CPU_Counter_frequency(void)
 
 #define Clock_driver_timecounter_tick() erc32_tc_tick()
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    ERC32_Mask_interrupt( ERC32_INTERRUPT_REAL_TIME_CLOCK ); \
-     \
-    ERC32_MEC_Set_Real_Time_Clock_Timer_Control( \
-      ERC32_MEC_TIMER_COUNTER_DISABLE_COUNTING \
-    ); \
-  } while (0)
-
 #include "../../../shared/dev/clock/clockimpl.h"
 
 SPARC_COUNTER_DEFINITION;
diff --git a/bsps/sparc/leon2/clock/ckinit.c b/bsps/sparc/leon2/clock/ckinit.c
index a1dfc12..f622975 100644
--- a/bsps/sparc/leon2/clock/ckinit.c
+++ b/bsps/sparc/leon2/clock/ckinit.c
@@ -91,12 +91,6 @@ extern int CLOCK_SPEED;
     ); \
   } while (0)
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    LEON_Mask_interrupt( LEON_INTERRUPT_TIMER1 ); \
-    LEON_REG.Timer_Control_1 = 0; \
-  } while (0)
-
 #define Clock_driver_timecounter_tick() leon2_tc_tick()
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/sparc/leon3/clock/ckinit.c b/bsps/sparc/leon3/clock/ckinit.c
index fd194ab..c3edaf2 100644
--- a/bsps/sparc/leon3/clock/ckinit.c
+++ b/bsps/sparc/leon3/clock/ckinit.c
@@ -267,12 +267,6 @@ static void leon3_clock_initialize(void)
 #define Clock_driver_support_initialize_hardware() \
   leon3_clock_initialize()
 
-#define Clock_driver_support_shutdown_hardware() \
-  do { \
-    LEON_Mask_interrupt(LEON_TRAP_TYPE(clkirq)); \
-    LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].ctrl = 0; \
-  } while (0)
-
 #define Clock_driver_timecounter_tick() leon3_tc_do_tick()
 
 #include "../../../shared/dev/clock/clockimpl.h"
diff --git a/bsps/sparc/shared/btimer/tlib_ckinit.c b/bsps/sparc/shared/btimer/tlib_ckinit.c
index 3f56d72..3e2feb1 100644
--- a/bsps/sparc/shared/btimer/tlib_ckinit.c
+++ b/bsps/sparc/shared/btimer/tlib_ckinit.c
@@ -174,17 +174,6 @@ static rtems_device_driver tlib_clock_install_isr(rtems_isr *isr)
   return RTEMS_SUCCESSFUL;
 }
 
-static void tlib_clock_shutdown_hardware(void)
-{
-  if (priv.tlib_tick) {
-    tlib_stop(priv.tlib_tick);
-    priv.tlib_tick = NULL;
-  }
-  if (priv.ops->shutdown_hardware) {
-    priv.ops->shutdown_hardware();
-  }
-}
-
 /** Simple counter **/
 static uint32_t simple_tlib_tc_get(rtems_timecounter_simple *tc)
 {
@@ -432,9 +421,6 @@ static const struct ops ops_irqamp = {
     } \
   } while (0)
 
-#define Clock_driver_support_shutdown_hardware() \
-  tlib_clock_shutdown_hardware()
-
 #define Clock_driver_timecounter_tick() \
   tlib_clock_timecounter_tick()
 
diff --git a/bsps/sparc64/shared/clock/ckinit.c b/bsps/sparc64/shared/clock/ckinit.c
index 6a82806..230e1fb 100644
--- a/bsps/sparc64/shared/clock/ckinit.c
+++ b/bsps/sparc64/shared/clock/ckinit.c
@@ -111,11 +111,6 @@ static void Clock_driver_support_initialize_hardware(void)
 #endif
 }
 
-#define Clock_driver_support_shutdown_hardware( ) \
-  do { \
-    \
-  } while ( 0 )
-
 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
 
 #include "../../../shared/dev/clock/clockimpl.h"



More information about the vc mailing list