Home | History | Annotate | Line # | Download | only in ep93xx
epcomvar.h revision 1.2.4.2
      1 /*      $NetBSD: epcomvar.h,v 1.2.4.2 2005/01/17 19:29:12 skrll Exp $        */
      2 /*-
      3  * Copyright (c) 2004 Jesse Off
      4  *
      5  * Redistribution and use in source and binary forms, with or without
      6  * modification, are permitted provided that the following conditions
      7  * are met:
      8  * 1. Redistributions of source code must retain the above copyright
      9  *    notice, this list of conditions and the following disclaimer.
     10  * 2. Redistributions in binary form must reproduce the above copyright
     11  *    notice, this list of conditions and the following disclaimer in the
     12  *    documentation and/or other materials provided with the distribution.
     13  * 3. All advertising materials mentioning features or use of this software
     14  *    must display the following acknowledgement:
     15  *      This product includes software developed by the NetBSD
     16  *      Foundation, Inc. and its contributors.
     17  * 4. Neither the name of The NetBSD Foundation nor the names of its
     18  *    contributors may be used to endorse or promote products derived
     19  *    from this software without specific prior written permission.
     20  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     30  * SUCH DAMAGE.
     31  *
     32  */
     33 
     34 #ifndef _EPCOMVAR_H_
     35 #define _EPCOMVAR_H_
     36 
     37 /* Hardware flag masks */
     38 #define COM_HW_NOIEN		0x01
     39 #define COM_HW_DEV_OK		0x20
     40 #define COM_HW_CONSOLE		0x40
     41 #define COM_HW_KGDB		0x80
     42 
     43 #define RX_TTY_BLOCKED		0x01
     44 #define RX_TTY_OVERFLOWED	0x02
     45 #define RX_IBUF_BLOCKED		0x04
     46 #define RX_IBUF_OVERFLOWED	0x08
     47 #define RX_ANY_BLOCK		0x0f
     48 
     49 #define EPCOM_RING_SIZE	2048
     50 
     51 struct epcom_softc {
     52 	struct device		sc_dev;
     53 	bus_addr_t		sc_hwbase;
     54 	bus_space_tag_t		sc_iot;
     55 	bus_space_handle_t 	sc_ioh;
     56 
     57 	void			*sc_si;
     58 
     59 	struct tty		*sc_tty;
     60 
     61 	u_char			*sc_rbuf, *sc_ebuf;
     62 
     63  	u_char			*sc_tba;
     64  	u_int			sc_tbc;
     65 
     66 	u_char			*volatile sc_rbget,
     67 				*volatile sc_rbput;
     68  	volatile u_int		sc_rbavail;
     69 
     70 	/* status flags */
     71 	int			sc_hwflags, sc_swflags;
     72 
     73 	volatile u_int		sc_rx_flags,
     74 				sc_tx_busy,
     75 				sc_tx_done,
     76 				sc_tx_stopped,
     77 				sc_st_check,
     78 				sc_rx_ready;
     79 
     80 	/* control registers */
     81 	u_int			sc_lcrlo;
     82 	u_int			sc_lcrmid;
     83 	u_int			sc_lcrhi;
     84 	u_int			sc_ctrl;
     85 
     86 	/* power management hooks */
     87 	int			(*enable)(struct epcom_softc *);
     88 	int			(*disable)(struct epcom_softc *);
     89 
     90 	int			enabled;
     91 #if NRND > 0 && defined(RND_COM)
     92 	rndsource_element_t  rnd_source;
     93 #endif
     94 };
     95 
     96 void	epcom_attach_subr(struct epcom_softc *);
     97 
     98 int	epcomintr(void* arg);
     99 int	epcomcnattach(bus_space_tag_t, bus_addr_t, bus_space_handle_t,
    100 		       int, tcflag_t);
    101 
    102 #endif /* _EPCOMVAR_H_ */
    103