]> sigrok.org Git - sigrok-firmware-fx2lafw.git/blob - include/dscr.inc
Use per-device USB serial number strings.
[sigrok-firmware-fx2lafw.git] / include / dscr.inc
1 ;;
2 ;; This file is part of the sigrok-firmware-fx2lafw project.
3 ;;
4 ;; Copyright (C) 2011-2012 Uwe Hermann <uwe@hermann-uwe.de>
5 ;; Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
6 ;;
7 ;; This program is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 2 of the License, or
10 ;; (at your option) any later version.
11 ;;
12 ;; This program is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ;; GNU General Public License for more details.
16 ;;
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with this program; if not, write to the Free Software
19 ;; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
20 ;;
21
22 .include "common.inc"
23
24 .module DEV_DSCR
25
26 ; Descriptor types
27 DSCR_DEVICE_TYPE        = 1
28 DSCR_CONFIG_TYPE        = 2
29 DSCR_STRING_TYPE        = 3
30 DSCR_INTERFACE_TYPE     = 4
31 DSCR_ENDPOINT_TYPE      = 5
32 DSCR_DEVQUAL_TYPE       = 6
33
34 ; Descriptor lengths
35 DSCR_INTERFACE_LEN      = 9
36 DSCR_ENDPOINT_LEN       = 7
37
38 ; Endpoint types
39 ENDPOINT_TYPE_CONTROL   = 0
40 ENDPOINT_TYPE_ISO       = 1
41 ENDPOINT_TYPE_BULK      = 2
42 ENDPOINT_TYPE_INT       = 3
43
44 .globl _dev_dscr, _dev_qual_dscr, _highspd_dscr, _fullspd_dscr, _dev_strings, _dev_strings_end
45 .area DSCR_AREA (CODE)
46
47 ; -----------------------------------------------------------------------------
48 ; Device descriptor
49 ; -----------------------------------------------------------------------------
50 _dev_dscr:
51         .db     dev_dscr_end - _dev_dscr
52         .db     DSCR_DEVICE_TYPE
53         .dw     0x0002                  ; USB 2.0
54         .db     0xff                    ; Class (vendor specific)
55         .db     0xff                    ; Subclass (vendor specific)
56         .db     0xff                    ; Protocol (vendor specific)
57         .db     64                      ; Max. EP0 packet size
58         .dw     VID                     ; Manufacturer ID
59         .dw     PID                     ; Product ID
60         .dw     0x0100                  ; Product version (0.01)
61         .db     1                       ; Manufacturer string index
62         .db     2                       ; Product string index
63         .db     3                       ; Serial number string index (none)
64         .db     1                       ; Number of configurations
65 dev_dscr_end:
66
67 ; -----------------------------------------------------------------------------
68 ; Device qualifier (for "other device speed")
69 ; -----------------------------------------------------------------------------
70 _dev_qual_dscr:
71         .db     dev_qualdscr_end - _dev_qual_dscr
72         .db     DSCR_DEVQUAL_TYPE
73         .dw     0x0002                  ; USB 2.0
74         .db     0xff                    ; Class (vendor specific)
75         .db     0xff                    ; Subclass (vendor specific)
76         .db     0xff                    ; Protocol (vendor specific)
77         .db     64                      ; Max. EP0 packet size
78         .db     1                       ; Number of configurations
79         .db     0                       ; Extra reserved byte
80 dev_qualdscr_end:
81
82 ; -----------------------------------------------------------------------------
83 ; High-Speed configuration descriptor
84 ; -----------------------------------------------------------------------------
85 _highspd_dscr:
86         .db     highspd_dscr_end - _highspd_dscr
87         .db     DSCR_CONFIG_TYPE
88         ; Total length of the configuration (1st line LSB, 2nd line MSB)
89         .db     (highspd_dscr_realend - _highspd_dscr) % 256
90         .db     (highspd_dscr_realend - _highspd_dscr) / 256
91         .db     1                       ; Number of interfaces
92         .db     1                       ; Configuration number
93         .db     0                       ; Configuration string (none)
94         .db     0x80                    ; Attributes (bus powered, no wakeup)
95         .db     0x32                    ; Max. power (100mA)
96 highspd_dscr_end:
97
98         ; Interfaces (only one in our case)
99         .db     DSCR_INTERFACE_LEN
100         .db     DSCR_INTERFACE_TYPE
101         .db     0                       ; Interface index
102         .db     0                       ; Alternate setting index
103         .db     1                       ; Number of endpoints
104         .db     0xff                    ; Class (vendor specific)
105         .db     0xff                    ; Subclass (vendor specific)
106         .db     0xff                    ; Protocol (vendor specific)
107         .db     0                       ; String index (none)
108
109         ; Endpoint 2 (IN)
110         .db     DSCR_ENDPOINT_LEN
111         .db     DSCR_ENDPOINT_TYPE
112         .db     0x82                    ; EP number (2), direction (IN)
113         .db     ENDPOINT_TYPE_BULK      ; Endpoint type (bulk)
114         .db     0x00                    ; Max. packet size, LSB (512 bytes)
115         .db     0x02                    ; Max. packet size, MSB (512 bytes)
116         .db     0x00                    ; Polling interval (ignored for bulk)
117
118 highspd_dscr_realend:
119
120         .even
121
122 ; -----------------------------------------------------------------------------
123 ; Full-Speed configuration descriptor
124 ; -----------------------------------------------------------------------------
125 _fullspd_dscr:
126         .db     fullspd_dscr_end - _fullspd_dscr
127         .db     DSCR_CONFIG_TYPE
128         ; Total length of the configuration (1st line LSB, 2nd line MSB)
129         .db     (fullspd_dscr_realend - _fullspd_dscr) % 256
130         .db     (fullspd_dscr_realend - _fullspd_dscr) / 256
131         .db     1                       ; Number of interfaces
132         .db     1                       ; Configuration number
133         .db     0                       ; Configuration string (none)
134         .db     0x80                    ; Attributes (bus powered, no wakeup)
135         .db     0x32                    ; Max. power (100mA)
136 fullspd_dscr_end:
137
138         ; Interfaces (only one in our case)
139         .db     DSCR_INTERFACE_LEN
140         .db     DSCR_INTERFACE_TYPE
141         .db     0                       ; Interface index
142         .db     0                       ; Alternate setting index
143         .db     1                       ; Number of endpoints
144         .db     0xff                    ; Class (vendor specific)
145         .db     0xff                    ; Subclass (vendor specific)
146         .db     0xff                    ; Protocol (vendor specific)
147         .db     0                       ; String index (none)
148
149         ; Endpoint 2 (IN)
150         .db     DSCR_ENDPOINT_LEN
151         .db     DSCR_ENDPOINT_TYPE
152         .db     0x82                    ; EP number (2), direction (IN)
153         .db     ENDPOINT_TYPE_BULK      ; Endpoint type (bulk)
154         .db     0x40                    ; Max. packet size, LSB (64 bytes)
155         .db     0x00                    ; Max. packet size, MSB (64 bytes)
156         .db     0x00                    ; Polling interval (ignored for bulk)
157
158 fullspd_dscr_realend:
159
160         .even
161
162 ; -----------------------------------------------------------------------------
163 ; Strings
164 ; -----------------------------------------------------------------------------
165
166 _dev_strings:
167
168 ; See http://www.usb.org/developers/docs/USB_LANGIDs.pdf for the full list.
169 string_descriptor_lang 0 0x0409 ; Language code 0x0409 (English, US)
170
171 string_descriptor_a 1,^"sigrok"
172 string_descriptor_a 2,^"fx2lafw"