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