From 55bb85f22cf02644de5fec43a5b1f06f23f4aa00 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 25 Aug 1994 00:09:09 +0000 Subject: [PATCH] Initial revision --- .../standalone/i386/force_cpu386/brdinit.c | 44 +++++ .../standalone/i386/force_cpu386/console.c | 163 ++++++++++++++++++ sysdeps/standalone/i960/nindy960/brdinit.c | 66 +++++++ 3 files changed, 273 insertions(+) create mode 100644 sysdeps/standalone/i386/force_cpu386/brdinit.c create mode 100644 sysdeps/standalone/i386/force_cpu386/console.c create mode 100644 sysdeps/standalone/i960/nindy960/brdinit.c diff --git a/sysdeps/standalone/i386/force_cpu386/brdinit.c b/sysdeps/standalone/i386/force_cpu386/brdinit.c new file mode 100644 index 0000000000..46b5691d0b --- /dev/null +++ b/sysdeps/standalone/i386/force_cpu386/brdinit.c @@ -0,0 +1,44 @@ +/* Copyright (C) 1994 Free Software Foundation, Inc. + Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil), + On-Line Applications Research Corporation. + +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include "__i386.h" + +/* _Board_Initialize() + +This routine initializes the FORCE CPU386 board. */ + +void DEFUN_VOID(_Console_Initialize); + +void +DEFUN_VOID(_Board_Initialize) +{ + /* + * FORCE documentation incorrectly states that the bus request + * level is initialized to 3. It is actually initialized by + * FORCEbug to 0. + */ + + outport_byte( 0x00, 0x3f ); /* resets VMEbus request level */ + + _Console_Initialize(); +} diff --git a/sysdeps/standalone/i386/force_cpu386/console.c b/sysdeps/standalone/i386/force_cpu386/console.c new file mode 100644 index 0000000000..a9d05d35fc --- /dev/null +++ b/sysdeps/standalone/i386/force_cpu386/console.c @@ -0,0 +1,163 @@ +/* Copyright (C) 1994 Free Software Foundation, Inc. + Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil), + On-Line Applications Research Corporation. + +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include "__i386.h" + +/* Console IO routines for a FORCE CPU386 board. */ + +/* Force CPU/386 specific IO addressing + * + * The following determines whether Port B or the Console should + * be used for console I/O. Setting ONE (and only ONE) of these to 1 + * enables I/O on that port. + * + * PORT A - DUSCC MC68562 Channel A (*** not supported here ***) + * PORT B - DUSCC MC68562 Channel B + * PORT C - MFP MC68901 Channel (*** FORCEbug console ***) + */ + +#define PORTB 1 /* use port b as console */ +#define PORTC 0 /* use console port as console */ + +#if ( PORTB == 1 ) +#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 ) +#endif + +#if ( PORTC == 1 ) +#define TX_STATUS 0x12c /* MFP Transmit Status Register */ +#define RX_STATUS 0x12a /* MFP Receive Status Register */ +#define TX_BUFFER 0x12e /* MFP Transmitter Channel */ +#define RX_BUFFER 0x12e /* MFP Receiver Channel */ +#define Is_tx_ready( _status ) ( (_status) & 0x80 ) +#define Is_rx_ready( _status ) ( (_status) & 0x80 ) +#endif + +/* _Console_Initialize + +On the Force board the console require some initialization. */ + +void +DEFUN_VOID(_Console_Initialize) +{ + 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 ); +} + +/* Miscellaneous support for console IO */ + +static inline int _Force386_is_rx_ready() +{ + register unsigned8 status; + + inport_byte( RX_STATUS, status ); + + if ( Is_rx_ready( status ) ) return 1; + else return 0; +} + +static inline int _Force386_is_tx_ready() +{ + register unsigned8 status; + + inport_byte( TX_STATUS, status ); + + if ( Is_tx_ready( status ) ) return 1; + else return 0; +} + + +static inline int _Force386_read_data() +{ + 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; +} + +/* _Console_Putc + +This routine transmits a character. It supports XON/XOFF flow control. */ + +#define XON 0x11 /* control-Q */ +#define XOFF 0x13 /* control-S */ + +int +DEFUN( _Console_Putc, (ch), char ch ) +{ + 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 ); +} + +/* _Console_Getc + +This routine reads a character from the UART and returns it. */ + +int +DEFUN( _Console_Getc, (poll), int poll ) +{ + if ( poll ) { + if ( !_Force386_is_rx_ready() ) + return -1; + else + return _Force386_read_data(); + } else { + while ( !_Force386_is_rx_ready() ); + return _Force386_read_data(); + } +} diff --git a/sysdeps/standalone/i960/nindy960/brdinit.c b/sysdeps/standalone/i960/nindy960/brdinit.c new file mode 100644 index 0000000000..a59c97c0ca --- /dev/null +++ b/sysdeps/standalone/i960/nindy960/brdinit.c @@ -0,0 +1,66 @@ +/* Copyright (C) 1994 Free Software Foundation, Inc. + Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil), + On-Line Applications Research Corporation. + +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include "__i960ca.h" + +/* _Board_Initialize() + +This routine initializes the board. + +NOTE: Only tested on a Cyclone CVME961 but should be OK on any i960ca board. */ + +void +DEFUN_VOID(_Board_Initialize) +{ + struct i80960ca_prcb *prcb; /* ptr to processor control block */ + struct i80960ca_ctltbl *ctl_tbl; /* ptr to control table */ + + static inline struct i80960ca_prcb *get_prcb() + { register struct i80960ca_prcb *_prcb = 0; + asm volatile( "calls 5; \ + mov g0,%0" \ + : "=d" (_prcb) \ + : "0" (_prcb) ); + return ( _prcb ); + } + + prcb = get_prcb(); + ctl_tbl = prcb->control_tbl; + + /* The following configures the data breakpoint (which must be set + * before this is executed) to break on writes only. + */ + + ctl_tbl->bpcon &= ~0x00cc0000; + reload_ctl_group( 6 ); + + /* bit 31 of the Register Cache Control can be set to + * enable an alternative caching algorithm. It does + * not appear to help our applications. + */ + + /* Configure Number of Register Caches */ + + prcb->reg_cache_cfg = 8; + soft_reset( prcb ); +}