1 | Index: c/src/lib/libbsp/i386/pc386/Makefile.am
|
---|
2 | ===================================================================
|
---|
3 | RCS file: /usr1/CVS/rtems/c/src/lib/libbsp/i386/pc386/Makefile.am,v
|
---|
4 | retrieving revision 1.61
|
---|
5 | diff -u -r1.61 Makefile.am
|
---|
6 | --- c/src/lib/libbsp/i386/pc386/Makefile.am 1 Aug 2011 13:41:37 -0000 1.61
|
---|
7 | +++ c/src/lib/libbsp/i386/pc386/Makefile.am 2 Nov 2011 13:36:47 -0000
|
---|
8 | @@ -68,16 +68,21 @@
|
---|
9 | libbsp_a_SOURCES += ../../shared/clockdrv_shell.h
|
---|
10 |
|
---|
11 | include_rtemsdir = $(includedir)/rtems
|
---|
12 | -include_rtems_HEADERS = console/keyboard.h console/kd.h console/ps2_drv.h
|
---|
13 | +include_rtems_HEADERS = console/keyboard.h console/kd.h console/ps2_drv.h \
|
---|
14 | + ../../shared/console_private.h console/vgacons.h
|
---|
15 |
|
---|
16 | include_HEADERS += ../../i386/shared/comm/i386_io.h
|
---|
17 | # console
|
---|
18 | -libbsp_a_SOURCES += console/console.c console/inch.c console/outch.c \
|
---|
19 | +libbsp_a_SOURCES += console/inch.c console/outch.c \
|
---|
20 | console/defkeymap.c console/fb_vga.c console/keyboard.c \
|
---|
21 | console/pc_keyb.c console/ps2_mouse.c \
|
---|
22 | console/vgainit.c console/vt.c console/videoAsm.S \
|
---|
23 | console/kbd_parser.c console/serial_mouse_config.c \
|
---|
24 | - ../../i386/shared/comm/uart.c ../../i386/shared/comm/tty_drv.c
|
---|
25 | + ../../i386/shared/comm/uart.c ../../i386/shared/comm/tty_drv.c \
|
---|
26 | + ../../shared/console.c ../../shared/console_select.c \
|
---|
27 | + ../../shared/console_read.c ../../shared/console_write.c \
|
---|
28 | + console/console_control.c console/conscfg.c console/printk_support.c \
|
---|
29 | + console/vgacons.c
|
---|
30 |
|
---|
31 | # gdb
|
---|
32 | libbsp_a_SOURCES += ../../i386/shared/comm/i386-stub.c \
|
---|
33 | Index: c/src/lib/libbsp/i386/pc386/preinstall.am
|
---|
34 | ===================================================================
|
---|
35 | RCS file: /usr1/CVS/rtems/c/src/lib/libbsp/i386/pc386/preinstall.am,v
|
---|
36 | retrieving revision 1.11
|
---|
37 | diff -u -r1.11 preinstall.am
|
---|
38 | --- c/src/lib/libbsp/i386/pc386/preinstall.am 1 Aug 2011 13:41:37 -0000 1.11
|
---|
39 | +++ c/src/lib/libbsp/i386/pc386/preinstall.am 2 Nov 2011 13:36:47 -0000
|
---|
40 | @@ -119,6 +119,14 @@
|
---|
41 | $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/ps2_drv.h
|
---|
42 | PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/ps2_drv.h
|
---|
43 |
|
---|
44 | +$(PROJECT_INCLUDE)/rtems/console_private.h: ../../shared/console_private.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
|
---|
45 | + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/console_private.h
|
---|
46 | +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/console_private.h
|
---|
47 | +
|
---|
48 | +$(PROJECT_INCLUDE)/rtems/vgacons.h: console/vgacons.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
|
---|
49 | + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/vgacons.h
|
---|
50 | +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/vgacons.h
|
---|
51 | +
|
---|
52 | $(PROJECT_INCLUDE)/i386_io.h: ../../i386/shared/comm/i386_io.h $(PROJECT_INCLUDE)/$(dirstamp)
|
---|
53 | $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/i386_io.h
|
---|
54 | PREINSTALL_FILES += $(PROJECT_INCLUDE)/i386_io.h
|
---|
55 | Index: c/src/lib/libbsp/i386/pc386/console/conscfg.c
|
---|
56 | ===================================================================
|
---|
57 | RCS file: c/src/lib/libbsp/i386/pc386/console/conscfg.c
|
---|
58 | diff -N c/src/lib/libbsp/i386/pc386/console/conscfg.c
|
---|
59 | --- /dev/null 1 Jan 1970 00:00:00 -0000
|
---|
60 | +++ c/src/lib/libbsp/i386/pc386/console/conscfg.c 2 Nov 2011 13:36:47 -0000
|
---|
61 | @@ -0,0 +1,163 @@
|
---|
62 | +/*
|
---|
63 | + * This file contains the libchip configuration information
|
---|
64 | + * to instantiate the libchip driver for the VGA console
|
---|
65 | + * and serial ports on a PC.
|
---|
66 | + */
|
---|
67 | +
|
---|
68 | +/*
|
---|
69 | + * COPYRIGHT (c) 1989-2011.
|
---|
70 | + * On-Line Applications Research Corporation (OAR).
|
---|
71 | + *
|
---|
72 | + * The license and distribution terms for this file may be
|
---|
73 | + * found in the file LICENSE in this distribution or at
|
---|
74 | + * http://www.rtems.com/license/LICENSE.
|
---|
75 | + *
|
---|
76 | + * $Id: conscfg.c,v 1.15 2011/08/11 21:52:51 joel Exp $
|
---|
77 | + */
|
---|
78 | +
|
---|
79 | +#include <unistd.h> /* write */
|
---|
80 | +
|
---|
81 | +#include <bsp.h>
|
---|
82 | +#include <libchip/serial.h>
|
---|
83 | +#include <libchip/ns16550.h>
|
---|
84 | +#include "vgacons.h"
|
---|
85 | +#include <bsp/irq.h>
|
---|
86 | +#include <rtems/pci.h>
|
---|
87 | +
|
---|
88 | +#define VGA_CONSOLE_FUNCTIONS &vgacons_fns
|
---|
89 | +#if 0
|
---|
90 | +#define COM_CONSOLE_FUNCTIONS &ns16550_fns_polled
|
---|
91 | +#else
|
---|
92 | +#define COM_CONSOLE_FUNCTIONS &ns16550_fns
|
---|
93 | +#endif
|
---|
94 | +
|
---|
95 | +/*
|
---|
96 | + * Base IO for UART
|
---|
97 | + */
|
---|
98 | +#define COM1_BASE_IO 0x3F8
|
---|
99 | +#define COM2_BASE_IO 0x3E8
|
---|
100 | +#define COM3_BASE_IO 0x2F8
|
---|
101 | +#define COM4_BASE_IO 0x2E8
|
---|
102 | +
|
---|
103 | +#define CLOCK_RATE (115200 * 16)
|
---|
104 | +
|
---|
105 | +uint8_t com_get_register(uint32_t addr,uint8_t i)
|
---|
106 | +{
|
---|
107 | + register uint8_t val;
|
---|
108 | +
|
---|
109 | + inport_byte( (addr + i),val );
|
---|
110 | + return val;
|
---|
111 | +}
|
---|
112 | +
|
---|
113 | +void com_set_register(uint32_t addr,uint8_t i, uint8_t val)
|
---|
114 | +{
|
---|
115 | + outport_byte( (addr+i),val );
|
---|
116 | +}
|
---|
117 | +
|
---|
118 | +console_tbl Console_Configuration_Ports[] = {
|
---|
119 | + {
|
---|
120 | + "/dev/vgacons", /* sDeviceName */
|
---|
121 | + VGA_CONSOLE, /* deviceType */
|
---|
122 | + VGA_CONSOLE_FUNCTIONS, /* pDeviceFns */
|
---|
123 | + vgacons_probe, /* deviceProbe */
|
---|
124 | + NULL, /* pDeviceFlow */
|
---|
125 | + 16, /* ulMargin */
|
---|
126 | + 8, /* ulHysteresis */
|
---|
127 | + (void *) NULL, /* NULL */ /* pDeviceParams */
|
---|
128 | + 0x00000000, /* ulCtrlPort1 */
|
---|
129 | + 0x00000000, /* ulCtrlPort2 */
|
---|
130 | + 0x00000000, /* ulDataPort */
|
---|
131 | + NULL, /* getRegister */
|
---|
132 | + NULL, /* setRegister */
|
---|
133 | + NULL,/* unused */ /* getData */
|
---|
134 | + NULL,/* unused */ /* setData */
|
---|
135 | + 0X0, /* ulClock */
|
---|
136 | + 0x0 /* ulIntVector -- base for port */
|
---|
137 | + },
|
---|
138 | + {
|
---|
139 | + "/dev/com1", /* sDeviceName */
|
---|
140 | + SERIAL_NS16550, /* deviceType */
|
---|
141 | + COM_CONSOLE_FUNCTIONS, /* pDeviceFns */
|
---|
142 | + NULL, /* deviceProbe, assume it is there */
|
---|
143 | + NULL, /* pDeviceFlow */
|
---|
144 | + 16, /* ulMargin */
|
---|
145 | + 8, /* ulHysteresis */
|
---|
146 | + (void *) 9600, /* Baud Rate */ /* pDeviceParams */
|
---|
147 | + COM1_BASE_IO, /* ulCtrlPort1 */
|
---|
148 | + 0x00000000, /* ulCtrlPort2 */
|
---|
149 | + COM1_BASE_IO, /* ulDataPort */
|
---|
150 | + com_get_register, /* getRegister */
|
---|
151 | + com_set_register, /* setRegister */
|
---|
152 | + NULL,/* unused */ /* getData */
|
---|
153 | + NULL,/* unused */ /* setData */
|
---|
154 | + CLOCK_RATE, /* ulClock */
|
---|
155 | + BSP_UART_COM1_IRQ /* ulIntVector -- base for port */
|
---|
156 | + },
|
---|
157 | + {
|
---|
158 | + "/dev/com2", /* sDeviceName */
|
---|
159 | + SERIAL_NS16550, /* deviceType */
|
---|
160 | + COM_CONSOLE_FUNCTIONS, /* pDeviceFns */
|
---|
161 | + NULL, /* deviceProbe, assume it is there */
|
---|
162 | + NULL, /* pDeviceFlow */
|
---|
163 | + 16, /* ulMargin */
|
---|
164 | + 8, /* ulHysteresis */
|
---|
165 | + (void *) 9600, /* Baud Rate */ /* pDeviceParams */
|
---|
166 | + COM2_BASE_IO, /* ulCtrlPort1 */
|
---|
167 | + 0x00000000, /* ulCtrlPort2 */
|
---|
168 | + COM2_BASE_IO, /* ulDataPort */
|
---|
169 | + com_get_register, /* getRegister */
|
---|
170 | + com_set_register, /* setRegister */
|
---|
171 | + NULL,/* unused */ /* getData */
|
---|
172 | + NULL,/* unused */ /* setData */
|
---|
173 | + CLOCK_RATE, /* ulClock */
|
---|
174 | + BSP_UART_COM2_IRQ /* ulIntVector -- base for port */
|
---|
175 | + },
|
---|
176 | +
|
---|
177 | + {
|
---|
178 | + "/dev/com3", /* sDeviceName */
|
---|
179 | + SERIAL_NS16550, /* deviceType */
|
---|
180 | + COM_CONSOLE_FUNCTIONS, /* pDeviceFns */
|
---|
181 | + NULL, /* deviceProbe, assume it is there */
|
---|
182 | + NULL, /* pDeviceFlow */
|
---|
183 | + 16, /* ulMargin */
|
---|
184 | + 8, /* ulHysteresis */
|
---|
185 | + (void *) 9600, /* Baud Rate */ /* pDeviceParams */
|
---|
186 | + COM3_BASE_IO, /* ulCtrlPort1 */
|
---|
187 | + 0x00000000, /* ulCtrlPort2 */
|
---|
188 | + COM3_BASE_IO, /* ulDataPort */
|
---|
189 | + com_get_register, /* getRegister */
|
---|
190 | + com_set_register, /* setRegister */
|
---|
191 | + NULL,/* unused */ /* getData */
|
---|
192 | + NULL,/* unused */ /* setData */
|
---|
193 | + CLOCK_RATE, /* ulClock */
|
---|
194 | + BSP_UART_COM3_IRQ /* ulIntVector -- base for port */
|
---|
195 | + },
|
---|
196 | +
|
---|
197 | + {
|
---|
198 | + "/dev/com4", /* sDeviceName */
|
---|
199 | + SERIAL_NS16550, /* deviceType */
|
---|
200 | + COM_CONSOLE_FUNCTIONS, /* pDeviceFns */
|
---|
201 | + NULL, /* deviceProbe, assume it is there */
|
---|
202 | + NULL, /* pDeviceFlow */
|
---|
203 | + 16, /* ulMargin */
|
---|
204 | + 8, /* ulHysteresis */
|
---|
205 | + (void *) 9600, /* Baud Rate */ /* pDeviceParams */
|
---|
206 | + COM4_BASE_IO, /* ulCtrlPort1 */
|
---|
207 | + 0x00000000, /* ulCtrlPort2 */
|
---|
208 | + COM4_BASE_IO, /* ulDataPort */
|
---|
209 | + com_get_register, /* getRegister */
|
---|
210 | + com_set_register, /* setRegister */
|
---|
211 | + NULL,/* unused */ /* getData */
|
---|
212 | + NULL,/* unused */ /* setData */
|
---|
213 | + CLOCK_RATE, /* ulClock */
|
---|
214 | + BSP_UART_COM4_IRQ /* ulIntVector -- base for port */
|
---|
215 | + },
|
---|
216 | +
|
---|
217 | +};
|
---|
218 | +
|
---|
219 | +/*
|
---|
220 | + * Define a variable that contains the number of statically configured
|
---|
221 | + * console devices.
|
---|
222 | + */
|
---|
223 | +unsigned long Console_Configuration_Count = \
|
---|
224 | + (sizeof(Console_Configuration_Ports)/sizeof(console_tbl));
|
---|
225 | Index: c/src/lib/libbsp/i386/pc386/console/console_control.c
|
---|
226 | ===================================================================
|
---|
227 | RCS file: c/src/lib/libbsp/i386/pc386/console/console_control.c
|
---|
228 | diff -N c/src/lib/libbsp/i386/pc386/console/console_control.c
|
---|
229 | --- /dev/null 1 Jan 1970 00:00:00 -0000
|
---|
230 | +++ c/src/lib/libbsp/i386/pc386/console/console_control.c 2 Nov 2011 13:36:47 -0000
|
---|
231 | @@ -0,0 +1,65 @@
|
---|
232 | +/*
|
---|
233 | + * This file is an extension of the generic console driver
|
---|
234 | + * shell used by all console drivers using libchip, it contains
|
---|
235 | + * the console_control routine, This bsp needs its own version
|
---|
236 | + * of this method to handle the keyboard and mouse as a single
|
---|
237 | + * device.
|
---|
238 | + */
|
---|
239 | +
|
---|
240 | +/*
|
---|
241 | + * COPYRIGHT (c) 1989-2011.
|
---|
242 | + * On-Line Applications Research Corporation (OAR).
|
---|
243 | + *
|
---|
244 | + * The license and distribution terms for this file may be
|
---|
245 | + * found in the file LICENSE in this distribution or at
|
---|
246 | + * http://www.rtems.com/license/LICENSE.
|
---|
247 | + *
|
---|
248 | + * $Id$
|
---|
249 | + */
|
---|
250 | +
|
---|
251 | +#include <bsp.h>
|
---|
252 | +#include <rtems/libio.h>
|
---|
253 | +#include <stdlib.h>
|
---|
254 | +#include <assert.h>
|
---|
255 | +#include <termios.h>
|
---|
256 | +
|
---|
257 | +#include <bsp/irq.h>
|
---|
258 | +
|
---|
259 | +#include <rtems/termiostypes.h>
|
---|
260 | +#include <libchip/serial.h>
|
---|
261 | +#include <rtems/mouse_parser.h>
|
---|
262 | +#include "keyboard.h"
|
---|
263 | +#include "../../../shared/console_private.h"
|
---|
264 | +
|
---|
265 | +/*
|
---|
266 | + * console_control
|
---|
267 | + *
|
---|
268 | + * this routine uses the termios driver to process io
|
---|
269 | + */
|
---|
270 | +rtems_device_driver console_control(
|
---|
271 | + rtems_device_major_number major,
|
---|
272 | + rtems_device_minor_number minor,
|
---|
273 | + void * arg
|
---|
274 | +)
|
---|
275 | +{
|
---|
276 | + rtems_libio_ioctl_args_t *args = arg;
|
---|
277 | +
|
---|
278 | + switch (args->command) {
|
---|
279 | + default:
|
---|
280 | + if( vt_ioctl( args->command, (unsigned long)args->buffer ) != 0 )
|
---|
281 | + return rtems_termios_ioctl (arg);
|
---|
282 | + break;
|
---|
283 | +
|
---|
284 | + case MW_UID_REGISTER_DEVICE:
|
---|
285 | + printk( "SerialMouse: reg=%s\n", args->buffer );
|
---|
286 | + register_kbd_msg_queue( args->buffer, 0 );
|
---|
287 | + break;
|
---|
288 | +
|
---|
289 | + case MW_UID_UNREGISTER_DEVICE:
|
---|
290 | + unregister_kbd_msg_queue( 0 );
|
---|
291 | + break;
|
---|
292 | + }
|
---|
293 | +
|
---|
294 | + args->ioctl_return = 0;
|
---|
295 | + return RTEMS_SUCCESSFUL;
|
---|
296 | +}
|
---|
297 | Index: c/src/lib/libbsp/i386/pc386/console/printk_support.c
|
---|
298 | ===================================================================
|
---|
299 | RCS file: c/src/lib/libbsp/i386/pc386/console/printk_support.c
|
---|
300 | diff -N c/src/lib/libbsp/i386/pc386/console/printk_support.c
|
---|
301 | --- /dev/null 1 Jan 1970 00:00:00 -0000
|
---|
302 | +++ c/src/lib/libbsp/i386/pc386/console/printk_support.c 2 Nov 2011 13:36:47 -0000
|
---|
303 | @@ -0,0 +1,57 @@
|
---|
304 | +/*
|
---|
305 | + * This file contains a stub for the required printk support.
|
---|
306 | + * It is NOT functional!!!
|
---|
307 | + *
|
---|
308 | + * This driver uses the termios pseudo driver.
|
---|
309 | + */
|
---|
310 | +
|
---|
311 | +/*
|
---|
312 | + * COPYRIGHT (c) 1989-2007.
|
---|
313 | + * On-Line Applications Research Corporation (OAR).
|
---|
314 | + *
|
---|
315 | + * The license and distribution terms for this file may be
|
---|
316 | + * found in the file LICENSE in this distribution or at
|
---|
317 | + * http://www.rtems.com/license/LICENSE.
|
---|
318 | + *
|
---|
319 | + * $Id: printk_support.c,v 1.2 2011/08/11 15:19:38 joel Exp $
|
---|
320 | + */
|
---|
321 | +
|
---|
322 | +#include <rtems.h>
|
---|
323 | +#include <rtems/bspIo.h>
|
---|
324 | +#include <rtems/keyboard.h>
|
---|
325 | +#include <bsp.h>
|
---|
326 | +#include <libchip/serial.h>
|
---|
327 | +#include <libchip/ns16550.h>
|
---|
328 | +
|
---|
329 | +BSP_output_char_function_type BSP_output_char = _IBMPC_outch;
|
---|
330 | +BSP_polling_getchar_function_type BSP_poll_char = BSP_wait_polled_input;
|
---|
331 | +
|
---|
332 | +rtems_device_minor_number BSPPrintkPort = 0;
|
---|
333 | +
|
---|
334 | +int ns16550_inbyte_nonblocking_polled(
|
---|
335 | + int minor
|
---|
336 | +);
|
---|
337 | +
|
---|
338 | +void BSP_com_outch(char ch)
|
---|
339 | +{
|
---|
340 | + console_tbl *cptr;
|
---|
341 | +
|
---|
342 | + cptr = &Console_Configuration_Ports[BSPPrintkPort];
|
---|
343 | +
|
---|
344 | + return cptr->pDeviceFns->deviceWritePolled( BSPPrintkPort, ch );
|
---|
345 | +}
|
---|
346 | +
|
---|
347 | +int BSP_com_inch( void )
|
---|
348 | +{
|
---|
349 | + int result;
|
---|
350 | + console_tbl *cptr;
|
---|
351 | +
|
---|
352 | + cptr = &Console_Configuration_Ports[BSPPrintkPort];
|
---|
353 | +
|
---|
354 | + do {
|
---|
355 | + result = ns16550_inbyte_nonblocking_polled( BSPPrintkPort );
|
---|
356 | + } while (result == -1);
|
---|
357 | +
|
---|
358 | + return result;
|
---|
359 | +}
|
---|
360 | +
|
---|
361 | Index: c/src/lib/libbsp/i386/pc386/console/serial_mouse_config.c
|
---|
362 | ===================================================================
|
---|
363 | RCS file: /usr1/CVS/rtems/c/src/lib/libbsp/i386/pc386/console/serial_mouse_config.c,v
|
---|
364 | retrieving revision 1.1
|
---|
365 | diff -u -r1.1 serial_mouse_config.c
|
---|
366 | --- c/src/lib/libbsp/i386/pc386/console/serial_mouse_config.c 14 Mar 2011 14:57:00 -0000 1.1
|
---|
367 | +++ c/src/lib/libbsp/i386/pc386/console/serial_mouse_config.c 2 Nov 2011 13:36:47 -0000
|
---|
368 | @@ -1,12 +1,12 @@
|
---|
369 | /*
|
---|
370 | - * COPYRIGHT (c) 1989-2007.
|
---|
371 | + * COPYRIGHT (c) 1989-2011.
|
---|
372 | * On-Line Applications Research Corporation (OAR).
|
---|
373 | *
|
---|
374 | * The license and distribution terms for this file may be
|
---|
375 | * found in the file LICENSE in this distribution or at
|
---|
376 | * http://www.rtems.com/license/LICENSE.
|
---|
377 | *
|
---|
378 | - * $Id: serial_mouse_config.c,v 1.1 2011/03/14 14:57:00 joel Exp $
|
---|
379 | + * $Id: serial_mouse_config.c,v 1.3 2011/08/11 15:19:38 joel Exp $
|
---|
380 | */
|
---|
381 |
|
---|
382 | #include <stdio.h>
|
---|
383 | @@ -16,35 +16,31 @@
|
---|
384 | #include <sys/stat.h>
|
---|
385 | #include <fcntl.h>
|
---|
386 |
|
---|
387 | +#include "libchip/serial.h"
|
---|
388 | +#include "../../../shared/console_private.h"
|
---|
389 | +
|
---|
390 | /* select which serial port the mouse is connected to */
|
---|
391 | -/* XXX - Hook these somewhere */
|
---|
392 | -#ifdef SERIAL_MOUSE_COM1
|
---|
393 | - #define SERIAL_MOUSE_COM 1
|
---|
394 | -#elif defined(SERIAL_MOUSE_COM2)
|
---|
395 | - #define SERIAL_MOUSE_COM 2
|
---|
396 | +#if defined(SERIAL_MOUSE_COM2)
|
---|
397 | + #define MOUSE_DEVICE "/dev/com2"
|
---|
398 | #else
|
---|
399 | - /* Select Default to be COM1 */
|
---|
400 | - #define SERIAL_MOUSE_COM 1
|
---|
401 | + #define MOUSE_DEVICE "/dev/com1"
|
---|
402 | #endif
|
---|
403 |
|
---|
404 | -extern int BSPConsolePort;
|
---|
405 | +static const char *SerialMouseDevice = MOUSE_DEVICE;
|
---|
406 |
|
---|
407 | bool bsp_get_serial_mouse_device(
|
---|
408 | const char **name,
|
---|
409 | const char **type
|
---|
410 | )
|
---|
411 | {
|
---|
412 | - #ifdef SERIAL_MOUSE_COM2
|
---|
413 | - *name = "/dev/ttyS2";
|
---|
414 | - #else
|
---|
415 | - *name = "/dev/ttyS1";
|
---|
416 | - #endif
|
---|
417 | -
|
---|
418 | + const char *consname;
|
---|
419 | +
|
---|
420 | + *name = SerialMouseDevice;
|
---|
421 | *type = "ms";
|
---|
422 |
|
---|
423 | /* Check if this port is not been used as console */
|
---|
424 | - /* XXX configure the serial port, take boot args additionally */
|
---|
425 | - if ( BSPConsolePort == SERIAL_MOUSE_COM ) {
|
---|
426 | + consname = Console_Port_Tbl[ Console_Port_Minor ]->sDeviceName;
|
---|
427 | + if ( !strcmp(MOUSE_DEVICE, consname) ) {
|
---|
428 | printk( "SERIAL MOUSE: port selected as console.(%s)\n", *name );
|
---|
429 | rtems_fatal_error_occurred( -1 );
|
---|
430 | }
|
---|
431 | Index: c/src/lib/libbsp/i386/pc386/console/vgacons.c
|
---|
432 | ===================================================================
|
---|
433 | RCS file: c/src/lib/libbsp/i386/pc386/console/vgacons.c
|
---|
434 | diff -N c/src/lib/libbsp/i386/pc386/console/vgacons.c
|
---|
435 | --- /dev/null 1 Jan 1970 00:00:00 -0000
|
---|
436 | +++ c/src/lib/libbsp/i386/pc386/console/vgacons.c 2 Nov 2011 13:36:47 -0000
|
---|
437 | @@ -0,0 +1,200 @@
|
---|
438 | +/*
|
---|
439 | + * This file contains the termios TTY driver for the i386
|
---|
440 | + * vga.
|
---|
441 | + *
|
---|
442 | + * COPYRIGHT (c) 1989-2011.
|
---|
443 | + * On-Line Applications Research Corporation (OAR).
|
---|
444 | + *
|
---|
445 | + * The license and distribution terms for this file may be
|
---|
446 | + * found in the file LICENSE in this distribution or at
|
---|
447 | + * http://www.rtems.com/license/LICENSE.
|
---|
448 | + *
|
---|
449 | + * $Id: vgacons.c,v 1.1 2011/08/05 15:40:18 joel Exp $
|
---|
450 | + */
|
---|
451 | +
|
---|
452 | +#include <rtems.h>
|
---|
453 | +#include <rtems/libio.h>
|
---|
454 | +#include <stdlib.h>
|
---|
455 | +#include <libchip/serial.h>
|
---|
456 | +#include <rtems/vgacons.h>
|
---|
457 | +#include <rtems/keyboard.h>
|
---|
458 | +#include <libchip/sersupp.h>
|
---|
459 | +#include <bsp/irq.h>
|
---|
460 | +#include <bsp.h>
|
---|
461 | +#include <crt.h>
|
---|
462 | +
|
---|
463 | +static int isr_is_on(const rtems_irq_connect_data *irq)
|
---|
464 | +{
|
---|
465 | + return BSP_irq_enabled_at_i8259s(irq->name);
|
---|
466 | +}
|
---|
467 | +
|
---|
468 | +static rtems_irq_connect_data keyboard_isr_data = {
|
---|
469 | + BSP_KEYBOARD,
|
---|
470 | + keyboard_interrupt,
|
---|
471 | + 0,
|
---|
472 | + NULL,
|
---|
473 | + NULL,
|
---|
474 | + isr_is_on
|
---|
475 | +};
|
---|
476 | +
|
---|
477 | +/*
|
---|
478 | + * vgacons_init
|
---|
479 | + *
|
---|
480 | + * This function initializes the VGA console to a quiecsent state.
|
---|
481 | + */
|
---|
482 | +VGACONS_STATIC void vgacons_init(int minor)
|
---|
483 | +{
|
---|
484 | + /*
|
---|
485 | + * Note: We do not initialize the KBD interface here since
|
---|
486 | + * it was initialized regardless of whether the
|
---|
487 | + * vga is available or not. Therefore it is initialized
|
---|
488 | + * in bsp_start.
|
---|
489 | + */
|
---|
490 | +}
|
---|
491 | +
|
---|
492 | +/*
|
---|
493 | + * vgacons_open
|
---|
494 | + *
|
---|
495 | + * This function opens a port for communication.
|
---|
496 | + *
|
---|
497 | + * Default state is 9600 baud, 8 bits, No parity, and 1 stop bit.
|
---|
498 | + */
|
---|
499 | +VGACONS_STATIC int vgacons_open(
|
---|
500 | + int major,
|
---|
501 | + int minor,
|
---|
502 | + void *arg
|
---|
503 | +)
|
---|
504 | +{
|
---|
505 | + return RTEMS_SUCCESSFUL;
|
---|
506 | +}
|
---|
507 | +
|
---|
508 | +/*
|
---|
509 | + * vgacons_close
|
---|
510 | + *
|
---|
511 | + * This function shuts down the requested port.
|
---|
512 | + */
|
---|
513 | +VGACONS_STATIC int vgacons_close(
|
---|
514 | + int major,
|
---|
515 | + int minor,
|
---|
516 | + void *arg
|
---|
517 | +)
|
---|
518 | +{
|
---|
519 | + return(RTEMS_SUCCESSFUL);
|
---|
520 | +}
|
---|
521 | +
|
---|
522 | +/*
|
---|
523 | + * vgacons_write_polled
|
---|
524 | + *
|
---|
525 | + * This routine polls out the requested character.
|
---|
526 | + */
|
---|
527 | +VGACONS_STATIC void vgacons_write_polled(
|
---|
528 | + int minor,
|
---|
529 | + char c
|
---|
530 | +)
|
---|
531 | +{
|
---|
532 | + _IBMPC_outch( c );
|
---|
533 | + if( c == '\n')
|
---|
534 | + _IBMPC_outch( '\r' ); /* LF = LF + CR */
|
---|
535 | +}
|
---|
536 | +
|
---|
537 | +/*
|
---|
538 | + * vgacons_write_support_polled
|
---|
539 | + *
|
---|
540 | + * Console Termios output entry point when using polled output.
|
---|
541 | + *
|
---|
542 | + */
|
---|
543 | +VGACONS_STATIC ssize_t vgacons_write_support_polled(
|
---|
544 | + int minor,
|
---|
545 | + const char *buf,
|
---|
546 | + size_t len
|
---|
547 | +)
|
---|
548 | +{
|
---|
549 | + int nwrite = 0;
|
---|
550 | +
|
---|
551 | + /*
|
---|
552 | + * poll each byte in the string out of the port.
|
---|
553 | + */
|
---|
554 | + while (nwrite < len) {
|
---|
555 | + vgacons_write_polled(minor, *buf++);
|
---|
556 | + nwrite++;
|
---|
557 | + }
|
---|
558 | +
|
---|
559 | + /*
|
---|
560 | + * return the number of bytes written.
|
---|
561 | + */
|
---|
562 | + return nwrite;
|
---|
563 | +}
|
---|
564 | +
|
---|
565 | +/*
|
---|
566 | + * vgacons_inbyte_nonblocking_polled
|
---|
567 | + *
|
---|
568 | + * Console Termios polling input entry point.
|
---|
569 | + */
|
---|
570 | +VGACONS_STATIC int vgacons_inbyte_nonblocking_polled(
|
---|
571 | + int minor
|
---|
572 | +)
|
---|
573 | +{
|
---|
574 | + if( rtems_kbpoll() ) {
|
---|
575 | + int c = getch();
|
---|
576 | + return c;
|
---|
577 | + }
|
---|
578 | +
|
---|
579 | + return -1;
|
---|
580 | +}
|
---|
581 | +
|
---|
582 | +/*
|
---|
583 | + * vgacons_set_attributes
|
---|
584 | + *
|
---|
585 | + * This function sets the UART channel to reflect the requested termios
|
---|
586 | + * port settings.
|
---|
587 | + */
|
---|
588 | +VGACONS_STATIC int vgacons_set_attributes(
|
---|
589 | + int minor,
|
---|
590 | + const struct termios *t
|
---|
591 | +)
|
---|
592 | +{
|
---|
593 | + return 0;
|
---|
594 | +}
|
---|
595 | +
|
---|
596 | +bool vgacons_probe(
|
---|
597 | + int minor
|
---|
598 | +)
|
---|
599 | +{
|
---|
600 | + int status;
|
---|
601 | + static bool firstTime = true;
|
---|
602 | +
|
---|
603 | + if ((*(unsigned char*) NB_MAX_ROW_ADDR == 0) &&
|
---|
604 | + (*(unsigned short*)NB_MAX_COL_ADDR == 0)) {
|
---|
605 | + return false;
|
---|
606 | + }
|
---|
607 | +
|
---|
608 | + /*
|
---|
609 | + * If there is a video card, let's assume there is also a keyboard.
|
---|
610 | + * The means that we need the ISR installed in case someone wants to
|
---|
611 | + * use the Keyboard or PS2 Mouse. With Microwindows, the console
|
---|
612 | + * can be COM1 and you can still use the mouse/VGA for graphics.
|
---|
613 | + */
|
---|
614 | + if ( firstTime ) {
|
---|
615 | + status = BSP_install_rtems_irq_handler(&keyboard_isr_data);
|
---|
616 | + if (!status) {
|
---|
617 | + printk("Error installing keyboard interrupt handler!\n");
|
---|
618 | + rtems_fatal_error_occurred(status);
|
---|
619 | + }
|
---|
620 | + }
|
---|
621 | + firstTime = false;
|
---|
622 | +
|
---|
623 | + return true;
|
---|
624 | +}
|
---|
625 | +
|
---|
626 | +console_fns vgacons_fns =
|
---|
627 | +{
|
---|
628 | + libchip_serial_default_probe, /* deviceProbe */
|
---|
629 | + vgacons_open, /* deviceFirstOpen */
|
---|
630 | + vgacons_close, /* deviceLastClose */
|
---|
631 | + vgacons_inbyte_nonblocking_polled, /* deviceRead */
|
---|
632 | + vgacons_write_support_polled, /* deviceWrite */
|
---|
633 | + vgacons_init, /* deviceInitialize */
|
---|
634 | + vgacons_write_polled, /* deviceWritePolled */
|
---|
635 | + vgacons_set_attributes, /* deviceSetAttributes */
|
---|
636 | + FALSE, /* deviceOutputUsesInterrupts */
|
---|
637 | +};
|
---|
638 | Index: c/src/lib/libbsp/i386/pc386/console/vgacons.h
|
---|
639 | ===================================================================
|
---|
640 | RCS file: c/src/lib/libbsp/i386/pc386/console/vgacons.h
|
---|
641 | diff -N c/src/lib/libbsp/i386/pc386/console/vgacons.h
|
---|
642 | --- /dev/null 1 Jan 1970 00:00:00 -0000
|
---|
643 | +++ c/src/lib/libbsp/i386/pc386/console/vgacons.h 2 Nov 2011 13:36:47 -0000
|
---|
644 | @@ -0,0 +1,45 @@
|
---|
645 | +/*
|
---|
646 | + * COPYRIGHT (c) 1989-2011.
|
---|
647 | + * On-Line Applications Research Corporation (OAR).
|
---|
648 | + *
|
---|
649 | + * The license and distribution terms for this file may be
|
---|
650 | + * found in the file LICENSE in this distribution or at
|
---|
651 | + * http://www.rtems.com/license/LICENSE.
|
---|
652 | + *
|
---|
653 | + * $Id: vgacons.h,v 1.1 2011/08/05 15:40:18 joel Exp $
|
---|
654 | + */
|
---|
655 | +
|
---|
656 | +#ifndef _VGACONS_H_
|
---|
657 | +#define _VGACONS_H_
|
---|
658 | +
|
---|
659 | +#include <libchip/serial.h>
|
---|
660 | +
|
---|
661 | +#ifdef __cplusplus
|
---|
662 | +extern "C" {
|
---|
663 | +#endif
|
---|
664 | +
|
---|
665 | +#define VGACONS_STATIC
|
---|
666 | +
|
---|
667 | +/*
|
---|
668 | + * This is the ASCII for "PC" in the upper word and 0386
|
---|
669 | + * in the lower which should be unique enough to
|
---|
670 | + * distinguish this type of serial device from others.
|
---|
671 | + */
|
---|
672 | +
|
---|
673 | +#define VGA_CONSOLE 0x80670386
|
---|
674 | +
|
---|
675 | +#define VGACONS_UART0 0
|
---|
676 | +#define VGACONS_UART1 1
|
---|
677 | +
|
---|
678 | +bool vgacons_probe( int minor );
|
---|
679 | +
|
---|
680 | +/*
|
---|
681 | + * Driver function table
|
---|
682 | + */
|
---|
683 | +extern console_fns vgacons_fns;
|
---|
684 | +
|
---|
685 | +#ifdef __cplusplus
|
---|
686 | +}
|
---|
687 | +#endif
|
---|
688 | +
|
---|
689 | +#endif /* _VGACONS_H_ */
|
---|
690 | Index: c/src/lib/libbsp/i386/pc386/include/bsp.h
|
---|
691 | ===================================================================
|
---|
692 | RCS file: /usr1/CVS/rtems/c/src/lib/libbsp/i386/pc386/include/bsp.h,v
|
---|
693 | retrieving revision 1.48
|
---|
694 | diff -u -r1.48 bsp.h
|
---|
695 | --- c/src/lib/libbsp/i386/pc386/include/bsp.h 11 Feb 2011 12:04:30 -0000 1.48
|
---|
696 | +++ c/src/lib/libbsp/i386/pc386/include/bsp.h 2 Nov 2011 13:36:47 -0000
|
---|
697 | @@ -201,6 +201,8 @@
|
---|
698 | void set_debug_traps(void);
|
---|
699 | void breakpoint(void);
|
---|
700 |
|
---|
701 | +#define BSP_MAXIMUM_DEVICES 6
|
---|
702 | +
|
---|
703 | #ifdef __cplusplus
|
---|
704 | }
|
---|
705 | #endif
|
---|
706 | Index: c/src/lib/libbsp/i386/pc386/start/start.S
|
---|
707 | ===================================================================
|
---|
708 | RCS file: /usr1/CVS/rtems/c/src/lib/libbsp/i386/pc386/start/start.S,v
|
---|
709 | retrieving revision 1.18
|
---|
710 | diff -u -r1.18 start.S
|
---|
711 | --- c/src/lib/libbsp/i386/pc386/start/start.S 14 Jul 2011 15:07:21 -0000 1.18
|
---|
712 | +++ c/src/lib/libbsp/i386/pc386/start/start.S 2 Nov 2011 13:36:47 -0000
|
---|
713 | @@ -209,11 +209,6 @@
|
---|
714 | +---------------------------------------------------------------------*/
|
---|
715 | call checkCPUtypeSetCr0
|
---|
716 |
|
---|
717 | -/*---------------------------------------------------------------------+
|
---|
718 | -| Redirect printk (and console) port if desired
|
---|
719 | -+---------------------------------------------------------------------*/
|
---|
720 | - call SYM(BSP_console_select)
|
---|
721 | -
|
---|
722 | #ifdef __SSE__
|
---|
723 | call SYM(enable_sse)
|
---|
724 | #endif
|
---|
725 | Index: c/src/lib/libbsp/i386/shared/irq/irq.h
|
---|
726 | ===================================================================
|
---|
727 | RCS file: /usr1/CVS/rtems/c/src/lib/libbsp/i386/shared/irq/irq.h,v
|
---|
728 | retrieving revision 1.17
|
---|
729 | diff -u -r1.17 irq.h
|
---|
730 | --- c/src/lib/libbsp/i386/shared/irq/irq.h 14 Jul 2011 17:30:27 -0000 1.17
|
---|
731 | +++ c/src/lib/libbsp/i386/shared/irq/irq.h 2 Nov 2011 13:36:47 -0000
|
---|
732 | @@ -55,6 +55,8 @@
|
---|
733 | #define BSP_KEYBOARD 1
|
---|
734 | #define BSP_UART_COM2_IRQ 3
|
---|
735 | #define BSP_UART_COM1_IRQ 4
|
---|
736 | +#define BSP_UART_COM3_IRQ 5
|
---|
737 | +#define BSP_UART_COM4_IRQ 6
|
---|
738 | #define BSP_RT_TIMER1 8
|
---|
739 | #define BSP_RT_TIMER3 10
|
---|
740 | #define BSP_SMP_IPI 16
|
---|