[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/21] usb-ehci: frindex always is a 14 bits counter
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 12/21] usb-ehci: frindex always is a 14 bits counter |
Date: |
Tue, 17 Apr 2012 10:45:17 +0200 |
From: Hans de Goede <address@hidden>
frindex always is a 14 bits counter, and not a 13 bits one as we were
emulating. There are some subtle hints to this in the spec, first of all
"Table 2-12. FRINDEX - Frame Index Register" says:
"Bit 13:0 Frame Index. The value in this register increments at the end of
each time frame (e.g. micro-frame). Bits [N:3] are used for the Frame List
current index. This means that each location of the frame list is accessed
8 times (frames or micro-frames) before moving to the next index. The
following illustrates values of N based on the value of the Frame List
Size field in the USBCMD register.
USBCMD[Frame List Size] Number Elements N
00b 1024 12
01b 512 11
10b 256 10
11b Reserved"
Notice how the text talks about "Bits [N:3]" are used ..., it does
NOT say that when N == 12 (our case) the counter will wrap from 8191 to 0,
or in otherwords that it is a 13 bits counter (bits 0 - 12).
The other hint is in "Table 2-10. USBSTS USB Status Register Bit Definitions":
"Bit 3 Frame List Rollover - R/WC. The Host Controller sets this bit to a one
when the Frame List Index (see Section 2.3.4) rolls over from its maximum value
to zero. The exact value at which the rollover occurs depends on the frame
list size. For example, if the frame list size (as programmed in the Frame
List Size field of the USBCMD register) is 1024, the Frame Index Register
rolls over every time FRINDEX[13] toggles. Similarly, if the size is 512,
the Host Controller sets this bit to a one every time FRINDEX[12] toggles."
Notice how this text talks about setting bit 3 when bit 13 of frindex toggles
(when there are 1024 entries, so our case), so this indicates that frindex
has a bit 13 making it a 14 bit counter.
Besides these clear hints the real proof is in the pudding. Before this
patch I could not stream data from a USB2 webcam under Windows XP, after
this cam using a USB2 webcam under Windows XP works fine, and no regressions
with other operating systems were seen.
Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/hcd-ehci.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 34f7538..be02308 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2149,11 +2149,15 @@ static void ehci_frame_timer(void *opaque)
if ( !(ehci->usbsts & USBSTS_HALT)) {
ehci->frindex += 8;
- if (ehci->frindex > 0x00001fff) {
- ehci->frindex = 0;
+ if (ehci->frindex == 0x00002000) {
ehci_set_interrupt(ehci, USBSTS_FLR);
}
+ if (ehci->frindex == 0x00004000) {
+ ehci_set_interrupt(ehci, USBSTS_FLR);
+ ehci->frindex = 0;
+ }
+
ehci->sofv = (ehci->frindex - 1) >> 3;
ehci->sofv &= 0x000003ff;
}
--
1.7.1
- [Qemu-devel] [PATCH 10/21] usb-hub: add tracepoints, (continued)
- [Qemu-devel] [PATCH 10/21] usb-hub: add tracepoints, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 18/21] usb-host: rewrite usb_linux_update_endp_table, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 21/21] usb-ehci: drop assert(), Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 08/21] usb-host: add property to turn off pipelining, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 19/21] usb-ehci: Drop unused sofv value, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 16/21] usb: use USBDescriptor for interface descriptors., Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 09/21] usb_packet_set_state: handle p->ep == NULL, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 06/21] usb-host: trace canceled requests, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 20/21] usb-redir: Notify our peer when we reject a device due to a speed mismatch, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 13/21] usb: add USBDescriptor, use for device descriptors., Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 12/21] usb-ehci: frindex always is a 14 bits counter,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 02/21] usb-uhci: stop queue filling when we find a in-flight td, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 15/21] usb: use USBDescriptor for config descriptors., Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 04/21] Add bootindex support to usb-host and usb-redir, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 07/21] usb-host: add usb packet to request tracepoints, Gerd Hoffmann, 2012/04/17
- Re: [Qemu-devel] [PULL 00/21] usb patch queue, Hans de Goede, 2012/04/17