diff options
author | Gerd Hoffmann | 2011-08-29 12:49:46 +0200 |
---|---|---|
committer | Gerd Hoffmann | 2012-01-17 09:44:50 +0100 |
commit | d8e17efdecaaa1a2d5c8f422fc44ae229e7f4fb4 (patch) | |
tree | 367a6b5453fc02d0b9b2b33d1a6da607fe1d83a4 /hw/usb.h | |
parent | xhci: Initial xHCI implementation (diff) | |
download | qemu-d8e17efdecaaa1a2d5c8f422fc44ae229e7f4fb4.tar.gz qemu-d8e17efdecaaa1a2d5c8f422fc44ae229e7f4fb4.tar.xz qemu-d8e17efdecaaa1a2d5c8f422fc44ae229e7f4fb4.zip |
usb: add USBEndpoint
Start maintaining endpoint state at USBDevice level. Add USBEndpoint
struct and some helper functions to deal with it. For now it contains
the endpoint type only. Moved over some bits from usb-linux.c
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb.h')
-rw-r--r-- | hw/usb.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -144,6 +144,7 @@ #define USB_ENDPOINT_XFER_ISOC 1 #define USB_ENDPOINT_XFER_BULK 2 #define USB_ENDPOINT_XFER_INT 3 +#define USB_ENDPOINT_XFER_INVALID 255 typedef struct USBBus USBBus; typedef struct USBBusOps USBBusOps; @@ -151,6 +152,7 @@ typedef struct USBPort USBPort; typedef struct USBDevice USBDevice; typedef struct USBDeviceInfo USBDeviceInfo; typedef struct USBPacket USBPacket; +typedef struct USBEndpoint USBEndpoint; typedef struct USBDesc USBDesc; typedef struct USBDescID USBDescID; @@ -171,6 +173,10 @@ struct USBDescString { #define USB_MAX_ENDPOINTS 15 #define USB_MAX_INTERFACES 16 +struct USBEndpoint { + uint8_t type; +}; + /* definition of a USB device */ struct USBDevice { DeviceState qdev; @@ -196,6 +202,9 @@ struct USBDevice { int32_t setup_len; int32_t setup_index; + USBEndpoint ep_in[USB_MAX_ENDPOINTS]; + USBEndpoint ep_out[USB_MAX_ENDPOINTS]; + QLIST_HEAD(, USBDescString) strings; const USBDescDevice *device; @@ -322,6 +331,11 @@ int usb_handle_packet(USBDevice *dev, USBPacket *p); void usb_packet_complete(USBDevice *dev, USBPacket *p); void usb_cancel_packet(USBPacket * p); +void usb_ep_init(USBDevice *dev); +struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep); +uint8_t usb_ep_get_type(USBDevice *dev, int pid, int ep); +void usb_ep_set_type(USBDevice *dev, int pid, int ep, uint8_t type); + void usb_attach(USBPort *port); void usb_detach(USBPort *port); void usb_reset(USBPort *port); |