debuggers.hg

view xen/include/public/io/usbif.h @ 3692:03c49d1bcd6b

bitkeeper revision 1.1159.243.1 (42042ba8OAh4EZUckgdGWWSqRLutaQ)

Various cleanups, including a move to the new ring macros.
author mwilli2@equilibrium.research
date Sat Feb 05 02:12:56 2005 +0000 (2005-02-05)
parents d295396360fb
children 924777207448
line source
1 /******************************************************************************
2 * usbif.h
3 *
4 * Unified block-device I/O interface for Xen guest OSes.
5 *
6 * Copyright (c) 2003-2004, Keir Fraser
7 */
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. */
19 typedef struct {
20 unsigned long id; /* 0: private guest value, echoed in resp */
21 u8 operation; /* 4: USBIF_OP_??? */
22 u8 __pad1;
23 usbif_vdev_t port; /* 6 : guest virtual USB port */
24 unsigned long devnum :7; /* 8 : 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; /* 12: Machine address */
31 unsigned long length; /* 16: Buffer length */
32 unsigned long transfer_flags; /* 20: For now just pass Linux transfer
33 * flags - this may change. */
34 unsigned char setup[8]; /* 22 Embed setup packets directly. */
35 unsigned long iso_schedule; /* 30 Machine address of transfer sched (iso
36 * only) */
37 unsigned long num_iso; /* 34 : length of iso schedule */
38 unsigned long timeout; /* 38: timeout in ms */
39 } PACKED usbif_request_t; /* 42 */
41 /* Data we need to pass:
42 * - Transparently handle short packets or complain at us?
43 */
45 typedef struct {
46 unsigned long id; /* 0: copied from request */
47 u8 operation; /* 4: copied from request */
48 u8 data; /* 5: Small chunk of in-band data */
49 s16 status; /* 6: USBIF_RSP_??? */
50 unsigned long transfer_mutex; /* Used for cancelling requests atomically. */
51 unsigned long length; /* 8: How much data we really got */
52 } PACKED usbif_response_t;
54 #define USBIF_RSP_ERROR -1 /* non-specific 'error' */
55 #define USBIF_RSP_OKAY 0 /* non-specific 'okay' */
57 #define USBIF_RING RING_PARAMS(usbif_request_t, usbif_response_t, PAGE_SIZE)
58 DEFINE_RING_TYPES(usbif, USBIF_RING);
60 typedef struct {
61 unsigned long length; /* IN = expected, OUT = actual */
62 unsigned long buffer_offset; /* IN offset in buffer specified in main
63 packet */
64 unsigned long status; /* OUT Status for this packet. */
65 } usbif_iso_t;
67 #endif /* __SHARED_USBIF_H__ */