Defined a linker symbol for the CPU frequency.

This commit is contained in:
afpr
2013-10-01 11:33:30 +01:00
parent 8e93e1cc19
commit a655f4dc7c
6 changed files with 17 additions and 15 deletions

View File

@@ -2,12 +2,12 @@
AC_DEFUN([RTEMS_CHECK_BSPDIR], AC_DEFUN([RTEMS_CHECK_BSPDIR],
[ [
case "$1" in case "$1" in
TLL6527M )
AC_CONFIG_SUBDIRS([TLL6527M]);;
bf537Stamp ) bf537Stamp )
AC_CONFIG_SUBDIRS([bf537Stamp]);; AC_CONFIG_SUBDIRS([bf537Stamp]);;
eZKit533 ) eZKit533 )
AC_CONFIG_SUBDIRS([eZKit533]);; AC_CONFIG_SUBDIRS([eZKit533]);;
TLL6527M )
AC_CONFIG_SUBDIRS([TLL6527M]);;
*) *)
AC_MSG_ERROR([Invalid BSP]);; AC_MSG_ERROR([Invalid BSP]);;
esac esac

View File

@@ -93,7 +93,7 @@ uint32_t bsp_clock_nanoseconds_since_last_tick(void)
{ {
uint32_t usecs; 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; return usecs * 1000;
} }
@@ -214,7 +214,7 @@ rtems_isr Clock_isr(
*/ */
Clock_driver_ticks += 1; 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(); rtems_clock_tick();
@@ -330,12 +330,12 @@ void Install_clock(
); );
#endif #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 * 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. * Schedule the clock cleanup routine to execute if the application exits.

View File

@@ -94,9 +94,11 @@ extern void set_cpu_cycles (u64 time_warp);
extern u64 get_cpu_cycles(void); extern u64 get_cpu_cycles(void);
extern u64 get_cpu_time(void); extern u64 get_cpu_time(void);
#define PATMOS_FREQ_MHZ 74 extern char __cycles_per_sec; /* linker symbol giving the CPU frequency */
#define PATMOS_FREQ_HZ ( PATMOS_FREQ_MHZ * 1000000U)
#define PATMOS_INF 0xFFFFFFFF #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 */ /* Address to access the cycle counter low register of the RTC */
#define __PATMOS_RTC_CYCLE_LOW_ADDR (&_timer_base + 0x00) #define __PATMOS_RTC_CYCLE_LOW_ADDR (&_timer_base + 0x00)

View File

@@ -16,4 +16,4 @@ CPU_CFLAGS = -msoft-float
# optimize flag: typically -O2 # optimize flag: typically -O2
CFLAGS_OPTIMIZE_V = -O2 -g -Xllc -trap-func=abort_trap 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 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

View File

@@ -29,7 +29,7 @@ void benchmark_timer_initialize(void)
/* /*
* Timer runs long and accurate enough not to require an interrupt. * 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) int benchmark_timer_read(void)
@@ -42,7 +42,7 @@ int benchmark_timer_read(void)
__PATMOS_RTC_RD_INTERVAL(total); __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 ) if ( benchmark_timer_find_average_overhead == true )
return total; /* in one microsecond units */ return total; /* in one microsecond units */

View File

@@ -144,10 +144,10 @@ function recurseDirs
if [[ $? == 0 || ${#resumetests[@]} == 0 ]]; then if [[ $? == 0 || ${#resumetests[@]} == 0 ]]; then
runTest "$f" $(echo "${testdir%%/*}") "$testdir" runTest "$f" $(echo "${testdir%%/*}") "$testdir"
fi fi
if [[ $cdlevel != 1 ]]; then
testdir=$(echo "${testdir%%/*}")
fi
recurseDirs $(ls -1) recurseDirs $(ls -1)
if [[ $cdlevel != 1 ]]; then
testdir=$(echo "${testdir%/*}")
fi
cd .. cd ..
let "cdlevel -= 1" let "cdlevel -= 1"
fi fi