1 /* $NetBSD: at91dbguvar.h,v 1.3 2009/10/23 06:53:13 snj 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 /* Hardware flag masks */ 35 #define COM_HW_NOIEN 0x01 36 #define COM_HW_DEV_OK 0x20 37 #define COM_HW_CONSOLE 0x40 38 #define COM_HW_KGDB 0x80 39 40 #define RX_TTY_BLOCKED 0x01 41 #define RX_TTY_OVERFLOWED 0x02 42 #define RX_IBUF_BLOCKED 0x04 43 #define RX_IBUF_OVERFLOWED 0x08 44 #define RX_ANY_BLOCK 0x0f 45 46 #define AT91DBGU_RING_SIZE 2048 47 48 struct at91dbgu_softc { 49 device_t sc_dev; 50 bus_addr_t sc_hwbase; 51 bus_space_tag_t sc_iot; 52 bus_space_handle_t sc_ioh; 53 54 void *sc_si; 55 56 struct tty *sc_tty; 57 58 u_char *sc_rbuf, *sc_ebuf; 59 60 u_char *sc_tba; 61 u_int sc_tbc; 62 63 u_char *volatile sc_rbget, 64 *volatile sc_rbput; 65 volatile u_int sc_rbavail; 66 67 /* status flags */ 68 int sc_hwflags, sc_swflags; 69 70 volatile u_int sc_rx_flags, 71 sc_tx_busy, 72 sc_tx_done, 73 sc_tx_stopped, 74 sc_st_check, 75 sc_rx_ready; 76 77 volatile u_int sc_brgr, sc_ier, sc_poll; 78 79 /* power management hooks */ 80 int (*enable)(struct at91dbgu_softc *); 81 int (*disable)(struct at91dbgu_softc *); 82 83 int enabled; 84 #if NRND > 0 && defined(RND_COM) 85 rndsource_element_t rnd_source; 86 #endif 87 }; 88 89 void at91dbgu_attach_subr(struct at91dbgu_softc *); 90 int at91dbgu_intr(void* arg); 91 92 void at91dbgu_attach_cn(bus_space_tag_t, int, int mode); 93 94 #endif /* _AT91DBGUVAR_H_ */ 95