Exemplo n.º 1
0
};

/*
 * Device Descriptor wrapper.
 */
static const USBDescriptor vcom_device_descriptor = {
  sizeof vcom_device_descriptor_data,
  vcom_device_descriptor_data
};

/* Configuration Descriptor tree for a CDC.*/
static const uint8_t vcom_configuration_descriptor_data[67] = {
  /* Configuration Descriptor.*/
  USB_DESC_CONFIGURATION(67,            /* wTotalLength.                    */
                         0x02,          /* bNumInterfaces.                  */
                         0x01,          /* bConfigurationValue.             */
                         0,             /* iConfiguration.                  */
                         0xC0,          /* bmAttributes (self powered).     */
                         50),           /* bMaxPower (100mA).               */
  /* Interface Descriptor.*/
  USB_DESC_INTERFACE    (0x00,          /* bInterfaceNumber.                */
                         0x00,          /* bAlternateSetting.               */
                         0x01,          /* bNumEndpoints.                   */
                         0x02,          /* bInterfaceClass (Communications
                                           Interface Class, CDC section
                                           4.2).                            */
                         0x02,          /* bInterfaceSubClass (Abstract
                                         Control Model, CDC section 4.3).   */
                         0x01,          /* bInterfaceProtocol (AT commands,
                                           CDC section 4.4).                */
                         0),            /* iInterface.                      */
  /* Header Functional Descriptor (CDC section 5.2.3).*/
Exemplo n.º 2
0
 * Configuration Descriptor tree for a HID device
 *
 * The HID Specifications version 1.11 require the following order:
 * - Configuration Descriptor
 * - Interface Descriptor
 * - HID Descriptor
 * - Endpoints Descriptors
 */
#define HID_DESCRIPTOR_OFFSET 9 + 9
#define HID_DESCRIPTOR_SIZE 9

static const uint8_t hid_configuration_descriptor_data[] = {
  /* Configuration Descriptor (9 bytes) */
  USB_DESC_CONFIGURATION(9 + 9 + 9 + 7, /* wTotalLength */
                         1,    /* bNumInterfaces */
                         1,    /* bConfigurationValue */
                         0,    /* iConfiguration */
                         0xC0, /* bmAttributes (self powered, set to 0x80 if not) */
                         50),  /* bMaxPower (100mA) */

  /* Interface Descriptor (9 bytes) */
  USB_DESC_INTERFACE(0,        /* bInterfaceNumber */
                     0,        /* bAlternateSetting */
                     1,        /* bNumEndpoints */
                     0x03,     /* bInterfaceClass: HID */
                     0x00,     /* bInterfaceSubClass: None */
                     0x00,     /* bInterfaceProtocol: None */
                     0),       /* iInterface */

  /* HID descriptor (9 bytes) */
  USB_DESC_BYTE(9),            /* bLength */
  USB_DESC_BYTE(0x21),         /* bDescriptorType (HID class) */
Exemplo n.º 3
0
#define USB_MSD_CFG_MAX 1
#define USB_MSD_CDC_CLASS_MAX 2

/* Interfaces */
static usb_if_struct_t usb_cdc_if[USB_CDC_IF_MAX] = {
    USB_DESC_INTERFACE(0, CIC_ENDP_COUNT, cic_ep),
    USB_DESC_INTERFACE(1, DIC_ENDP_COUNT, dic_ep),
};

static usb_if_struct_t usb_msd_if[USB_MSD_IF_MAX] = {
    USB_DESC_INTERFACE(2, MSC_DESC_ENDPOINT_COUNT, msd_ep),
};

/* Configuration */
static usb_interfaces_struct_t usb_cdc_configuration[USB_CDC_CFG_MAX] = {
    USB_DESC_CONFIGURATION(USB_CDC_IF_MAX, usb_cdc_if),
};

static usb_interfaces_struct_t usb_msd_configuration[USB_MSD_CFG_MAX] = {
    USB_DESC_CONFIGURATION(USB_MSD_IF_MAX, usb_msd_if),
};

static usb_class_struct_t usb_dec_class[USB_MSD_CDC_CLASS_MAX] =
{
    {
        USB_CLASS_CDC,
        USB_DESC_CONFIGURATION(USB_CDC_IF_MAX, usb_cdc_if),
    },
    {
        USB_CLASS_MSC,
        USB_DESC_CONFIGURATION(USB_MSD_IF_MAX, usb_msd_if),
Exemplo n.º 4
0
};
static const USBDescriptor deviceDescriptor =
{
  sizeof(deviceDescriptorData),
  deviceDescriptorData
};

/* configuration descriptor */
static const uint8_t configurationDescriptorData[] =
{
  /* configuration descriptor */
  USB_DESC_CONFIGURATION
    (
     32,   /* total length                                             */
     1,    /* number of interfaces                                     */
     1,    /* value that selects this configuration                    */
     0,    /* index of string descriptor describing this configuration */
     0xC0, /* attributes (self-powered)                                */
     50    /* max power (100 mA)                                       */
    ),

  /* interface descriptor */
  USB_DESC_INTERFACE
    (
     0,    /* interface number                                     */
     0,    /* value used to select alternative setting             */
     2,    /* number of end-points used by this interface          */
     0x08, /* interface class (Mass Storage)                       */
     0x06, /* interface sub-class (SCSI Transparent Storage)       */
     0x50, /* interface protocol (Bulk Only)                       */
     0     /* index of string descriptor describing this interface */
Exemplo n.º 5
0
    CDC_COMMUNICATION_INTERFACE_CLASS,      /* bFunctionClass.          */  \
    CDC_ABSTRACT_CONTROL_MODEL,             /* bFunctionSubClass.       */  \
    1,                                      /* bFunctionProcotol.       */  \
    0                                       /* iInterface.              */  \
  ),                                                                        \
  /* CDC Interface descriptor set */                                        \
  CDC_IF_DESC_SET(comIfNum, datIfNum, comInEp, datOutEp, datInEp)

/* Configuration Descriptor tree for a CDC.*/
static const uint8_t vcom_configuration_descriptor_data[] = {
  /* Configuration Descriptor.*/
  USB_DESC_CONFIGURATION(
    USB_DESC_CONFIGURATION_SIZE +
    (IAD_CDC_IF_DESC_SET_SIZE * 2),         /* wTotalLength.                */
    USB_NUM_INTERFACES,                     /* bNumInterfaces.              */
    0x01,                                   /* bConfigurationValue.         */
    0,                                      /* iConfiguration.              */
    0xC0,                                   /* bmAttributes (self powered). */
    50                                      /* bMaxPower (100mA).           */
  ),
  IAD_CDC_IF_DESC_SET(
    USB_CDC_CIF_NUM0,
    USB_CDC_DIF_NUM0,
    USB_ENDPOINT_IN(USB_INTERRUPT_REQUEST_EP_A),
    USB_ENDPOINT_OUT(USB_DATA_AVAILABLE_EP_A),
    USB_ENDPOINT_IN(USB_DATA_REQUEST_EP_A)
  ),
  IAD_CDC_IF_DESC_SET(
    USB_CDC_CIF_NUM1,
    USB_CDC_DIF_NUM1,
    USB_ENDPOINT_IN(USB_INTERRUPT_REQUEST_EP_B),
    USB_RECV,
    DIC_BULK_OUT_ENDP_PACKET_SIZE
}
#endif
};

#define USB_CDC_IF_MAX 2
#define USB_CDC_CFG_MAX 1
#define USB_CDC_CLASS_MAX 2
static usb_if_struct_t usb_if[USB_CDC_IF_MAX] = {
    USB_DESC_INTERFACE(0, CIC_ENDP_COUNT, cic_ep),
    USB_DESC_INTERFACE(1, DIC_ENDP_COUNT, dic_ep),
};

static usb_interfaces_struct_t usb_configuration[USB_CDC_CFG_MAX] = {
    USB_DESC_CONFIGURATION(USB_CDC_IF_MAX, usb_if),
};

static usb_class_struct_t usb_dec_class[USB_CDC_CLASS_MAX] =
{
    {
        USB_CLASS_CDC,
        USB_DESC_CONFIGURATION(USB_CDC_IF_MAX, usb_if),
    },
    {
        USB_CLASS_INVALID,
        USB_DESC_CONFIGURATION(0, NULL),
    }
};

uint8_t g_device_descriptor[DEVICE_DESCRIPTOR_SIZE] =