Changeset 3cbb63a in rtems


Ignore:
Timestamp:
08/30/00 08:15:30 (23 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
b459526
Parents:
fe602cf
Message:

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
Location:
c/src/lib/libbsp/i386/pc386
Files:
17 added
6 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/pc386/ChangeLog

    rfe602cf r3cbb63a  
     12000-08-26  Rosimildo da Silva  <rdasilva@connecttel.com>
     2
     3        * Major rework of the "/dev/console" driver.
     4        * Added termios support for stdin ( keyboard ).
     5        * Added ioctls() to support modes similar to Linux( XLATE,
     6        RAW, MEDIUMRAW ).
     7        * Added Keyboard mapping and handling of the keyboard's leds.
     8        * Added Micro FrameBuffer driver ( "/dev/fb0" ) for bare VGA
     9        controller ( 16 colors ).
     10        * Added PS/2 and Serial mouse support for PC386 BSP.
     11        * console/defkeymap.c: New file.
     12        * console/fb_vga.c: New file.
     13        * console/fb_vga.h: New file.
     14        * console/i386kbd.h: New file.
     15        * console/kd.h: New file.
     16        * console/keyboard.c: New file.
     17        * console/keyboard.h: New file.
     18        * console/mouse_parser.c: New file.
     19        * console/mouse_parser.h: New file.
     20        * console/pc_keyb.c: New file.
     21        * console/ps2_drv.h: New file.
     22        * console/ps2_mouse.c: New file.
     23        * console/ps2_mouse.h: New file.
     24        * console/serial_mouse.c: New file.
     25        * console/serial_mouse.h: New file.
     26        * console/vgainit.c: New file.
     27        * console/vt.c: New file.
     28        * console/Makefile.am: Reflect new files.
     29        * console/console.c, console/inch.c, console/outch.c: Console
     30        functionality modifications.
     31        * startup/Makefile.am: Pick up tty_drv.c and gdb_glue.c
     32
    1332000-08-10      Joel Sherrill <joel@OARcorp.com>
    234
  • c/src/lib/libbsp/i386/pc386/console/Makefile.am

    rfe602cf r3cbb63a  
    99PGM = $(ARCH)/console.rel
    1010
    11 C_FILES = console.c inch.c outch.c
     11RTEMS_H_FILES = keyboard.h kd.h serial_mouse.h ps2_drv.h fb_vga.h
     12
     13C_FILES = console.c inch.c outch.c defkeymap.c fb_vga.c keyboard.c \
     14    mouse_parser.c pc_keyb.c ps2_mouse.c serial_mouse.c vgainit.c vt.c
    1215S_FILES = videoAsm.S
    1316
     
    1619include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
    1720include $(top_srcdir)/../../../../../../automake/lib.am
     21
     22
     23PREINSTALL_FILES = $(PROJECT_INCLUDE) \
     24    $(RTEMS_H_FILES:%.h=$(PROJECT_INCLUDE)/rtems/%.h)
    1825
    1926#
     
    2431        $(make-rel)
    2532
     33$(PROJECT_INCLUDE)/rtems:
     34        $(mkinstalldirs) $@
     35
     36$(PROJECT_INCLUDE)/rtems/%.h: %.h
     37        $(INSTALL_DATA) $< $@
     38
    2639# the .rel file built here will be put into libbsp.a by
    2740#       ../wrapup/Makefile
    2841
    29 all-local: $(ARCH) $(console_rel_OBJECTS) $(PGM)
     42all-local: $(PREINSTALL_FILES) $(ARCH) $(console_rel_OBJECTS) $(PGM)
    3043
    3144.PRECIOUS: $(PGM)
    3245
    33 EXTRA_DIST = console.c inch.c outch.c videoAsm.S
     46EXTRA_DIST = $(C_FILES) $(RTEMS_H_FILES) $(S_FILES)
    3447
    3548include $(top_srcdir)/../../../../../../automake/local.am
  • c/src/lib/libbsp/i386/pc386/console/console.c

    rfe602cf r3cbb63a  
    4545#include <libcpu/cpuModel.h>
    4646
     47#include <rtems/mw_uid.h>
     48#include "mouse_parser.h"
     49
    4750/*
    4851 * Possible value for console input/output :
     
    6669
    6770extern BSP_polling_getchar_function_type BSP_poll_char;
     71extern int getch( void );
     72extern void kbd_init( void );
    6873
    6974/*-------------------------------------------------------------------------+
    7075| External Prototypes
    7176+--------------------------------------------------------------------------*/
    72 extern void _IBMPC_keyboard_isr(void);
    73 extern rtems_boolean _IBMPC_scankey(char *);  /* defined in 'inch.c' */
     77extern void keyboard_interrupt(void);
    7478extern char BSP_wait_polled_input(void);
    7579extern void _IBMPC_initVideo(void);
     
    8084static int  isr_is_on(const rtems_irq_connect_data *);
    8185
     86extern int rtems_kbpoll( void );
    8287
    8388static rtems_irq_connect_data console_isr_data = {BSP_KEYBOARD,
    84                                                    _IBMPC_keyboard_isr,
     89                     keyboard_interrupt,
    8590                                                   isr_on,
    8691                                                   isr_off,
     
    104109  return BSP_irq_enabled_at_i8259s(irq->name);
    105110}
     111
     112extern char _IBMPC_inch(void);
     113extern int  rtems_kbpoll( void );
     114
     115static int
     116ibmpc_console_write(int minor, const char *buf, int len)
     117{
     118  int count;
     119  for (count = 0; count < len; count++)
     120  {
     121    _IBMPC_outch( buf[ count ] );
     122    if( buf[ count ] == '\n')
     123      _IBMPC_outch( '\r' );            /* LF = LF + CR */
     124  }
     125  return 0;
     126}
     127
     128
     129int kbd_poll_read( int minor )
     130{
     131  if( rtems_kbpoll() )
     132  {
     133     int c = getch();
     134     return c;
     135  }
     136  return -1;
     137}
     138
     139/*
     140static void*         termios_ttyp_console         = NULL;
     141void enq_key( char key )
     142{
     143  if( termios_ttyp_console )
     144  {
     145          rtems_termios_enqueue_raw_characters(termios_ttyp_console, &key,1 );
     146  }
     147}
     148*/
    106149
    107150void __assert (const char *file, int line, const char *msg)
     
    145188  rtems_status_code status;
    146189
     190
     191  /* Initialize the KBD interface */
     192  kbd_init();
     193
     194  /*
     195   * Set up TERMIOS
     196   */
     197  rtems_termios_initialize ();
     198
    147199  /*
    148200   *  The video was initialized in the start.s code and does not need
     
    150202   */
    151203
    152 
    153204  if(BSPConsolePort == BSP_CONSOLE_PORT_CONSOLE)
    154205    {
     
    156207      status = BSP_install_rtems_irq_handler(&console_isr_data);
    157208 
    158       if (!status)
     209    if (!status)
    159210        {
    160211          printk("Error installing keyboard interrupt handler!\n");
     
    173224    {
    174225      /*
    175        * Set up TERMIOS
    176        */
    177       rtems_termios_initialize ();
    178      
    179       /*
    180226       * Do device-specific initialization
    181227       */
    182      
    183228      /* 9600-8-N-1 */
    184229      BSP_uart_init(BSPConsolePort, 9600, 0);
     
    187232      /* Set interrupt handler */
    188233      if(BSPConsolePort == BSP_UART_COM1)
    189         {
    190           console_isr_data.name = BSP_UART_COM1_IRQ;
    191           console_isr_data.hdl  = BSP_uart_termios_isr_com1;
     234        {
     235             console_isr_data.name = BSP_UART_COM1_IRQ;
     236        console_isr_data.hdl  = BSP_uart_termios_isr_com1;
    192237         
    193         }
     238        }
    194239      else
    195         {
     240           {
    196241          assert(BSPConsolePort == BSP_UART_COM2);
    197           console_isr_data.name = BSP_UART_COM2_IRQ;
    198           console_isr_data.hdl  = BSP_uart_termios_isr_com2;
    199         }
    200 
     242          console_isr_data.name = BSP_UART_COM2_IRQ;
     243          console_isr_data.hdl  = BSP_uart_termios_isr_com2;
     244        }
    201245      status = BSP_install_rtems_irq_handler(&console_isr_data);
    202246
     
    270314    NULL,                     /* firstOpen */
    271315    console_last_close,       /* lastClose */
    272     NULL,                     /* pollRead */
     316    NULL,          /* pollRead */
    273317    BSP_uart_termios_write_com1, /* write */
    274318    conSetAttr,               /* setAttributes */
     
    280324  if(BSPConsolePort == BSP_CONSOLE_PORT_CONSOLE)
    281325    {
     326
     327      /* Let's set the routines for termios to poll the
     328       * Kbd queue for data
     329       */
     330      cb.pollRead = kbd_poll_read;
     331      cb.outputUsesInterrupts = 0;
     332      /* write the "echo" if it is on */
     333      cb.write = ibmpc_console_write;
     334
     335      cb.setAttributes = NULL;
    282336      ++console_open_count;
    283       return RTEMS_SUCCESSFUL;
     337      status = rtems_termios_open (major, minor, arg, &cb);
     338      if(status != RTEMS_SUCCESSFUL)
     339      {
     340         printk("Error openning console device\n");
     341      }
     342      return status;
    284343    }
    285344
     
    317376              void                      *arg)
    318377{
    319   rtems_device_driver res = RTEMS_SUCCESSFUL;
    320 
    321   if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE)
    322     {
    323       res =  rtems_termios_close (arg);
    324     }
    325   else {
    326     if (--console_open_count == 0) {
    327       console_last_close(major, minor, arg);
    328     }
    329   }
    330  
    331   return res;
     378   return rtems_termios_close (arg);
    332379} /* console_close */
    333380
     
    343390             void                      *arg)
    344391{
    345   rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *)arg;
    346   char                  *buffer  = rw_args->buffer;
    347   int            count, maximum  = rw_args->count;
    348 
    349   if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE)
    350     {
    351       return rtems_termios_read (arg);
    352     }
    353  
    354   for (count = 0; count < maximum; count++)
    355   {
    356     /* Get character */
    357     buffer[count] = _IBMPC_inch_sleep();
    358 
    359     /* Echo character to screen */
    360     _IBMPC_outch(buffer[count]);
    361     if (buffer[count] == '\r')
    362       {
    363         _IBMPC_outch('\n');  /* CR = CR + LF */
    364       }
    365 
    366     if (buffer[count] == '\n' || buffer[count] == '\r')
    367     {
    368       /* What if this goes past the end of the buffer?  We're hosed. [bhc] */
    369       buffer[count++]  = '\n';
    370       buffer[count]    = '\0';
    371       break;
    372     }
    373   }
    374  
    375   rw_args->bytes_moved = count;
    376   return ((count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED);
     392 return rtems_termios_read( arg );
    377393} /* console_read */
    378394 
     
    390406  rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *)arg;
    391407  char                  *buffer  = rw_args->buffer;
    392   int            count, maximum  = rw_args->count;
     408  int                    maximum  = rw_args->count;
    393409
    394410  if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE)
     
    397413    }
    398414 
    399   for (count = 0; count < maximum; count++)
    400   {
    401     _IBMPC_outch(buffer[count]);
    402     if (buffer[count] == '\n')
    403       _IBMPC_outch('\r');            /* LF = LF + CR */
    404   }
    405 
     415  /* write data to VGA */
     416  ibmpc_console_write( minor, buffer, maximum );
    406417  rw_args->bytes_moved = maximum;
    407418  return RTEMS_SUCCESSFUL;
     
    409420
    410421
     422extern int vt_ioctl( unsigned int cmd, unsigned long arg);
    411423 
    412424/*
     
    419431)
    420432{
    421   if(BSPConsolePort != BSP_CONSOLE_PORT_CONSOLE)
    422     {
    423       return rtems_termios_ioctl (arg);
    424     }
    425 
    426   return RTEMS_SUCCESSFUL;
     433        rtems_libio_ioctl_args_t *args = arg;
     434        switch (args->command)
     435        {
     436           default:
     437      if( vt_ioctl( args->command, (unsigned long)args->buffer ) != 0 )
     438          return rtems_termios_ioctl (arg);
     439                break;
     440
     441      case MW_UID_REGISTER_DEVICE:
     442      printk( "SerialMouse: reg=%s\n", args->buffer );
     443      register_kbd_msg_queue( args->buffer, 0 );
     444                break;
     445
     446      case MW_UID_UNREGISTER_DEVICE:
     447      unregister_kbd_msg_queue( 0 );
     448                break;
     449   }
     450        args->ioctl_return = 0;
     451   return RTEMS_SUCCESSFUL;
    427452}
    428453
  • c/src/lib/libbsp/i386/pc386/console/inch.c

    rfe602cf r3cbb63a  
    1919| With the following copyright notice:
    2020| **************************************************************************
    21 | *  COPYRIGHT (c) 1989-1999.
     21| *  COPYRIGHT (c) 1989-1998.
    2222| *  On-Line Applications Research Corporation (OAR).
     23| *  Copyright assigned to U.S. Government, 1994.
    2324| *
    2425| *  The license and distribution terms for this file may be
     
    3637| Constants
    3738+--------------------------------------------------------------------------*/
    38 #define KBD_CTL      0x61  /* -------------------------------- */
    39 #define KBD_DATA     0x60  /* Ports for PC keyboard controller */
    40 #define KBD_STATUS   0x64  /* -------------------------------- */
     39#define KBD_BUF_SIZE    256
    4140
    42 #define KBD_BUF_SIZE 256
    43 
    44 /*-------------------------------------------------------------------------+
    45 | Global Variables
    46 +--------------------------------------------------------------------------*/
    47 static char key_map[] =
    48 {
    49   0,033,'1','2','3','4','5','6','7','8','9','0','-','=','\b','\t',
    50   'q','w','e','r','t','y','u','i','o','p','[',']',015,0x80,
    51   'a','s','d','f','g','h','j','k','l',';',047,0140,0x80,
    52   0134,'z','x','c','v','b','n','m',',','.','/',0x80,
    53   '*',0x80,' ',0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
    54   0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
    55   0x80,0x80,0x80,'0',0177
    56 }; /* Keyboard scancode -> character map with no modifiers.       */
    57 
    58 static char shift_map[] =
    59 {
    60   0,033,'!','@','#','$','%','^','&','*','(',')','_','+','\b','\t',
    61   'Q','W','E','R','T','Y','U','I','O','P','{','}',015,0x80,
    62   'A','S','D','F','G','H','J','K','L',':',042,'~',0x80,
    63   '|','Z','X','C','V','B','N','M','<','>','?',0x80,
    64   '*',0x80,' ',0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
    65   0x80,0x80,0x80,0x80,'7','8','9',0x80,'4','5','6',0x80,
    66   '1','2','3','0',177
    67 }; /* Keyboard scancode -> character map with SHIFT key modifier. */
    68 
    69 static char             kbd_buffer[KBD_BUF_SIZE];
     41static unsigned short   kbd_buffer[KBD_BUF_SIZE];
    7042static rtems_unsigned16 kbd_first = 0;
    7143static rtems_unsigned16 kbd_last  = 0;
     
    8557} /* rtemsReboot */
    8658
    87 /*-------------------------------------------------------------------------+
    88 |         Function: _IBMPC_scankey
    89 |      Description: This function can be called during a poll for input, or by
    90 |                   an ISR. Basically any time you want to process a keypress.
    91 | Global Variables: key_map, shift_map.
    92 |        Arguments: outChar - character read in case of a valid reading,
    93 |                   otherwise unchanged.
    94 |          Returns: TRUE in case a valid character has been read,
    95 |                   FALSE otherwise.
    96 +--------------------------------------------------------------------------*/
    97 rtems_boolean
    98 _IBMPC_scankey(char *outChar)
    99 {
    100   unsigned char inChar;
    101   static int alt_pressed   = 0;
    102   static int ctrl_pressed  = 0;
    103   static int shift_pressed = 0;
    104   static int caps_pressed  = 0;
    105   static int extended      = 0;
    106 
    107   *outChar = NULL; /* default value if we return FALSE */
    108 
    109   /* Read keyboard controller, toggle enable */
    110   inport_byte(KBD_CTL, inChar);
    111   outport_byte(KBD_CTL, inChar & ~0x80);
    112   outport_byte(KBD_CTL, inChar | 0x80);
    113   outport_byte(KBD_CTL, inChar & ~0x80);
    114 
    115   /* See if it has data */
    116   inport_byte(KBD_STATUS, inChar);
    117   if ((inChar & 0x01) == 0)
    118     return FALSE;
    119 
    120   /* Read the data.  Handle nonsense with shift, control, etc. */
    121   inport_byte(KBD_DATA, inChar);
    122 
    123   if (extended)
    124     extended--;
    125 
    126   switch (inChar)
    127   {
    128     case 0xe0:
    129       extended = 2;
    130       return FALSE;
    131       break;
    132 
    133     case 0x38:
    134       alt_pressed = 1;
    135       return FALSE;
    136       break;
    137     case 0xb8:
    138       alt_pressed = 0;
    139       return FALSE;
    140       break;
    141 
    142     case 0x1d:
    143       ctrl_pressed = 1;
    144       return FALSE;
    145       break;
    146     case 0x9d:
    147       ctrl_pressed = 0;
    148       return FALSE;
    149       break;
    150 
    151     case 0x2a:
    152       if (extended)
    153         return FALSE;
    154     case 0x36:
    155       shift_pressed = 1;
    156       return FALSE;
    157       break;
    158     case 0xaa:
    159       if (extended)
    160         return FALSE;
    161     case 0xb6:
    162       shift_pressed = 0;
    163       return FALSE;
    164       break;
    165 
    166     case 0x3a:
    167       caps_pressed = 1;
    168       return FALSE;
    169       break;
    170     case 0xba:
    171       caps_pressed = 0;
    172       return FALSE;
    173       break;
    174 
    175     case 0x53:
    176       if (ctrl_pressed && alt_pressed)
    177         rtemsReboot(); /* ctrl+alt+del -> reboot */
    178       break;
    179 
    180     /*
    181      * Ignore unrecognized keys--usually arrow and such
    182      */
    183     default:
    184       if ((inChar & 0x80) || (inChar > 0x39))
    185       /* High-bit on means key is being released, not pressed */
    186         return FALSE;
    187       break;
    188   } /* switch */
    189 
    190   /* Strip high bit, look up in our map */
    191   inChar &= 0x7f;
    192   if (ctrl_pressed)
    193   {
    194     *outChar = key_map[inChar];
    195     *outChar &= 037;
    196   }
    197   else
    198   {
    199     *outChar = shift_pressed ? shift_map[inChar] : key_map[inChar];
    200     if (caps_pressed)
    201     {
    202       if (*outChar >= 'A' && *outChar <= 'Z')
    203         *outChar += 'a' - 'A';
    204       else if (*outChar >= 'a' && *outChar <= 'z')
    205         *outChar -= 'a' - 'A';
    206     }
    207   }
    208 
    209   return TRUE;
    210 } /* _IBMPC_scankey */
    211 
    212 /*-------------------------------------------------------------------------+
    213 |         Function: _IBMPC_keyboard_isr
    214 |      Description: Interrupt Service Routine for keyboard (0x01) IRQ.
    215 | Global Variables: kbd_buffer, kbd_first, kbd_last.
    216 |        Arguments: vector - standard RTEMS argument - see documentation.
    217 |          Returns: standard return value - see documentation.
    218 +--------------------------------------------------------------------------*/
    219 void _IBMPC_keyboard_isr()
    220 {
    221   if (_IBMPC_scankey(&kbd_buffer[kbd_last]))
    222   {
    223     /* Got one; save it if there is enough room in buffer. */
    224     unsigned int next = (kbd_last == kbd_end) ? 0 : kbd_last + 1;
    225 
    226     if (next != kbd_first)
    227       {
    228         kbd_last = next;
    229       }
    230   }
    231 } /* _IBMPC_keyboard_isr */
    23259
    23360
    234 /*-------------------------------------------------------------------------+
    235 |         Function: _IBMPC_chrdy
    236 |      Description: Check keyboard ISR buffer and return character if not empty.
    237 | Global Variables: kbd_buffer, kbd_first, kbd_last.
    238 |        Arguments: c - character read if keyboard buffer not empty, otherwise
    239 |                   unchanged.
    240 |          Returns: TRUE if keyboard buffer not empty, FALSE otherwise.
    241 +--------------------------------------------------------------------------*/
    242 rtems_boolean
    243 _IBMPC_chrdy(char *c)
     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 )
    24468{
    245   /* FIX ME!!! It doesn't work without something like the following line.
    246      Find out why! */
    247   printk("");
     69  int rc;
     70  disable;
     71  rc = ( kbd_first != kbd_last ) ? TRUE : FALSE;
     72  enable;
     73  return rc;
     74}
    24875
    249   /* Check buffer our ISR builds */
    250   if (kbd_first != kbd_last)
     76int getch( void )
     77{
     78  int c;
     79  while( kbd_first == kbd_last )
    25180  {
    252     *c = kbd_buffer[kbd_first];
    253 
    254     kbd_first = (kbd_first + 1) % KBD_BUF_SIZE;
    255     return TRUE;
     81     rtems_task_wake_after( 10 );
    25682  }
    257   else
    258     return FALSE;
    259 } /* _IBMPC_chrdy */
    260 
    261 
    262 /*-------------------------------------------------------------------------+
    263 |         Function: _IBMPC_inch
    264 |      Description: Poll keyboard until a character is ready and return it.
    265 | Global Variables: None.
    266 |        Arguments: None.
    267 |          Returns: character read from keyboard.
    268 +--------------------------------------------------------------------------*/
    269 char
    270 _IBMPC_inch(void)
    271 {
    272     char c;
    273     while (!_IBMPC_chrdy(&c))
    274       continue;
    275 
    276     return c;
    277 } /* _IBMPC_inch */
    278 
    279  
    280  /*
    281   * Routine that can be used before interrupt management is initialized.
    282   */
    283  
    284 char
    285 BSP_wait_polled_input(void)
    286 {
    287   char c;
    288   while (!_IBMPC_scankey(&c))
    289     continue;
    290 
     83  c = kbd_buffer[ kbd_first ];
     84  kbd_first = (kbd_first + 1) % KBD_BUF_SIZE;
    29185  return c;
    29286}
    29387
    294 /*-------------------------------------------------------------------------+
    295 |         Function: _IBMPC_inch_sleep
    296 |      Description: If charcter is ready return it, otherwise sleep until
    297 |                   it is ready
    298 | Global Variables: None.
    299 |        Arguments: None.
    300 |          Returns: character read from keyboard.
    301 +--------------------------------------------------------------------------*/
    302 char
    303 _IBMPC_inch_sleep(void)
     88void add_to_queue( unsigned short b )
    30489{
    305     char           c;
    306     rtems_interval ticks_per_second;
     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}
    30798
    308     ticks_per_second = 0;
    309 
    310     for(;;)
    311       {
    312         if(_IBMPC_chrdy(&c))
    313           {
    314             return c;
    315           }
    316  
    317         if(ticks_per_second == 0)
    318           {
    319             rtems_clock_get(RTEMS_CLOCK_GET_TICKS_PER_SECOND,
    320                             &ticks_per_second);
    321           }
    322         rtems_task_wake_after((ticks_per_second+24)/25);
    323       }
    324        
    325     return c;
    326 } /* _IBMPC_inch */
    327 
    328 
    329 
    330 
    331 
    332 
  • c/src/lib/libbsp/i386/pc386/console/outch.c

    rfe602cf r3cbb63a  
    180180#endif
    181181} /* _IBMPC_initVideo */
     182
     183
     184/* for old DOS compatibility n-curses type of applications */
     185void gotoxy( int x, int y )
     186{
     187  row = x;
     188  column = y;
     189  wr_cursor(row * maxCol + column, ioCrtBaseAddr);
     190}
     191
     192
     193int whereX( void )
     194{
     195  return row;
     196}
     197
     198int whereY( void )
     199{
     200  return column;
     201}
     202
  • c/src/lib/libbsp/i386/pc386/startup/Makefile.am

    rfe602cf r3cbb63a  
    1111C_FILES = bsplibc.c bsppost.c bspstart.c exit.c irq.c irq_init.c bootcard.c \
    1212    main.c sbrk.c i386-stub.c i386-stub-glue.c uart.c pcibios.c \
    13     gnatinstallhandler.c
     13    gnatinstallhandler.c gdb_glue.c tty_drv.c
     14
    1415C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
    1516
Note: See TracChangeset for help on using the changeset viewer.