diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-11-19 14:36:56 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2013-11-26 09:21:17 +0100 |
commit | 04b300f85fafd2d6a92ec0a766f0035e9bc5835c (patch) | |
tree | 91eb8d9a07f7cd39801dc786fa7543c1c829cba1 /hw/usb | |
parent | 5007c940a9c96ad974573915192424ba00b49932 (diff) | |
download | qemu-04b300f85fafd2d6a92ec0a766f0035e9bc5835c.zip qemu-04b300f85fafd2d6a92ec0a766f0035e9bc5835c.tar.gz qemu-04b300f85fafd2d6a92ec0a766f0035e9bc5835c.tar.bz2 |
usb: Add max_streams attribute to endpoint info
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r-- | hw/usb/core.c | 22 | ||||
-rw-r--r-- | hw/usb/desc.c | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/hw/usb/core.c b/hw/usb/core.c index cf59a1a..67ba7d6 100644 --- a/hw/usb/core.c +++ b/hw/usb/core.c @@ -623,6 +623,7 @@ void usb_ep_reset(USBDevice *dev) dev->ep_ctl.type = USB_ENDPOINT_XFER_CONTROL; dev->ep_ctl.ifnum = 0; dev->ep_ctl.max_packet_size = 64; + dev->ep_ctl.max_streams = 0; dev->ep_ctl.dev = dev; dev->ep_ctl.pipeline = false; for (ep = 0; ep < USB_MAX_ENDPOINTS; ep++) { @@ -636,6 +637,8 @@ void usb_ep_reset(USBDevice *dev) dev->ep_out[ep].ifnum = USB_INTERFACE_INVALID; dev->ep_in[ep].max_packet_size = 0; dev->ep_out[ep].max_packet_size = 0; + dev->ep_in[ep].max_streams = 0; + dev->ep_out[ep].max_streams = 0; dev->ep_in[ep].dev = dev; dev->ep_out[ep].dev = dev; dev->ep_in[ep].pipeline = false; @@ -764,6 +767,25 @@ int usb_ep_get_max_packet_size(USBDevice *dev, int pid, int ep) return uep->max_packet_size; } +void usb_ep_set_max_streams(USBDevice *dev, int pid, int ep, uint8_t raw) +{ + struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); + int MaxStreams; + + MaxStreams = raw & 0x1f; + if (MaxStreams) { + uep->max_streams = 1 << MaxStreams; + } else { + uep->max_streams = 0; + } +} + +int usb_ep_get_max_streams(USBDevice *dev, int pid, int ep) +{ + struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); + return uep->max_streams; +} + void usb_ep_set_pipeline(USBDevice *dev, int pid, int ep, bool enabled) { struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); diff --git a/hw/usb/desc.c b/hw/usb/desc.c index bf6c522..5dbe754 100644 --- a/hw/usb/desc.c +++ b/hw/usb/desc.c @@ -385,6 +385,8 @@ static void usb_desc_ep_init(USBDevice *dev) usb_ep_set_ifnum(dev, pid, ep, iface->bInterfaceNumber); usb_ep_set_max_packet_size(dev, pid, ep, iface->eps[e].wMaxPacketSize); + usb_ep_set_max_streams(dev, pid, ep, + iface->eps[e].bmAttributes_super); } } } |