summaryrefslogtreecommitdiff
path: root/config/os
diff options
context:
space:
mode:
authorsonarnerd <sonarnerd@0c269be4-1314-0410-8aa9-9f06e86f4224>2006-10-25 18:17:45 +0000
committersonarnerd <sonarnerd@0c269be4-1314-0410-8aa9-9f06e86f4224>2006-10-25 18:17:45 +0000
commit34d9717147d79b32c72618d41e10b95d97db8f14 (patch)
tree8eabc748358b7fe73a0840cf5e9052eef4f012d3 /config/os
parent5d89e1da69c6f7612a06ff9ce40bebe5b2a4b55d (diff)
downloadjack1-34d9717147d79b32c72618d41e10b95d97db8f14.tar.gz
Use 32-bit reads on HPET on 32-bit platforms. 64-bit reads should be OK on x86-64 and for example Intel ICH7.
git-svn-id: svn+ssh://jackaudio.org/trunk/jack@991 0c269be4-1314-0410-8aa9-9f06e86f4224
Diffstat (limited to 'config/os')
-rw-r--r--config/os/gnu-linux/time.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/config/os/gnu-linux/time.c b/config/os/gnu-linux/time.c
index ca1391b..923597a 100644
--- a/config/os/gnu-linux/time.c
+++ b/config/os/gnu-linux/time.c
@@ -30,6 +30,11 @@ jack_time_t (*_jack_get_microseconds)(void) = 0;
#define HPET_MMAP_SIZE 1024
#define HPET_PERIOD 0x004
#define HPET_COUNTER 0x0f0
+#if defined(__x86_64__)
+#define HPET_64BIT
+#else
+#define HPET_32BIT
+#endif
static int hpet_fd;
static unsigned char *hpet_ptr;
static unsigned int hpet_period; /* period length in femto secs */
@@ -64,10 +69,18 @@ jack_hpet_init ()
static jack_time_t
jack_get_microseconds_from_hpet (void)
{
+#ifdef HPET_64BIT
unsigned long long hpet_counter;
+#else
+ unsigned int hpet_counter;
+#endif
long double hpet_time;
+#ifdef HPET_64BIT
hpet_counter = *((unsigned long long *) (hpet_ptr + HPET_COUNTER));
+#else
+ hpet_counter = *((unsigned int *) (hpet_ptr + HPET_COUNTER));
+#endif
hpet_time = (long double) hpet_counter * (long double) hpet_period *
(long double) 1e-9;
return ((jack_time_t) (hpet_time + 0.5));