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