epcomvar.h revision 1.7.14.1 1 1.7.14.1 skrll /* $NetBSD: epcomvar.h,v 1.7.14.1 2015/06/06 14:39:55 skrll 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.7.14.1 skrll #ifdef RND_COM
32 1.7.14.1 skrll #include <sys/rndsource.h>
33 1.7.14.1 skrll #endif
34 1.7.14.1 skrll
35 1.1 joff /* Hardware flag masks */
36 1.1 joff #define COM_HW_NOIEN 0x01
37 1.1 joff #define COM_HW_DEV_OK 0x20
38 1.1 joff #define COM_HW_CONSOLE 0x40
39 1.1 joff #define COM_HW_KGDB 0x80
40 1.1 joff
41 1.1 joff #define RX_TTY_BLOCKED 0x01
42 1.1 joff #define RX_TTY_OVERFLOWED 0x02
43 1.1 joff #define RX_IBUF_BLOCKED 0x04
44 1.1 joff #define RX_IBUF_OVERFLOWED 0x08
45 1.1 joff #define RX_ANY_BLOCK 0x0f
46 1.1 joff
47 1.1 joff #define EPCOM_RING_SIZE 2048
48 1.1 joff
49 1.1 joff struct epcom_softc {
50 1.7 chs device_t sc_dev;
51 1.1 joff bus_addr_t sc_hwbase;
52 1.1 joff bus_space_tag_t sc_iot;
53 1.1 joff bus_space_handle_t sc_ioh;
54 1.1 joff
55 1.1 joff void *sc_si;
56 1.1 joff
57 1.1 joff struct tty *sc_tty;
58 1.1 joff
59 1.1 joff u_char *sc_rbuf, *sc_ebuf;
60 1.1 joff
61 1.1 joff u_char *sc_tba;
62 1.2 joff u_int sc_tbc;
63 1.1 joff
64 1.1 joff u_char *volatile sc_rbget,
65 1.1 joff *volatile sc_rbput;
66 1.1 joff volatile u_int sc_rbavail;
67 1.1 joff
68 1.1 joff /* status flags */
69 1.1 joff int sc_hwflags, sc_swflags;
70 1.1 joff
71 1.1 joff volatile u_int sc_rx_flags,
72 1.1 joff sc_tx_busy,
73 1.1 joff sc_tx_done,
74 1.1 joff sc_tx_stopped,
75 1.1 joff sc_st_check,
76 1.1 joff sc_rx_ready;
77 1.1 joff
78 1.1 joff /* control registers */
79 1.1 joff u_int sc_lcrlo;
80 1.1 joff u_int sc_lcrmid;
81 1.1 joff u_int sc_lcrhi;
82 1.1 joff u_int sc_ctrl;
83 1.1 joff
84 1.1 joff /* power management hooks */
85 1.1 joff int (*enable)(struct epcom_softc *);
86 1.1 joff int (*disable)(struct epcom_softc *);
87 1.1 joff
88 1.1 joff int enabled;
89 1.6 tls #ifdef RND_COM
90 1.5 tls krndsource_t rnd_source;
91 1.1 joff #endif
92 1.1 joff };
93 1.1 joff
94 1.1 joff void epcom_attach_subr(struct epcom_softc *);
95 1.1 joff
96 1.1 joff int epcomintr(void* arg);
97 1.1 joff int epcomcnattach(bus_space_tag_t, bus_addr_t, bus_space_handle_t,
98 1.1 joff int, tcflag_t);
99 1.1 joff
100 1.1 joff #endif /* _EPCOMVAR_H_ */
101