From a655f4dc7cf6d6258d6ffd2227b949e0fb3442cb Mon Sep 17 00:00:00 2001 From: afpr Date: Tue, 1 Oct 2013 11:33:30 +0100 Subject: [PATCH] Defined a linker symbol for the CPU frequency. --- c/src/lib/libbsp/bfin/acinclude.m4 | 4 ++-- c/src/lib/libbsp/patmos/pasim/clock/ckinit.c | 8 ++++---- c/src/lib/libbsp/patmos/pasim/include/pasim.h | 8 +++++--- c/src/lib/libbsp/patmos/pasim/make/custom/pasim.cfg | 2 +- c/src/lib/libbsp/patmos/pasim/timer/timer.c | 4 ++-- run-testsuite.sh | 6 +++--- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/c/src/lib/libbsp/bfin/acinclude.m4 b/c/src/lib/libbsp/bfin/acinclude.m4 index ab6082ef47..828fd894dd 100644 --- a/c/src/lib/libbsp/bfin/acinclude.m4 +++ b/c/src/lib/libbsp/bfin/acinclude.m4 @@ -2,12 +2,12 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR], [ case "$1" in - TLL6527M ) - AC_CONFIG_SUBDIRS([TLL6527M]);; bf537Stamp ) AC_CONFIG_SUBDIRS([bf537Stamp]);; eZKit533 ) AC_CONFIG_SUBDIRS([eZKit533]);; + TLL6527M ) + AC_CONFIG_SUBDIRS([TLL6527M]);; *) AC_MSG_ERROR([Invalid BSP]);; esac diff --git a/c/src/lib/libbsp/patmos/pasim/clock/ckinit.c b/c/src/lib/libbsp/patmos/pasim/clock/ckinit.c index b7824c481b..288c3e5d87 100755 --- a/c/src/lib/libbsp/patmos/pasim/clock/ckinit.c +++ b/c/src/lib/libbsp/patmos/pasim/clock/ckinit.c @@ -93,7 +93,7 @@ uint32_t bsp_clock_nanoseconds_since_last_tick(void) { uint32_t usecs; - usecs = get_cpu_cycles()/PATMOS_FREQ_MHZ - Clock_driver_ticks*rtems_configuration_get_microseconds_per_tick() - usecs_offset; + usecs = get_cpu_cycles()/__PATMOS_FREQ_MHZ - Clock_driver_ticks*rtems_configuration_get_microseconds_per_tick() - usecs_offset; return usecs * 1000; } @@ -214,7 +214,7 @@ rtems_isr Clock_isr( */ Clock_driver_ticks += 1; - __PATMOS_RTC_WR_INTERVAL(rtems_configuration_get_microseconds_per_tick() * PATMOS_FREQ_MHZ); + __PATMOS_RTC_WR_INTERVAL(rtems_configuration_get_microseconds_per_tick() * __PATMOS_FREQ_MHZ); rtems_clock_tick(); @@ -330,12 +330,12 @@ void Install_clock( ); #endif - __PATMOS_RTC_WR_INTERVAL(rtems_configuration_get_microseconds_per_tick() * PATMOS_FREQ_MHZ); + __PATMOS_RTC_WR_INTERVAL(rtems_configuration_get_microseconds_per_tick() * __PATMOS_FREQ_MHZ); /* * reset the cpu_cycles count to determine clock_nanoseconds_since_last_tick */ - //usecs_offset = get_cpu_cycles()/PATMOS_FREQ_MHZ; + //usecs_offset = get_cpu_cycles()/__PATMOS_FREQ_MHZ; /* * Schedule the clock cleanup routine to execute if the application exits. diff --git a/c/src/lib/libbsp/patmos/pasim/include/pasim.h b/c/src/lib/libbsp/patmos/pasim/include/pasim.h index 35f50fbcbd..c60a5322cb 100755 --- a/c/src/lib/libbsp/patmos/pasim/include/pasim.h +++ b/c/src/lib/libbsp/patmos/pasim/include/pasim.h @@ -94,9 +94,11 @@ extern void set_cpu_cycles (u64 time_warp); extern u64 get_cpu_cycles(void); extern u64 get_cpu_time(void); -#define PATMOS_FREQ_MHZ 74 -#define PATMOS_FREQ_HZ ( PATMOS_FREQ_MHZ * 1000000U) -#define PATMOS_INF 0xFFFFFFFF +extern char __cycles_per_sec; /* linker symbol giving the CPU frequency */ + +#define __PATMOS_CPU_FREQ (int)(&__cycles_per_sec) /* CPU frequency in Hz */ +#define __PATMOS_FREQ_MHZ __PATMOS_CPU_FREQ/1000000U +#define __PATMOS_INF 0xFFFFFFFF /* maximum cycles the clock can run without interrupts */ /* Address to access the cycle counter low register of the RTC */ #define __PATMOS_RTC_CYCLE_LOW_ADDR (&_timer_base + 0x00) diff --git a/c/src/lib/libbsp/patmos/pasim/make/custom/pasim.cfg b/c/src/lib/libbsp/patmos/pasim/make/custom/pasim.cfg index 777b7d391c..f4f87a54c5 100755 --- a/c/src/lib/libbsp/patmos/pasim/make/custom/pasim.cfg +++ b/c/src/lib/libbsp/patmos/pasim/make/custom/pasim.cfg @@ -16,4 +16,4 @@ CPU_CFLAGS = -msoft-float # optimize flag: typically -O2 CFLAGS_OPTIMIZE_V = -O2 -g -Xllc -trap-func=abort_trap -LINK_LIBS += $(PROJECT_RELEASE)/lib/start.o $(PROJECT_RELEASE)/lib/libsyms.ll -l=c -l=rtemscpu -l=rtemsbsp -nostartfiles -Xgold -Map -Xgold map.map -Xgold --script=$(PROJECT_RELEASE)/lib/linkcmds -Xopt -disable-internalize \ No newline at end of file +LINK_LIBS += $(PROJECT_RELEASE)/lib/start.o $(PROJECT_RELEASE)/lib/libsyms.ll -l=c -l=rtemscpu -l=rtemsbsp -nostartfiles -Xgold -Map -Xgold map.map -Xgold --script=$(PROJECT_RELEASE)/lib/linkcmds -Xgold --defsym -Xgold __cycles_per_sec=5000000 -Xopt -disable-internalize \ No newline at end of file diff --git a/c/src/lib/libbsp/patmos/pasim/timer/timer.c b/c/src/lib/libbsp/patmos/pasim/timer/timer.c index 3f1497abec..6b049026f6 100755 --- a/c/src/lib/libbsp/patmos/pasim/timer/timer.c +++ b/c/src/lib/libbsp/patmos/pasim/timer/timer.c @@ -29,7 +29,7 @@ void benchmark_timer_initialize(void) /* * Timer runs long and accurate enough not to require an interrupt. */ - __PATMOS_RTC_WR_INTERVAL(PATMOS_INF); + __PATMOS_RTC_WR_INTERVAL(__PATMOS_INF); } int benchmark_timer_read(void) @@ -42,7 +42,7 @@ int benchmark_timer_read(void) __PATMOS_RTC_RD_INTERVAL(total); - total = (PATMOS_INF - total)/PATMOS_FREQ_MHZ; + total = (__PATMOS_INF - total)/__PATMOS_FREQ_MHZ; if ( benchmark_timer_find_average_overhead == true ) return total; /* in one microsecond units */ diff --git a/run-testsuite.sh b/run-testsuite.sh index 48efdf8db1..a20e04408e 100755 --- a/run-testsuite.sh +++ b/run-testsuite.sh @@ -143,11 +143,11 @@ function recurseDirs containsElement "$testdir" "${resumetests[@]}" if [[ $? == 0 || ${#resumetests[@]} == 0 ]]; then runTest "$f" $(echo "${testdir%%/*}") "$testdir" - fi + fi + recurseDirs $(ls -1) if [[ $cdlevel != 1 ]]; then - testdir=$(echo "${testdir%%/*}") + testdir=$(echo "${testdir%/*}") fi - recurseDirs $(ls -1) cd .. let "cdlevel -= 1" fi