| 176 | |
| 177 | |
| 178 | void rt_hw_uart_init(void) |
| 179 | { |
| 180 | struct rt_uart_ls1b *uart; |
| 181 | struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT; |
| 182 | |
| 183 | #ifdef RT_USING_UART5 |
| 184 | uart = &uart5; |
| 185 | |
| 186 | serial5.ops = &ls1b_uart_ops; |
| 187 | serial5.config = config; |
| 188 | |
| 189 | rt_hw_interrupt_install(uart->IRQ, uart_irq_handler, &serial5, "UART5"); |
| 190 | |
| 191 | /* register UART5 device */ |
| 192 | rt_hw_serial_register(&serial5, |
| 193 | "uart5", |
| 194 | //RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_DMA_RX, |
| 195 | RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, |
| 196 | uart); |
| 197 | #endif /* RT_USING_UART5 */ |
| 198 | |
| 199 | |
| 200 | #ifdef RT_USING_UART2 |
| 201 | uart = &uart2; |
| 202 | |
| 203 | serial2.ops = &ls1b_uart_ops; |
| 204 | serial2.config = config; |
| 205 | |
| 206 | pin_set_purpose(36, PIN_PURPOSE_OTHER); |
| 207 | pin_set_purpose(37, PIN_PURPOSE_OTHER); |
| 208 | pin_set_remap(36, PIN_REMAP_SECOND); |
| 209 | pin_set_remap(37, PIN_REMAP_SECOND); |
| 210 | |
| 211 | rt_hw_interrupt_install(uart->IRQ, uart_irq_handler, &serial2, "UART2"); |
| 212 | |
| 213 | /* register UART2 device */ |
| 214 | rt_hw_serial_register(&serial2, |
| 215 | "uart2", |
| 216 | //RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_DMA_RX, |
| 217 | RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, |
| 218 | uart); |
| 219 | #endif /* RT_USING_UART2 */ |
| 220 | |
| 221 | } |
| 222 |
no test coverage detected