From 3109857c88d6297121f0377b2dea87fe0227bbf1 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 26 Aug 2013 15:26:50 -0400 Subject: bsps: Add and use CLOCK_DRIVER_ISRS_PER_TICK_VALUE pc386 set CLOCK_DRIVER_ISRS_PER_TICK to a string rather than a numeric value. Add CLOCK_DRIVER_ISRS_PER_TICK_VALUE and other clean up on the clock driver. --- c/src/lib/libbsp/i386/pc386/clock/ckinit.c | 21 ++++----------------- c/src/lib/libbsp/shared/clockdrv_shell.h | 2 +- 2 files changed, 5 insertions(+), 18 deletions(-) (limited to 'c/src/lib/libbsp') diff --git a/c/src/lib/libbsp/i386/pc386/clock/ckinit.c b/c/src/lib/libbsp/i386/pc386/clock/ckinit.c index 76024e8731..343232250e 100644 --- a/c/src/lib/libbsp/i386/pc386/clock/ckinit.c +++ b/c/src/lib/libbsp/i386/pc386/clock/ckinit.c @@ -57,12 +57,11 @@ uint64_t pc586_nanoseconds_per_tick; uint64_t pc586_tsc_at_tick; /* this driver may need to count ISRs per tick */ -#define CLOCK_DRIVER_ISRS_PER_TICK pc386_isrs_per_tick +#define CLOCK_DRIVER_ISRS_PER_TICK 1 +#define CLOCK_DRIVER_ISRS_PER_TICK_VALUE pc386_isrs_per_tick -/* if so, the driver may use the count in Clock_driver_support_at_tick */ -#ifdef CLOCK_DRIVER_ISRS_PER_TICK +/* The driver uses the count in Clock_driver_support_at_tick */ extern volatile uint32_t Clock_driver_isrs; -#endif #define READ_8254( _lsb, _msb ) \ do { outport_byte(TIMER_MODE, TIMER_SEL0|TIMER_LATCH); \ @@ -83,18 +82,7 @@ uint32_t (*Clock_driver_nanoseconds_since_last_tick)(void) = NULL; */ static void Clock_driver_support_at_tick_tsc(void) { -#ifdef CLOCK_DRIVER_ISRS_PER_TICK - /* - * The driver is multiple ISRs per clock tick. - */ - if (!Clock_driver_isrs) - pc586_tsc_at_tick = rdtsc(); -#else - /* - * The driver is one ISR per clock tick. - */ pc586_tsc_at_tick = rdtsc(); -#endif } static void Clock_driver_support_at_tick_empty(void) @@ -106,8 +94,6 @@ static void Clock_driver_support_at_tick_empty(void) _old = NULL; \ } while(0) -extern volatile uint32_t Clock_driver_isrs; - /* * Get nanoseconds using Pentium-compatible TSC register */ @@ -271,6 +257,7 @@ static void clockOff(void) outport_byte(TIMER_CNTR0, 0); } /* Clock_exit */ +#define Clock_driver_support_shutdown_hardware() clockOff() bool Clock_isr_enabled = false; static void Clock_isr_handler(void *param) diff --git a/c/src/lib/libbsp/shared/clockdrv_shell.h b/c/src/lib/libbsp/shared/clockdrv_shell.h index 2a7fe0b6f9..a2dc7f52ff 100644 --- a/c/src/lib/libbsp/shared/clockdrv_shell.h +++ b/c/src/lib/libbsp/shared/clockdrv_shell.h @@ -183,7 +183,7 @@ rtems_device_driver Clock_initialize( * If we are counting ISRs per tick, then initialize the counter. */ #if CLOCK_DRIVER_ISRS_PER_TICK - Clock_driver_isrs = CLOCK_DRIVER_ISRS_PER_TICK; + Clock_driver_isrs = CLOCK_DRIVER_ISRS_PER_TICK_VALUE; #endif return RTEMS_SUCCESSFUL; -- cgit v1.2.3