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