summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpauldavisthefirst <paul@linuxaudiosystems.com>2014-03-14 13:28:41 -0400
committerpauldavisthefirst <paul@linuxaudiosystems.com>2014-03-14 13:28:41 -0400
commit59352d43f42d39a69c718fc03f622aae324b325e (patch)
treeb905035aa39259179c8440415043c13ce26aa5c4
parent144f712ac2f42acf0c63d90320a663a7c399512e (diff)
parent0dff59ba7c019e560c9076f48ea57b1ad0d970b1 (diff)
downloadjack1-59352d43f42d39a69c718fc03f622aae324b325e.tar.gz
Merge pull request #10 from adiknoth/arm-clockfix
ARM clockfix
-rw-r--r--config/os/gnu-linux/time.c65
-rw-r--r--include/internal.h1
-rw-r--r--jackd/jackd.c11
-rw-r--r--libjack/time.c2
4 files changed, 9 insertions, 70 deletions
diff --git a/config/os/gnu-linux/time.c b/config/os/gnu-linux/time.c
index 7301200..982a290 100644
--- a/config/os/gnu-linux/time.c
+++ b/config/os/gnu-linux/time.c
@@ -23,7 +23,6 @@
#include <stdint.h>
-static jack_time_t __jack_cpu_mhz = 0;
jack_time_t (*_jack_get_microseconds)(void) = 0;
#if defined(__gnu_linux__) && (defined(__i386__) || defined(__x86_64__))
@@ -113,68 +112,10 @@ jack_get_microseconds_from_hpet (void)
#endif /* HPET_SUPPORT */
-jack_time_t
-jack_get_microseconds_from_cycles (void) {
- return get_cycles() / __jack_cpu_mhz;
-}
-
-/*
- * This is another kludge. It looks CPU-dependent, but actually it
- * reflects the lack of standards for the Linux kernel formatting of
- * /proc/cpuinfo.
- */
-
-jack_time_t
-jack_get_mhz (void)
-{
- FILE *f = fopen("/proc/cpuinfo", "r");
- if (f == 0)
- {
- perror("can't open /proc/cpuinfo\n");
- exit(1);
- }
-
- for ( ; ; )
- {
- jack_time_t mhz;
- int ret;
- char buf[1000];
-
- if (fgets(buf, sizeof(buf), f) == NULL) {
- jack_error ("FATAL: cannot locate cpu MHz in "
- "/proc/cpuinfo\n");
- exit(1);
- }
-
-#if defined(__powerpc__)
- ret = sscanf(buf, "clock\t: %" SCNu64 "MHz", &mhz);
-#elif defined( __i386__ ) || defined (__hppa__) || defined (__ia64__) || \
- defined(__x86_64__)
- ret = sscanf(buf, "cpu MHz : %" SCNu64, &mhz);
-#elif defined( __sparc__ )
- ret = sscanf(buf, "Cpu0Bogo : %" SCNu64, &mhz);
-#elif defined( __mc68000__ )
- ret = sscanf(buf, "Clocking: %" SCNu64, &mhz);
-#elif defined( __s390__ )
- ret = sscanf(buf, "bogomips per cpu: %" SCNu64, &mhz);
-#elif defined( __sh__ )
- ret = sscanf(buf, "bogomips : %" SCNu64, &mhz);
-#else /* MIPS, ARM, alpha */
- ret = sscanf(buf, "BogoMIPS : %" SCNu64, &mhz);
-#endif
-
- if (ret == 1)
- {
- fclose(f);
- return (jack_time_t)mhz;
- }
- }
-}
-
void
jack_init_time ()
{
- __jack_cpu_mhz = jack_get_mhz ();
+ /* nothing to do on a generic system - we use the system clock */
}
void
@@ -182,10 +123,6 @@ jack_set_clock_source (jack_timer_type_t clocksrc)
{
switch (clocksrc)
{
- case JACK_TIMER_CYCLE_COUNTER:
- _jack_get_microseconds = jack_get_microseconds_from_cycles;
- break;
-
case JACK_TIMER_HPET:
if (jack_hpet_init () == 0) {
_jack_get_microseconds = jack_get_microseconds_from_hpet;
diff --git a/include/internal.h b/include/internal.h
index ae8e86a..bf622c8 100644
--- a/include/internal.h
+++ b/include/internal.h
@@ -52,7 +52,6 @@ extern jack_thread_creator_t jack_thread_creator;
typedef enum {
JACK_TIMER_SYSTEM_CLOCK,
- JACK_TIMER_CYCLE_COUNTER,
JACK_TIMER_HPET,
} jack_timer_type_t;
diff --git a/jackd/jackd.c b/jackd/jackd.c
index 0aab9e1..d9d9f77 100644
--- a/jackd/jackd.c
+++ b/jackd/jackd.c
@@ -542,7 +542,7 @@ static void usage (FILE *file)
" [ --debug-timer OR -D ]\n"
" [ --no-sanity-checks OR -N ]\n"
" [ --verbose OR -v ]\n"
-" [ --clocksource OR -c [ c(ycle) | h(pet) | s(ystem) ]\n"
+" [ --clocksource OR -c [ h(pet) | s(ystem) ]\n"
" [ --replace-registry ]\n"
" [ --silent OR -s ]\n"
" [ --version OR -V ]\n"
@@ -792,7 +792,12 @@ main (int argc, char *argv[])
if (tolower (optarg[0]) == 'h') {
clock_source = JACK_TIMER_HPET;
} else if (tolower (optarg[0]) == 'c') {
- clock_source = JACK_TIMER_CYCLE_COUNTER;
+ /* For backwards compatibility with scripts,
+ * allow the user to request the cycle clock
+ * on the command line, but use the system
+ * clock instead
+ */
+ clock_source = JACK_TIMER_SYSTEM_CLOCK;
} else if (tolower (optarg[0]) == 's') {
clock_source = JACK_TIMER_SYSTEM_CLOCK;
} else {
@@ -914,7 +919,7 @@ main (int argc, char *argv[])
copyright (stdout);
- if (do_sanity_checks && (0 < sanitycheck (realtime, (clock_source == JACK_TIMER_CYCLE_COUNTER)))) {
+ if (do_sanity_checks && (0 < sanitycheck (realtime, FALSE))) {
return -1;
}
diff --git a/libjack/time.c b/libjack/time.c
index 449329b..d450aa6 100644
--- a/libjack/time.c
+++ b/libjack/time.c
@@ -45,8 +45,6 @@ const char*
jack_clock_source_name (jack_timer_type_t src)
{
switch (src) {
- case JACK_TIMER_CYCLE_COUNTER:
- return "cycle counter";
case JACK_TIMER_HPET:
return "hpet";
case JACK_TIMER_SYSTEM_CLOCK: