3 ;;;-----------------------------------------------------------------------------
\r
4 ;;; USB Descriptor(s)
\r
5 ;;;-----------------------------------------------------------------------------
\r
6 ;;; Copyright 2005..2007 Kolja Waschk, ixo.de
\r
7 ;;; Modified by LAP for FPGA4U project, Jan 2007. lap.epfl.ch
\r
8 ;;;-----------------------------------------------------------------------------
\r
9 ;;; Code based on USRP2 firmware (GNU Radio Project), version 3.0.2,
\r
10 ;;; Copyright 2003 Free Software Foundation, Inc.
\r
11 ;;;-----------------------------------------------------------------------------
\r
12 ;;; This code is part of usbjtag. usbjtag is free software; you can redistribute
\r
13 ;;; it and/or modify it under the terms of the GNU General Public License as
\r
14 ;;; published by the Free Software Foundation; either version 2 of the License,
\r
15 ;;; or (at your option) any later version. usbjtag is distributed in the hope
\r
16 ;;; that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
\r
17 ;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
18 ;;; GNU General Public License for more details. You should have received a
\r
19 ;;; copy of the GNU General Public License along with this program in the file
\r
20 ;;; COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin
\r
21 ;;; St, Fifth Floor, Boston, MA 02110-1301 USA
\r
22 ;;;-----------------------------------------------------------------------------
\r
24 .module usb_descriptors
\r
26 VID = 0x09FB ; Changed by LAP to match Altera VID
\r
27 PID = 0x6001 ; Changed by LAP to match Altera USBBlaster PID
\r
28 VERSION = 0x0400 ; Product Version (4 indicates *BM device)
\r
29 USB_VER = 0x0110 ; Support USB version 1.10
\r
30 USB_ATTR = 0x80 ; Bus powered, not self-powered, no remote wakeup
\r
31 FTD_ATTR = 0x001C ; Set USB version, use version string, enable suspend PD
\r
32 MAX_POWER = 250 ; need 2*250 mA max
\r
34 DSCR_DEVICE = 1 ; Descriptor type: Device
\r
35 DSCR_CONFIG = 2 ; Descriptor type: Configuration
\r
36 DSCR_STRING = 3 ; Descriptor type: String
\r
37 DSCR_INTRFC = 4 ; Descriptor type: Interface
\r
38 DSCR_ENDPNT = 5 ; Descriptor type: Endpoint
\r
39 DSCR_DEVQUAL = 6 ; Descriptor type: Device Qualifier
\r
41 DSCR_DEVICE_LEN = 18
\r
45 DSCR_DEVQUAL_LEN = 10
\r
47 ET_CONTROL = 0 ; Endpoint type: Control
\r
48 ET_ISO = 1 ; Endpoint type: Isochronous
\r
49 ET_BULK = 2 ; Endpoint type: Bulk
\r
50 ET_INT = 3 ; Endpoint type: Interrupt
\r
52 ;;; --------------------------------------------------------
\r
53 ;;; external ram data
\r
54 ;;;--------------------------------------------------------
\r
56 .area USBDESCSEG (XDATA)
\r
58 ;;; ----------------------------------------------------------------
\r
59 ;;; descriptors used when operating at high speed (480Mb/sec)
\r
60 ;;; ----------------------------------------------------------------
\r
62 .even ; descriptors must be 2-byte aligned for SUDPTR{H,L} to work
\r
64 ;; The .even directive isn't really honored by the linker. Bummer!
\r
65 ;; (There's no way to specify an alignment requirement for a given area,
\r
66 ;; hence when they're concatenated together, even doesn't work.)
\r
68 ;; We work around this by telling the linker to put USBDESCSEG
\r
69 ;; at 0xE000 absolute. This means that the maximimum length of this
\r
70 ;; segment is 480 bytes, leaving room for the two hash slots
\r
71 ;; at 0xE1EO to 0xE1FF.
\r
72 ;; Note from LAP: TODOOOOO
\r
74 _high_speed_device_descr::
\r
78 .db <USB_VER ; Specification version (LSB)
\r
79 .db >USB_VER ; Specification version (MSB)
\r
80 .db 0xFF ; device class (vendor specific) 0xFF
\r
81 .db 0x00 ; device subclass (vendor specific)
\r
82 .db 0x00 ; device protocol (vendor specific)
\r
83 .db 64 ; bMaxPacketSize0 for endpoint 0
\r
87 .db <PID ; idProduct
\r
88 .db >PID ; idProduct
\r
89 .db <VERSION ; bcdDevice
\r
90 .db >VERSION ; bcdDevice
\r
92 .db SI_VENDOR ; iManufacturer (string index)
\r
93 .db SI_PRODUCT ; iProduct (string index)
\r
94 .db SI_SERIAL ; iSerial number (string index)
\r
95 .db 1 ; bNumConfigurations
\r
98 _high_speed_devqual_descr::
\r
99 .db DSCR_DEVQUAL_LEN
\r
101 .db <USB_VER ; bcdUSB (LSB)
\r
102 .db >USB_VER ; bcdUSB (MSB)
\r
103 .db 0xFF ; bDeviceClass
\r
104 .db 0xFF ; bDeviceSubClass
\r
105 .db 0xFF ; bDeviceProtocol
\r
106 .db 64 ; bMaxPacketSize0
\r
107 .db 1 ; bNumConfigurations (one config at 12Mb/sec)
\r
111 _high_speed_config_descr::
\r
112 .db DSCR_CONFIG_LEN
\r
114 .db <(_high_speed_config_descr_end - _high_speed_config_descr) ; LSB
\r
115 .db >(_high_speed_config_descr_end - _high_speed_config_descr) ; MSB
\r
116 .db 2 ; bNumInterfaces
\r
117 .db 1 ; bConfigurationValue
\r
118 .db 0 ; iConfiguration
\r
120 .db USB_ATTR ; bmAttributes
\r
121 .db MAX_POWER ; bMaxPower [Unit: 0.5 mA]
\r
123 ;; interface descriptor
\r
125 .db DSCR_INTRFC_LEN
\r
127 .db 0 ; bInterfaceNumber (zero based)
\r
128 .db 0 ; bAlternateSetting
\r
129 .db 2 ; bNumEndpoints
\r
130 .db 0xFF ; bInterfaceClass (vendor specific)
\r
131 .db 0xFF ; bInterfaceSubClass (vendor specific)
\r
132 .db 0xFF ; bInterfaceProtocol (vendor specific)
\r
133 .db SI_PRODUCT ; iInterface (description)
\r
135 ;; endpoint descriptor
\r
137 .db DSCR_ENDPNT_LEN
\r
139 .db 0x81 ; bEndpointAddress (ep 1 IN)
\r
140 .db ET_BULK ; bmAttributes
\r
141 .db <64 ; wMaxPacketSize (LSB)
\r
142 .db >64 ; wMaxPacketSize (MSB)
\r
143 .db 0 ; bInterval (iso only)
\r
145 ;; endpoint descriptor
\r
147 .db DSCR_ENDPNT_LEN
\r
149 .db 0x02 ; bEndpointAddress (ep 2 OUT)
\r
150 .db ET_BULK ; bmAttributes
\r
151 .db <64 ; wMaxPacketSize (LSB)
\r
152 .db >64 ; wMaxPacketSize (MSB)
\r
153 .db 0 ; bInterval (iso only)
\r
155 ;; interface descriptor
\r
157 .db DSCR_INTRFC_LEN
\r
159 .db 1 ; bInterfaceNumber (zero based)
\r
160 .db 0 ; bAlternateSetting
\r
161 .db 2 ; bNumEndpoints
\r
162 .db 0xFF ; bInterfaceClass (vendor specific)
\r
163 .db 0xFF ; bInterfaceSubClass (vendor specific)
\r
164 .db 0xFF ; bInterfaceProtocol (vendor specific)
\r
165 .db SI_PRODUCT ; iInterface (description)
\r
167 ;; Endpoint Descriptor 2
\r
169 .db DSCR_ENDPNT_LEN ; Descriptor length
\r
170 .db DSCR_ENDPNT ; Descriptor type
\r
171 .db 0x06 ; Endpoint number and direction
\r
172 .db ET_BULK ; Endpoint type
\r
173 .db 0x00 ; Maximum packet size (LSB)
\r
174 .db 0x02 ; Max packect size (MSB)
\r
175 .db 0x00 ; Polling interval
\r
177 ;; Endpoint Descriptor 2
\r
178 .db DSCR_ENDPNT_LEN ; Descriptor length
\r
179 .db DSCR_ENDPNT ; Descriptor type
\r
180 .db 0x88 ; Endpoint number, and direction
\r
181 .db ET_BULK ; Endpoint type
\r
182 .db 0x00 ; Maximum packet size (LSB)
\r
183 .db 0x02 ; Max packect size (MSB)
\r
184 .db 0x00 ; Polling interval
\r
186 _high_speed_config_descr_end:
\r
188 ;;; ----------------------------------------------------------------
\r
189 ;;; descriptors used when operating at full speed (12Mb/sec)
\r
190 ;;; ----------------------------------------------------------------
\r
193 _full_speed_device_descr::
\r
194 .db DSCR_DEVICE_LEN
\r
196 .db <USB_VER ; Specification version (LSB)
\r
197 .db >USB_VER ; Specification version (MSB)
\r
198 .db 0x00 ; device class (vendor specific)
\r
199 .db 0x00 ; device subclass (vendor specific)
\r
200 .db 0x00 ; device protocol (vendor specific)
\r
201 .db 64 ; bMaxPacketSize0 for endpoint 0
\r
202 .db <VID ; idVendor
\r
203 .db >VID ; idVendor
\r
204 .db <PID ; idProduct
\r
205 .db >PID ; idProduct
\r
206 .db <VERSION ; bcdDevice
\r
207 .db >VERSION ; bcdDevice
\r
208 .db SI_VENDOR ; iManufacturer (string index)
\r
209 .db SI_PRODUCT ; iProduct (string index)
\r
210 .db SI_SERIAL ; iSerial number (None)
\r
211 .db 1 ; bNumConfigurations
\r
213 ;;; describes the other speed (480Mb/sec)
\r
215 _full_speed_devqual_descr::
\r
216 .db DSCR_DEVQUAL_LEN
\r
218 .db <USB_VER ; bcdUSB
\r
219 .db >USB_VER ; bcdUSB
\r
220 .db 0xFF ; bDeviceClass
\r
221 .db 0xFF ; bDeviceSubClass
\r
222 .db 0xFF ; bDeviceProtocol
\r
223 .db 64 ; bMaxPacketSize0
\r
224 .db 1 ; bNumConfigurations (one config at 480Mb/sec)
\r
228 _full_speed_config_descr::
\r
229 .db DSCR_CONFIG_LEN
\r
231 .db <(_full_speed_config_descr_end - _full_speed_config_descr) ; LSB
\r
232 .db >(_full_speed_config_descr_end - _full_speed_config_descr) ; MSB
\r
233 .db 2 ; bNumInterfaces
\r
234 .db 1 ; bConfigurationValue
\r
235 .db 0 ; iConfiguration
\r
236 .db USB_ATTR ; bmAttributes
\r
237 .db MAX_POWER ; bMaxPower [Unit: 0.5 mA]
\r
239 ;; interface descriptor
\r
241 .db DSCR_INTRFC_LEN
\r
243 .db 0 ; bInterfaceNumber (zero based)
\r
244 .db 0 ; bAlternateSetting
\r
245 .db 2 ; bNumEndpoints
\r
246 .db 0xFF ; bInterfaceClass (vendor specific)
\r
247 .db 0xFF ; bInterfaceSubClass (vendor specific)
\r
248 .db 0xFF ; bInterfaceProtocol (vendor specific)
\r
249 .db SI_PRODUCT ; iInterface (description)
\r
251 ;; endpoint descriptor
\r
253 .db DSCR_ENDPNT_LEN
\r
255 .db 0x81 ; bEndpointAddress (ep 1 IN)
\r
256 .db ET_BULK ; bmAttributes
\r
257 .db <64 ; wMaxPacketSize (LSB)
\r
258 .db >64 ; wMaxPacketSize (MSB)
\r
259 .db 0 ; bInterval (iso only)
\r
261 ;; endpoint descriptor
\r
263 .db DSCR_ENDPNT_LEN
\r
265 .db 0x02 ; bEndpointAddress (ep 2 OUT)
\r
266 .db ET_BULK ; bmAttributes
\r
267 .db <64 ; wMaxPacketSize (LSB)
\r
268 .db >64 ; wMaxPacketSize (MSB)
\r
269 .db 0 ; bInterval (iso only)
\r
271 ;; interface descriptor
\r
273 .db DSCR_INTRFC_LEN
\r
275 .db 1 ; bInterfaceNumber (zero based)
\r
276 .db 0 ; bAlternateSetting
\r
277 .db 2 ; bNumEndpoints
\r
278 .db 0xFF ; bInterfaceClass (vendor specific)
\r
279 .db 0xFF ; bInterfaceSubClass (vendor specific)
\r
280 .db 0xFF ; bInterfaceProtocol (vendor specific)
\r
281 .db SI_PRODUCT ; iInterface (description)
\r
283 ;; endpoint descriptor
\r
285 .db DSCR_ENDPNT_LEN
\r
287 .db 0x06 ; bEndpointAddress (ep 6 OUT)
\r
288 .db ET_BULK ; bmAttributes
\r
289 .db 0x40 ; wMaxPacketSize (LSB)
\r
290 .db 0x00 ; wMaxPacketSize (MSB)
\r
291 .db 0 ; bInterval (iso only)
\r
293 ;; endpoint descriptor
\r
295 .db DSCR_ENDPNT_LEN
\r
297 .db 0x88 ; bEndpointAddress (ep 8 IN)
\r
298 .db ET_BULK ; bmAttributes
\r
299 .db 0x40 ; wMaxPacketSize (LSB)
\r
300 .db 0x00 ; wMaxPacketSize (MSB)
\r
301 .db 0 ; bInterval (iso only)
\r
304 _full_speed_config_descr_end:
\r
306 ;;; ----------------------------------------------------------------
\r
307 ;;; string descriptors
\r
308 ;;; ----------------------------------------------------------------
\r
310 _nstring_descriptors::
\r
311 .db (_string_descriptors_end - _string_descriptors) / 2
\r
313 _string_descriptors::
\r
318 _string_descriptors_end:
\r
321 ;; str0 contains the language ID's.
\r
324 str0: .db str0_end - str0
\r
328 .db <0x0409 ; magic code for US English (LSB)
\r
329 .db >0x0409 ; magic code for US English (MSB)
\r
335 str1: .db str1_end - str1
\r
337 .db 'E, 0 ; 16-bit unicode
\r
346 str2: .db str2_end - str2
\r
364 str3: .db str3_end - str3
\r