Back to index

glibc  2.9
Defines | Functions
console.c File Reference
#include <standalone.h>
#include "i386.h"

Go to the source code of this file.

Defines

#define PORTB   1 /* use port b as console */
#define PORTC   0 /* use console port as console */
#define TX_STATUS   0x1b6 /* DUSCC General Status Register */
#define RX_STATUS   0x1b6 /* DUSCC General Status Register */
#define TX_BUFFER   0x1e0 /* DUSCC Transmitter Channel B */
#define RX_BUFFER   0x1e8 /* DUSCC Receiver Channel B */
#define Is_tx_ready(_status)   ( (_status) & 0x20 )
#define Is_rx_ready(_status)   ( (_status) & 0x10 )
#define XON   0x11 /* control-Q */
#define XOFF   0x13 /* control-S */

Functions

void _Console_Initialize ()
static int _Force386_is_rx_ready ()
static int _Force386_is_tx_ready ()
static int _Force386_read_data ()
int _Console_Putc (char ch)
int _Console_Getc (int poll)

Define Documentation

#define Is_rx_ready (   _status)    ( (_status) & 0x10 )

Definition at line 46 of file console.c.

#define Is_tx_ready (   _status)    ( (_status) & 0x20 )

Definition at line 45 of file console.c.

#define PORTB   1 /* use port b as console */

Definition at line 37 of file console.c.

#define PORTC   0 /* use console port as console */

Definition at line 38 of file console.c.

#define RX_BUFFER   0x1e8 /* DUSCC Receiver Channel B */

Definition at line 44 of file console.c.

#define RX_STATUS   0x1b6 /* DUSCC General Status Register */

Definition at line 42 of file console.c.

#define TX_BUFFER   0x1e0 /* DUSCC Transmitter Channel B */

Definition at line 43 of file console.c.

#define TX_STATUS   0x1b6 /* DUSCC General Status Register */

Definition at line 41 of file console.c.

#define XOFF   0x13 /* control-S */

Definition at line 123 of file console.c.

#define XON   0x11 /* control-Q */

Definition at line 122 of file console.c.


Function Documentation

int _Console_Getc ( int  poll)

Definition at line 151 of file console.c.

{
  if ( poll ) {
    if ( !_Force386_is_rx_ready() )
      return -1;
    else
      return _Force386_read_data();
  } else {
    while ( !_Force386_is_rx_ready() );
    return _Force386_read_data();
  }
}

Here is the call graph for this function:

void _Console_Initialize ( void  )

Definition at line 63 of file console.c.

{
  register unsigned8 ignored;

  /* FORCE technical support mentioned that it may be necessary to
     read the DUSCC RX_BUFFER port four times to remove all junk.
     This code is a little more paranoid.  */

  inport_byte( RX_BUFFER, ignored );
  inport_byte( RX_BUFFER, ignored );
  inport_byte( RX_BUFFER, ignored );
  inport_byte( RX_BUFFER, ignored );
  inport_byte( RX_BUFFER, ignored );
}

Here is the caller graph for this function:

int _Console_Putc ( char  ch)

Definition at line 126 of file console.c.

{
  register unsigned8 inch;

  while ( !_Force386_is_tx_ready() );

  while ( _Force386_is_rx_ready() == 1 ) {      /* must be an XOFF */
    inch = _Force386_read_data();
    if ( inch == XOFF )
      do {
        while ( _Force386_is_rx_ready() == 0 );
        inch = _Force386_read_data();
      } while ( inch != XON );
  }

  outport_byte( TX_BUFFER, ch );
  return( 0 );
}

Here is the call graph for this function:

static int _Force386_is_rx_ready ( ) [inline, static]

Definition at line 80 of file console.c.

{
  register unsigned8 status;

  inport_byte( RX_STATUS, status );

  if ( Is_rx_ready( status ) ) return 1;
  else                         return 0;
}

Here is the caller graph for this function:

static int _Force386_is_tx_ready ( ) [inline, static]

Definition at line 90 of file console.c.

{
  register unsigned8 status;

  inport_byte( TX_STATUS, status );

  if ( Is_tx_ready( status ) ) return 1;
  else                         return 0;
}

Here is the caller graph for this function:

static int _Force386_read_data ( ) [inline, static]

Definition at line 101 of file console.c.

{
  register unsigned8 ch;

#if ( PORTB == 1 )
    /* Force example code resets the Channel B Receiver here.
     * It appears to cause XON's to be lost.
     */

     /* outport_byte( RX_STATUS, 0x10 );  */
#endif

  inport_byte( RX_BUFFER, ch );

  return ch;
}

Here is the call graph for this function:

Here is the caller graph for this function: