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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
/*
* 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 || defined BSP_USING_DEVICE_USBOTG2
#define USE_OTG_DEVICE_MODE
#endif
#if defined BSP_USING_HOST_USBOTG1 || defined BSP_USING_HOST_USBOTG2
#define USE_OTG_HOST_MODE
#endif
/* usb irqhandler */
#define OTGFS1_IRQHandler OTGFS1_IRQHandler
#define OTGFS2_IRQHandler OTGFS2_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
/* otg2 device fifo */
#define USBD2_RX_SIZE 128
#define USBD2_EP0_TX_SIZE 24
#define USBD2_EP1_TX_SIZE 20
#define USBD2_EP2_TX_SIZE 20
#define USBD2_EP3_TX_SIZE 20
#define USBD2_EP4_TX_SIZE 20
#define USBD2_EP5_TX_SIZE 20
#define USBD2_EP6_TX_SIZE 20
#define USBD2_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
/* otg2 host fifo */
#define USBH2_RX_FIFO_SIZE 128
#define USBH2_NP_TX_FIFO_SIZE 96
#define USBH2_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_HOST_USBOTG2
#undef BSP_USING_DEVICE_USBOTG1
#define USBOTG1_CONFIG \
{ \
.name = "usbh1", \
.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)
#undef BSP_USING_DEVICE_USBOTG2
#define USBOTG1_CONFIG \
{ \
.name = "usbd", \
.id = USB_OTG1_ID, \
.dev_spd = USB_FULL_SPEED_CORE_ID, \
.irqn = OTGFS1_IRQn, \
}
#endif /* BSP_USING_DEVICE_USBOTG1 */
#if defined(BSP_USING_HOST_USBOTG2)
#undef BSP_USING_HOST_USBOTG1
#undef BSP_USING_DEVICE_USBOTG2
#define USBOTG2_CONFIG \
{ \
.name = "usbh2", \
.id = USB_OTG2_ID, \
.dev_spd = USB_FULL_SPEED_CORE_ID, \
.irqn = OTGFS2_IRQn, \
}
#endif /* BSP_USING_HOST_USBOTG2 */
#if defined(BSP_USING_DEVICE_USBOTG2)
#undef BSP_USING_DEVICE_USBOTG1
#define USBOTG2_CONFIG \
{ \
.name = "usbd", \
.id = USB_OTG2_ID, \
.dev_spd = USB_FULL_SPEED_CORE_ID, \
.irqn = OTGFS2_IRQn, \
}
#endif /* BSP_USING_DEVICE_USBOTG2 */
#ifdef __cplusplus
}
#endif
#endif
|