comvar.h revision 1.18
1/* $OpenBSD: comvar.h,v 1.18 2001/01/24 09:38:04 hugh Exp $ */ 2/* $NetBSD: comvar.h,v 1.5 1996/05/05 19:50:47 christos Exp $ */ 3 4/* 5 * Copyright (c) 1997 - 1998, Jason Downs. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by Jason Downs for the 18 * OpenBSD system. 19 * 4. Neither the name(s) of the author(s) nor the name OpenBSD 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS 24 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, 27 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 */ 35/* 36 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. 37 * 38 * Redistribution and use in source and binary forms, with or without 39 * modification, are permitted provided that the following conditions 40 * are met: 41 * 1. Redistributions of source code must retain the above copyright 42 * notice, this list of conditions and the following disclaimer. 43 * 2. Redistributions in binary form must reproduce the above copyright 44 * notice, this list of conditions and the following disclaimer in the 45 * documentation and/or other materials provided with the distribution. 46 * 3. All advertising materials mentioning features or use of this software 47 * must display the following acknowledgement: 48 * This product includes software developed by Christopher G. Demetriou 49 * for the NetBSD Project. 50 * 4. The name of the author may not be used to endorse or promote products 51 * derived from this software without specific prior written permission 52 * 53 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 54 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 55 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 56 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 57 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 58 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 59 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 60 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 61 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 62 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 63 */ 64 65struct commulti_attach_args { 66 int ca_slave; /* slave number */ 67 68 bus_space_tag_t ca_iot; 69 bus_space_handle_t ca_ioh; 70 int ca_iobase; 71 int ca_noien; 72}; 73 74#define COM_IBUFSIZE (2 * 512) 75#define COM_IHIGHWATER ((3 * COM_IBUFSIZE) / 4) 76 77struct com_softc { 78 struct device sc_dev; 79 void *sc_ih; 80 bus_space_tag_t sc_iot; 81 struct tty *sc_tty; 82 83 int sc_overflows; 84 int sc_floods; 85 int sc_errors; 86 87 int sc_halt; 88 89 int sc_iobase; 90 int sc_frequency; 91#ifdef COM_HAYESP 92 int sc_hayespbase; 93#endif 94 95 bus_space_handle_t sc_ioh; 96 bus_space_handle_t sc_hayespioh; 97 98 u_char sc_uarttype; 99#define COM_UART_UNKNOWN 0x00 /* unknown */ 100#define COM_UART_8250 0x01 /* no fifo */ 101#define COM_UART_16450 0x02 /* no fifo */ 102#define COM_UART_16550 0x03 /* no working fifo */ 103#define COM_UART_16550A 0x04 /* 16 byte fifo */ 104#define COM_UART_ST16650 0x05 /* no working fifo */ 105#define COM_UART_ST16650V2 0x06 /* 32 byte fifo */ 106#define COM_UART_TI16750 0x07 /* 64 byte fifo */ 107#define COM_UART_XR16850 0x10 /* 128 byte fifo */ 108 109 u_char sc_hwflags; 110#define COM_HW_NOIEN 0x01 111#define COM_HW_FIFO 0x02 112#define COM_HW_HAYESP 0x04 113#define COM_HW_CONSOLE 0x40 114#define COM_HW_KGDB 0x80 115 u_char sc_swflags; 116#define COM_SW_SOFTCAR 0x01 117#define COM_SW_CLOCAL 0x02 118#define COM_SW_CRTSCTS 0x04 119#define COM_SW_MDMBUF 0x08 120#define COM_SW_PPS 0x10 121 int sc_fifolen; 122 u_char sc_msr, sc_mcr, sc_lcr, sc_ier; 123 u_char sc_dtr; 124 125 u_char sc_cua; 126 127 u_char sc_initialize; /* force initialization */ 128 129 u_char *sc_ibuf, *sc_ibufp, *sc_ibufhigh, *sc_ibufend; 130 u_char sc_ibufs[2][COM_IBUFSIZE]; 131 132 /* power management hooks */ 133 int (*enable) __P((struct com_softc *)); 134 void (*disable) __P((struct com_softc *)); 135 int enabled; 136}; 137 138int comprobe1 __P((bus_space_tag_t, bus_space_handle_t)); 139void cominit __P((bus_space_tag_t, bus_space_handle_t, int)); 140int comstop __P((struct tty *, int)); 141int comintr __P((void *)); 142int com_detach __P((struct device *, int)); 143int com_activate __P((struct device *, enum devact)); 144 145#ifdef COM_HAYESP 146int comprobeHAYESP __P((bus_space_handle_t hayespioh, struct com_softc *sc)); 147#endif 148void comdiag __P((void *)); 149int comspeed __P((long)); 150u_char com_cflag2lcr __P((tcflag_t)); 151int comparam __P((struct tty *, struct termios *)); 152void comstart __P((struct tty *)); 153void compoll __P((void *)); 154 155struct consdev; 156void comcnprobe __P((struct consdev *)); 157int comcnattach __P((bus_space_tag_t, int, int, int, tcflag_t)); 158void comcninit __P((struct consdev *)); 159int comcngetc __P((dev_t)); 160void comcnputc __P((dev_t, int)); 161void comcnpollc __P((dev_t, int)); 162int com_common_getc __P((bus_space_tag_t, bus_space_handle_t)); 163void com_common_putc __P((bus_space_tag_t, bus_space_handle_t, int)); 164 165#if defined(DDB) || defined(KGDB) 166void com_enable_debugport __P((struct com_softc *)); 167#endif 168 169#ifdef KGDB 170int com_kgdb_attach __P((bus_space_tag_t, int, int, int, tcflag_t)); 171int kgdbintr __P((void *)); 172#endif 173 174int comcnattach __P((bus_space_tag_t, int, int, int, tcflag_t)); 175 176extern int comdefaultrate; 177extern int comconsaddr; 178extern int comconsinit; 179extern int comconsattached; 180extern bus_space_tag_t comconsiot; 181extern bus_space_handle_t comconsioh; 182extern tcflag_t comconscflag; 183