comvar.h revision 1.7
1/*	$OpenBSD: comvar.h,v 1.7 1997/01/29 17:56:35 niklas Exp $	*/
2/*	$NetBSD: comvar.h,v 1.5 1996/05/05 19:50:47 christos Exp $	*/
3
4/*
5 * Copyright (c) 1996 Christopher G. Demetriou.  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 Christopher G. Demetriou
18 *	for the NetBSD Project.
19 * 4. The name of the author may not be used to endorse or promote products
20 *    derived from this software without specific prior written permission
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34struct commulti_attach_args {
35	int		ca_slave;		/* slave number */
36
37	bus_space_tag_t ca_iot;
38	bus_space_handle_t ca_ioh;
39	int		ca_iobase;
40	int		ca_noien;
41};
42
43#define	COM_IBUFSIZE	(2 * 512)
44#define	COM_IHIGHWATER	((3 * COM_IBUFSIZE) / 4)
45
46struct com_softc {
47	struct device sc_dev;
48	void *sc_ih;
49	bus_space_tag_t sc_iot;
50	struct tty *sc_tty;
51
52	int sc_overflows;
53	int sc_floods;
54	int sc_errors;
55
56	int sc_halt;
57
58	int sc_iobase;
59#ifdef COM_HAYESP
60	int sc_hayespbase;
61#endif
62
63	bus_space_handle_t sc_ioh;
64	bus_space_handle_t sc_hayespioh;
65	isa_chipset_tag_t sc_ic;
66
67	u_char sc_hwflags;
68#define	COM_HW_NOIEN	0x01
69#define	COM_HW_FIFO	0x02
70#define	COM_HW_HAYESP	0x04
71#define	COM_HW_ABSENT_PENDING	0x08	/* reattached, awaiting close/reopen */
72#define	COM_HW_ABSENT	0x10		/* configure actually failed, or removed */
73#define	COM_HW_REATTACH	0x20		/* reattaching */
74#define	COM_HW_CONSOLE	0x40
75	u_char sc_swflags;
76#define	COM_SW_SOFTCAR	0x01
77#define	COM_SW_CLOCAL	0x02
78#define	COM_SW_CRTSCTS	0x04
79#define	COM_SW_MDMBUF	0x08
80	u_char sc_msr, sc_mcr, sc_lcr, sc_ier;
81	u_char sc_dtr;
82
83	u_char	sc_cua;
84
85	u_char	sc_initialize;		/* force initialization */
86
87	u_char *sc_ibuf, *sc_ibufp, *sc_ibufhigh, *sc_ibufend;
88	u_char sc_ibufs[2][COM_IBUFSIZE];
89};
90
91int	comprobe1 __P((bus_space_tag_t, bus_space_handle_t, int));
92void	cominit __P((bus_space_tag_t, bus_space_handle_t, int));
93int	comintr __P((void *));
94void	com_absent_notify __P((struct com_softc *sc));
95
96#ifdef COM_HAYESP
97int comprobeHAYESP __P((bus_space_handle_t hayespioh, struct com_softc *sc));
98#endif
99void	comdiag		__P((void *));
100int	comspeed	__P((long));
101int	comparam	__P((struct tty *, struct termios *));
102void	comstart	__P((struct tty *));
103void	compoll		__P((void *));
104
105struct consdev;
106void	comcnprobe	__P((struct consdev *));
107void	comcninit	__P((struct consdev *));
108int	comcngetc	__P((dev_t));
109void	comcnputc	__P((dev_t, int));
110void	comcnpollc	__P((dev_t, int));
111
112extern int comdefaultrate;
113extern int comconsaddr;
114extern int comconsinit;
115extern int comconsattached;
116extern bus_space_tag_t comconsiot;
117extern bus_space_handle_t comconsioh;
118extern tcflag_t comconscflag;
119