USB-BDI
M:/USB-BDI/USB-BDI/Firmware/MPC555-USB-BDI/src/usb_descriptors.a51
00001 ;;;
00002 ;;; Copyright 2006 Free Software Foundation, Inc.
00003 ;;; 
00004 ;;; This file is part of USB PDI
00005 ;;; 
00006 ;;; USB PDI is free software; you can redistribute it and/or modify
00007 ;;; it under the terms of the GNU General Public License as published by
00008 ;;; the Free Software Foundation; either version 2, or (at your option)
00009 ;;; any later version.
00010 ;;; 
00011 ;;; USB PDI is distributed in the hope that it will be useful,
00012 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 ;;; GNU General Public License for more details.
00015 ;;; 
00016 ;;; You should have received a copy of the GNU General Public License
00017 ;;; along with USB PDI; see the file COPYING.  If not, write to
00018 ;;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019 ;;; Boston, MA 02111-1307, USA.
00020 ;;;
00021         
00022 ;;; USB Descriptor table for the USB PDI
00023 ;;; 
00024 ;;; We're a high-speed and full speed device with 1 configuration
00025 ;;; and 4 endpoints.  
00026 ;;; 
00027 ;;;     endpoint 0:     command and status (ep0 COMMAND)
00028 ;;;     endpoint 1:     BDI + UART Transmit path (ep2 OUT BULK)
00029 ;;;     endpoint 2:     BDI Receive path (ep6 IN BULK)
00030 ;;;     endpoint 3:     UART Receive path (ep8 IN BULK)
00031 
00032         .module usb_descriptors
00033         
00034         VID_FREE         = 0x8235       ; NTB
00035         PID_USBPDI       = 0x0100       ; PD-Interface
00036         
00037         ;; The LSB of the DID is reserved for hardware revs.
00038         
00039         DID_USBPDI       = 0x0102       ; Device ID (bcd)
00040 
00041         
00042         DSCR_DEVICE      =   1  ; Descriptor type: Device
00043         DSCR_CONFIG      =   2  ; Descriptor type: Configuration
00044         DSCR_STRING      =   3  ; Descriptor type: String
00045         DSCR_INTRFC      =   4  ; Descriptor type: Interface
00046         DSCR_ENDPNT      =   5  ; Descriptor type: Endpoint
00047         DSCR_DEVQUAL     =   6  ; Descriptor type: Device Qualifier
00048         
00049         DSCR_DEVICE_LEN  =  18
00050         DSCR_CONFIG_LEN  =   9
00051         DSCR_INTRFC_LEN  =   9
00052         DSCR_ENDPNT_LEN  =   7
00053         DSCR_DEVQUAL_LEN =  10
00054         
00055         ET_CONTROL       =   0  ; Endpoint type: Control
00056         ET_ISO           =   1  ; Endpoint type: Isochronous
00057         ET_BULK          =   2  ; Endpoint type: Bulk
00058         ET_INT           =   3  ; Endpoint type: Interrupt
00059         
00060         VCP_COM_INTERFACE_NR = 0x1 ; Virtual Com Port Communication Interface Number
00061         VCP_BULK_INTERFACE_NR = 0x2 ; Virtual Com Port Bulk Interface Number
00062         BDI_INTERFACE_NR =0x0 ;USB-BDI Interface Number
00063         
00064         
00065         ;; configuration attributes
00066         bmBUS_POWERED = 1 << 7
00067         bmSELF_POWERED  =       1 << 6
00068 
00069 ;;; --------------------------------------------------------
00070 ;;;     external ram data
00071 ;;;--------------------------------------------------------
00072         
00073         .area USBDESCSEG    (XDATA)
00074         
00075 ;;; ----------------------------------------------------------------
00076 ;;; descriptors used when operating at high speed (480Mb/sec)
00077 ;;; ----------------------------------------------------------------
00078         
00079         .even   ; descriptors must be 2-byte aligned for SUDPTR{H,L} to work
00080 
00081         ;; The .even directive isn't really honored by the linker.  Bummer!
00082         ;; (There's no way to specify an alignment requirement for a given area,
00083         ;; hence when they're concatenated together, even doesn't work.)
00084         ;; 
00085         ;; We work around this by telling the linker to put USBDESCSEG
00086         ;; at 0xE000 absolute.  This means that the maximimum length of this
00087         ;; segment is 480 bytes, leaving room for the two hash slots 
00088         ;; at 0xE1EO to 0xE1FF.  
00089         ;; 
00090         ;; As of January 16, 2006, this segment is ??? bytes long
00091         
00092 _high_speed_device_descr::
00093         .db     DSCR_DEVICE_LEN
00094         .db     DSCR_DEVICE
00095         .db     <0x0200         ; Specification version (LSB)
00096         .db     >0x0200         ; Specification version (MSB)
00097         .db     0xEF            ; device class (vendor specific) 
00098         .db     0x02            ; device subclass (vendor specific) 0xff
00099         .db     0x01            ; device protocol (vendor specific) 0xff
00100         .db     0x40            ; bMaxPacketSize0 for endpoint 0 (64)
00101         .db     <VID_FREE       ; idVendor
00102         .db     >VID_FREE       ; idVendor
00103         .db     <PID_USBPDI     ; idProduct
00104         .db     >PID_USBPDI     ; idProduct
00105         .db     <DID_USBPDI     ; bcdDevice
00106         .db     >DID_USBPDI     ; bcdDevice
00107         .db     SI_VENDOR       ; iManufacturer (string index)
00108         .db     SI_PRODUCT      ; iProduct (string index)
00109         .db     SI_SERIAL       ; iSerial number (string index)
00110         .db     1               ; bNumConfigurations
00111         
00112 ;;; describes the other speed (12Mb/sec)
00113         .even
00114 _high_speed_devqual_descr::
00115         .db     DSCR_DEVQUAL_LEN
00116         .db     DSCR_DEVQUAL
00117         .db     <0x0200         ; bcdUSB (LSB)
00118         .db     >0x0200         ; bcdUSB (MSB)
00119         .db     0xEf            ; bDeviceClass
00120         .db     0x02            ; bDeviceSubClass
00121         .db     0x01            ; bDeviceProtocol
00122         .db     64              ; bMaxPacketSize0
00123         .db     1               ; bNumConfigurations (one config at 12Mb/sec)
00124         .db     0               ; bReservedS
00125         
00126         .even
00127 _high_speed_config_descr::      
00128         .db     DSCR_CONFIG_LEN
00129         .db     DSCR_CONFIG
00130         .db     <(_high_speed_config_descr_end - _high_speed_config_descr) ; LSB
00131         .db     >(_high_speed_config_descr_end - _high_speed_config_descr) ; MSB
00132         .db     3               ; bNumInterfaces
00133         .db     1               ; bConfigurationValue
00134         .db     0               ; iConfiguration
00135         .db     bmSELF_POWERED ; bmAttributes
00136         .db     50              ; bMaxPower (when BUS_POWERED)
00137 
00138 
00139 ;; interface descriptor 2 (transmit path, ep2 OUT BULK)
00140         
00141         .db     DSCR_INTRFC_LEN
00142         .db     DSCR_INTRFC
00143         .db     BDI_INTERFACE_NR ; bInterfaceNumber (zero based)
00144         .db     0               ; bAlternateSetting
00145         .db     2               ; bNumEndpoints
00146         .db     0xff            ; bInterfaceClass (vendor specific)
00147         .db     0xff            ; bInterfaceSubClass (vendor specific)
00148         .db     0xff            ; bInterfaceProtocol (vendor specific)
00149         .db     SI_BDI_UART_PATH        ; iInterface (description)
00150         
00151         ;; first end point for interface 2(OUT, transmit)
00152 
00153         .db     DSCR_ENDPNT_LEN
00154         .db     DSCR_ENDPNT
00155         .db     0x02            ; bEndpointAddress (ep 2 OUT)
00156         .db     ET_BULK         ; bmAttributes
00157         .db     <512            ; wMaxPacketSize (LSB)
00158         .db     >512            ; wMaxPacketSize (MSB)
00159         .db     0                       ; bInterval (iso only)
00160 
00161         ;; second end point for interface 2(IN, receive)
00162 
00163         .db     DSCR_ENDPNT_LEN
00164         .db     DSCR_ENDPNT
00165         .db     0x86            ; bEndpointAddress (ep 6 IN)
00166         .db     ET_BULK         ; bmAttributes
00167         .db     <512            ; wMaxPacketSize (LSB)
00168         .db     >512            ; wMaxPacketSize (MSB)
00169         .db     0                       ; bInterval (iso only)
00170                 
00171         
00172         ;;Interface Association Descriptor
00173         .db 0x08 ;Descriptor size in bytes (8)
00174         .db 0x0B ;Descriptor type (IAD)
00175         .db     VCP_COM_INTERFACE_NR ;First associated interface
00176         .db 0x02 ;Number of associated interfaces
00177         .db 0x02 ;Class code (communication)
00178         .db     0x02 ;Subclass code (abstract control model)
00179         .db     0x02 ;Protocol code (V.25ter) 
00180         .db 0x0 ;String descriptor index
00181 
00182         ;; interface descriptor 0 (virtual com port communication interface)
00183         
00184         .db     DSCR_INTRFC_LEN
00185         .db     DSCR_INTRFC
00186         .db     VCP_COM_INTERFACE_NR ; bInterfaceNumber (zero based)
00187         .db     0               ; bAlternateSetting
00188         .db     1               ; bNumEndpoints
00189         .db     0x02    ; bInterfaceClass (communication)
00190         .db     0x02    ; bInterfaceSubClass (abstract control model ACM)
00191         .db     0x01    ; bInterfaceProtocol (V.25ter, common AT commands
00192         .db VIRTUAL_COM_PORT    ; iInterface (no string defined)
00193         
00194         ;;Header Functional Descriptor
00195         
00196         .db 0x05 ;Descriptor size in bytes (5)
00197         .db 0x24 ;CS_INTERFACE
00198         .db 0x00 ;Header functional descriptor
00199         .db <272 ;CDC specification release number in BCD format (1.1)
00200         .db >272 ;CDC specification release number in BCD format (1.1)
00201         
00202         ;;Call Management Functional Descriptor
00203         
00204         .db 0x05 ;Descriptor size in bytes (5)
00205         .db 0x24 ;CS_INTERFACE
00206         .db 0x01 ;Call Management Functional Descriptor
00207         .db 0x00 ;Device doesn’t handle call management itself
00208         .db 0x01 ;Interface used for call management (bInterfaceNumber of a data class interface in this configuration).
00209 
00210         ;;Abstract Control Management Functional Descriptor
00211         
00212         .db 0x04 ;Descriptor size in bytes (4)
00213         .db 0x24 ;CS_INTERFACE
00214         .db 0x02 ;Abstract Control Management Functional Descriptor
00215         .db 0x02 ;Support for the SET_LINE_CODING, SET_CONTROL_LINE, and GET_LINE_CODING requests and the SERIAL_STATE notification.
00216         
00217         ;;Union Functional Descriptor
00218         
00219         .db 0x05 ;Descriptor size in bytes (5)
00220         .db 0x24 ;CS_INTERFACE
00221         .db 0x06 ;Union Functional Descriptor
00222         .db 0x00 ;The controlling interface for the union (bInterfaceNumber of a Communication or Data Class interface in this configuration)
00223         .db 0x01 ;The controlled interface in the union (bInterfaceNumber of an interface in this configuration)
00224         
00225         
00226         ;; first end point for interface 0(interrupt endpoint)
00227 
00228         .db     DSCR_ENDPNT_LEN
00229         .db     DSCR_ENDPNT
00230         .db     0x81            ; bEndpointAddress (ep 1 IN)
00231         .db     ET_INT          ; bmAttributes
00232         .db     <8                      ; wMaxPacketSize (LSB)
00233         .db     >8                      ; wMaxPacketSize (MSB)
00234         .db     0x2                     ; bInterval (Maximum Latency)
00235         
00236         ;; interface descriptor 1 (virtual com port in and out)
00237         
00238         .db     DSCR_INTRFC_LEN
00239         .db     DSCR_INTRFC
00240         .db     VCP_BULK_INTERFACE_NR ; bInterfaceNumber (zero based)
00241         .db     0x0             ; bAlternateSetting
00242         .db     0x2             ; bNumEndpoints
00243         .db     0x0A    ; bInterfaceClass (CRC)
00244         .db     0x0             ; bInterfaceSubClass 
00245         .db     0x0             ; bInterfaceProtocol 
00246         .db VIRTUAL_COM_PORT ; iInterface (description)
00247 
00248         ;; first end point for interface 1(OUT)
00249 
00250         .db     DSCR_ENDPNT_LEN
00251         .db     DSCR_ENDPNT
00252         .db     0x08            ; bEndpointAddress (ep 8 OUT)
00253         .db     ET_BULK         ; bmAttributes
00254         .db     <512            ; wMaxPacketSize (LSB)
00255         .db     >512            ; wMaxPacketSize (MSB)
00256         .db     0               ; bInterval (iso only)
00257 
00258         ;; second end point for interface 1(IN)
00259 
00260         .db     DSCR_ENDPNT_LEN
00261         .db     DSCR_ENDPNT
00262         .db     0x84            ; bEndpointAddress (ep 4 IN)
00263         .db     ET_BULK         ; bmAttributes
00264         .db     <512            ; wMaxPacketSize (LSB)
00265         .db     >512            ; wMaxPacketSize (MSB)
00266         .db     0                       ; bInterval (iso only)
00267 
00268         
00269         
00270 
00271 _high_speed_config_descr_end::          
00272 
00273 ;;; ----------------------------------------------------------------
00274 ;;;                     string descriptors
00275 ;;; ----------------------------------------------------------------
00276 
00277 _nstring_descriptors::
00278         .db     (_string_descriptors_end - _string_descriptors) / 2
00279 
00280 _string_descriptors::
00281         .db     <str0, >str0
00282         .db     <str1, >str1
00283         .db     <str2, >str2
00284         .db     <str3, >str3
00285         .db     <str4, >str4
00286         .db     <str5, >str5
00287 _string_descriptors_end:
00288 
00289         SI_NONE = 0
00290         ;; str0 contains the language ID's.
00291         .even
00292 str0:   .db     str0_end - str0
00293         .db     DSCR_STRING
00294         .db     0
00295         .db     0
00296         .db     <0x0409         ; magic code for US English (LSB)
00297         .db     >0x0409         ; magic code for US English (MSB)
00298 str0_end:
00299 
00300         SI_VENDOR = 1
00301         .even
00302 str1:   .db     str1_end - str1
00303         .db     DSCR_STRING
00304         .db     'i, 0           ; 16-bit unicode
00305         .db     'n, 0
00306         .db     'f, 0
00307         .db     '., 0
00308         .db     'n, 0
00309         .db     't, 0
00310         .db     'b, 0
00311         .db     '., 0
00312         .db     'c, 0
00313         .db     'h, 0
00314 str1_end:
00315 
00316         SI_PRODUCT = 2
00317         .even
00318 str2:   .db     str2_end - str2
00319         .db     DSCR_STRING
00320         .db     'P, 0
00321         .db     'D, 0
00322         .db     '-, 0
00323         .db     'I, 0
00324         .db     'n, 0
00325         .db     't, 0
00326         .db     'e, 0
00327         .db     'r, 0
00328         .db     'f, 0
00329         .db     'a, 0
00330         .db     'c, 0
00331         .db     'e, 0
00332 str2_end:
00333 
00334         SI_BDI_UART_PATH = 3
00335         .even
00336 str3:   .db     str3_end - str3
00337         .db     DSCR_STRING
00338         .db     'B, 0
00339         .db     'D, 0
00340         .db     'I, 0
00341 str3_end:
00342 
00343         SI_SERIAL = 4
00344         .even
00345 _serial_number_descriptor::
00346 str4:   .db     str4_end - str4
00347         .db     DSCR_STRING
00348         .db     '0, 0
00349         .db     '0, 0
00350         .db     '., 0
00351         .db     '0, 0
00352         .db     '3, 0
00353         .db     '., 0
00354         .db     '1, 0
00355         .db     '0, 0
00356 str4_end:
00357 
00358 VIRTUAL_COM_PORT = 5
00359         .even
00360 str5:   .db     str5_end - str5
00361         .db     DSCR_STRING
00362         .db     'V, 0
00363         .db     'i, 0
00364         .db     'r, 0
00365         .db     't, 0
00366         .db     'u, 0
00367         .db     'a, 0
00368         .db     'l, 0
00369         .db     ' , 0
00370         .db     'C, 0
00371         .db     'o, 0
00372         .db     'm, 0
00373         .db     ' , 0
00374         .db     'P, 0
00375         .db     'o, 0
00376         .db     'r, 0
00377         .db     't, 0
00378 str5_end:
00379 
 All Files Functions Variables Defines