summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/erc32
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-20 12:08:42 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-20 13:52:19 +0200
commite0dd8a5ad830798bc8082b03b8c42c32fb9660e0 (patch)
treed147bfc4d670fcdfbd2e2d2e75eb209f92e07df1 /c/src/lib/libbsp/sparc/erc32
parentbsps: Move startup files to bsps (diff)
downloadrtems-e0dd8a5ad830798bc8082b03b8c42c32fb9660e0.tar.bz2
bsps: Move benchmark timer to bsps
This patch is a part of the BSP source reorganization. Update #3285.
Diffstat (limited to 'c/src/lib/libbsp/sparc/erc32')
-rw-r--r--c/src/lib/libbsp/sparc/erc32/Makefile.am2
-rw-r--r--c/src/lib/libbsp/sparc/erc32/timer/timer.c81
2 files changed, 1 insertions, 82 deletions
diff --git a/c/src/lib/libbsp/sparc/erc32/Makefile.am b/c/src/lib/libbsp/sparc/erc32/Makefile.am
index 3171e0b697..7668a98610 100644
--- a/c/src/lib/libbsp/sparc/erc32/Makefile.am
+++ b/c/src/lib/libbsp/sparc/erc32/Makefile.am
@@ -50,7 +50,7 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/erc32/console/debugputs.c
# clock
librtemsbsp_a_SOURCES +=../../../../../../bsps/sparc/erc32/clock/ckinit.c
# timer
-librtemsbsp_a_SOURCES += timer/timer.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/erc32/btimer/btimer.c
# IRQ
librtemsbsp_a_SOURCES += ../shared/irq/irq-shared.c
diff --git a/c/src/lib/libbsp/sparc/erc32/timer/timer.c b/c/src/lib/libbsp/sparc/erc32/timer/timer.c
deleted file mode 100644
index 05728f8acc..0000000000
--- a/c/src/lib/libbsp/sparc/erc32/timer/timer.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* timer.c
- *
- * This file implements a benchmark timer using the General Purpose Timer on
- * the MEC.
- *
- * COPYRIGHT (c) 1989-1999.
- * 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.
- *
- * Ported to ERC32 implementation of the SPARC by On-Line Applications
- * Research Corporation (OAR) under contract to the European Space
- * Agency (ESA).
- *
- * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
- * European Space Agency.
- */
-
-#include <bsp.h>
-#include <rtems/btimer.h>
-
-bool benchmark_timer_find_average_overhead;
-
-bool benchmark_timer_is_initialized = false;
-
-void benchmark_timer_initialize(void)
-{
- /*
- * Timer runs long and accurate enough not to require an interrupt.
- */
-
- if ( benchmark_timer_is_initialized == false ) {
-
- /* approximately 1 us per countdown */
- ERC32_MEC.General_Purpose_Timer_Scalar = CLOCK_SPEED - 1;
- ERC32_MEC.General_Purpose_Timer_Counter = 0xffffffff;
-
- } else {
- benchmark_timer_is_initialized = true;
- }
-
- ERC32_MEC_Set_General_Purpose_Timer_Control(
- ERC32_MEC_TIMER_COUNTER_ENABLE_COUNTING |
- ERC32_MEC_TIMER_COUNTER_LOAD_COUNTER
- );
-
- ERC32_MEC_Set_General_Purpose_Timer_Control(
- ERC32_MEC_TIMER_COUNTER_ENABLE_COUNTING
- );
-
-}
-
-#define AVG_OVERHEAD 12 /* It typically takes 3.0 microseconds */
- /* to start/stop the timer. */
-#define LEAST_VALID 13 /* Don't trust a value lower than this */
-
-benchmark_timer_t benchmark_timer_read(void)
-{
- uint32_t total;
-
- total = ERC32_MEC.General_Purpose_Timer_Counter;
-
- total = 0xffffffff - total;
-
- if ( benchmark_timer_find_average_overhead == true )
- return total; /* in one microsecond units */
-
- if ( total < LEAST_VALID )
- return 0; /* below timer resolution */
-
- return total - AVG_OVERHEAD;
-}
-
-void benchmark_timer_disable_subtracting_average_overhead(
- bool find_flag
-)
-{
- benchmark_timer_find_average_overhead = find_flag;
-}