ns16550.h revision 1.1
11.1Scdi/*	$NetBSD: ns16550.h,v 1.1 2003/06/25 17:24:22 cdi Exp $	*/
21.1Scdi
31.1Scdi/*-
41.1Scdi * Copyright (C) 1995-1997 Gary Thomas (gdt@linuxppc.org)
51.1Scdi * All rights reserved.
61.1Scdi *
71.1Scdi * Redistribution and use in source and binary forms, with or without
81.1Scdi * modification, are permitted provided that the following conditions
91.1Scdi * are met:
101.1Scdi * 1. Redistributions of source code must retain the above copyright
111.1Scdi *    notice, this list of conditions and the following disclaimer.
121.1Scdi * 2. Redistributions in binary form must reproduce the above copyright
131.1Scdi *    notice, this list of conditions and the following disclaimer in the
141.1Scdi *    documentation and/or other materials provided with the distribution.
151.1Scdi * 3. All advertising materials mentioning features or use of this software
161.1Scdi *    must display the following acknowledgement:
171.1Scdi *      This product includes software developed by Gary Thomas.
181.1Scdi * 4. The name of the author may not be used to endorse or promote products
191.1Scdi *    derived from this software without specific prior written permission.
201.1Scdi *
211.1Scdi * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
221.1Scdi * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
231.1Scdi * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
241.1Scdi * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
251.1Scdi * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
261.1Scdi * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
271.1Scdi * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
281.1Scdi * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
291.1Scdi * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
301.1Scdi * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
311.1Scdi */
321.1Scdi
331.1Scdi/*
341.1Scdi * NS16550 Serial Port
351.1Scdi */
361.1Scdi
371.1Scdistruct NS16550
381.1Scdi	{
391.1Scdi		volatile unsigned char rbr;  /* 0 */
401.1Scdi		volatile unsigned char ier;  /* 1 */
411.1Scdi		volatile unsigned char fcr;  /* 2 */
421.1Scdi		volatile unsigned char lcr;  /* 3 */
431.1Scdi		volatile unsigned char mcr;  /* 4 */
441.1Scdi		volatile unsigned char lsr;  /* 5 */
451.1Scdi		volatile unsigned char msr;  /* 6 */
461.1Scdi		volatile unsigned char scr;  /* 7 */
471.1Scdi	};
481.1Scdi
491.1Scdi#define thr rbr
501.1Scdi#define iir fcr
511.1Scdi#define dll rbr
521.1Scdi#define dlm ier
531.1Scdi
541.1Scdi#define LSR_DR   0x01  /* Data ready */
551.1Scdi#define LSR_OE   0x02  /* Overrun */
561.1Scdi#define LSR_PE   0x04  /* Parity error */
571.1Scdi#define LSR_FE   0x08  /* Framing error */
581.1Scdi#define LSR_BI   0x10  /* Break */
591.1Scdi#define LSR_THRE 0x20  /* Xmit holding register empty */
601.1Scdi#define LSR_TEMT 0x40  /* Xmitter empty */
611.1Scdi#define LSR_ERR  0x80  /* Error */
621.1Scdi
631.1Scdi#define LCR_EERS 0xBF  /* Enable access to Enhanced Register Set */
641.1Scdi#define LCR_DLAB 0x80  /* Divisor latch access enable */
651.1Scdi
661.1Scdi#ifndef COMBASE
671.1Scdi#define COMBASE	0x80000000
681.1Scdi#endif
691.1Scdi
701.1Scdi#ifndef COMPROBE
711.1Scdi#define COMPROBE 0xa020001c
721.1Scdi#endif
731.1Scdi
741.1Scdiextern volatile struct NS16550 *NS16550_init __P((int, int));
751.1Scdiextern void NS16550_putc __P((volatile struct NS16550 *, int));
761.1Scdiextern int NS16550_getc __P((volatile struct NS16550 *));
771.1Scdiextern int NS16550_scankbd __P((volatile struct NS16550 *));
781.1Scdiextern int NS16550_test __P((volatile struct NS16550 *));
79