5
Last change
on this file since d7d66d7 was
d7d66d7,
checked in by Sebastian Huber <sebastian.huber@…>, on 04/19/18 at 04:28:01
|
bsps: Move console drivers to bsps
This patch is a part of the BSP source reorganization.
Update #3285.
|
-
Property mode set to
100644
|
File size:
1.7 KB
|
Line | |
---|
1 | /* |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup Console |
---|
5 | * |
---|
6 | * @brief printk support routines |
---|
7 | * |
---|
8 | * This file contains the required printk support. |
---|
9 | */ |
---|
10 | |
---|
11 | /* |
---|
12 | * COPYRIGHT (c) 1989-2012. |
---|
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 |
---|
17 | * http://www.rtems.org/license/LICENSE. |
---|
18 | */ |
---|
19 | |
---|
20 | #include <rtems.h> |
---|
21 | #include <rtems/bspIo.h> |
---|
22 | #if BSP_ENABLE_VGA |
---|
23 | #include <rtems/keyboard.h> |
---|
24 | #endif |
---|
25 | #include <bsp.h> |
---|
26 | #include <libchip/serial.h> |
---|
27 | #include <libchip/ns16550.h> |
---|
28 | #include "../../shared/dev/serial/legacy-console.h" |
---|
29 | |
---|
30 | rtems_device_minor_number BSPPrintkPort = 0; |
---|
31 | |
---|
32 | void BSP_outch(char ch); |
---|
33 | int BSP_inch(void); |
---|
34 | |
---|
35 | void BSP_outch(char ch) |
---|
36 | { |
---|
37 | #if BSP_ENABLE_VGA |
---|
38 | bool isVga = BSPPrintkPort == BSP_CONSOLE_VGA; |
---|
39 | #else |
---|
40 | bool isVga = false; |
---|
41 | #endif |
---|
42 | |
---|
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 |
---|
54 | } |
---|
55 | |
---|
56 | int BSP_inch(void) |
---|
57 | { |
---|
58 | #if BSP_ENABLE_VGA |
---|
59 | bool isVga = BSPPrintkPort == BSP_CONSOLE_VGA; |
---|
60 | #else |
---|
61 | bool isVga = false; |
---|
62 | #endif |
---|
63 | |
---|
64 | int result = -1; |
---|
65 | |
---|
66 | if ( !isVga ) { |
---|
67 | console_tbl *port = Console_Port_Tbl[BSPPrintkPort]; |
---|
68 | if (port->pDeviceFns && port->pDeviceFns->deviceRead) { |
---|
69 | do { |
---|
70 | result = port->pDeviceFns->deviceRead( BSPPrintkPort ); |
---|
71 | } while (result == -1); |
---|
72 | return result; |
---|
73 | } |
---|
74 | } |
---|
75 | |
---|
76 | #if BSP_ENABLE_VGA |
---|
77 | result = BSP_wait_polled_input(); |
---|
78 | #endif |
---|
79 | |
---|
80 | return result; |
---|
81 | } |
---|
82 | |
---|
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.