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

Subversion Repositories gecko3

[/] [gecko3/] [trunk/] [GECKO3COM/] [gecko3com-fw/] [firmware/] [src/] [usb_descriptors.a51] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 nussgipfel
;;; -*- asm -*-
2
 
3
;;; GECKO3COM
4
;;;
5
;;; Copyright (C) 2008 by
6
;;;   ___    ____  _   _
7
;;;  (  _`\ (  __)( ) ( )
8
;;;  | (_) )| (_  | |_| |   Berne University of Applied Sciences
9
;;;  |  _ <'|  _) |  _  |   School of Engineering and
10
;;;  | (_) )| |   | | | |   Information Technology
11
;;;  (____/'(_)   (_) (_)
12
;;;
13
;;;
14
;;; This program is free software: you can redistribute it and/or modify
15
;;; it under the terms of the GNU General Public License as published by
16
;;; the Free Software Foundation, either version 3 of the License, or
17
;;; (at your option) any later version.
18
;;;
19
;;; This program is distributed in the hope that it will be useful,
20
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
;;; GNU General Public License for more details.
23
;;; You should have received a copy of the GNU General Public License
24
;;; along with this program.  If not, see .
25
;;;
26
;;;********************************************************************
27
;;; As vendor ID we use the ID from Anchor Chips (0x4705) which is now Cypress, so
28
;;; they don't need there old ID anymore.
29
;;;
30
;;; This device works with USB full and high speed hosts.
31
;;;
32
;;; Endpoint configuration is according to USB TMC specification 1.0
33
;;;
34
 
35
 
36
        .module usb_descriptors
37
 
38
        VID_FREE         = 0x0547       ; Anchor Chips (now Cypress) nobody using it anymore
39
        PID_GECKO        = 0x0002       ; GECKO3COM using USB TMC
40
        PID_DFU          = 0x0003       ; Different PID for DFU mode, some OS have problems when you use the same PID
41
 
42
        ;; We distinguish configured from unconfigured GECKO3main's using the Device ID.
43
        ;; If the MSB of the DID is 0, the device is unconfigured.
44
        ;; The LSB of the DID is reserved for hardware revs.
45
 
46
        DID_GECKO        = 0x0100       ; Device ID (bcd)
47
 
48
 
49
        DSCR_DEVICE      =   1  ; Descriptor type: Device
50
        DSCR_CONFIG      =   2  ; Descriptor type: Configuration
51
        DSCR_STRING      =   3  ; Descriptor type: String
52
        DSCR_INTRFC      =   4  ; Descriptor type: Interface
53
        DSCR_ENDPNT      =   5  ; Descriptor type: Endpoint
54
        DSCR_DEVQUAL     =   6  ; Descriptor type: Device Qualifier
55
        DSCR_DFUFUNC     =   0x21 ;  Descriptor type: DFU Functional
56
 
57
        DSCR_DEVICE_LEN  =  18
58
        DSCR_CONFIG_LEN  =   9
59
        DSCR_INTRFC_LEN  =   9
60
        DSCR_ENDPNT_LEN  =   7
61
        DSCR_DEVQUAL_LEN =  10
62
        DSCR_DFUFUNC_LEN =   9
63
 
64
        ET_CONTROL       =   0  ; Endpoint type: Control
65
        ET_ISO           =   1  ; Endpoint type: Isochronous
66
        ET_BULK          =   2  ; Endpoint type: Bulk
67
        ET_INT           =   3  ; Endpoint type: Interrupt
68
 
69
 
70
        ;; configuration attributes
71
        bmSELF_POWERED  =       1 << 6
72
 
73
;;; --------------------------------------------------------
74
;;;     external ram data
75
;;;--------------------------------------------------------
76
 
77
        .area USBDESCSEG    (XDATA)
78
 
79
;;; ----------------------------------------------------------------
80
;;; descriptors used when operating at high speed (480Mb/sec)
81
;;; ----------------------------------------------------------------
82
 
83
        .even   ; descriptors must be 2-byte aligned for SUDPTR{H,L} to work
84
 
85
        ;; The .even directive isn't really honored by the linker.  Bummer!
86
        ;; (There's no way to specify an alignment requirement for a given area,
87
        ;; hence when they're concatenated together, even doesn't work.)
88
        ;;
89
        ;; We work around this by telling the linker to put USBDESCSEG
90
        ;; at 0xE000 absolute.  This means that the maximimum length of this
91
        ;; segment is 480 bytes, leaving room for the two hash slots
92
        ;; at 0xE1EO to 0xE1FF.
93
        ;;
94
        ;; As of March 9, 2009, this segment is 398 bytes long
95
 
96
_high_speed_device_descr::
97
        .db     DSCR_DEVICE_LEN
98
        .db     DSCR_DEVICE
99
        .db     <0x0200                ; Specification version (LSB)
100
        .db     >0x0200         ; Specification version (MSB)
101
        .db     0x00            ; device class (see interface)
102
        .db     0x00            ; device subclass (see interface)
103
        .db     0x00            ; device protocol (see interface)
104
        .db     64              ; bMaxPacketSize0 for endpoint 0
105
        .db     
106
        .db     >VID_FREE       ; idVendor
107
        .db     
108
        .db     >PID_GECKO      ; idProduct
109
_usb_desc_hw_rev_binary_patch_location_0::
110
        .db     
111
        .db     >DID_GECKO      ; bcdDevice
112
        .db     SI_VENDOR       ; iManufacturer (string index)
113
        .db     SI_PRODUCT      ; iProduct (string index)
114
        .db     SI_SERIAL       ; iSerial number (string index)
115
        .db     1               ; bNumConfigurations
116
 
117
;;; describes the other speed (12Mb/sec)
118
        .even
119
_high_speed_devqual_descr::
120
        .db     DSCR_DEVQUAL_LEN
121
        .db     DSCR_DEVQUAL
122
        .db     <0x0200                ; bcdUSB (LSB)
123
        .db     >0x0200         ; bcdUSB (MSB)
124
        .db     0x00            ; bDeviceClass
125
        .db     0x00            ; bDeviceSubClass
126
        .db     0x00            ; bDeviceProtocol
127
        .db     64              ; bMaxPacketSize0
128
        .db     1               ; bNumConfigurations (one config at 12Mb/sec)
129
        .db     0                ; bReserved
130
 
131
        .even
132
_high_speed_config_descr::
133
        .db     DSCR_CONFIG_LEN
134
        .db     DSCR_CONFIG
135
        .db     <(_high_speed_config_descr_end - _high_speed_config_descr) ; LSB
136
        .db     >(_high_speed_config_descr_end - _high_speed_config_descr) ; MSB
137
        .db     2               ; bNumInterfaces
138
        .db     1               ; bConfigurationValue
139
        .db     0                ; iConfiguration
140
        .db     0x80 | bmSELF_POWERED ; bmAttributes
141
        .db     0                ; bMaxPower
142
 
143
        ;; interface descriptor 0 (USB TMC, ep2 OUT BULK, ep6 IN BULK)
144
 
145
        .db     DSCR_INTRFC_LEN
146
        .db     DSCR_INTRFC
147
        .db     0                ; bInterfaceNumber (zero based)
148
        .db     0                ; bAlternateSetting
149
        .db     2               ; bNumEndpoints
150
        .db     0xfe            ; bInterfaceClass (application class)
151
        .db     0x03            ; bInterfaceSubClass (USB TMC)
152
        .db     0x01            ; bInterfaceProtocol (USB TMC USB488 subclass device)
153
        .db     SI_USB_TMC      ; iInterface (description)
154
 
155
        ;; interface 0's OUT end point
156
 
157
        .db     DSCR_ENDPNT_LEN
158
        .db     DSCR_ENDPNT
159
        .db     0x02            ; bEndpointAddress (ep 2 OUT)
160
        .db     ET_BULK         ; bmAttributes
161
        .db     <512                ; wMaxPacketSize (LSB)
162
        .db     >512            ; wMaxPacketSize (MSB)
163
        .db     0                ; bInterval (iso only)
164
 
165
        ;; interface 0's IN end point
166
 
167
        .db     DSCR_ENDPNT_LEN
168
        .db     DSCR_ENDPNT
169
        .db     0x86            ; bEndpointAddress (ep 6 IN)
170
        .db     ET_BULK         ; bmAttributes
171
        .db     <512                ; wMaxPacketSize (LSB)
172
        .db     >512            ; wMaxPacketSize (MSB)
173
        .db     0                ; bInterval (iso only)
174
 
175
        ;; interface descriptor 1 (command & status, ep0 COMMAND)
176
 
177
;;      disabled since firmware version 0.4, use version 0.3 after production to set parameters
178
;;      .db     DSCR_INTRFC_LEN
179
;;      .db     DSCR_INTRFC
180
;;      .db     1               ; bInterfaceNumber (zero based)
181
;;      .db     0                ; bAlternateSetting
182
;;      .db     0                ; bNumEndpoints
183
;;      .db     0xff            ; bInterfaceClass (vendor specific)
184
;;      .db     0xff            ; bInterfaceSubClass (vendor specific)
185
;;      .db     0xff            ; bInterfaceProtocol (vendor specific)
186
;;      .db     SI_COMMAND_AND_STATUS   ; iInterface (description)
187
 
188
        ;; interface descriptor 2 (Run-Time DFU Interface descriptor)
189
 
190
        .db     DSCR_INTRFC_LEN
191
        .db     DSCR_INTRFC
192
        .db     1               ; bInterfaceNumber (zero based)
193
        .db     0                ; bAlternateSetting
194
        .db     0                ; bNumEndpoints
195
        .db     0xfe            ; bInterfaceClass (application specific)
196
        .db     0x01            ; bInterfaceSubClass (device firmware upgrade)
197
        .db     0x01            ; bInterfaceProtocol (runtime protocol)
198
        .db     SI_DFU          ; iInterface (description)
199
 
200
        ;; interface 2's functional descriptor
201
 
202
        .db     DSCR_DFUFUNC_LEN
203
        .db     DSCR_DFUFUNC
204
        .db     0x01            ; bmAttributes: no auto detach, no upload, yes download
205
        .db     <500                ; wDetachTimeOut (LSB)
206
        .db     >500            ; wDetachTimeOut (MSB)
207
        .db     <64                ; wMaxPacketSize (LSB)
208
        .db     >64             ; wMaxPacketSize (MSB)
209
        .db     <0x0001                ; bcdDFUVersion (LSB)
210
        .db     >0x0001         ; bcdDFUVersion (MSB)
211
_high_speed_config_descr_end:
212
 
213
;;; ----------------------------------------------------------------
214
;;; descriptors used when operating at full speed (12Mb/sec)
215
;;; ----------------------------------------------------------------
216
 
217
        .even
218
_full_speed_device_descr::
219
        .db     DSCR_DEVICE_LEN
220
        .db     DSCR_DEVICE
221
        .db     <0x0200                ; Specification version (LSB)
222
        .db     >0x0200         ; Specification version (MSB)
223
        .db     0x00            ; device class (see interface)
224
        .db     0x00            ; device subclass (see interface)
225
        .db     0x00            ; device protocol (see interface)
226
        .db     64              ; bMaxPacketSize0 for endpoint 0
227
        .db     
228
        .db     >VID_FREE       ; idVendor
229
        .db     
230
        .db     >PID_GECKO      ; idProduct
231
_usb_desc_hw_rev_binary_patch_location_1::
232
        .db     
233
        .db     >DID_GECKO      ; bcdDevice
234
        .db     SI_VENDOR       ; iManufacturer (string index)
235
        .db     SI_PRODUCT      ; iProduct (string index)
236
        .db     SI_SERIAL       ; iSerial number (None)
237
        .db     1               ; bNumConfigurations
238
 
239
 
240
;;; describes the other speed (480Mb/sec)
241
        .even
242
_full_speed_devqual_descr::
243
        .db     DSCR_DEVQUAL_LEN
244
        .db     DSCR_DEVQUAL
245
        .db     <0x0200                ; bcdUSB
246
        .db     >0x0200         ; bcdUSB
247
        .db     0x00            ; bDeviceClass
248
        .db     0x00            ; bDeviceSubClass
249
        .db     0x00            ; bDeviceProtocol
250
        .db     64              ; bMaxPacketSize0
251
        .db     1               ; bNumConfigurations (one config at 480Mb/sec)
252
        .db     0                ; bReserved
253
 
254
        .even
255
_full_speed_config_descr::
256
        .db     DSCR_CONFIG_LEN
257
        .db     DSCR_CONFIG
258
        .db     <(_full_speed_config_descr_end - _full_speed_config_descr) ; LSB
259
        .db     >(_full_speed_config_descr_end - _full_speed_config_descr) ; MSB
260
        .db     3               ; bNumInterfaces
261
        .db     1               ; bConfigurationValue
262
        .db     0                ; iConfiguration
263
        .db     0x80 | bmSELF_POWERED ; bmAttributes
264
        .db     0                ; bMaxPower
265
 
266
        ;; interface descriptor 0 (USB TMC, ep2 OUT BULK, ep6 IN BULK)
267
 
268
        .db     DSCR_INTRFC_LEN
269
        .db     DSCR_INTRFC
270
        .db     0                ; bInterfaceNumber (zero based)
271
        .db     0                ; bAlternateSetting
272
        .db     2               ; bNumEndpoints
273
        .db     0xfe            ; bInterfaceClass (application class)
274
        .db     0x03            ; bInterfaceSubClass (USB TMC)
275
        .db     0x01            ; bInterfaceProtocol (USB TMC USB488 subclass device)
276
        .db     SI_USB_TMC      ; iInterface (description)
277
 
278
        ;; interface 0's OUT end point
279
 
280
        .db     DSCR_ENDPNT_LEN
281
        .db     DSCR_ENDPNT
282
        .db     0x02            ; bEndpointAddress (ep 2 OUT)
283
        .db     ET_BULK         ; bmAttributes
284
        .db     <64                ; wMaxPacketSize (LSB)
285
        .db     >64             ; wMaxPacketSize (MSB)
286
        .db     0                ; bInterval (iso only)
287
 
288
        ;; interface 1's IN end point
289
 
290
        .db     DSCR_ENDPNT_LEN
291
        .db     DSCR_ENDPNT
292
        .db     0x86            ; bEndpointAddress (ep 6 IN)
293
        .db     ET_BULK         ; bmAttributes
294
        .db     <64                ; wMaxPacketSize (LSB)
295
        .db     >64             ; wMaxPacketSize (MSB)
296
        .db     0                ; bInterval (iso only)
297
 
298
        ;; interface descriptor 1 (command & status, ep0 COMMAND)
299
 
300
;;      disabled since firmware version 0.4, use version 0.3 after production to set parameters
301
;;      .db     DSCR_INTRFC_LEN
302
;;      .db     DSCR_INTRFC
303
;;      .db     1               ; bInterfaceNumber (zero based)
304
;;      .db     0                ; bAlternateSetting
305
;;      .db     0                ; bNumEndpoints
306
;;      .db     0xff            ; bInterfaceClass (vendor specific)
307
;;      .db     0xff            ; bInterfaceSubClass (vendor specific)
308
;;      .db     0xff            ; bInterfaceProtocol (vendor specific)
309
;;      .db     SI_COMMAND_AND_STATUS   ; iInterface (description)
310
 
311
        ;; interface descriptor 2 (Run-Time DFU Interface descriptor)
312
 
313
        .db     DSCR_INTRFC_LEN
314
        .db     DSCR_INTRFC
315
        .db     1               ; bInterfaceNumber (zero based)
316
        .db     0                ; bAlternateSetting
317
        .db     0                ; bNumEndpoints
318
        .db     0xfe            ; bInterfaceClass (application specific)
319
        .db     0x01            ; bInterfaceSubClass (device firmware upgrade)
320
        .db     0x01            ; bInterfaceProtocol (runtime protocol)
321
        .db     SI_DFU          ; iInterface (description)
322
 
323
        ;; interface 2's functional descriptor
324
 
325
        .db     DSCR_DFUFUNC_LEN
326
        .db     DSCR_DFUFUNC
327
        .db     0x01            ; bmAttributes: no auto detach, no upload, yes download
328
        .db     <500                ; wDetachTimeOut (LSB)
329
        .db     >500            ; wDetachTimeOut (MSB)
330
        .db     <64                ; wMaxPacketSize (LSB)
331
        .db     >64             ; wMaxPacketSize (MSB)
332
        .db     <0x0001                ; bcdDFUVersion (LSB)
333
        .db     >0x0001         ; bcdDFUVersion (MSB)
334
_full_speed_config_descr_end:
335
 
336
;;; ----------------------------------------------------------------
337
;;; descriptors used when operating in DFU class mode
338
;;; ----------------------------------------------------------------
339
 
340
        .even
341
_dfu_mode_device_descr::
342
        .db     DSCR_DEVICE_LEN
343
        .db     DSCR_DEVICE
344
        .db     <0x0100                ; Specification version (LSB)
345
        .db     >0x0100         ; Specification version (MSB)
346
        .db     0x00            ; device class (see interface)
347
        .db     0x00            ; device subclass (see interface)
348
        .db     0x00            ; device protocol (see interface)
349
        .db     64              ; bMaxPacketSize0 for endpoint 0
350
        .db     
351
        .db     >VID_FREE       ; idVendor
352
        .db     
353
        .db     >PID_DFU        ; idProduct
354
_usb_desc_hw_rev_binary_patch_location_2::
355
        .db     
356
        .db     >DID_GECKO      ; bcdDevice
357
        .db     SI_VENDOR       ; iManufacturer (string index)
358
        .db     SI_PRODUCT      ; iProduct (string index)
359
        .db     SI_SERIAL       ; iSerial number (None)
360
        .db     1               ; bNumConfigurations
361
 
362
        .even
363
_dfu_mode_config_descr::
364
        .db     DSCR_CONFIG_LEN
365
        .db     DSCR_CONFIG
366
        .db     <(_dfu_mode_config_descr_end - _dfu_mode_config_descr) ; LSB
367
        .db     >(_dfu_mode_config_descr_end - _dfu_mode_config_descr) ; MSB
368
        .db     1               ; bNumInterfaces
369
        .db     1               ; bConfigurationValue
370
        .db     0                ; iConfiguration
371
        .db     0x80 | bmSELF_POWERED ; bmAttributes
372
        .db     0                ; bMaxPower
373
 
374
        ;; interface descriptor 0 (command & status, ep0 COMMAND)
375
 
376
        .db     DSCR_INTRFC_LEN
377
        .db     DSCR_INTRFC
378
        .db     0                ; bInterfaceNumber (zero based)
379
        .db     0                ; bAlternateSetting
380
        .db     0                ; bNumEndpoints
381
        .db     0xfe            ; bInterfaceClass (vendor specific)
382
        .db     0x01            ; bInterfaceSubClass (vendor specific)
383
        .db     0x02            ; bInterfaceProtocol (vendor specific)
384
        .db     SI_DFU          ; iInterface (description)
385
_dfu_mode_config_descr_end:
386
 
387
_dfu_mode_functional_descr::
388
        .db     DSCR_DFUFUNC_LEN
389
        .db     DSCR_DFUFUNC
390
        .db     0x01            ; bmAttributes: no auto detach, no upload, yes download
391
        .db     <500                ; wDetachTimeOut (LSB)
392
        .db     >500            ; wDetachTimeOut (MSB)
393
        .db     <64                ; wMaxPacketSize (LSB)
394
        .db     >64             ; wMaxPacketSize (MSB)
395
        .db     <0x0001                ; bcdDFUVersion (LSB)
396
        .db     >0x0001         ; bcdDFUVersion (MSB)
397
 
398
 
399
;;; ----------------------------------------------------------------
400
;;;                     string descriptors
401
;;; ----------------------------------------------------------------
402
 
403
_nstring_descriptors::
404
        .db     (_string_descriptors_end - _string_descriptors) / 2
405
 
406
_string_descriptors::
407
        .db     str0
408
        .db     str1
409
        .db     str2
410
        .db     str3
411
        .db     str4
412
        .db     str5
413
        .db     str6
414
_string_descriptors_end:
415
 
416
        SI_NONE = 0
417
        ;; str0 contains the language ID's.
418
        .even
419
str0:   .db     str0_end - str0
420
        .db     DSCR_STRING
421
        .db     0
422
        .db     0
423
        .db     <0x0409                ; magic code for US English (LSB)
424
        .db     >0x0409         ; magic code for US English (MSB)
425
str0_end:
426
 
427
        SI_VENDOR = 1
428
        .even
429
str1:   .db     str1_end - str1
430
        .db     DSCR_STRING
431
        .db     'M, 0           ; 16-bit unicode
432
        .db     'i, 0
433
        .db     'c, 0
434
        .db     'r, 0
435
        .db     'o, 0
436
        .db     'L, 0
437
        .db     'a, 0
438
        .db     'b, 0
439
        .db     ' , 0
440
        .db     'B, 0
441
        .db     'F, 0
442
        .db     'H, 0
443
        .db     '-, 0
444
        .db     'T, 0
445
        .db     'I, 0
446
str1_end:
447
 
448
        SI_PRODUCT = 2
449
        .even
450
str2:   .db     str2_end - str2
451
        .db     DSCR_STRING
452
        .db     'G, 0
453
        .db     'E, 0
454
        .db     'C, 0
455
        .db     'K, 0
456
        .db     'O, 0
457
        .db     '3, 0
458
        .db     'C, 0
459
        .db     'O, 0
460
        .db     'M, 0
461
str2_end:
462
 
463
        SI_COMMAND_AND_STATUS = 3
464
        .even
465
str3:   .db     str3_end - str3
466
        .db     DSCR_STRING
467
        .db     'C, 0
468
        .db     'o, 0
469
        .db     'm, 0
470
        .db     'm, 0
471
        .db     'a, 0
472
        .db     'n, 0
473
        .db     'd, 0
474
        .db     ' , 0
475
        .db     '&, 0
476
        .db     ' , 0
477
        .db     'S, 0
478
        .db     't, 0
479
        .db     'a, 0
480
        .db     't, 0
481
        .db     'u, 0
482
        .db     's, 0
483
str3_end:
484
 
485
        SI_USB_TMC = 4
486
        .even
487
str4:   .db     str4_end - str4
488
        .db     DSCR_STRING
489
        .db     'U, 0
490
        .db     'S, 0
491
        .db     'B, 0
492
        .db     'T, 0
493
        .db     'M, 0
494
        .db     'C, 0
495
        .db     ' , 0
496
        .db     'U, 0
497
        .db     'S, 0
498
        .db     'B, 0
499
        .db     '4, 0
500
        .db     '8, 0
501
        .db     '8, 0
502
str4_end:
503
 
504
        SI_DFU = 5
505
        .even
506
str5:   .db     str5_end - str5
507
        .db     DSCR_STRING
508
        .db     'G, 0
509
        .db     'E, 0
510
        .db     'C, 0
511
        .db     'K, 0
512
        .db     'O, 0
513
        .db     '3, 0
514
        .db     'C, 0
515
        .db     'O, 0
516
        .db     'M, 0
517
        .db     ' , 0
518
        .db     'F, 0
519
        .db     'W, 0
520
        .db     ' , 0
521
        .db     'U, 0
522
        .db     'P, 0
523
        .db     'D, 0
524
        .db     'A, 0
525
        .db     'T, 0
526
        .db     'E, 0
527
str5_end:
528
 
529
        SI_SERIAL = 6
530
        .even
531
str6:   .db     str6_end - str6
532
        .db     DSCR_STRING
533
_usb_desc_serial_number_ascii::
534
        .db     '3, 0
535
        .db     '., 0
536
        .db     '1, 0
537
        .db     '4, 0
538
        .db     '1, 0
539
        .db     '5, 0
540
        .db     '9, 0
541
        .db     '3, 0
542
str6_end:
543
 

powered by: WebSVN 2.1.0

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