; ; $Id: dscr.a51,v 1.6 2012-02-08 20:13:48 scg Exp $ ; ; UMSE2 controller part USB Device Descriptors ; ; (C)2011 St(u)dio of Computer Games ; Alexander Ozumenko ; .module usb_descriptors VID = 0xb4d4 PID = 0x7216 VERSION = 0x0200 DSCR_DEVICE = 1 ; descriptor type: device DSCR_CONFIG = 2 ; descriptor type: configuration DSCR_STRING = 3 ; descriptor type: string DSCR_INTRFC = 4 ; descriptor type: interface DSCR_ENDPNT = 5 ; descriptor type: endpoint DSCR_DEVQUAL = 6 ; descriptor type: device qualifier DSCR_DEVICE_LEN = 18 DSCR_CONFIG_LEN = 9 DSCR_INTRFC_LEN = 9 DSCR_ENDPNT_LEN = 7 DSCR_DEVQUAL_LEN = 10 ET_CONTROL = 0 ; endpoint type: control ET_ISO = 1 ; endpoint type: isochronous ET_BULK = 2 ; endpoint type: bulk ET_INT = 3 ; endpoint type: interrupt ED_IN = 0x80 ; endpoint direction: in ED_OUT = 0x00 ; endpoint direction: out CF_D7_RESERVED = 0x80 ; configuration flad: reserved CF_BUSPWR = 0x00 ; confoguration flag: buspwr .globl _dev_dscr, _dev_qual_dscr, _highspd_dscr, _fullspd_dscr, _dev_strings, _dev_strings_end .area USBDESCSEG (CODE) ; Device descriptor _dev_dscr: .db DSCR_DEVICE_LEN ; descriptor length .db DSCR_DEVICE ; decriptor type .dw 0x0002 ; specification version (BCD) .db 0x00 ; device class .db 0x00 ; device sub-class .db 0x00 ; device sub-sub-class .db 64 ; maximum packet size .dw VID >> 8 | (VID & 0xff) << 8 ; vendor ID .dw PID >> 8 | (PID & 0xff) << 8 ; product ID .dw VERSION >> 8 | (VERSION & 0xff) << 8 ; product version ID .db 1 ; manufacturer string index .db 2 ; product string index .db 0 ; serial number string index .db 1 ; number of configurations ; FixME: добавить коментарий блоку _dev_qual_dscr: .db DSCR_DEVQUAL_LEN ; descriptor length .db DSCR_DEVQUAL ; decriptor type .dw 0x0002 ; specification version (BCD) .db 0x00 ; device class .db 0x00 ; device sub-class .db 0x00 ; device sub-sub-class .db 64 ; maximum packet size .db 1 ; number of configurations .db 0 ; reserved ; High-speed descriptors set ; Configureation descriptor _highspd_dscr: .db DSCR_CONFIG_LEN ; descriptor length .db DSCR_CONFIG ; descriptor type .db (highspd_dscr_end - _highspd_dscr) % 256 ; total length (LSB) .db (highspd_dscr_end - _highspd_dscr) / 256 ; total length (MSB) .db 1 ; number of interfaces .db 1 ; configuration number .db 0 ; configuration string .db CF_D7_RESERVED | CF_BUSPWR ; attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu) .db 250 ; power requirement (div 2 mA) ; Interface descriptor (interface 0) .db DSCR_INTRFC_LEN ; descriptor length .db DSCR_INTRFC ; descriptor type .db 0 ; zero-based index of this interface .db 0 ; alternate setting .db 3 ; number of end points .db 0xff ; interface class (USB_VENDOR_SPECIFIC_CLASS) .db 0x00 ; interface sub class (USB_NO_SUBCLASS) .db 0xff ; interface protocol (USB_VENDOR_SPECIFIC_PROTOCOL) .db 0 ; interface descriptor string index ; Endpoint descriptor (IN/EP1) .db DSCR_ENDPNT_LEN ; descriptor length .db DSCR_ENDPNT ; descriptor type .db 0x80 | 0x01 ; endpoint number and direction .db ET_INT ; endpoint type .db 0x40 ; maximun packet size (LSB) .db 0x00 ; max packect size (MSB) .db 0x01 ; polling interval ; Endpoint descriptor (OUT/EP2) .db DSCR_ENDPNT_LEN ; descriptor length .db DSCR_ENDPNT ; descriptor type .db ED_OUT | 0x02 ; endpoint number and direction .db ET_BULK ; endpoint type .db 0x00 ; max packet size (LSB) .db 0x02 ; max packet size (MSB) .db 0x00 ; polling interval ; Endpoint descriptor (IN/EP6) .db DSCR_ENDPNT_LEN ; descriptor length .db DSCR_ENDPNT ; descriptor type .db ED_IN | 0x06 ; endpoint number and direction .db ET_BULK ; endpoint type .db 0x00 ; max packet size (LSB) .db 0x02 ; max packet size (MSB) .db 0x00 ; polling interval highspd_dscr_end: ; Full-speed descriptors set ; Configureation descriptor _fullspd_dscr: .db DSCR_CONFIG_LEN ; descriptor length .db DSCR_CONFIG ; descriptor type .db (fullspd_dscr_end - _fullspd_dscr) % 256 ; total length (LSB) .db (fullspd_dscr_end - _fullspd_dscr) / 256 ; total length (MSB) .db 1 ; number of interfaces .db 1 ; configuration number .db 0 ; configuration string .db CF_D7_RESERVED | CF_BUSPWR ; attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu) .db 250 ; power requirement (div 2 mA) ; Interface descriptor (interface 0) .db DSCR_INTRFC_LEN ; descriptor length .db DSCR_INTRFC ; descriptor type .db 0 ; zero-based index of this interface .db 0 ; alternate setting .db 3 ; number of end points .db 0xff ; interface class (USB_VENDOR_SPECIFIC_CLASS) .db 0x00 ; interface sub class (USB_NO_SUBCLASS) .db 0xff ; interface protocol (USB_VENDOR_SPECIFIC_PROTOCOL) .db 0 ; interface descriptor string index ; Endpoint descriptor (IN/EP1) .db DSCR_ENDPNT_LEN ; descriptor length .db DSCR_ENDPNT ; descriptor type .db 0x80 | 0x01 ; endpoint number and direction .db ET_INT ; endpoint type .db 0x40 ; maximun packet size (LSB) .db 0x00 ; max packect size (MSB) .db 0x01 ; polling interval ; Endpoint descriptor (OUT/EP2) .db DSCR_ENDPNT_LEN ; descriptor length .db DSCR_ENDPNT ; descriptor type .db 0x00 | 0x02 ; endpoint number and direction .db ET_BULK ; endpoint type .db 0x40 ; max packet size (LSB) .db 0x00 ; max packet size (MSB) .db 0x00 ; polling interval ; Endpoint descriptor (IN/EP6) .db DSCR_ENDPNT_LEN ; descriptor length .db DSCR_ENDPNT ; descriptor type .db 0x80 | 0x06 ; endpoint number and direction .db ET_BULK ; endpoint type .db 0x40 ; maximun packet size (LSB) .db 0x00 ; max packect size (MSB) .db 0x00 ; polling interval fullspd_dscr_end: ; String descriptors _dev_strings: _string0: .db string0_end - _string0 ; string descriptor length .db DSCR_STRING .db 0x09, 0x04 ; ENGLISH_UNITED_STATES_LANG string0_end: _string1: .db string1_end - _string1 ; string descriptor length .db DSCR_STRING .db 'S, 0 ; 16-bit unicode .db 't, 0 .db '(, 0 .db 'u, 0 .db '), 0 .db 'd, 0 .db 'i, 0 .db 'o, 0 .db ' , 0 .db 'o, 0 .db 'f, 0 .db ' , 0 .db 'C, 0 .db 'o, 0 .db 'm, 0 .db 'p, 0 .db 'u, 0 .db 't, 0 .db 'e, 0 .db 'r, 0 .db ' , 0 .db 'G, 0 .db 'a, 0 .db 'm, 0 .db 'e, 0 .db 's, 0 string1_end: _string2: .db string2_end - _string2 ; string descriptor length .db DSCR_STRING .db 'U, 0 ; 16-bit unicode .db 'M, 0 .db 'S, 0 .db ' , 0 .db 'E, 0 .db 'm, 0 .db 'u, 0 .db 'l, 0 .db 'a, 0 .db 't, 0 .db 'o, 0 .db 'r, 0 .db ' , 0 .db 'C, 0 .db 'o, 0 .db 'n, 0 .db 't, 0 .db 'r, 0 .db 'o, 0 .db 'l, 0 .db 'l, 0 .db 'e, 0 .db 'r, 0 string2_end: _dev_strings_end: .dw 0x0000 ; just in case someone passes an index higher than the end to the firmware