version 4.2.0
[fx2fw-sdcc] / fx2 / usb_requests.h
1 /* -*- c++ -*- */\r
2 /*-----------------------------------------------------------------------------\r
3  * USB request definitions\r
4  *-----------------------------------------------------------------------------\r
5  * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2,\r
6  * Copyright 2003 Free Software Foundation, Inc.\r
7  *-----------------------------------------------------------------------------\r
8  * This code is part of usbjtag. usbjtag is free software; you can redistribute\r
9  * it and/or modify it under the terms of the GNU General Public License as\r
10  * published by the Free Software Foundation; either version 2 of the License,\r
11  * or (at your option) any later version. usbjtag is distributed in the hope\r
12  * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied\r
13  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.  You should have received a\r
15  * copy of the GNU General Public License along with this program in the file\r
16  * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin\r
17  * St, Fifth Floor, Boston, MA  02110-1301  USA\r
18  *-----------------------------------------------------------------------------\r
19  */\r
20 \r
21 // Standard USB requests.\r
22 // These are contained in end point 0 setup packets\r
23 \r
24 \r
25 #ifndef _USB_REQUESTS_H_\r
26 #define _USB_REQUESTS_H_\r
27 \r
28 // format of bmRequestType byte\r
29 \r
30 #define bmRT_DIR_MASK           (0x1 << 7)\r
31 #define bmRT_DIR_IN             (1 << 7)\r
32 #define bmRT_DIR_OUT            (0 << 7)\r
33 \r
34 #define bmRT_TYPE_MASK          (0x3 << 5)\r
35 #define bmRT_TYPE_STD           (0 << 5)\r
36 #define bmRT_TYPE_CLASS         (1 << 5)\r
37 #define bmRT_TYPE_VENDOR        (2 << 5)\r
38 #define bmRT_TYPE_RESERVED      (3 << 5)\r
39 \r
40 #define bmRT_RECIP_MASK         (0x1f << 0)\r
41 #define bmRT_RECIP_DEVICE       (0 << 0)\r
42 #define bmRT_RECIP_INTERFACE    (1 << 0)\r
43 #define bmRT_RECIP_ENDPOINT     (2 << 0)\r
44 #define bmRT_RECIP_OTHER        (3 << 0)\r
45 \r
46 \r
47 // standard request codes (bRequest)\r
48 \r
49 #define RQ_GET_STATUS           0\r
50 #define RQ_CLEAR_FEATURE        1\r
51 #define RQ_RESERVED_2           2\r
52 #define RQ_SET_FEATURE          3\r
53 #define RQ_RESERVED_4           4\r
54 #define RQ_SET_ADDRESS          5\r
55 #define RQ_GET_DESCR            6\r
56 #define RQ_SET_DESCR            7\r
57 #define RQ_GET_CONFIG           8\r
58 #define RQ_SET_CONFIG           9\r
59 #define RQ_GET_INTERFACE       10\r
60 #define RQ_SET_INTERFACE       11\r
61 #define RQ_SYNCH_FRAME         12\r
62 \r
63 // standard descriptor types\r
64 \r
65 #define DT_DEVICE               1\r
66 #define DT_CONFIG               2\r
67 #define DT_STRING               3\r
68 #define DT_INTERFACE            4\r
69 #define DT_ENDPOINT             5\r
70 #define DT_DEVQUAL              6\r
71 #define DT_OTHER_SPEED          7\r
72 #define DT_INTERFACE_POWER      8\r
73 \r
74 // standard feature selectors\r
75 \r
76 #define FS_ENDPOINT_HALT        0       // recip: endpoint\r
77 #define FS_DEV_REMOTE_WAKEUP    1       // recip: device\r
78 #define FS_TEST_MODE            2       // recip: device\r
79 \r
80 // Get Status device attributes\r
81 \r
82 #define bmGSDA_SELF_POWERED     0x01\r
83 #define bmGSDA_REM_WAKEUP       0x02\r
84 \r
85 \r
86 #endif /* _USB_REQUESTS_H_ */\r