Skip to content

Commit 7c0b98c

Browse files
committed
fix code format issue.
1 parent 45641c8 commit 7c0b98c

37 files changed

Lines changed: 7479 additions & 553 deletions

bsp/nuvoton/libraries/m3331/rtt_port/cherryusb/msh_cmd.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/* Functions Implementation --------------------------------------------------*/
2+
/*
3+
* @copyright (C) 2026 Nuvoton Technology Corp. All rights reserved.
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
18
/* Includes ------------------------------------------------------------------*/
29
#include "rtthread.h"
310
#include "NuMicro.h"
@@ -8,13 +15,6 @@
815
#define DBG_TAG LOG_TAG
916
#include "drv_log.h"
1017

11-
/* Functions Implementation --------------------------------------------------*/
12-
/*
13-
* @copyright (C) 2026 Nuvoton Technology Corp. All rights reserved.
14-
*
15-
* SPDX-License-Identifier: Apache-2.0
16-
*/
17-
1818

1919
#if defined(PKG_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM)
2020
void cdc_acm_init(uint8_t busid, uint32_t reg_base);

bsp/nuvoton/libraries/m3331/rtt_port/cherryusb/usb_config.h

Lines changed: 153 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
6-
6+
77
#ifndef __USB_CONFIG_H__
88
#define __USB_CONFIG_H__
99

@@ -20,7 +20,7 @@
2020

2121
//#define CONFIG_USB_DBG_LEVEL USB_DBG_LOG
2222
#if !defined(CONFIG_USB_DBG_LEVEL)
23-
#define CONFIG_USB_DBG_LEVEL USB_DBG_INFO
23+
#define CONFIG_USB_DBG_LEVEL USB_DBG_INFO
2424
#endif
2525

2626
/* Enable print with color */
@@ -34,8 +34,6 @@
3434
/* attribute data into no cache ram */
3535
#define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable")))
3636

37-
38-
3937
#define CONFIG_USBDEV_MAX_BUS 1 // for now, bus num must be 1 except hpm ip
4038

4139
/* Ep0 max transfer buffer, specially for receiving data from ep0 out */
@@ -76,189 +74,189 @@
7674
#endif
7775

7876
#if !defined(CONFIG_USBDEV_MSC_MAX_LUN)
79-
#define CONFIG_USBDEV_MSC_MAX_LUN 1
80-
#if !defined(CONFIG_USBDEV_MSC_MAX_BUFSIZE)
81-
#define CONFIG_USBDEV_MSC_MAX_BUFSIZE 512
82-
#endif
77+
#define CONFIG_USBDEV_MSC_MAX_LUN 1
78+
#if !defined(CONFIG_USBDEV_MSC_MAX_BUFSIZE)
79+
#define CONFIG_USBDEV_MSC_MAX_BUFSIZE 512
80+
#endif
8381

84-
#if !defined(CONFIG_USBDEV_MSC_MANUFACTURER_STRING)
85-
#define CONFIG_USBDEV_MSC_MANUFACTURER_STRING ""
86-
#endif
87-
#if !defined(CONFIG_USBDEV_MSC_PRODUCT_STRING)
88-
#define CONFIG_USBDEV_MSC_PRODUCT_STRING ""
89-
#endif
90-
#if !defined(CONFIG_USBDEV_MSC_VERSION_STRING)
91-
#define CONFIG_USBDEV_MSC_VERSION_STRING "0.01"
92-
#endif
82+
#if !defined(CONFIG_USBDEV_MSC_MANUFACTURER_STRING)
83+
#define CONFIG_USBDEV_MSC_MANUFACTURER_STRING ""
84+
#endif
85+
#if !defined(CONFIG_USBDEV_MSC_PRODUCT_STRING)
86+
#define CONFIG_USBDEV_MSC_PRODUCT_STRING ""
87+
#endif
88+
#if !defined(CONFIG_USBDEV_MSC_VERSION_STRING)
89+
#define CONFIG_USBDEV_MSC_VERSION_STRING "0.01"
90+
#endif
9391

