summaryrefslogtreecommitdiff
path: root/bsp/at32/libraries/rt_drivers/config/f425/usb_config.h
blob: 3297a5e91694d5ddc186426d60e262cc3296b2b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2023-02-28     leo          first version
 */

#ifndef __USB_CONFIG_H__
#define __USB_CONFIG_H__

#include <rtthread.h>

#ifdef __cplusplus
extern "C" {
#endif

#if defined BSP_USING_DEVICE_USBOTG1
#define USE_OTG_DEVICE_MODE
#endif

#if defined BSP_USING_HOST_USBOTG1
#define USE_OTG_HOST_MODE
#endif

/* usb irqhandler */
#define OTGFS1_IRQHandler               OTGFS1_IRQHandler

/**
  * @brief usb device mode config
  */
#define USB_EPT_MAX_NUM                 8

/* otg1 device fifo */
#define USBD_RX_SIZE                    128
#define USBD_EP0_TX_SIZE                24
#define USBD_EP1_TX_SIZE                20
#define USBD_EP2_TX_SIZE                20
#define USBD_EP3_TX_SIZE                20
#define USBD_EP4_TX_SIZE                20
#define USBD_EP5_TX_SIZE                20
#define USBD_EP6_TX_SIZE                20
#define USBD_EP7_TX_SIZE                20

/**
  * @brief usb host mode config
  */
#define USB_HOST_CHANNEL_NUM            16

/* otg1 host fifo */
#define USBH_RX_FIFO_SIZE               128
#define USBH_NP_TX_FIFO_SIZE            96
#define USBH_P_TX_FIFO_SIZE             96

/**
  * @brief usb sof output enable
  */
// #define USB_SOF_OUTPUT_ENABLE

/**
  * @brief usb vbus ignore, not use vbus pin
  */
#define USB_VBUS_IGNORE

/**
  * @brief usb low power wakeup handler enable
  */
// #define USB_LOW_POWER_WAKUP

#if defined(BSP_USING_HOST_USBOTG1)
#undef BSP_USING_DEVICE_USBOTG1
#define USBOTG1_CONFIG                                              \
    {                                                               \
        .name = "usbh",                                             \
        .id = USB_OTG1_ID,                                          \
        .dev_spd = USB_FULL_SPEED_CORE_ID,                          \
        .irqn = OTGFS1_IRQn,                                        \
    }
#endif /* BSP_USING_HOST_USBOTG1 */

#if defined(BSP_USING_DEVICE_USBOTG1)
#define USBOTG1_CONFIG                                              \
    {                                                               \
        .name = "usbd",                                             \
        .id = USB_OTG1_ID,                                          \
        .dev_spd = USB_FULL_SPEED_CORE_ID,                          \
        .irqn = OTGFS1_IRQn,                                        \
    }
#endif /* BSP_USING_DEVICE_USBOTG1 */

#ifdef __cplusplus
}
#endif

#endif