comvar.h revision 1.8 1 /* $NetBSD: comvar.h,v 1.8 1997/04/04 20:56:40 mycroft Exp $ */
2
3 /*
4 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Christopher G. Demetriou
17 * for the NetBSD Project.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 extern int comconsaddr;
34 extern int comconsattached;
35 extern bus_space_tag_t comconstag;
36 extern bus_space_handle_t comconsioh;
37 extern tcflag_t comconscflag;
38
39 /* Hardware flag masks */
40 #define COM_HW_NOIEN 0x01
41 #define COM_HW_FIFO 0x02
42 #define COM_HW_HAYESP 0x04
43 #define COM_HW_CONSOLE 0x40
44
45 /* Buffer size for character buffer */
46 #define RXBUFSIZE 2048 /* More than enough.. */
47 #define RXBUFMASK (RXBUFSIZE-1) /* Only iff previous is a power of 2 */
48 #define RXHIWAT (RXBUFSIZE >> 2)
49
50 struct com_softc {
51 struct device sc_dev;
52 void *sc_ih;
53 void *sc_si;
54 struct tty *sc_tty;
55
56 int sc_overflows;
57 int sc_floods;
58 int sc_errors;
59
60 int sc_iobase;
61
62 bus_space_tag_t sc_iot;
63 bus_space_handle_t sc_ioh;
64 bus_space_handle_t sc_hayespioh;
65
66 u_char sc_hwflags;
67 u_char sc_swflags;
68 int sc_fifolen;
69
70 u_char sc_msr, sc_msr_delta, sc_msr_mask, sc_mcr, sc_mcr_active, sc_lcr,
71 sc_ier, sc_fifo, sc_dlbl, sc_dlbh;
72 u_char sc_mcr_dtr, sc_mcr_rts, sc_msr_cts, sc_msr_dcd;
73
74 int sc_r_hiwat;
75 volatile u_int sc_rbget;
76 volatile u_int sc_rbput;
77 volatile u_int sc_rbavail;
78 u_char sc_rbuf[RXBUFSIZE];
79 u_char sc_lbuf[RXBUFSIZE];
80
81 u_char *sc_tba;
82 int sc_tbc,
83 sc_heldtbc;
84
85 volatile u_char sc_rx_blocked,
86 sc_tx_busy,
87 sc_tx_done,
88 sc_tx_stopped,
89 sc_st_check,
90 sc_rx_ready;
91
92 volatile u_char sc_heldchange;
93 };
94
95 /* Macros to clear/set/test flags. */
96 #define SET(t, f) (t) |= (f)
97 #define CLR(t, f) (t) &= ~(f)
98 #define ISSET(t, f) ((t) & (f))
99
100 int comprobe1 __P((bus_space_tag_t, bus_space_handle_t, int));
101 int comintr __P((void *));
102 void com_attach_subr __P((struct com_softc *));
103 void cominit __P((bus_space_tag_t, bus_space_handle_t, int));
104
105 #ifndef __GENERIC_SOFT_INTERRUPTS
106 #ifdef alpha
107 #define IPL_SERIAL IPL_TTY
108 #define splserial() spltty()
109 #define IPL_SOFTSERIAL IPL_TTY
110 #define splsoftserial() spltty()
111 #endif
112 #endif
113
114 #ifndef __BROKEN_INDIRECT_CONFIG
115 #define __CGD_INDIRECT_CONFIG
116 #endif
117