static void initialize_descriptors(void) { LOG("\n"); desc.dev.bLength = sizeof( device_desc_t ); desc.dev.bDescriptorType = USB_DESC_DEVICE; desc.dev.bcdUSB = 0x100; /* 1.1 */ desc.dev.bDeviceClass = 0xFF; /* vendor specific */ desc.dev.bDeviceSubClass = 0x0; desc.dev.bDeviceProtocol = 0x0; desc.dev.bMaxPacketSize0 = 0x8; /* ep0 max fifo size in s3c2410*/ desc.dev.idVendor = 0x49f; /* vendor ID undefined */ desc.dev.idProduct = 0x505a; /* product */ desc.dev.bcdDevice = 0x01 ; /* vendor assigned device release num */ desc.dev.iManufacturer = 0; /* index of manufacturer string */ desc.dev.iProduct = 0; /* index of product description string */ desc.dev.iSerialNumber = 0; /* index of string holding product s/n */ desc.dev.bNumConfigurations = 0x1; desc.b.cfg.bLength = sizeof( config_desc_t ); desc.b.cfg.bDescriptorType = USB_DESC_CONFIG; desc.b.cfg.wTotalLength = make_word_c( sizeof(struct cdb) ); desc.b.cfg.bNumInterfaces = 1; desc.b.cfg.bConfigurationValue = 1; desc.b.cfg.iConfiguration = 0; desc.b.cfg.bmAttributes = USB_CONFIG_BUSPOWERED; desc.b.cfg.MaxPower = USB_POWER( 500 ); desc.b.intf.bLength = sizeof( intf_desc_t ); desc.b.intf.bDescriptorType = USB_DESC_INTERFACE; desc.b.intf.bInterfaceNumber = 0x0; /* unique intf index*/ desc.b.intf.bAlternateSetting = 0x0; desc.b.intf.bNumEndpoints = 2; /* endpoint number excluding ep0 */ desc.b.intf.bInterfaceClass = 0xFF; /* vendor specific */ desc.b.intf.bInterfaceSubClass = 0x0; desc.b.intf.bInterfaceProtocol = 0x0; desc.b.intf.iInterface = 0x0; desc.b.ep1.bLength = sizeof( ep_desc_t ); desc.b.ep1.bDescriptorType = USB_DESC_ENDPOINT; desc.b.ep1.bEndpointAddress = USB_EP_ADDRESS( 1, USB_OUT ); desc.b.ep1.bmAttributes = USB_EP_BULK; desc.b.ep1.wMaxPacketSize = make_word_c( 64 ); desc.b.ep1.bInterval = 0x0; desc.b.ep2.bLength = sizeof( ep_desc_t ); desc.b.ep2.bDescriptorType = USB_DESC_ENDPOINT; desc.b.ep2.bEndpointAddress = USB_EP_ADDRESS( 2, USB_IN ); desc.b.ep2.bmAttributes = USB_EP_BULK; desc.b.ep2.wMaxPacketSize = make_word_c( 64 ); desc.b.ep2.bInterval = 0x0; /* set language */ /* See: http://www.usb.org/developers/data/USB_LANGIDs.pdf */ sd_zero.bDescriptorType = USB_DESC_STRING; sd_zero.bLength = sizeof( string_desc_t ); sd_zero.bString[0] = make_word_c( 0x409 ); /* American English */ s3c2410_usb_set_string_descriptor( 0, &sd_zero ); }
/* twiddle_descriptors() * It is between open() and start(). Setup descriptors. */ static void twiddle_descriptors( void ) { desc_t * pDesc = pxa_usb_get_descriptor_ptr(); string_desc_t * pString; pDesc->b.ep1.wMaxPacketSize = make_word_c( RX_PACKET_SIZE ); pDesc->b.ep1.bmAttributes = USB_EP_BULK; pDesc->b.ep2.wMaxPacketSize = make_word_c( TX_PACKET_SIZE ); pDesc->b.ep2.bmAttributes = USB_EP_BULK; if ( 1 ) { pDesc->dev.idVendor = make_word_c( 0x0C9F ); pDesc->dev.idProduct = 0x0453; /* revision 1.00 */ pDesc->dev.bcdDevice = make_word_c( 0x0100 ); pDesc->b.cfg.bmAttributes = USB_CONFIG_SELFPOWERED; pDesc->b.cfg.MaxPower = 0; pString = pxa_usb_kmalloc_string_descriptor( "BTicino" ); if ( pString ) { pxa_usb_set_string_descriptor( 1, pString ); pDesc->dev.iManufacturer = 1; } pString = pxa_usb_kmalloc_string_descriptor( "F453AV" ); if ( pString ) { pxa_usb_set_string_descriptor( 2, pString ); pDesc->dev.iProduct = 2; } pString = pxa_usb_kmalloc_string_descriptor( "00000000" ); if ( pString ) { pxa_usb_set_string_descriptor( 3, pString ); pDesc->dev.iSerialNumber = 3; } pString = pxa_usb_kmalloc_string_descriptor( "HHT Bulk Transfer" ); if ( pString ) { pxa_usb_set_string_descriptor( 4, pString ); pDesc->b.intf.iInterface = 4; } pxa_set_configured_callback( configured_notify ); } }