nuclei: update kconfig

Signed-off-by: Huaqi Fang <578567190@qq.com>
This commit is contained in:
Huaqi Fang 2020-04-08 18:37:24 +08:00
parent ad81c1d3bf
commit 1131f6e648
4 changed files with 84 additions and 8 deletions

View File

@ -435,12 +435,16 @@ CONFIG_SOC_GD32VF103V=y
# #
# Onboard Peripheral Drivers # Onboard Peripheral Drivers
# #
CONFIG_BSP_USING_USART=y CONFIG_BSP_USING_UART_CONSOLE=y
# #
# On-chip Peripheral Drivers # On-chip Peripheral Drivers
# #
CONFIG_BSP_USING_UART=y CONFIG_BSP_USING_UART=y
# CONFIG_BSP_USING_UART0 is not set
# CONFIG_BSP_USING_UART1 is not set
# CONFIG_BSP_USING_UART2 is not set
# CONFIG_BSP_USING_UART3 is not set
CONFIG_BSP_USING_UART4=y CONFIG_BSP_USING_UART4=y
# #

View File

@ -7,8 +7,8 @@ config SOC_GD32VF103V
menu "Onboard Peripheral Drivers" menu "Onboard Peripheral Drivers"
config BSP_USING_USART config BSP_USING_UART_CONSOLE
bool "Enable USART (uart4)" bool "Enable UART CONSOLE"
select BSP_USING_UART select BSP_USING_UART
select BSP_USING_UART4 select BSP_USING_UART4
default y default y
@ -21,9 +21,21 @@ menu "On-chip Peripheral Drivers"
default y default y
select RT_USING_SERIAL select RT_USING_SERIAL
if BSP_USING_UART if BSP_USING_UART
config BSP_USING_UART0
bool "Enable UART0"
default n
config BSP_USING_UART1
bool "Enable UART1"
default n
config BSP_USING_UART2
bool "Enable UART2"
default n
config BSP_USING_UART3
bool "Enable UART3"
default n
config BSP_USING_UART4 config BSP_USING_UART4
bool "Enable UART4" bool "Enable UART4"
default y default n
endif endif
endmenu endmenu

View File

@ -14,14 +14,23 @@
#ifdef RT_USING_SERIAL #ifdef RT_USING_SERIAL
#if !defined(BSP_USING_UART0) && !defined(BSP_USING_UART1) && !defined(BSP_USING_UART2) \ #if !defined(BSP_USING_UART0) && !defined(BSP_USING_UART1) && !defined(BSP_USING_UART2) \
&& !defined(BSP_USING_UART3) && !defined(BSP_USING_UART4) && !defined(BSP_USING_UART5) && !defined(BSP_USING_UART3) && !defined(BSP_USING_UART4)
#error "Please define at least one BSP_USING_UARTx" #error "Please define at least one BSP_USING_UARTx"
/* this driver can be disabled at menuconfig -> RT-Thread Components -> Device Drivers */ /* this driver can be disabled at menuconfig -> RT-Thread Components -> Device Drivers */
#endif #endif
enum { enum {
#ifdef BSP_USING_UART0 #ifdef BSP_USING_UART0
GDUSART0_INDEX, GDUART0_INDEX,
#endif
#ifdef BSP_USING_UART1
GDUART1_INDEX,
#endif
#ifdef BSP_USING_UART2
GDUART2_INDEX,
#endif
#ifdef BSP_USING_UART3
GDUART3_INDEX,
#endif #endif
#ifdef BSP_USING_UART4 #ifdef BSP_USING_UART4
GDUART4_INDEX, GDUART4_INDEX,
@ -34,6 +43,21 @@ static struct gd32_uart_config uart_config[] = {
USART0, USART0,
USART0_IRQn, }, USART0_IRQn, },
#endif #endif
#ifdef BSP_USING_UART1
{ "uart1",
USART1,
USART1_IRQn, },
#endif
#ifdef BSP_USING_UART2
{ "uart2",
USART2,
USART2_IRQn, },
#endif
#ifdef BSP_USING_UART3
{ "uart3",
USART3,
USART3_IRQn, },
#endif
#ifdef BSP_USING_UART4 #ifdef BSP_USING_UART4
{ "uart4", { "uart4",
UART4, UART4,
@ -202,7 +226,43 @@ static void usart_isr(struct rt_serial_device *serial) {
void USART0_IRQHandler(void) { void USART0_IRQHandler(void) {
rt_interrupt_enter(); rt_interrupt_enter();
usart_isr(&uart_obj[GDUSART0_INDEX].serial); usart_isr(&uart_obj[GDUART0_INDEX].serial);
rt_interrupt_leave();
}
#endif
#ifdef BSP_USING_UART1
void USART1_IRQHandler(void) {
rt_interrupt_enter();
usart_isr(&uart_obj[GDUART1_INDEX].serial);
rt_interrupt_leave();
}
#endif
#ifdef BSP_USING_UART2
void USART2_IRQHandler(void) {
rt_interrupt_enter();
usart_isr(&uart_obj[GDUART2_INDEX].serial);
rt_interrupt_leave();
}
#endif
#ifdef BSP_USING_UART3
void UART3_IRQHandler(void) {
rt_interrupt_enter();
usart_isr(&uart_obj[GDUART3_INDEX].serial);
rt_interrupt_leave(); rt_interrupt_leave();
} }

View File

@ -167,7 +167,7 @@
/* Onboard Peripheral Drivers */ /* Onboard Peripheral Drivers */
#define BSP_USING_USART #define BSP_USING_UART_CONSOLE
/* On-chip Peripheral Drivers */ /* On-chip Peripheral Drivers */