2 * Copyright © 2009 Keith Packard <keithp@keithp.com>
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.
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.
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.
21 #define AO_USB_SETUP_DIR_MASK (0x01 << 7)
22 #define AO_USB_SETUP_TYPE_MASK (0x03 << 5)
23 #define AO_USB_SETUP_RECIP_MASK (0x1f)
25 #define AO_USB_DIR_OUT 0
26 #define AO_USB_DIR_IN (1 << 7)
28 #define AO_USB_TYPE_STANDARD 0
29 #define AO_USB_TYPE_CLASS (1 << 5)
30 #define AO_USB_TYPE_VENDOR (2 << 5)
31 #define AO_USB_TYPE_RESERVED (3 << 5)
33 #define AO_USB_RECIP_DEVICE 0
34 #define AO_USB_RECIP_INTERFACE 1
35 #define AO_USB_RECIP_ENDPOINT 2
36 #define AO_USB_RECIP_OTHER 3
38 /* standard requests */
39 #define AO_USB_REQ_GET_STATUS 0x00
40 #define AO_USB_REQ_CLEAR_FEATURE 0x01
41 #define AO_USB_REQ_SET_FEATURE 0x03
42 #define AO_USB_REQ_SET_ADDRESS 0x05
43 #define AO_USB_REQ_GET_DESCRIPTOR 0x06
44 #define AO_USB_REQ_SET_DESCRIPTOR 0x07
45 #define AO_USB_REQ_GET_CONFIGURATION 0x08
46 #define AO_USB_REQ_SET_CONFIGURATION 0x09
47 #define AO_USB_REQ_GET_INTERFACE 0x0A
48 #define AO_USB_REQ_SET_INTERFACE 0x0B
49 #define AO_USB_REQ_SYNCH_FRAME 0x0C
51 #define AO_USB_DESC_DEVICE 1
52 #define AO_USB_DESC_CONFIGURATION 2
53 #define AO_USB_DESC_STRING 3
54 #define AO_USB_DESC_INTERFACE 4
55 #define AO_USB_DESC_ENDPOINT 5
56 #define AO_USB_DESC_DEVICE_QUALIFIER 6
57 #define AO_USB_DESC_OTHER_SPEED 7
58 #define AO_USB_DESC_INTERFACE_POWER 8
60 #define AO_USB_GET_DESC_TYPE(x) (((x)>>8)&0xFF)
61 #define AO_USB_GET_DESC_INDEX(x) ((x)&0xFF)
63 #define AO_USB_CONTROL_EP 0
64 #define AO_USB_INT_EP 1
65 #define AO_USB_OUT_EP 4
66 #define AO_USB_IN_EP 5
67 #define AO_USB_CONTROL_SIZE 32
69 * Double buffer IN and OUT EPs, so each
70 * gets half of the available space
72 * Ah, but USB bulk packets can only come in 8, 16, 32 and 64
73 * byte sizes, so we'll use 64 for everything
75 #define AO_USB_IN_SIZE 64
76 #define AO_USB_OUT_SIZE 64
78 #define AO_USB_EP0_IDLE 0
79 #define AO_USB_EP0_DATA_IN 1
80 #define AO_USB_EP0_DATA_OUT 2
82 #define LE_WORD(x) ((x)&0xFF),((uint8_t) (((uint16_t) (x))>>8))
85 #define CS_INTERFACE 0x24
86 #define CS_ENDPOINT 0x25
88 #define SET_LINE_CODING 0x20
89 #define GET_LINE_CODING 0x21
90 #define SET_CONTROL_LINE_STATE 0x22
92 /* Data structure for GET_LINE_CODING / SET_LINE_CODING class requests */
93 struct ao_usb_line_coding {
100 #endif /* _AO_USB_H_ */