1 | /* |
---|
2 | * This file is an extension of the generic console driver |
---|
3 | * shell used by all console drivers using libchip, it contains |
---|
4 | * the console_control routine, This bsp needs its own version |
---|
5 | * of this method to handle the keyboard and mouse as a single |
---|
6 | * device. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2011. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #include <bsp.h> |
---|
19 | #include <stdlib.h> |
---|
20 | #include <assert.h> |
---|
21 | #include <termios.h> |
---|
22 | #include <rtems/libio.h> |
---|
23 | #include <rtems/console.h> |
---|
24 | |
---|
25 | #include <bsp/irq.h> |
---|
26 | |
---|
27 | #include <rtems/termiostypes.h> |
---|
28 | #include <libchip/serial.h> |
---|
29 | #include <rtems/mouse_parser.h> |
---|
30 | #if BSP_ENABLE_VGA |
---|
31 | #include <rtems/keyboard.h> |
---|
32 | #endif |
---|
33 | #include "../../../../../../../bsps/shared/dev/serial/legacy-console.h" |
---|
34 | |
---|
35 | /* |
---|
36 | * console_control |
---|
37 | * |
---|
38 | * this routine uses the termios driver to process io |
---|
39 | */ |
---|
40 | rtems_device_driver console_control( |
---|
41 | rtems_device_major_number major, |
---|
42 | rtems_device_minor_number minor, |
---|
43 | void * arg |
---|
44 | ) |
---|
45 | { |
---|
46 | #if BSP_ENABLE_VGA |
---|
47 | if (minor == 0) { |
---|
48 | rtems_libio_ioctl_args_t *args = arg; |
---|
49 | |
---|
50 | switch (args->command) { |
---|
51 | default: |
---|
52 | if( vt_ioctl( args->command, (unsigned long)args->buffer ) != 0 ) |
---|
53 | return rtems_termios_ioctl (arg); |
---|
54 | break; |
---|
55 | |
---|
56 | case MW_UID_REGISTER_DEVICE: |
---|
57 | printk( "SerialMouse: reg=%s\n", (const char*) args->buffer ); |
---|
58 | register_kbd_msg_queue( args->buffer, 0 ); |
---|
59 | break; |
---|
60 | |
---|
61 | case MW_UID_UNREGISTER_DEVICE: |
---|
62 | unregister_kbd_msg_queue( 0 ); |
---|
63 | break; |
---|
64 | } |
---|
65 | |
---|
66 | args->ioctl_return = 0; |
---|
67 | return RTEMS_SUCCESSFUL; |
---|
68 | } |
---|
69 | #endif |
---|
70 | return rtems_termios_ioctl (arg); |
---|
71 | } |
---|