summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386/pc386/console/serial_mouse_config.c
blob: b2ebc5a520a2650f9b806dec38f605b20d009132 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 *  COPYRIGHT (c) 1989-2011.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.org/license/LICENSE.
 */

#include <stdio.h>
#include <stdlib.h>
#include <bsp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include "libchip/serial.h"
#include "../../../shared/console_private.h"

/* select which serial port the mouse is connected to */
#if defined(SERIAL_MOUSE_COM2)
  #define MOUSE_DEVICE "/dev/com2"
#else
  #define MOUSE_DEVICE "/dev/com1"
#endif

static const char *SerialMouseDevice = MOUSE_DEVICE;

bool bsp_get_serial_mouse_device(
  const char **name,
  const char **type
)
{
  const char *consname;

  *name = SerialMouseDevice;
  *type = "ms";

  /* Check if this port is not been used as console */
  consname = Console_Port_Tbl[ Console_Port_Minor ]->sDeviceName;
  if ( !strcmp(MOUSE_DEVICE, consname) ) {
    printk( "SERIAL MOUSE: port selected as console.(%s)\n", *name );
    rtems_fatal_error_occurred( -1 );
  }

  printk("Mouse Device: %s\n", *name );
  return name;
}