aboutsummaryrefslogtreecommitdiff
path: root/hw/usb.h
diff options
context:
space:
mode:
Diffstat (limited to 'hw/usb.h')
-rw-r--r--hw/usb.h35
1 files changed, 33 insertions, 2 deletions
diff --git a/hw/usb.h b/hw/usb.h
index 4a009a5848..55b7e5850a 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -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];