xref: /dflybsd-src/sys/dev/serial/ic_layer/esp.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
1*86d7f5d3SJohn Marino /*-
2*86d7f5d3SJohn Marino  * Copyright (c) 1995 Sean Eric Fagan.
3*86d7f5d3SJohn Marino  * All rights reserved.
4*86d7f5d3SJohn Marino  *
5*86d7f5d3SJohn Marino  * Redistribution and use in source and binary forms, with or without
6*86d7f5d3SJohn Marino  * modification, are permitted provided that the following conditions
7*86d7f5d3SJohn Marino  * are met:
8*86d7f5d3SJohn Marino  * 1. Redistributions of source code must retain the above copyright
9*86d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer.
10*86d7f5d3SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
11*86d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer in the
12*86d7f5d3SJohn Marino  *    documentation and/or other materials provided with the distribution.
13*86d7f5d3SJohn Marino  * 3. Neither the name of the author nor the names of contributors
14*86d7f5d3SJohn Marino  *    may be used to endorse or promote products derived from this software
15*86d7f5d3SJohn Marino  *    without specific prior written permission.
16*86d7f5d3SJohn Marino  *
17*86d7f5d3SJohn Marino  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18*86d7f5d3SJohn Marino  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*86d7f5d3SJohn Marino  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*86d7f5d3SJohn Marino  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21*86d7f5d3SJohn Marino  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*86d7f5d3SJohn Marino  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23*86d7f5d3SJohn Marino  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24*86d7f5d3SJohn Marino  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25*86d7f5d3SJohn Marino  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26*86d7f5d3SJohn Marino  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27*86d7f5d3SJohn Marino  * SUCH DAMAGE.
28*86d7f5d3SJohn Marino  *
29*86d7f5d3SJohn Marino  * $FreeBSD: src/sys/dev/ic/esp.h,v 1.6.2.1 2002/02/03 14:52:02 nyan Exp $
30*86d7f5d3SJohn Marino  * $DragonFly: src/sys/dev/serial/ic_layer/esp.h,v 1.2 2003/06/17 04:28:27 dillon Exp $
31*86d7f5d3SJohn Marino  */
32*86d7f5d3SJohn Marino 
33*86d7f5d3SJohn Marino #ifndef _IC_ESP_H_
34*86d7f5d3SJohn Marino #define	_IC_ESP_H_
35*86d7f5d3SJohn Marino 
36*86d7f5d3SJohn Marino /*
37*86d7f5d3SJohn Marino  * Definitions for Hayes ESP serial cards.
38*86d7f5d3SJohn Marino  */
39*86d7f5d3SJohn Marino 
40*86d7f5d3SJohn Marino /*
41*86d7f5d3SJohn Marino  * CMD1 and CMD2 are the command ports, offsets from <esp_iobase>.
42*86d7f5d3SJohn Marino  */
43*86d7f5d3SJohn Marino #define	ESP_CMD1	4
44*86d7f5d3SJohn Marino #define	ESP_CMD2	5
45*86d7f5d3SJohn Marino 
46*86d7f5d3SJohn Marino /*
47*86d7f5d3SJohn Marino  * STAT1 and STAT2 are to get return values and status bytes;
48*86d7f5d3SJohn Marino  * they overload CMD1 and CMD2.
49*86d7f5d3SJohn Marino  */
50*86d7f5d3SJohn Marino #define	ESP_STATUS1	ESP_CMD1
51*86d7f5d3SJohn Marino #define	ESP_STATUS2	ESP_CMD2
52*86d7f5d3SJohn Marino 
53*86d7f5d3SJohn Marino /*
54*86d7f5d3SJohn Marino  * Commands.  Commands are given by writing the command value to
55*86d7f5d3SJohn Marino  * ESP_CMD1 and then writing or reading some number of bytes from
56*86d7f5d3SJohn Marino  * ESP_CMD2 or ESP_STATUS2.
57*86d7f5d3SJohn Marino  */
58*86d7f5d3SJohn Marino #define	ESP_GETTEST	0x01	/* self-test command (1 byte + extras) */
59*86d7f5d3SJohn Marino #define	ESP_GETDIPS	0x02	/* get on-board DIP switches (1 byte) */
60*86d7f5d3SJohn Marino #define	ESP_SETFLOWTYPE	0x08	/* set type of flow-control (2 bytes) */
61*86d7f5d3SJohn Marino #define	ESP_SETRXFLOW	0x0a	/* set Rx FIFO flow control levels (4 bytes) */
62*86d7f5d3SJohn Marino #define	ESP_SETMODE	0x10	/* set board mode (1 byte) */
63*86d7f5d3SJohn Marino #define	ESP_SETCLOCK	0x23	/* set UART clock prescaler */
64*86d7f5d3SJohn Marino 
65*86d7f5d3SJohn Marino /* Mode bits (ESP_SETMODE). */
66*86d7f5d3SJohn Marino #define	ESP_MODE_FIFO	0x02	/* act like a 16550 (compatibility mode) */
67*86d7f5d3SJohn Marino #define	ESP_MODE_RTS	0x04	/* use RTS hardware flow control */
68*86d7f5d3SJohn Marino #define	ESP_MODE_SCALE	0x80	/* scale FIFO trigger levels */
69*86d7f5d3SJohn Marino 
70*86d7f5d3SJohn Marino /* Flow control type bits (ESP_SETFLOWTYPE). */
71*86d7f5d3SJohn Marino #define	ESP_FLOW_RTS	0x04	/* cmd1: local Rx sends RTS flow control */
72*86d7f5d3SJohn Marino #define	ESP_FLOW_CTS	0x10	/* cmd2: local transmitter responds to CTS */
73*86d7f5d3SJohn Marino 
74*86d7f5d3SJohn Marino /* Used by ESP_SETRXFLOW. */
75*86d7f5d3SJohn Marino #define	HIBYTE(w)	(((w) >> 8) & 0xff)
76*86d7f5d3SJohn Marino #define	LOBYTE(w)	((w) & 0xff)
77*86d7f5d3SJohn Marino 
78*86d7f5d3SJohn Marino #endif /* !_IC_ESP_H_ */
79