cbd0f3a720d2c7ab021bb5d9eb7c9c7a5d2f9e27
[fw/altos] / ao_usb.h
1 /*
2  * Copyright © 2009 Keith Packard <keithp@keithp.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
16  */
17
18 #ifndef _AO_USB_H_
19 #define _AO_USB_H_
20
21 #define AO_USB_DIR_OUT                  0
22 #define AO_USB_DIR_IN                   1
23
24 #define AO_USB_TYPE_STANDARD            0
25 #define AO_USB_TYPE_CLASS               1
26 #define AO_USB_TYPE_VENDOR              2
27 #define AO_USB_TYPE_RESERVED            3
28
29 #define AO_USB_RECIP_DEVICE             0
30 #define AO_USB_RECIP_INTERFACE          1
31 #define AO_USB_RECIP_ENDPOINT           2
32 #define AO_USB_RECIP_OTHER              3
33
34 /* standard requests */
35 #define AO_USB_REQ_GET_STATUS           0x00
36 #define AO_USB_REQ_CLEAR_FEATURE        0x01
37 #define AO_USB_REQ_SET_FEATURE          0x03
38 #define AO_USB_REQ_SET_ADDRESS          0x05
39 #define AO_USB_REQ_GET_DESCRIPTOR       0x06
40 #define AO_USB_REQ_SET_DESCRIPTOR       0x07
41 #define AO_USB_REQ_GET_CONFIGURATION    0x08
42 #define AO_USB_REQ_SET_CONFIGURATION    0x09
43 #define AO_USB_REQ_GET_INTERFACE        0x0A
44 #define AO_USB_REQ_SET_INTERFACE        0x0B
45 #define AO_USB_REQ_SYNCH_FRAME          0x0C
46
47 #define AO_USB_DESC_DEVICE              1
48 #define AO_USB_DESC_CONFIGURATION       2
49 #define AO_USB_DESC_STRING              3
50 #define AO_USB_DESC_INTERFACE           4
51 #define AO_USB_DESC_ENDPOINT            5
52 #define AO_USB_DESC_DEVICE_QUALIFIER    6
53 #define AO_USB_DESC_OTHER_SPEED         7
54 #define AO_USB_DESC_INTERFACE_POWER     8
55
56 #define AO_USB_GET_DESC_TYPE(x)         (((x)>>8)&0xFF)
57 #define AO_USB_GET_DESC_INDEX(x)        ((x)&0xFF)
58
59 #endif /* _AO_USB_H_ */