Код
/**************************************************************************
Device Descriptor
**************************************************************************/
PROGMEM USB_DEVICE_DESCRIPTOR USB_DeviceDescriptor =
{
sizeof(USB_DEVICE_DESCRIPTOR), /* length of descriptor in bytes */
USB_DEVICE_DESCRIPTOR_TYPE, /* descriptor type */
0x0110, /* USB version supported */
0,//USB_CFG_DEVICE_CLASS, /* device class */
0,//USB_CFG_DEVICE_SUBCLASS, /* device subclass */
0,//USB_CFG_DEVICE_PROTOCOL, /* device protocol */
D12_EP0_PACKET_SIZE, /* max packet size for control endpoint */
USB_CFG_VENDOR_ID, /* vendor ID (VID) */
USB_CFG_DEVICE_ID, /* device ID (PID) */
USB_CFG_DEVICE_VERSION, /* version */
USB_CFG_VENDOR_STRING_INDEX, /* manufacturer string index */
USB_CFG_DEVICE_STRING_INDEX, /* product string index */
USB_CFG_SERIAL_STRING_INDEX, /* serial number string index */
1, /* number of configurations */
};
/**************************************************************************
CDC Config Descriptors Packet for Communication Port Emulation
**************************************************************************/
PROGMEM USB_CONFIG_DESCRIPTOR_PACKET USB_ConfigDescriptorPacket =
{
/**************************************************************************
Configuration Descriptor
**************************************************************************/
{
sizeof(USB_CONFIGURATION_DESCRIPTOR), /* length of descriptor in bytes */
USB_CONFIGURATION_DESCRIPTOR_TYPE, /* descriptor type */
sizeof(USB_CONFIG_DESCRIPTOR_PACKET), /* total packet length */
2, /* number of interfaces in this configuration */
1, /* index of this configuration */
0, /* configuration name string index */
USB_CONFIG_SELF_POWERED,
USB_CFG_MAX_BUS_POWER / 2,
},
/**************************************************************************
ACM Interface Descriptor 0
**************************************************************************/
{
sizeof(USB_INTERFACE_DESCRIPTOR), /* length of descriptor in bytes */
USB_INTERFACE_DESCRIPTOR_TYPE, /* descriptor type */
0, /* index of this interface */
0, /* alternate setting for this interface */
3, /* 1 - control? 2 - data */
USB_CFG_INTERFACE_CLASS, /* USB_DEVICE_CLASS_COMMUNICATIONS */
USB_CFG_INTERFACE_SUBCLASS, /* USB_CDC_SUBCLASS_ACM */
USB_CFG_INTERFACE_PROTOCOL, /* 0 */
0,
},
/**************************************************************************
CDC Header Functional Descriptor
**************************************************************************/
{
sizeof(USB_CDC_HEADER_FUNCTIONAL_DESCRIPTOR),
0x24, /* descriptor type */
0, /* header functional descriptor */
0x0110, /* USB version */
},
/**************************************************************************
CDC Abstract Control Management Functional Descriptor
**************************************************************************/
{
sizeof(USB_CDC_ABSTRACT_CONTROL_MANAGEMENT_FUNCTIONAL_DESCRIPTOR),
0x24, /* descriptor type */
2, /* abstract control management functional descriptor */
0x02, /* SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE */
},
/**************************************************************************
In Endpoint #3 Descriptor (Control in) not real!!!
**************************************************************************/
{
sizeof(USB_ENDPOINT_DESCRIPTOR),
USB_ENDPOINT_DESCRIPTOR_TYPE,
0x83, /* In endpoint number 3 */
0x03, /* attrib: Interrupt endpoint */
D12_EP1_PACKET_SIZE, /* maximum packet size */
10, /* in ms */
},
/**************************************************************************
Out Endpoint #1 Descriptor (Data out)
**************************************************************************/
{
sizeof(USB_ENDPOINT_DESCRIPTOR),
USB_ENDPOINT_DESCRIPTOR_TYPE,
0x01, /* OUT endpoint number 1 */
0x02, /* attrib: Bulk endpoint */
D12_EP1_PACKET_SIZE, /* maximum packet size */
0, /* in ms */
},
/**************************************************************************
In Endpoint #1 Descriptor (Data in)
**************************************************************************/
{
sizeof(USB_ENDPOINT_DESCRIPTOR),
USB_ENDPOINT_DESCRIPTOR_TYPE,
0x81, /* IN endpoint number 1 */
0x02, /* attrib: Bulk endpoint */
D12_EP1_PACKET_SIZE, /* maximum packet size */
0, /* in ms */
},
/**************************************************************************
ACM Interface Descriptor 1
**************************************************************************/
{
sizeof(USB_INTERFACE_DESCRIPTOR), /* length of descriptor in bytes */
USB_INTERFACE_DESCRIPTOR_TYPE, /* descriptor type */
1, /* index of this interface */
0, /* alternate setting for this interface */
3, /* 1 - control? 2 - data */
USB_CFG_INTERFACE_CLASS, /* USB_DEVICE_CLASS_COMMUNICATIONS */
USB_CFG_INTERFACE_SUBCLASS, /* USB_CDC_SUBCLASS_ACM */
USB_CFG_INTERFACE_PROTOCOL, /* 0 */
0,
},
/**************************************************************************
CDC Header Functional Descriptor
**************************************************************************/
{
sizeof(USB_CDC_HEADER_FUNCTIONAL_DESCRIPTOR),
0x24, /* descriptor type */
0, /* header functional descriptor */
0x0110, /* USB version */
},
/**************************************************************************
CDC Abstract Control Management Functional Descriptor
**************************************************************************/
{
sizeof(USB_CDC_ABSTRACT_CONTROL_MANAGEMENT_FUNCTIONAL_DESCRIPTOR),
0x24, /* descriptor type */
2, /* abstract control management functional descriptor */
0x02, /* SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE */
},
/**************************************************************************
In Endpoint #4 Descriptor (Control in) not real !!!
**************************************************************************/
{
sizeof(USB_ENDPOINT_DESCRIPTOR),
USB_ENDPOINT_DESCRIPTOR_TYPE,
0x84, /* In endpoint number 4 */
0x03, /* attrib: Interrupt endpoint */
D12_EP1_PACKET_SIZE, /* maximum packet size */
10, /* in ms */
},
/**************************************************************************
Out Endpoint #2 Descriptor (Data out)
**************************************************************************/
{
sizeof(USB_ENDPOINT_DESCRIPTOR),
USB_ENDPOINT_DESCRIPTOR_TYPE,
0x02, /* OUT endpoint number 2 */
0x02, /* attrib: Bulk endpoint */
D12_EP2_PACKET_SIZE, /* maximum packet size */
0, /* in ms */
},
/**************************************************************************
In Endpoint #2 Descriptor (Data in)
**************************************************************************/
{
sizeof(USB_ENDPOINT_DESCRIPTOR),
USB_ENDPOINT_DESCRIPTOR_TYPE,
0x82, /* IN endpoint number 2 */
0x02, /* attrib: Bulk endpoint */
D12_EP2_PACKET_SIZE, /* maximum packet size */
0, /* in ms */
},
}; /* enf of config descriptor packet */