1 /* Copyright (C) 1994, 1996 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
4 On-Line Applications Research Corporation.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 #include <standalone.h>
24 /* Console IO routines for a Motorola MVME135/MVME136 board.
26 They currently use the B port. It should be possible to
27 use the A port by filling in the reset of the chip structure,
28 adding an ifdef for PORTA/PORTB, and switching the addresses,
29 and maybe the macros based on the macro. */
31 /* M68681 DUART chip register structures and constants */
34 volatile unsigned char fill1
[ 5 ]; /* channel A regs ( not used ) */
35 volatile unsigned char isr
; /* interrupt status reg */
36 volatile unsigned char fill2
[ 2 ]; /* counter regs (not used) */
37 volatile unsigned char mr1mr2b
; /* MR1B and MR2B regs */
38 volatile unsigned char srb
; /* status reg channel B */
39 volatile unsigned char fill3
; /* do not access */
40 volatile unsigned char rbb
; /* receive buffer channel B */
41 volatile unsigned char ivr
; /* interrupt vector register */
45 volatile unsigned char fill1
[ 4 ]; /* channel A regs (not used) */
46 volatile unsigned char acr
; /* auxillary control reg */
47 volatile unsigned char imr
; /* interrupt mask reg */
48 volatile unsigned char fill2
[ 2 ]; /* counter regs (not used) */
49 volatile unsigned char mr1mr2b
; /* MR1B and MR2B regs */
50 volatile unsigned char csrb
; /* clock select reg */
51 volatile unsigned char crb
; /* command reg */
52 volatile unsigned char tbb
; /* transmit buffer channel B */
53 volatile unsigned char ivr
; /* interrupt vector register */
56 #define RD_M68681 ((r_m681_info *)0xfffb0040) /* ptr to the M68681 */
57 #define WR_M68681 ((w_m681_info *)0xfffb0040) /* ptr to the M68681 */
58 #define RXRDYB 0x01 /* status reg recv ready mask */
59 #define TXRDYB 0x04 /* status reg trans ready mask */
63 This routine transmits a character out the M68681. It supports
64 XON/XOFF flow control. */
66 #define XON 0x11 /* control-Q */
67 #define XOFF 0x13 /* control-S */
73 while ( ! (RD_M68681
->srb
& TXRDYB
) ) ;
74 while ( RD_M68681
->srb
& RXRDYB
) /* must be an XOFF */
75 if ( RD_M68681
->rbb
== XOFF
)
77 while ( ! (RD_M68681
->srb
& RXRDYB
) ) ;
78 } while ( RD_M68681
->rbb
!= XON
);
86 This routine reads a character from the UART and returns it. */
93 if ( !(RD_M68681
->srb
& RXRDYB
) )
96 return RD_M68681
->rbb
;
98 while ( !(RD_M68681
->srb
& RXRDYB
) );
99 return RD_M68681
->rbb
;