source: rtems/c/src/lib/libbsp/i386/pc386/console/inch.c @ b459526

4.104.114.84.95
Last change on this file since b459526 was 3cbb63a, checked in by Joel Sherrill <joel.sherrill@…>, on 08/30/00 at 08:15:30

2000-08-26 Rosimildo da Silva <rdasilva@…>

  • Major rework of the "/dev/console" driver.
  • Added termios support for stdin ( keyboard ).
  • Added ioctls() to support modes similar to Linux( XLATE, RAW, MEDIUMRAW ).
  • Added Keyboard mapping and handling of the keyboard's leds.
  • Added Micro FrameBuffer? driver ( "/dev/fb0" ) for bare VGA controller ( 16 colors ).
  • Added PS/2 and Serial mouse support for PC386 BSP.
  • console/defkeymap.c: New file.
  • console/fb_vga.c: New file.
  • console/fb_vga.h: New file.
  • console/i386kbd.h: New file.
  • console/kd.h: New file.
  • console/keyboard.c: New file.
  • console/keyboard.h: New file.
  • console/mouse_parser.c: New file.
  • console/mouse_parser.h: New file.
  • console/pc_keyb.c: New file.
  • console/ps2_drv.h: New file.
  • console/ps2_mouse.c: New file.
  • console/ps2_mouse.h: New file.
  • console/serial_mouse.c: New file.
  • console/serial_mouse.h: New file.
  • console/vgainit.c: New file.
  • console/vt.c: New file.
  • console/Makefile.am: Reflect new files.
  • console/console.c, console/inch.c, console/outch.c: Console functionality modifications.
  • startup/Makefile.am: Pick up tty_drv.c and gdb_glue.c
  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*-------------------------------------------------------------------------+
2| inch.c v1.1 - PC386 BSP - 1997/08/07
3+--------------------------------------------------------------------------+
4| (C) Copyright 1997 -
5| - NavIST Group - Real-Time Distributed Systems and Industrial Automation
6|
7| http://pandora.ist.utl.pt
8|
9| Instituto Superior Tecnico * Lisboa * PORTUGAL
10+--------------------------------------------------------------------------+
11| Disclaimer:
12|
13| This file is provided "AS IS" without warranty of any kind, either
14| expressed or implied.
15+--------------------------------------------------------------------------+
16| This code is based on:
17|   inch.c,v 1.3 1995/12/19 20:07:25 joel Exp - go32 BSP
18| With the following copyright notice:
19| With the following copyright notice:
20| **************************************************************************
21| *  COPYRIGHT (c) 1989-1998.
22| *  On-Line Applications Research Corporation (OAR).
23| *  Copyright assigned to U.S. Government, 1994.
24| *
25| *  The license and distribution terms for this file may be
26| *  found in found in the file LICENSE in this distribution or at
27| *  http://www.OARcorp.com/rtems/license.html.
28| **************************************************************************
29|
30|  $Id$
31+--------------------------------------------------------------------------*/
32
33#include <bsp.h>
34#include <irq.h>
35
36/*-------------------------------------------------------------------------+
37| Constants
38+--------------------------------------------------------------------------*/
39#define KBD_BUF_SIZE    256
40
41static unsigned short   kbd_buffer[KBD_BUF_SIZE];
42static rtems_unsigned16 kbd_first = 0;
43static rtems_unsigned16 kbd_last  = 0;
44static rtems_unsigned16 kbd_end   = KBD_BUF_SIZE - 1;
45
46/*-------------------------------------------------------------------------+
47|         Function: rtemsReboot
48|      Description: Reboot the PC.
49| Global Variables: None.
50|        Arguments: None.
51|          Returns: Nothing.
52+--------------------------------------------------------------------------*/
53void rtemsReboot(void)
54{
55  /* shutdown and reboot */
56  outport_byte(0x64, 0xFE);      /* use keyboard controler to do the job... */
57} /* rtemsReboot */
58
59
60
61#define disable __asm__ __volatile__("cli")
62#define enable  __asm__ __volatile__("sti");
63/*
64 * Check if a key has been pressed. This is a non-destructive
65 * call, meaning, it keeps the key in the buffer.
66 */
67int rtems_kbpoll( void )
68{
69  int rc;
70  disable;
71  rc = ( kbd_first != kbd_last ) ? TRUE : FALSE;
72  enable;
73  return rc;
74}
75
76int getch( void )
77{
78  int c;
79  while( kbd_first == kbd_last )
80  {
81     rtems_task_wake_after( 10 );
82  }
83  c = kbd_buffer[ kbd_first ];
84  kbd_first = (kbd_first + 1) % KBD_BUF_SIZE;
85  return c;
86}
87
88void add_to_queue( unsigned short b )
89{
90 unsigned int next;
91 kbd_buffer[ kbd_last ] = b;
92 next = (kbd_last == kbd_end) ? 0 : kbd_last + 1;
93 if( next != kbd_first )
94 {
95    kbd_last = next;
96 }
97}
98
Note: See TracBrowser for help on using the repository browser.