#ifndef _USB_DESC_H
#define _USB_DESC_H

#include "include.h"

#define USB_DEV_VID             0x314b          // VID.
#define USB_DEV_PID             0x0200          // PID.
#define USB_DEV_LANG_ID         0x0409          // Language ID
#define USB_DESC_MANUF          "Geehy"         // max 15 Bytes.
#define USB_DESC_PRODUCT        "GW3323"        // max 15 Bytes.
#define USB_DESC_SERIAL         "0001"          // max 15 Bytes.

#define USB_MAX_EP0_SIZE        PACKET_MAX_64B  // max transmit size of endpoint 0.
#define USB_MAX_STR_DESC_SIZE   64

#define L_BYTE(x)           ((uint8_t)(x & 0x00ff))
#define H_BYTE(x)           ((uint8_t)((x & 0xff00) >> 8))

enum {
    USB_DESC_TYPE_DEV       = 1,                // the of device descriptor type.
    USB_DESC_TYPE_CFG       = 2,                // the of configuration descriptor type.
    USB_DESC_TYPE_STR       = 3,                // the of string descriptor type.
    USB_DESC_TYPE_IF        = 4,                // the of interface descriptor type.
    USB_DESC_TYPE_EP        = 5,                // the of endpoint descriptor type.

    HID_DESC_TYPE           = 0x21,
    HID_REPORT_TYPE         = 0x22,
};

enum {
    EP_NUM_1                = 1,
    EP_NUM_2                = 2,
    EP_NUM_3                = 3,
};

enum {
    PACKET_MAX_8B           = 8,
    PACKET_MAX_16B          = 16,
    PACKET_MAX_32B          = 32,
    PACKET_MAX_64B          = 64,
};

void usb_desc_config(u8 *dest, char *src, u8 *length);

#endif // _USB_DESC_H
