Ignore:
Timestamp:
09/11/95 19:35:39 (28 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
ced11f99
Parents:
5072b07
Message:

The word "RTEMS" almost completely removed from the core.

Configuration Table Template file added and all tests
modified to use this. All gvar.h and conftbl.h files
removed from test directories.

Configuration parameter maximum_devices added.

Core semaphore and mutex handlers added and RTEMS API Semaphore
Manager updated to reflect this.

Initialization sequence changed to invoke API specific initialization
routines. Initialization tasks table now owned by RTEMS Tasks Manager.

Added user extension for post-switch.

Utilized user extensions to implement API specific functionality
like signal dispatching.

Added extensions to the System Initialization Thread so that an
API can register a function to be invoked while the system
is being initialized. These are largely equivalent to the
pre-driver and post-driver hooks.

Added the Modules file oar-go32_p5, modified oar-go32, and modified
the file make/custom/go32.cfg to look at an environment varable which
determines what CPU model is being used.

All BSPs updated to reflect named devices and clock driver's IOCTL
used by the Shared Memory Driver. Also merged clock isr into
main file and removed ckisr.c where possible.

Updated spsize to reflect new and moved variables.

Makefiles for the executive source and include files updated to show
break down of files into Core, RTEMS API, and Neither.

Header and inline files installed into subdirectory based on whether
logically in the Core or a part of the RTEMS API.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/go32/console/console.c

    r5072b07 r3a4ae6c  
    99#include <stdlib.h>
    1010
    11 #include <rtems.h>
    12 #include "console.h"
    13 #include "bsp.h"
     11#include <bsp.h>
     12#include <rtems/libio.h>
    1413
    1514#include <dpmi.h>
     
    4342 */
    4443
    45 /* Set this if console I/O should use go32 (DOS) read/write calls.      */
    46 /* Otherwise, direct hardware accesses will be used.                    */
    47 int                     _IBMPC_Use_Go32_IO      = 0;
    48 
    49 static rtems_isr_entry  old_keyboard_isr        = NULL;
    50 extern void             _IBMPC_keyboard_isr( rtems_unsigned32 interrupt );
    51 
     44/* Set this if console I/O should use go32 (DOS) read/write calls.   */
     45/* Otherwise, direct hardware accesses will be used.                 */
     46
     47int      _IBMPC_Use_Go32_IO  = 0;
     48
     49static rtems_isr_entry  old_keyboard_isr  = NULL;
     50
     51extern void    _IBMPC_keyboard_isr( rtems_unsigned32 interrupt );
    5252
    5353rtems_device_driver console_initialize(
    5454  rtems_device_major_number  major,
    5555  rtems_device_minor_number  minor,
    56   void                      *arg,
    57   rtems_id                   self,
    58   rtems_unsigned32          *status
    59 )
    60 {
    61     if ( _IBMPC_Use_Go32_IO )  {
    62         /* Nothing.  We let DOS and go32 do all the work. */
    63     } else {
    64         /* Grap the keyboard interrupt so DOS doesn't steal our */
    65         /* keystrokes.                                          */
    66         rtems_status_code       status;
    67         status = rtems_interrupt_catch( _IBMPC_keyboard_isr, 9,
    68                                         &old_keyboard_isr );
    69         if ( status )  {
    70             int write( int, void *, int );
    71             void exit( int );
    72             char msg[] = "error initializing keyboard\n";
    73             write( 2, msg, sizeof msg - 1 );
    74             exit( 1 );
    75         }
     56  void                      *arg
     57)
     58{
     59  rtems_status_code status;
     60
     61  if ( _IBMPC_Use_Go32_IO )  {
     62    /* Nothing.  We let DOS and go32 do all the work. */
     63  } else {
     64    /* Grap the keyboard interrupt so DOS doesn't steal our */
     65    /* keystrokes.                                    */
     66    rtems_status_code  status;
     67
     68    status =
     69      rtems_interrupt_catch( _IBMPC_keyboard_isr, 9, &old_keyboard_isr );
     70
     71    if ( status )  {
     72      int write( int, void *, int );
     73      void exit( int );
     74
     75      char msg[] = "error initializing keyboard\n";
     76      write( 2, msg, sizeof msg - 1 );
     77      exit( 1 );
    7678    }
    77 
    78     atexit( console_cleanup );
     79  }
     80
     81  status = rtems_io_register_name(
     82    "/dev/console",
     83    major,
     84    (rtems_device_minor_number) 0
     85  );
     86 
     87  if (status != RTEMS_SUCCESSFUL)
     88    rtems_fatal_error_occurred(status);
     89 
     90  atexit( console_cleanup );
     91
     92  return RTEMS_SUCCESSFUL;
    7993}
    8094
     
    118132    outbyte( ch );
    119133    if ( ch == '\r' )
    120         outbyte( '\n' );
     134      outbyte( '\n' );
    121135#endif
    122136    return ch;
     
    139153
    140154/*
    141  * __read  -- read bytes from the console. Ignore fd, since
    142  *            we only have stdin.
    143  */
    144 
    145 int __read(
    146   int fd,
    147   char *buf,
    148   int nbytes
    149 )
    150 {
    151   int i = 0;
    152 
    153   for ( i = 0; i < nbytes; i++ ) {
    154     buf[i] = inbyte();
    155     if ( buf[i] == '\r' ) {
    156         /* What if this goes past the end of the buffer?  We're hosed. [bhc] */
    157         buf[i++] = '\n';
    158         buf[i] = '\0';
    159         break;
     155 *  Open entry point
     156 */
     157 
     158rtems_device_driver console_open(
     159  rtems_device_major_number major,
     160  rtems_device_minor_number minor,
     161  void                    * arg
     162)
     163{
     164  return RTEMS_SUCCESSFUL;
     165}
     166
     167/*
     168 *  Close entry point
     169 */
     170 
     171rtems_device_driver console_close(
     172  rtems_device_major_number major,
     173  rtems_device_minor_number minor,
     174  void                    * arg
     175)
     176{
     177  return RTEMS_SUCCESSFUL;
     178}
     179 
     180/*
     181 * read bytes from the serial port. We only have stdin.
     182 */
     183 
     184rtems_device_driver console_read(
     185  rtems_device_major_number major,
     186  rtems_device_minor_number minor,
     187  void                    * arg
     188)
     189{
     190  rtems_libio_rw_args_t *rw_args;
     191  char *buffer;
     192  int maximum;
     193  int count = 0;
     194 
     195  rw_args = (rtems_libio_rw_args_t *) arg;
     196 
     197  buffer = rw_args->buffer;
     198  maximum = rw_args->count;
     199 
     200  for (count = 0; count < maximum; count++) {
     201    buffer[ count ] = inbyte();
     202    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
     203      /* What if this goes past the end of the buffer?  We're hosed. [bhc] */
     204      buffer[ count++ ]  = '\n';
     205      buffer[ count ]  = 0;
     206      break;
    160207    }
    161208  }
    162   return i;
    163 }
    164 
    165 /*
    166  * __write -- write bytes to the console. Ignore fd, since
    167  *            stdout and stderr are the same. Since we have no filesystem,
    168  *            open will only return an error.
    169  */
    170 
    171 int __write(
    172   int fd,
    173   char *buf,
    174   int nbytes
    175 )
    176 {
    177   int i;
    178 
    179   for (i = 0; i < nbytes; i++) {
    180     if (*(buf + i) == '\n') {
    181       outbyte ('\r');
     209 
     210  rw_args->bytes_moved = count;
     211  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
     212}
     213 
     214/*
     215 * write bytes to the serial port. Stdout and stderr are the same.
     216 */
     217 
     218rtems_device_driver console_write(
     219  rtems_device_major_number major,
     220  rtems_device_minor_number minor,
     221  void                    * arg
     222)
     223{
     224  int count;
     225  int maximum;
     226  rtems_libio_rw_args_t *rw_args;
     227  char *buffer;
     228 
     229  rw_args = (rtems_libio_rw_args_t *) arg;
     230 
     231  buffer = rw_args->buffer;
     232  maximum = rw_args->count;
     233 
     234  for (count = 0; count < maximum; count++) {
     235    if ( buffer[ count ] == '\n') {
     236      outbyte('\r');
    182237    }
    183     outbyte (*(buf + i));
     238    outbyte( buffer[ count ] );
    184239  }
    185   return (nbytes);
    186 }
     240  return maximum;
     241}
     242 
     243/*
     244 *  IO Control entry point
     245 */
     246 
     247rtems_device_driver console_control(
     248  rtems_device_major_number major,
     249  rtems_device_minor_number minor,
     250  void                    * arg
     251)
     252{
     253  return RTEMS_SUCCESSFUL;
     254}
     255
Note: See TracChangeset for help on using the changeset viewer.