94-
/* move msc read & write from isr to while(1), you should call usbd_msc_polling in while(1) */
95-
// #define CONFIG_USBDEV_MSC_POLLING
92+
/* move msc read & write from isr to while(1), you should call usbd_msc_polling in while(1) */
93+
// #define CONFIG_USBDEV_MSC_POLLING
9694

97-
/* move msc read & write from isr to thread */
98-
#define CONFIG_USBDEV_MSC_THREAD
95+
/* move msc read & write from isr to thread */
96+
#define CONFIG_USBDEV_MSC_THREAD
9997

100-
#if !defined(CONFIG_USBDEV_MSC_PRIO)
101-
#define CONFIG_USBDEV_MSC_PRIO 4
102-
#endif
103-
#if !defined(CONFIG_USBDEV_MSC_STACKSIZE)
104-
#define CONFIG_USBDEV_MSC_STACKSIZE 2048
105-
#endif
98+
#if !defined(CONFIG_USBDEV_MSC_PRIO)
99+
#define CONFIG_USBDEV_MSC_PRIO 4
100+
#endif
101+
#if !defined(CONFIG_USBDEV_MSC_STACKSIZE)
102+
#define CONFIG_USBDEV_MSC_STACKSIZE 2048
103+
#endif
106104

107-
#if !defined(CONFIG_USBDEV_RNDIS_RESP_BUFFER_SIZE)
108-
#define CONFIG_USBDEV_RNDIS_RESP_BUFFER_SIZE 156
109-
#endif
105+
#if !defined(CONFIG_USBDEV_RNDIS_RESP_BUFFER_SIZE)
106+
#define CONFIG_USBDEV_RNDIS_RESP_BUFFER_SIZE 156
107+
#endif
110108

111-
/* rndis transfer buffer size, must be a multiple of (1536 + 44)*/
112-
#if !defined(CONFIG_USBDEV_RNDIS_ETH_MAX_FRAME_SIZE)
113-
#define CONFIG_USBDEV_RNDIS_ETH_MAX_FRAME_SIZE 1580
114-
#endif
109+
/* rndis transfer buffer size, must be a multiple of (1536 + 44)*/
110+
#if !defined(CONFIG_USBDEV_RNDIS_ETH_MAX_FRAME_SIZE)
111+
#define CONFIG_USBDEV_RNDIS_ETH_MAX_FRAME_SIZE 1580
112+
#endif
115113

116-
#if !defined(CONFIG_USBDEV_RNDIS_VENDOR_ID)
117-
#define CONFIG_USBDEV_RNDIS_VENDOR_ID 0x0000ffff
118-
#endif
114+
#if !defined(CONFIG_USBDEV_RNDIS_VENDOR_ID)
115+
#define CONFIG_USBDEV_RNDIS_VENDOR_ID 0x0000ffff
116+
#endif
119117

120-
#if !defined(CONFIG_USBDEV_RNDIS_VENDOR_DESC)
121-
#define CONFIG_USBDEV_RNDIS_VENDOR_DESC "CherryUSB"
122-
#endif
118+
#if !defined(CONFIG_USBDEV_RNDIS_VENDOR_DESC)
119+
#define CONFIG_USBDEV_RNDIS_VENDOR_DESC "CherryUSB"
120+
#endif
123121

124-
#define CONFIG_USBDEV_RNDIS_USING_LWIP
122+
#define CONFIG_USBDEV_RNDIS_USING_LWIP
125123

126124

127125

