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