1 | /* |
---|
2 | * This file contains the libchip configuration information |
---|
3 | * to instantiate the libchip driver for the VGA console |
---|
4 | * and serial ports on a PC. |
---|
5 | */ |
---|
6 | |
---|
7 | /* |
---|
8 | * COPYRIGHT (c) 1989-2011. |
---|
9 | * On-Line Applications Research Corporation (OAR). |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * http://www.rtems.com/license/LICENSE. |
---|
14 | * |
---|
15 | * $Id$ |
---|
16 | */ |
---|
17 | |
---|
18 | #include <unistd.h> /* write */ |
---|
19 | |
---|
20 | #include <bsp.h> |
---|
21 | #include <libchip/serial.h> |
---|
22 | #include <libchip/ns16550.h> |
---|
23 | #include "vgacons.h" |
---|
24 | #include <bsp/irq.h> |
---|
25 | #include <rtems/pci.h> |
---|
26 | |
---|
27 | #define VGA_CONSOLE_FUNCTIONS &vgacons_fns |
---|
28 | #if 0 |
---|
29 | #define COM_CONSOLE_FUNCTIONS &ns16550_fns_polled |
---|
30 | #else |
---|
31 | #define COM_CONSOLE_FUNCTIONS &ns16550_fns |
---|
32 | #endif |
---|
33 | |
---|
34 | /* |
---|
35 | * Base IO for UART |
---|
36 | */ |
---|
37 | #define COM1_BASE_IO 0x3F8 |
---|
38 | #define COM2_BASE_IO 0x3E8 |
---|
39 | #define COM3_BASE_IO 0x2F8 |
---|
40 | #define COM4_BASE_IO 0x2E8 |
---|
41 | |
---|
42 | #define CLOCK_RATE (115200 * 16) |
---|
43 | |
---|
44 | uint8_t com_get_register(uint32_t addr,uint8_t i) |
---|
45 | { |
---|
46 | register uint8_t val; |
---|
47 | |
---|
48 | inport_byte( (addr + i),val ); |
---|
49 | return val; |
---|
50 | } |
---|
51 | |
---|
52 | void com_set_register(uint32_t addr,uint8_t i, uint8_t val) |
---|
53 | { |
---|
54 | outport_byte( (addr+i),val ); |
---|
55 | } |
---|
56 | |
---|
57 | console_tbl Console_Configuration_Ports[] = { |
---|
58 | { |
---|
59 | "/dev/vgacons", /* sDeviceName */ |
---|
60 | VGA_CONSOLE, /* deviceType */ |
---|
61 | VGA_CONSOLE_FUNCTIONS, /* pDeviceFns */ |
---|
62 | vgacons_probe, /* deviceProbe */ |
---|
63 | NULL, /* pDeviceFlow */ |
---|
64 | 16, /* ulMargin */ |
---|
65 | 8, /* ulHysteresis */ |
---|
66 | (void *) NULL, /* NULL */ /* pDeviceParams */ |
---|
67 | 0x00000000, /* ulCtrlPort1 */ |
---|
68 | 0x00000000, /* ulCtrlPort2 */ |
---|
69 | 0x00000000, /* ulDataPort */ |
---|
70 | NULL, /* getRegister */ |
---|
71 | NULL, /* setRegister */ |
---|
72 | NULL,/* unused */ /* getData */ |
---|
73 | NULL,/* unused */ /* setData */ |
---|
74 | 0X0, /* ulClock */ |
---|
75 | 0x0 /* ulIntVector -- base for port */ |
---|
76 | }, |
---|
77 | { |
---|
78 | "/dev/com1", /* sDeviceName */ |
---|
79 | SERIAL_NS16550, /* deviceType */ |
---|
80 | COM_CONSOLE_FUNCTIONS, /* pDeviceFns */ |
---|
81 | NULL, /* deviceProbe, assume it is there */ |
---|
82 | NULL, /* pDeviceFlow */ |
---|
83 | 16, /* ulMargin */ |
---|
84 | 8, /* ulHysteresis */ |
---|
85 | (void *) 9600, /* Baud Rate */ /* pDeviceParams */ |
---|
86 | COM1_BASE_IO, /* ulCtrlPort1 */ |
---|
87 | 0x00000000, /* ulCtrlPort2 */ |
---|
88 | COM1_BASE_IO, /* ulDataPort */ |
---|
89 | com_get_register, /* getRegister */ |
---|
90 | com_set_register, /* setRegister */ |
---|
91 | NULL,/* unused */ /* getData */ |
---|
92 | NULL,/* unused */ /* setData */ |
---|
93 | CLOCK_RATE, /* ulClock */ |
---|
94 | BSP_UART_COM1_IRQ /* ulIntVector -- base for port */ |
---|
95 | }, |
---|
96 | { |
---|
97 | "/dev/com2", /* sDeviceName */ |
---|
98 | SERIAL_NS16550, /* deviceType */ |
---|
99 | COM_CONSOLE_FUNCTIONS, /* pDeviceFns */ |
---|
100 | NULL, /* deviceProbe, assume it is there */ |
---|
101 | NULL, /* pDeviceFlow */ |
---|
102 | 16, /* ulMargin */ |
---|
103 | 8, /* ulHysteresis */ |
---|
104 | (void *) 9600, /* Baud Rate */ /* pDeviceParams */ |
---|
105 | COM2_BASE_IO, /* ulCtrlPort1 */ |
---|
106 | 0x00000000, /* ulCtrlPort2 */ |
---|
107 | COM2_BASE_IO, /* ulDataPort */ |
---|
108 | com_get_register, /* getRegister */ |
---|
109 | com_set_register, /* setRegister */ |
---|
110 | NULL,/* unused */ /* getData */ |
---|
111 | NULL,/* unused */ /* setData */ |
---|
112 | CLOCK_RATE, /* ulClock */ |
---|
113 | BSP_UART_COM2_IRQ /* ulIntVector -- base for port */ |
---|
114 | }, |
---|
115 | |
---|
116 | { |
---|
117 | "/dev/com3", /* sDeviceName */ |
---|
118 | SERIAL_NS16550, /* deviceType */ |
---|
119 | COM_CONSOLE_FUNCTIONS, /* pDeviceFns */ |
---|
120 | NULL, /* deviceProbe, assume it is there */ |
---|
121 | NULL, /* pDeviceFlow */ |
---|
122 | 16, /* ulMargin */ |
---|
123 | 8, /* ulHysteresis */ |
---|
124 | (void *) 9600, /* Baud Rate */ /* pDeviceParams */ |
---|
125 | COM3_BASE_IO, /* ulCtrlPort1 */ |
---|
126 | 0x00000000, /* ulCtrlPort2 */ |
---|
127 | COM3_BASE_IO, /* ulDataPort */ |
---|
128 | com_get_register, /* getRegister */ |
---|
129 | com_set_register, /* setRegister */ |
---|
130 | NULL,/* unused */ /* getData */ |
---|
131 | NULL,/* unused */ /* setData */ |
---|
132 | CLOCK_RATE, /* ulClock */ |
---|
133 | BSP_UART_COM3_IRQ /* ulIntVector -- base for port */ |
---|
134 | }, |
---|
135 | |
---|
136 | { |
---|
137 | "/dev/com4", /* sDeviceName */ |
---|
138 | SERIAL_NS16550, /* deviceType */ |
---|
139 | COM_CONSOLE_FUNCTIONS, /* pDeviceFns */ |
---|
140 | NULL, /* deviceProbe, assume it is there */ |
---|
141 | NULL, /* pDeviceFlow */ |
---|
142 | 16, /* ulMargin */ |
---|
143 | 8, /* ulHysteresis */ |
---|
144 | (void *) 9600, /* Baud Rate */ /* pDeviceParams */ |
---|
145 | COM4_BASE_IO, /* ulCtrlPort1 */ |
---|
146 | 0x00000000, /* ulCtrlPort2 */ |
---|
147 | COM4_BASE_IO, /* ulDataPort */ |
---|
148 | com_get_register, /* getRegister */ |
---|
149 | com_set_register, /* setRegister */ |
---|
150 | NULL,/* unused */ /* getData */ |
---|
151 | NULL,/* unused */ /* setData */ |
---|
152 | CLOCK_RATE, /* ulClock */ |
---|
153 | BSP_UART_COM4_IRQ /* ulIntVector -- base for port */ |
---|
154 | }, |
---|
155 | |
---|
156 | }; |
---|
157 | |
---|
158 | /* |
---|
159 | * Define a variable that contains the number of statically configured |
---|
160 | * console devices. |
---|
161 | */ |
---|
162 | unsigned long Console_Configuration_Count = \ |
---|
163 | (sizeof(Console_Configuration_Ports)/sizeof(console_tbl)); |
---|