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