forked from Imagelibrary/rtems
Optional Clock_driver_support_shutdown_hardware()
Make Clock_driver_support_shutdown_hardware() optional. This avoids the atexit() support on memory constrained targets.
This commit is contained in:
@@ -67,13 +67,12 @@ static void Clock_driver_support_initialize_hardware(void)
|
||||
lm32_interrupt_unmask(CLOCK_IRQMASK);
|
||||
}
|
||||
|
||||
static void Clock_driver_support_shutdown_hardware(void)
|
||||
{
|
||||
/* Disable clock interrupts and stop */
|
||||
|
||||
lm32_interrupt_unmask(CLOCK_IRQMASK);
|
||||
clockwrite(LM32_CLOCK_CR, LM32_CLOCK_CR_STOP);
|
||||
}
|
||||
#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
|
||||
|
||||
|
||||
@@ -40,11 +40,11 @@ static void Clock_driver_support_initialize_hardware(void)
|
||||
bsp_interrupt_vector_enable(MM_IRQ_TIMER0);
|
||||
}
|
||||
|
||||
static void Clock_driver_support_shutdown_hardware(void)
|
||||
{
|
||||
bsp_interrupt_vector_disable(MM_IRQ_TIMER0);
|
||||
MM_WRITE(MM_TIMER0_CONTROL, 0);
|
||||
}
|
||||
#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
|
||||
|
||||
|
||||
@@ -57,10 +57,10 @@ static void mcf52235_tc_tick(void)
|
||||
/*
|
||||
* Turn off the clock
|
||||
*/
|
||||
static void Clock_driver_support_shutdown_hardware(void)
|
||||
{
|
||||
MCF_PIT1_PCSR &= ~MCF_PIT_PCSR_EN;
|
||||
}
|
||||
#define Clock_driver_support_shutdown_hardware() \
|
||||
do { \
|
||||
MCF_PIT1_PCSR &= ~MCF_PIT_PCSR_EN; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Set up the clock hardware
|
||||
|
||||
@@ -57,10 +57,10 @@ static void mcf5225x_tc_tick(void)
|
||||
/*
|
||||
* Turn off the clock
|
||||
*/
|
||||
static void Clock_driver_support_shutdown_hardware(void)
|
||||
{
|
||||
MCF_PIT1_PCSR &= ~MCF_PIT_PCSR_EN;
|
||||
}
|
||||
#define Clock_driver_support_shutdown_hardware() \
|
||||
do { \
|
||||
MCF_PIT1_PCSR &= ~MCF_PIT_PCSR_EN; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Set up the clock hardware
|
||||
|
||||
@@ -57,10 +57,10 @@ static void mcf5329_tc_tick(void)
|
||||
/*
|
||||
* Turn off the clock
|
||||
*/
|
||||
static void Clock_driver_support_shutdown_hardware(void)
|
||||
{
|
||||
MCF_PIT3_PCSR &= ~MCF_PIT_PCSR_EN;
|
||||
}
|
||||
#define Clock_driver_support_shutdown_hardware() \
|
||||
do { \
|
||||
MCF_PIT3_PCSR &= ~MCF_PIT_PCSR_EN; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Set up the clock hardware
|
||||
|
||||
@@ -102,7 +102,9 @@ static void Clock_driver_timecounter_tick( void )
|
||||
*/
|
||||
volatile uint32_t Clock_driver_ticks;
|
||||
|
||||
#ifdef Clock_driver_support_shutdown_hardware
|
||||
void Clock_exit( void );
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Clock_isr
|
||||
@@ -181,6 +183,7 @@ rtems_isr Clock_isr(
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef Clock_driver_support_shutdown_hardware
|
||||
/**
|
||||
* @brief Clock_exit
|
||||
*
|
||||
@@ -193,6 +196,7 @@ void Clock_exit( void )
|
||||
|
||||
/* do not restore old vector */
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Clock_initialize
|
||||
@@ -237,7 +241,9 @@ 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.
|
||||
|
||||
@@ -106,10 +106,10 @@ static void Clock_driver_support_initialize_hardware(void)
|
||||
(void) st_str; /* avoid set but not used warning */ \
|
||||
} while (0)
|
||||
|
||||
static void Clock_driver_support_shutdown_hardware( void )
|
||||
{
|
||||
BSP_remove_rtems_irq_handler(&clock_isr_data);
|
||||
}
|
||||
#define Clock_driver_support_shutdown_hardware() \
|
||||
do { \
|
||||
BSP_remove_rtems_irq_handler(&clock_isr_data); \
|
||||
} while (0)
|
||||
|
||||
#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
|
||||
|
||||
|
||||
@@ -111,10 +111,10 @@ static void Clock_driver_support_initialize_hardware(void)
|
||||
XSCALE_OS_TIMER_MR0 = XSCALE_OS_TIMER_TCR + period_num; \
|
||||
} while (0)
|
||||
|
||||
static void Clock_driver_support_shutdown_hardware( void )
|
||||
{
|
||||
BSP_remove_rtems_irq_handler(&clock_isr_data);
|
||||
}
|
||||
#define Clock_driver_support_shutdown_hardware() \
|
||||
do { \
|
||||
BSP_remove_rtems_irq_handler(&clock_isr_data); \
|
||||
} while (0)
|
||||
|
||||
#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
|
||||
|
||||
|
||||
Reference in New Issue
Block a user