Skip to content

Commit fab9e3b

Browse files
authored
Merge pull request #12176 from OpenNuvoton/nuvoton_usbd
Nuvoton: Support usbd
2 parents c8ac1ef + 2764f48 commit fab9e3b

File tree

9 files changed

+2515
-14
lines changed

9 files changed

+2515
-14
lines changed

TESTS/usb_device/msd/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
#include "HeapBlockDevice.h"
3434
#include "FATFileSystem.h"
3535

36-
37-
#if !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
36+
// TARGET_NANO100 SRAM 16KB can't afford mass-storage-disk test, so skip usb_msd_test.
37+
#if !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE || TARGET_NANO100
3838
#error [NOT_SUPPORTED] USB Device not supported for this target
3939
#else
4040

drivers/source/usb/USBCDC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ void USBCDC::_receive_isr_start()
464464
{
465465
if ((_rx_size == 0) && !_rx_in_progress) {
466466
// Refill the buffer
467-
read_start(_bulk_out, _rx_buffer, sizeof(_rx_buffer));
468467
_rx_in_progress = true;
468+
read_start(_bulk_out, _rx_buffer, sizeof(_rx_buffer));
469469
}
470470
}
471471

targets/TARGET_NUVOTON/TARGET_M2351/device/StdDriver/m2351_clk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ extern "C"
6464
#define CLK_CLKSEL0_SDH0SEL_HCLK (0x02UL<<CLK_CLKSEL0_SDH0SEL_Pos) /*!< Setting SDH0 clock source as HCLK */
6565
#define CLK_CLKSEL0_SDH0SEL_HIRC (0x03UL<<CLK_CLKSEL0_SDH0SEL_Pos) /*!< Setting SDH0 clock source as HIRC */
6666

67+
#define CLK_CLKSEL0_USBSEL_HIRC48 (0x00UL<<CLK_CLKSEL0_USBSEL_Pos) /*!< Setting USB clock source as HIRC48 */
6768
#define CLK_CLKSEL0_USBSEL_PLL (0x01UL<<CLK_CLKSEL0_USBSEL_Pos) /*!< Setting USB clock source as PLL */
6869

6970

targets/TARGET_NUVOTON/TARGET_NANO100/device/StdDriver/nano100_usbd.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
******************************************************************************/
1010
#ifndef __USBD_H__
1111
#define __USBD_H__
12-
12+
#ifdef __cplusplus
13+
extern "C"
14+
{
15+
#endif
1316

1417
/** @addtogroup NANO100_Device_Driver NANO100 Device Driver
1518
@{
@@ -501,6 +504,9 @@ void USBD_LockEpStall(uint32_t u32EpBitmap);
501504

502505
/*@}*/ /* end of group NANO100_Device_Driver */
503506

507+
#ifdef __cplusplus
508+
}
509+
#endif
504510

505511
#endif //__USBD_H__
506512

targets/TARGET_NUVOTON/TARGET_NANO100/mbed_overrides.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void mbed_sdk_init(void)
6464
* T2. <1 ms with HIRC-clocked PLL as HCLK clock source
6565
* T1 will fail Greentea test which requires max 10 ms wake-up time.
6666
*
67-
* If we just call CLK_SetCoreClock(FREQ_42MHZ) to configure HCLK to 42 MHz,
67+
* If we just call CLK_SetCoreClock(FREQ_48MHZ) to configure HCLK to 48 MHz,
6868
* it will go T1 with HXT already enabled in front. So we manually configure
6969
* it to choose HXT/HIRC-clocked PLL.
7070
*/
@@ -76,10 +76,10 @@ void mbed_sdk_init(void)
7676
#endif
7777

7878
#if (NU_CLOCK_PLL == NU_HXT_PLL)
79-
CLK_EnablePLL(CLK_PLLCTL_PLL_SRC_HXT, FREQ_42MHZ*2);
79+
CLK_EnablePLL(CLK_PLLCTL_PLL_SRC_HXT, FREQ_48MHZ*2);
8080
CLK_SetHCLK(CLK_CLKSEL0_HCLK_S_PLL, CLK_HCLK_CLK_DIVIDER(2));
8181
#elif (NU_CLOCK_PLL == NU_HIRC_PLL)
82-
CLK_EnablePLL(CLK_PLLCTL_PLL_SRC_HIRC, FREQ_42MHZ*2);
82+
CLK_EnablePLL(CLK_PLLCTL_PLL_SRC_HIRC, FREQ_48MHZ*2);
8383
CLK_SetHCLK(CLK_CLKSEL0_HCLK_S_PLL, CLK_HCLK_CLK_DIVIDER(2));
8484
#endif
8585

0 commit comments

Comments
 (0)