OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.61/] [tools/] [fx2/] [src/] [dscr_gen.A51] - Blame information for rev 26

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 wfjm
;;; -*- asm -*-
2
;;; $Id: dscr_gen.A51 457 2012-02-12 22:34:20Z mueller $
3
;;;
4
;;; Copyright 2011-2012 by Walter F.J. Mueller 
5
;;; Code was forked from ixo-jtag.svn.sourceforge.net on 2011-07-17
6
;;;
7
;;;- original copyright and licence disclaimer ---------------------------------
8
;;;- Copyright 2005..2007 Kolja Waschk, ixo.de
9
;;;- Code based on USRP2 firmware (GNU Radio Project), version 3.0.2,
10
;;;- Copyright 2003 Free Software Foundation, Inc.
11
;;;- This code is part of usbjtag. usbjtag is free software;
12
;;;- ---------------------------------------------------------------------------
13
;;;
14
;;; This program is free software; you may redistribute and/or modify it under
15
;;; the terms of the GNU General Public License as published by the Free
16
;;; Software Foundation, either version 2, or at your option any later version.
17
;;;
18
;;; This program is distributed in the hope that it will be useful, but
19
;;; WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
20
;;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
21
;;; for complete details.
22
;;;
23
;;;-----------------------------------------------------------------------------
24
;;; USB Descriptor, common source for jtag + 0, 2, or 3 hardware fifo interface
25
;;;
26
;;; Use C preprocessor to create an assembler source for the configurations:
27
;;;
28
;;;   Endpoint   Usage   Comment
29
;;;   EP1 IN     jtag    always defined
30
;;;   EP2 OUT    jtag    always defined
31
;;;   EP4 OUT    data    defined if USE_2FIFO or USE_3FIFO
32
;;;   EP6 IN     data    defined if USE_2FIFO or USE_3FIFO
33
;;;   EP8 IN     data    defined if USE_3FIFO
34
;;;
35
;;; Available preprocessor options
36
;;;
37
;;;   USE_VID            USB Vendor ID
38
;;;   USE_PID            USB Product ID
39
;;;
40
;;;   USE_2FIFO          if given EP4 OUT and EP6 IN created
41
;;;   USE_3FIFO          if given EP4 OUT, EP6 IN and EP8 IN created
42
;;;   USE_DID=0xhhhh     for product version (default 0x0004)
43
;;;   USE_MAXPOWER=nnn   for USB max current (in units of 2 mA; default 250)
44
;;;
45
;;;   USE_NEXYS2         prefix 'nexys2_' in iProduct string
46
;;;   USE_NEXYS3         prefix 'nexys3_' in iProduct string
47
;;;   USE_AS             suffix '_as' in iProduct string
48
;;;   USE_IC             suffix '_ic' in iProduct string
49
;;;
50
;;; Usage
51
;;;   cpp -P -x assembler-with-cpp dscr_gen.A51             > ...
52
;;;   cpp -P -x assembler-with-cpp dscr_gen.A51 -DUSE_2FIFO > ...
53
;;;   cpp -P -x assembler-with-cpp dscr_gen.A51 -DUSE_3FIFO > ...
54
;;;
55
;;;
56
;;; Revision History:
57
;;;
58
;;; Date         Rev Version  Comment
59
;;; 2012-02-11   457   2.1    iVendor string now reflects firmware file name;
60
;;;                           iSerial string now 00000000;
61
;;;                           VID/PID now via USE_VID/USE_PID defines
62
;;; 2011-07-24   398   2.0    Convert all *.a51 to one common source
63
;;; 2011-07-17   395   1.1    Use USB 2.0; New string values; use 512 byte for
64
;;;                           all high speed endpoints
65
;;; 2011-07-17   395   1.0    Initial version (derived from dscr_jtag.a51)
66
;;;-----------------------------------------------------------------------------
67
 
68
#ifndef USE_DID
69
#define USE_DID  0x0004
70
#endif
71
 