128-
#define CONFIG_USBHOST_MAX_RHPORTS 1
129-
#define CONFIG_USBHOST_MAX_EXTHUBS 4
130-
#define CONFIG_USBHOST_MAX_EHPORTS 8
131-
#define CONFIG_USBHOST_MAX_INTERFACES 8
132-
#define CONFIG_USBHOST_MAX_INTF_ALTSETTINGS 8
133-
#define CONFIG_USBHOST_MAX_ENDPOINTS 8
126+
#define CONFIG_USBHOST_MAX_RHPORTS 1
127+
#define CONFIG_USBHOST_MAX_EXTHUBS 4
128+
#define CONFIG_USBHOST_MAX_EHPORTS 8
129+
#define CONFIG_USBHOST_MAX_INTERFACES 8
130+
#define CONFIG_USBHOST_MAX_INTF_ALTSETTINGS 8
131+
#define CONFIG_USBHOST_MAX_ENDPOINTS 8
134132

135-
#define CONFIG_USBHOST_MAX_CDC_ACM_CLASS 4
136-
#define CONFIG_USBHOST_MAX_HID_CLASS 4
137-
#define CONFIG_USBHOST_MAX_MSC_CLASS 2
138-
#define CONFIG_USBHOST_MAX_AUDIO_CLASS 1
139-
#define CONFIG_USBHOST_MAX_VIDEO_CLASS 1
140-
#define CONFIG_USBHOST_MAX_RNDIS_CLASS 1
133+
#define CONFIG_USBHOST_MAX_CDC_ACM_CLASS 4
134+
#define CONFIG_USBHOST_MAX_HID_CLASS 4
135+
#define CONFIG_USBHOST_MAX_MSC_CLASS 2
136+
#define CONFIG_USBHOST_MAX_AUDIO_CLASS 1
137+
#define CONFIG_USBHOST_MAX_VIDEO_CLASS 1
138+
#define CONFIG_USBHOST_MAX_RNDIS_CLASS 1
141139

142-
#define CONFIG_USBHOST_DEV_NAMELEN 16
140+
#define CONFIG_USBHOST_DEV_NAMELEN 16
143141

144-
#if !defined(CONFIG_USBHOST_PSC_PRIO)
145-
#define CONFIG_USBHOST_PSC_PRIO 0
146-
#endif
147-
#if !defined(CONFIG_USBHOST_PSC_STACKSIZE)
148-
#define CONFIG_USBHOST_PSC_STACKSIZE 2048
149-
#endif
142+
#if !defined(CONFIG_USBHOST_PSC_PRIO)
143+
#define CONFIG_USBHOST_PSC_PRIO 0
144+
#endif
145+
#if !defined(CONFIG_USBHOST_PSC_STACKSIZE)
146+
#define CONFIG_USBHOST_PSC_STACKSIZE 2048
147+
#endif
150148

151-
//#define CONFIG_USBHOST_GET_STRING_DESC
149+
//#define CONFIG_USBHOST_GET_STRING_DESC
152150

153-
// #define CONFIG_USBHOST_MSOS_ENABLE
154-
#if !defined(CONFIG_USBHOST_MSOS_VENDOR_CODE)
155-
#define CONFIG_USBHOST_MSOS_VENDOR_CODE 0x00
156-
#endif
151+
// #define CONFIG_USBHOST_MSOS_ENABLE
152+
#if !defined(CONFIG_USBHOST_MSOS_VENDOR_CODE)
153+
#define CONFIG_USBHOST_MSOS_VENDOR_CODE 0x00
154+
#endif
157155

158-
/* Ep0 max transfer buffer */
159-
#if !defined(CONFIG_USBHOST_REQUEST_BUFFER_LEN)
160-
#define CONFIG_USBHOST_REQUEST_BUFFER_LEN 512
161-
#endif
156+
/* Ep0 max transfer buffer */
157+
#if !defined(CONFIG_USBHOST_REQUEST_BUFFER_LEN)
158+
#define CONFIG_USBHOST_REQUEST_BUFFER_LEN 512
159+
#endif
162160

163-
#if !defined(CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT)
164-
#define CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT 500
165-
#endif
161+
#if !defined(CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT)
162+
#define CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT 500
163+
#endif
166164

