From e0dd8a5ad830798bc8082b03b8c42c32fb9660e0 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 20 Apr 2018 12:08:42 +0200 Subject: bsps: Move benchmark timer to bsps This patch is a part of the BSP source reorganization. Update #3285. --- c/src/lib/libbsp/or1k/generic_or1k/Makefile.am | 2 +- c/src/lib/libbsp/or1k/generic_or1k/timer/timer.c | 64 ------------------------ 2 files changed, 1 insertion(+), 65 deletions(-) delete mode 100644 c/src/lib/libbsp/or1k/generic_or1k/timer/timer.c (limited to 'c/src/lib/libbsp/or1k') diff --git a/c/src/lib/libbsp/or1k/generic_or1k/Makefile.am b/c/src/lib/libbsp/or1k/generic_or1k/Makefile.am index 6a0fe40683..629e72bdaf 100644 --- a/c/src/lib/libbsp/or1k/generic_or1k/Makefile.am +++ b/c/src/lib/libbsp/or1k/generic_or1k/Makefile.am @@ -55,7 +55,7 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/or1k/generic_or1k/console/consol librtemsbsp_a_SOURCES += ../../../../../../bsps/or1k/generic_or1k/console/uart.c # Timer -librtemsbsp_a_SOURCES += timer/timer.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/or1k/generic_or1k/btimer/btimer.c # clock librtemsbsp_a_SOURCES +=../../../../../../bsps/or1k/generic_or1k/clock/clockdrv.c diff --git a/c/src/lib/libbsp/or1k/generic_or1k/timer/timer.c b/c/src/lib/libbsp/or1k/generic_or1k/timer/timer.c deleted file mode 100644 index 872f1af7be..0000000000 --- a/c/src/lib/libbsp/or1k/generic_or1k/timer/timer.c +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @file - * - * @ingroup generic_or1k - * - * @brief Benchmark timer support. - */ - -/* - * Copyright (c) 2014-2015 by Hesham ALMatary - * - * 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 -#include -#include -#include - -#define OR1K_NANOSECONDS_PER_CLK_CYCLE 10 - -static bool benchmark_timer_find_average_overhead = false; -static uint64_t benchmark_timer_base; - -void benchmark_timer_initialize(void) -{ - benchmark_timer_base = _OR1K_mfspr(CPU_OR1K_SPR_TTCR); -} - -#define AVG_OVERHEAD 0 -#define LEAST_VALID 1 - -benchmark_timer_t benchmark_timer_read( void ) -{ - uint64_t clicks; - uint64_t total; - uint64_t delta; - /* - * Read the timer and see how many clicks (clock cycles) - * has passed since timer initialization. - */ - clicks = _OR1K_mfspr(CPU_OR1K_SPR_TTCR); - - delta = clicks - benchmark_timer_base; - - /* total in nanoseconds */ - total = OR1K_NANOSECONDS_PER_CLK_CYCLE * (delta); - - if ( benchmark_timer_find_average_overhead == true ) - return total; /* in nanoseconds microsecond units */ - else { - 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; -} -- cgit v1.2.3