View | Details | Raw Unified | Return to bug 20341 | Differences between
and this patch

Collapse All | Expand All

(-)isa/siovar.h (+146 lines)
Line 0 Link Here
1
/*-
2
 * Copyright (c) 1991 The Regents of the University of California.
3
 * All rights reserved.
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 University of
16
 *	California, Berkeley and its contributors.
17
 * 4. Neither the name of the University nor the names of its contributors
18
 *    may be used to endorse or promote products derived from this software
19
 *    without specific prior written permission.
20
 *
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
 * $FreeBSD: src/sys/isa/sio.c,v 1.291 2000/03/11 20:22:09 imp Exp $
34
 *	from: @(#)com.c	7.5 (Berkeley) 5/16/91
35
 *	from: i386/isa sio.c,v 1.234
36
 */
37
#define	SIO_MAXUNITS		64	/* max sio ports */
38
#define	CE_NTYPES		3
39
40
/* types.  XXX - should be elsewhere */
41
typedef u_int	Port_t;		/* hardware port */
42
typedef u_char	bool_t;		/* boolean */
43
44
/* queue of linear buffers */
45
struct lbq {
46
	u_char	*l_head;	/* next char to process */
47
	u_char	*l_tail;	/* one past the last char to process */
48
	struct lbq *l_next;	/* next in queue */
49
	bool_t	l_queued;	/* nonzero if queued */
50
};
51
52
/* com device structure */
53
struct com_s {
54
	u_int	flags;		/* Copy isa device flags */
55
	u_char	state;		/* miscellaneous flag bits */
56
	bool_t  active_out;	/* nonzero if the callout device is open */
57
	u_char	cfcr_image;	/* copy of value written to CFCR */
58
#ifdef COM_ESP
59
	bool_t	esp;		/* is this unit a hayes esp board? */
60
#endif
61
	u_char	extra_state;	/* more flag bits, separate for order trick */
62
	u_char	fifo_image;	/* copy of value written to FIFO */
63
	bool_t	hasfifo;	/* nonzero for 16550 UARTs */
64
	bool_t	st16650a;	/* Is a Startech 16650A or RTS/CTS compat */
65
	bool_t	loses_outints;	/* nonzero if device loses output interrupts */
66
	u_char	mcr_image;	/* copy of value written to MCR */
67
#ifdef COM_MULTIPORT
68
	bool_t	multiport;	/* is this unit part of a multiport device? */
69
#endif /* COM_MULTIPORT */
70
	bool_t	no_irq;		/* nonzero if irq is not attached */
71
	bool_t  gone;		/* hardware disappeared */
72
	bool_t	poll;		/* nonzero if polling is required */
73
	bool_t	poll_output;	/* nonzero if polling for output is required */
74
	int	unit;		/* unit	number */
75
	int	dtr_wait;	/* time to hold DTR down on close (* 1/hz) */
76
	u_int	tx_fifo_size;
77
	u_int	wopeners;	/* # processes waiting for DCD in open() */
78
79
	/*
80
	 * The high level of the driver never reads status registers directly
81
	 * because there would be too many side effects to handle conveniently.
82
	 * Instead, it reads copies of the registers stored here by the
83
	 * interrupt handler.
84
	 */
85
	u_char	last_modem_status;	/* last MSR read by intr handler */
86
	u_char	prev_modem_status;	/* last MSR handled by high level */
87
88
	u_char	hotchar;	/* ldisc-specific char to be handled ASAP */
89
	u_char	*ibuf;		/* start of input buffer */
90
	u_char	*ibufend;	/* end of input buffer */
91
	u_char	*ibufold;	/* old input buffer, to be freed */
92
	u_char	*ihighwater;	/* threshold in input buffer */
93
	u_char	*iptr;		/* next free spot in input buffer */
94
	int	ibufsize;	/* size of ibuf (not include error bytes) */
95
	int	ierroff;	/* offset of error bytes in ibuf */
96
97
	struct lbq	obufq;	/* head of queue of output buffers */
98
	struct lbq	obufs[2];	/* output buffers */
99
100
	Port_t	data_port;	/* i/o ports */
101
#ifdef COM_ESP
102
	Port_t	esp_port;
103
#endif
104
	Port_t	int_id_port;
105
	Port_t	iobase;
106
	Port_t	modem_ctl_port;
107
	Port_t	line_status_port;
108
	Port_t	modem_status_port;
109
	Port_t	intr_ctl_port;	/* Ports of IIR register */
110
111
	struct tty	*tp;	/* cross reference */
112
113
	/* Initial state. */
114
	struct termios	it_in;	/* should be in struct tty */
115
	struct termios	it_out;
116
117
	/* Lock state. */
118
	struct termios	lt_in;	/* should be in struct tty */
119
	struct termios	lt_out;
120
121
	bool_t	do_timestamp;
122
	bool_t	do_dcd_timestamp;
123
	struct timeval	timestamp;
124
	struct timeval	dcd_timestamp;
125
	struct	pps_state pps;
126
127
	u_long	bytes_in;	/* statistics */
128
	u_long	bytes_out;
129
	u_int	delta_error_counts[CE_NTYPES];
130
	u_long	error_counts[CE_NTYPES];
131
132
	struct resource *irqres;
133
	struct resource *ioportres;
134
	void *cookie;
135
136
	/*
137
	 * Data area for output buffers.  Someday we should build the output
138
	 * buffer queue without copying data.
139
	 */
140
	u_char	obuf1[256];
141
	u_char	obuf2[256];
142
};
143
144
int	sio_attach_unit	(struct com_s *com, int unit, Port_t iobase, 
145
			 u_int flags, bool_t no_irq);
146
void	siointr1 (struct com_s *com);

Return to bug 20341