Exemplo n.º 1
0
#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) */
  USB_DESC_BCD(0x0111),        /* bcdHID: HID version 1.11 */
  USB_DESC_BYTE(0),            /* bCountryCode */
  USB_DESC_BYTE(1),            /* bNumDescriptors */
  USB_DESC_BYTE(0x22),         /* bDescriptorType (report desc) */
  USB_DESC_WORD(sizeof(hid_report_descriptor_data)), /* wDescriptorLength */

  /* HID debug Endpoint (IN) Descriptor (7 bytes) */
  USB_DESC_ENDPOINT(DEBUG_TX_ENDPOINT | 0x80,  /* bEndpointAddress */
Exemplo n.º 2
0
/* 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).*/
  USB_DESC_BYTE         (5),            /* bLength.                         */
  USB_DESC_BYTE         (0x24),         /* bDescriptorType (CS_INTERFACE).  */
  USB_DESC_BYTE         (0x00),         /* bDescriptorSubtype (Header
                                           Functional Descriptor.           */
  USB_DESC_BCD          (0x0110),       /* bcdCDC.                          */
  /* Call Management Functional Descriptor. */
  USB_DESC_BYTE         (5),            /* bFunctionLength.                 */
  USB_DESC_BYTE         (0x24),         /* bDescriptorType (CS_INTERFACE).  */
  USB_DESC_BYTE         (0x01),         /* bDescriptorSubtype (Call Management
Exemplo n.º 3
0
    // Interface Association descriptor (IAD)
    0x08, //Length of IAD
    USB_DESCRIPTOR_INTERFACE_ASSOCIATION,
    0x00, // bFirstInterface
    0x02, // bInterfaceCount
    0xFF,//COMMUNICATIONS_INTERFACE_CLASS, //0xFF, // bFunctionClass
    0x00,//ABSTRACT_CONTROL_SUB_CLASS, //0x00, // bFunctionSubClass
    0x00,//AT_CDC_INTERFACE_PROTOCOL, //0x00, // bFunctionProcotol
    0x00, // iInterface


    /* Interface Descriptor. */
    USB_DESC_INTERFACE (0x00, /* bInterfaceNumber.                */
    0x00, /* bAlternateSetting.               */
    0x01, /* bNumEndpoints.                   */
    COMMUNICATIONS_INTERFACE_CLASS, /* bInterfaceClass (Communications Interface Class, CDC section 4.2).                            */
    ABSTRACT_CONTROL_SUB_CLASS, /* bInterfaceSubClass (Abstract Control Model, CDC section 4.3).   */
    AT_CDC_INTERFACE_PROTOCOL, /* bInterfaceProtocol (AT commands, CDC section 4.4).                */
    0), /* iInterface.                      */
    /* Header Functional Descriptor (CDC section 5.2.3).*/
    USB_DESC_BYTE (5), /* bLength.                         */
    USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE).  */
    USB_DESC_BYTE (0x00), /* bDescriptorSubtype (Header Functional Descriptor.           */
    USB_DESC_BCD (0x0110), /* bcdCDC.                          */
    /* Call Management Functional Descriptor. */
    USB_DESC_BYTE (5), /* bFunctionLength.                 */
    USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE).  */
    USB_DESC_BYTE (0x01), /* bDescriptorSubtype (Call Management Functional Descriptor).          */
    USB_DESC_BYTE (0x00), /* bmCapabilities (D0+D1).          */
    USB_DESC_BYTE (0x02), /* bDataInterface.                  */
    /* ACM Functional Descriptor.*/
Exemplo n.º 4
0
        FS_BULK_OUT_ENDPOINT, 
#endif
        USB_BULK_PIPE, 
        USB_RECV,
        BULK_OUT_ENDP_PACKET_SIZE
    }        
};
#define USB_CDC_IF_MAX 2
#define USB_MSD_IF_MAX 1
#define USB_CDC_CFG_MAX 1
#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),
};
Exemplo n.º 5
0
  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 */
    ),

  /* end-point descriptor */
  USB_DESC_ENDPOINT
    (
     USB_MS_DATA_EP | 0x80, /* address (end point index | OUT direction)      */
     USB_EP_MODE_TYPE_BULK, /* attributes (bulk)                              */
     64,                    /* max packet size                                */
     0x05                   /* polling interval (ignored for bulk end-points) */
    ),

  /* end-point descriptor */
    DIC_BULK_IN_ENDP_PACKET_SIZE
},
{
    DIC_BULK_OUT_ENDPOINT,
    USB_BULK_PIPE,
    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,
Exemplo n.º 7
0
#define HID_DESCRIPTOR_OFFSET       18
#define HID_DESCRIPTOR_SIZE         USB_DESC_HID_SIZE

static const uint8_t hid_configuration_descriptor_data[41] = {
  /* Configuration Descriptor.*/
  USB_DESC_CONFIGURATION(41,            /* wTotalLength.                    */
                         0x01,          /* bNumInterfaces.                  */
                         0x01,          /* bConfigurationValue.             */
                         0,             /* iConfiguration.                  */
                         0xC0,          /* bmAttributes (self powered).     */
                         50),           /* bMaxPower (100mA).               */
  /* Interface Descriptor.*/
  USB_DESC_INTERFACE    (0x00,          /* bInterfaceNumber.                */
                         0x00,          /* bAlternateSetting.               */
                         0x02,          /* bNumEndpoints.                   */
                         0x03,          /* bInterfaceClass (HID Interface
                                           Class).                          */
                         0x00,          /* bInterfaceSubClass (None).       */
                         0x00,          /* bInterfaceProtocol (None).       */
                         0),            /* iInterface.                      */
  /* HID Descriptor.*/
  USB_DESC_HID          (0x0110,        /* bcdHID.                          */
                         0x00,          /* bCountryCode.                    */
                         0x01,          /* bNumDescriptors.                 */
                         0x22,          /* bDescriptorType (Report
                                           Descriptor).                     */
                         34),           /* wDescriptorLength.               */
  /* Endpoint 1 Descriptor.*/
  USB_DESC_ENDPOINT     (USBD1_DATA_AVAILABLE_EP,       /* bEndpointAddress.*/
                         0x03,          /* bmAttributes (Interrupt).        */
                         0x0040,        /* wMaxPacketSize.                  */
                         0x0A),         /* bInterval (10ms).                */