72
#ifndef USE_MAXPOWER
73
#define USE_MAXPOWER  250
74
#endif
75
 
76
#ifdef  USE_3FIFO
77
#define NUM_EPS 5
78
#elif   USE_2FIFO
79
#define NUM_EPS 4
80
#else
81
#define NUM_EPS 2
82
#endif
83
 
84
        .module usb_descriptors
85
 
86
        VID              = USE_VID    ; Vendor ID
87
        PID              = USE_PID    ; Product ID
88
        VERSION          = USE_DID    ; Version
89
 
90
        USB_VER          = 0x0200     ; Support USB version 2.00
91
        USB_ATTR         = 0x80       ; Bus powered, no remote wakeup
92
        FTD_ATTR         = 0x001C     ; Set USB version, use version string, enable suspend PD
93
        MAX_POWER        = USE_MAXPOWER
94
 
95
        DSCR_DEVICE      =   1        ; Descriptor type: Device
96
        DSCR_CONFIG      =   2        ; Descriptor type: Configuration
97
        DSCR_STRING      =   3        ; Descriptor type: String
98
        DSCR_INTRFC      =   4        ; Descriptor type: Interface
99
        DSCR_ENDPNT      =   5        ; Descriptor type: Endpoint
100
        DSCR_DEVQUAL     =   6        ; Descriptor type: Device Qualifier
101
 
102
        DSCR_DEVICE_LEN  =  18
103
        DSCR_CONFIG_LEN  =   9
104
        DSCR_INTRFC_LEN  =   9
105
        DSCR_ENDPNT_LEN  =   7
106
        DSCR_DEVQUAL_LEN =  10
107
 
108
        ET_CONTROL       =   0        ; Endpoint type: Control
109
        ET_ISO           =   1        ; Endpoint type: Isochronous
110
        ET_BULK          =   2        ; Endpoint type: Bulk
111
        ET_INT           =   3        ; Endpoint type: Interrupt
112
 
113
;;; --------------------------------------------------------
114
;;;        external ram data
115
;;;--------------------------------------------------------
116
 
117
        .area USBDESCSEG    (XDATA)
118
 
119
        .even      ; descriptors must be 2-byte aligned for SUDPTR{H,L} to work
120
 
121
        ;; The .even directive isn't really honored by the linker.  Bummer!
122
        ;; (There's no way to specify an alignment requirement for a given area,
123
        ;; hence when they're concatenated together, even doesn't work.)
124
        ;;
125
        ;; We work around this by telling the linker to put USBDESCSEG
126
        ;; at absolute address 0xE100 (see LDFLAGS in Makefile).
127
 
128
;;; ----------------------------------------------------------------
129
;;; descriptors used when operating at high speed (480Mbps)
130
;;; ----------------------------------------------------------------
131
 
132
_high_speed_device_descr::
133
        .db        DSCR_DEVICE_LEN
134
        .db        DSCR_DEVICE
135
_dscr_usbver::
136
        .db        
137
        .db        >USB_VER         ; Specification version (MSB)
138
        .db        0x00             ; device class (vendor specific)
139
        .db        0x00             ; device subclass (vendor specific)
140
        .db        0x00             ; device protocol (vendor specific)
141
        .db        64               ; bMaxPacketSize0 for endpoint 0
142
_dscr_vidpidver::
143
        .db        
144
        .db        >VID             ; idVendor
145
        .db        
146
        .db        >PID             ; idProduct
147
        .db        
148
        .db        >VERSION         ; bcdDevice
149
_dscr_strorder::
150
        .db        SI_VENDOR        ; iManufacturer (string index)
151
        .db        SI_PRODUCT       ; iProduct (string index)
152
        .db        SI_SERIAL        ; iSerial number (string index)
153
        .db        1                ; bNumConfigurations
154
 
155
        .even
156
_high_speed_devqual_descr::
157
        .db        DSCR_DEVQUAL_LEN
158
        .db        DSCR_DEVQUAL
159
        .db        
160
        .db        >USB_VER         ; bcdUSB (MSB)
