summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bsps/powerpc/shared/ppc-dec-timer.c (renamed from c/src/lib/libcpu/powerpc/mpc6xx/timer/timer.c)4
-rw-r--r--bsps/powerpc/ss555/dev/timer.c104
-rw-r--r--c/src/lib/libbsp/powerpc/beatnik/Makefile.am2
-rw-r--r--c/src/lib/libbsp/powerpc/gen5200/Makefile.am4
-rw-r--r--c/src/lib/libbsp/powerpc/gen83xx/Makefile.am2
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/Makefile.am4
-rw-r--r--c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c5
-rw-r--r--c/src/lib/libbsp/powerpc/motorola_powerpc/Makefile.am2
-rw-r--r--c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am4
-rw-r--r--c/src/lib/libbsp/powerpc/mpc8260ads/Makefile.am4
-rw-r--r--c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspstart.c4
-rw-r--r--c/src/lib/libbsp/powerpc/mvme3100/Makefile.am2
-rw-r--r--c/src/lib/libbsp/powerpc/mvme5500/Makefile.am2
-rw-r--r--c/src/lib/libbsp/powerpc/psim/Makefile.am2
-rw-r--r--c/src/lib/libbsp/powerpc/qemuppc/Makefile.am4
-rw-r--r--c/src/lib/libbsp/powerpc/ss555/Makefile.am2
-rw-r--r--c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c4
-rw-r--r--c/src/lib/libbsp/powerpc/tqm8xx/Makefile.am4
-rw-r--r--c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c6
-rw-r--r--c/src/lib/libbsp/powerpc/virtex/Makefile.am5
-rw-r--r--c/src/lib/libbsp/powerpc/virtex/timer/timer-config.c58
-rw-r--r--c/src/lib/libbsp/powerpc/virtex4/Makefile.am4
-rw-r--r--c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c4
-rw-r--r--c/src/lib/libbsp/powerpc/virtex5/Makefile.am4
-rw-r--r--c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c4
-rw-r--r--c/src/lib/libcpu/powerpc/Makefile.am38
-rw-r--r--c/src/lib/libcpu/powerpc/mpc8260/timer/timer.c103
-rw-r--r--c/src/lib/libcpu/powerpc/mpc8xx/timer/timer.c94
-rw-r--r--c/src/lib/libcpu/powerpc/ppc403/timer/timer.c73
29 files changed, 28 insertions, 524 deletions
diff --git a/c/src/lib/libcpu/powerpc/mpc6xx/timer/timer.c b/bsps/powerpc/shared/ppc-dec-timer.c
index 2131b6017d..d161710732 100644
--- a/c/src/lib/libcpu/powerpc/mpc6xx/timer/timer.c
+++ b/bsps/powerpc/shared/ppc-dec-timer.c
@@ -21,6 +21,10 @@
#include <assert.h>
#include <libcpu/powerpc-utility.h>
+#ifndef BSP_Convert_decrementer
+#define BSP_Convert_decrementer(value) (value)
+#endif
+
uint64_t Timer_driver_Start_time;
bool benchmark_timer_find_average_overhead = false;
diff --git a/bsps/powerpc/ss555/dev/timer.c b/bsps/powerpc/ss555/dev/timer.c
deleted file mode 100644
index 65deae961e..0000000000
--- a/bsps/powerpc/ss555/dev/timer.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * @file
- * @brief Timer Driver for the PowerPC MPC5xx.
- *
- * This file manages the interval timer on the PowerPC MPC5xx.
- * @noe This is not the PIT, but rather the RTEMS interval timer.
- * We shall use the bottom 32 bits of the timebase register,
- */
-
-/*
- * MPC5xx port sponsored by Defence Research and Development Canada - Suffield
- * Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
- *
- * Derived from c/src/lib/libcpu/powerpc/mpc8xx/timer/timer.c:
- *
- * Author: Jay Monkman (jmonkman@frasca.com)
- * Copywright (C) 1998 by Frasca International, Inc.
- *
- * Derived from c/src/lib/libcpu/ppc/ppc403/timer/timer.c:
- *
- * Author: Andrew Bray <andy@i-cubed.co.uk>
- *
- * COPYRIGHT (c) 1995 by i-cubed ltd.
- *
- * To anyone who acknowledges that this file is provided "AS IS"
- * without any express or implied warranty:
- * permission to use, copy, modify, and distribute this file
- * for any purpose is hereby granted without fee, provided that
- * the above copyright notice and this notice appears in all
- * copies, and that the name of i-cubed limited not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * i-cubed limited makes no representations about the suitability
- * of this software for any purpose.
- *
- * Derived from c/src/lib/libcpu/hppa1_1/timer/timer.c:
- *
- * COPYRIGHT (c) 1989-2007.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#include <rtems.h>
-#include <rtems/btimer.h>
-#include <mpc5xx.h>
-
-static volatile uint32_t Timer_starting;
-static bool benchmark_timer_find_average_overhead;
-
-extern uint32_t bsp_timer_least_valid;
-extern uint32_t bsp_timer_average_overhead;
-
-/*
- * This is so small that this code will be reproduced where needed.
- */
-static inline uint32_t get_itimer(void)
-{
- uint32_t ret;
-
- __asm__ volatile ("mftb %0" : "=r" ((ret))); /* TBLO */
-
- return ret;
-}
-
-void benchmark_timer_initialize(void)
-{
- /* set interrupt level and enable timebase. This should never */
- /* generate an interrupt however. */
- usiu.tbscrk = USIU_UNLOCK_KEY;
- usiu.tbscr |= USIU_TBSCR_TBIRQ(4) /* interrupt priority level */
- | USIU_TBSCR_TBF /* freeze timebase during debug */
- | USIU_TBSCR_TBE; /* enable timebase */
- usiu.tbscrk = 0;
-
- Timer_starting = get_itimer();
-}
-
-benchmark_timer_t benchmark_timer_read(void)
-{
- uint32_t clicks;
- uint32_t total;
-
- clicks = get_itimer();
-
- total = clicks - Timer_starting;
-
- if ( benchmark_timer_find_average_overhead == 1 )
- return total; /* in XXX microsecond units */
-
- else {
- if ( total < bsp_timer_least_valid ) {
- return 0; /* below timer resolution */
- }
- return (total - bsp_timer_average_overhead);
- }
-}
-
-void benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
-{
- benchmark_timer_find_average_overhead = find_flag;
-}
diff --git a/c/src/lib/libbsp/powerpc/beatnik/Makefile.am b/c/src/lib/libbsp/powerpc/beatnik/Makefile.am
index 30ad34a881..d9a45d6c17 100644
--- a/c/src/lib/libbsp/powerpc/beatnik/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/beatnik/Makefile.am
@@ -165,10 +165,10 @@ libbsp_a_SOURCES += ../../shared/tod.c tod/todcfg.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/irq/ppc-irq-legacy.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/mpc6xx/clock.rel \
../../../libcpu/@RTEMS_CPU@/mpc6xx/mmu.rel \
- ../../../libcpu/@RTEMS_CPU@/mpc6xx/timer.rel \
../../../libcpu/@RTEMS_CPU@/mpc6xx/altivec.rel
if HAS_NETWORKING
diff --git a/c/src/lib/libbsp/powerpc/gen5200/Makefile.am b/c/src/lib/libbsp/powerpc/gen5200/Makefile.am
index efaea4bc91..5f9b3da88f 100644
--- a/c/src/lib/libbsp/powerpc/gen5200/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/gen5200/Makefile.am
@@ -111,9 +111,9 @@ libbsp_a_SOURCES += network_5200/network.c
endif
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
-libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/mpc6xx/mmu.rel \
- ../../../libcpu/@RTEMS_CPU@/mpc6xx/timer.rel
+libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/mpc6xx/mmu.rel
include $(top_srcdir)/../../../../automake/local.am
include $(srcdir)/../../../../../../bsps/powerpc/shared/shared.am
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/Makefile.am b/c/src/lib/libbsp/powerpc/gen83xx/Makefile.am
index 94971badab..a0eb6eb8fc 100644
--- a/c/src/lib/libbsp/powerpc/gen83xx/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/gen83xx/Makefile.am
@@ -74,9 +74,9 @@ libbsp_a_SOURCES += i2c/i2c_init.c
libbsp_a_SOURCES += spi/spi_init.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/mpc6xx/mmu.rel \
- ../../../libcpu/@RTEMS_CPU@/mpc6xx/timer.rel \
../../../libcpu/@RTEMS_CPU@/mpc83xx/i2c.rel \
../../../libcpu/@RTEMS_CPU@/mpc83xx/spi.rel \
../../../libcpu/@RTEMS_CPU@/mpc83xx/gtm.rel
diff --git a/c/src/lib/libbsp/powerpc/haleakala/Makefile.am b/c/src/lib/libbsp/powerpc/haleakala/Makefile.am
index 951e4931ad..b461f23058 100644
--- a/c/src/lib/libbsp/powerpc/haleakala/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/haleakala/Makefile.am
@@ -44,9 +44,9 @@ endif
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/irq/ppc-irq-legacy.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
-libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/ppc403/clock.rel \
- ../../../libcpu/@RTEMS_CPU@/ppc403/timer.rel
+libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/ppc403/clock.rel
include $(top_srcdir)/../../../../automake/local.am
include $(srcdir)/../../../../../../bsps/powerpc/shared/shared.am
diff --git a/c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c b/c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c
index f3788b1bd2..18b45f33df 100644
--- a/c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c
@@ -75,8 +75,6 @@ LINKER_SYMBOL(intrStack_size);
/* Expected by clock.c */
uint32_t bsp_clicks_per_usec;
-uint32_t bsp_timer_least_valid;
-uint32_t bsp_timer_average_overhead;
/*-------------------- Haleakala-specific UART setup -------------------------*/
@@ -182,9 +180,6 @@ void bsp_start( void )
bsp_clicks_per_usec = 400;
rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);
- bsp_timer_average_overhead = 2;
- bsp_timer_least_valid = 3;
-
/*
* Initialize default raw exception handlers.
*/
diff --git a/c/src/lib/libbsp/powerpc/motorola_powerpc/Makefile.am b/c/src/lib/libbsp/powerpc/motorola_powerpc/Makefile.am
index 71c7de90b9..75139b05e9 100644
--- a/c/src/lib/libbsp/powerpc/motorola_powerpc/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/motorola_powerpc/Makefile.am
@@ -116,12 +116,12 @@ endif
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/irq/ppc-irq-legacy.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
libbsp_a_LIBADD = \
polledIO.rel \
../../../libcpu/@RTEMS_CPU@/mpc6xx/clock.rel \
../../../libcpu/@RTEMS_CPU@/mpc6xx/mmu.rel \
- ../../../libcpu/@RTEMS_CPU@/mpc6xx/timer.rel \
../../../libcpu/@RTEMS_CPU@/mpc6xx/altivec.rel
EXTRA_DIST += BOOTING README.mtx603e README.MVME2100 README.MVME2300 \
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am b/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am
index b2f612216b..8cb70bb00d 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am
@@ -107,14 +107,14 @@ endif
# BSP library
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/misc.rel \
../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/irq.rel \
../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/siu.rel \
../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/edma.rel \
../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/emios.rel \
- ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/dspi.rel \
- ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/timer.rel
+ ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/dspi.rel
include $(top_srcdir)/../../../../automake/local.am
include $(srcdir)/../../../../../../bsps/powerpc/shared/shared.am
diff --git a/c/src/lib/libbsp/powerpc/mpc8260ads/Makefile.am b/c/src/lib/libbsp/powerpc/mpc8260ads/Makefile.am
index d039345167..f01305d3c0 100644
--- a/c/src/lib/libbsp/powerpc/mpc8260ads/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/mpc8260ads/Makefile.am
@@ -55,11 +55,11 @@ libbsp_a_SOURCES += network/network.c
endif
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/mpc8260/console-generic.rel \
../../../libcpu/@RTEMS_CPU@/mpc8260/cpm.rel \
- ../../../libcpu/@RTEMS_CPU@/mpc8260/mmu.rel \
- ../../../libcpu/@RTEMS_CPU@/mpc8260/timer.rel
+ ../../../libcpu/@RTEMS_CPU@/mpc8260/mmu.rel
EXTRA_DIST += times
diff --git a/c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspstart.c b/c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspstart.c
index 837543567f..44ec072775 100644
--- a/c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspstart.c
@@ -68,8 +68,6 @@ bool bsp_serial_external_clock;
bool bsp_serial_xon_xoff;
bool bsp_serial_cts_rts;
uint32_t bsp_serial_rate;
-uint32_t bsp_timer_average_overhead; /* Average overhead of timer in ticks */
-uint32_t bsp_timer_least_valid; /* Least valid number from timer */
extern char IntrStack_start [];
extern char intrStack [];
@@ -172,8 +170,6 @@ void bsp_start(void)
bsp_serial_xon_xoff = 0;
bsp_serial_cts_rts = 0;
bsp_serial_rate = 9600;
- bsp_timer_average_overhead = 3;
- bsp_timer_least_valid = 3;
bsp_clock_speed = 40000000;
rtems_counter_initialize_converter(bsp_clock_speed);
diff --git a/c/src/lib/libbsp/powerpc/mvme3100/Makefile.am b/c/src/lib/libbsp/powerpc/mvme3100/Makefile.am
index 6d6ae37f01..d0ddfa62bb 100644
--- a/c/src/lib/libbsp/powerpc/mvme3100/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/mvme3100/Makefile.am
@@ -107,9 +107,9 @@ endif
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/irq/ppc-irq-legacy.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/e500/clock.rel \
- ../../../libcpu/@RTEMS_CPU@/e500/timer.rel \
../../../libcpu/@RTEMS_CPU@/e500/mmu.rel
if HAS_NETWORKING
diff --git a/c/src/lib/libbsp/powerpc/mvme5500/Makefile.am b/c/src/lib/libbsp/powerpc/mvme5500/Makefile.am
index 6bc467fbf0..c85cd8804f 100644
--- a/c/src/lib/libbsp/powerpc/mvme5500/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/mvme5500/Makefile.am
@@ -85,11 +85,11 @@ dist_project_lib_DATA += ../shared/startup/linkcmds.share
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/irq/ppc-irq-legacy.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
libbsp_a_LIBADD = \
../../../libcpu/@RTEMS_CPU@/mpc6xx/clock.rel \
../../../libcpu/@RTEMS_CPU@/mpc6xx/mmu.rel \
- ../../../libcpu/@RTEMS_CPU@/mpc6xx/timer.rel\
../../../libcpu/@RTEMS_CPU@/mpc6xx/altivec.rel
if HAS_NETWORKING
diff --git a/c/src/lib/libbsp/powerpc/psim/Makefile.am b/c/src/lib/libbsp/powerpc/psim/Makefile.am
index 1df73b75f0..18bb28d51a 100644
--- a/c/src/lib/libbsp/powerpc/psim/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/psim/Makefile.am
@@ -62,10 +62,10 @@ endif
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/irq/ppc-irq-legacy.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/mpc6xx/clock.rel \
../../../libcpu/@RTEMS_CPU@/mpc6xx/mmu.rel \
- ../../../libcpu/@RTEMS_CPU@/mpc6xx/timer.rel \
../../../libcpu/@RTEMS_CPU@/mpc6xx/altivec.rel
include $(top_srcdir)/../../../../automake/local.am
diff --git a/c/src/lib/libbsp/powerpc/qemuppc/Makefile.am b/c/src/lib/libbsp/powerpc/qemuppc/Makefile.am
index ad42c39373..2b268bc0e4 100644
--- a/c/src/lib/libbsp/powerpc/qemuppc/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/qemuppc/Makefile.am
@@ -52,9 +52,9 @@ libbsp_a_SOURCES = $(startup_SOURCES) $(clock_SOURCES) $(console_SOURCES) \
$(irq_SOURCES)
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
-libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/mpc6xx/mmu.rel \
- ../../../libcpu/@RTEMS_CPU@/mpc6xx/timer.rel
+libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/mpc6xx/mmu.rel
include $(top_srcdir)/../../../../automake/local.am
include $(srcdir)/../../../../../../bsps/powerpc/shared/shared.am
diff --git a/c/src/lib/libbsp/powerpc/ss555/Makefile.am b/c/src/lib/libbsp/powerpc/ss555/Makefile.am
index 0a85ecd539..50cbdc6bba 100644
--- a/c/src/lib/libbsp/powerpc/ss555/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/ss555/Makefile.am
@@ -37,9 +37,9 @@ libbsp_a_SOURCES += startup/tm27supp.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/exceptions/ppc_exc_print.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/ss555/dev/clock.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/ss555/dev/console-generic.c
-libbsp_a_SOURCES += ../../../../../../bsps/powerpc/ss555/dev/timer.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/ss555/start/irq_asm.S
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/ss555/start/irq.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/ss555/start/irq_init.c
diff --git a/c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c b/c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c
index 56be333921..f47ca7d5be 100644
--- a/c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c
@@ -39,8 +39,6 @@ extern unsigned long intrStackPtr;
*/
uint32_t bsp_clicks_per_usec;
uint32_t bsp_clock_speed; /* Serial clocks per second */
-uint32_t bsp_timer_least_valid;
-uint32_t bsp_timer_average_overhead;
/*
* bsp_start()
@@ -90,8 +88,6 @@ void bsp_start(void)
*/
bsp_clicks_per_usec = BSP_CRYSTAL_HZ / 4 / 1000000;
bsp_clock_speed = BSP_CLOCK_HZ; /* for SCI baud rate generator */
- bsp_timer_least_valid = 0;
- bsp_timer_average_overhead = 0;
rtems_counter_initialize_converter(BSP_CRYSTAL_HZ / 4);
/*
diff --git a/c/src/lib/libbsp/powerpc/tqm8xx/Makefile.am b/c/src/lib/libbsp/powerpc/tqm8xx/Makefile.am
index 8188ad5c03..f04ed45748 100644
--- a/c/src/lib/libbsp/powerpc/tqm8xx/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/tqm8xx/Makefile.am
@@ -63,13 +63,13 @@ libbsp_a_SOURCES += network/network_scc.c
endif
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
libbsp_a_LIBADD = \
../../../libcpu/@RTEMS_CPU@/mpc8xx/console-generic.rel \
../../../libcpu/@RTEMS_CPU@/mpc8xx/cpm.rel \
../../../libcpu/@RTEMS_CPU@/mpc8xx/clock.rel \
- ../../../libcpu/@RTEMS_CPU@/mpc8xx/mmu.rel \
- ../../../libcpu/@RTEMS_CPU@/mpc8xx/timer.rel
+ ../../../libcpu/@RTEMS_CPU@/mpc8xx/mmu.rel
include $(top_srcdir)/../../../../automake/local.am
include $(srcdir)/../../../../../../bsps/powerpc/shared/shared.am
diff --git a/c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c b/c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c
index 90753f4982..a4865cc104 100644
--- a/c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c
@@ -46,10 +46,6 @@ uint32_t bsp_time_base_frequency;
/* Legacy */
uint32_t bsp_clicks_per_usec; /* for PIT driver: OSCCLK */
-/* for timer: */
-uint32_t bsp_timer_average_overhead; /* Average overhead of timer in ticks */
-uint32_t bsp_timer_least_valid; /* Least valid number from timer */
-
static const char *bsp_tqm_get_cib_string( const char *cib_id)
{
char srch_pattern[10] = "";
@@ -145,8 +141,6 @@ void bsp_start( void)
bsp_time_base_frequency = BSP_bus_frequency / 16;
bsp_clicks_per_usec = bsp_time_base_frequency / 1000000;
- bsp_timer_least_valid = 3;
- bsp_timer_average_overhead = 3;
rtems_counter_initialize_converter(bsp_time_base_frequency);
/* Initialize exception handler */
diff --git a/c/src/lib/libbsp/powerpc/virtex/Makefile.am b/c/src/lib/libbsp/powerpc/virtex/Makefile.am
index 355b0ca83f..cb23c69d78 100644
--- a/c/src/lib/libbsp/powerpc/virtex/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/virtex/Makefile.am
@@ -62,11 +62,8 @@ if HAS_NETWORKING
libbsp_a_SOURCES += = network/xiltemac.c
endif
-# timer
-libbsp_a_SOURCES += timer/timer-config.c
-libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/ppc403/timer.rel
-
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
include $(top_srcdir)/../../../../automake/local.am
include $(srcdir)/../../../../../../bsps/powerpc/shared/shared.am
diff --git a/c/src/lib/libbsp/powerpc/virtex/timer/timer-config.c b/c/src/lib/libbsp/powerpc/virtex/timer/timer-config.c
deleted file mode 100644
index bdea6bb775..0000000000
--- a/c/src/lib/libbsp/powerpc/virtex/timer/timer-config.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Author: Thomas Doerfler <td@imd.m.isar.de>
- * IMD Ingenieurbuero fuer Microcomputertechnik
- *
- * COPYRIGHT (c) 1998 by IMD
- *
- * Changes from IMD are covered by the original distributions terms.
- * This file has been derived from the papyrus BSP:
- *
- * Author: Andrew Bray <andy@i-cubed.co.uk>
- *
- * COPYRIGHT (c) 1995 by i-cubed ltd.
- *
- * To anyone who acknowledges that this file is provided "AS IS"
- * without any express or implied warranty:
- * permission to use, copy, modify, and distribute this file
- * for any purpose is hereby granted without fee, provided that
- * the above copyright notice and this notice appears in all
- * copies, and that the name of i-cubed limited not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * i-cubed limited makes no representations about the suitability
- * of this software for any purpose.
- *
- * Modifications for spooling console driver and control of memory layout
- * with linker command file by
- * Thomas Doerfler <td@imd.m.isar.de>
- * for these modifications:
- * COPYRIGHT (c) 1997 by IMD, Puchheim, Germany.
- *
- * To anyone who acknowledges that this file is provided "AS IS"
- * without any express or implied warranty:
- * permission to use, copy, modify, and distribute this file
- * for any purpose is hereby granted without fee, provided that
- * the above copyright notice and this notice appears in all
- * copies. IMD makes no representations about the suitability
- * of this software for any purpose.
- *
- * Derived from c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c:
- *
- * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
- * On-Line Applications Research Corporation (OAR).
- *
- * Modifications for PPC405GP by Dennis Ehlin
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-
-/*
- * Driver configuration parameters
- */
-
-/* Average overhead of timer in ticks */
-uint32_t bsp_timer_average_overhead = 2;
-
-/* Least valid number from timer */
-uint32_t bsp_timer_least_valid = 3;
diff --git a/c/src/lib/libbsp/powerpc/virtex4/Makefile.am b/c/src/lib/libbsp/powerpc/virtex4/Makefile.am
index 256ace53e8..fe1adc7847 100644
--- a/c/src/lib/libbsp/powerpc/virtex4/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/virtex4/Makefile.am
@@ -46,9 +46,9 @@ libbsp_a_SOURCES += irq/irq_init.c
libbsp_a_SOURCES += mmu/mmu.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
-libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/ppc403/clock.rel \
- ../../../libcpu/@RTEMS_CPU@/ppc403/timer.rel
+libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/ppc403/clock.rel
EXTRA_DIST += times
diff --git a/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c b/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c
index fa7c1137e9..f67c1c3603 100644
--- a/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c
@@ -96,8 +96,6 @@ LINKER_SYMBOL(bsp_exc_vector_base);
/* Expected by clock.c */
uint32_t bsp_clicks_per_usec;
-uint32_t bsp_timer_least_valid;
-uint32_t bsp_timer_average_overhead;
/*
@@ -167,8 +165,6 @@ void bsp_start(void)
/* Timebase register ticks/microsecond; The application may override these */
bsp_clicks_per_usec = 350;
- bsp_timer_average_overhead = 2;
- bsp_timer_least_valid = 3;
rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);
/*
diff --git a/c/src/lib/libbsp/powerpc/virtex5/Makefile.am b/c/src/lib/libbsp/powerpc/virtex5/Makefile.am
index f25045845f..89c7b9b5d6 100644
--- a/c/src/lib/libbsp/powerpc/virtex5/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/virtex5/Makefile.am
@@ -48,9 +48,9 @@ libbsp_a_SOURCES += irq/irq_init.c
libbsp_a_SOURCES += mmu/mmu.c
libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/cache/cache.c
+libbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/ppc-dec-timer.c
-libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/e500/clock.rel \
- ../../../libcpu/@RTEMS_CPU@/e500/timer.rel
+libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/e500/clock.rel
EXTRA_DIST += times
diff --git a/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c b/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
index c865abe3a1..44e7512e55 100644
--- a/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
@@ -97,8 +97,6 @@ LINKER_SYMBOL(bsp_exc_vector_base);
/* Expected by clock.c */
uint32_t bsp_clicks_per_usec;
-uint32_t bsp_timer_least_valid;
-uint32_t bsp_timer_average_overhead;
/*
* Bus Frequency
@@ -189,8 +187,6 @@ void bsp_start(void)
rtems_counter_initialize_converter(
BSP_bus_frequency / (BSP_time_base_divisor / 1000)
);
- bsp_timer_average_overhead = 2;
- bsp_timer_least_valid = 3;
/*
* Initialize the interrupt related settings.
diff --git a/c/src/lib/libcpu/powerpc/Makefile.am b/c/src/lib/libcpu/powerpc/Makefile.am
index 6d5bc19e5b..e83d47a772 100644
--- a/c/src/lib/libcpu/powerpc/Makefile.am
+++ b/c/src/lib/libcpu/powerpc/Makefile.am
@@ -24,12 +24,6 @@ endif
ppc403_console_rel_CPPFLAGS = $(AM_CPPFLAGS)
ppc403_console_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-# ppc403/timer
-noinst_PROGRAMS += ppc403/timer.rel
-ppc403_timer_rel_SOURCES = ppc403/timer/timer.c
-ppc403_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
-ppc403_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
# ppc403/tty_drv
if ppc405
noinst_PROGRAMS += ppc403/tty_drv.rel
@@ -61,12 +55,6 @@ mpc6xx_clock_rel_SOURCES = mpc6xx/clock/c_clock.c mpc6xx/clock/c_clock.h
mpc6xx_clock_rel_CPPFLAGS = $(AM_CPPFLAGS)
mpc6xx_clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-# mpc6xx/timer
-noinst_PROGRAMS += mpc6xx/timer.rel
-mpc6xx_timer_rel_SOURCES = mpc6xx/timer/timer.c
-mpc6xx_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
-mpc6xx_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
# mpc6xx/altivec
noinst_PROGRAMS += mpc6xx/altivec.rel
mpc6xx_altivec_rel_SOURCES = mpc6xx/altivec/vec_sup.c mpc6xx/altivec/vec_sup_asm.S
@@ -83,14 +71,6 @@ e500_clock_rel_CPPFLAGS = $(AM_CPPFLAGS)
e500_clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif
-# e500/timer
-if e500_timer
-noinst_PROGRAMS += e500/timer.rel
-e500_timer_rel_SOURCES = mpc6xx/timer/timer.c
-e500_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
-e500_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-endif
-
# e500/mmu
if e500_mmu
noinst_PROGRAMS += e500/mmu.rel
@@ -124,12 +104,6 @@ noinst_PROGRAMS += mpc8xx/mmu.rel
mpc8xx_mmu_rel_SOURCES = mpc8xx/mmu/mmu.c
mpc8xx_mmu_rel_CPPFLAGS = $(AM_CPPFLAGS)
mpc8xx_mmu_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
-# mpc8xx/timer
-noinst_PROGRAMS += mpc8xx/timer.rel
-mpc8xx_timer_rel_SOURCES = mpc8xx/timer/timer.c
-mpc8xx_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
-mpc8xx_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif
EXTRA_DIST += mpc8260/README
@@ -154,12 +128,6 @@ mpc8260_mmu_rel_SOURCES = mpc8260/mmu/mmu.c \
mpc8260/include/mmu.h
mpc8260_mmu_rel_CPPFLAGS = $(AM_CPPFLAGS)
mpc8260_mmu_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
-# mpc8260/timer
-noinst_PROGRAMS += mpc8260/timer.rel
-mpc8260_timer_rel_SOURCES = mpc8260/timer/timer.c
-mpc8260_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
-mpc8260_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif
##############################################################################
@@ -209,12 +177,6 @@ noinst_PROGRAMS += mpc55xx/irq.rel
mpc55xx_irq_rel_SOURCES = mpc55xx/irq/irq.c
mpc55xx_irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-# mpc6xx/timer
-noinst_PROGRAMS += mpc55xx/timer.rel
-mpc55xx_timer_rel_SOURCES = mpc6xx/timer/timer.c
-mpc55xx_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
-mpc55xx_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
# FEC
noinst_PROGRAMS += mpc55xx/fec.rel
mpc55xx_fec_rel_SOURCES = mpc55xx/fec/fec.c
diff --git a/c/src/lib/libcpu/powerpc/mpc8260/timer/timer.c b/c/src/lib/libcpu/powerpc/mpc8260/timer/timer.c
deleted file mode 100644
index c20fdc5cca..0000000000
--- a/c/src/lib/libcpu/powerpc/mpc8260/timer/timer.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * @file
- * @brief Timer for the PowerPC MPC860
- *
- * We shall use the bottom 32 bits of the timebase register,
- *
- * @note This is not the PIT, but rather the RTEMS interval timer.
- */
-
-/*
- * Author: Andy Dachs <a.dachs@sstl.co.uk>
- * Surrey Satellite Technlogy Limited
- * Modified for MPC8260
- * Derived from c/src/lib/libcpu/powerpc/mpc860/timer/timer.c:
- *
- * Author: Jay Monkman (jmonkman@frasca.com)
- * Copywright (C) 1998 by Frasca International, Inc.
- *
- * Derived from c/src/lib/libcpu/ppc/ppc403/timer/timer.c:
- *
- * Author: Andrew Bray <andy@i-cubed.co.uk>
- *
- * COPYRIGHT (c) 1995 by i-cubed ltd.
- *
- * To anyone who acknowledges that this file is provided "AS IS"
- * without any express or implied warranty:
- * permission to use, copy, modify, and distribute this file
- * for any purpose is hereby granted without fee, provided that
- * the above copyright notice and this notice appears in all
- * copies, and that the name of i-cubed limited not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * i-cubed limited makes no representations about the suitability
- * of this software for any purpose.
- *
- * Derived from c/src/lib/libcpu/hppa1_1/timer/timer.c:
- *
- * COPYRIGHT (c) 1989-2007.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#include <rtems.h>
-#include <rtems/btimer.h>
-#include <mpc8260.h>
-
-static volatile uint32_t Timer_starting;
-static bool benchmark_timer_find_average_overhead;
-
-/*
- * This is so small that this code will be reproduced where needed.
- */
-static inline uint32_t get_itimer(void)
-{
- uint32_t ret;
-
- __asm__ volatile ("mftb %0" : "=r" ((ret))); /* TBLO */
-
- return ret;
-}
-
-void benchmark_timer_initialize(void)
-{
- /* set interrupt level and enable timebase. This should never */
- /* generate an interrupt however. */
-
-/*
- m860.tbscr |= M860_TBSCR_TBIRQ(4) | M860_TBSCR_TBE;
-*/
-
-
- Timer_starting = get_itimer();
-}
-
-extern uint32_t bsp_timer_least_valid;
-extern uint32_t bsp_timer_average_overhead;
-benchmark_timer_t benchmark_timer_read(void)
-{
- uint32_t clicks;
- uint32_t total;
-
- clicks = get_itimer();
-
- total = clicks - Timer_starting;
-
- if ( benchmark_timer_find_average_overhead == 1 )
- return total; /* in XXX microsecond units */
-
- else {
- if ( total < bsp_timer_least_valid ) {
- return 0; /* below timer resolution */
- }
- return (total - bsp_timer_average_overhead);
- }
-}
-
-void benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
-{
- benchmark_timer_find_average_overhead = find_flag;
-}
diff --git a/c/src/lib/libcpu/powerpc/mpc8xx/timer/timer.c b/c/src/lib/libcpu/powerpc/mpc8xx/timer/timer.c
deleted file mode 100644
index b82d76497d..0000000000
--- a/c/src/lib/libcpu/powerpc/mpc8xx/timer/timer.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * @file
- * @brief Timer Driver for the PowerPC MPC8xx.
- *
- * This file manages the interval timer on the PowerPC MPC8xx.
- * We shall use the bottom 32 bits of the timebase register,
- *
- * @note This is not the PIT, but rather the RTEMS interval timer
- */
-
-/*
- * Author: Jay Monkman (jmonkman@frasca.com)
- * Copywright (C) 1998 by Frasca International, Inc.
- *
- * Derived from c/src/lib/libcpu/ppc/ppc403/timer/timer.c:
- *
- * Author: Andrew Bray <andy@i-cubed.co.uk>
- *
- * COPYRIGHT (c) 1995 by i-cubed ltd.
- *
- * To anyone who acknowledges that this file is provided "AS IS"
- * without any express or implied warranty:
- * permission to use, copy, modify, and distribute this file
- * for any purpose is hereby granted without fee, provided that
- * the above copyright notice and this notice appears in all
- * copies, and that the name of i-cubed limited not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * i-cubed limited makes no representations about the suitability
- * of this software for any purpose.
- *
- * Derived from c/src/lib/libcpu/hppa1_1/timer/timer.c:
- *
- * COPYRIGHT (c) 1989-2007.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#include <rtems.h>
-#include <rtems/btimer.h>
-#include <mpc8xx.h>
-
-static volatile uint32_t Timer_starting;
-static bool benchmark_timer_find_average_overhead;
-extern uint32_t bsp_timer_least_valid;
-extern uint32_t bsp_timer_average_overhead;
-
-/*
- * This is so small that this code will be reproduced where needed.
- */
-static inline uint32_t get_itimer(void)
-{
- uint32_t ret;
-
- __asm__ volatile ("mftb %0" : "=r" ((ret))); /* TBLO */
-
- return ret;
-}
-
-void benchmark_timer_initialize(void)
-{
- /* set interrupt level and enable timebase. This should never */
- /* generate an interrupt however. */
- m8xx.tbscr |= M8xx_TBSCR_TBIRQ(4) | M8xx_TBSCR_TBE;
-
- Timer_starting = get_itimer();
-}
-
-benchmark_timer_t benchmark_timer_read(void)
-{
- uint32_t clicks;
- uint32_t total;
-
- clicks = get_itimer();
-
- total = clicks - Timer_starting;
-
- if ( benchmark_timer_find_average_overhead == 1 )
- return total; /* in XXX microsecond units */
- else {
- if ( total < bsp_timer_least_valid ) {
- return 0; /* below timer resolution */
- }
- return (total - bsp_timer_average_overhead);
- }
-}
-
-void benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
-{
- benchmark_timer_find_average_overhead = find_flag;
-}
diff --git a/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c b/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c
deleted file mode 100644
index f883facb80..0000000000
--- a/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * @file
- * @brief Timer Driver for the PowerPC 405.
- *
- * This file manages the interval timer on the PowerPC 405.
- * We shall use the bottom 32 bits of the timebase register,
- */
-
-/*
- * Author: Andrew Bray <andy@i-cubed.co.uk>
- *
- * COPYRIGHT (c) 1995 by i-cubed ltd.
- *
- * To anyone who acknowledges that this file is provided "AS IS"
- * without any express or implied warranty:
- * permission to use, copy, modify, and distribute this file
- * for any purpose is hereby granted without fee, provided that
- * the above copyright notice and this notice appears in all
- * copies, and that the name of i-cubed limited not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * i-cubed limited makes no representations about the suitability
- * of this software for any purpose.
- *
- * Derived from c/src/lib/libcpu/hppa1.1/timer/timer.c:
- *
- * COPYRIGHT (c) 1989-2007.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- *
- * Modifications for PPC405GP by Dennis Ehlin
- *
- * Further mods for PPC405EX/EXr by Michael Hamel
- *
- */
-
-#include <rtems.h>
-#include <rtems/btimer.h>
-#include <libcpu/powerpc-utility.h>
-
-extern uint32_t bsp_timer_least_valid;
-extern uint32_t bsp_timer_average_overhead;
-
-static volatile uint32_t startedAt;
-static bool subtractOverhead;
-
-void benchmark_timer_initialize(void)
-{
- /* We are going to rely on clock.c to sort out where the clock comes from */
- startedAt = ppc_time_base();
-}
-
-benchmark_timer_t benchmark_timer_read(void)
-{
- uint32_t clicks, total;
-
- clicks = ppc_time_base();
- total = clicks - startedAt;
- if ( ! subtractOverhead )
- return total; /* in XXX microsecond units */
- else if ( total < bsp_timer_least_valid )
- return 0; /* below timer resolution */
- else
- return (total - bsp_timer_average_overhead);
-}
-
-void benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
-{
- subtractOverhead = find_flag;
-}