diff options
Diffstat (limited to 'hw/usb.h')
-rw-r--r-- | hw/usb.h | 35 |
1 files changed, 33 insertions, 2 deletions
@@ -120,18 +120,49 @@ typedef struct USBPacket USBPacket; /* definition of a USB device */ struct USBDevice { void *opaque; + + /* + * Process USB packet. + * Called by the HC (Host Controller). + * + * Returns length of the transaction + * or one of the USB_RET_XXX codes. + */ int (*handle_packet)(USBDevice *dev, USBPacket *p); + + /* + * Called when device is destroyed. + */ void (*handle_destroy)(USBDevice *dev); int speed; /* The following fields are used by the generic USB device - layer. They are here just to avoid creating a new structure for - them. */ + layer. They are here just to avoid creating a new structure + for them. */ + + /* + * Reset the device + */ void (*handle_reset)(USBDevice *dev); + + /* + * Process control request. + * Called from handle_packet(). + * + * Returns length or one of the USB_RET_ codes. + */ int (*handle_control)(USBDevice *dev, int request, int value, int index, int length, uint8_t *data); + + /* + * Process data transfers (both BULK and ISOC). + * Called from handle_packet(). + * + * Returns length or one of the USB_RET_ codes. + */ int (*handle_data)(USBDevice *dev, USBPacket *p); + uint8_t addr; char devname[32]; |