unbreak allmodconfig KCONFIG_ALLCONFIG=...
[carl9170fw.git] / carlfw / include / usb_fifo.h
1 /*
2  * carl9170 firmware - used by the ar9170 wireless device
3  *
4  * USB definitions
5  *
6  * Copyright (c) 2000-2005 ZyDAS Technology Corporation
7  * Copyright (c) 2007-2009 Atheros Communications, Inc.
8  * Copyright    2009    Johannes Berg <johannes@sipsolutions.net>
9  * Copyright 2009-2011  Christian Lamparter <chunkeey@googlemail.com>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; If not, see <http://www.gnu.org/licenses/>.
23  */
24
25 #ifndef __CARL9170FW_USB_FIFO_H
26 #define __CARL9170FW_USB_FIFO_H
27
28 #include "config.h"
29
30 #define MASK_F0             0xf0
31
32 /* Block Size define */
33 #define BLK512BYTE      1
34 #define BLK1024BYTE     2
35
36 #define BLK64BYTE       1
37 #define BLK128BYTE      2
38
39 /* Block toggle number define */
40 #define SINGLE_BLK      1
41 #define DOUBLE_BLK      2
42 #define TRIBLE_BLK      3
43
44 /* Endpoint transfer type */
45 #define TF_TYPE_ISOCHRONOUS     1
46 #define TF_TYPE_BULK            2
47 #define TF_TYPE_INTERRUPT       3
48
49 /* Endpoint or FIFO direction define */
50 #define DIRECTION_IN    0
51 #define DIRECTION_OUT   1
52
53 #define HS_C1_I0_A0_EP1_MAX_PACKET              512
54 #define HS_C1_I0_A0_EP1_bInterval               0
55
56 #define HS_C1_I0_A0_EP_NUMBER                   0x04
57 #define HS_C1_I0_A0_EP_LENGTH                   (EP_LENGTH * HS_C1_I0_A0_EP_NUMBER)
58 #define HS_C1_I0_ALT_LENGTH                     (HS_C1_I0_A0_EP_LENGTH)
59 #define HS_C1_INTERFACE_LENGTH                  (HS_C1_I0_ALT_LENGTH)
60
61 #define HS_C1_CONFIG_TOTAL_LENGTH               (CONFIG_LENGTH + INTERFACE_LENGTH +  HS_C1_INTERFACE_LENGTH)
62 #define FS_C1_CONFIG_TOTAL_LENGTH               (CONFIG_LENGTH + INTERFACE_LENGTH +  FS_C1_INTERFACE_LENGTH)
63
64 #define FS_C1_I0_A0_EP1_MAX_PACKET              64
65 /* #define FS_C1_I0_A0_EP1_bInterval               HS_C1_I0_A0_EP1_bInterval */
66
67 #define HS_CONFIGURATION_NUMBER                 1
68 #define FS_CONFIGURATION_NUMBER                 1
69
70 #define fDOUBLE_BUF                             1
71 #define fDOUBLE_BUF_IN                          0
72
73 #define fFLASH_DISK                             0
74 #define fENABLE_ISO                             0
75
76 #define HS_C1_INTERFACE_NUMBER  0x01
77 #define HS_C1                   0x01
78 #define HS_C1_iConfiguration    0x00
79 #define HS_C1_bmAttribute       0x80
80
81 #define HS_C1_iMaxPower         0xFA
82
83 /* Interface 0 */
84 #define HS_C1_I0_ALT_NUMBER    0X01
85 /* AlternateSetting 0 */
86 #define HS_C1_I0_A0_bInterfaceNumber    0x00
87 #define HS_C1_I0_A0_bAlternateSetting   0x00
88 /* JWEI 2003/07/14 */
89 #define HS_C1_I0_A0_EP_NUMBER           0x04
90 #define HS_C1_I0_A0_bInterfaceClass     0xff
91 #define HS_C1_I0_A0_bInterfaceSubClass  0x00
92 #define HS_C1_I0_A0_bInterfaceProtocol  0x00
93 #define HS_C1_I0_A0_iInterface          0x00
94
95 /* EP 1 */
96 #define HS_C1_I0_A0_EP1_BLKSIZE    512
97 #define HS_C1_I0_A0_EP1_BLKNO      DOUBLE_BLK
98 #define HS_C1_I0_A0_EP1_DIRECTION  DIRECTION_OUT
99 #define HS_C1_I0_A0_EP1_TYPE       TF_TYPE_BULK
100
101 #define HS_C1_I0_A0_EP1_MAX_PACKET 512
102 #define HS_C1_I0_A0_EP1_bInterval  0
103
104 /* EP 2 */
105 #define HS_C1_I0_A0_EP2_BLKSIZE    512
106 /* JWEI 2003/08/20 */
107 #define HS_C1_I0_A0_EP2_BLKNO      SINGLE_BLK
108 #define HS_C1_I0_A0_EP2_DIRECTION  DIRECTION_IN
109 #define HS_C1_I0_A0_EP2_TYPE       TF_TYPE_BULK
110 #define HS_C1_I0_A0_EP2_MAX_PACKET 512
111 #define HS_C1_I0_A0_EP2_bInterval  0
112
113 /* EP 3 */
114 #define HS_C1_I0_A0_EP3_BLKSIZE    64
115 #define HS_C1_I0_A0_EP3_BLKNO      SINGLE_BLK
116 #define HS_C1_I0_A0_EP3_DIRECTION  DIRECTION_IN
117 #define HS_C1_I0_A0_EP3_TYPE       TF_TYPE_INTERRUPT
118 #define HS_C1_I0_A0_EP3_MAX_PACKET 0x0040
119 #define HS_C1_I0_A0_EP3_bInterval  01
120
121 /*
122  * Note: HS Bulk type require max pkt size = 512
123  *       ==> must use Interrupt type for max pkt size = 64
124  */
125
126 /* EP 4 */
127 #define HS_C1_I0_A0_EP4_BLKSIZE    64
128 #define HS_C1_I0_A0_EP4_BLKNO      SINGLE_BLK
129 #define HS_C1_I0_A0_EP4_DIRECTION  DIRECTION_OUT
130 #define HS_C1_I0_A0_EP4_TYPE       TF_TYPE_INTERRUPT
131 #define HS_C1_I0_A0_EP4_MAX_PACKET 0x0040
132 #define HS_C1_I0_A0_EP4_bInterval  01
133
134 #define HS_C1_I0_A0_EP_LENGTH           (EP_LENGTH * HS_C1_I0_A0_EP_NUMBER)
135 /* EP 1 */
136 #define HS_C1_I0_A0_EP1_FIFO_START  0
137 #define HS_C1_I0_A0_EP1_FIFO_NO     (HS_C1_I0_A0_EP1_BLKNO * HS_C1_I0_A0_EP1_BLKSIZE)
138 #define HS_C1_I0_A0_EP1_FIFO_CONFIG (uint8_t)(0x80 | ((HS_C1_I0_A0_EP1_BLKSIZE - 1) << 4) | ((HS_C1_I0_A0_EP1_BLKNO - 1) << 2) | HS_C1_I0_A0_EP1_TYPE)
139 #define HS_C1_I0_A0_EP1_FIFO_MAP    (((1 - HS_C1_I0_A0_EP1_DIRECTION) << 4) | 1)
140 #define HS_C1_I0_A0_EP1_MAP         (HS_C1_I0_A0_EP1_FIFO_START |   (HS_C1_I0_A0_EP1_FIFO_START << 4)   | (MASK_F0 >> (4*HS_C1_I0_A0_EP1_DIRECTION)))
141
142 /* EP 2 */
143 #define HS_C1_I0_A0_EP2_FIFO_START  (uint8_t)(HS_C1_I0_A0_EP1_FIFO_START + HS_C1_I0_A0_EP1_FIFO_NO)
144 #define HS_C1_I0_A0_EP2_FIFO_NO     (uint8_t)(HS_C1_I0_A0_EP2_BLKNO * HS_C1_I0_A0_EP2_BLKSIZE)
145 #define HS_C1_I0_A0_EP2_FIFO_CONFIG (uint8_t)(0x80 | ((HS_C1_I0_A0_EP2_BLKSIZE - 1) << 4) | ((HS_C1_I0_A0_EP2_BLKNO - 1) << 2) | HS_C1_I0_A0_EP2_TYPE)
146 #define HS_C1_I0_A0_EP2_FIFO_MAP    (uint8_t)(((1 - HS_C1_I0_A0_EP2_DIRECTION) << 4) | 2)
147 #define HS_C1_I0_A0_EP2_MAP         (uint8_t)(HS_C1_I0_A0_EP2_FIFO_START |   (HS_C1_I0_A0_EP2_FIFO_START << 4)   | (MASK_F0 >> (4*HS_C1_I0_A0_EP2_DIRECTION)))
148
149 /* EP 3 */
150 #define HS_C1_I0_A0_EP3_FIFO_START  14
151 #define HS_C1_I0_A0_EP3_FIFO_NO     (HS_C1_I0_A0_EP3_BLKNO * HS_C1_I0_A0_EP3_BLKSIZE)
152 #define HS_C1_I0_A0_EP3_FIFO_CONFIG (uint8_t)(0x80 | ((HS_C1_I0_A0_EP3_BLKSIZE - 1) << 4) | ((HS_C1_I0_A0_EP3_BLKNO - 1) << 2) | HS_C1_I0_A0_EP3_TYPE)
153 #define HS_C1_I0_A0_EP3_FIFO_MAP    (uint8_t)(((1 - HS_C1_I0_A0_EP3_DIRECTION) << 4) | 3)
154 #define HS_C1_I0_A0_EP3_MAP         (uint8_t)(HS_C1_I0_A0_EP3_FIFO_START |   (HS_C1_I0_A0_EP3_FIFO_START << 4)   | (MASK_F0 >> (4*HS_C1_I0_A0_EP3_DIRECTION)))
155
156 /* EP 4 */
157 #define HS_C1_I0_A0_EP4_FIFO_START  (HS_C1_I0_A0_EP3_FIFO_START + HS_C1_I0_A0_EP3_FIFO_NO)
158 #define HS_C1_I0_A0_EP4_FIFO_NO     (HS_C1_I0_A0_EP4_BLKNO * HS_C1_I0_A0_EP4_BLKSIZE)
159 #define HS_C1_I0_A0_EP4_FIFO_CONFIG (uint8_t)(0x80 | ((HS_C1_I0_A0_EP4_BLKSIZE - 1) << 4) | ((HS_C1_I0_A0_EP4_BLKNO - 1) << 2) | HS_C1_I0_A0_EP4_TYPE)
160 #define HS_C1_I0_A0_EP4_FIFO_MAP    (((1 - HS_C1_I0_A0_EP4_DIRECTION) << 4) | 4)
161 #define HS_C1_I0_A0_EP4_MAP         (uint8_t)(HS_C1_I0_A0_EP4_FIFO_START |   (HS_C1_I0_A0_EP4_FIFO_START << 4)   | (MASK_F0 >> (4*HS_C1_I0_A0_EP4_DIRECTION)))
162
163 /* Configuration 1 */
164 #define FS_C1_INTERFACE_NUMBER          0x01
165 #define FS_C1                           0x01
166 #define FS_C1_iConfiguration            0x00
167 #define FS_C1_bmAttribute               0x80
168 #define FS_C1_iMaxPower                 0xfa
169
170 /* Interface 0 */
171 #define FS_C1_I0_ALT_NUMBER             0x01
172 /* AlternateSetting 0x00 */
173 #define FS_C1_I0_A0_bInterfaceNumber    0x00
174 #define FS_C1_I0_A0_bAlternateSetting   0x00
175 #define FS_C1_I0_A0_EP_NUMBER           0x04
176 #define FS_C1_I0_A0_bInterfaceClass     0xff
177 #define FS_C1_I0_A0_bInterfaceSubClass  0x00
178 #define FS_C1_I0_A0_bInterfaceProtocol  0x00
179
180 /* EP 1 */
181 #define FS_C1_I0_A0_EP1_BLKSIZE    512
182 /* JWEI 2003/05/19 */
183 #define FS_C1_I0_A0_EP1_BLKNO      DOUBLE_BLK
184 #define FS_C1_I0_A0_EP1_DIRECTION  DIRECTION_OUT
185 #define FS_C1_I0_A0_EP1_TYPE       TF_TYPE_BULK
186 #define FS_C1_I0_A0_EP1_MAX_PACKET 64
187 #define FS_C1_I0_A0_EP1_bInterval  0
188
189 /* EP 2 */
190 #define FS_C1_I0_A0_EP2_BLKSIZE    512
191 /* JWEI 2003/08/20 */
192 #define FS_C1_I0_A0_EP2_BLKNO      SINGLE_BLK
193 #define FS_C1_I0_A0_EP2_DIRECTION  DIRECTION_IN
194 #define FS_C1_I0_A0_EP2_TYPE       TF_TYPE_BULK
195 #define FS_C1_I0_A0_EP2_MAX_PACKET 64
196 #define FS_C1_I0_A0_EP2_bInterval  0
197
198 /* EP 3 */
199 #define FS_C1_I0_A0_EP3_BLKSIZE    64
200 #define FS_C1_I0_A0_EP3_BLKNO      SINGLE_BLK
201 #define FS_C1_I0_A0_EP3_DIRECTION  DIRECTION_IN
202 #define FS_C1_I0_A0_EP3_TYPE       TF_TYPE_INTERRUPT
203 #define FS_C1_I0_A0_EP3_MAX_PACKET 0x0040
204 #define FS_C1_I0_A0_EP3_bInterval  1
205
206 /* EP 4 */
207 #define FS_C1_I0_A0_EP4_BLKSIZE    64
208 #define FS_C1_I0_A0_EP4_BLKNO      SINGLE_BLK
209 #define FS_C1_I0_A0_EP4_DIRECTION  DIRECTION_OUT
210 #define FS_C1_I0_A0_EP4_TYPE       TF_TYPE_BULK
211 #define FS_C1_I0_A0_EP4_MAX_PACKET 0x0040
212 #define FS_C1_I0_A0_EP4_bInterval  0
213
214 #define FS_C1_I0_A0_EP_LENGTH           (EP_LENGTH * FS_C1_I0_A0_EP_NUMBER)
215 /* EP 1 */
216 #define FS_C1_I0_A0_EP1_FIFO_START  0
217 #define FS_C1_I0_A0_EP1_FIFO_NO     (uint8_t)(FS_C1_I0_A0_EP1_BLKNO * FS_C1_I0_A0_EP1_BLKSIZE)
218 #define FS_C1_I0_A0_EP1_FIFO_CONFIG (uint8_t)(0x80 | ((FS_C1_I0_A0_EP1_BLKSIZE - 1) << 4) | ((FS_C1_I0_A0_EP1_BLKNO - 1) << 2) | FS_C1_I0_A0_EP1_TYPE)
219 #define FS_C1_I0_A0_EP1_FIFO_MAP    (uint8_t)(((1 - FS_C1_I0_A0_EP1_DIRECTION) << 4) | 1)
220 #define FS_C1_I0_A0_EP1_MAP         (uint8_t)(FS_C1_I0_A0_EP1_FIFO_START |   (FS_C1_I0_A0_EP1_FIFO_START << 4)   | (MASK_F0 >> (4*FS_C1_I0_A0_EP1_DIRECTION)))
221
222 /* EP 2 */
223 #define FS_C1_I0_A0_EP2_FIFO_START  (uint8_t)(FS_C1_I0_A0_EP1_FIFO_START + FS_C1_I0_A0_EP1_FIFO_NO)
224 #define FS_C1_I0_A0_EP2_FIFO_NO     (uint8_t)(FS_C1_I0_A0_EP2_BLKNO * FS_C1_I0_A0_EP2_BLKSIZE)
225 #define FS_C1_I0_A0_EP2_FIFO_CONFIG (uint8_t)(0x80 | ((FS_C1_I0_A0_EP2_BLKSIZE - 1) << 4) | ((FS_C1_I0_A0_EP2_BLKNO - 1) << 2) | FS_C1_I0_A0_EP2_TYPE)
226 #define FS_C1_I0_A0_EP2_FIFO_MAP    (uint8_t)(((1 - FS_C1_I0_A0_EP2_DIRECTION) << 4) | 2)
227 #define FS_C1_I0_A0_EP2_MAP         (uint8_t)(FS_C1_I0_A0_EP2_FIFO_START |   (FS_C1_I0_A0_EP2_FIFO_START << 4)   | (MASK_F0 >> (4*FS_C1_I0_A0_EP2_DIRECTION)))
228
229 /* EP 3 */
230 #define FS_C1_I0_A0_EP3_FIFO_START  14
231 #define FS_C1_I0_A0_EP3_FIFO_NO     (uint8_t)(FS_C1_I0_A0_EP3_BLKNO * FS_C1_I0_A0_EP3_BLKSIZE)
232 #define FS_C1_I0_A0_EP3_FIFO_CONFIG (uint8_t)(0x80 | ((FS_C1_I0_A0_EP3_BLKSIZE - 1) << 4) | ((FS_C1_I0_A0_EP3_BLKNO - 1) << 2) | FS_C1_I0_A0_EP3_TYPE)
233 #define FS_C1_I0_A0_EP3_FIFO_MAP    (uint8_t)(((1 - FS_C1_I0_A0_EP3_DIRECTION) << 4) | 3)
234 #define FS_C1_I0_A0_EP3_MAP         (uint8_t)(FS_C1_I0_A0_EP3_FIFO_START |   (FS_C1_I0_A0_EP3_FIFO_START << 4)   | (MASK_F0 >> (4*FS_C1_I0_A0_EP3_DIRECTION)))
235
236 /* EP 4 */
237 #define FS_C1_I0_A0_EP4_FIFO_START  (uint8_t)(FS_C1_I0_A0_EP3_FIFO_START + FS_C1_I0_A0_EP3_FIFO_NO)
238 #define FS_C1_I0_A0_EP4_FIFO_NO     (uint8_t)(FS_C1_I0_A0_EP4_BLKNO * FS_C1_I0_A0_EP4_BLKSIZE)
239 #define FS_C1_I0_A0_EP4_FIFO_CONFIG (uint8_t)(0x80 | ((FS_C1_I0_A0_EP4_BLKSIZE - 1) << 4) | ((FS_C1_I0_A0_EP4_BLKNO - 1) << 2) | FS_C1_I0_A0_EP4_TYPE)
240 #define FS_C1_I0_A0_EP4_FIFO_MAP    (uint8_t)(((1 - FS_C1_I0_A0_EP4_DIRECTION) << 4) | 4)
241 #define FS_C1_I0_A0_EP4_MAP         (uint8_t)(FS_C1_I0_A0_EP4_FIFO_START |   (FS_C1_I0_A0_EP4_FIFO_START << 4)   | (MASK_F0 >> (4*FS_C1_I0_A0_EP4_DIRECTION)))
242
243 #endif /* __CARL9170FW_USB_FIFO_H */