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