diff options
| author | Bernard Xiong <[email protected]> | 2021-02-02 07:00:46 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-02-02 07:00:46 +0800 |
| commit | 59f320783f120a6ba8f330192c0bbedaaf9ad4d6 (patch) | |
| tree | ff868d374473b44cb10309ad2baaf86fb2baaafb /bsp/ls2kdev | |
| parent | b42a43cd00f125a329b7112d0229372f7034f928 (diff) | |
| parent | 4de8848a8c13eb58bb9afe5bd3122280ebb906b5 (diff) | |
Merge pull request #4286 from Michael0066/ls1b-dev
ls1b: fix the count of GPIO IRQ
Diffstat (limited to 'bsp/ls2kdev')
| -rw-r--r-- | bsp/ls2kdev/Kconfig | 11 | ||||
| -rw-r--r-- | bsp/ls2kdev/drivers/drv_uart.c | 22 | ||||
| -rw-r--r-- | 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 c4c1bd2a86..4fd46f8874 100644 --- a/bsp/ls2kdev/rtconfig.h +++ b/bsp/ls2kdev/rtconfig.h @@ -232,5 +232,7 @@ /* samples: kernel and components samples */ #define SOC_LS2K1000 +#define RT_USING_UART0 +#define RT_USING_UART4 #endif |
