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