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:
Sebastian Huber
2017-08-03 14:48:04 +02:00
parent a8694035ae
commit 30be024aa4
8 changed files with 37 additions and 32 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -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