-
Notifications
You must be signed in to change notification settings - Fork 2
/
dscr.a51
230 lines (207 loc) · 6.27 KB
/
dscr.a51
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
; Copyright (C) 2009 Ubixum, Inc.
;
; This library is free software; you can redistribute it and/or
; modify it under the terms of the GNU Lesser General Public
; License as published by the Free Software Foundation; either
; version 2.1 of the License, or (at your option) any later version.
;
; This library 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
; Lesser General Public License for more details.
;
; You should have received a copy of the GNU Lesser General Public
; License along with this library; if not, write to the Free Software
; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
; this is a the default
; full speed and high speed
; descriptors found in the TRM
; change however you want but leave
; the descriptor pointers so the setupdat.c file works right
.module DEV_DSCR
; descriptor types
; same as setupdat.h
DSCR_DEVICE_TYPE=1
DSCR_CONFIG_TYPE=2
DSCR_STRING_TYPE=3
DSCR_INTERFACE_TYPE=4
DSCR_ENDPOINT_TYPE=5
DSCR_DEVQUAL_TYPE=6
; for the repeating interfaces
DSCR_INTERFACE_LEN=9
DSCR_ENDPOINT_LEN=7
; endpoint types
ENDPOINT_TYPE_CONTROL=0
ENDPOINT_TYPE_ISO=1
ENDPOINT_TYPE_BULK=2
ENDPOINT_TYPE_INT=3
.globl _dev_dscr, _dev_qual_dscr, _highspd_dscr, _fullspd_dscr, _dev_strings, _dev_strings_end
; These need to be in code memory. If
; they aren't you'll have to manully copy them somewhere
; in code memory otherwise SUDPTRH:L don't work right
.area DSCR_AREA (CODE)
_dev_dscr:
.db dev_dscr_end-_dev_dscr ; len
.db DSCR_DEVICE_TYPE ; type
.dw 0x0002 ; usb 2.0
.db 0x00 ; class (vendor specific)
.db 0x00 ; subclass (vendor specific)
.db 0x00 ; protocol (vendor specific)
.db 64 ; packet size (ep0)
.dw 0xFD03 ; vendor id
.dw 0x0800 ; product id
.dw 0x0000 ; version id
.db 1 ; manufacturure str idx
.db 2 ; product str idx
.db 0 ; serial str idx
.db 1 ; n configurations
dev_dscr_end:
_dev_qual_dscr:
.db dev_qualdscr_end-_dev_qual_dscr
.db DSCR_DEVQUAL_TYPE
.dw 0x0002 ; usb 2.0
.db 0x00
.db 0x00
.db 0x00
.db 64 ; max packet
.db 5 ; n configs
.db 0 ; extra reserved byte
dev_qualdscr_end:
_highspd_dscr:
.db highspd_dscr_end-_highspd_dscr ; dscr len ;; Descriptor length
.db DSCR_CONFIG_TYPE
; can't use .dw because byte order is different
.db (highspd_dscr_realend-_highspd_dscr) % 256 ; total length of config lsb
.db (highspd_dscr_realend-_highspd_dscr) / 256 ; total length of config msb
.db 1 ; n interfaces
.db 1 ; config number
.db 0 ; config string
.db 0x80 ; attrs = bus powered, no wakeup
.db 0x1E ; max power = 75ma
highspd_dscr_end:
; all the interfaces next
; NOTE the default TRM actually has more alt interfaces
; but you can add them back in if you need them.
; here, we just use the default alt setting 1 from the trm
.db DSCR_INTERFACE_LEN
.db DSCR_INTERFACE_TYPE
.db 0 ; index
.db 0 ; alt setting idx
.db 2 ; n endpoints
.db 0xff ; class
.db 0x00
.db 0x00
.db 0 ; string index
; endpoint 2 out
.db DSCR_ENDPOINT_LEN
.db DSCR_ENDPOINT_TYPE
.db 0x02 ; ep2 dir=OUT and address
.db ENDPOINT_TYPE_BULK ; type
.db 0x00 ; max packet LSB
.db 0x02 ; max packet size=512 bytes
.db 0x00 ; polling interval
; endpoint 6 in
.db DSCR_ENDPOINT_LEN
.db DSCR_ENDPOINT_TYPE
.db 0x86 ; ep6 dir=in and address
.db ENDPOINT_TYPE_BULK ; type
.db 0x00 ; max packet LSB
.db 0x02 ; max packet size=512 bytes
.db 0x00 ; polling interval
highspd_dscr_realend:
.even
_fullspd_dscr:
.db fullspd_dscr_end-_fullspd_dscr ; dscr len
.db DSCR_CONFIG_TYPE
; can't use .dw because byte order is different
.db (fullspd_dscr_realend-_fullspd_dscr) % 256 ; total length of config lsb
.db (fullspd_dscr_realend-_fullspd_dscr) / 256 ; total length of config msb
.db 1 ; n interfaces
.db 2 ; config number
.db 0 ; config string
.db 0x80 ; attrs = bus powered, no wakeup
.db 0x1E ; max power = 75ma
fullspd_dscr_end:
; all the interfaces next
; NOTE the default TRM actually has more alt interfaces
; but you can add them back in if you need them.
; here, we just use the default alt setting 1 from the trm
.db DSCR_INTERFACE_LEN
.db DSCR_INTERFACE_TYPE
.db 0 ; index
.db 0 ; alt setting idx
.db 2 ; n endpoints
.db 0xff ; class
.db 0x00
.db 0x00
.db 0 ; string index
; endpoint 2 out
.db DSCR_ENDPOINT_LEN
.db DSCR_ENDPOINT_TYPE
.db 0x02 ; ep2 dir=OUT and address
.db ENDPOINT_TYPE_BULK ; type
.db 0x40 ; max packet LSB
.db 0x00 ; max packet size=64 bytes
.db 0x00 ; polling interval
; endpoint 6 in
.db DSCR_ENDPOINT_LEN
.db DSCR_ENDPOINT_TYPE
.db 0x86 ; ep6 dir=in and address
.db ENDPOINT_TYPE_BULK ; type
.db 0x40 ; max packet LSB
.db 0x00 ; max packet size=64 bytes
.db 0x00 ; polling interval 0xEB
fullspd_dscr_realend:
.even
_dev_strings:
; sample string
_string0:
.db string0end-_string0 ; len
.db DSCR_STRING_TYPE
.db 0x09, 0x04 ; who knows
string0end:
; add more strings here
_string1:
.db string1end-_string1
.db DSCR_STRING_TYPE
.ascii 'X'
.db 0
.ascii 'I'
.db 0
.ascii 'L'
.db 0
.ascii 'I'
.db 0
.ascii 'N'
.db 0
.ascii 'X'
.db 0
.ascii ' '
.db 0
string1end:
_string2:
.db string2end-_string2
.db DSCR_STRING_TYPE
.ascii 'X'
.db 0
.ascii 'I'
.db 0
.ascii 'L'
.db 0
.ascii 'I'
.db 0
.ascii 'N'
.db 0
.ascii 'X'
.db 0
.ascii ' '
.db 0
.ascii ' '
.db 0
.ascii ' '
.db 0
.db 0
.db 0
string2end:
_dev_strings_end:
.dw 0x0000 ; just in case someone passes an index higher than the end to the firmware