Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync from master #6981

Merged
merged 23 commits into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
feed84b
fix rt_kprint 64bit error
zhkag Feb 20, 2023
ff58949
update rtdevice.h add lcd
XYZ-20240101 Feb 18, 2023
aaba21c
[fix]避免字符设备特殊控制指令和通用控制指令冲突
JonasWen Feb 21, 2023
1533b88
[arduino][lpc55s69] : 对接RTduino
Z8MAN8 Feb 22, 2023
b3b8c23
[spi] rt_spi_configure 增加对cs_pin处理
liYony Feb 23, 2023
52cb2f0
[lwIP] apply AF_UNIX feature (#6954)
Guozhanxin Feb 23, 2023
6d4764a
serial_v2 rt_device_write/read return data type as rt_ssize_t
JonasWen Feb 23, 2023
96a636f
[Renesas]Add tft-lcd lvgl support
Rbb666 Feb 22, 2023
08c2a65
[rtduino][lpc55s69] 修正RTduino框架下的引脚错误 (#6963)
kurisaW Feb 23, 2023
382e9bc
[rt-smart] handling kernel from accessing unmapped user stack (#6957)
polarvid Feb 24, 2023
7bf6648
[serial]增加at32的serial_v2驱动
JonasWen Feb 23, 2023
a5c62b9
[bsp/at32] add support usb driver (#6968)
sheltonyu Feb 25, 2023
022760c
[Infineon]Fix scb5 can't use bug
Rbb666 Feb 24, 2023
faddfec
[rtduino][lpc55s69] update (#6972)
Z8MAN8 Feb 25, 2023
7763183
[rtduino][lpc55s69] 纠正uart引脚错误并使能相关依赖项 (#6976)
kurisaW Feb 25, 2023
e50a7e3
🐞 fix(components/drivers/tty/pty.c): fix ptmx not init (#6970)
xqyjlj Feb 25, 2023
4c1c6ef
解决关中断时进行了调度操作
zhkag Feb 24, 2023
d3553e7
fixed fstat/stat/readlink syscall.
geniusgogo Feb 24, 2023
53afeda
fix inet_ioctlsocket set O_LARGEFILE flag by musl.
geniusgogo Feb 24, 2023
a53367a
fixed O_LARGEFILE not defined ci build error.
geniusgogo Feb 25, 2023
fef2607
[lwp] save virtual addr in shm structure
polarvid Feb 25, 2023
12f0df9
[libcpu/aarch64] stop when no page is free
polarvid Feb 25, 2023
e63e33a
[ch32][bsp] fix warning: rt_size_t to rt_ssize_t
linshire Feb 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[bsp/at32] add support usb driver (#6968)
* add support usb driver

* fixed code format error
  • Loading branch information
sheltonyu committed Feb 25, 2023
commit a5c62b9a847fb44bb060e475c8473709cb6a2d05
3 changes: 3 additions & 0 deletions bsp/at32/at32f403a-start/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ AT32F403A-START板级包支持MDK4﹑MDK5﹑IAR开发环境和GCC编译器,以
| WDT | 支持 | |
| RTC | 支持 | |
| FLASH | 支持 | |
| USB | 支持 | |

### IO在板级支持包中的映射情况

Expand Down Expand Up @@ -94,6 +95,8 @@ AT32F403A-START板级包支持MDK4﹑MDK5﹑IAR开发环境和GCC编译器,以
| PB9 | CAN1_TX |
| PB5 | CAN2_RX |
| PB6 | CAN2_TX |
| PA11 | USB_DM |
| PA12 | USB_DP |

## 使用说明

Expand Down
3 changes: 3 additions & 0 deletions bsp/at32/at32f403a-start/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ rtconfig.BSP_LIBRARY_TYPE = at32_library
# include libraries
objs.extend(SConscript(os.path.join(libraries_path_prefix, at32_library, 'SConscript')))

# include usb libraries
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'usbd_library', 'SConscript')))

# include drivers
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'rt_drivers', 'SConscript')))

Expand Down
5 changes: 5 additions & 0 deletions bsp/at32/at32f403a-start/board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ menu "On-chip Peripheral Drivers"

config BSP_USING_ON_CHIP_FLASH
bool "Enable on-chip FLASH"
default n

config BSP_USING_USBD
bool "Enable USB BUS"
select RT_USING_USB_DEVICE
default n

menuconfig BSP_USING_RTC
Expand Down
1 change: 1 addition & 0 deletions bsp/at32/at32f403a-start/board/inc/at32_msp.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ void at32_msp_sdio_init(void *instance);
void at32_msp_adc_init(void *instance);
void at32_msp_hwtmr_init(void *instance);
void at32_msp_can_init(void *instance);
void at32_msp_usb_init(void *instance);

#endif /* __AT32_MSP_H__ */
66 changes: 66 additions & 0 deletions bsp/at32/at32f403a-start/board/src/at32_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,69 @@ void at32_msp_can_init(void *instance)
#endif
}
#endif /* BSP_USING_CAN */

#ifdef BSP_USING_USBD
void at32_msp_usb_init(void *instance)
{
usb_clk48_s clk_s;

/* default usb clock source from hick */
clk_s = USB_CLK_HICK;

/* enable usb clock */
crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);

if(clk_s == USB_CLK_HICK)
{
crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);

/* enable the acc calibration ready interrupt */
crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);

