comvar.h revision 1.15
1/*	$OpenBSD: comvar.h,v 1.15 2000/02/01 01:32:39 mickey 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#ifdef COM_HAYESP
91	int sc_hayespbase;
92#endif
93
94	bus_space_handle_t sc_ioh;
95	bus_space_handle_t sc_hayespioh;
96
97	u_char sc_uarttype;
98#define COM_UART_UNKNOWN	0x00		/* unknown */
99#define COM_UART_8250		0x01		/* no fifo */
100#define COM_UART_16450		0x02		/* no fifo */
101#define COM_UART_16550		0x03		/* no working fifo */
102#define COM_UART_16550A		0x04		/* 16 byte fifo */
103#define COM_UART_ST16650	0x05		/* no working fifo */
104#define COM_UART_ST16650V2	0x06		/* 32 byte fifo */
105#define COM_UART_TI16750	0x07		/* 64 byte fifo */
106#define	COM_UART_XR16850	0x10		/* 128 byte fifo */
107
108	u_char sc_hwflags;
109#define	COM_HW_NOIEN	0x01
110#define	COM_HW_FIFO	0x02
111#define	COM_HW_HAYESP	0x04
112#define	COM_HW_CONSOLE	0x40
113	u_char sc_swflags;
114#define	COM_SW_SOFTCAR	0x01
115#define	COM_SW_CLOCAL	0x02
116#define	COM_SW_CRTSCTS	0x04
117#define	COM_SW_MDMBUF	0x08
118#define	COM_SW_PPS	0x10
119	int	sc_fifolen;
120	u_char sc_msr, sc_mcr, sc_lcr, sc_ier;
121	u_char sc_dtr;
122
123	u_char	sc_cua;
124
125	u_char	sc_initialize;		/* force initialization */
126
127	u_char *sc_ibuf, *sc_ibufp, *sc_ibufhigh, *sc_ibufend;
128	u_char sc_ibufs[2][COM_IBUFSIZE];
129
130	/* power management hooks */
131	int (*enable) __P((struct com_softc *));
132	void (*disable) __P((struct com_softc *));
133	int enabled;
134};
135
136int	comprobe1 __P((bus_space_tag_t, bus_space_handle_t));
137void	cominit __P((bus_space_tag_t, bus_space_handle_t, int));
138int	comintr __P((void *));
139int	com_detach __P((struct device *, int));
140int	com_activate __P((struct device *, enum devact));
141
142#ifdef COM_HAYESP
143int comprobeHAYESP __P((bus_space_handle_t hayespioh, struct com_softc *sc));
144#endif
145void	comdiag		__P((void *));
146int	comspeed	__P((long));
147int	comparam	__P((struct tty *, struct termios *));
148void	comstart	__P((struct tty *));
149void	compoll		__P((void *));
150
151struct consdev;
152void	comcnprobe	__P((struct consdev *));
153void	comcninit	__P((struct consdev *));
154int	comcngetc	__P((dev_t));
155void	comcnputc	__P((dev_t, int));
156void	comcnpollc	__P((dev_t, int));
157
158extern int comdefaultrate;
159extern int comconsaddr;
160extern int comconsinit;
161extern int comconsattached;
162extern bus_space_tag_t comconsiot;
163extern bus_space_handle_t comconsioh;
164extern tcflag_t comconscflag;
165