mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
usb: generic packet handler cleanup and documentation (Max Krasnyansky)
A bit better documentation of the USB device API, namely return codes. Rewrite of usb_generic_handle_packet() to make it more reable and easier to follow. Signed-off-by: Max Krasnyansky <maxk@kernel.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5049 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
4b096fc9ec
commit
89b9b79f34
2 changed files with 183 additions and 125 deletions
35
hw/usb.h
35
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];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue