epcomvar.h revision 1.5 1 1.5 tls /* $NetBSD: epcomvar.h,v 1.5 2011/11/19 22:51:19 tls 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.4 snj *
14 1.1 joff * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
15 1.1 joff * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 1.1 joff * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 1.1 joff * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
18 1.1 joff * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 1.1 joff * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 1.1 joff * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 1.1 joff * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 1.1 joff * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 1.1 joff * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 1.1 joff * SUCH DAMAGE.
25 1.1 joff *
26 1.1 joff */
27 1.1 joff
28 1.1 joff #ifndef _EPCOMVAR_H_
29 1.1 joff #define _EPCOMVAR_H_
30 1.1 joff
31 1.1 joff /* Hardware flag masks */
32 1.1 joff #define COM_HW_NOIEN 0x01
33 1.1 joff #define COM_HW_DEV_OK 0x20
34 1.1 joff #define COM_HW_CONSOLE 0x40
35 1.1 joff #define COM_HW_KGDB 0x80
36 1.1 joff
37 1.1 joff #define RX_TTY_BLOCKED 0x01
38 1.1 joff #define RX_TTY_OVERFLOWED 0x02
39 1.1 joff #define RX_IBUF_BLOCKED 0x04
40 1.1 joff #define RX_IBUF_OVERFLOWED 0x08
41 1.1 joff #define RX_ANY_BLOCK 0x0f
42 1.1 joff
43 1.1 joff #define EPCOM_RING_SIZE 2048
44 1.1 joff
45 1.1 joff struct epcom_softc {
46 1.1 joff struct device sc_dev;
47 1.1 joff bus_addr_t sc_hwbase;
48 1.1 joff bus_space_tag_t sc_iot;
49 1.1 joff bus_space_handle_t sc_ioh;
50 1.1 joff
51 1.1 joff void *sc_si;
52 1.1 joff
53 1.1 joff struct tty *sc_tty;
54 1.1 joff
55 1.1 joff u_char *sc_rbuf, *sc_ebuf;
56 1.1 joff
57 1.1 joff u_char *sc_tba;
58 1.2 joff u_int sc_tbc;
59 1.1 joff
60 1.1 joff u_char *volatile sc_rbget,
61 1.1 joff *volatile sc_rbput;
62 1.1 joff volatile u_int sc_rbavail;
63 1.1 joff
64 1.1 joff /* status flags */
65 1.1 joff int sc_hwflags, sc_swflags;
66 1.1 joff
67 1.1 joff volatile u_int sc_rx_flags,
68 1.1 joff sc_tx_busy,
69 1.1 joff sc_tx_done,
70 1.1 joff sc_tx_stopped,
71 1.1 joff sc_st_check,
72 1.1 joff sc_rx_ready;
73 1.1 joff
74 1.1 joff /* control registers */
75 1.1 joff u_int sc_lcrlo;
76 1.1 joff u_int sc_lcrmid;
77 1.1 joff u_int sc_lcrhi;
78 1.1 joff u_int sc_ctrl;
79 1.1 joff
80 1.1 joff /* power management hooks */
81 1.1 joff int (*enable)(struct epcom_softc *);
82 1.1 joff int (*disable)(struct epcom_softc *);
83 1.1 joff
84 1.1 joff int enabled;
85 1.1 joff #if NRND > 0 && defined(RND_COM)
86 1.5 tls krndsource_t rnd_source;
87 1.1 joff #endif
88 1.1 joff };
89 1.1 joff
90 1.1 joff void epcom_attach_subr(struct epcom_softc *);
91 1.1 joff
92 1.1 joff int epcomintr(void* arg);
93 1.1 joff int epcomcnattach(bus_space_tag_t, bus_addr_t, bus_space_handle_t,
94 1.1 joff int, tcflag_t);
95 1.1 joff
96 1.1 joff #endif /* _EPCOMVAR_H_ */
97