aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/fx2/b100/usb_descriptors.a51
blob: 6efeb8367f3e941e8118a87d4667eea2862b8304 (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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
;;; -*- asm -*-
;;;
;;; Copyright 2003 Free Software Foundation, Inc.
;;; 
;;; This file is part of GNU Radio
;;; 
;;; GNU Radio 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 3, or (at your option)
;;; any later version.
;;; 
;;; GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
;;; the Free Software Foundation, Inc., 51 Franklin Street,
;;; Boston, MA 02110-1301, USA.
;;;
	
;;; USB Descriptor table for the B100
;;; 
;;; We're a high-speed only device (480 Mb/sec) with 1 configuration
;;; and 5 interfaces.  
;;; 
;;;	interface 0:	command and status (ep0 COMMAND)
;;;	interface 1:	Transmit path (ep2 OUT BULK)
;;;	interface 2:	Receive path (ep6 IN BULK)

;;; interface 3:  Command transmit path (ep4 OUT BULK) for FPGA comms
;;; interface 4:  Command receive path (ep8 IN BULK) for FPGA comms

	.module usb_descriptors
	
	VID_FREE	 = 0x2500	; Ettus Research, LLC.
	PID_USRP	 = 0x0002	; B100

	;; We distinguish configured from unconfigured USRPs using the Device ID.
	;; If the MSB of the DID is 0, the device is unconfigured.
	;; The LSB of the DID is reserved for hardware revs.
	
	DID_USRP	 = 0x0100	; Device ID (bcd)

	
	DSCR_DEVICE	 =   1	; Descriptor type: Device
	DSCR_CONFIG	 =   2	; Descriptor type: Configuration
	DSCR_STRING	 =   3	; Descriptor type: String
	DSCR_INTRFC	 =   4	; Descriptor type: Interface
	DSCR_ENDPNT	 =   5	; Descriptor type: Endpoint
	DSCR_DEVQUAL	 =   6	; Descriptor type: Device Qualifier
	
	DSCR_DEVICE_LEN	 =  18
	DSCR_CONFIG_LEN  =   9
	DSCR_INTRFC_LEN  =   9
	DSCR_ENDPNT_LEN  =   7
	DSCR_DEVQUAL_LEN =  10
	
	ET_CONTROL	 =   0	; Endpoint type: Control
	ET_ISO		 =   1	; Endpoint type: Isochronous
	ET_BULK		 =   2	; Endpoint type: Bulk
	ET_INT		 =   3	; Endpoint type: Interrupt
	
	
	;; configuration attributes
	bmSELF_POWERED	=	1 << 6

;;; --------------------------------------------------------
;;;	external ram data
;;;--------------------------------------------------------
	
	.area USBDESCSEG    (XDATA)
	
;;; ----------------------------------------------------------------
;;; descriptors used when operating at high speed (480Mb/sec)
;;; ----------------------------------------------------------------
	
	.even	; descriptors must be 2-byte aligned for SUDPTR{H,L} to work

	;; The .even directive isn't really honored by the linker.  Bummer!
	;; (There's no way to specify an alignment requirement for a given area,
	;; hence when they're concatenated together, even doesn't work.)
	;; 
	;; We work around this by telling the linker to put USBDESCSEG
	;; at 0xE000 absolute.  This means that the maximimum length of this
	;; segment is 480 bytes, leaving room for the two hash slots 
	;; at 0xE1EO to 0xE1FF.  
	;; 
	;; As of July 7, 2004, this segment is 326 bytes long
  ;; As of Sept 2, 2010, this segment is 416 bytes long
	
_high_speed_device_descr::
	.db	DSCR_DEVICE_LEN
	.db	DSCR_DEVICE
	.db	<0x0200		; Specification version (LSB)
	.db	>0x0200		; Specification version (MSB)
	.db	0xff		; device class (vendor specific)
	.db	0xff		; device subclass (vendor specific)
	.db	0xff		; device protocol (vendor specific)
	.db	64		; bMaxPacketSize0 for endpoint 0
	.db	<VID_FREE	; idVendor
	.db	>VID_FREE	; idVendor
	.db	<PID_USRP	; idProduct
	.db	>PID_USRP	; idProduct
_usb_desc_hw_rev_binary_patch_location_0::
	.db	<DID_USRP	; bcdDevice
	.db	>DID_USRP	; bcdDevice
	.db	SI_VENDOR	; iManufacturer (string index)
	.db	SI_PRODUCT	; iProduct (string index)
	.db	SI_SERIAL	; iSerial number (string index)
	.db	1		; bNumConfigurations
	
;;; describes the other speed (12Mb/sec)
	.even
_high_speed_devqual_descr::
	.db	DSCR_DEVQUAL_LEN
	.db	DSCR_DEVQUAL
	.db	<0x0200		; bcdUSB (LSB)
	.db	>0x0200		; bcdUSB (MSB)
	.db	0xff		; bDeviceClass
	.db	0xff		; bDeviceSubClass
	.db	0xff		; bDeviceProtocol
	.db	64		; bMaxPacketSize0
	.db	1		; bNumConfigurations (one config at 12Mb/sec)
	.db	0		; bReserved
	
	.even
_high_speed_config_descr::	
	.db	DSCR_CONFIG_LEN
	.db	DSCR_CONFIG
	.db	<(_high_speed_config_descr_end - _high_speed_config_descr) ; LSB
	.db	>(_high_speed_config_descr_end - _high_speed_config_descr) ; MSB
	.db	5		; bNumInterfaces
	.db	1		; bConfigurationValue
	.db	0		; iConfiguration
	.db	0x80 | bmSELF_POWERED ; bmAttributes
	.db	0		; bMaxPower

	;; interface descriptor 0 (command & status, ep0 COMMAND)
	
	.db	DSCR_INTRFC_LEN
	.db	DSCR_INTRFC
	.db	0		; bInterfaceNumber (zero based)
	.db	0		; bAlternateSetting
	.db	0		; bNumEndpoints
	.db	0xff		; bInterfaceClass (vendor specific)
	.db	0xff		; bInterfaceSubClass (vendor specific)
	.db	0xff		; bInterfaceProtocol (vendor specific)
	.db	SI_COMMAND_AND_STATUS	; iInterface (description)

	;; interface descriptor 1 (transmit path, ep2 OUT BULK)
	
	.db	DSCR_INTRFC_LEN
	.db	DSCR_INTRFC
	.db	1		; bInterfaceNumber (zero based)
	.db	0		; bAlternateSetting
	.db	1		; bNumEndpoints
	.db	0xff		; bInterfaceClass (vendor specific)
	.db	0xff		; bInterfaceSubClass (vendor specific)
	.db	0xff		; bInterfaceProtocol (vendor specific)
	.db	SI_TX_PATH	; iInterface (description)

	;; interface 1's end point

	.db	DSCR_ENDPNT_LEN
	.db	DSCR_ENDPNT
	.db	0x02		; bEndpointAddress (ep 2 OUT)
	.db	ET_BULK		; bmAttributes
	.db	<512		; wMaxPacketSize (LSB)
	.db	>512		; wMaxPacketSize (MSB)
	.db	0		; bInterval (iso only)

	;; interface descriptor 2 (receive path, ep6 IN BULK)
	
	.db	DSCR_INTRFC_LEN
	.db	DSCR_INTRFC
	.db	2		; bInterfaceNumber (zero based)
	.db	0		; bAlternateSetting
	.db	1		; bNumEndpoints
	.db	0xff		; bInterfaceClass (vendor specific)
	.db	0xff		; bInterfaceSubClass (vendor specific)
	.db	0xff		; bInterfaceProtocol (vendor specific)
	.db	SI_RX_PATH	; iInterface (description)

	;; interface 2's end point

	.db	DSCR_ENDPNT_LEN
	.db	DSCR_ENDPNT
	.db	0x86		; bEndpointAddress (ep 6 IN)
	.db	ET_BULK		; bmAttributes
	.db	<512		; wMaxPacketSize (LSB)
	.db	>512		; wMaxPacketSize (MSB)
	.db	0		; bInterval (iso only)

	;; interface descriptor 3 (FPGA command OUT path, ep4 OUT BULK)
	
	.db	DSCR_INTRFC_LEN
	.db	DSCR_INTRFC
	.db	3		; bInterfaceNumber (zero based)
	.db	0		; bAlternateSetting
	.db	1		; bNumEndpoints
	.db	0xff		; bInterfaceClass (vendor specific)
	.db	0xff		; bInterfaceSubClass (vendor specific)
	.db	0xff		; bInterfaceProtocol (vendor specific)
	.db	SI_FPGA_COMMAND_OUT_PATH	; iInterface (description)

	;; interface 3's end point

	.db	DSCR_ENDPNT_LEN
	.db	DSCR_ENDPNT
	.db	0x04		; bEndpointAddress (ep 4 OUT)
	.db	ET_BULK		; bmAttributes
	.db	<32		; wMaxPacketSize (LSB)
	.db	>32		; wMaxPacketSize (MSB)
	.db	0		; bInterval (iso only)

	;; interface descriptor 4 (FPGA command IN path, ep8 IN BULK)
	
	.db	DSCR_INTRFC_LEN
	.db	DSCR_INTRFC
	.db	4		; bInterfaceNumber (zero based)
	.db	0		; bAlternateSetting
	.db	1		; bNumEndpoints
	.db	0xff		; bInterfaceClass (vendor specific)
	.db	0xff		; bInterfaceSubClass (vendor specific)
	.db	0xff		; bInterfaceProtocol (vendor specific)
	.db	SI_FPGA_COMMAND_IN_PATH	; iInterface (description)

	;; interface 4's end point

	.db	DSCR_ENDPNT_LEN
	.db	DSCR_ENDPNT
	.db	0x88		; bEndpointAddress (ep 8 IN)
	.db	ET_BULK		; bmAttributes
	.db	<32		; wMaxPacketSize (LSB)
	.db	>32		; wMaxPacketSize (MSB)
	.db	0		; bInterval (iso only)


_high_speed_config_descr_end:		

;;; ----------------------------------------------------------------
;;; descriptors used when operating at full speed (12Mb/sec)
;;; ----------------------------------------------------------------

	.even
_full_speed_device_descr::	
	.db	DSCR_DEVICE_LEN
	.db	DSCR_DEVICE
	.db	<0x0200		; Specification version (LSB)
	.db	>0x0200		; Specification version (MSB)
	.db	0xff		; device class (vendor specific)
	.db	0xff		; device subclass (vendor specific)
	.db	0xff		; device protocol (vendor specific)
	.db	64		; bMaxPacketSize0 for endpoint 0
	.db	<VID_FREE	; idVendor
	.db	>VID_FREE	; idVendor
	.db	<PID_USRP	; idProduct
	.db	>PID_USRP	; idProduct
_usb_desc_hw_rev_binary_patch_location_1::
	.db	<DID_USRP	; bcdDevice
	.db	>DID_USRP	; bcdDevice
	.db	SI_VENDOR	; iManufacturer (string index)
	.db	SI_PRODUCT	; iProduct (string index)
	.db	SI_NONE		; iSerial number (None)
	.db	1		; bNumConfigurations
	
	
;;; describes the other speed (480Mb/sec)
	.even
_full_speed_devqual_descr::
	.db	DSCR_DEVQUAL_LEN
	.db	DSCR_DEVQUAL
	.db	<0x0200		; bcdUSB
	.db	>0x0200		; bcdUSB
	.db	0xff		; bDeviceClass
	.db	0xff		; bDeviceSubClass
	.db	0xff		; bDeviceProtocol
	.db	64		; bMaxPacketSize0
	.db	1		; bNumConfigurations (one config at 480Mb/sec)
	.db	0		; bReserved
	
	.even
_full_speed_config_descr::	
	.db	DSCR_CONFIG_LEN
	.db	DSCR_CONFIG
	.db	<(_full_speed_config_descr_end - _full_speed_config_descr) ; LSB
	.db	>(_full_speed_config_descr_end - _full_speed_config_descr) ; MSB
	.db	1		; bNumInterfaces
	.db	1		; bConfigurationValue
	.db	0		; iConfiguration
	.db	0x80 | bmSELF_POWERED ; bmAttributes
	.db	0		; bMaxPower

	;; interface descriptor 0 (command & status, ep0 COMMAND)
	
	.db	DSCR_INTRFC_LEN
	.db	DSCR_INTRFC
	.db	0		; bInterfaceNumber (zero based)
	.db	0		; bAlternateSetting
	.db	0		; bNumEndpoints
	.db	0xff		; bInterfaceClass (vendor specific)
	.db	0xff		; bInterfaceSubClass (vendor specific)
	.db	0xff		; bInterfaceProtocol (vendor specific)
	.db	SI_COMMAND_AND_STATUS	; iInterface (description)
	
_full_speed_config_descr_end:	
	
;;; ----------------------------------------------------------------
;;;			string descriptors
;;; ----------------------------------------------------------------

_nstring_descriptors::
	.db	(_string_descriptors_end - _string_descriptors) / 2

_string_descriptors::
	.db	<str0, >str0
	.db	<str1, >str1
	.db	<str2, >str2
	.db	<str3, >str3
	.db	<str4, >str4
	.db	<str5, >str5
	.db	<str6, >str6
	.db <str7, >str7
	.db <str8, >str8
_string_descriptors_end:

	SI_NONE = 0
	;; str0 contains the language ID's.
	.even
str0:	.db	str0_end - str0
	.db	DSCR_STRING
	.db	0
	.db	0
	.db	<0x0409		; magic code for US English (LSB)
	.db	>0x0409		; magic code for US English (MSB)
str0_end:

	SI_VENDOR = 1
	.even
str1:	.db	str1_end - str1
	.db	DSCR_STRING
	.db	'F, 0		; 16-bit unicode
	.db	'r, 0
	.db	'e, 0
	.db	'e, 0
	.db	' , 0
	.db	'S, 0
	.db	'o, 0
	.db	'f, 0
	.db	't, 0
	.db	'w, 0
	.db	'a, 0
	.db	'r, 0
	.db	'e, 0
	.db	' , 0
	.db	'F, 0
	.db	'o, 0
	.db	'l, 0
	.db	'k, 0
	.db	's, 0
str1_end:

	SI_PRODUCT = 2
	.even
str2:	.db	str2_end - str2
	.db	DSCR_STRING
	.db	'U, 0
	.db	'S, 0
	.db	'R, 0
	.db	'P, 0
	.db '1, 0
	.db 'P, 0
	.db	' , 0
	.db	'R, 0
	.db	'e, 0
	.db	'v, 0
	.db	' , 0
_usb_desc_hw_rev_ascii_patch_location_0::
	.db	'?, 0
str2_end:

	SI_COMMAND_AND_STATUS = 3
	.even
str3:	.db	str3_end - str3
	.db	DSCR_STRING
	.db	'C, 0
	.db	'o, 0
	.db	'm, 0
	.db	'm, 0
	.db	'a, 0
	.db	'n, 0
	.db	'd, 0
	.db	' , 0
	.db	'&, 0
	.db	' , 0
	.db	'S, 0
	.db	't, 0
	.db	'a, 0
	.db	't, 0
	.db	'u, 0
	.db	's, 0
str3_end:

	SI_TX_PATH = 4
	.even
str4:	.db	str4_end - str4
	.db	DSCR_STRING
	.db	'T, 0
	.db	'r, 0
	.db	'a, 0
	.db	'n, 0
	.db	's, 0
	.db	'm, 0
	.db	'i, 0
	.db	't, 0
	.db	' , 0
	.db	'P, 0
	.db	'a, 0
	.db	't, 0
	.db	'h, 0
str4_end:

	SI_RX_PATH = 5
	.even
str5:	.db	str5_end - str5
	.db	DSCR_STRING
	.db	'R, 0
	.db	'e, 0
	.db	'c, 0
	.db	'e, 0
	.db	'i, 0
	.db	'v, 0
	.db	'e, 0
	.db	' , 0
	.db	'P, 0
	.db	'a, 0
	.db	't, 0
	.db	'h, 0
str5_end:

	SI_SERIAL = 6
	.even
str6:	.db	str6_end - str6
	.db	DSCR_STRING
_usb_desc_serial_number_ascii::
	.db	'3, 0
	.db	'., 0
	.db	'1, 0
	.db	'4, 0
	.db	'1, 0
	.db	'5, 0
	.db	'9, 0
	.db	'2, 0
	.db	'7, 0
str6_end:

	SI_FPGA_COMMAND_OUT_PATH = 7
	.even
str7:	.db	str7_end - str7
	.db	DSCR_STRING
	.db	'F, 0
	.db	'P, 0
	.db	'G, 0
	.db	'A, 0
	.db	' , 0
	.db	'C, 0
	.db	'o, 0
	.db	'm, 0
	.db	'm, 0
	.db	'a, 0
	.db	'n, 0
	.db	'd, 0
	.db	' , 0
	.db	'O, 0
	.db	'u, 0
	.db	't, 0
str7_end:

	SI_FPGA_COMMAND_IN_PATH = 8
	.even
str8:	.db	str8_end - str8
	.db	DSCR_STRING
	.db	'F, 0
	.db	'P, 0
	.db	'G, 0
	.db	'A, 0
	.db	' , 0
	.db	'C, 0
	.db	'o, 0
	.db	'm, 0
	.db	'm, 0
	.db	'a, 0
	.db	'n, 0
	.db	'd, 0
	.db	' , 0
	.db	'I, 0
	.db	'n, 0
str8_end: