forked from svn2github/ixo-usb-jtag
-
Notifications
You must be signed in to change notification settings - Fork 30
/
dscr.a51.in
311 lines (272 loc) · 12.8 KB
/
dscr.a51.in
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
;;; -*- asm -*-
;;;
;;;-----------------------------------------------------------------------------
;;; USB Descriptor(s)
;;;-----------------------------------------------------------------------------
;;; Copyright 2005..2007 Kolja Waschk, ixo.de
;;;-----------------------------------------------------------------------------
;;; Code based on USRP2 firmware (GNU Radio Project), version 3.0.2,
;;; Copyright 2003 Free Software Foundation, Inc.
;;;-----------------------------------------------------------------------------
;;; This code is part of usbjtag. usbjtag 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 2 of the License,
;;; or (at your option) any later version. usbjtag 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 this program in the file
;;; COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin
;;; St, Fifth Floor, Boston, MA 02110-1301 USA
;;;-----------------------------------------------------------------------------
.module usb_descriptors
VID = 0x16C0 ; Vendor ID 0x16C0
PID = 0x06AD ; Product ID 0x06AD
VERSION = 0x0004 ; Product Version (4 indicates *BM device)
USB_VER = 0x0110 ; Support USB version 1.10
USB_ATTR = 0x80 ; Bus powered, not self-powered, no remote wakeup
FTD_ATTR = 0x001C ; Set USB version, use version string, enable suspend PD
MAX_POWER = 75 ; need 2*75 mA max
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
;;; --------------------------------------------------------
;;; external ram data
;;;--------------------------------------------------------
.area USBDESCSEG (XDATA)
.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 absolute address 0xE100 (see LDFLAGS in Makefile).
;;; ----------------------------------------------------------------
;;; descriptors used when operating at high speed (480Mb/sec)
;;; ----------------------------------------------------------------
_high_speed_device_descr::
.db DSCR_DEVICE_LEN
.db DSCR_DEVICE
_dscr_usbver::
.db <USB_VER ; Specification version (LSB)
.db >USB_VER ; Specification version (MSB)
.db 0x00 ; device class (vendor specific)
.db 0x00 ; device subclass (vendor specific)
.db 0x00 ; device protocol (vendor specific)
.db 64 ; bMaxPacketSize0 for endpoint 0
_dscr_vidpidver::
.db <VID ; idVendor
.db >VID ; idVendor
.db <PID ; idProduct
.db >PID ; idProduct
.db <VERSION ; bcdDevice
.db >VERSION ; bcdDevice
_dscr_strorder::
.db SI_VENDOR ; iManufacturer (string index)
.db SI_PRODUCT ; iProduct (string index)
.db SI_SERIAL ; iSerial number (string index)
.db 1 ; bNumConfigurations
.even
_high_speed_devqual_descr::
.db DSCR_DEVQUAL_LEN
.db DSCR_DEVQUAL
.db <USB_VER ; bcdUSB (LSB)
.db >USB_VER ; 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 1 ; bNumInterfaces
.db 1 ; bConfigurationValue
.db 0 ; iConfiguration
_dscr_attrpow::
.db USB_ATTR ; bmAttributes
.db MAX_POWER ; bMaxPower [Unit: 0.5 mA]
;; interface descriptor
.db DSCR_INTRFC_LEN
.db DSCR_INTRFC
.db 0 ; bInterfaceNumber (zero based)
.db 0 ; bAlternateSetting
.db 2 ; bNumEndpoints
.db 0xFF ; bInterfaceClass (vendor specific)
.db 0xFF ; bInterfaceSubClass (vendor specific)
.db 0xFF ; bInterfaceProtocol (vendor specific)
.db SI_PRODUCT ; iInterface (description)
;; endpoint descriptor
.db DSCR_ENDPNT_LEN
.db DSCR_ENDPNT
.db 0x81 ; bEndpointAddress (EP 1 IN)
.db ET_BULK ; bmAttributes
.db <64 ; wMaxPacketSize (LSB)
.db >64 ; wMaxPacketSize (MSB)
.db 0 ; bInterval (iso only)
;; endpoint descriptor
.db DSCR_ENDPNT_LEN
.db DSCR_ENDPNT
.db 0x02 ; bEndpointAddress (EP 2 OUT)
.db ET_BULK ; bmAttributes
;;; TODO (HD): Sune Mai's version has the following two values at 512 ?
;;; --> compare with EP2CFG in usbjtag.c
.db <64 ; wMaxPacketSize (LSB)
.db >64 ; 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 <USB_VER ; Specification version (LSB)
.db >USB_VER ; Specification version (MSB)
.db 0x00 ; device class (vendor specific)
.db 0x00 ; device subclass (vendor specific)
.db 0x00 ; device protocol (vendor specific)
.db 64 ; bMaxPacketSize0 for endpoint 0
.db <VID ; idVendor
.db >VID ; idVendor
.db <PID ; idProduct
.db >PID ; idProduct
.db <VERSION ; bcdDevice
.db >VERSION ; bcdDevice
.db SI_VENDOR ; iManufacturer (string index)
.db SI_PRODUCT ; iProduct (string index)
.db SI_SERIAL ; 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 <USB_VER ; bcdUSB
.db >USB_VER ; 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 USB_ATTR ; bmAttributes
.db MAX_POWER ; bMaxPower [Unit: 0.5 mA]
;; interface descriptor
.db DSCR_INTRFC_LEN
.db DSCR_INTRFC
.db 0 ; bInterfaceNumber (zero based)
.db 0 ; bAlternateSetting
.db 2 ; bNumEndpoints
.db 0xFF ; bInterfaceClass (vendor specific)
.db 0xFF ; bInterfaceSubClass (vendor specific)
.db 0xFF ; bInterfaceProtocol (vendor specific)
.db SI_PRODUCT ; iInterface (description)
;; endpoint descriptor
.db DSCR_ENDPNT_LEN
.db DSCR_ENDPNT
.db 0x81 ; bEndpointAddress (ep 1 IN)
.db ET_BULK ; bmAttributes
.db <64 ; wMaxPacketSize (LSB)
.db >64 ; wMaxPacketSize (MSB)
.db 0 ; bInterval (iso only)
;; endpoint descriptor
.db DSCR_ENDPNT_LEN
.db DSCR_ENDPNT
.db 0x02 ; bEndpointAddress (ep 1 IN)
.db ET_BULK ; bmAttributes
.db <64 ; wMaxPacketSize (LSB)
.db >64 ; wMaxPacketSize (MSB)
.db 0 ; bInterval (iso only)
_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
_string_descriptors_end:
SI_NONE = 0
;; str0 contains the language ID's.
.even
_str0::
str0: .db str0_end - str0
.db DSCR_STRING
.db <0x0409 ; magic code for US English (LSB)
.db >0x0409 ; magic code for US English (MSB)
str0_end:
SI_VENDOR = 1
.even
_str1::
str1: .db str1_end - str1
.db DSCR_STRING
.db 'i, 0 ; 16-bit unicode
.db 'x, 0
.db 'o, 0
.db '., 0
.db 'd, 0
.db 'e, 0
str1_end:
SI_PRODUCT = 2
.even
_str2::
str2: .db str2_end - str2
.db DSCR_STRING
.db 'U, 0
.db 'S, 0
.db 'B, 0
.db '-, 0
.db 'J, 0
.db 'T, 0
.db 'A, 0
.db 'G, 0
.db '-, 0
.db 'I, 0
.db 'F, 0
str2_end:
SI_SERIAL = 3
.even
_str3::
str3: .db str3_end - str3
.db DSCR_STRING
.db '$H0, 0
.db '$H1, 0
.db '$H2, 0
.db '$H3, 0
.db '$H4, 0
.db '$H5, 0
.db '$H6, 0
.db '$H7, 0
.db '$H8, 0
.db '$H9, 0
str3_end: