Skip to content

Commit c60ecd7

Browse files
XYZboomGuozhanxin
authored andcommitted
[bsp][nuclei] fix "usb_conf.h not found"
Nuclei sdk requires the USB configuration header file to be completed by the application in versions after 0.3.8. see Nuclei-Software/nuclei-sdk#54 and Nuclei-Software/nuclei-sdk@43912c1
1 parent b243312 commit c60ecd7

File tree

3 files changed

+139
-0
lines changed

3 files changed

+139
-0
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*
2+
* Copyright (c) 2006-2020, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2023-09-25 XYZboom fix usb_conf.h not found in nuclei-sdk after 0.3.8
9+
*/
10+
#ifndef __USB_CONF_H__
11+
#define __USB_CONF_H__
12+
13+
#include <stddef.h>
14+
#include "gd32vf103.h"
15+
16+
#define USE_USB_FS
17+
18+
#ifdef USE_USB_FS
19+
#define USB_FS_CORE
20+
#endif
21+
22+
#ifdef USE_USB_HS
23+
#define USB_HS_CORE
24+
#endif
25+
26+
#ifdef USB_FS_CORE
27+
#define RX_FIFO_FS_SIZE 128
28+
#define TX0_FIFO_FS_SIZE 64
29+
#define TX1_FIFO_FS_SIZE 128
30+
#define TX2_FIFO_FS_SIZE 0
31+
#define TX3_FIFO_FS_SIZE 0
32+
#define USB_RX_FIFO_FS_SIZE 128
33+
#define USB_HTX_NPFIFO_FS_SIZE 96
34+
#define USB_HTX_PFIFO_FS_SIZE 96
35+
#endif /* USB_FS_CORE */
36+
37+
#ifdef USB_HS_CORE
38+
#define RX_FIFO_HS_SIZE 512
39+
#define TX0_FIFO_HS_SIZE 128
40+
#define TX1_FIFO_HS_SIZE 372
41+
#define TX2_FIFO_HS_SIZE 0
42+
#define TX3_FIFO_HS_SIZE 0
43+
#define TX4_FIFO_HS_SIZE 0
44+
#define TX5_FIFO_HS_SIZE 0
45+
46+
#ifdef USE_ULPI_PHY
47+
#define USB_OTG_ULPI_PHY_ENABLED
48+
#endif
49+
50+
#ifdef USE_EMBEDDED_PHY
51+
#define USB_OTG_EMBEDDED_PHY_ENABLED
52+
#endif
53+
54+
#define USB_OTG_HS_INTERNAL_DMA_ENABLED
55+
#define USB_OTG_HS_DEDICATED_EP1_ENABLED
56+
#endif /* USB_HS_CORE */
57+
58+
#ifndef USB_SOF_OUTPUT
59+
#define USB_SOF_OUTPUT 0
60+
#endif
61+
62+
#ifndef USB_LOW_POWER
63+
#define USB_LOW_POWER 0
64+
#endif
65+
66+
#ifndef USE_HOST_MODE
67+
#define USE_DEVICE_MODE
68+
#endif
69+
70+
#ifndef USB_FS_CORE
71+
#ifndef USB_HS_CORE
72+
#error "USB_HS_CORE or USB_FS_CORE should be defined"
73+
#endif
74+
#endif
75+
76+
#ifndef USE_DEVICE_MODE
77+
#ifndef USE_HOST_MODE
78+
#error "USE_DEVICE_MODE or USE_HOST_MODE should be defined"
79+
#endif
80+
#endif
81+
82+
#ifndef USE_USB_HS
83+
#ifndef USE_USB_FS
84+
#error "USE_USB_HS or USE_USB_FS should be defined"
85+
#endif
86+
#endif
87+
88+
/****************** C Compilers dependant keywords ****************************/
89+
/* In HS mode and when the DMA is used, all variables and data structures dealing
90+
with the DMA during the transaction process should be 4-bytes aligned */
91+
#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
92+
#if defined (__GNUC__) /* GNU Compiler */
93+
#define __ALIGN_END __attribute__ ((aligned(4)))
94+
#define __ALIGN_BEGIN
95+
#endif /* __GNUC__ */
96+
#else
97+
#define __ALIGN_BEGIN
98+
#define __ALIGN_END
99+
#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
100+
101+
#endif /* __USB_CONF_H__ */
102+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (c) 2006-2020, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2023-09-25 XYZboom fix usbd_conf.h not found in nuclei-sdk after 0.3.8
9+
*/
10+
#ifndef __USBD_CONF_H__
11+
#define __USBD_CONF_H__
12+
13+
#include "usb_conf.h"
14+
15+
#define USBD_CFG_MAX_NUM 1
16+
#define USBD_ITF_MAX_NUM 1
17+
18+
#endif /* __USBD_CONF_H__ */
19+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2006-2020, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2023-09-25 XYZboom fix usbh_conf.h not found in nuclei-sdk after 0.3.8
9+
*/
10+
#ifndef __USBH_CONF_H__
11+
#define __USBH_CONF_H__
12+
13+
#define USBH_MAX_EP_NUM 2
14+
#define USBH_MAX_INTERFACES_NUM 2
15+
#define USBH_MSC_MPS_SIZE 0x200
16+
17+
#endif /* __USBH_CONF_H__ */
18+

0 commit comments

Comments
 (0)