]> sigrok.org Git - sigrok-firmware-fx2lafw.git/blob - include/dscr.inc
configure.ac: Bump package version to 0.1.5.
[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, see <http://www.gnu.org/licenses/>.
19 ;;
20
21 .include "common.inc"
22
23 .module DEV_DSCR
24
25 ; Descriptor types
26 DSCR_DEVICE_TYPE        = 1
27 DSCR_CONFIG_TYPE        = 2
28 DSCR_STRING_TYPE        = 3
29 DSCR_INTERFACE_TYPE     = 4
30 DSCR_ENDPOINT_TYPE      = 5
31 DSCR_DEVQUAL_TYPE       = 6
32
33 ; Descriptor lengths
34 DSCR_INTERFACE_LEN      = 9
35 DSCR_ENDPOINT_LEN       = 7
36
37 ; Endpoint types
38 ENDPOINT_TYPE_CONTROL   = 0
39 ENDPOINT_TYPE_ISO       = 1
40 ENDPOINT_TYPE_BULK      = 2
41 ENDPOINT_TYPE_INT       = 3
42
43 .globl _dev_dscr, _dev_qual_dscr, _highspd_dscr, _fullspd_dscr, _dev_strings, _dev_strings_end
44 .area DSCR_AREA (CODE)
45
46 ; -----------------------------------------------------------------------------
47 ; Device descriptor
48 ; -----------------------------------------------------------------------------
49 _dev_dscr:
50         .db     dev_dscr_end - _dev_dscr
51         .db     DSCR_DEVICE_TYPE
52         .dw     0x0002                  ; USB 2.0
53         .db     0xff                    ; Class (vendor specific)
54         .db     0xff                    ; Subclass (vendor specific)
55         .db     0xff                    ; Protocol (vendor specific)
56         .db     64                      ; Max. EP0 packet size
57         .dw     VID                     ; Manufacturer ID
58         .dw     PID                     ; Product ID
59         .dw     0x0100                  ; Product version (0.01)
60         .db     1                       ; Manufacturer string index
61         .db     2                       ; Product string index
62         .db     3                       ; Serial number string index (none)
63         .db     1                       ; Number of configurations
64 dev_dscr_end:
65
66 ; -----------------------------------------------------------------------------
67 ; Device qualifier (for "other device speed")
68 ; -----------------------------------------------------------------------------
69 _dev_qual_dscr:
70         .db     dev_qualdscr_end - _dev_qual_dscr
71         .db     DSCR_DEVQUAL_TYPE
72         .dw     0x0002                  ; USB 2.0
73         .db     0xff                    ; Class (vendor specific)
74         .db     0xff                    ; Subclass (vendor specific)
75         .db     0xff                    ; Protocol (vendor specific)
76         .db     64                      ; Max. EP0 packet size
77         .db     1                       ; Number of configurations
78         .db     0                       ; Extra reserved byte
79 dev_qualdscr_end:
80
81 ; -----------------------------------------------------------------------------
82 ; High-Speed configuration descriptor
83 ; -----------------------------------------------------------------------------
84 _highspd_dscr:
85         .db     highspd_dscr_end - _highspd_dscr
86         .db     DSCR_CONFIG_TYPE
87         ; Total length of the configuration (1st line LSB, 2nd line MSB)
88         .db     (highspd_dscr_realend - _highspd_dscr) % 256
89         .db     (highspd_dscr_realend - _highspd_dscr) / 256
90         .db     1                       ; Number of interfaces
91         .db     1                       ; Configuration number
92         .db     0                       ; Configuration string (none)
93         .db     0x80                    ; Attributes (bus powered, no wakeup)
94         .db     0x32                    ; Max. power (100mA)
95 highspd_dscr_end:
96
97         ; Interfaces (only one in our case)
98         .db     DSCR_INTERFACE_LEN
99         .db     DSCR_INTERFACE_TYPE
100         .db     0                       ; Interface index
101         .db     0                       ; Alternate setting index
102         .db     1                       ; Number of endpoints
103         .db     0xff                    ; Class (vendor specific)
104         .db     0xff                    ; Subclass (vendor specific)
105         .db     0xff                    ; Protocol (vendor specific)
106         .db     0                       ; String index (none)
107
108         ; Endpoint 2 (IN)
109         .db     DSCR_ENDPOINT_LEN
110         .db     DSCR_ENDPOINT_TYPE
111         .db     0x82                    ; EP number (2), direction (IN)
112         .db     ENDPOINT_TYPE_BULK      ; Endpoint type (bulk)
113         .db     0x00                    ; Max. packet size, LSB (512 bytes)
114         .db     0x02                    ; Max. packet size, MSB (512 bytes)
115         .db     0x00                    ; Polling interval (ignored for bulk)
116
117 highspd_dscr_realend:
118
119         .even
120
121 ; -----------------------------------------------------------------------------
122 ; Full-Speed configuration descriptor
123 ; -----------------------------------------------------------------------------
124 _fullspd_dscr:
125         .db     fullspd_dscr_end - _fullspd_dscr
126         .db     DSCR_CONFIG_TYPE
127         ; Total length of the configuration (1st line LSB, 2nd line MSB)
128         .db     (fullspd_dscr_realend - _fullspd_dscr) % 256
129         .db     (fullspd_dscr_realend - _fullspd_dscr) / 256
130         .db     1                       ; Number of interfaces
131         .db     1                       ; Configuration number
132         .db     0                       ; Configuration string (none)
133         .db     0x80                    ; Attributes (bus powered, no wakeup)
134         .db     0x32                    ; Max. power (100mA)
135 fullspd_dscr_end:
136
137         ; Interfaces (only one in our case)
138         .db     DSCR_INTERFACE_LEN
139         .db     DSCR_INTERFACE_TYPE
140         .db     0                       ; Interface index
141         .db     0                       ; Alternate setting index
142         .db     1                       ; Number of endpoints
143         .db     0xff                    ; Class (vendor specific)
144         .db     0xff                    ; Subclass (vendor specific)
145         .db     0xff                    ; Protocol (vendor specific)
146         .db     0                       ; String index (none)
147
148         ; Endpoint 2 (IN)
149         .db     DSCR_ENDPOINT_LEN
150         .db     DSCR_ENDPOINT_TYPE
151         .db     0x82                    ; EP number (2), direction (IN)
152         .db     ENDPOINT_TYPE_BULK      ; Endpoint type (bulk)
153         .db     0x40                    ; Max. packet size, LSB (64 bytes)
154         .db     0x00                    ; Max. packet size, MSB (64 bytes)
155         .db     0x00                    ; Polling interval (ignored for bulk)
156
157 fullspd_dscr_realend:
158
159         .even
160
161 ; -----------------------------------------------------------------------------
162 ; Strings
163 ; -----------------------------------------------------------------------------
164
165 _dev_strings:
166
167 ; See http://www.usb.org/developers/docs/USB_LANGIDs.pdf for the full list.
168 string_descriptor_lang 0 0x0409 ; Language code 0x0409 (English, US)
169
170 string_descriptor_a 1,^"sigrok"
171 string_descriptor_a 2,^"fx2lafw"