static void USB_Device_GetInternalSerialDescriptor(void) { struct { USB_Descriptor_Header_t Header; uint16_t UnicodeString[INTERNAL_SERIAL_LENGTH_BITS / 4]; } SignatureDescriptor; SignatureDescriptor.Header.Type = DTYPE_String; SignatureDescriptor.Header.Size = USB_STRING_LEN(INTERNAL_SERIAL_LENGTH_BITS / 4); USB_Device_GetSerialString(SignatureDescriptor.UnicodeString); Endpoint_ClearSETUP(); Endpoint_Write_Control_Stream_LE(&SignatureDescriptor, sizeof(SignatureDescriptor)); Endpoint_ClearOUT(); }
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .EndpointAddress = (ENDPOINT_DIR_OUT | AVRISP_DATA_OUT_EPNUM), .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = AVRISP_DATA_EPSIZE, .PollingIntervalMS = 0x0A }, }; /** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate * via the language ID table available at USB.org what languages the device supports for its string descriptors. */ const USB_Descriptor_String_t PROGMEM AVRISP_LanguageString = { .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, .UnicodeString = {LANGUAGE_ID_ENG} }; /** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ const USB_Descriptor_String_t PROGMEM AVRISP_ManufacturerString = { .Header = {.Size = USB_STRING_LEN(5), .Type = DTYPE_String}, .UnicodeString = L"ATMEL" };
.DATA_InfoEndpoint = { .Header = { .Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint }, .EndpointAddress = (ENDPOINT_DIR_IN | INFO_EPNUM), .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = INFO_EPSIZE, .PollingIntervalMS = 0x0 }, }; const USB_Descriptor_String_t PROGMEM LanguageString = { .Header = { .Size = USB_STRING_LEN(1), .Type = DTYPE_String }, .UnicodeString = { LANGUAGE_ID_ENG }, }; const USB_Descriptor_String_t PROGMEM ManufacturerString = { .Header = { .Size = USB_STRING_LEN(6), .Type = DTYPE_String }, .UnicodeString = L"jwatte", };
.EndpointSize = MASS_STORAGE_IO_EPSIZE, .PollingIntervalMS = 0x01 }, #if defined(USB_DEVICE_ROM_DRIVER) && defined(__LPC11UXX__) || defined(__LPC13UXX__) // Required by IP3511 .Configuration_Termination = 0x00 #endif }; /** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate * via the language ID table available at USB.org what languages the device supports for its string descriptors. */ uint8_t LanguageString[] = { USB_STRING_LEN(1), DTYPE_String, WBVAL(LANGUAGE_ID_ENG), }; USB_Descriptor_String_t *LanguageStringPtr = (USB_Descriptor_String_t*)LanguageString; /** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ uint8_t ManufacturerString[] = { USB_STRING_LEN(3), DTYPE_String, WBVAL('N'), WBVAL('X'),
{ .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .EndpointAddress = (ENDPOINT_DIR_IN | KEYBOARD_EPNUM), .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = KEYBOARD_EPSIZE, .PollingIntervalMS = 0x01 }, }; /** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate * via the language ID table available at USB.org what languages the device supports for its string descriptors. */ const USB_Descriptor_String_t PROGMEM LanguageString = { .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, .UnicodeString = {LANGUAGE_ID_ENG} }; /** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ const USB_Descriptor_String_t PROGMEM ManufacturerString = { .Header = {.Size = USB_STRING_LEN(32), .Type = DTYPE_String}, .UnicodeString = L"Dean Camera and Denver Gingerich" };
.PollingIntervalMS = 0x00 }, }; /** * Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate * via the language ID table available at USB.org what languages the device supports for its string descriptors. */ const USB_Descriptor_String_t PROGMEM LanguageString = { .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, .UnicodeString = {LANGUAGE_ID_ENG} }; /** * Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ const USB_Descriptor_String_t PROGMEM ManufacturerString = { //.UnicodeString = L"Dean Camera" #if defined CHERRY_COMPACT .Header = {.Size = USB_STRING_LEN(6), .Type = DTYPE_String},
.Class = 0xFF, .SubClass = 0x00, .Protocol = 0x00, .InterfaceStrIndex = NO_DESCRIPTOR } }; /** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate * via the language ID table available at USB.org what languages the device supports for its string descriptors. */ USB_Descriptor_String_t PROGMEM LanguageString = { .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, .UnicodeString = {LANGUAGE_ID_ENG} }; /** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ USB_Descriptor_String_t PROGMEM ManufacturerString = { .Header = {.Size = USB_STRING_LEN(19), .Type = DTYPE_String}, .UnicodeString = L"www.AVRopendous.org" };
*/ #include "UsbRom.h" #if defined(USB_DEVICE_ROM_DRIVER) /***************************************************************************** * Private types/enumerations/variables ****************************************************************************/ /***************************************************************************** * Public types/enumerations/variables ****************************************************************************/ uint8_t StringDescriptor[] = { USB_STRING_LEN(1), /* LanguageString */ DTYPE_String, WBVAL(LANGUAGE_ID_ENG), USB_STRING_LEN(3), /* ManufacturerString */ DTYPE_String, WBVAL('N'), WBVAL('X'), WBVAL('P'), USB_STRING_LEN(22 + 1), /* ProductString */ DTYPE_String, WBVAL('L'), WBVAL('P'), WBVAL('C'), WBVAL('U'), WBVAL('S'), WBVAL('B'), WBVAL('l'), WBVAL('i'), WBVAL('b'), WBVAL( ' '), WBVAL('K'), WBVAL('e'), WBVAL('y'), WBVAL('b'), WBVAL('o'), WBVAL('a'), WBVAL('r'), WBVAL('d'), WBVAL(' '), WBVAL('D'), WBVAL('e'), WBVAL('m'), WBVAL('o') }; extern USB_Descriptor_Device_t DeviceDescriptor;
// .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | MOUSE_EPNUM), .EndpointAddress = (ENDPOINT_DIR_IN | MOUSE_EPNUM), // End .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = MOUSE_EPSIZE, .PollingIntervalMS = 0x01 }, .HID_Termination = 0x00 }; /** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate * via the language ID table available at USB.org what languages the device supports for its string descriptors. */ uint8_t LanguageString[] = { USB_STRING_LEN(1), DTYPE_String, WBVAL(LANGUAGE_ID_ENG), }; USB_Descriptor_String_t *LanguageStringPtr = (USB_Descriptor_String_t *) LanguageString; /** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ uint8_t ManufacturerString[] = { USB_STRING_LEN(3), DTYPE_String, WBVAL('N'), WBVAL('X'), WBVAL('P'),
}, .CDC_DataInEndpoint = { .Header = { .Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint, }, .EndpointAddress = DEMO_CDC_TX_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = DEMO_CDC_TXRX_EPSIZE, .PollingIntervalMS = 0x05, } }; const USB_Descriptor_String_t PROGMEM language_string = { .Header = { .Size = USB_STRING_LEN(1), .Type = DTYPE_String, }, .UnicodeString = { LANGUAGE_ID_ENG, }, }; const USB_Descriptor_String_t PROGMEM manufacturer_string = { .Header = { .Size = USB_STRING_LEN(DEMO_MANUFACTURER_STR_LEN), .Type = DTYPE_String, }, .UnicodeString = DEMO_MANUFACTURER_STR, };
.EndpointAddress = (ENDPOINT_DIR_OUT | LABTOOL_OUT_EPNUM), .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = LABTOOL_IO_EPSIZE, .PollingIntervalMS = 0x01 }, .LabTool_Termination = 0x00 }; /** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate * via the language ID table available at USB.org what languages the device supports for its string descriptors. */ uint8_t LanguageString[] = { USB_STRING_LEN(1), DTYPE_String, WBVAL(LANGUAGE_ID_ENG), }; USB_Descriptor_String_t *LanguageStringPtr = (USB_Descriptor_String_t*)LanguageString; /** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ uint8_t ManufacturerString[] = { USB_STRING_LEN(16), DTYPE_String, WBVAL('E'), WBVAL('m'),
.bInterfaceSubClass = 0x00, .bInterfaceProtocol = 0x00, .iInterface = 0x11, }, .ReportInEndpoint = { .bLength = sizeof(USB_EndpointDescriptor), .bDescriptorType = USB_DTYPE_Endpoint, .bEndpointAddress = USB_EP_REPORT_IN, .bmAttributes = (USB_EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .wMaxPacketSize = 8, .bInterval = 10, }, }; __attribute__((__aligned__(4))) const USB_StringDescriptor language_string = { .bLength = USB_STRING_LEN(1), .bDescriptorType = USB_DTYPE_String, .bString = {USB_LANGUAGE_EN_US}, }; __attribute__((__aligned__(4))) const USB_StringDescriptor msft_os = { .bLength = 18, .bDescriptorType = USB_DTYPE_String, .bString = u"MSFT100\xee" }; __attribute__((__aligned__(4))) const USB_MicrosoftCompatibleDescriptor msft_compatible = { .dwLength = sizeof(USB_MicrosoftCompatibleDescriptor) + sizeof(USB_MicrosoftCompatibleDescriptor_Interface), .bcdVersion = 0x0100, .wIndex = 0x0004, .bCount = 1,
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .EndpointAddress = OUT_EPNUM, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = EPSIZE, .PollingIntervalMS = 0x05 } }; /** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate * via the language ID table available at USB.org what languages the device supports for its string descriptors. */ const USB_Descriptor_String_t PROGMEM LanguageString = { .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, .UnicodeString = {LANGUAGE_ID_ENG} }; /** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ const USB_Descriptor_String_t PROGMEM ManufacturerString = { .Header = {.Size = USB_STRING_LEN(8), .Type = DTYPE_String}, .UnicodeString = L"Logitech" };
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .EndpointAddress = (ENDPOINT_DIR_OUT | MASS_STORAGE_OUT_EPNUM), .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = MASS_STORAGE_IO_EPSIZE, .PollingIntervalMS = 0x01 }, .MS_Termination = 0x00 }; /** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate * via the language ID table available at USB.org what languages the device supports for its string descriptors. */ uint8_t LanguageString[] = { USB_STRING_LEN(1), DTYPE_String, WBVAL(LANGUAGE_ID_ENG), }; USB_Descriptor_String_t *LanguageStringPtr = (USB_Descriptor_String_t *) LanguageString; /** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ uint8_t ManufacturerString[] = { USB_STRING_LEN(3), DTYPE_String, WBVAL('s'), WBVAL('v'), WBVAL('o'),
.endpoint = { .Header = { .Size = sizeof (USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint }, .EndpointAddress = MY_EPADDR, .Attributes = \ (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = MY_EPSIZE, .PollingIntervalMS = 5 }, }; const USB_Descriptor_String_t PROGMEM LanguageString = { .Header = { .Size = USB_STRING_LEN(1), .Type = DTYPE_String }, .UnicodeString = { LANGUAGE_ID_ENG } }; #define USBSTRING_INITIALIZER(str) \ { \ .Header = { \ .Size = USB_STRING_LEN(sizeof (str) / sizeof (str[0]) - 1), \ .Type = DTYPE_String \ }, \ .UnicodeString = L##str \ }
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM), .Attributes = EP_TYPE_BULK, .EndpointSize = CDC_TXRX_EPSIZE, .PollingIntervalMS= 0x00 } }; /** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate * via the language ID table available at USB.org what languages the device supports for its string descriptors. */ USB_Descriptor_String_t PROGMEM LanguageString = { .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, .UnicodeString = {LANGUAGE_ID_ENG} }; /** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ USB_Descriptor_String_t PROGMEM ManufacturerString = { .Header = {.Size = USB_STRING_LEN(17), .Type = DTYPE_String}, .UnicodeString = L"Lime Microsystems" };
.EndpointAddress = (ENDPOINT_DIR_IN | JOYSTICK2_EPNUM), .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = 32, .PollingIntervalMS = 0x02 }, }; /** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate * via the language ID table available at USB.org what languages the device supports for its string descriptors. */ const USB_Descriptor_String_t PROGMEM LanguageString = { .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, .UnicodeString = {LANGUAGE_ID_ENG} }; /** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ const USB_Descriptor_String_t PROGMEM ManufacturerString = { .Header = {.Size = USB_STRING_LEN(7), .Type = DTYPE_String}, .UnicodeString = L"Arduino" };
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = CDC_TXRX_EPSIZE, .PollingIntervalMS = 0x01 } }; /** Language descriptor structure. This descriptor, located in FLASH memory, is * returned when the host requests the string descriptor with index 0 (the * first index). It is actually an array of 16-bit integers, which indicate * via the language ID table available at USB.org what languages the device * supports for its string descriptors. */ const USB_Descriptor_String_t PROGMEM language_string = { .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, .UnicodeString = {LANGUAGE_ID_ENG} }; /** Manufacturer descriptor string. This is a Unicode string containing the * manufacturer's details in human readable form, and is read out upon request * by the host when the appropriate string ID is requested, listed in the * Device Descriptor. */ const USB_Descriptor_String_t PROGMEM manufacturer_string = { .Header = {.Size = USB_STRING_LEN(8), .Type = DTYPE_String}, .UnicodeString = { 'I','n','f','i','n','e','o','n'}
USB_DESC_BYTE(2), // iProduct. USB_DESC_BYTE(0), // iSerialNumber. USB_DESC_BYTE(1) // bNumConfigurations. }; // Configuration static const uint8_t ConfigDescriptor[] = { USB_DESC_BYTE(2), USB_DESC_BYTE(dtConfiguration), }; // ================================= Strings =================================== // U.S. English language identifier static const uint8_t LanguageString[] = { USB_DESC_BYTE(USB_STRING_LEN(1)), USB_DESC_BYTE(dtString), USB_DESC_WORD(0x0409) }; // Vendor string static const uint8_t ManufacturerString[] = { USB_DESC_BYTE(USB_STRING_LEN(38)), USB_DESC_BYTE(dtString), 'S', 0, 'T', 0, 'M', 0, 'i', 0, 'c', 0, 'r', 0, 'o', 0, 'e', 0, 'l', 0, 'e', 0, 'c', 0, 't', 0, 'r', 0, 'o', 0, 'n', 0, 'i', 0, 'c', 0, 's', 0 }; // Device Description string static const uint8_t ProductString[] = {
.EndpointAddress = CDC_IN_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = CDC_EPSIZE, .PollingIntervalMS = 0x05 }, #endif }; /******************************************************************************* * String Descriptors ******************************************************************************/ const USB_Descriptor_String_t PROGMEM LanguageString = { .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, .UnicodeString = {LANGUAGE_ID_ENG} }; const USB_Descriptor_String_t PROGMEM ManufacturerString = { /* subtract 1 for null terminator */ .Header = {.Size = USB_STRING_LEN(sizeof(STR(MANUFACTURER))-1), .Type = DTYPE_String}, .UnicodeString = LSTR(MANUFACTURER) }; const USB_Descriptor_String_t PROGMEM ProductString = { /* subtract 1 for null terminator */
.bLength = sizeof(USB_ENDPOINT_DESCRIPTOR), .bDescriptorType = USB_ENDPOINT_DESCRIPTOR_TYPE, .bEndpointAddress = CUSTOM_EP_IN, .bmAttributes = USB_ENDPOINT_TYPE_BULK, .wMaxPacketSize = 64, }, .Custom_BulkOUT = { .bLength = sizeof(USB_ENDPOINT_DESCRIPTOR), .bDescriptorType = USB_ENDPOINT_DESCRIPTOR_TYPE, .bEndpointAddress = CUSTOM_EP_OUT, .bmAttributes = USB_ENDPOINT_TYPE_BULK, .wMaxPacketSize = 64, }, #endif .ConfigDescTermination = 0, }; ALIGNED(4) USB_STR_DESCRIPTOR USB_StringDescriptor = { .LangID = { .bLength = 0x04, .bDescriptorType = USB_STRING_DESCRIPTOR_TYPE }, .strLangID= {0x0409}, // US English .Manufacturer = { .bLength = USB_STRING_LEN(sizeof(CFG_USB_STRING_MANUFACTURER)-1), .bDescriptorType = USB_STRING_DESCRIPTOR_TYPE }, .Product = { .bLength = USB_STRING_LEN(sizeof(CFG_USB_STRING_PRODUCT)-1), .bDescriptorType = USB_STRING_DESCRIPTOR_TYPE }, .Serial = { .bLength = USB_STRING_LEN(USB_STRING_SERIAL_LEN), .bDescriptorType = USB_STRING_DESCRIPTOR_TYPE }, }; #endif /* CFG_USB */