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