mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 22:54:14 +08:00
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.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -81,19 +81,6 @@ rtems_irq_connect_data clock_isr_data = {
|
||||
MC9328MXL_TMR1_TPRER = 0; \
|
||||
} 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.
|
||||
*
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -126,19 +126,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.
|
||||
*
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -75,18 +75,6 @@ rtems_irq_connect_data clock_isr_data = {
|
||||
rTCON=(cr|(0x5<<20)); \
|
||||
} 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.
|
||||
*
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -25,14 +25,6 @@
|
||||
#define Clock_driver_support_install_isr( _new ) \
|
||||
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
|
||||
*
|
||||
|
||||
@@ -54,14 +54,6 @@ static unsigned long nsec;
|
||||
#define Clock_driver_support_install_isr( _new ) \
|
||||
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
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
#define Clock_driver_support_install_isr( _new ) \
|
||||
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
|
||||
*
|
||||
|
||||
@@ -52,14 +52,6 @@ static void mcf52235_tc_tick(void)
|
||||
#define Clock_driver_support_install_isr( _new ) \
|
||||
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
|
||||
*
|
||||
|
||||
@@ -52,14 +52,6 @@ static void mcf5225x_tc_tick(void)
|
||||
#define Clock_driver_support_install_isr( _new ) \
|
||||
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
|
||||
*
|
||||
|
||||
@@ -25,14 +25,6 @@
|
||||
#define Clock_driver_support_install_isr( _new ) \
|
||||
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
|
||||
*
|
||||
|
||||
@@ -52,14 +52,6 @@ static void mcf5329_tc_tick(void)
|
||||
#define Clock_driver_support_install_isr( _new ) \
|
||||
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
|
||||
*
|
||||
|
||||
@@ -78,14 +78,6 @@ static void uC5282_tc_tick(void)
|
||||
#define Clock_driver_support_install_isr( _new ) \
|
||||
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
|
||||
*
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -21,14 +21,6 @@
|
||||
#define Clock_driver_support_install_isr(_new) \
|
||||
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
|
||||
*/
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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() \
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 */
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user