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/arm/rtl22xx/Makefile.am | 2 +- c/src/lib/libbsp/arm/rtl22xx/timer/lpc_timer.h | 48 ------------------- c/src/lib/libbsp/arm/rtl22xx/timer/timer.c | 65 -------------------------- 3 files changed, 1 insertion(+), 114 deletions(-) delete mode 100644 c/src/lib/libbsp/arm/rtl22xx/timer/lpc_timer.h delete mode 100644 c/src/lib/libbsp/arm/rtl22xx/timer/timer.c (limited to 'c/src/lib/libbsp/arm/rtl22xx') diff --git a/c/src/lib/libbsp/arm/rtl22xx/Makefile.am b/c/src/lib/libbsp/arm/rtl22xx/Makefile.am index aff940c6ab..7a8ff9e58e 100644 --- a/c/src/lib/libbsp/arm/rtl22xx/Makefile.am +++ b/c/src/lib/libbsp/arm/rtl22xx/Makefile.am @@ -27,7 +27,7 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterdiff.c -librtemsbsp_a_SOURCES += timer/timer.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/rtl22xx/btimer/btimer.c librtemsbsp_a_SOURCES +=../../../../../../bsps/arm/rtl22xx/clock/clockdrv.c # console librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/legacy-console.c diff --git a/c/src/lib/libbsp/arm/rtl22xx/timer/lpc_timer.h b/c/src/lib/libbsp/arm/rtl22xx/timer/lpc_timer.h deleted file mode 100644 index 364812ddb8..0000000000 --- a/c/src/lib/libbsp/arm/rtl22xx/timer/lpc_timer.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef __LPC_TIMER_H -#define __LPC_TIMER_H - -/************************************************************************* - * - * File name : Timer.h - * - **************************************************************************/ - -/* Timer Control register bit descriptions */ -#define TCR_ENABLE_BIT 0 -#define TCR_RESET_BIT 1 - -// The channel name which is used in matching, in fact they represent -// corresponding Match Register -#define CH_MAXNUM 4 -#define CH0 0 -#define CH1 1 -#define CH2 2 -#define CH3 3 - -// The channel name which is used in capturing, in fact they represent -// corresponding Capture Register -#define CPCH_MAXNUM 4 -#define CPCH0 0 -#define CPCH1 1 -#define CPCH2 2 -#define CPCH3 3 - -//The actions when matching -#define TimerAction_Interrupt 0x1 -#define TimerAction_ResetTimer 0x2 -#define TimerAction_StopTimer 0x4 - -//Interrupt source type -#define TIMERMR0Int 0x01 -#define TIMERMR1Int 0x02 -#define TIMERMR2Int 0x04 -#define TIMERMR3Int 0x08 -#define TIMERCR0Int 0x10 -#define TIMERCR1Int 0x20 -#define TIMERCR2Int 0x40 -#define TIMERCR3Int 0x80 - -#define TIMERALLInt 0xFF - -#endif //__LPC_Timer_H - diff --git a/c/src/lib/libbsp/arm/rtl22xx/timer/timer.c b/c/src/lib/libbsp/arm/rtl22xx/timer/timer.c deleted file mode 100644 index ad73aeda3c..0000000000 --- a/c/src/lib/libbsp/arm/rtl22xx/timer/timer.c +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @file - * @brief RTL22xx board Timer driver - * - * This uses Timer1 for timing measurments. - */ - -/* - * By Ray Xu , modify form Mc9328mxl RTEMS DSP - * - * 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 -#include "lpc_timer.h" - -uint32_t g_start; -uint32_t g_freq; - -bool benchmark_timer_find_average_overhead; - - -/* - * Set up Timer 1 - */ -void benchmark_timer_initialize( void ) -{ - g_freq = LPC22xx_Fpclk / 1000; -} - -/* - * The following controls the behavior of benchmark_timer_read(). - * - * AVG_OVEREHAD is the overhead for starting and stopping the timer. It - * is usually deducted from the number returned. - * - * LEAST_VALID is the lowest number this routine should trust. Numbers - * below this are "noise" and zero is returned. - */ - -#define AVG_OVERHEAD 0 /* It typically takes X.X microseconds */ - /* (Y countdowns) to start/stop the timer. */ - /* This value is in microseconds. */ -#define LEAST_VALID 1 /* Don't trust a clicks value lower than this */ - -benchmark_timer_t benchmark_timer_read( void ) -{ - return (T0TC/(LPC22xx_Fpclk/1000000)); - /* - * Total is calculated by taking into account the number of timer overflow - * interrupts since the timer was initialized and clicks since the last - * interrupts. - */ -} - -void benchmark_timer_disable_subtracting_average_overhead(bool find_flag) -{ - benchmark_timer_find_average_overhead = find_flag; -} - -- cgit v1.2.3