]> sigrok.org Git - sigrok-firmware-fx2lafw.git/blob - fx2lib/examples/bulkloop/dscr.a51
Import fx2lib into fx2lafw directly.
[sigrok-firmware-fx2lafw.git] / fx2lib / examples / bulkloop / 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     0x0410                                    ; product id
61         .dw     0x0100                                    ; version id
62         .db     1                                 ; 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     2                                ; n endpoints  
102         .db     0xff                     ; class
103         .db     0xff
104         .db     0xff
105         .db     3                    ; string index     
106
107 ; endpoint 2 out
108         .db     DSCR_ENDPOINT_LEN
109         .db     DSCR_ENDPOINT_TYPE
110         .db     0x02                            ;  ep2 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 6 in
117         .db     DSCR_ENDPOINT_LEN
118         .db     DSCR_ENDPOINT_TYPE
119         .db     0x86                            ;  ep6 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 highspd_dscr_realend:
126
127     .even
128 _fullspd_dscr:
129         .db     fullspd_dscr_end-_fullspd_dscr      ; dscr len
130         .db     DSCR_CONFIG_TYPE
131     ; can't use .dw because byte order is different
132         .db     (fullspd_dscr_realend-_fullspd_dscr) % 256 ; total length of config lsb
133         .db     (fullspd_dscr_realend-_fullspd_dscr) / 256 ; total length of config msb
134         .db     1                                                                ; n interfaces
135         .db     1                                                                ; config number
136         .db     0                                                                ; config string
137         .db     0x80                             ; attrs = bus powered, no wakeup
138         .db     0x32                             ; max power = 100ma
139 fullspd_dscr_end:
140
141 ; all the interfaces next 
142 ; NOTE the default TRM actually has more alt interfaces
143 ; but you can add them back in if you need them.
144 ; here, we just use the default alt setting 1 from the trm
145         .db     DSCR_INTERFACE_LEN
146         .db     DSCR_INTERFACE_TYPE
147         .db     0                                ; index
148         .db     0                                ; alt setting idx
149         .db     2                                ; n endpoints  
150         .db     0xff                     ; class
151         .db     0xff
152         .db     0xff
153         .db     3                    ; string index     
154
155 ; endpoint 2 out
156         .db     DSCR_ENDPOINT_LEN
157         .db     DSCR_ENDPOINT_TYPE
158         .db     0x02                            ;  ep2 dir=OUT and address
159         .db     ENDPOINT_TYPE_BULK      ; type
160         .db     0x40                            ; max packet LSB
161         .db     0x00                            ; max packet size=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                            ;  ep6 dir=in and address
168         .db     ENDPOINT_TYPE_BULK      ; type
169         .db     0x40                            ; max packet LSB
170         .db     0x00                            ; max packet size=64 bytes
171         .db     0x00                            ; polling interval
172
173 fullspd_dscr_realend:
174
175 .even
176 _dev_strings:
177 ; sample string
178 _string0:
179         .db     string0end-_string0 ; len
180         .db     DSCR_STRING_TYPE
181     .db 0x09, 0x04     ; who knows
182 string0end:
183 ; add more strings here
184
185 _string1:
186     .db string1end-_string1
187     .db DSCR_STRING_TYPE
188     .ascii 'H'
189     .db 0
190     .ascii 'i'
191     .db 0
192 string1end:
193
194 _string2:
195     .db string2end-_string2
196     .db DSCR_STRING_TYPE
197     .ascii 'T'
198     .db 0
199     .ascii 'h'
200     .db 0
201     .ascii 'e'
202     .db 0
203     .ascii 'r'
204     .db 0
205     .ascii 'e'
206     .db 0
207 string2end:
208
209 _string3:
210     .db string3end-_string3
211     .db DSCR_STRING_TYPE
212     .ascii 'i'
213     .db 0
214     .ascii 'F'
215     .db 0
216     .ascii 'a'
217     .db 0
218     .ascii 'c'
219     .db 0
220     .ascii 'e'
221     .db 0
222 string3end:
223     
224 _dev_strings_end:
225     .dw 0x0000   ; just in case someone passes an index higher than the end to the firmware