From 0af3666882491d5336274ee37da9c564a0eca202 Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 31 Jan 2021 21:53:00 +0800 Subject: [PATCH 1/4] remove unused function declarations --- libcpu/mips/gs232/interrupt.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libcpu/mips/gs232/interrupt.c b/libcpu/mips/gs232/interrupt.c index f3e0f80763..66abea379d 100644 --- a/libcpu/mips/gs232/interrupt.c +++ b/libcpu/mips/gs232/interrupt.c @@ -22,7 +22,6 @@ #define MAX_INTR (GS232_NR_IRQS) static struct rt_irq_desc irq_handle_table[MAX_INTR]; -void rt_interrupt_dispatch(void *ptreg); void rt_hw_timer_handler(); static struct gs232_intc_regs volatile *gs232_hw0_icregs From d874ab11098e9384869db6ad4a86c5c5d65ca432 Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 31 Jan 2021 21:56:30 +0800 Subject: [PATCH 2/4] mips:gs232:LS1C300 have 5 group INTC cells but LS1B have 4 group INTC cells --- bsp/ls1cdev/Kconfig | 2 +- bsp/ls1cdev/rtconfig.h | 2 +- libcpu/mips/gs232/gs232.h | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bsp/ls1cdev/Kconfig b/bsp/ls1cdev/Kconfig index 6cd2409db4..3fb6e3bbdf 100644 --- a/bsp/ls1cdev/Kconfig +++ b/bsp/ls1cdev/Kconfig @@ -19,7 +19,7 @@ source "$RTT_DIR/Kconfig" source "$RTT_DIR/libcpu/mips/common/Kconfig" source "$PKGS_DIR/Kconfig" -config SOC_1C300 +config SOC_LS1C300 bool select RT_USING_COMPONENTS_INIT select RT_USING_USER_MAIN diff --git a/bsp/ls1cdev/rtconfig.h b/bsp/ls1cdev/rtconfig.h index a2bac5d6f0..55899c04e1 100644 --- a/bsp/ls1cdev/rtconfig.h +++ b/bsp/ls1cdev/rtconfig.h @@ -161,7 +161,7 @@ /* samples: kernel and components samples */ -#define SOC_1C300 +#define SOC_LS1C300 #define RT_LS1C_BAICAIBOARD #define RT_USING_SELF_BOOT #define RT_SELF_BOOT_DEBUG diff --git a/libcpu/mips/gs232/gs232.h b/libcpu/mips/gs232/gs232.h index 6e90f7ba66..95c81cf93e 100644 --- a/libcpu/mips/gs232/gs232.h +++ b/libcpu/mips/gs232/gs232.h @@ -17,7 +17,14 @@ #define INTC_BASE 0xBFD01040 +#ifdef SOC_LS1B +#define GS232_INTC_CELLS 4 +#endif + +#ifdef SOC_LS1C300 #define GS232_INTC_CELLS 5 +#endif + #define GS232_NR_IRQS (32 * GS232_INTC_CELLS) #define GMAC0_BASE 0xBFE10000 @@ -64,4 +71,4 @@ extern void rt_hw_timer_init(void); #endif -#endif \ No newline at end of file +#endif From 242530ae7017dbe0b5efae7796d6914c3c57f9ad Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 31 Jan 2021 22:33:58 +0800 Subject: [PATCH 3/4] ls1b: fix the count of GPIO IRQ and improvement the IRQ of UARTS. from 1b manunal we know it have 64 GPIO IRQ and 12 UARTS --- libcpu/mips/gs232/ls1b.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libcpu/mips/gs232/ls1b.h b/libcpu/mips/gs232/ls1b.h index 071a4aeb82..a6f244ef4f 100644 --- a/libcpu/mips/gs232/ls1b.h +++ b/libcpu/mips/gs232/ls1b.h @@ -19,6 +19,15 @@ #define LS1B_UART1_IRQ 3 #define LS1B_UART2_IRQ 4 #define LS1B_UART3_IRQ 5 +#define LS1B_UART4_IRQ 29 +#define LS1B_UART5_IRQ 30 +#define LS1B_UART6_IRQ 2 //共享LS1B_UART0_IRQ +#define LS1B_UART7_IRQ 2 +#define LS1B_UART8_IRQ 2 +#define LS1B_UART9_IRQ 3 //共享LS1B_UART1_IRQ +#define LS1B_UART10_IRQ 3 +#define LS1B_UART11_IRQ 3 + #define LS1B_CAN0_IRQ 6 #define LS1B_CAN1_IRQ 7 #define LS1B_SPI0_IRQ 8 @@ -49,7 +58,7 @@ #define LS1B_GPIO_IRQ 64 #define LS1B_GPIO_FIRST_IRQ 64 -#define LS1B_GPIO_IRQ_COUNT 96 +#define LS1B_GPIO_IRQ_COUNT 64 #define LS1B_GPIO_LAST_IRQ (LS1B_GPIO_FIRST_IRQ + LS1B_GPIO_IRQ_COUNT-1) #define INT_PCI_INTA (1<<6) From 4de8848a8c13eb58bb9afe5bd3122280ebb906b5 Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 31 Jan 2021 23:03:16 +0800 Subject: [PATCH 4/4] bsp:ls2k: make uart init more flexible --- bsp/ls2kdev/Kconfig | 11 ++++++++++- bsp/ls2kdev/drivers/drv_uart.c | 22 ++++++++++++++-------- bsp/ls2kdev/rtconfig.h | 2 ++ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/bsp/ls2kdev/Kconfig b/bsp/ls2kdev/Kconfig index 5cfb6892ff..fc2dfe1328 100644 --- a/bsp/ls2kdev/Kconfig +++ b/bsp/ls2kdev/Kconfig @@ -29,4 +29,13 @@ config SOC_LS2K1000 select RT_USING_USER_MAIN select RT_USING_DEVICE default y - \ No newline at end of file + +if RT_USING_SERIAL +config RT_USING_UART0 + bool "Using RT_USING_UART0" + default y + +config RT_USING_UART4 + bool "Using RT_USING_UART4" + default y +endif diff --git a/bsp/ls2kdev/drivers/drv_uart.c b/bsp/ls2kdev/drivers/drv_uart.c index 9421078769..5b5c39c595 100644 --- a/bsp/ls2kdev/drivers/drv_uart.c +++ b/bsp/ls2kdev/drivers/drv_uart.c @@ -156,26 +156,32 @@ struct rt_serial_device serial, serial4; void rt_hw_uart_init(void) { - struct rt_uart_ls2k *uart, *uart4; struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT; - uart = &uart_dev0; - uart4 = &uart_dev4; +#ifdef RT_USING_UART0 + struct rt_uart_ls2k *uart0; + uart0 = &uart_dev0; serial.ops = &ls2k_uart_ops; serial.config = config_uart0; - serial4.ops = &ls2k_uart_ops; - serial4.config = config; - rt_hw_interrupt_install(uart->IRQ, uart_irq_handler, &serial, "UART0"); - rt_hw_interrupt_install(uart4->IRQ, uart_irq_handler, &serial4, "UART4"); + rt_hw_interrupt_install(uart0->IRQ, uart_irq_handler, &serial, "UART0"); /* register UART device */ rt_hw_serial_register(&serial, "uart0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, - uart); + uart0); +#endif + +#ifdef RT_USING_UART4 + struct rt_uart_ls2k *uart4; + uart4 = &uart_dev4; + serial4.ops = &ls2k_uart_ops; + serial4.config = config; + rt_hw_interrupt_install(uart4->IRQ, uart_irq_handler, &serial4, "UART4"); rt_hw_serial_register(&serial4, "uart4", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, &uart_dev4); +#endif } /*@}*/ diff --git a/bsp/ls2kdev/rtconfig.h b/bsp/ls2kdev/rtconfig.h index dfaa45a009..0b15f1f420 100644 --- a/bsp/ls2kdev/rtconfig.h +++ b/bsp/ls2kdev/rtconfig.h @@ -235,5 +235,7 @@ /* games: games run on RT-Thread console */ #define SOC_LS2K1000 +#define RT_USING_UART0 +#define RT_USING_UART4 #endif