161
        .db        0xFF             ; bDeviceClass
162
        .db        0xFF             ; bDeviceSubClass
163
        .db        0xFF             ; bDeviceProtocol
164
        .db        64               ; bMaxPacketSize0
165
        .db        1                ; bNumConfigurations (one config at 12Mbps)
166
        .db        0                ; bReserved
167
 
168
        .even
169
_high_speed_config_descr::
170
        .db        DSCR_CONFIG_LEN
171
        .db        DSCR_CONFIG
172
        .db        <(_high_speed_config_descr_end - _high_speed_config_descr)
173
        .db        >(_high_speed_config_descr_end - _high_speed_config_descr)
174
        .db        1                ; bNumInterfaces
175
        .db        1                ; bConfigurationValue
176
        .db        0                ; iConfiguration
177
_dscr_attrpow::
178
        .db        USB_ATTR         ; bmAttributes
179
        .db        MAX_POWER        ; bMaxPower [Unit: 2 mA]
180
 
181
        ;; interface descriptor
182
 
183
        .db        DSCR_INTRFC_LEN
184
        .db        DSCR_INTRFC
185
        .db        0                ; bInterfaceNumber (zero based)
186
        .db        0                ; bAlternateSetting
187
        .db        NUM_EPS          ; bNumEndpoints
188
        .db        0xFF             ; bInterfaceClass (vendor specific)
189
        .db        0xFF             ; bInterfaceSubClass (vendor specific)
190
        .db        0xFF             ; bInterfaceProtocol (vendor specific)
191
        .db        SI_PRODUCT       ; iInterface (description)
192
 
193
        ;; endpoint descriptor (jtag response)
194
 
195
        .db        DSCR_ENDPNT_LEN
196
        .db        DSCR_ENDPNT
197
        .db        0x81             ; bEndpointAddress (EP 1 IN)
198
        .db        ET_BULK          ; bmAttributes
199
        .db        <512             ; wMaxPacketSize (LSB) !! use only 64 byte
200
        .db        >512             ; wMaxPacketSize (MSB) !! use only 64 byte
201
        .db        0                ; bInterval (iso only)
202
 
203
        ;; endpoint descriptor (jtag request)
204
 
205
        .db        DSCR_ENDPNT_LEN
206
        .db        DSCR_ENDPNT
207
        .db        0x02             ; bEndpointAddress (EP 2 OUT)
208
        .db        ET_BULK          ; bmAttributes
209
        .db        <512             ; wMaxPacketSize (LSB) !! use only 64 byte
210
        .db        >512             ; wMaxPacketSize (MSB) !! use only 64 byte
211
        .db        0                ; bInterval (iso only)
212
 
213
#if defined(USE_2FIFO) || defined(USE_3FIFO)
214
 
215
        ;; endpoint descriptor (RXFIFO HOST->FPGA)
216
 
217
        .db        DSCR_ENDPNT_LEN
218
        .db        DSCR_ENDPNT
219
        .db        0x04             ; bEndpointAddress (EP 4 OUT)
220
        .db        ET_BULK          ; bmAttributes
221
        .db        <512             ; wMaxPacketSize (LSB)
222
        .db        >512             ; wMaxPacketSize (MSB)
223
        .db        0                ; bInterval (iso only)
224
 
225
        ;; endpoint descriptor (TXFIFO FPGA->HOST)
226
 
227
        .db        DSCR_ENDPNT_LEN
228
        .db        DSCR_ENDPNT
229
        .db        0x86             ; bEndpointAddress (EP 6 IN)
230
        .db        ET_BULK          ; bmAttributes
231
        .db        <512             ; wMaxPacketSize (LSB)
232
        .db        >512             ; wMaxPacketSize (MSB)
233
        .db        0                ; bInterval (iso only)
234
 
235
#endif
236
 
237
#if defined(USE_3FIFO)
238
 
239
        ;; endpoint descriptor (extra FIFO FPGA->HOST)
240
 
241
        .db        DSCR_ENDPNT_LEN