167-
#if !defined(CONFIG_USBHOST_MSC_TIMEOUT)
168-
#define CONFIG_USBHOST_MSC_TIMEOUT 5000
169-
#endif
165+
#if !defined(CONFIG_USBHOST_MSC_TIMEOUT)
166+
#define CONFIG_USBHOST_MSC_TIMEOUT 5000
167+
#endif
170168

171-
/* This parameter affects usb performance, and depends on (TCP_WND)tcp eceive windows size,
172-
* you can change to 2K ~ 16K and must be larger than TCP RX windows size in order to avoid being overflow.
173-
*/
174-
#if !defined(CONFIG_USBHOST_RNDIS_ETH_MAX_RX_SIZE)
175-
#define CONFIG_USBHOST_RNDIS_ETH_MAX_RX_SIZE (2048)
176-
#endif
169+
/* This parameter affects usb performance, and depends on (TCP_WND)tcp eceive windows size,
170+
* you can change to 2K ~ 16K and must be larger than TCP RX windows size in order to avoid being overflow.
171+
*/
172+
#if !defined(CONFIG_USBHOST_RNDIS_ETH_MAX_RX_SIZE)
173+
#define CONFIG_USBHOST_RNDIS_ETH_MAX_RX_SIZE (2048)
174+
#endif
177175

178-
/* Because lwip do not support multi pbuf at a time, so increasing this variable has no performance improvement */
179-
#if !defined(CONFIG_USBHOST_RNDIS_ETH_MAX_TX_SIZE)
180-
#define CONFIG_USBHOST_RNDIS_ETH_MAX_TX_SIZE (2048)
181-
#endif
176+
/* Because lwip do not support multi pbuf at a time, so increasing this variable has no performance improvement */
177+
#if !defined(CONFIG_USBHOST_RNDIS_ETH_MAX_TX_SIZE)
178+
#define CONFIG_USBHOST_RNDIS_ETH_MAX_TX_SIZE (2048)
179+
#endif
182180

183-
/* This parameter affects usb performance, and depends on (TCP_WND)tcp eceive windows size,
184-
* you can change to 2K ~ 16K and must be larger than TCP RX windows size in order to avoid being overflow.
185-
*/
186-
#if !defined(CONFIG_USBHOST_CDC_NCM_ETH_MAX_RX_SIZE)
187-
#define CONFIG_USBHOST_CDC_NCM_ETH_MAX_RX_SIZE (2048)
188-
#endif
189-
/* Because lwip do not support multi pbuf at a time, so increasing this variable has no performance improvement */
190-
#if !defined(CONFIG_USBHOST_CDC_NCM_ETH_MAX_TX_SIZE)
191-
#define CONFIG_USBHOST_CDC_NCM_ETH_MAX_TX_SIZE (2048)
192-
#endif
181+
/* This parameter affects usb performance, and depends on (TCP_WND)tcp eceive windows size,
182+
* you can change to 2K ~ 16K and must be larger than TCP RX windows size in order to avoid being overflow.
183+
*/
184+
#if !defined(CONFIG_USBHOST_CDC_NCM_ETH_MAX_RX_SIZE)
185+
#define CONFIG_USBHOST_CDC_NCM_ETH_MAX_RX_SIZE (2048)
186+
#endif
187+
/* Because lwip do not support multi pbuf at a time, so increasing this variable has no performance improvement */
188+
#if !defined(CONFIG_USBHOST_CDC_NCM_ETH_MAX_TX_SIZE)
189+
#define CONFIG_USBHOST_CDC_NCM_ETH_MAX_TX_SIZE (2048)
190+
#endif
193191

