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