242
        .db        DSCR_ENDPNT
243
        .db        0x88             ; bEndpointAddress (EP 8 IN)
244
        .db        ET_BULK          ; bmAttributes
245
        .db        <512             ; wMaxPacketSize (LSB)
246
        .db        >512             ; wMaxPacketSize (MSB)
247
        .db        0                ; bInterval (iso only)
248
 
249
#endif
250
 
251
_high_speed_config_descr_end:
252
 
253
;;; ----------------------------------------------------------------
254
;;; descriptors used when operating at full speed (12Mbps)
255
;;; no data fifo endpoints defined, if we are in full speed mode this will be no
256
;;; fun anyway. Shouldn't happen anyway, unless stone age USB hubs interfere...
257
;;; ----------------------------------------------------------------
258
 
259
        .even
260
_full_speed_device_descr::
261
        .db        DSCR_DEVICE_LEN
262
        .db        DSCR_DEVICE
263
        .db        
264
        .db        >USB_VER         ; Specification version (MSB)
265
        .db        0x00             ; device class (vendor specific)
266
        .db        0x00             ; device subclass (vendor specific)
267
        .db        0x00             ; device protocol (vendor specific)
268
        .db        64               ; bMaxPacketSize0 for endpoint 0
269
        .db        
270
        .db        >VID             ; idVendor
271
        .db        
272
        .db        >PID             ; idProduct
273
        .db        
274
        .db        >VERSION         ; bcdDevice
275
        .db        SI_VENDOR        ; iManufacturer (string index)
276
        .db        SI_PRODUCT       ; iProduct (string index)
277
        .db        SI_SERIAL        ; iSerial number (string index)
278
        .db        1                ; bNumConfigurations
279
 
280
;;; describes the other speed (480Mbps)
281
        .even
282
_full_speed_devqual_descr::
283
        .db        DSCR_DEVQUAL_LEN
284
        .db        DSCR_DEVQUAL
285
        .db        
286
        .db        >USB_VER         ; bcdUSB
287
        .db        0xFF             ; bDeviceClass
288
        .db        0xFF             ; bDeviceSubClass
289
        .db        0xFF             ; bDeviceProtocol
290
        .db        64               ; bMaxPacketSize0
291
        .db        1                ; bNumConfigurations (one config at 480Mbps)
292
        .db        0                ; bReserved
293
 
294
        .even
295
_full_speed_config_descr::
296
        .db        DSCR_CONFIG_LEN
297
        .db        DSCR_CONFIG
298
        .db        <(_full_speed_config_descr_end - _full_speed_config_descr)
299
        .db        >(_full_speed_config_descr_end - _full_speed_config_descr)
300
        .db        1                ; bNumInterfaces
301
        .db        1                ; bConfigurationValue
302
        .db        0                ; iConfiguration
303
        .db        USB_ATTR         ; bmAttributes
304
        .db        MAX_POWER        ; bMaxPower [Unit: 2 mA]
305
 
306
        ;; interface descriptor
307
 
308
        .db        DSCR_INTRFC_LEN
309
        .db        DSCR_INTRFC
310
        .db        0                ; bInterfaceNumber (zero based)
311
        .db        0                ; bAlternateSetting
312
        .db        2                ; bNumEndpoints
313
        .db        0xFF             ; bInterfaceClass (vendor specific)
314
        .db        0xFF             ; bInterfaceSubClass (vendor specific)
315
        .db        0xFF             ; bInterfaceProtocol (vendor specific)
316
        .db        SI_PRODUCT       ; iInterface (description)
317
 
318
        ;; endpoint descriptor
319
 
320
        .db        DSCR_ENDPNT_LEN
321
        .db        DSCR_ENDPNT
322
        .db        0x81             ; bEndpointAddress (EP 1 IN)
323
        .db        ET_BULK          ; bmAttributes
324
        .db        <64              ; wMaxPacketSize (LSB)
325
        .db        >64              ; wMaxPacketSize (MSB)
326
        .db        0                ; bInterval (iso only)
