xref: /netbsd/sys/arch/arm/ixp12x0/ixp12x0_comvar.h (revision c4a72b64)
1 /*      $NetBSD: ixp12x0_comvar.h,v 1.3 2002/12/02 14:10:13 ichiro 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 #ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
61 	void			*sc_si;
62 #endif
63 	struct tty		*sc_tty;
64 
65 
66 	u_char			*sc_rbuf, *sc_ebuf;
67 
68  	u_char			*sc_tba;
69  	u_int			sc_tbc, sc_heldtbc;
70 
71 	u_char			*volatile sc_rbget,
72 				*volatile sc_rbput;
73  	volatile u_int		sc_rbavail;
74 
75 	/* status flags */
76 	int			sc_hwflags, sc_swflags;
77 
78 	volatile u_int		sc_rx_flags,
79 				sc_tx_busy,
80 				sc_tx_done,
81 				sc_tx_stopped,
82 				sc_st_check,
83 				sc_rx_ready;
84 	volatile int		sc_heldchange;
85 
86 	/* control registers */
87 	u_int			sc_xie;
88 	u_int			sc_rie;
89 	u_int			sc_speed;
90 
91 	/* power management hooks */
92 	int			(*enable)(struct ixpcom_softc *);
93 	int			(*disable)(struct ixpcom_softc *);
94 
95 	int			enabled;
96 };
97 
98 #if 0
99 extern struct bus_space ixpcom_bs_tag;
100 #endif
101 extern struct ixpcom_softc* ixpcom_sc;
102 
103 void	ixpcom_attach_subr(struct ixpcom_softc *);
104 
105 int	ixpcomintr(void* arg);
106 int	ixpcomcnattach(bus_space_tag_t, bus_addr_t, int, tcflag_t);
107 
108 #endif /* _IXP12X0_COMVAR_H_ */
109