diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2012-01-12 14:26:13 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2012-02-10 12:16:18 +0100 |
commit | db4be873d312576c6971da15a38e056017a406b8 (patch) | |
tree | f542f1e79cf24e89eb0900facc3291d387f47f48 /hw/usb.h | |
parent | 079d0b7f1eedcc634c371fe05b617fdc55c8b762 (diff) | |
download | qemu-db4be873d312576c6971da15a38e056017a406b8.zip qemu-db4be873d312576c6971da15a38e056017a406b8.tar.gz qemu-db4be873d312576c6971da15a38e056017a406b8.tar.bz2 |
usb: maintain async packet list per endpoint
Maintain a list of async packets per endpoint. With the current code
the list will never receive more than a single item. I think you can
guess what the future plan is though ;)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb.h')
-rw-r--r-- | hw/usb.h | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -177,6 +177,7 @@ struct USBEndpoint { uint8_t ifnum; int max_packet_size; USBDevice *dev; + QTAILQ_HEAD(, USBPacket) queue; }; /* definition of a USB device */ @@ -309,15 +310,16 @@ struct USBPort { typedef void USBCallback(USBPacket * packet, void *opaque); -/* Structure used to hold information about an active USB packet. */ typedef enum USBPacketState { USB_PACKET_UNDEFINED = 0, USB_PACKET_SETUP, + USB_PACKET_QUEUED, USB_PACKET_ASYNC, USB_PACKET_COMPLETE, USB_PACKET_CANCELED, } USBPacketState; +/* Structure used to hold information about an active USB packet. */ struct USBPacket { /* Data fields for use by the driver. */ int pid; @@ -326,9 +328,11 @@ struct USBPacket { int result; /* transfer length or USB_RET_* status code */ /* Internal use by the USB layer. */ USBPacketState state; + QTAILQ_ENTRY(USBPacket) queue; }; void usb_packet_init(USBPacket *p); +void usb_packet_set_state(USBPacket *p, USBPacketState state); void usb_packet_setup(USBPacket *p, int pid, USBEndpoint *ep); void usb_packet_addbuf(USBPacket *p, void *ptr, size_t len); int usb_packet_map(USBPacket *p, QEMUSGList *sgl); @@ -339,7 +343,8 @@ void usb_packet_cleanup(USBPacket *p); static inline bool usb_packet_is_inflight(USBPacket *p) { - return p->state == USB_PACKET_ASYNC; + return (p->state == USB_PACKET_QUEUED || + p->state == USB_PACKET_ASYNC); } USBDevice *usb_find_device(USBPort *port, uint8_t addr); |