diff options
author | Juan Quintela <quintela@redhat.com> | 2009-09-10 03:04:26 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-09-11 10:19:52 -0500 |
commit | 6ee093c90761eabfc6255624000d3d8248802209 (patch) | |
tree | f550274a05a1cd7a379f3e4d1cb7789fb2e64b8c /hw/i8254.c | |
parent | b03b2e48cb322cb695ff7a6666b25712140ea3c9 (diff) | |
download | qemu-6ee093c90761eabfc6255624000d3d8248802209.tar.gz qemu-6ee093c90761eabfc6255624000d3d8248802209.tar.bz2 qemu-6ee093c90761eabfc6255624000d3d8248802209.zip |
Unexport ticks_per_sec variable. Create get_ticks_per_sec() function
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/i8254.c')
-rw-r--r-- | hw/i8254.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/hw/i8254.c b/hw/i8254.c index 6a8cd3ed18..5c49e6e0ae 100644 --- a/hw/i8254.c +++ b/hw/i8254.c @@ -66,7 +66,8 @@ static int pit_get_count(PITChannelState *s) uint64_t d; int counter; - d = muldiv64(qemu_get_clock(vm_clock) - s->count_load_time, PIT_FREQ, ticks_per_sec); + d = muldiv64(qemu_get_clock(vm_clock) - s->count_load_time, PIT_FREQ, + get_ticks_per_sec()); switch(s->mode) { case 0: case 1: @@ -91,7 +92,8 @@ static int pit_get_out1(PITChannelState *s, int64_t current_time) uint64_t d; int out; - d = muldiv64(current_time - s->count_load_time, PIT_FREQ, ticks_per_sec); + d = muldiv64(current_time - s->count_load_time, PIT_FREQ, + get_ticks_per_sec()); switch(s->mode) { default: case 0: @@ -130,7 +132,8 @@ static int64_t pit_get_next_transition_time(PITChannelState *s, uint64_t d, next_time, base; int period2; - d = muldiv64(current_time - s->count_load_time, PIT_FREQ, ticks_per_sec); + d = muldiv64(current_time - s->count_load_time, PIT_FREQ, + get_ticks_per_sec()); switch(s->mode) { default: case 0: @@ -166,7 +169,8 @@ static int64_t pit_get_next_transition_time(PITChannelState *s, break; } /* convert to timer units */ - next_time = s->count_load_time + muldiv64(next_time, ticks_per_sec, PIT_FREQ); + next_time = s->count_load_time + muldiv64(next_time, get_ticks_per_sec(), + PIT_FREQ); /* fix potential rounding problems */ /* XXX: better solution: use a clock at PIT_FREQ Hz */ if (next_time <= current_time) @@ -373,7 +377,7 @@ static void pit_irq_timer_update(PITChannelState *s, int64_t current_time) #ifdef DEBUG_PIT printf("irq_level=%d next_delay=%f\n", irq_level, - (double)(expire_time - current_time) / ticks_per_sec); + (double)(expire_time - current_time) / get_ticks_per_sec()); #endif s->next_transition_time = expire_time; if (expire_time != -1) |