1 /******************************************************************************
4 * Unified block-device I/O interface for Xen guest OSes.
6 * Copyright (c) 2003-2004, Keir Fraser
9 #ifndef __SHARED_USBIF_H__
10 #define __SHARED_USBIF_H__
12 #define usbif_vdev_t u16
13 #define usbif_sector_t u64
15 #define USBIF_OP_IO 0 /* Request IO to a device */
16 #define USBIF_OP_PROBE 1 /* Is there a device on this port? */
17 #define USBIF_OP_RESET 2 /* Reset a virtual USB port. */
20 unsigned long id; /* private guest value, echoed in resp */
21 u8 operation; /* USBIF_OP_??? */
23 usbif_vdev_t port; /* guest virtual USB port */
24 unsigned long devnum :7; /* Device address, as seen by the guest.*/
25 unsigned long endpoint :4; /* Device endpoint. */
26 unsigned long direction :1; /* Pipe direction. */
27 unsigned long speed :1; /* Pipe speed. */
28 unsigned long pipe_type :2; /* Pipe type (iso, bulk, int, ctrl) */
29 unsigned long __pad2 :18;
30 unsigned long transfer_buffer; /* Machine address */
31 unsigned long length; /* Buffer length */
32 unsigned long transfer_flags; /* For now just pass Linux transfer
33 * flags - this may change. */
34 unsigned char setup[8]; /* Embed setup packets directly. */
35 unsigned long iso_schedule; /* Machine address of transfer sched (iso
37 unsigned long num_iso; /* length of iso schedule */
38 unsigned long timeout; /* timeout in ms */
41 /* Data we need to pass:
42 * - Transparently handle short packets or complain at us?
46 unsigned long id; /* copied from request */
47 u8 operation; /* copied from request */
48 u8 data; /* Small chunk of in-band data */
49 s16 status; /* USBIF_RSP_??? */
50 unsigned long transfer_mutex; /* Used for cancelling requests atomically. */
51 unsigned long length; /* How much data we really got */
54 #define USBIF_RSP_ERROR -1 /* non-specific 'error' */
55 #define USBIF_RSP_OKAY 0 /* non-specific 'okay' */
57 DEFINE_RING_TYPES(usbif, usbif_request_t, usbif_response_t);
60 unsigned long length; /* IN = expected, OUT = actual */
61 unsigned long buffer_offset; /* IN offset in buffer specified in main
63 unsigned long status; /* OUT Status for this packet. */
66 #endif /* __SHARED_USBIF_H__ */