]>
Commit | Line | Data |
---|---|---|
1 | ;; | |
2 | ;; This file is part of the fx2lafw project. | |
3 | ;; | |
4 | ;; Copyright (C) 2011-2012 Uwe Hermann <uwe@hermann-uwe.de> | |
5 | ;; | |
6 | ;; This program is free software; you can redistribute it and/or modify | |
7 | ;; it under the terms of the GNU General Public License as published by | |
8 | ;; the Free Software Foundation; either version 2 of the License, or | |
9 | ;; (at your option) any later version. | |
10 | ;; | |
11 | ;; This program is distributed in the hope that it will be useful, | |
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | ;; GNU General Public License for more details. | |
15 | ;; | |
16 | ;; You should have received a copy of the GNU General Public License | |
17 | ;; along with this program; if not, write to the Free Software | |
18 | ;; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | ;; | |
20 | ||
21 | .module DEV_DSCR | |
22 | ||
23 | ; Descriptor types | |
24 | DSCR_DEVICE_TYPE = 1 | |
25 | DSCR_CONFIG_TYPE = 2 | |
26 | DSCR_STRING_TYPE = 3 | |
27 | DSCR_INTERFACE_TYPE = 4 | |
28 | DSCR_ENDPOINT_TYPE = 5 | |
29 | DSCR_DEVQUAL_TYPE = 6 | |
30 | ||
31 | ; Descriptor lengths | |
32 | DSCR_INTERFACE_LEN = 9 | |
33 | DSCR_ENDPOINT_LEN = 7 | |
34 | ||
35 | ; Endpoint types | |
36 | ENDPOINT_TYPE_CONTROL = 0 | |
37 | ENDPOINT_TYPE_ISO = 1 | |
38 | ENDPOINT_TYPE_BULK = 2 | |
39 | ENDPOINT_TYPE_INT = 3 | |
40 | ||
41 | .globl _dev_dscr, _dev_qual_dscr, _highspd_dscr, _fullspd_dscr, _dev_strings, _dev_strings_end | |
42 | .area DSCR_AREA (CODE) | |
43 | ||
44 | ; ----------------------------------------------------------------------------- | |
45 | ; Device descriptor | |
46 | ; ----------------------------------------------------------------------------- | |
47 | _dev_dscr: | |
48 | .db dev_dscr_end - _dev_dscr | |
49 | .db DSCR_DEVICE_TYPE | |
50 | .dw 0x0002 ; USB 2.0 | |
51 | .db 0xff ; Class (vendor specific) | |
52 | .db 0xff ; Subclass (vendor specific) | |
53 | .db 0xff ; Protocol (vendor specific) | |
54 | .db 64 ; Max. EP0 packet size | |
55 | .dw 0xa908 ; Manufacturer ID (0x08a9) | |
56 | .dw 0x1400 ; Product ID (0x0014) | |
57 | .dw 0x0100 ; Product version (0.01) | |
58 | .db 1 ; Manufacturer string index | |
59 | .db 2 ; Product string index | |
60 | .db 0 ; Serial number string index (none) | |
61 | .db 1 ; Number of configurations | |
62 | dev_dscr_end: | |
63 | ||
64 | ; ----------------------------------------------------------------------------- | |
65 | ; Device qualifier (for "other device speed") | |
66 | ; ----------------------------------------------------------------------------- | |
67 | _dev_qual_dscr: | |
68 | .db dev_qualdscr_end - _dev_qual_dscr | |
69 | .db DSCR_DEVQUAL_TYPE | |
70 | .dw 0x0002 ; USB 2.0 | |
71 | .db 0xff ; Class (vendor specific) | |
72 | .db 0xff ; Subclass (vendor specific) | |
73 | .db 0xff ; Protocol (vendor specific) | |
74 | .db 64 ; Max. EP0 packet size | |
75 | .db 1 ; Number of configurations | |
76 | .db 0 ; Extra reserved byte | |
77 | dev_qualdscr_end: | |
78 | ||
79 | ; ----------------------------------------------------------------------------- | |
80 | ; High-Speed configuration descriptor | |
81 | ; ----------------------------------------------------------------------------- | |
82 | _highspd_dscr: | |
83 | .db highspd_dscr_end - _highspd_dscr | |
84 | .db DSCR_CONFIG_TYPE | |
85 | ; Total length of the configuration (1st line LSB, 2nd line MSB) | |
86 | .db (highspd_dscr_realend - _highspd_dscr) % 256 | |
87 | .db (highspd_dscr_realend - _highspd_dscr) / 256 | |
88 | .db 1 ; Number of interfaces | |
89 | .db 1 ; Configuration number | |
90 | .db 0 ; Configuration string (none) | |
91 | .db 0x80 ; Attributes (bus powered, no wakeup) | |
92 | .db 0x32 ; Max. power (100mA) | |
93 | highspd_dscr_end: | |
94 | ||
95 | ; Interfaces (only one in our case) | |
96 | .db DSCR_INTERFACE_LEN | |
97 | .db DSCR_INTERFACE_TYPE | |
98 | .db 0 ; Interface index | |
99 | .db 0 ; Alternate setting index | |
100 | .db 2 ; Number of endpoints | |
101 | .db 0xff ; Class (vendor specific) | |
102 | .db 0xff ; Subclass (vendor specific) | |
103 | .db 0xff ; Protocol (vendor specific) | |
104 | .db 0 ; String index (none) | |
105 | ||
106 | ; Endpoint 2 (IN) | |
107 | .db DSCR_ENDPOINT_LEN | |
108 | .db DSCR_ENDPOINT_TYPE | |
109 | .db 0x82 ; EP number (2), direction (IN) | |
110 | .db ENDPOINT_TYPE_BULK ; Endpoint type (bulk) | |
111 | .db 0x00 ; Max. packet size, LSB (512 bytes) | |
112 | .db 0x02 ; Max. packet size, MSB (512 bytes) | |
113 | .db 0x00 ; Polling interval | |
114 | ||
115 | ; Endpoint 6 (IN) | |
116 | .db DSCR_ENDPOINT_LEN | |
117 | .db DSCR_ENDPOINT_TYPE | |
118 | .db 0x86 ; EP number (6), direction (IN) | |
119 | .db ENDPOINT_TYPE_BULK ; Endpoint type (bulk) | |
120 | .db 0x00 ; Max. packet size, LSB (512 bytes) | |
121 | .db 0x02 ; Max. packet size, MSB (512 bytes) | |
122 | .db 0x00 ; Polling interval | |
123 | ||
124 | highspd_dscr_realend: | |
125 | ||
126 | .even | |
127 | ||
128 | ; ----------------------------------------------------------------------------- | |
129 | ; Full-Speed configuration descriptor | |
130 | ; ----------------------------------------------------------------------------- | |
131 | _fullspd_dscr: | |
132 | .db fullspd_dscr_end - _fullspd_dscr | |
133 | .db DSCR_CONFIG_TYPE | |
134 | ; Total length of the configuration (1st line LSB, 2nd line MSB) | |
135 | .db (fullspd_dscr_realend - _fullspd_dscr) % 256 | |
136 | .db (fullspd_dscr_realend - _fullspd_dscr) / 256 | |
137 | .db 1 ; Number of interfaces | |
138 | .db 1 ; Configuration number | |
139 | .db 0 ; Configuration string (none) | |
140 | .db 0x80 ; Attributes (bus powered, no wakeup) | |
141 | .db 0x32 ; Max. power (100mA) | |
142 | fullspd_dscr_end: | |
143 | ||
144 | ; Interfaces (only one in our case) | |
145 | .db DSCR_INTERFACE_LEN | |
146 | .db DSCR_INTERFACE_TYPE | |
147 | .db 0 ; Interface index | |
148 | .db 0 ; Alternate setting index | |
149 | .db 2 ; Number of endpoints | |
150 | .db 0xff ; Class (vendor specific) | |
151 | .db 0xff ; Subclass (vendor specific) | |
152 | .db 0xff ; Protocol (vendor specific) | |
153 | .db 0 ; String index (none) | |
154 | ||
155 | ; Endpoint 2 (IN) | |
156 | .db DSCR_ENDPOINT_LEN | |
157 | .db DSCR_ENDPOINT_TYPE | |
158 | .db 0x82 ; EP number (2), direction (IN) | |
159 | .db ENDPOINT_TYPE_BULK ; Endpoint type (bulk) | |
160 | .db 0x40 ; Max. packet size, LSB (64 bytes) | |
161 | .db 0x00 ; Max. packet size, MSB (64 bytes) | |
162 | .db 0x00 ; Polling interval | |
163 | ||
164 | ; Endpoint 6 (IN) | |
165 | .db DSCR_ENDPOINT_LEN | |
166 | .db DSCR_ENDPOINT_TYPE | |
167 | .db 0x86 ; EP number (6), direction (IN) | |
168 | .db ENDPOINT_TYPE_BULK ; Endpoint type (bulk) | |
169 | .db 0x40 ; Max. packet size, LSB (64 bytes) | |
170 | .db 0x00 ; Max. packet size, MSB (64 bytes) | |
171 | .db 0x00 ; Polling interval | |
172 | ||
173 | fullspd_dscr_realend: | |
174 | ||
175 | .even | |
176 | ||
177 | ; ----------------------------------------------------------------------------- | |
178 | ; Strings | |
179 | ; ----------------------------------------------------------------------------- | |
180 | ||
181 | _dev_strings: | |
182 | ||
183 | ; See http://www.usb.org/developers/docs/USB_LANGIDs.pdf for the full list. | |
184 | _string0: | |
185 | .db string0end - _string0 | |
186 | .db DSCR_STRING_TYPE | |
187 | .db 0x09, 0x04 ; Language code 0x0409 (English, US) | |
188 | string0end: | |
189 | ||
190 | _string1: | |
191 | .db string1end - _string1 | |
192 | .db DSCR_STRING_TYPE | |
193 | .ascii 's' | |
194 | .db 0 | |
195 | .ascii 'i' | |
196 | .db 0 | |
197 | .ascii 'g' | |
198 | .db 0 | |
199 | .ascii 'r' | |
200 | .db 0 | |
201 | .ascii 'o' | |
202 | .db 0 | |
203 | .ascii 'k' | |
204 | .db 0 | |
205 | string1end: | |
206 | ||
207 | _string2: | |
208 | .db string2end - _string2 | |
209 | .db DSCR_STRING_TYPE | |
210 | .ascii 'f' | |
211 | .db 0 | |
212 | .ascii 'x' | |
213 | .db 0 | |
214 | .ascii '2' | |
215 | .db 0 | |
216 | .ascii 'l' | |
217 | .db 0 | |
218 | .ascii 'a' | |
219 | .db 0 | |
220 | .ascii 'f' | |
221 | .db 0 | |
222 | .ascii 'w' | |
223 | .db 0 | |
224 | string2end: | |
225 | ||
226 | _dev_strings_end: | |
227 | .dw 0x0000 | |
228 |