/*!
    /file  usbd_conf.h
    /brief usb device driver basic configuration
*/

/*
    Copyright (C) 2017 GigaDevice

    2017-02-10, V1.0.0, firmware for GD32F30x
*/

#ifndef USBD_CONF_H
#define USBD_CONF_H

#include "gd32f30x.h"

#define USBD_CFG_MAX_NUM                   1U
#define USBD_ITF_MAX_NUM                   1U

/* define if low power mode is enabled; it allows entering the device into DEEP_SLEEP mode
   following USB suspend event and wakes up after the USB wakeup event is received. */
//#define USB_DEVICE_LOW_PWR_MODE_SUPPORT

/* USB feature -- Self Powered */
/* #define USBD_SELF_POWERED */

#define HID_IN_EP                          EP_IN(1)
#define HID_OUT_EP                         EP_OUT(1)

/* endpoint count used by the CDC ACM device */
#define CDC_IN_EP                          EP_IN(2)
#define CDC_OUT_EP                         EP_OUT(2)
#define CDC_CMD_EP                         EP_IN(3)

/* endpoint0, Rx/Tx buffers address offset */
#define EP0_RX_ADDR                        (0x40U)
#define EP0_TX_ADDR                        (0x80U)

#define INT_TX_ADDR                        (0xC0)
#define INT_RX_ADDR                        (0x100)

/* CDC data Tx buffer address offset */
#define BULK_TX_ADDR                       (0x180U)

/* CDC data Rx buffer address offset */
#define BULK_RX_ADDR                       (0x140U)

/* CDC command Tx buffer address offset */
#define CMD_TX_ADDR                        (0x190U)

#define INT_DATA_PACKET                    64U

#define CDC_CMD_PACKET                     16U
#define BULK_DATA_PACKET                   64U

/* endpoint count used by the CDC ACM device */
#define EP_COUNT                           (4U)

#define USB_STRING_COUNT                   4U

/* base address offset of the allocation buffer, used for buffer descriptor table and packet memory */
#define BTABLE_OFFSET                      (0x0000U)

#endif /* USBD_CONF_H */
