Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 19, 2024, 09:40:41 21:40


Login with username, password and session length


Pages: [1]
Print
Author Topic: Composite USB Device with picbasic  (Read 3763 times)
0 Members and 1 Guest are viewing this topic.
Cynetron
Newbie
*
Offline Offline

Posts: 25

Thank You
-Given: 25
-Receive: 31


« on: February 01, 2008, 10:38:11 22:38 »

i try to write a composite device with usb support but i can't run this description. what is the problem in this?

Code:
 LIST
;
; This file contains a set of descriptors for a CDC Virtual serial com interface.
;
#DEFINE __EP0_BUFF_SIZE 8 ; 8, 16, 32, or 64
#DEFINE __MAX_NUM_INT 1 ; For tracking Alternate Setting
#DEFINE __MAX_EP_NUMBER 5 ; UEP5
#DEFINE __NUM_CONFIGURATIONS 1
#DEFINE __NUM_INTERFACES 2

#DEFINE __MODE_PP _PPBM0
#DEFINE __UCFG_VAL _PUEN | _TRINT | _FS | __MODE_PP ; Set bus for Full Speed

#DEFINE __USB_USE_CDC ; Inform the rest of the library subroutines that we're using a CDC interface

; CDC
#DEFINE __CDC_COMM_INTF_ID        0
#DEFINE __CDC_COMM_UEP            UEP2
#DEFINE __CDC_INT_BD_IN           __ep2Bi
#DEFINE __CDC_INT_EP_SIZE         8
#DEFINE __CDC_DATA_INTF_ID        1
#DEFINE __CDC_DATA_UEP            UEP3
#DEFINE __CDC_BULK_BD_OUT         __ep3Bo
#DEFINE __CDC_BULK_OUT_EP_SIZE    128 ; 128 byte output buffer. Note maximum of 128
#DEFINE __CDC_BULK_BD_IN          __ep3Bi
#DEFINE __CDC_BULK_IN_EP_SIZE     128 ; 128 byte input buffer. Note maximum of 128
;MSD
#DEFINE __MSD_INTF   8 ; Class code
#DEFINE __MSD_INTF_SUBCLASS   6 ; Subclass code
#DEFINE __MSD_PROTOCOL   80 ; Protocol code
#DEFINE __MSD_BULK_IN_EP_SIZE     64                ; 64 byte input buffer.
#DEFINE __MSD_BULK_OUT_EP_SIZE    64                ; 64 byte output buffer.
;Custom Device
#DEFINE __CD_BULK_IN_EP_SIZE      64                ; 64 byte input buffer.
#DEFINE __CD_BULK_OUT_EP_SIZE     64                ; 64 byte output buffer.
; ------------------------------------------------------------------------------
; This table is polled by the host immediately after USB Reset has been released.
; These fields are application dependent to be modified to meet your specifications.
;
__DeviceDescriptor
retlw (__EndDeviceDescriptor - __DeviceDescriptor) / 2 ; bLength Length of this descriptor
retlw __DSC_DEV ; bDescType DEVICE
dt 0x00, 0x02 ; bcd USB Revision 1.10 low byte, high byte
retlw __CDC_DEVICE ; bDeviceClass
retlw 0x00 ; bDeviceSubClass
retlw 0x00 ; bDeviceProtocol
retlw __EP0_BUFF_SIZE ; bMaxPacketSize for EP0
dt 0xD8, 0x04 ; idVendor - 0x04D8 is Microchip VENDOR ID low byte, high byte
dt 0x0A, 0x00 ; idProduct Product ID low byte, high byte
dt 0x00, 0x00 ; bcd Device Device release number low byte, high byte
retlw 0x01 ; iManufacturer Manufacturer string index
retlw 0x02 ; iProduct Product string index
retlw 0x03 ; iSerialNumber Device serial number string index
retlw __NUM_CONFIGURATIONS ; bNumConfigurations
__EndDeviceDescriptor

; ------------------------------------------------------------------------------
; This table is retrieved by the host after the address has been set.
; This table defines the configurations available for the device.
; See section 9.6.2 of the Rev 1.0 USB specification (page 184).
; These fields are application dependent to be modified to meet your specifications.
;
; Configuration pointer table
__USB_CD_Ptr
__Configs
db Low ___Config1, High ___Config1
db Low ___Config1, High ___Config1

