Home | History | Annotate | Line # | Download | only in ic
comvar.h revision 1.13
      1  1.13  drochner /*	$NetBSD: comvar.h,v 1.13 1997/08/14 16:15:16 drochner Exp $	*/
      2   1.1       cgd 
      3   1.1       cgd /*
      4   1.2       cgd  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
      5   1.1       cgd  *
      6   1.1       cgd  * Redistribution and use in source and binary forms, with or without
      7   1.1       cgd  * modification, are permitted provided that the following conditions
      8   1.1       cgd  * are met:
      9   1.1       cgd  * 1. Redistributions of source code must retain the above copyright
     10   1.1       cgd  *    notice, this list of conditions and the following disclaimer.
     11   1.1       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     12   1.1       cgd  *    notice, this list of conditions and the following disclaimer in the
     13   1.1       cgd  *    documentation and/or other materials provided with the distribution.
     14   1.1       cgd  * 3. All advertising materials mentioning features or use of this software
     15   1.1       cgd  *    must display the following acknowledgement:
     16   1.1       cgd  *      This product includes software developed by Christopher G. Demetriou
     17   1.1       cgd  *	for the NetBSD Project.
     18   1.1       cgd  * 4. The name of the author may not be used to endorse or promote products
     19   1.1       cgd  *    derived from this software without specific prior written permission
     20   1.1       cgd  *
     21   1.1       cgd  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22   1.1       cgd  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23   1.1       cgd  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24   1.1       cgd  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25   1.1       cgd  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26   1.1       cgd  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27   1.1       cgd  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28   1.1       cgd  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29   1.1       cgd  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30   1.1       cgd  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31   1.1       cgd  */
     32   1.1       cgd 
     33   1.8   mycroft extern int comconsaddr;
     34   1.8   mycroft extern bus_space_tag_t comconstag;
     35   1.8   mycroft extern bus_space_handle_t comconsioh;
     36  1.13  drochner extern int comconsrate;
     37   1.8   mycroft extern tcflag_t comconscflag;
     38  1.13  drochner int comcngetc __P((dev_t));
     39  1.13  drochner void comcnputc __P((dev_t, int));
     40  1.13  drochner void comcnpollc __P((dev_t, int));
     41  1.13  drochner extern int comconsattached;
     42  1.12  drochner 
     43  1.12  drochner #ifdef KGDB
     44  1.12  drochner extern int com_kgdb_addr;
     45  1.12  drochner extern bus_space_tag_t com_kgdb_iot;
     46  1.12  drochner extern bus_space_handle_t com_kgdb_ioh;
     47  1.12  drochner extern int com_kgdb_getc __P((void*));
     48  1.12  drochner extern void com_kgdb_putc __P((void*, int));
     49  1.12  drochner #endif
     50   1.8   mycroft 
     51   1.8   mycroft /* Hardware flag masks */
     52   1.8   mycroft #define	COM_HW_NOIEN	0x01
     53   1.8   mycroft #define	COM_HW_FIFO	0x02
     54   1.8   mycroft #define	COM_HW_HAYESP	0x04
     55   1.8   mycroft #define	COM_HW_CONSOLE	0x40
     56  1.11   thorpej #define	COM_HW_KGDB	0x80
     57   1.8   mycroft 
     58   1.8   mycroft /* Buffer size for character buffer */
     59  1.10   mycroft #define RXBUFSIZE 2048			/* More than enough.. */
     60  1.10   mycroft #define RXBUFMASK (RXBUFSIZE - 1)	/* Only iff previous is a power of 2 */
     61  1.10   mycroft #define RXHIWAT   ((RXBUFSIZE * 1) / 4)
     62  1.10   mycroft #define	RXLOWAT	  ((RXBUFSIZE * 3) / 4)
     63   1.8   mycroft 
     64   1.8   mycroft struct com_softc {
     65   1.8   mycroft 	struct device sc_dev;
     66   1.8   mycroft 	void *sc_ih;
     67   1.8   mycroft 	void *sc_si;
     68   1.8   mycroft 	struct tty *sc_tty;
     69   1.8   mycroft 
     70   1.8   mycroft 	int sc_overflows;
     71   1.8   mycroft 	int sc_floods;
     72   1.8   mycroft 	int sc_errors;
     73   1.8   mycroft 
     74   1.8   mycroft 	int sc_iobase;
     75   1.8   mycroft 
     76   1.8   mycroft 	bus_space_tag_t sc_iot;
     77   1.8   mycroft 	bus_space_handle_t sc_ioh;
     78   1.8   mycroft 	bus_space_handle_t sc_hayespioh;
     79   1.8   mycroft 
     80   1.8   mycroft 	u_char sc_hwflags;
     81   1.8   mycroft 	u_char sc_swflags;
     82   1.8   mycroft 	int sc_fifolen;
     83   1.3       cgd 
     84   1.8   mycroft 	u_char sc_msr, sc_msr_delta, sc_msr_mask, sc_mcr, sc_mcr_active, sc_lcr,
     85   1.8   mycroft 	       sc_ier, sc_fifo, sc_dlbl, sc_dlbh;
     86   1.8   mycroft 	u_char sc_mcr_dtr, sc_mcr_rts, sc_msr_cts, sc_msr_dcd;
     87   1.8   mycroft 
     88   1.8   mycroft 	int sc_r_hiwat;
     89  1.10   mycroft 	int sc_r_lowat;
     90   1.8   mycroft  	volatile u_int sc_rbget;
     91   1.8   mycroft  	volatile u_int sc_rbput;
     92   1.8   mycroft 	volatile u_int sc_rbavail;
     93   1.8   mycroft  	u_char sc_rbuf[RXBUFSIZE];
     94   1.8   mycroft 	u_char sc_lbuf[RXBUFSIZE];
     95   1.8   mycroft 
     96   1.8   mycroft  	u_char *sc_tba;
     97   1.8   mycroft  	int sc_tbc,
     98   1.8   mycroft 	    sc_heldtbc;
     99   1.8   mycroft 
    100  1.10   mycroft 	volatile u_char sc_rx_flags,
    101  1.10   mycroft #define	RX_TTY_BLOCKED		0x01
    102  1.10   mycroft #define	RX_TTY_OVERFLOWED	0x02
    103  1.10   mycroft #define	RX_IBUF_BLOCKED		0x04
    104  1.10   mycroft #define	RX_IBUF_OVERFLOWED	0x08
    105  1.10   mycroft #define	RX_ANY_BLOCK		0x0f
    106   1.8   mycroft 			sc_tx_busy,
    107   1.8   mycroft 			sc_tx_done,
    108   1.8   mycroft 			sc_tx_stopped,
    109   1.8   mycroft 			sc_st_check,
    110   1.8   mycroft 			sc_rx_ready;
    111   1.8   mycroft 
    112   1.8   mycroft 	volatile u_char sc_heldchange;
    113   1.1       cgd };
    114   1.1       cgd 
    115   1.8   mycroft /* Macros to clear/set/test flags. */
    116   1.8   mycroft #define SET(t, f)	(t) |= (f)
    117   1.8   mycroft #define CLR(t, f)	(t) &= ~(f)
    118   1.8   mycroft #define ISSET(t, f)	((t) & (f))
    119   1.8   mycroft 
    120   1.6   thorpej int comprobe1 __P((bus_space_tag_t, bus_space_handle_t, int));
    121   1.5  christos int comintr __P((void *));
    122   1.8   mycroft void com_attach_subr __P((struct com_softc *));
    123   1.8   mycroft void cominit 		__P((bus_space_tag_t, bus_space_handle_t, int));
    124   1.3       cgd 
    125   1.8   mycroft #ifndef __GENERIC_SOFT_INTERRUPTS
    126   1.8   mycroft #ifdef alpha
    127   1.8   mycroft #define	IPL_SERIAL	IPL_TTY
    128   1.8   mycroft #define	splserial()	spltty()
    129   1.8   mycroft #define	IPL_SOFTSERIAL	IPL_TTY
    130   1.8   mycroft #define	splsoftserial()	spltty()
    131   1.8   mycroft #endif
    132   1.8   mycroft #endif
    133