327
 
328
        ;; endpoint descriptor
329
 
330
        .db        DSCR_ENDPNT_LEN
331
        .db        DSCR_ENDPNT
332
        .db        0x02             ; bEndpointAddress (EP 2 OUT)
333
        .db        ET_BULK          ; bmAttributes
334
        .db        <64              ; wMaxPacketSize (LSB)
335
        .db        >64              ; wMaxPacketSize (MSB)
336
        .db        0                ; bInterval (iso only)
337
 
338
_full_speed_config_descr_end:
339
 
340
;;; ----------------------------------------------------------------
341
;;;                        string descriptors
342
;;; ----------------------------------------------------------------
343
 
344
_nstring_descriptors::
345
        .db        (_string_descriptors_end - _string_descriptors) / 2
346
 
347
_string_descriptors::
348
        .db        str0
349
        .db        str1
350
        .db        str2
351
        .db        str3
352
_string_descriptors_end:
353
 
354
        SI_NONE = 0
355
        ;; str0 contains the language ID's.
356
        .even
357
_str0::
358
str0:   .db        str0_end - str0
359
        .db        DSCR_STRING
360
        .db        0
361
        .db        0
362
        .db        <0x0409          ; magic code for US English (LSB)
363
        .db        >0x0409          ; magic code for US English (MSB)
364
str0_end:
365
 
366
        SI_VENDOR = 1
367
        .even
368
_str1::
369
str1:   .db        str1_end - str1
370
        .db        DSCR_STRING
371
        .db        'w, 0            ; 16-bit unicode
372
        .db        'w, 0
373
        .db        'w, 0
374
        .db        '., 0
375
        .db        'r, 0
376
        .db        'e, 0
377
        .db        't, 0
378
        .db        'r, 0
379
        .db        'o, 0
380
        .db        '1, 0
381
        .db        '1, 0
382
        .db        '., 0
383
        .db        'd, 0
384
        .db        'e, 0
385
str1_end:
386
 
387
        SI_PRODUCT = 2
388
        .even
389
_str2::
390
str2:   .db        str2_end - str2
391
        .db        DSCR_STRING
392
#if defined(USE_NEXYS2)
393
        .db        'n, 0
394
        .db        'e, 0
395
        .db        'x, 0
396
        .db        'y, 0
397
        .db        's, 0
398
        .db        '2, 0
399
        .db        '_, 0
400
#endif
401
#if defined(USE_NEXYS3)
402
        .db        'n, 0
403
        .db        'e, 0
404
        .db        'x, 0
405
        .db        'y, 0
406
        .db        's, 0
407
        .db        '3, 0
408
        .db        '_, 0
409
#endif
410
        .db        'j, 0
411
        .db        't, 0
412
        .db        'a, 0
413
        .db        'g, 0
414
#if defined(USE_2FIFO)
415
        .db        '_, 0
416
        .db        '2, 0
417
        .db        'f, 0
418
        .db        'i, 0
419
        .db        'f, 0
420
        .db        'o, 0
421
#endif
422
#if defined(USE_3FIFO)
423
        .db        '_, 0
424
        .db        '3, 0
425
        .db        'f, 0
426
        .db        'i, 0
427
        .db        'f, 0
428
        .db        'o, 0
429
#endif
430
#if defined(USE_AS)
431
        .db        '_, 0
432
        .db        'a, 0
433
        .db        's, 0
434
#endif
435
#if defined(USE_IC)
436
        .db        '_, 0
437
        .db        'i, 0
438
        .db        'c, 0
439
#endif
440
str2_end:
441
 
442
        SI_SERIAL = 3
443
        .even
444
_str3::
445
str3:   .db        str3_end - str3
446
        .db        DSCR_STRING
447
        .db        '0, 0
448
        .db        '0, 0
449
        .db        '0, 0
450
        .db        '0, 0
451
        .db        '0, 0
452
        .db        '0, 0
453
        .db        '0, 0
454
        .db        '0, 0
455
str3_end:

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.