error_type_t usb_hiddevice_init(void) { usb_intf_config_t usbInterface0; error_type_t status; HID_DESCRIPTOR USB_HID_DESCRIPTOR; /* init the HID descriptor */ USB_HID_DESCRIPTOR.bLength = (uint8_t) sizeof(HID_DESCRIPTOR); /* size of this descriptor in bytes */ USB_HID_DESCRIPTOR.bDescriptorType = HID_DESCRIPTOR_TYPE; /* HID descriptor type */ USB_HID_DESCRIPTOR.bcdHID = WBVAL(HID_V1_10); /* USB HID specification release version */ USB_HID_DESCRIPTOR.bCountrycode = 0x00; /* Hardware target country */ USB_HID_DESCRIPTOR.bNumDescriptorType = 0x01; /* Number of HID class descriptors to follow */ USB_HID_DESCRIPTOR.bReportDescriptorType = HID_REPORT_DESCRIPTOR_TYPE; /* Report descriptor type */ USB_HID_DESCRIPTOR.wDescriptorLength = WBVAL(sizeof(ReportDescriptor)); /* Total length of Report decriptor*/ /* init the interface0 */ usbInterface0.NumOuts = 1; usbInterface0.NumIns = 1; usbInterface0.EPType = e_INTERRUPT; usbInterface0.ClassCode = HID_INTERFACE_CLASS; usbInterface0.SubClass = HID_DEVICE_SUBCLASS_NONEBOOT ; usbInterface0.Protocol = HID_PROTOCOL_NONE; usbInterface0.Function = e_HID; usbInterface0.ClassDesc = (uint8_t *) &USB_HID_DESCRIPTOR; usbInterface0.ClassDescSize = sizeof(USB_HID_DESCRIPTOR) ; usbInterface0.InterfAssocDes = NULL ; usbInterface0.InterfAssocName = NULL; usbInterface0.InterfaceName = HidInter; usbInterface0.ZeroTermination = USB_DEVICE_ZERO_TERMINATE; usbInterface0.InterfaceCallback = hidInterface0Callback; usbInterface0.ZLP = USB_DEVICE_DONT_ZLP; if ((status = usb_dev_intf_add(USB_HID_INTERFACE, &usbInterface0)) != OK) { DPRINTF("\nUSB usbDevOpen failed for usb_prtdevice_init0000\n"); } return status; }
HID_LogicalMax(127), HID_ReportSize(8), HID_ReportCount(2), HID_Input(HID_Data | HID_Variable | HID_Relative), HID_EndCollection, HID_EndCollection, }; const uint16_t Mouse_ReportDescSize = sizeof(Mouse_ReportDescriptor); /** * USB Standard Device Descriptor */ ALIGNED(4) const uint8_t USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* bcdUSB : 2.00*/ 0x00, /* bDeviceClass */ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0x1FC9), /* idVendor */ WBVAL(0x0087), /* idProduct */ WBVAL(0x0100), /* bcdDevice : 1.00 */ 0x01, /* iManufacturer */ 0x02, /* iProduct */ 0x03, /* iSerialNumber */ 0x01 /* bNumConfigurations */ }; /** * USB FSConfiguration Descriptor
#include <incl/usbsysinit.h> #include <incl/usb_cdc.h> /* These strings are for identifying the various interfaces. */ static char CdcInter[] = "MARVELL-MC200-VCOM"; uint8_t EP0Buf[8]; uint8_t CdcClassDesc[] = { /*Header Functional Descriptor*/ 0x05, /* bLength: Endpoint Descriptor size */ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ CDC_HEADER, /* bDescriptorSubtype: Header Func Desc */ WBVAL(CDC_V1_10), /* 1.10 *//* bcdCDC */ /*Call Management Functional Descriptor */ 0x05, /* bFunctionLength */ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ CDC_CALL_MANAGEMENT, /* bDescriptorSubtype: Call Management Func Desc */ 0x01, /* bmCapabilities: device handles call management */ 0x01, /* bDataInterface: CDC data IF ID */ /*Abstract Control Management Functional Descriptor*/ 0x04, /* bFunctionLength */ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ CDC_ABSTRACT_CONTROL_MANAGEMENT, /* bDescriptorSubtype: Abstract Control Management desc */ 0x02, /* bmCapabilities: SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE supported */ /*Union Functional Descriptor*/ 0x05, /* bFunctionLength */ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ CDC_UNION, /* bDescriptorSubtype: Union func desc */
/***************************************************************************** * Private types/enumerations/variables ****************************************************************************/ /***************************************************************************** * Public types/enumerations/variables ****************************************************************************/ /** * USB Standard Device Descriptor */ ALIGNED(4) const uint8_t USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* bcdUSB: 2.00 */ 0xEF, /* bDeviceClass */ 0x02, /* bDeviceSubClass */ 0x01, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0x1FC9), /* idVendor */ WBVAL(0x0083), /* idProduct */ WBVAL(0x0100), /* bcdDevice: 1.00 */ 0x01, /* iManufacturer */ 0x02, /* iProduct */ 0x03, /* iSerialNumber */ 0x01 /* bNumConfigurations */ }; /** * USB Device Qualifier
#include "usb.h" #include "audio.h" #include "usbcfg.h" #include "usbdesc.h" typedef struct SINGSTARMICState { USBDevice dev; //nothing yet } SINGSTARMICState; /* descriptor dumped from a real singstar MIC adapter */ static const uint8_t singstar_mic_dev_descriptor[] = { /* bLength */ 0x12, //(18) /* bDescriptorType */ 0x01, //(1) /* bcdUSB */ WBVAL(0x0110), //(272) /* bDeviceClass */ 0x00, //(0) /* bDeviceSubClass */ 0x00, //(0) /* bDeviceProtocol */ 0x00, //(0) /* bMaxPacketSize0 */ 0x08, //(8) /* idVendor */ WBVAL(0x1415), //(5141) /* idProduct */ WBVAL(0x0000), //(0) /* bcdDevice */ WBVAL(0x0001), //(1) /* iManufacturer */ 0x01, //(1) /* iProduct */ 0x02, //(2) /* iSerialNumber */ 0x00, //(0) /* bNumConfigurations */ 0x01, //(1) }; static const uint8_t singstar_mic_config_descriptor[] = {
#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; extern USB_Descriptor_Configuration_t ConfigurationDescriptor; extern USB_Descriptor_HIDReport_Datatype_t KeyboardReport[];
.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'), }; USB_Descriptor_String_t *ManufacturerStringPtr = (USB_Descriptor_String_t *) ManufacturerString;
}, #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'), WBVAL('P'), };
* licensor's relevant copyrights in the software, without fee, provided that it * is used in conjunction with NXP Semiconductors microcontrollers. This * copyright, permission, and disclaimer notice must appear in all copies of * this code. */ #include "UsbRom.h" #if defined(USB_DEVICE_ROM_DRIVER) const 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(18), /* ProductString */ DTYPE_String, WBVAL('n'),WBVAL('x'),WBVAL('p'),WBVAL('U'),WBVAL('S'),WBVAL('B'),WBVAL('l'),WBVAL('i'),WBVAL('b'),WBVAL(' '), WBVAL('C'),WBVAL('D'),WBVAL('C'),WBVAL(' '), WBVAL('D'),WBVAL('e'),WBVAL('m'),WBVAL('o') }; extern const USB_Descriptor_Device_t PROGMEM DeviceDescriptor; extern const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor; extern USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface;
HID_UsageMin(0), HID_UsageMax(0x40), // HID_ReportCount(8), //HID_ReportSize(1), HID_Output(HID_Data), HID_EndCollection, }; const WORD HID_ReportDescSize = sizeof(HID_ReportDescriptor); /* USB Standard Device Descriptor */ const BYTE USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* 2.20 */ /* bcdUSB */ 0x00, /* bDeviceClass */ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0xC251), /* idVendor */ WBVAL(0x2201), /* idProduct */ WBVAL(0x0200), /* 2.00 */ /* bcdDevice */ 0x04, /* iManufacturer */ 0x20, /* iProduct */ 0x44, /* iSerialNumber */ 0x01 /* bNumConfigurations */ }; /* USB Configuration Descriptor */ /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
#define BULK_IN_EP 1 #define BULK_OUT_EP 2 // Configuration descriptor params #define USB_MAX_CURRENT (200/USB_CURRENT_UNIT) #define USB_ATTRIBUTES (USB_ATTRIBUTE_BASE | USB_ATTRIBUTE_SELF_POWER) // Extended descriptor params #define OS_DESCRIPTOR_EX_VERSION 0x0100 /* USB Standard Device Descriptor */ ALIGNED(4) const UINT8 USB_DeviceDescriptor[] = { USB_DEVICE_DESCRIPTOR_LENGTH, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0110), /* 1.10 */ /* bcdUSB */ 0x00, /* bDeviceClass */ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ MAX_EP0_SIZE, /* bMaxPacketSize0 */ WBVAL(VENDOR_ID), /* idVendor */ WBVAL(PRODUCT_ID), /* idProduct */ WBVAL(DEVICE_RELEASE_VERSION), /* bcdDevice */ MANUFACTURER_NAME_INDEX, /* iManufacturer */ PRODUCT_NAME_INDEX, /* iProduct */ SERIAL_NUMBER_INDEX, /* iSerialNumber */ 0x01 /* bNumConfigurations */ }; /* USB Configuration Descriptor */ /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
/***************************************************************************** * Private types/enumerations/variables ****************************************************************************/ /***************************************************************************** * Public types/enumerations/variables ****************************************************************************/ /** * USB Standard Device Descriptor */ ALIGNED(4) const uint8_t USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* bcdUSB: 2.00 */ 0x00, /* bDeviceClass */ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0x1FC9), /* idVendor */ WBVAL(WCID_VENDOR_CODE), /* idProduct */ WBVAL(0x0100), /* bcdDevice: 1.00 */ 0x01, /* iManufacturer */ 0x02, /* iProduct */ 0x03, /* iSerialNumber */ 0x01 /* bNumConfigurations */ }; /** * USB Device Qualifier
/* * msc_desc.c * * Created on: 2014.07.04 * Author: Kestutis Bivainis */ #include "app_usbd_cfg.h" /** * USB Standard Device Descriptor */ ALIGNED(4) const uint8_t USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* bcdUSB */ 0x00, /* bDeviceClass */ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0x0D28), /* idVendor */ WBVAL(0x0206), /* idProduct */ WBVAL(0x0100), /* bcdDevice */ 0x01, /* iManufacturer Index to string descriptor containing manufacturer. */ 0x02, /* iProduct Index to string descriptor containing product. */ 0x03, /* iSerialNumber Index to string descriptor containing serial number. */ 0x01 /* bNumConfigurations */ }; /** * USB FSConfiguration Descriptor
.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'), WBVAL('b'), WBVAL('e'),
/***************************************************************************** * Private types/enumerations/variables ****************************************************************************/ /***************************************************************************** * Public types/enumerations/variables ****************************************************************************/ /** * USB Standard Device Descriptor */ ALIGNED(4) const uint8_t USB_msc_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* bcdUSB: 2.00 */ 0x00, /* bDeviceClass */ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0x1FC9), /* idVendor */ WBVAL(0x0042), /* idProduct */ WBVAL(0x0100), /* bcdDevice: 1.00 */ 0x01, /* iManufacturer */ 0x02, /* iProduct */ 0x03, /* iSerialNumber */ 0x01 /* bNumConfigurations */ }; /** * USB Device Qualifier
HID_Usage(0x01), HID_Output(HID_Data | HID_Variable | HID_Absolute), HID_ReportCount(HID_FEATURE_REPORT_BYTES), HID_Usage(0x01), HID_Feature(HID_Data | HID_Variable | HID_Absolute), HID_EndCollection, }; const uint16_t HID_ReportDescSize = sizeof(HID_ReportDescriptor); /** * USB Standard Device Descriptor */ ALIGNED(4) const uint8_t USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* bcdUSB 2.0 */ 0x00, /* bDeviceClass */ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0x1FC9), /* idVendor */ WBVAL(0x0081), /* idProduct */ WBVAL(0x0100), /* bcdDevice */ 0x01, /* iManufacturer */ 0x02, /* iProduct */ 0x03, /* iSerialNumber */ 0x01 /* bNumConfigurations */ }; /** * USB FSConfiguration Descriptor
* gives you the right to use this software. * * Copyright (c) 2009 Keil - An ARM Company. All rights reserved. *---------------------------------------------------------------------------*/ #include "lpc13xx.h" #include "usb.h" #include "usbdesc.h" #include "config.h" /* USB String Descriptor (optional) */ const uint8_t USB_StringDescriptor[] = { /* Index 0x00: LANGID Codes */ 0x04, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(NXP_VID), /* US English */ /* wLANGID */ /* Index 0x04: Manufacturer */ 0x1C, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ 'N',0, 'X',0, 'P',0, ' ',0, 'S',0, 'E',0, 'M',0, 'I',0, 'C',0, 'O',0, 'N',0, 'D',0,
HID_Usage(0x01), HID_Output(HID_Data | HID_Variable | HID_Absolute), HID_ReportCount(DEVICE_USB_HID_FEATURE_REPORT_SIZE), HID_Usage(0x01), HID_Feature(HID_Data | HID_Variable | HID_Absolute), HID_EndCollection, }; const uint16_t HID_ReportDescSize = sizeof(HID_ReportDescriptor); /** * USB Standard Device Descriptor */ ALIGNED(4) const uint8_t USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* bcdUSB 2.0 */ 0x00, /* bDeviceClass */ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(DEVICE_USB_VENDOR_ID), /* idVendor */ WBVAL(DEVICE_USB_PRODUCT_ID), /* idProduct */ WBVAL(DEVICE_USB_DEVICE_REVISION), /* bcdDevice */ 0x01, /* iManufacturer */ 0x02, /* iProduct */ 0x03, /* iSerialNumber */ 0x01 /* bNumConfigurations */ }; /** * USB FSConfiguration Descriptor
NULL , USBD_video_GetCfgDesc, #ifdef USB_OTG_HS_CORE USBD_video_GetCfgDesc, /* use same config as per FS */ #endif }; /* USB VIDEO device Configuration Descriptor */ static uint8_t usbd_video_CfgDesc[] = { /* Configuration 1 */ USB_CONFIGUARTION_DESC_SIZE, // bLength 9 USB_CONFIGURATION_DESCRIPTOR_TYPE, // bDescriptorType 2 WBVAL(USB_VIDEO_DESC_SIZ), 0x02, // bNumInterfaces 2 0x01, // bConfigurationValue 1 ID of this configuration 0x00, // iConfiguration 0 no description available USB_CONFIG_BUS_POWERED , // bmAttributes 0x80 Bus Powered USB_CONFIG_POWER_MA(100), // bMaxPower 100 mA /* Interface Association Descriptor */ UVC_INTERFACE_ASSOCIATION_DESC_SIZE, // bLength 8 USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE, // bDescriptorType 11 0x00, // bFirstInterface 0 0x02, // bInterfaceCount 2 CC_VIDEO, // bFunctionClass 14 Video SC_VIDEO_INTERFACE_COLLECTION, // bFunctionSubClass 3 Video Interface Collection PC_PROTOCOL_UNDEFINED, // bInterfaceProtocol 0 (protocol undefined)
#define EN_USBREG (1<<14) static ROM **rom = (ROM **) 0x1fff1ff8; void USB_IRQHandler (void) { (*rom)->pUSBD->isr (); } /* USB String Descriptor (optional) */ const uint8_t USB_StringDescriptor[] = { /* Index 0x00: LANGID Codes */ 0x04, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL (0x0409), /* US English - wLANGID */ /* Index 0x04: Manufacturer */ 0x1C, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ 'B', 0, 'i', 0, 't', 0, 'm', 0, 'a', 0, 'n', 0, 'u', 0, 'f', 0, 'a', 0, 'k', 0, 't', 0, 'u', 0, 'r', 0, /* Index 0x20: Product */ 0x28, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ 'O', 0, 'p', 0, 'e', 0, 'n', 0, 'B', 0, 'e', 0, 'a', 0, 'c', 0, 'o', 0, 'n', 0, ' ', 0, 'U', 0, 'S', 0, 'B', 0, ' ', 0, 'I', 0, 'I', 0, ' ', 0, ' ', 0, /* Index 0x48: Serial Number */ 0x1A, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ '0', 0, '0', 0, '0', 0, '0', 0, '0', 0, '0', 0, '0', 0, '0', 0,
#include "usb.h" #include "usbcfg.h" #include "usbdesc.h" #define ALIGNED(n) __attribute__((aligned (n))) #ifdef __cplusplus extern "C" { #endif /* USB Standard Device Descriptor */ ALIGNED(4) const uint8_t USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* 2.0 */ /* bcdUSB */ 0xff, /* bDeviceClass */ 0x01, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0xb1ac), /* idVendor */ WBVAL(0xf000), /* idProduct */ WBVAL(0x0100), /* 1.00 */ /* bcdDevice */ 0x01, /* iManufacturer */ 0x02, /* iProduct */ 0x03, /* iSerialNumber */ 0x01 /* bNumConfigurations: one possible configuration*/ }; /* USB FSConfiguration Descriptor */ /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
* use without further testing or modification. **********************************************************************/ #include <string.h> #include "usb-desc.h" #ifdef __GNUC__ #define ALIGN4 __attribute__ ((aligned(4))) #else // Keil #define ALIGN4 __align(4) #endif /* USB Standard Device Descriptor */ ALIGN4 const uint8_t USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* 2.0 */ /* bcdUSB */ USB_DEVICE_CLASS_COMMUNICATIONS, /* bDeviceClass CDC*/ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0x1FC9), /* idVendor */ WBVAL(0x0003), /* idProduct */ WBVAL(0x0100), /* 1.00 */ /* bcdDevice */ 0x01, /* iManufacturer */ 0x02, /* iProduct */ 0x03, /* iSerialNumber */ 0x01 /* bNumConfigurations: one possible configuration*/ }; #define WTOTALLENGHT WBVAL((uint16_t)(sizeof (struct UsbConfig)-1)) /* USB Configuration Descriptor */
HID_Output ( HID_Data | HID_Variable | HID_Absolute ), HID_ReportCount ( HID_FEATURE_REPORT_BYTES ), HID_Usage ( 0x01 ), HID_Feature ( HID_Data | HID_Variable | HID_Absolute ), HID_EndCollection, }; const uint16_t HID_ReportDescSize = sizeof(HID_ReportDescriptor); #if (USE_HID_DESC) /* USB Standard Device Descriptor */ ALIGN4 const uint8_t USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* 2.00 */ /* bcdUSB */ 0x00, /* bDeviceClass */ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0x1FC9), /* idVendor */ WBVAL(0x0107), /* idProduct */ WBVAL(0x0100), /* 1.00 */ /* bcdDevice */ 0x01, /* iManufacturer */ 0x02, /* iProduct */ 0x03, /* iSerialNumber */ 0x01 /* bNumConfigurations */ }; /* USB FSConfiguration Descriptor */ /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Nitrokey. If not, see <http://www.gnu.org/licenses/>. */ /* Includes ------------------------------------------------------------------ */ #include "CCIDHID_usb_desc.h" #define WBVAL(x) (x&0xff),((x>>8)&0xff) const uint8_t CCID_DeviceDescriptor[CCID_SIZ_DEVICE_DESC] = { 0x12, /* DeviceDescriptor bLength */ 0x01, /* bDescriptorType */ WBVAL (0x0110), /* bcdUSB, version 1.10 */ 0x00, /* bDeviceClass : each interface define the device class */ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ 0x40, /* bMaxPacketSize0 0x08 - 0x40 = 64 */ WBVAL (GLOBAL_VID), /* VID for CCID driver idVendor */ WBVAL (GLOBAL_PID), /* PID for CCID driver idProduct */ // WBVAL(0x0800), /* Test VID for MS CCID driver idVendor */ // WBVAL(0x0006), /* Test PID for MS CCID driver idProduct */ // WBVAL(0x08e6), /* 0x08e6 = idVendor germalto - for testing */ // WBVAL(0x3437), /* 0x3437 = idProduct germalto usb-sl reader - for // testing */ WBVAL (0x0100), /* bcdDevice version 1.00 */
#include "app_usbd_cfg.h" #ifdef __GNUC__ #define ALIGN4 __attribute__ ((aligned(4))) #else // Keil #define ALIGN4 __align(4) #endif #define _(c) c, 0 /* USB Standard Device Descriptor */ ALIGN4 const uint8_t VCOM_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* 2.0 */ /* bcdUSB */ USB_DEVICE_CLASS_COMMUNICATIONS, /* bDeviceClass CDC*/ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0x1FC9), /* idVendor */ WBVAL(0x0011), /* idProduct */ WBVAL(0x0100), /* 1.00 */ /* bcdDevice */ 0x01, /* iManufacturer */ 0x02, /* iProduct */ 0x04, /* iSerialNumber */ 0x01 /* bNumConfigurations: one possible configuration*/ }; /* USB Configuration Descriptor */ /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
* V1.00 Initial Version *----------------------------------------------------------------------------*/ #include "lpc43xx.H" #include "lpc_types.h" #include "usb.h" #include "cdc.h" #include "usbcfg.h" #include "usbdesc.h" /* USB Standard Device Descriptor */ const uint8_t USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* 2.0 */ /* bcdUSB */ USB_DEVICE_CLASS_COMMUNICATIONS, /* bDeviceClass CDC*/ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0x1FC9), /* idVendor */ WBVAL(0x2002), /* idProduct */ WBVAL(0x0100), /* 1.00 */ /* bcdDevice */ 0x01, /* iManufacturer */ 0x02, /* iProduct */ 0x03, /* iSerialNumber */ 0x01 /* bNumConfigurations: one possible configuration*/ }; /* USB FSConfiguration Descriptor */ /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
#include "audio.h" #include "usbcfg.h" #include "usbdesc.h" /** @addtogroup USBDEV_AudioUsbDesc * @{ */ /* USB Standard Device Descriptor */ const uint8_t USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* 2.00 */ /* bcdUSB */ 0x00, /* bDeviceClass */ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0x1FC9), /* idVendor */ WBVAL(0x4002), /* idProduct */ WBVAL(0x0100), /* 1.00 */ /* bcdDevice */ 0x01, /* iManufacturer */ 0x02, /* iProduct */ 0x03, /* iSerialNumber */ 0x01 /* bNumConfigurations: one possible configuration*/ }; /* USB Configuration Descriptor */ /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
extern uint8_t VCOM_ConfigDescriptor[]; static USBD_API_T *usbapi; extern void lmp_parse(const unsigned char *buf, int len); #define _(c) c, 0 /* This is the static part of the USB string descriptors */ const uint8_t VCOM_StringDescriptor[] = { /* Index 0x00: LANGID Codes */ 0x04, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0409), /* US English */ /* wLANGID */ /* Index 0x01: Manufacturer */ (10 * 2 + 2), /* bLength (3 Char + Type + len) */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ _('L'), _('i'), _('n'), _('a'), _('r'), _('o'), _(' '), _('L'), _('t'), _('d'), /* Index 0x02: Product */ (7 * 2 + 2), /* bLength (3 Char + Type + len) */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ _('L'), _('a'), _('v'), _('a'), _('L'), _('M'), _('P'), /* Index 0x03: Interface 0, Alternate Setting 0 */ (4 * 2 + 2), /* bLength (4 Char + Type + len) */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */\
* Copyright (c) 2005-2009 Keil Software. *---------------------------------------------------------------------------*/ #include "lpc_types.h" #include "usb.h" #include "msc.h" #include "usbcfg.h" #include "usbdesc.h" /* USB Standard Device Descriptor */ const uint8_t USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* 2.00 */ /* bcdUSB */ 0x00, /* bDeviceClass */ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0xC251), /* idVendor */ WBVAL(0x1303), /* idProduct */ WBVAL(0x0100), /* 1.00 */ /* bcdDevice */ 0x04, /* iManufacturer */ 0x20, /* iProduct */ 0x48, /* iSerialNumber */ 0x01 /* bNumConfigurations */ }; /* USB Configuration Descriptor */ /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------- Local Function Prototypes ------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------- Data Members ------------------------------------------------------------------------------*/ /* USB Standard Device Descriptor */ const uint8 MASS_DeviceDescriptor[USB_DEVICE_DESCRIPTOR_SIZE] = { USB_DEVICE_DESCRIPTOR_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* 1.1 */ /* bcdUSB */ USB_DEVICE_CLASS_RESERVED, /* bDeviceClass */ 0x00, /* bDeviceSubClass: common */ 0x00, /* bDeviceProtocol: IAD */ 0x40, /* bMaxPacketSize0 (64 bytes) */ WBVAL(USB_VENDOR_ID), /* idVendor */ WBVAL(USB_PRODUCT_ID), /* idProduct */ WBVAL(USB_BOOTLOADER_ID), /* 0.00 */ /* bcdDevice */ 1, /*Index of string descriptor describing manufacturer */ 2, /*Index of string descriptor describing product*/ 3, /*Index of string descriptor describing the device serial number */ 0x01 /* bNumConfigurations */ }; const uint8 MASS_ConfigDescriptor[MASS_SIZ_CONFIG_DESC] = {