194-
/* This parameter affects usb performance, and depends on (TCP_WND)tcp eceive windows size,
195-
* you can change to 2K ~ 16K and must be larger than TCP RX windows size in order to avoid being overflow.
196-
*/
197-
#if !defined(CONFIG_USBHOST_ASIX_ETH_MAX_RX_SIZE)
198-
#define CONFIG_USBHOST_ASIX_ETH_MAX_RX_SIZE (2048)
199-
#endif
200-
/* Because lwip do not support multi pbuf at a time, so increasing this variable has no performance improvement */
201-
#if !defined(CONFIG_USBHOST_ASIX_ETH_MAX_TX_SIZE)
202-
#define CONFIG_USBHOST_ASIX_ETH_MAX_TX_SIZE (2048)
203-
#endif
192+
/* This parameter affects usb performance, and depends on (TCP_WND)tcp eceive windows size,
193+
* you can change to 2K ~ 16K and must be larger than TCP RX windows size in order to avoid being overflow.
194+
*/
195+
#if !defined(CONFIG_USBHOST_ASIX_ETH_MAX_RX_SIZE)
196+
#define CONFIG_USBHOST_ASIX_ETH_MAX_RX_SIZE (2048)
197+
#endif
198+
/* Because lwip do not support multi pbuf at a time, so increasing this variable has no performance improvement */
199+
#if !defined(CONFIG_USBHOST_ASIX_ETH_MAX_TX_SIZE)
200+
#define CONFIG_USBHOST_ASIX_ETH_MAX_TX_SIZE (2048)
201+
#endif
204202

205-
/* This parameter affects usb performance, and depends on (TCP_WND)tcp eceive windows size,
206-
* you can change to 2K ~ 16K and must be larger than TCP RX windows size in order to avoid being overflow.
207-
*/
208-
#if !defined(CONFIG_USBHOST_RTL8152_ETH_MAX_RX_SIZE)
209-
#define CONFIG_USBHOST_RTL8152_ETH_MAX_RX_SIZE (2048)
210-
#endif
211-
/* Because lwip do not support multi pbuf at a time, so increasing this variable has no performance improvement */
212-
#if !defined(CONFIG_USBHOST_RTL8152_ETH_MAX_TX_SIZE)
213-
#define CONFIG_USBHOST_RTL8152_ETH_MAX_TX_SIZE (2048)
214-
#endif
203+
/* This parameter affects usb performance, and depends on (TCP_WND)tcp eceive windows size,
204+
* you can change to 2K ~ 16K and must be larger than TCP RX windows size in order to avoid being overflow.
205+
*/
206+
#if !defined(CONFIG_USBHOST_RTL8152_ETH_MAX_RX_SIZE)
207+
#define CONFIG_USBHOST_RTL8152_ETH_MAX_RX_SIZE (2048)
208+
#endif
209+
/* Because lwip do not support multi pbuf at a time, so increasing this variable has no performance improvement */
210+
#if !defined(CONFIG_USBHOST_RTL8152_ETH_MAX_TX_SIZE)
211+
#define CONFIG_USBHOST_RTL8152_ETH_MAX_TX_SIZE (2048)
212+
#endif
215213

216-
#define CONFIG_USBHOST_BLUETOOTH_HCI_H4
217-
// #define CONFIG_USBHOST_BLUETOOTH_HCI_LOG
214+
#define CONFIG_USBHOST_BLUETOOTH_HCI_H4
215+
// #define CONFIG_USBHOST_BLUETOOTH_HCI_LOG
218216

219-
#if !defined(CONFIG_USBHOST_BLUETOOTH_TX_SIZE)
220-
#define CONFIG_USBHOST_BLUETOOTH_TX_SIZE 2048
221-
#endif
222-
#if !defined(CONFIG_USBHOST_BLUETOOTH_RX_SIZE)
223-
#define CONFIG_USBHOST_BLUETOOTH_RX_SIZE 2048
224-
#endif
217+
#if !defined(CONFIG_USBHOST_BLUETOOTH_TX_SIZE)
218+
#define CONFIG_USBHOST_BLUETOOTH_TX_SIZE 2048
219+
#endif
220+
#if !defined(CONFIG_USBHOST_BLUETOOTH_RX_SIZE)
221+
#define CONFIG_USBHOST_BLUETOOTH_RX_SIZE 2048
222+
#endif
225223

