fxload fx2lp dev board
[fx2fw-sdcc] / dscr.a51
1 ;;; -*- asm -*-\r
2 ;;;\r
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
23 \r
24         .module usb_descriptors\r
25 \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
33 \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
40         \r
41         DSCR_DEVICE_LEN  =  18\r
42         DSCR_CONFIG_LEN  =   9\r
43         DSCR_INTRFC_LEN  =   9\r
44         DSCR_ENDPNT_LEN  =   7\r
45         DSCR_DEVQUAL_LEN =  10\r
46         \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
51         \r
52 ;;; --------------------------------------------------------\r
53 ;;;        external ram data\r
54 ;;;--------------------------------------------------------\r
55         \r
56         .area USBDESCSEG    (XDATA)\r
57         \r
58 ;;; ----------------------------------------------------------------\r
59 ;;; descriptors used when operating at high speed (480Mb/sec)\r
60 ;;; ----------------------------------------------------------------\r
61         \r
62         .even        ; descriptors must be 2-byte aligned for SUDPTR{H,L} to work\r
63 \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
67         ;; \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
73         \r
74 _high_speed_device_descr::\r
75         .db        DSCR_DEVICE_LEN\r
76         .db        DSCR_DEVICE\r
77 _dscr_usbver::\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
84 _dscr_vidpidver::\r
85         .db        <VID             ; idVendor\r
86         .db        >VID             ; idVendor\r
87         .db        <PID             ; idProduct\r
88         .db        >PID             ; idProduct\r
89         .db        <VERSION         ; bcdDevice\r
90         .db        >VERSION         ; bcdDevice\r
91 _dscr_strorder::\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
96         \r
97         .even\r
98 _high_speed_devqual_descr::\r
99         .db        DSCR_DEVQUAL_LEN\r
100         .db        DSCR_DEVQUAL\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
108         .db        0                ; bReserved\r
109         \r
110         .even\r
111 _high_speed_config_descr::        \r
112         .db        DSCR_CONFIG_LEN\r
113         .db        DSCR_CONFIG\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
119 _dscr_attrpow::\r
120         .db        USB_ATTR         ; bmAttributes\r
121         .db        MAX_POWER        ; bMaxPower [Unit: 0.5 mA]\r
122 \r
123         ;; interface descriptor\r
124         \r
125         .db        DSCR_INTRFC_LEN\r
126         .db        DSCR_INTRFC\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
134 \r
135         ;; endpoint descriptor\r
136 \r
137         .db        DSCR_ENDPNT_LEN\r
138         .db        DSCR_ENDPNT\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
144 \r
145         ;; endpoint descriptor\r
146 \r
147         .db        DSCR_ENDPNT_LEN\r
148         .db        DSCR_ENDPNT\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
154 \r
155         ;; interface descriptor\r
156         \r
157         .db        DSCR_INTRFC_LEN\r
158         .db        DSCR_INTRFC\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
166         \r
167                 ;; Endpoint Descriptor 2\r
168                 \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
176 \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
185         \r
186 _high_speed_config_descr_end:                   \r
187 \r
188 ;;; ----------------------------------------------------------------\r
189 ;;; descriptors used when operating at full speed (12Mb/sec)\r
190 ;;; ----------------------------------------------------------------\r
191 \r
192         .even\r
193 _full_speed_device_descr::        \r
194         .db        DSCR_DEVICE_LEN\r
195         .db        DSCR_DEVICE\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
212         \r
213 ;;; describes the other speed (480Mb/sec)\r
214         .even\r
215 _full_speed_devqual_descr::\r
216         .db        DSCR_DEVQUAL_LEN\r
217         .db        DSCR_DEVQUAL\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
225         .db        0                ; bReserved\r
226         \r
227         .even\r
228 _full_speed_config_descr::        \r
229         .db        DSCR_CONFIG_LEN\r
230         .db        DSCR_CONFIG\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
238 \r
239         ;; interface descriptor\r
240         \r
241         .db        DSCR_INTRFC_LEN\r
242         .db        DSCR_INTRFC\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
250 \r
251         ;; endpoint descriptor\r
252 \r
253         .db        DSCR_ENDPNT_LEN\r
254         .db        DSCR_ENDPNT\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
260 \r
261         ;; endpoint descriptor\r
262 \r
263         .db        DSCR_ENDPNT_LEN\r
264         .db        DSCR_ENDPNT\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
270 \r
271         ;; interface descriptor\r
272         \r
273         .db        DSCR_INTRFC_LEN\r
274         .db        DSCR_INTRFC\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
282 \r
283         ;; endpoint descriptor\r
284 \r
285         .db        DSCR_ENDPNT_LEN\r
286         .db        DSCR_ENDPNT\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
292 \r
293         ;; endpoint descriptor\r
294 \r
295         .db        DSCR_ENDPNT_LEN\r
296         .db        DSCR_ENDPNT\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
302     \r
303         \r
304 _full_speed_config_descr_end:        \r
305         \r
306 ;;; ----------------------------------------------------------------\r
307 ;;;                        string descriptors\r
308 ;;; ----------------------------------------------------------------\r
309 \r
310 _nstring_descriptors::\r
311         .db        (_string_descriptors_end - _string_descriptors) / 2\r
312 \r
313 _string_descriptors::\r
314         .db        <str0, >str0\r
315         .db        <str1, >str1\r
316         .db        <str2, >str2\r
317         .db        <str3, >str3\r
318 _string_descriptors_end:\r
319 \r
320         SI_NONE = 0\r
321         ;; str0 contains the language ID's.\r
322         .even\r
323 _str0::\r
324 str0:   .db        str0_end - str0\r
325         .db        DSCR_STRING\r
326         .db        0\r
327         .db        0\r
328         .db        <0x0409          ; magic code for US English (LSB)\r
329         .db        >0x0409          ; magic code for US English (MSB)\r
330 str0_end:\r
331 \r
332         SI_VENDOR = 1\r
333         .even\r
334 _str1::\r
335 str1:   .db        str1_end - str1\r
336         .db        DSCR_STRING\r
337         .db        'E, 0            ; 16-bit unicode\r
338         .db        'P, 0\r
339         .db        'F, 0\r
340         .db        'L, 0\r
341 str1_end:\r
342 \r
343         SI_PRODUCT = 2\r
344         .even\r
345 _str2::\r
346 str2:   .db        str2_end - str2\r
347         .db        DSCR_STRING\r
348         .db        'U, 0\r
349         .db        'S, 0\r
350         .db        'B, 0\r
351         .db        '-, 0\r
352         .db        'B, 0\r
353         .db        'l, 0\r
354         .db        'a, 0\r
355         .db        's, 0\r
356         .db        't, 0\r
357         .db        'e, 0\r
358         .db        'r, 0\r
359 str2_end:\r
360 \r
361         SI_SERIAL = 3\r
362         .even\r
363 _str3::\r
364 str3:   .db        str3_end - str3\r
365         .db        DSCR_STRING\r
366         .db        '0, 0\r
367         .db        '0, 0\r
368         .db        '0, 0\r
369         .db        '0, 0\r
370         .db        '0, 0\r
371         .db        '0, 0\r
372         .db        '0, 0\r
373         .db        '0, 0\r
374 str3_end:\r
375 \r