#include "usb_cdc_uart_desc.h"

#if USB_DEVICE_TYPE & BIT(4)

AT(.usbdev.com.table)
const u8 desc_config_printer[DEV_CFG_DESC_SIZE] = {
    0x09,
    0x02,
    L_BYTE(DEV_CFG_DESC_SIZE),
    H_BYTE(DEV_CFG_DESC_SIZE),
    0x02,
    0x01,
    0x00,
    0xc0,
    0x32,//0x00,//9byte 配置描述符

    0x09,
    USB_DESC_TYPE_IF,
    0x00,
    0x00,
    0x01,//0x02,
    0x02,//0x07,
    0x02,//0x01,
    0x01,//0x02,
    0x00,//0x04,//9byte 接口描述符

    0x05,//0x07,
    0x24,//USB_DESC_TYPE_EP,
    0x00,//USB_DEV_IN_EP | 0x80,
    0x10,//0x02,
    0x01,//L_BYTE(EP_IN_MAX_SIZE),
//    H_BYTE(EP_IN_MAX_SIZE),
//    0x00,//7byte 端点描述符

    /* bFunctionLength */
    0x05,
    /* bDescriptorType: CS_INTERFACE */
    0x24,
    /* bDescriptorSubtype: Call Management Func Desc */
    0x01,
    /* bmCapabilities: D0+D1 */
    0x00,
    /* bDataInterface: 1 */
    0x01,

    /* bFunctionLength */
    0x04,
    /* bDescriptorType: CS_INTERFACE */
    0x24,
    /* bDescriptorSubtype: Abstract Control Management desc */
    0x02,
    /* bmCapabilities */
    0x02,

    /* CDC Union Function Descriptor */
    /* bFunctionLength */
    0x05,
    /* bDescriptorType: CS_INTERFACE */
    0x24,
    /* bDescriptorSubtype: Union func desc */
    0x06,
    /* bMasterInterface: Communication class interface */
    0x00,
    /* bSlaveInterface0: Data Class Interface */
    0x01,

    /* bLength */
    0x07,
    /* bDescriptorType: Endpoint */
    0x05,
    /* bEndpointAddress */
    0x82,
    /* bmAttributes */
    0x03,
    /* wMaxPacketSize: */
    L_BYTE(0x08),
    H_BYTE(0x08),
    /* bInterval: */
    16,

    /* bLength */
    0x09,
    /* bDescriptorType */
    0x04,
    /* bInterfaceNumber */
    0x01,
    /* bAlternateSetting */
    0x00,
    /* bNumEndpoints */
    0x02,
    /* bInterfaceClass */
    0x0A,
    /* bInterfaceSubClass */
    0x00,
    /* bInterfaceProtocol */
    0x00,
    /* iInterface */
    0x00,

    0x07,
    0x05,
    0x01,
    0x02,
    L_BYTE(0x40),
    H_BYTE(0x40),
    0x00,//7byte 端点描述符

     /* bLength */
    0x07,
    /* bDescriptorType: Endpoint */
    0x05,
    /* bEndpointAddress */
    0x81,
    /* bmAttributes */
    0x02,
    /* wMaxPacketSize: */
    L_BYTE(0x40),
    H_BYTE(0x40),
    /* bInterval: */
    0x00,
};

u8 *usb_get_config_descriptor(u8 *length)
{
    *length = sizeof(desc_config_printer);
    return (u8 *)desc_config_printer;
}

#endif // USB_DEVICE_TYPE & BIT(4)
