diff options
| author | Meco Man <[email protected]> | 2021-02-05 20:44:25 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-02-05 20:44:25 +0800 |
| commit | 852d7d7552bd3fe898115ea16ba401970b0d1fad (patch) | |
| tree | f7c13c061ecaa47e70f0f856cc685bba25866429 /bsp/ls2kdev/drivers/drv_uart.c | |
| parent | 97cc8a8f72838deb0273a3e60ae29319edd7e4f7 (diff) | |
| parent | 7fc236dddb14bcf5dba8e304efde9c3a518a117c (diff) | |
Merge pull request #15 from RT-Thread/master
pr
Diffstat (limited to 'bsp/ls2kdev/drivers/drv_uart.c')
| -rw-r--r-- | bsp/ls2kdev/drivers/drv_uart.c | 22 |
1 files changed, 14 insertions, 8 deletions
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 } /*@}*/ |