226224

227-
#if !defined(CONFIG_USB_HS)
228-
#define CONFIG_USB_HS
229-
#endif
225+
#if !defined(CONFIG_USB_HS)
226+
#define CONFIG_USB_HS
227+
#endif
230228

231-
#if !defined(CONFIG_USBDEV_EP_NUM)
232-
#define CONFIG_USBDEV_EP_NUM 8
233-
#endif
234-
#if !defined(CONFIG_USBHOST_MAX_BUS)
235-
#define CONFIG_USBHOST_MAX_BUS 1
236-
#endif
229+
#if !defined(CONFIG_USBDEV_EP_NUM)
230+
#define CONFIG_USBDEV_EP_NUM 8
231+
#endif
232+
#if !defined(CONFIG_USBHOST_MAX_BUS)
233+
#define CONFIG_USBHOST_MAX_BUS 1
234+
#endif
237235

238-
#if !defined(CONFIG_USBHOST_PIPE_NUM)
239-
#define CONFIG_USBHOST_PIPE_NUM 10
240-
#endif
236+
#if !defined(CONFIG_USBHOST_PIPE_NUM)
237+
#define CONFIG_USBHOST_PIPE_NUM 10
238+
#endif
241239

242-
/* ---------------- EHCI Configuration ---------------- */
243-
#define CONFIG_USB_EHCI_HCCR_OFFSET (0)
244-
#define CONFIG_USB_EHCI_FRAME_LIST_SIZE 1024
245-
#define CONFIG_USB_EHCI_QH_NUM CONFIG_USBHOST_PIPE_NUM
246-
#define CONFIG_USB_EHCI_QTD_NUM 3
247-
#define CONFIG_USB_EHCI_ITD_NUM 20
248-
// #define CONFIG_USB_EHCI_HCOR_RESERVED_DISABLE
249-
#define CONFIG_USB_EHCI_CONFIGFLAG
250-
// #define CONFIG_USB_EHCI_ISO
251-
//#define CONFIG_USB_EHCI_WITH_OHCI
252-
253-
/* ---------------- OHCI Configuration ---------------- */
254-
#define CONFIG_USB_OHCI_HCOR_OFFSET (0x0)
255-
256-
#if !defined(usb_phyaddr2ramaddr)
257-
#define usb_phyaddr2ramaddr(addr) (addr)
258-
#endif
240+
/* ---------------- EHCI Configuration ---------------- */
241+
#define CONFIG_USB_EHCI_HCCR_OFFSET (0)
242+
#define CONFIG_USB_EHCI_FRAME_LIST_SIZE 1024
243+
#define CONFIG_USB_EHCI_QH_NUM CONFIG_USBHOST_PIPE_NUM
244+
#define CONFIG_USB_EHCI_QTD_NUM 3
245+
#define CONFIG_USB_EHCI_ITD_NUM 20
246+
// #define CONFIG_USB_EHCI_HCOR_RESERVED_DISABLE
247+
#define CONFIG_USB_EHCI_CONFIGFLAG
248+
// #define CONFIG_USB_EHCI_ISO
249+
//#define CONFIG_USB_EHCI_WITH_OHCI
250+
251+
/* ---------------- OHCI Configuration ---------------- */
252+
#define CONFIG_USB_OHCI_HCOR_OFFSET (0x0)
253+
254+
#if !defined(usb_phyaddr2ramaddr)
255+
#define usb_phyaddr2ramaddr(addr) (addr)
256+
#endif
259257

260-
#if !defined(usb_ramaddr2phyaddr)
261-
#define usb_ramaddr2phyaddr(addr) (addr)
262-
#endif
258+
#if !defined(usb_ramaddr2phyaddr)
259+
#define usb_ramaddr2phyaddr(addr) (addr)
260+
#endif
263261

264262
#endif

0 commit comments

Comments
 (0)