[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 16/18] ehci: create ehci_update_frindex
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 16/18] ehci: create ehci_update_frindex |
Date: |
Fri, 25 May 2012 14:40:32 +0200 |
Factor out code from ehci_frame_timer.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/hcd-ehci.c | 35 +++++++++++++++++++++++------------
1 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index ee7420f..c15dbee 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2280,6 +2280,28 @@ static void ehci_advance_periodic_state(EHCIState *ehci)
}
}
+static void ehci_update_frindex(EHCIState *ehci, int frames)
+{
+ int i;
+
+ if (!ehci_enabled(ehci)) {
+ return;
+ }
+
+ for (i = 0; i < frames; i++) {
+ ehci->frindex += 8;
+
+ if (ehci->frindex == 0x00002000) {
+ ehci_set_interrupt(ehci, USBSTS_FLR);
+ }
+
+ if (ehci->frindex == 0x00004000) {
+ ehci_set_interrupt(ehci, USBSTS_FLR);
+ ehci->frindex = 0;
+ }
+ }
+}
+
static void ehci_frame_timer(void *opaque)
{
EHCIState *ehci = opaque;
@@ -2296,18 +2318,7 @@ static void ehci_frame_timer(void *opaque)
frames = ns_elapsed / FRAME_TIMER_NS;
for (i = 0; i < frames; i++) {
- if (ehci_enabled(ehci)) {
- ehci->frindex += 8;
-
- if (ehci->frindex == 0x00002000) {
- ehci_set_interrupt(ehci, USBSTS_FLR);
- }
-
- if (ehci->frindex == 0x00004000) {
- ehci_set_interrupt(ehci, USBSTS_FLR);
- ehci->frindex = 0;
- }
- }
+ ehci_update_frindex(ehci, 1);
if (frames - i > ehci->maxframes) {
skipped_frames++;
--
1.7.1
- [Qemu-devel] [PATCH 05/18] ehci: add queuing support, (continued)
- [Qemu-devel] [PATCH 05/18] ehci: add queuing support, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 14/18] ehci: fix halt status handling, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 04/18] ehci: move ehci_flush_qh, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 13/18] ehci: update status bits in ehci_set_state, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 03/18] ehci: cache USBDevice in EHCIQueue, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 01/18] ehci: add EHCIPacket, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 09/18] ehci: schedule async bh on async packet completion, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 17/18] ehci: adaptive wakeup rate., Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 18/18] ehci: rework frame skipping, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 15/18] ehci: remove unused attach_poll_counter, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 16/18] ehci: create ehci_update_frindex,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 07/18] ehci: add async field to EHCIQueue, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 02/18] ehci: make ehci_execute work on EHCIPacket instead of EHCIQueue, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 08/18] ehci: move async schedule to bottom half, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 11/18] ehci: fix reset, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 06/18] ehci: tweak queue initialization, Gerd Hoffmann, 2012/05/25