; Configuration Descriptor
___Config1
retlw 9 ; bLength Length of this descriptor
retlw __DSC_CFG ; bDescType CONFIGURATION
__Config1Len
retlw Low ((__EndConfig1 - ___Config1) / 2) ; Length of this configuration
retlw High ((__EndConfig1 - ___Config1) / 2)
retlw __NUM_INTERFACES ; bNumInterfaces Number of interfaces IN this configuration
retlw 0x01 ; bConfigValue Configuration Value
retlw 0x02 ; iConfigString Index for this configuration
retlw 0x80 ; bmAttributes
retlw 0x50 ; Max power consumption (2X mA)

; Interface Descriptor
retlw 9 ; bLength Length of this descriptor
retlw __DSC_INTF ; bDescType INTERFACE
retlw 0 ; Interface number
retlw 0 ; Alternate setting
retlw 1 ; Number of endpoints in this interface
retlw __COMM_INTF ; Class code
retlw __ABSTRACT_CONTROL_MODEL ; Subclass code
retlw __V25TER ; Protocol code
retlw 2 ; Interface string index

; CDC Class-Specific Descriptors
retlw 5 ; bFNLength (USB_CDC_HEADER_FN_DSC)
retlw __CS_INTERFACE ; bDscType
retlw __DSC_FN_HEADER ; bDscSubType
dt 0x10, 0x01 ; bcd CDC low byte, high byte

retlw 4 ; bFNLength (USB_CDC_ACM_FN_DSC)
retlw __CS_INTERFACE ; bDscType
retlw __DSC_FN_ACM ; bDscSubType
retlw 2 ; bmCapabilities

retlw 5 ; bFNLength (USB_CDC_UNION_FN_DSC)
retlw __CS_INTERFACE ; bDscType
retlw __DSC_FN_UNION ; bDscSubType
retlw __CDC_COMM_INTF_ID ; bMasterIntf
retlw __CDC_DATA_INTF_ID ; bSaveIntf0

retlw 5 ; bFNLength (USB_CDC_CALL_MGT_FN_DSC)
retlw __CS_INTERFACE ; bDscType
retlw __DSC_FN_CALL_MGT ; bDscSubType
retlw 0 ; bmCapabilities
retlw __CDC_DATA_INTF_ID ; bDataInterface

; Endpoint Descriptor
retlw 7 ; bLength (USB_EP_DSC)
retlw __DSC_EP ; bDscType
retlw _EP02_IN ; bEPAdr
retlw 3 ; bmAttributes (_INT)
retlw Low (__CDC_INT_EP_SIZE) ; wMaxPktSize
retlw High (__CDC_INT_EP_SIZE)
retlw 2 ; bInterval
   
; Interface Descriptor
retlw 9 ; bLength Length of this descriptor
retlw __DSC_INTF ; INTERFACE descriptor type
retlw 1 ; Interface Number
retlw 0 ; Alternate Setting Number
retlw 2 ; Number of endpoints in this intf
retlw __DATA_INTF ; Class code
retlw 0 ; Subclass code
retlw __NO_PROTOCOL ; Protocol code
retlw 2 ; Interface string index
   
; Endpoint Descriptors
retlw 7 ; bLength (USB_EP_DSC)
retlw __DSC_EP ; bDscType
retlw _EP03_OUT ; bEPAdr
retlw 2 ; bmAttributes (_BULK)
retlw Low (__CDC_BULK_OUT_EP_SIZE) ; wMaxPktSize
retlw High (__CDC_BULK_OUT_EP_SIZE)
retlw 0 ; bInterval

retlw 7 ; bLength (USB_EP_DSC)
retlw __DSC_EP ; bDscType
retlw _EP03_IN ; bEPAdr
retlw 2 ; bmAttributes (_BULK)
retlw Low (__CDC_BULK_IN_EP_SIZE) ; wMaxPktSize
retlw High (__CDC_BULK_IN_EP_SIZE)
retlw 0 ; bInterval
;
;  Mass Storage Device
;
; Interface Descriptor
retlw 9 ; bLength Length of this descriptor
retlw __DSC_INTF ; INTERFACE descriptor type
retlw 2 ; Interface Number
retlw 0 ; Alternate Setting Number
retlw 2 ; Number of endpoints in this intf
retlw __MSD_INTF ; Class code
retlw __MSD_INTF_SUBCLASS ; Subclass code
retlw __MSD_PROTOCOL ; Protocol code
retlw 4 ; Interface string index
   
