Fix usbdebug compilation.
[coreboot.git] / src / include / usb_ch9.h
1 #ifndef USB_CH9_H
2 #define USB_CH9_H
3
4 #define USB_DIR_OUT                     0               /* to device */
5 #define USB_DIR_IN                      0x80            /* to host */
6
7 /*
8  * USB types, the second of three bRequestType fields
9  */
10 #define USB_TYPE_MASK                   (0x03 << 5)
11 #define USB_TYPE_STANDARD               (0x00 << 5)
12 #define USB_TYPE_CLASS                  (0x01 << 5)
13 #define USB_TYPE_VENDOR                 (0x02 << 5)
14 #define USB_TYPE_RESERVED               (0x03 << 5)
15 /*
16  * USB recipients, the third of three bRequestType fields
17  */
18 #define USB_RECIP_MASK                  0x1f
19 #define USB_RECIP_DEVICE                0x00
20 #define USB_RECIP_INTERFACE             0x01
21 #define USB_RECIP_ENDPOINT              0x02
22 #define USB_RECIP_OTHER                 0x03
23 /* From Wireless USB 1.0 */
24 #define USB_RECIP_PORT                  0x04
25 #define USB_RECIP_RPIPE                 0x05
26
27 /*
28  * Standard requests, for the bRequest field of a SETUP packet.
29  *
30  * These are qualified by the bRequestType field, so that for example
31  * TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved
32  * by a GET_STATUS request.
33  */
34 #define USB_REQ_GET_STATUS              0x00
35 #define USB_REQ_CLEAR_FEATURE           0x01
36 #define USB_REQ_SET_FEATURE             0x03
37 #define USB_REQ_SET_ADDRESS             0x05
38 #define USB_REQ_GET_DESCRIPTOR          0x06
39 #define USB_REQ_SET_DESCRIPTOR          0x07
40 #define USB_REQ_GET_CONFIGURATION       0x08
41 #define USB_REQ_SET_CONFIGURATION       0x09
42 #define USB_REQ_GET_INTERFACE           0x0A
43 #define USB_REQ_SET_INTERFACE           0x0B
44 #define USB_REQ_SYNCH_FRAME             0x0C
45
46 #define USB_REQ_SET_ENCRYPTION          0x0D    /* Wireless USB */
47 #define USB_REQ_GET_ENCRYPTION          0x0E
48 #define USB_REQ_RPIPE_ABORT             0x0E
49 #define USB_REQ_SET_HANDSHAKE           0x0F
50 #define USB_REQ_RPIPE_RESET             0x0F
51 #define USB_REQ_GET_HANDSHAKE           0x10
52 #define USB_REQ_SET_CONNECTION          0x11
53 #define USB_REQ_SET_SECURITY_DATA       0x12
54 #define USB_REQ_GET_SECURITY_DATA       0x13
55 #define USB_REQ_SET_WUSB_DATA           0x14
56 #define USB_REQ_LOOPBACK_DATA_WRITE     0x15
57 #define USB_REQ_LOOPBACK_DATA_READ      0x16
58 #define USB_REQ_SET_INTERFACE_DS        0x17
59
60 #define USB_DT_DEBUG                    0x0a
61
62 #define USB_DEVICE_DEBUG_MODE           6       /* (special devices only) */
63
64 struct usb_ctrlrequest {
65         u8  bRequestType;
66         u8  bRequest;
67         u16 wValue;
68         u16 wIndex;
69         u16 wLength;
70 } __attribute__ ((packed));
71
72 struct usb_debug_descriptor {
73         u8  bLength;
74         u8  bDescriptorType;
75
76         /* bulk endpoints with 8 byte maxpacket */
77         u8  bDebugInEndpoint;
78         u8  bDebugOutEndpoint;
79 };
80
81 #endif
82