/* update the c1\c2\c3 value */
acc_write_c1(7980);
acc_write_c2(8000);
acc_write_c3(8020);

/* open acc calibration */
acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
}
else
{
switch(system_core_clock)
{
/* 48MHz */
case 48000000:
crm_usb_clock_div_set(CRM_USB_DIV_1);
break;
/* 72MHz */
case 72000000:
crm_usb_clock_div_set(CRM_USB_DIV_1_5);
break;
/* 96MHz */
case 96000000:
crm_usb_clock_div_set(CRM_USB_DIV_2);
break;
/* 120MHz */
case 120000000:
crm_usb_clock_div_set(CRM_USB_DIV_2_5);
break;
/* 144MHz */
case 144000000:
crm_usb_clock_div_set(CRM_USB_DIV_3);
break;
/* 168MHz */
case 168000000:
crm_usb_clock_div_set(CRM_USB_DIV_3_5);
break;
/* 192MHz */
case 192000000:
crm_usb_clock_div_set(CRM_USB_DIV_4);
break;
default:
break;
}
}
}

#endif /* BSP_USING_USBD */
3 changes: 3 additions & 0 deletions bsp/at32/at32f407-start/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ AT32F407-START板级包支持MDK4﹑MDK5﹑IAR开发环境和GCC编译器,以
| RTC | 支持 | |
| FLASH | 支持 | |
| EMAC | 支持 | |
| USB | 支持 | |

### IO在板级支持包中的映射情况

Expand Down Expand Up @@ -102,6 +103,8 @@ AT32F407-START板级包支持MDK4﹑MDK5﹑IAR开发环境和GCC编译器,以
| PD9 | EMAC_RMII_RXD0 |
| PD10 | EMAC_RMII_RXD1 |
| PA1 | EMAC_RMII_REF_CLK |
| PA11 | USB_DM |
| PA12 | USB_DP |

## 使用说明

Expand Down
3 changes: 3 additions & 0 deletions bsp/at32/at32f407-start/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ rtconfig.BSP_LIBRARY_TYPE = at32_library
# include libraries
objs.extend(SConscript(os.path.join(libraries_path_prefix, at32_library, 'SConscript')))

# include usb libraries
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'usbd_library', 'SConscript')))

# include drivers
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'rt_drivers', 'SConscript')))

Expand Down
5 changes: 5 additions & 0 deletions bsp/at32/at32f407-start/board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ menu "On-chip Peripheral Drivers"
endchoice
endif

config BSP_USING_USBD
bool "Enable USB BUS"
select RT_USING_USB_DEVICE
default n

menuconfig BSP_USING_RTC
bool "Enable RTC"
select RT_USING_RTC
Expand Down
1 change: 1 addition & 0 deletions bsp/at32/at32f407-start/board/inc/at32_msp.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ void at32_msp_adc_init(void *instance);
void at32_msp_hwtmr_init(void *instance);
void at32_msp_can_init(void *instance);
void at32_msp_emac_init(void *instance);
void at32_msp_usb_init(void *instance);

#endif /* __AT32_MSP_H__ */
67 changes: 67 additions & 0 deletions bsp/at32/at32f407-start/board/src/at32_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,70 @@ void at32_msp_emac_init(void *instance)
gpio_init(GPIOD, &gpio_init_struct);
}
#endif /* BSP_USING_EMAC */

#ifdef BSP_USING_USBD
void at32_msp_usb_init(void *instance)
{
usb_clk48_s clk_s;

/* default usb clock source from hick */
clk_s = USB_CLK_HICK;

/* enable usb clock */
crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);

if(clk_s == USB_CLK_HICK)
{
crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);

/* enable the acc calibration ready interrupt */
crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);

/* update the c1\c2\c3 value */
acc_write_c1(7980);
acc_write_c2(8000);
acc_write_c3(8020);

/* open acc calibration */
acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
}
else
{
switch(system_core_clock)
{
/* 48MHz */
case 48000000:
crm_usb_clock_div_set(CRM_USB_DIV_1);
break;
/* 72MHz */
case 72000000:
crm_usb_clock_div_set(CRM_USB_DIV_1_5);
break;
/* 96MHz */
case 96000000:
crm_usb_clock_div_set(CRM_USB_DIV_2);
break;
/* 120MHz */
case 120000000:
crm_usb_clock_div_set(CRM_USB_DIV_2_5);
break;
/* 144MHz */
case 144000000:
crm_usb_clock_div_set(CRM_USB_DIV_3);
break;
/* 168MHz */
case 168000000:
crm_usb_clock_div_set(CRM_USB_DIV_3_5);
break;
/* 192MHz */
case 192000000:
crm_usb_clock_div_set(CRM_USB_DIV_4);
break;
default:
break;
}
}
}

#endif /* BSP_USING_USBD */

