source:
rtems/bsps/i386/pc386/console/printk_support.c
@
d7d66d7
Last change on this file since d7d66d7 was d7d66d7, checked in by Sebastian Huber <sebastian.huber@…>, on 04/19/18 at 04:28:01 | |
---|---|
|
|
File size: 1.7 KB |
Rev | Line | |
---|---|---|
[1c0b8d7] | 1 | /* |
[d1887baf] | 2 | * @file |
[1c0b8d7] | 3 | * |
[d1887baf] | 4 | * @ingroup Console |
5 | * | |
6 | * @brief printk support routines | |
7 | * | |
8 | * This file contains the required printk support. | |
[1c0b8d7] | 9 | */ |
10 | ||
11 | /* | |
[d1887baf] | 12 | * COPYRIGHT (c) 1989-2012. |
[1c0b8d7] | 13 | * On-Line Applications Research Corporation (OAR). |
14 | * | |
15 | * The license and distribution terms for this file may be | |
16 | * found in the file LICENSE in this distribution or at | |
[c499856] | 17 | * http://www.rtems.org/license/LICENSE. |
[1c0b8d7] | 18 | */ |
19 | ||
20 | #include <rtems.h> | |
21 | #include <rtems/bspIo.h> | |
[607c854] | 22 | #if BSP_ENABLE_VGA |
23 | #include <rtems/keyboard.h> | |
24 | #endif | |
[1c0b8d7] | 25 | #include <bsp.h> |
26 | #include <libchip/serial.h> | |
27 | #include <libchip/ns16550.h> | |
[d7d66d7] | 28 | #include "../../shared/dev/serial/legacy-console.h" |
[1c0b8d7] | 29 | |
[292dbff] | 30 | rtems_device_minor_number BSPPrintkPort = 0; |
[1c0b8d7] | 31 | |
[441b90e] | 32 | void BSP_outch(char ch); |
33 | int BSP_inch(void); | |
[1c0b8d7] | 34 | |
[441b90e] | 35 | void BSP_outch(char ch) |
36 | { | |
[607c854] | 37 | #if BSP_ENABLE_VGA |
[292dbff] | 38 | bool isVga = BSPPrintkPort == BSP_CONSOLE_VGA; |
39 | #else | |
40 | bool isVga = false; | |
[607c854] | 41 | #endif |
[1c0b8d7] | 42 | |
[292dbff] | 43 | if ( !isVga ) { |
44 | console_tbl *port = Console_Port_Tbl[BSPPrintkPort]; | |
45 | if (port->pDeviceFns && port->pDeviceFns->deviceWritePolled) { | |
46 | port->pDeviceFns->deviceWritePolled( BSPPrintkPort, ch ); | |
47 | } | |
48 | return; | |
49 | } | |
50 | ||
51 | #if BSP_ENABLE_VGA | |
52 | _IBMPC_outch( ch ); | |
53 | #endif | |
[1c0b8d7] | 54 | } |
55 | ||
[292dbff] | 56 | int BSP_inch(void) |
[1c0b8d7] | 57 | { |
[607c854] | 58 | #if BSP_ENABLE_VGA |
[292dbff] | 59 | bool isVga = BSPPrintkPort == BSP_CONSOLE_VGA; |
60 | #else | |
61 | bool isVga = false; | |
[607c854] | 62 | #endif |
[292dbff] | 63 | |
64 | int result = -1; | |
65 | ||
66 | if ( !isVga ) { | |
67 | console_tbl *port = Console_Port_Tbl[BSPPrintkPort]; | |
68 | if (port->pDeviceFns && port->pDeviceFns->deviceRead) { | |
[607c854] | 69 | do { |
[292dbff] | 70 | result = port->pDeviceFns->deviceRead( BSPPrintkPort ); |
[607c854] | 71 | } while (result == -1); |
[292dbff] | 72 | return result; |
[607c854] | 73 | } |
[292dbff] | 74 | } |
75 | ||
76 | #if BSP_ENABLE_VGA | |
77 | result = BSP_wait_polled_input(); | |
[0a36af04] | 78 | #endif |
[292dbff] | 79 | |
[1c0b8d7] | 80 | return result; |
81 | } | |
82 | ||
[441b90e] | 83 | BSP_output_char_function_type BSP_output_char = BSP_outch; |
84 | BSP_polling_getchar_function_type BSP_poll_char = BSP_inch; |
Note: See TracBrowser
for help on using the repository browser.