xref: /dflybsd-src/sys/dev/serial/ic_layer/esp.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino /*-
286d7f5d3SJohn Marino  * Copyright (c) 1995 Sean Eric Fagan.
386d7f5d3SJohn Marino  * All rights reserved.
486d7f5d3SJohn Marino  *
586d7f5d3SJohn Marino  * Redistribution and use in source and binary forms, with or without
686d7f5d3SJohn Marino  * modification, are permitted provided that the following conditions
786d7f5d3SJohn Marino  * are met:
886d7f5d3SJohn Marino  * 1. Redistributions of source code must retain the above copyright
986d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer.
1086d7f5d3SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
1186d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer in the
1286d7f5d3SJohn Marino  *    documentation and/or other materials provided with the distribution.
1386d7f5d3SJohn Marino  * 3. Neither the name of the author nor the names of contributors
1486d7f5d3SJohn Marino  *    may be used to endorse or promote products derived from this software
1586d7f5d3SJohn Marino  *    without specific prior written permission.
1686d7f5d3SJohn Marino  *
1786d7f5d3SJohn Marino  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1886d7f5d3SJohn Marino  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1986d7f5d3SJohn Marino  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2086d7f5d3SJohn Marino  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2186d7f5d3SJohn Marino  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2286d7f5d3SJohn Marino  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2386d7f5d3SJohn Marino  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2486d7f5d3SJohn Marino  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2586d7f5d3SJohn Marino  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2686d7f5d3SJohn Marino  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2786d7f5d3SJohn Marino  * SUCH DAMAGE.
2886d7f5d3SJohn Marino  *
2986d7f5d3SJohn Marino  * $FreeBSD: src/sys/dev/ic/esp.h,v 1.6.2.1 2002/02/03 14:52:02 nyan Exp $
3086d7f5d3SJohn Marino  * $DragonFly: src/sys/dev/serial/ic_layer/esp.h,v 1.2 2003/06/17 04:28:27 dillon Exp $
3186d7f5d3SJohn Marino  */
3286d7f5d3SJohn Marino 
3386d7f5d3SJohn Marino #ifndef _IC_ESP_H_
3486d7f5d3SJohn Marino #define	_IC_ESP_H_
3586d7f5d3SJohn Marino 
3686d7f5d3SJohn Marino /*
3786d7f5d3SJohn Marino  * Definitions for Hayes ESP serial cards.
3886d7f5d3SJohn Marino  */
3986d7f5d3SJohn Marino 
4086d7f5d3SJohn Marino /*
4186d7f5d3SJohn Marino  * CMD1 and CMD2 are the command ports, offsets from <esp_iobase>.
4286d7f5d3SJohn Marino  */
4386d7f5d3SJohn Marino #define	ESP_CMD1	4
4486d7f5d3SJohn Marino #define	ESP_CMD2	5
4586d7f5d3SJohn Marino 
4686d7f5d3SJohn Marino /*
4786d7f5d3SJohn Marino  * STAT1 and STAT2 are to get return values and status bytes;
4886d7f5d3SJohn Marino  * they overload CMD1 and CMD2.
4986d7f5d3SJohn Marino  */
5086d7f5d3SJohn Marino #define	ESP_STATUS1	ESP_CMD1
5186d7f5d3SJohn Marino #define	ESP_STATUS2	ESP_CMD2
5286d7f5d3SJohn Marino 
5386d7f5d3SJohn Marino /*
5486d7f5d3SJohn Marino  * Commands.  Commands are given by writing the command value to
5586d7f5d3SJohn Marino  * ESP_CMD1 and then writing or reading some number of bytes from
5686d7f5d3SJohn Marino  * ESP_CMD2 or ESP_STATUS2.
5786d7f5d3SJohn Marino  */
5886d7f5d3SJohn Marino #define	ESP_GETTEST	0x01	/* self-test command (1 byte + extras) */
5986d7f5d3SJohn Marino #define	ESP_GETDIPS	0x02	/* get on-board DIP switches (1 byte) */
6086d7f5d3SJohn Marino #define	ESP_SETFLOWTYPE	0x08	/* set type of flow-control (2 bytes) */
6186d7f5d3SJohn Marino #define	ESP_SETRXFLOW	0x0a	/* set Rx FIFO flow control levels (4 bytes) */
6286d7f5d3SJohn Marino #define	ESP_SETMODE	0x10	/* set board mode (1 byte) */
6386d7f5d3SJohn Marino #define	ESP_SETCLOCK	0x23	/* set UART clock prescaler */
6486d7f5d3SJohn Marino 
6586d7f5d3SJohn Marino /* Mode bits (ESP_SETMODE). */
6686d7f5d3SJohn Marino #define	ESP_MODE_FIFO	0x02	/* act like a 16550 (compatibility mode) */
6786d7f5d3SJohn Marino #define	ESP_MODE_RTS	0x04	/* use RTS hardware flow control */
6886d7f5d3SJohn Marino #define	ESP_MODE_SCALE	0x80	/* scale FIFO trigger levels */
6986d7f5d3SJohn Marino 
7086d7f5d3SJohn Marino /* Flow control type bits (ESP_SETFLOWTYPE). */
7186d7f5d3SJohn Marino #define	ESP_FLOW_RTS	0x04	/* cmd1: local Rx sends RTS flow control */
7286d7f5d3SJohn Marino #define	ESP_FLOW_CTS	0x10	/* cmd2: local transmitter responds to CTS */
7386d7f5d3SJohn Marino 
7486d7f5d3SJohn Marino /* Used by ESP_SETRXFLOW. */
7586d7f5d3SJohn Marino #define	HIBYTE(w)	(((w) >> 8) & 0xff)
7686d7f5d3SJohn Marino #define	LOBYTE(w)	((w) & 0xff)
7786d7f5d3SJohn Marino 
7886d7f5d3SJohn Marino #endif /* !_IC_ESP_H_ */
79