Changeset 1d1b1507 in rtems


Ignore:
Timestamp:
May 27, 1999, 4:08:40 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
5adf355a
Parents:
2a333f9
Message:

Split out polled io, debug puts, and console reserve resources to
reduce dependencies and shrink minimum executable size.

Location:
c/src/lib/libbsp/sparc/erc32/console
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/erc32/console/Makefile.in

    r2a333f9 r1d1b1507  
    1919
    2020# C source names, if any, go here -- minus the .c
    21 C_PIECES=console
     21C_PIECES=console consolereserveresources debugputs
    2222C_FILES=$(C_PIECES:%=%.c)
    2323C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
  • c/src/lib/libbsp/sparc/erc32/console/console.c

    r2a333f9 r1d1b1507  
    4646  int  port,
    4747  char ch
    48 )
    49 {
    50   if ( port == 0 ) {
    51     while ( (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA) == 0 );
    52     ERC32_MEC.UART_Channel_A = (int) ch;
    53     return;
    54   }
    55 
    56   while ( (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB) == 0 );
    57   ERC32_MEC.UART_Channel_B = (int) ch;
    58 }
     48);
     49
     50/* body is in debugputs.c */
    5951
    6052/*
     
    6456 */
    6557
    66 int console_inbyte_nonblocking( int port )
    67 {
    68   int UStat;
    69 
    70   UStat = ERC32_MEC.UART_Status;
    71 
    72   switch (port) {
    73 
    74     case 0:
    75       if (UStat & ERC32_MEC_UART_STATUS_ERRA) {
    76         ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRA;
    77         ERC32_MEC.Control = ERC32_MEC.Control;
    78       }
    79 
    80       if ((UStat & ERC32_MEC_UART_STATUS_DRA) == 0)
    81          return -1;
    82       return (int) ERC32_MEC.UART_Channel_A;
    83       return 1;
    84 
    85     case 1:
    86       if (UStat & ERC32_MEC_UART_STATUS_ERRB) {
    87         ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRB;
    88         ERC32_MEC.Control = ERC32_MEC.Control;
    89       }
    90 
    91       if ((UStat & ERC32_MEC_UART_STATUS_DRB) == 0)
    92         return -1;
    93       return (int) ERC32_MEC.UART_Channel_B;
    94 
    95     default:
    96       assert( 0 );
    97   }
    98 
    99   return -1;
    100 }
     58int console_inbyte_nonblocking( int port );
     59
     60/* body is in debugputs.c */
    10161
    10262/*
     
    319279
    320280/*
    321  *  DEBUG_puts
    322  *
    323  *  This should be safe in the event of an error.  It attempts to insure
    324  *  that no TX empty interrupts occur while it is doing polled IO.  Then
    325  *  it restores the state of that external interrupt.
    326  *
    327  *  Input parameters:
    328  *    string  - pointer to debug output string
    329  *
    330  *  Output parameters:  NONE
    331  *
    332  *  Return values:      NONE
    333  */
    334 
    335 void DEBUG_puts(
    336   char *string
    337 )
    338 {
    339   char *s;
    340   unsigned32 old_level;
    341 
    342   ERC32_Disable_interrupt( ERC32_INTERRUPT_UART_A_RX_TX, old_level );
    343     for ( s = string ; *s ; s++ )
    344       console_outbyte_polled( 0, *s );
    345 
    346     console_outbyte_polled( 0, '\r' );
    347     console_outbyte_polled( 0, '\n' );
    348   ERC32_Restore_interrupt( ERC32_INTERRUPT_UART_A_RX_TX, old_level );
    349 }
    350 
    351 /*
    352281 *  Console Termios Support Entry Points
    353282 *
     
    367296  }
    368297  return nwrite;
    369 }
    370 
    371 void console_reserve_resources(
    372   rtems_configuration_table *configuration
    373 )
    374 {
    375   rtems_termios_reserve_resources( configuration, 2 );
    376298}
    377299
Note: See TracChangeset for help on using the changeset viewer.