* This function initializes console * */
| 277 | * |
| 278 | */ |
| 279 | int rt_hw_console_init(void) |
| 280 | { |
| 281 | rt_cga_init(); |
| 282 | rt_serial_init(); |
| 283 | init_keyboard(); |
| 284 | |
| 285 | /* install keyboard isr */ |
| 286 | rt_hw_interrupt_install(INTKEYBOARD, rt_console_isr, RT_NULL, "kbd"); |
| 287 | rt_hw_interrupt_umask(INTKEYBOARD); |
| 288 | |
| 289 | rt_hw_interrupt_install(INTUART0_RX, rt_console_isr, RT_NULL, "COM1"); |
| 290 | rt_hw_interrupt_umask(INTUART0_RX); |
| 291 | |
| 292 | console_device.type = RT_Device_Class_Char; |
| 293 | console_device.rx_indicate = RT_NULL; |
| 294 | console_device.tx_complete = RT_NULL; |
| 295 | console_device.init = rt_console_init; |
| 296 | console_device.open = rt_console_open; |
| 297 | console_device.close = rt_console_close; |
| 298 | console_device.read = rt_console_read; |
| 299 | console_device.write = rt_console_write; |
| 300 | console_device.control = rt_console_control; |
| 301 | console_device.user_data = RT_NULL; |
| 302 | |
| 303 | /* register a character device */ |
| 304 | rt_device_register(&console_device, |
| 305 | "console", |
| 306 | RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM); |
| 307 | |
| 308 | return 0; |
| 309 | } |
| 310 | INIT_DEVICE_EXPORT(rt_hw_console_init); |
| 311 | |
| 312 | /** |
no test coverage detected