예제 #1
0
파일: usb_ctl.c 프로젝트: hugh712/Jollen
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 );
}
예제 #2
0
파일: hub.c 프로젝트: granberro/PSjbiPAQ
  .bLength =		USB_DT_INTERFACE_SIZE,
  .bDescriptorType =	USB_DT_INTERFACE,
  .bInterfaceNumber =	0,
  .bAlternateSetting = 0x00,
  .bNumEndpoints =	1, 
  .bInterfaceClass =	USB_CLASS_HUB,
  .bInterfaceSubClass =	0,
  .bInterfaceProtocol = 0,
  .iInterface =		0
};

/* Hub endpoint Descriptor 1 ( ep2in)*/
static const usb_endpoint_descriptor hub_endpoint_1 = {
  .bLength =		USB_DT_ENDPOINT_SIZE,
  .bDescriptorType =	USB_DT_ENDPOINT,
  .bEndpointAddress =	USB_EP_ADDRESS( 2, USB_IN ),
  .bmAttributes =	USB_EP_INT, 
  .wMaxPacketSize =	cpu_to_le16(1), // cpu_to_le16(8) ojo
  .bInterval =		12	// frames -> 32 ms
};

/* Hub endpoint Descriptor 2 ( ep1out)*/
static const usb_endpoint_descriptor hub_endpoint_2 = {
  .bLength =		USB_DT_ENDPOINT_SIZE,
  .bDescriptorType =	USB_DT_ENDPOINT,
  .bEndpointAddress =	USB_EP_ADDRESS( 1, USB_OUT),
  .bmAttributes =	USB_EP_INT, 
  .wMaxPacketSize =	cpu_to_le16(8),
  .bInterval =		12	// frames -> 32 ms
};