xref: /netbsd-src/sys/arch/arm/ixp12x0/ixp12x0_comvar.h (revision cbab9cadce21ae72fac13910001079fff214cc29)
1 /*      $NetBSD: ixp12x0_comvar.h,v 1.7 2012/10/27 17:17:39 chs 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  *
17  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef _IXP12X0_COMVAR_H_
31 #define _IXP12X0_COMVAR_H_
32 
33 /* Hardware flag masks */
34 #define COM_HW_NOIEN		0x01
35 #define COM_HW_DEV_OK		0x20
36 #define COM_HW_CONSOLE		0x40
37 #define COM_HW_KGDB		0x80
38 
39 #define RX_TTY_BLOCKED		0x01
40 #define RX_TTY_OVERFLOWED	0x02
41 #define RX_IBUF_BLOCKED		0x04
42 #define RX_IBUF_OVERFLOWED	0x08
43 #define RX_ANY_BLOCK		0x0f
44 
45 #define IXPCOM_RING_SIZE	2048
46 
47 struct ixpcom_softc {
48 	device_t		sc_dev;
49 	bus_addr_t		sc_baseaddr;
50 	bus_space_tag_t		sc_iot;
51 	bus_space_handle_t 	sc_ioh;
52 
53 	void			*sc_si;
54 
55 	struct tty		*sc_tty;
56 
57 	u_char			*sc_rbuf, *sc_ebuf;
58 
59  	u_char			*sc_tba;
60  	u_int			sc_tbc, sc_heldtbc;
61 
62 	u_char			*volatile sc_rbget,
63 				*volatile sc_rbput;
64  	volatile u_int		sc_rbavail;
65 
66 	/* status flags */
67 	int			sc_hwflags, sc_swflags;
68 
69 	volatile u_int		sc_rx_flags,
70 				sc_tx_busy,
71 				sc_tx_done,
72 				sc_tx_stopped,
73 				sc_st_check,
74 				sc_rx_ready;
75 	volatile int		sc_heldchange;
76 
77 	/* control registers */
78 	u_int			sc_xie;
79 	u_int			sc_rie;
80 	u_int			sc_speed;
81 
82 	/* power management hooks */
83 	int			(*enable)(struct ixpcom_softc *);
84 	int			(*disable)(struct ixpcom_softc *);
85 
86 	int			enabled;
87 };
88 
89 extern struct ixpcom_softc* ixpcom_sc;
90 
91 void	ixpcom_attach_subr(struct ixpcom_softc *);
92 
93 int	ixpcomintr(void* arg);
94 int	ixpcomcnattach(bus_space_tag_t, bus_addr_t, bus_space_handle_t,
95 		       int, tcflag_t);
96 
97 #endif /* _IXP12X0_COMVAR_H_ */
98