From: Uwe Hermann Date: Wed, 10 Aug 2016 06:07:32 +0000 (+0200) Subject: dscr_hantek_6022be.inc: Cosmetic and consistency changes. X-Git-Tag: sigrok-firmware-fx2lafw-0.1.4~19 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e0c25b8e13abdba0de4dc57006dc195f4200b38a;p=sigrok-firmware-fx2lafw.git dscr_hantek_6022be.inc: Cosmetic and consistency changes. This makes the file a lot more readable and also easier to compare to the other dscr.inc files. Also, fix some typos (or copy-paste errors) in some comments. --- diff --git a/include/dscr_hantek_6022be.inc b/include/dscr_hantek_6022be.inc index 03ffa54b..2e61b14e 100644 --- a/include/dscr_hantek_6022be.inc +++ b/include/dscr_hantek_6022be.inc @@ -18,345 +18,349 @@ ;; 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) - +.module DEV_DSCR + +; Descriptor types +DSCR_DEVICE_TYPE = 1 +DSCR_CONFIG_TYPE = 2 +DSCR_STRING_TYPE = 3 +DSCR_INTERFACE_TYPE = 4 +DSCR_ENDPOINT_TYPE = 5 +DSCR_DEVQUAL_TYPE = 6 + +; Descriptor lengths +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 +.area DSCR_AREA (CODE) + +; ----------------------------------------------------------------------------- +; Device descriptor +; ----------------------------------------------------------------------------- _dev_dscr: - .db dev_dscr_end-_dev_dscr ; len - .db DSCR_DEVICE_TYPE ; type - .dw 0x0002 ; usb 2.0 - .db 0xff ; class (vendor specific) - .db 0xff ; subclass (vendor specific) - .db 0xff ; protocol (vendor specific) - .db 64 ; packet size (ep0) - .dw VID ; vendor id - .dw PID ; 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 + .db dev_dscr_end - _dev_dscr + .db DSCR_DEVICE_TYPE + .dw 0x0002 ; USB 2.0 + .db 0xff ; Class (vendor specific) + .db 0xff ; Subclass (vendor specific) + .db 0xff ; Protocol (vendor specific) + .db 64 ; Max. EP0 packet size + .dw VID ; Manufacturer ID + .dw PID ; Product ID + .dw 0x0000 ; Product version (0.00) + .db 1 ; Manufacturer string index + .db 2 ; Product string index + .db 0 ; Serial number string index (none) + .db 1 ; Number of configurations dev_dscr_end: +; ----------------------------------------------------------------------------- +; Device qualifier (for "other device speed") +; ----------------------------------------------------------------------------- _dev_qual_dscr: - .db dev_qualdscr_end-_dev_qual_dscr + .db dev_qualdscr_end - _dev_qual_dscr .db DSCR_DEVQUAL_TYPE - .dw 0x0002 ; usb 2.0 - .db 0 - .db 0 - .db 0 - .db 64 ; max packet - .db 1 ; n configs - .db 0 ; extra reserved byte + .dw 0x0002 ; USB 2.0 + .db 0 ; Class (0) + .db 0 ; Subclass (0) + .db 0 ; Protocol (0) + .db 64 ; Max. EP0 packet size + .db 1 ; Number of configurations + .db 0 ; Extra reserved byte dev_qualdscr_end: +; ----------------------------------------------------------------------------- +; High-Speed configuration descriptor +; ----------------------------------------------------------------------------- _highspd_dscr: - .db highspd_dscr_end-_highspd_dscr ; dscr len ;; Descriptor length + .db highspd_dscr_end - _highspd_dscr .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 55 ; max power = 110mA + ; Total length of the configuration (1st line LSB, 2nd line MSB) + .db (highspd_dscr_realend - _highspd_dscr) % 256 + .db (highspd_dscr_realend - _highspd_dscr) / 256 + .db 1 ; Number of interfaces + .db 1 ; Configuration number + .db 0 ; Configuration string (none) + .db 0x80 ; Attributes (bus powered, no wakeup) + .db 0x37 ; Max. power (110mA) highspd_dscr_end: -; all the interfaces next -; BULK interface + ; Bulk interface 0, alt 0 .db DSCR_INTERFACE_LEN .db DSCR_INTERFACE_TYPE - .db 0 ; index - .db 0 ; alt setting idx - .db 1 ; n endpoints - .db 0xff ; class - .db 0 - .db 0 - .db 0 ; string index - -; endpoint 6 in + .db 0 ; Interface index + .db 0 ; Alternate setting index + .db 1 ; Number of endpoints + .db 0xff ; Class (vendor specific) + .db 0 ; Subclass (0) + .db 0 ; Protocol (0) + .db 0 ; String index (none) + + ; Endpoint 6 (IN) .db DSCR_ENDPOINT_LEN .db DSCR_ENDPOINT_TYPE - .db 0x86 ; ep1 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 + .db 0x86 ; EP number (6), direction (IN) + .db ENDPOINT_TYPE_BULK ; Endpoint type (bulk) + .db 0x00 ; Max. packet size, LSB (512 bytes) + .db 0x02 ; Max. packet size, MSB (512 bytes) + .db 0x00 ; Polling interval -; ISOCHRONOUS interface + ; Isochronous interface 0, alt 1 .db DSCR_INTERFACE_LEN .db DSCR_INTERFACE_TYPE - .db 0 ; index - .db 1 ; alt setting idx - .db 1 ; n endpoints - .db 0xff ; class - .db 0 - .db 1 - .db 0 ; string index - -; endpoint 2 in + .db 0 ; Interface index + .db 1 ; Alternate setting index + .db 1 ; Number of endpoints + .db 0xff ; Class (vendor specific) + .db 0 ; Subclass (0) + .db 1 ; Protocol (1) + .db 0 ; String index (none) + + ; Endpoint 2 (IN) .db DSCR_ENDPOINT_LEN .db DSCR_ENDPOINT_TYPE - .db 0x82 ; ep1 dir=in and address - .db ENDPOINT_TYPE_ISO ; type - .db 0x00 ; max packet LSB - .db 0x14 ; max packet size=3*1024 bytes - .db 0x01 ; polling interval + .db 0x82 ; EP number (2), direction (IN) + .db ENDPOINT_TYPE_ISO ; Endpoint type (iso) + .db 0x00 ; Max. packet size, LSB (3*1024 bytes) + .db 0x14 ; Max. packet size, MSB (3*1024 bytes) + .db 0x01 ; Polling interval -; ISOCHRONOUS interface 16MB/s + ; Isochronous interface 0, alt 2, 16MB/s .db DSCR_INTERFACE_LEN .db DSCR_INTERFACE_TYPE - .db 0 ; index - .db 2 ; alt setting idx - .db 1 ; n endpoints - .db 0xff ; class - .db 0 - .db 1 - .db 0 ; string index - -; endpoint 2 in + .db 0 ; Interface index + .db 2 ; Alternate setting index + .db 1 ; Number of endpoints + .db 0xff ; Class (vendor specific) + .db 0 ; Subclass (0) + .db 1 ; Protocol (1) + .db 0 ; String index (none) + + ; Endpoint 2 (IN) .db DSCR_ENDPOINT_LEN .db DSCR_ENDPOINT_TYPE - .db 0x82 ; ep1 dir=in and address - .db ENDPOINT_TYPE_ISO ; type - .db 0x00 ; max packet LSB - .db 0x0c ; max packet size=2*1024 bytes - .db 0x01 ; polling interval + .db 0x82 ; EP number (2), direction (IN) + .db ENDPOINT_TYPE_ISO ; Endpoint type (iso) + .db 0x00 ; Max. packet size, LSB (2*1024 bytes) + .db 0x0c ; Max. packet size, MSB (2*1024 bytes) + .db 0x01 ; Polling interval -; ISOCHRONOUS interface 8MB/s + ; Isochronous interface 0, alt 3, 8MB/s .db DSCR_INTERFACE_LEN .db DSCR_INTERFACE_TYPE - .db 0 ; index - .db 3 ; alt setting idx - .db 1 ; n endpoints - .db 0xff ; class - .db 0 - .db 1 - .db 0 ; string index - -; endpoint 2 in + .db 0 ; Interface index + .db 3 ; Alternate setting index + .db 1 ; Number of endpoints + .db 0xff ; Class (vendor specific) + .db 0 ; Subclass (0) + .db 1 ; Protocol (1) + .db 0 ; String index (none) + + ; Endpoint 2 (IN) .db DSCR_ENDPOINT_LEN .db DSCR_ENDPOINT_TYPE - .db 0x82 ; ep1 dir=in and address - .db ENDPOINT_TYPE_ISO ; type - .db 0x00 ; max packet LSB - .db 0x04 ; max packet size=1024 bytes - .db 0x01 ; polling interval + .db 0x82 ; EP number (2), direction (IN) + .db ENDPOINT_TYPE_ISO ; Endpoint type (iso) + .db 0x00 ; Max. packet size, LSB (1024 bytes) + .db 0x04 ; Max. packet size, MSB (1024 bytes) + .db 0x01 ; Polling interval -; ISOCHRONOUS interface 4MB/s + ; Isochronous interface 0, alt 4, 4MB/s .db DSCR_INTERFACE_LEN .db DSCR_INTERFACE_TYPE - .db 0 ; index - .db 4 ; alt setting idx - .db 1 ; n endpoints - .db 0xff ; class - .db 0 - .db 1 - .db 0 ; string index - -; endpoint 2 in + .db 0 ; Interface index + .db 4 ; Alternate setting index + .db 1 ; Number of endpoints + .db 0xff ; Class (vendor specific) + .db 0 ; Subclass (0) + .db 1 ; Protocol (1) + .db 0 ; String index (none) + + ; Endpoint 2 (IN) .db DSCR_ENDPOINT_LEN .db DSCR_ENDPOINT_TYPE - .db 0x82 ; ep1 dir=in and address - .db ENDPOINT_TYPE_ISO ; type - .db 0x00 ; max packet LSB - .db 0x04 ; max packet size=1024 bytes - .db 0x02 ; polling interval - + .db 0x82 ; EP number (2), direction (IN) + .db ENDPOINT_TYPE_ISO ; Endpoint type (iso) + .db 0x00 ; Max. packet size, LSB (1024 bytes) + .db 0x04 ; Max. packet size, MSB (1024 bytes) + .db 0x02 ; Polling interval -; ISOCHRONOUS interface 2MB/s + ; Isochronous interface 0, alt 5, 2MB/s .db DSCR_INTERFACE_LEN .db DSCR_INTERFACE_TYPE - .db 0 ; index - .db 5 ; alt setting idx - .db 1 ; n endpoints - .db 0xff ; class - .db 0 - .db 1 - .db 0 ; string index - -; endpoint 2 in + .db 0 ; Interface index + .db 5 ; Alternate setting index + .db 1 ; Number of endpoints + .db 0xff ; Class (vendor specific) + .db 0 ; Subclass (0) + .db 1 ; Protocol (1) + .db 0 ; String index (none) + + ; Endpoint 2 (IN) .db DSCR_ENDPOINT_LEN .db DSCR_ENDPOINT_TYPE - .db 0x82 ; ep1 dir=in and address - .db ENDPOINT_TYPE_ISO ; type - .db 0x00 ; max packet LSB - .db 0x04 ; max packet size=1024 bytes - .db 0x03 ; polling interval + .db 0x82 ; EP number (2), direction (IN) + .db ENDPOINT_TYPE_ISO ; Endpoint type (iso) + .db 0x00 ; Max. packet size, LSB (1024 bytes) + .db 0x04 ; Max. packet size, MSB (1024 bytes) + .db 0x03 ; Polling interval -; ISOCHRONOUS interface 1MB/s + ; Isochronous interface 0, alt 6, 1MB/s .db DSCR_INTERFACE_LEN .db DSCR_INTERFACE_TYPE - .db 0 ; index - .db 6 ; alt setting idx - .db 1 ; n endpoints - .db 0xff ; class - .db 0 - .db 1 - .db 0 ; string index - -; endpoint 2 in + .db 0 ; Interface index + .db 6 ; Alternate setting index + .db 1 ; Number of endpoints + .db 0xff ; Class (vendor specific) + .db 0 ; Subclass (0) + .db 1 ; Protocol (1) + .db 0 ; String index (none) + + ; Endpoint 2 (IN) .db DSCR_ENDPOINT_LEN .db DSCR_ENDPOINT_TYPE - .db 0x82 ; ep1 dir=in and address - .db ENDPOINT_TYPE_ISO ; type - .db 0x00 ; max packet LSB - .db 0x04 ; max packet size=1024 bytes - .db 0x04 ; polling interval + .db 0x82 ; EP number (2), direction (IN) + .db ENDPOINT_TYPE_ISO ; Endpoint type (iso) + .db 0x00 ; Max. packet size, LSB (1024 bytes) + .db 0x04 ; Max. packet size, MSB (1024 bytes) + .db 0x04 ; Polling interval -; ISOCHRONOUS interface 500 kB/s + ; Isochronous interface 0, alt 7, 500kB/s .db DSCR_INTERFACE_LEN .db DSCR_INTERFACE_TYPE - .db 0 ; index - .db 7 ; alt setting idx - .db 1 ; n endpoints - .db 0xff ; class - .db 0 - .db 1 - .db 0 ; string index - -; endpoint 2 in + .db 0 ; Interface index + .db 7 ; Alternate setting index + .db 1 ; Number of endpoints + .db 0xff ; Class (vendor specific) + .db 0 ; Subclass (0) + .db 1 ; Protocol (1) + .db 0 ; String index (none) + + ; Endpoint 2 (IN) .db DSCR_ENDPOINT_LEN .db DSCR_ENDPOINT_TYPE - .db 0x82 ; ep1 dir=in and address - .db ENDPOINT_TYPE_ISO ; type - .db 0x00 ; max packet LSB - .db 0x02 ; max packet size=512 bytes - .db 0x04 ; polling interval - + .db 0x82 ; EP number (2), direction (IN) + .db ENDPOINT_TYPE_ISO ; Endpoint type (iso) + .db 0x00 ; Max. packet size, LSB (512 bytes) + .db 0x02 ; Max. packet size, MSB (512 bytes) + .db 0x04 ; Polling interval highspd_dscr_realend: -.even + .even + +; ----------------------------------------------------------------------------- +; Full-Speed configuration descriptor +; ----------------------------------------------------------------------------- _fullspd_dscr: - .db fullspd_dscr_end-_fullspd_dscr ; dscr len + .db fullspd_dscr_end - _fullspd_dscr .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 2 ; n interfaces - .db 1 ; config number - .db 0 ; config string - .db 0x80 ; attrs = bus powered, no wakeup - .db 55 ; max power = 110mA + ; Total length of the configuration (1st line LSB, 2nd line MSB) + .db (fullspd_dscr_realend - _fullspd_dscr) % 256 + .db (fullspd_dscr_realend - _fullspd_dscr) / 256 + .db 2 ; Number of interfaces + .db 1 ; Configuration number + .db 0 ; Configuration string (none) + .db 0x80 ; Attributes (bus powered, no wakeup) + .db 0x37 ; Max. power (110mA) fullspd_dscr_end: - -; all the interfaces next -; BULK interface + ; Bulk interface 0, alt 0 .db DSCR_INTERFACE_LEN .db DSCR_INTERFACE_TYPE - .db 0 ; index - .db 0 ; alt setting idx - .db 1 ; n endpoints - .db 0xff ; class - .db 0 - .db 0 - .db 0 ; string index - -; endpoint 6 in + .db 0 ; Interface index + .db 0 ; Alternate setting index + .db 1 ; Number of endpoints + .db 0xff ; Class (vendor specific) + .db 0 ; Subclass (0) + .db 0 ; Protocol (0) + .db 0 ; String index (none) + + ; Endpoint 6 (IN) .db DSCR_ENDPOINT_LEN .db DSCR_ENDPOINT_TYPE - .db 0x86 ; ep1 dir=in and address - .db ENDPOINT_TYPE_BULK ; type - .db 0x40 ; max packet LSB - .db 0x00 ; max packet size=512 bytes - .db 0x00 ; polling interval + .db 0x86 ; EP number (6), direction (IN) + .db ENDPOINT_TYPE_BULK ; Endpoint type (bulk) + .db 0x40 ; Max. packet size, LSB (512 bytes) + .db 0x00 ; Max. packet size, MSB (512 bytes) + .db 0x00 ; Polling interval -; ISOCHRONOUS interface 1 MB/s + ; Isochronous interface 0, alt 1, 1MB/s .db DSCR_INTERFACE_LEN .db DSCR_INTERFACE_TYPE - .db 0 ; index - .db 1 ; alt setting idx - .db 1 ; n endpoints - .db 0xff ; class - .db 0 - .db 1 - .db 0 ; string index - -; endpoint 2 in + .db 0 ; Interface index + .db 1 ; Alternate setting index + .db 1 ; Number of endpoints + .db 0xff ; Class (vendor specific) + .db 0 ; Subclass (0) + .db 1 ; Protocol (1) + .db 0 ; String index (none) + + ; Endpoint 2 (IN) .db DSCR_ENDPOINT_LEN .db DSCR_ENDPOINT_TYPE - .db 0x82 ; ep1 dir=in and address - .db ENDPOINT_TYPE_ISO ; type - .db 0xff ; max packet LSB - .db 0x03 ; max packet size=1023 bytes - .db 0x01 ; polling interval + .db 0x82 ; EP number (2), direction (IN) + .db ENDPOINT_TYPE_ISO ; Endpoint type (iso) + .db 0xff ; Max. packet size, LSB (1023 bytes) + .db 0x03 ; Max. packet size, MSB (1023 bytes) + .db 0x01 ; Polling interval -; ISOCHRONOUS interface 500 kB/s + ; Isochronous interface 0, alt 2, 500kB/s .db DSCR_INTERFACE_LEN .db DSCR_INTERFACE_TYPE - .db 0 ; index - .db 2 ; alt setting idx - .db 1 ; n endpoints - .db 0xff ; class - .db 0 - .db 1 - .db 0 ; string index - -; endpoint 2 in + .db 0 ; Interface index + .db 2 ; Alternate setting index + .db 1 ; Number of endpoints + .db 0xff ; Class (vendor specific) + .db 0 ; Subclass (0) + .db 1 ; Protocol (1) + .db 0 ; String index (none) + + ; Endpoint 2 (IN) .db DSCR_ENDPOINT_LEN .db DSCR_ENDPOINT_TYPE - .db 0x82 ; ep1 dir=in and address - .db ENDPOINT_TYPE_ISO ; type - .db 0x00 ; max packet LSB - .db 0x02 ; max packet size=512 bytes - .db 0x01 ; polling interval + .db 0x82 ; EP number (2), direction (IN) + .db ENDPOINT_TYPE_ISO ; Endpoint type (iso) + .db 0x00 ; Max. packet size, LSB (512 bytes) + .db 0x02 ; Max. packet size, MSB (512 bytes) + .db 0x01 ; Polling interval fullspd_dscr_realend: -.even + .even + +; ----------------------------------------------------------------------------- +; Strings +; ----------------------------------------------------------------------------- + _dev_strings: -; sample string + +; See http://www.usb.org/developers/docs/USB_LANGIDs.pdf for the full list. _string0: - .db string0end-_string0 ; len + .db string0end - _string0 .db DSCR_STRING_TYPE - .db 0x09, 0x04 ; 0x0409 is the language code for English. Possible to add more codes after this. + .db 0x09, 0x04 ; Language code 0x0409 (English, US) string0end: -; add more strings here + _string1: - .db string1end-_string1 ; len + .db string1end - _string1 .db DSCR_STRING_TYPE - .ascii 'O\0D\0M\0' + .ascii 'O\0D\0M\0' string1end: + _string2: - .db string2end-_string2 ; len + .db string2end - _string2 .db DSCR_STRING_TYPE - .ascii 'f\0x\0002\0l\0a\0f\0w\0' + .ascii 'f\0x\0002\0l\0a\0f\0w\0' string2end: - _dev_strings_end: - .dw 0x0000 ; in case you wanted to look at memory between _dev_strings and _dev_strings_end + .dw 0x0000 +