epcomvar.h revision 1.2 1 1.1 joff /* $NetBSD: epcomvar.h,v 1.2 2004/12/29 06:31:32 joff Exp $ */
2 1.1 joff /*-
3 1.1 joff * Copyright (c) 2004 Jesse Off
4 1.1 joff *
5 1.1 joff * Redistribution and use in source and binary forms, with or without
6 1.1 joff * modification, are permitted provided that the following conditions
7 1.1 joff * are met:
8 1.1 joff * 1. Redistributions of source code must retain the above copyright
9 1.1 joff * notice, this list of conditions and the following disclaimer.
10 1.1 joff * 2. Redistributions in binary form must reproduce the above copyright
11 1.1 joff * notice, this list of conditions and the following disclaimer in the
12 1.1 joff * documentation and/or other materials provided with the distribution.
13 1.1 joff * 3. All advertising materials mentioning features or use of this software
14 1.1 joff * must display the following acknowledgement:
15 1.1 joff * This product includes software developed by the NetBSD
16 1.1 joff * Foundation, Inc. and its contributors.
17 1.1 joff * 4. Neither the name of The NetBSD Foundation nor the names of its
18 1.1 joff * contributors may be used to endorse or promote products derived
19 1.1 joff * from this software without specific prior written permission.
20 1.1 joff * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 1.1 joff * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 1.1 joff * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 1.1 joff * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 1.1 joff * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 1.1 joff * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 1.1 joff * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 1.1 joff * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 1.1 joff * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 1.1 joff * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 1.1 joff * SUCH DAMAGE.
31 1.1 joff *
32 1.1 joff */
33 1.1 joff
34 1.1 joff #ifndef _EPCOMVAR_H_
35 1.1 joff #define _EPCOMVAR_H_
36 1.1 joff
37 1.1 joff /* Hardware flag masks */
38 1.1 joff #define COM_HW_NOIEN 0x01
39 1.1 joff #define COM_HW_DEV_OK 0x20
40 1.1 joff #define COM_HW_CONSOLE 0x40
41 1.1 joff #define COM_HW_KGDB 0x80
42 1.1 joff
43 1.1 joff #define RX_TTY_BLOCKED 0x01
44 1.1 joff #define RX_TTY_OVERFLOWED 0x02
45 1.1 joff #define RX_IBUF_BLOCKED 0x04
46 1.1 joff #define RX_IBUF_OVERFLOWED 0x08
47 1.1 joff #define RX_ANY_BLOCK 0x0f
48 1.1 joff
49 1.1 joff #define EPCOM_RING_SIZE 2048
50 1.1 joff
51 1.1 joff struct epcom_softc {
52 1.1 joff struct device sc_dev;
53 1.1 joff bus_addr_t sc_hwbase;
54 1.1 joff bus_space_tag_t sc_iot;
55 1.1 joff bus_space_handle_t sc_ioh;
56 1.1 joff
57 1.1 joff void *sc_si;
58 1.1 joff
59 1.1 joff struct tty *sc_tty;
60 1.1 joff
61 1.1 joff u_char *sc_rbuf, *sc_ebuf;
62 1.1 joff
63 1.1 joff u_char *sc_tba;
64 1.2 joff u_int sc_tbc;
65 1.1 joff
66 1.1 joff u_char *volatile sc_rbget,
67 1.1 joff *volatile sc_rbput;
68 1.1 joff volatile u_int sc_rbavail;
69 1.1 joff
70 1.1 joff /* status flags */
71 1.1 joff int sc_hwflags, sc_swflags;
72 1.1 joff
73 1.1 joff volatile u_int sc_rx_flags,
74 1.1 joff sc_tx_busy,
75 1.1 joff sc_tx_done,
76 1.1 joff sc_tx_stopped,
77 1.1 joff sc_st_check,
78 1.1 joff sc_rx_ready;
79 1.1 joff
80 1.1 joff /* control registers */
81 1.1 joff u_int sc_lcrlo;
82 1.1 joff u_int sc_lcrmid;
83 1.1 joff u_int sc_lcrhi;
84 1.1 joff u_int sc_ctrl;
85 1.1 joff
86 1.1 joff /* power management hooks */
87 1.1 joff int (*enable)(struct epcom_softc *);
88 1.1 joff int (*disable)(struct epcom_softc *);
89 1.1 joff
90 1.1 joff int enabled;
91 1.1 joff #if NRND > 0 && defined(RND_COM)
92 1.1 joff rndsource_element_t rnd_source;
93 1.1 joff #endif
94 1.1 joff };
95 1.1 joff
96 1.1 joff void epcom_attach_subr(struct epcom_softc *);
97 1.1 joff
98 1.1 joff int epcomintr(void* arg);
99 1.1 joff int epcomcnattach(bus_space_tag_t, bus_addr_t, bus_space_handle_t,
100 1.1 joff int, tcflag_t);
101 1.1 joff
102 1.1 joff #endif /* _EPCOMVAR_H_ */
103