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