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