]> sigrok.org Git - sigrok-firmware-fx2lafw.git/blob - fx2lib/fw/dscr.a51
Import fx2lib into fx2lafw directly.
[sigrok-firmware-fx2lafw.git] / fx2lib / fw / dscr.a51
1 ; Copyright (C) 2009 Ubixum, Inc. 
2 ;
3 ; This library is free software; you can redistribute it and/or
4 ; modify it under the terms of the GNU Lesser General Public
5 ; License as published by the Free Software Foundation; either
6 ; version 2.1 of the License, or (at your option) any later version.
7
8 ; This library is distributed in the hope that it will be useful,
9 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 ; Lesser General Public License for more details.
12
13 ; You should have received a copy of the GNU Lesser General Public
14 ; License along with this library; if not, write to the Free Software
15 ; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
16
17 ; this is a the default 
18 ; full speed and high speed 
19 ; descriptors found in the TRM
20 ; change however you want but leave 
21 ; the descriptor pointers so the setupdat.c file works right
22  
23
24 .module DEV_DSCR 
25
26 ; descriptor types
27 ; same as setupdat.h
28 DSCR_DEVICE_TYPE=1
29 DSCR_CONFIG_TYPE=2
30 DSCR_STRING_TYPE=3
31 DSCR_INTERFACE_TYPE=4
32 DSCR_ENDPOINT_TYPE=5
33 DSCR_DEVQUAL_TYPE=6
34
35 ; for the repeating interfaces
36 DSCR_INTERFACE_LEN=9
37 DSCR_ENDPOINT_LEN=7
38
39 ; endpoint types
40 ENDPOINT_TYPE_CONTROL=0
41 ENDPOINT_TYPE_ISO=1
42 ENDPOINT_TYPE_BULK=2
43 ENDPOINT_TYPE_INT=3
44
45     .globl      _dev_dscr, _dev_qual_dscr, _highspd_dscr, _fullspd_dscr, _dev_strings, _dev_strings_end
46 ; These need to be in code memory.  If
47 ; they aren't you'll have to manully copy them somewhere
48 ; in code memory otherwise SUDPTRH:L don't work right
49     .area       DSCR_AREA       (CODE)
50
51 _dev_dscr:
52         .db     dev_dscr_end-_dev_dscr    ; len
53         .db     DSCR_DEVICE_TYPE                  ; type
54         .dw     0x0002                                    ; usb 2.0
55         .db     0xff                                      ; class (vendor specific)
56         .db     0xff                                      ; subclass (vendor specific)
57         .db     0xff                                      ; protocol (vendor specific)
58         .db     64                                                ; packet size (ep0)
59         .dw     0xB404                                    ; vendor id 
60         .dw     0x1386                                    ; product id
61         .dw     0x0100                                    ; version id
62         .db     0                                 ; manufacturure str idx                               
63         .db     2                                         ; product str idx     
64         .db     0                                         ; serial str idx 
65         .db     1                                     ; n configurations
66 dev_dscr_end:
67
68 _dev_qual_dscr:
69         .db     dev_qualdscr_end-_dev_qual_dscr
70         .db     DSCR_DEVQUAL_TYPE
71         .dw     0x0002                              ; usb 2.0
72         .db     0xff
73         .db     0xff
74         .db     0xff
75         .db     64                                  ; max packet
76         .db     1                                                                       ; n configs
77         .db     0                                                                       ; extra reserved byte
78 dev_qualdscr_end:
79
80 _highspd_dscr:
81         .db     highspd_dscr_end-_highspd_dscr      ; dscr len                                                                                  ;; Descriptor length
82         .db     DSCR_CONFIG_TYPE
83     ; can't use .dw because byte order is different
84         .db     (highspd_dscr_realend-_highspd_dscr) % 256 ; total length of config lsb
85         .db     (highspd_dscr_realend-_highspd_dscr) / 256 ; total length of config msb
86         .db     1                                                                ; n interfaces
87         .db     1                                                                ; config number
88         .db     0                                                                ; config string
89         .db     0x80                             ; attrs = bus powered, no wakeup
90         .db     0x32                             ; max power = 100ma
91 highspd_dscr_end:
92
93 ; all the interfaces next 
94 ; NOTE the default TRM actually has more alt interfaces
95 ; but you can add them back in if you need them.
96 ; here, we just use the default alt setting 1 from the trm
97         .db     DSCR_INTERFACE_LEN
98         .db     DSCR_INTERFACE_TYPE
99         .db     0                                ; index
100         .db     0                                ; alt setting idx
101         .db     6                                ; n endpoints  
102         .db     0xff                     ; class
103         .db     0xff
104         .db     0xff
105         .db     0                    ; string index     
106
107 ; endpoint 1 out
108         .db     DSCR_ENDPOINT_LEN
109         .db     DSCR_ENDPOINT_TYPE
110         .db     0x01                            ;  ep1 dir=out and address
111         .db     ENDPOINT_TYPE_BULK      ; type
112         .db     0x00                            ; max packet LSB
113         .db     0x02                            ; max packet size=512 bytes
114         .db     0x00                            ; polling interval
115       
116 ; endpoint 1 in 
117         .db     DSCR_ENDPOINT_LEN
118         .db     DSCR_ENDPOINT_TYPE
119         .db     0x81                            ;  ep1 dir=in and address
120         .db     ENDPOINT_TYPE_BULK      ; type
121         .db     0x00                            ; max packet LSB
122         .db     0x02                            ; max packet size=512 bytes
123         .db     0x00                            ; polling interval
124
125 ; endpoint 2 out
126         .db     DSCR_ENDPOINT_LEN
127         .db     DSCR_ENDPOINT_TYPE
128         .db     0x02                            ;  ep2 dir=OUT and address
129         .db     ENDPOINT_TYPE_BULK      ; type
130         .db     0x00                            ; max packet LSB
131         .db     0x02                            ; max packet size=512 bytes
132         .db     0x00                            ; polling interval
133
134 ; endpoint 4 out
135         .db     DSCR_ENDPOINT_LEN
136         .db     DSCR_ENDPOINT_TYPE
137         .db     0x04                            ;  ep4 dir=OUT and address
138         .db     ENDPOINT_TYPE_BULK      ; type
139         .db     0x00                            ; max packet LSB
140         .db     0x02                            ; max packet size=512 bytes
141         .db     0x00                            ; polling interval
142
143 ; endpoint 6 in
144         .db     DSCR_ENDPOINT_LEN
145         .db     DSCR_ENDPOINT_TYPE
146         .db     0x86                            ;  ep6 dir=in and address
147         .db     ENDPOINT_TYPE_BULK      ; type
148         .db     0x00                            ; max packet LSB
149         .db     0x02                            ; max packet size=512 bytes
150         .db     0x00                            ; polling interval
151
152 ; endpoint 8 in
153         .db     DSCR_ENDPOINT_LEN
154         .db     DSCR_ENDPOINT_TYPE
155         .db     0x88                            ;  ep8 dir=in and address
156         .db     ENDPOINT_TYPE_BULK      ; type
157         .db     0x00                            ; max packet LSB
158         .db     0x02                            ; max packet size=512 bytes
159         .db     0x00                            ; polling interval
160 highspd_dscr_realend:
161
162 .even
163 _fullspd_dscr:
164         .db     fullspd_dscr_end-_fullspd_dscr      ; dscr len
165         .db     DSCR_CONFIG_TYPE
166     ; can't use .dw because byte order is different
167         .db     (fullspd_dscr_realend-_fullspd_dscr) % 256 ; total length of config lsb
168         .db     (fullspd_dscr_realend-_fullspd_dscr) / 256 ; total length of config msb
169         .db     1                                                                ; n interfaces
170         .db     1                                                                ; config number
171         .db     0                                                                ; config string
172         .db     0x80                             ; attrs = bus powered, no wakeup
173         .db     0x32                             ; max power = 100ma
174 fullspd_dscr_end:
175
176 ; all the interfaces next 
177 ; NOTE the default TRM actually has more alt interfaces
178 ; but you can add them back in if you need them.
179 ; here, we just use the default alt setting 1 from the trm
180         .db     DSCR_INTERFACE_LEN
181         .db     DSCR_INTERFACE_TYPE
182         .db     0                                ; index
183         .db     0                                ; alt setting idx
184         .db     6                                ; n endpoints  
185         .db     0xff                     ; class
186         .db     0xff
187         .db     0xff
188         .db     0                    ; string index     
189
190 ; endpoint 1 out
191         .db     DSCR_ENDPOINT_LEN
192         .db     DSCR_ENDPOINT_TYPE
193         .db     0x01                            ;  ep1 dir=out and address
194         .db     ENDPOINT_TYPE_BULK      ; type
195         .db     0x40                            ; max packet LSB
196         .db     0x00                            ; max packet size=64 bytes
197         .db     0x00                            ; polling interval
198       
199 ; endpoint 1 in 
200         .db     DSCR_ENDPOINT_LEN
201         .db     DSCR_ENDPOINT_TYPE
202         .db     0x81                            ;  ep1 dir=in and address
203         .db     ENDPOINT_TYPE_BULK      ; type
204         .db     0x40                            ; max packet LSB
205         .db     0x00                            ; max packet size=64 bytes
206         .db     0x00                            ; polling interval
207
208 ; endpoint 2 out
209         .db     DSCR_ENDPOINT_LEN
210         .db     DSCR_ENDPOINT_TYPE
211         .db     0x02                            ;  ep2 dir=OUT and address
212         .db     ENDPOINT_TYPE_BULK      ; type
213         .db     0x40                            ; max packet LSB
214         .db     0x00                            ; max packet size=64 bytes
215         .db     0x00                            ; polling interval
216
217 ; endpoint 4 out
218         .db     DSCR_ENDPOINT_LEN
219         .db     DSCR_ENDPOINT_TYPE
220         .db     0x04                            ;  ep4 dir=OUT and address
221         .db     ENDPOINT_TYPE_BULK      ; type
222         .db     0x40                            ; max packet LSB
223         .db     0x00                            ; max packet size=64 bytes
224         .db     0x00                            ; polling interval
225
226 ; endpoint 6 in
227         .db     DSCR_ENDPOINT_LEN
228         .db     DSCR_ENDPOINT_TYPE
229         .db     0x86                            ;  ep6 dir=in and address
230         .db     ENDPOINT_TYPE_BULK      ; type
231         .db     0x40                            ; max packet LSB
232         .db     0x00                            ; max packet size=64 bytes
233         .db     0x00                            ; polling interval
234 ; endpoint 6 in
235         .db     DSCR_ENDPOINT_LEN
236         .db     DSCR_ENDPOINT_TYPE
237         .db     0x88                            ;  ep6 dir=in and address
238         .db     ENDPOINT_TYPE_BULK      ; type
239         .db     0x40                            ; max packet LSB
240         .db     0x00                            ; max packet size=64 bytes
241         .db     0x00                            ; polling interval
242 fullspd_dscr_realend:
243
244 .even
245 _dev_strings:
246 ; sample string
247 _string0:
248         .db     string0end-_string0 ; len
249         .db     DSCR_STRING_TYPE
250     .db 0x09, 0x04 ; 0x0409 is the language code for English.  Possible to add more codes after this. 
251 string0end:
252 ; add more strings here
253
254
255 _dev_strings_end:
256     .dw 0x0000  ; in case you wanted to look at memory between _dev_strings and _dev_strings_end