From a7fb77d6eca56e61e94f62e7deb4120b60b1e919 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Mon, 10 May 2010 23:50:54 -0700 Subject: Upstream: integrate timer/clock management changes. Change-Id: I24acbdebe58d207352548f54dda1abf5be01e7d4 --- hw/bt-hci.c | 8 +++----- hw/goldfish_timer.c | 7 ++++--- hw/usb-ohci.c | 13 ++++++------- 3 files changed, 13 insertions(+), 15 deletions(-) (limited to 'hw') diff --git a/hw/bt-hci.c b/hw/bt-hci.c index 7837d9e..669866a 100644 --- a/hw/bt-hci.c +++ b/hw/bt-hci.c @@ -15,9 +15,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA + * along with this program; if not, see . */ #include "qemu-common.h" @@ -579,7 +577,7 @@ static void bt_hci_inquiry_result(struct bt_hci_s *hci, static void bt_hci_mod_timer_1280ms(QEMUTimer *timer, int period) { qemu_mod_timer(timer, qemu_get_clock(vm_clock) + - muldiv64(period << 7, ticks_per_sec, 100)); + muldiv64(period << 7, get_ticks_per_sec(), 100)); } static void bt_hci_inquiry_start(struct bt_hci_s *hci, int length) @@ -1088,7 +1086,7 @@ static int bt_hci_mode_change(struct bt_hci_s *hci, uint16_t handle, bt_hci_event_status(hci, HCI_SUCCESS); qemu_mod_timer(link->acl_mode_timer, qemu_get_clock(vm_clock) + - muldiv64(interval * 625, ticks_per_sec, 1000000)); + muldiv64(interval * 625, get_ticks_per_sec(), 1000000)); bt_hci_lmp_mode_change_master(hci, link->link, mode, interval); return 0; diff --git a/hw/goldfish_timer.c b/hw/goldfish_timer.c index 8a84895..d5c9a33 100644 --- a/hw/goldfish_timer.c +++ b/hw/goldfish_timer.c @@ -9,6 +9,7 @@ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. */ +#include "qemu-common.h" #include "qemu-timer.h" #include "cpu.h" #include "arm_pic.h" @@ -42,7 +43,7 @@ static void goldfish_timer_save(QEMUFile* f, void* opaque) qemu_put_byte(f, s->armed); if (s->armed) { int64_t now = qemu_get_clock(vm_clock); - int64_t alarm = muldiv64(s->alarm_low | (int64_t)s->alarm_high << 32, ticks_per_sec, 1000000000); + int64_t alarm = muldiv64(s->alarm_low | (int64_t)s->alarm_high << 32, get_ticks_per_sec(), 1000000000); qemu_put_be64(f, alarm-now); } } @@ -76,7 +77,7 @@ static uint32_t goldfish_timer_read(void *opaque, target_phys_addr_t offset) struct timer_state *s = (struct timer_state *)opaque; switch(offset) { case TIMER_TIME_LOW: - s->now = muldiv64(qemu_get_clock(vm_clock), 1000000000, ticks_per_sec); + s->now = muldiv64(qemu_get_clock(vm_clock), 1000000000, get_ticks_per_sec()); return s->now; case TIMER_TIME_HIGH: return s->now >> 32; @@ -93,7 +94,7 @@ static void goldfish_timer_write(void *opaque, target_phys_addr_t offset, uint32 switch(offset) { case TIMER_ALARM_LOW: s->alarm_low = value; - alarm = muldiv64(s->alarm_low | (int64_t)s->alarm_high << 32, ticks_per_sec, 1000000000); + alarm = muldiv64(s->alarm_low | (int64_t)s->alarm_high << 32, get_ticks_per_sec(), 1000000000); now = qemu_get_clock(vm_clock); if (alarm <= now) { goldfish_device_set_irq(&s->dev, 0, 1); diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c index c575480..7dd8ed3 100644 --- a/hw/usb-ohci.c +++ b/hw/usb-ohci.c @@ -15,8 +15,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA + * License along with this library; if not, see . * * TODO: * o Isochronous transfers @@ -1668,12 +1667,12 @@ static void usb_ohci_init(OHCIState *ohci, int num_ports, int devfn, if (usb_frame_time == 0) { #ifdef OHCI_TIME_WARP - usb_frame_time = ticks_per_sec; - usb_bit_time = muldiv64(1, ticks_per_sec, USB_HZ/1000); + usb_frame_time = get_ticks_per_sec(); + usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ/1000); #else - usb_frame_time = muldiv64(1, ticks_per_sec, 1000); - if (ticks_per_sec >= USB_HZ) { - usb_bit_time = muldiv64(1, ticks_per_sec, USB_HZ); + usb_frame_time = muldiv64(1, get_ticks_per_sec(), 1000); + if (get_ticks_per_sec() >= USB_HZ) { + usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ); } else { usb_bit_time = 1; } -- cgit v1.1