3 changes: 3 additions & 0 deletions bsp/at32/at32f413-start/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ AT32F413-START板级包支持MDK4﹑MDK5﹑IAR开发环境和GCC编译器,以
| WDT | 支持 | |
| RTC | 支持 | |
| FLASH | 支持 | |
| USB | 支持 | |

### IO在板级支持包中的映射情况

Expand Down Expand Up @@ -94,6 +95,8 @@ AT32F413-START板级包支持MDK4﹑MDK5﹑IAR开发环境和GCC编译器,以
| PB9 | CAN1_TX |
| PB5 | CAN2_RX |
| PB6 | CAN2_TX |
| PA11 | USB_DM |
| PA12 | USB_DP |

## 使用说明

Expand Down
6 changes: 3 additions & 3 deletions bsp/at32/at32f413-start/SConscript
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# for module compiling
from building import *
import os
Import('RTT_ROOT')

cwd = str(Dir('#'))
cwd = GetCurrentDir()
objs = []
list = os.listdir(cwd)

list = os.listdir(cwd)
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
Expand Down
3 changes: 3 additions & 0 deletions bsp/at32/at32f413-start/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ rtconfig.BSP_LIBRARY_TYPE = at32_library
# include libraries
objs.extend(SConscript(os.path.join(libraries_path_prefix, at32_library, 'SConscript')))

# include usb libraries
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'usbd_library', 'SConscript')))

# include drivers
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'rt_drivers', 'SConscript')))

Expand Down
5 changes: 5 additions & 0 deletions bsp/at32/at32f413-start/board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ menu "On-chip Peripheral Drivers"

config BSP_USING_ON_CHIP_FLASH
bool "Enable on-chip FLASH"
default n

config BSP_USING_USBD
bool "Enable USB BUS"
select RT_USING_USB_DEVICE
default n

menuconfig BSP_USING_RTC
Expand Down
1 change: 1 addition & 0 deletions bsp/at32/at32f413-start/board/inc/at32_msp.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ void at32_msp_sdio_init(void *instance);
void at32_msp_adc_init(void *instance);
void at32_msp_hwtmr_init(void *instance);
void at32_msp_can_init(void *instance);
void at32_msp_usb_init(void *instance);

#endif /* __AT32_MSP_H__ */
66 changes: 66 additions & 0 deletions bsp/at32/at32f413-start/board/src/at32_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,69 @@ void at32_msp_can_init(void *instance)
#endif
}
#endif /* BSP_USING_CAN */

#ifdef BSP_USING_USBD
void at32_msp_usb_init(void *instance)
{
usb_clk48_s clk_s;

/* default usb clock source from hick */
clk_s = USB_CLK_HICK;

/* enable usb clock */
crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);

if(clk_s == USB_CLK_HICK)
{
crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);

/* enable the acc calibration ready interrupt */
crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);

/* update the c1\c2\c3 value */
acc_write_c1(7980);
acc_write_c2(8000);
acc_write_c3(8020);

/* open acc calibration */
acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
}
else
{
switch(system_core_clock)
{
/* 48MHz */
case 48000000:
crm_usb_clock_div_set(CRM_USB_DIV_1);
break;
/* 72MHz */
case 72000000:
crm_usb_clock_div_set(CRM_USB_DIV_1_5);
break;
/* 96MHz */
case 96000000:
crm_usb_clock_div_set(CRM_USB_DIV_2);
break;
/* 120MHz */
case 120000000:
crm_usb_clock_div_set(CRM_USB_DIV_2_5);
break;
/* 144MHz */
case 144000000:
crm_usb_clock_div_set(CRM_USB_DIV_3);
break;
/* 168MHz */
case 168000000:
crm_usb_clock_div_set(CRM_USB_DIV_3_5);
break;
/* 192MHz */
case 192000000:
crm_usb_clock_div_set(CRM_USB_DIV_4);
break;
default:
break;
}
}
}

#endif /* BSP_USING_USBD */
3 changes: 3 additions & 0 deletions bsp/at32/at32f415-start/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ AT32F415-START板级包支持MDK4﹑MDK5﹑IAR开发环境和GCC编译器,以
| WDT | 支持 | |
| RTC | 支持 | |
| FLASH | 支持 | |
| USB | 支持 | |

### IO在板级支持包中的映射情况

Expand Down Expand Up @@ -92,6 +93,8 @@ AT32F415-START板级包支持MDK4﹑MDK5﹑IAR开发环境和GCC编译器,以
| PC5 | ADC1_IN15 |
| PB8 | CAN1_RX |
| PB9 | CAN1_TX |
| PA11 | USB_DM |
| PA12 | USB_DP |

## 使用说明

Expand Down
3 changes: 3 additions & 0 deletions bsp/at32/at32f415-start/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ rtconfig.BSP_LIBRARY_TYPE = at32_library
# include libraries
objs.extend(SConscript(os.path.join(libraries_path_prefix, at32_library, 'SConscript')))

# include usb libraries
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'usbfs_library', 'SConscript')))

# include drivers
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'rt_drivers', 'SConscript')))

Expand Down
Loading