; Endpoint Descriptor 1 for Mass Storage Device
retlw 7 ; bLength (USB_EP_DSC)
retlw __DSC_EP ; bDscType
retlw _EP05_OUT ; bEPAdr
retlw 2 ; bmAttributes (_BULK)
retlw Low (__MSD_BULK_OUT_EP_SIZE) ; wMaxPktSize
retlw High (__MSD_BULK_OUT_EP_SIZE)
retlw 0 ; bInterval
; Endpoint Descriptor 2 for Mass Storage Device
retlw 7 ; bLength (USB_EP_DSC)
retlw __DSC_EP ; bDscType
retlw _EP05_IN ; bEPAdr
retlw 2 ; bmAttributes (_BULK)
retlw Low (__MSD_BULK_IN_EP_SIZE)      ; wMaxPktSize
retlw High (__MSD_BULK_IN_EP_SIZE)
retlw 0 ; bInterval
;
;  Custom Device
;
; Interface Descriptor
retlw 9 ; bLength Length of this descriptor
retlw __DSC_INTF ; INTERFACE descriptor type
retlw 3 ; Interface Number
retlw 0 ; Alternate Setting Number
retlw 2 ; Number of endpoints in this intf
retlw 0            ; Class code
retlw 0                    ; Subclass code
retlw __NO_PROTOCOL ; Protocol code
retlw 3 ; Interface string index
   
; Endpoint Descriptor 1 for Custom Device
retlw 7 ; bLength (USB_EP_DSC)
retlw __DSC_EP ; bDscType
retlw _EP04_OUT ; bEPAdr
retlw 2 ; bmAttributes (_BULK)
retlw Low (__CD_BULK_OUT_EP_SIZE)     ; wMaxPktSize
retlw High (__CD_BULK_OUT_EP_SIZE)
retlw 100 ; bInterval
; Endpoint Descriptor 2 for Custom Device 
retlw 7 ; bLength (USB_EP_DSC)
retlw __DSC_EP ; bDscType
retlw _EP04_IN ; bEPAdr
retlw 2 ; bmAttributes (_BULK)
retlw Low (__CD_BULK_IN_EP_SIZE)          ; wMaxPktSize
retlw High (__CD_BULK_IN_EP_SIZE)
retlw 0 ; bInterval


__EndConfig1


; String pointer table
__USB_SD_Ptr
__Strings
db Low __String0, High __String0
db Low __String1, High __String1
db Low __String2, High __String2
db Low __String3, High __String3
db Low __String4, High __String4
__String0
retlw   (__String1 - __String0) / 2 ; Length of string
retlw   __DSC_STR ; Descriptor type 3
dt   0x09, 0x04    ; Language ID (0x0409 as defined by Microsoft)
__String1
retlw   (__String2 - __String1) / 2
retlw   __DSC_STR
dt   'M', 0, 'i', 0, 'c', 0, 'r', 0, 'o', 0, 'c', 0, 'h', 0, 'i', 0, 'p', 0
__String2
retlw   (__String3 - __String2) / 2
retlw   __DSC_STR
dt   'V',0,'i',0,'r',0,'t',0,'u',0,'a',0,'l',0,' ',0,'C',0,'O',0,'M',0
__String3
retlw   (__String4 - __String3) / 2
retlw   __DSC_STR
dt   'C',0,'u',0,'s',0,'t',0,'o',0,'m',0,' ',0,'D',0,'e',0,'v',0,'i',0,'c',0,'e',0
__String4
retlw   (__String5 - __String4) / 2
retlw   __DSC_STR
dt   'M',0,'a',0,'s',0,'s',0,' ',0,'S',0,'t',0,'o',0,'r',0,'a',0,'g',0,'e',0,
__String5
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC