diff options
author | Richard Braun <rbraun@sceen.net> | 2017-08-31 23:17:47 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-08-31 23:17:47 +0200 |
commit | bf9ea21a402d3e006edce6d87ca7b0a16adbe3f0 (patch) | |
tree | fe14fbcbc38e4e686408c2a0a255b7d83662d515 | |
parent | 406a8a1aeec188fde53050ea9b58fb2bcff9a2d0 (diff) |
Make the low resolution clock frequency configurable
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | kern/clock.h | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index 947786c..20d8156 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,12 @@ AC_ARG_WITH([max-cpus], [opt_max_cpus=$withval], [opt_max_cpus=128]) +AC_ARG_WITH([clock-freq], + [AS_HELP_STRING([--with-clock-freq=CLOCK_FREQ], + [set the low resolution clock frequency])], + [opt_clock_freq=$withval], + [opt_clock_freq=200]) + AC_ARG_ENABLE([mutex-adaptive], [AS_HELP_STRING([--enable-mutex-adaptive], [enable adaptive spinning mutexes])]) @@ -112,7 +118,10 @@ AM_CONDITIONAL([TEST_XCALL], AC_DEFINE_UNQUOTED([X15_MAX_CPUS], [$opt_max_cpus], [maximum number of supported processors]) +AC_DEFINE_UNQUOTED([X15_CLOCK_FREQ], [$opt_clock_freq], + [low resolution clock frequency]) AC_MSG_NOTICE([maximum number of supported processors: $opt_max_cpus]) +AC_MSG_NOTICE([low resolution clock frequency: $opt_clock_freq Hz]) AS_IF([test x"$enable_mutex_adaptive" = xyes -a x"$enable_mutex_pi" = xyes], [AC_MSG_ERROR([--enable-mutex-adaptive and --enable-mutex-pi are mutually exclusive])]) diff --git a/kern/clock.h b/kern/clock.h index 30db0a8..fa48a47 100644 --- a/kern/clock.h +++ b/kern/clock.h @@ -31,12 +31,10 @@ /* * Clock frequency. - * - * TODO Clock frequency selection. */ -#define CLOCK_FREQ 200 +#define CLOCK_FREQ X15_CLOCK_FREQ -#if (1000 % CLOCK_FREQ) != 0 +#if (CLOCK_FREQ < 100) || (CLOCK_FREQ > 1000) || (1000 % CLOCK_FREQ) != 0 #error "invalid clock frequency" #endif /* (1000 % CLOCK_FREQ) != 0 */ |