asy.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
/* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */
/* All Rights Reserved */
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_ASY_H
#define _SYS_ASY_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/dditypes.h>
#define COM1_IOADDR 0x3f8
#define COM2_IOADDR 0x2f8
#define COM3_IOADDR 0x3e8
#define COM4_IOADDR 0x2e8
/*
* Definitions for INS8250 / 16550 chips
*/
/* defined as offsets from the data register */
#define DLL 0 /* divisor latch (lsb) */
/*
* INTEL 8210-A/B & 16450/16550 Registers Structure.
*/
/* Line Control Register */
#define STOP1 0x00
#define STOP2 0x04
#define PAREN 0x08
#define PAREVN 0x10
#define PARMARK 0x20
#define SNDBRK 0x40
/* Line Status Register */
/* Interrupt Id Regisger */
/* Interrupt Enable Register */
/* Modem Control Register */
/* Modem Status Register */
/* flags for FCR (FIFO Control register) */
#define OVERRUN 040000
#define FRERROR 020000
#define PERROR 010000
/* EFR - Enhanced feature register for 16650 */
#define ENHENABLE 0x10
/* SCR - scratch register */
/*
* Ring buffer and async line management definitions.
*/
#define RING_UNMARK(ap) \
/*
*
*/
#ifdef DEBUG
#else
#endif
/*
* Hardware channel common data. One structure per port.
* Each of the fields in this structure is required to be protected by a
* mutex lock at the highest priority at which it can be altered.
* The asy_flags, and asy_next fields can be altered by interrupt
* handling code that must be protected by the mutex whose handle is
* stored in asy_excl_hi. All others can be protected by the asy_excl
* mutex, which is lower priority and adaptive.
*/
struct asycom {
int asy_flags; /* random flags */
/* protected by asy_excl_hi lock */
int asy_unit; /* which port */
#ifdef DEBUG
int asy_msint_cnt; /* number of times in async_msint */
#endif
};
/*
* Asychronous protocol private data structure for ASY.
* Each of the fields in the structure is required to be protected by
* the lower priority lock except the fields that are set only at
* base level but cleared (with out lock) at interrupt level.
*/
struct asyncline {
int async_flags; /* random flags */
/*
* The following fields are protected by the asy_excl_hi lock.
* Some, such as async_flowc, are set only at the base level and
* cleared (without the lock) only by the interrupt level.
*/
int async_ocnt; /* output count */
/*
* Each character stuffed into the ring has two bytes associated
* with it. The first byte is used to indicate special conditions
* and the second byte is the actual data. The ring buffer
* needs to be defined as ushort_t to accomodate this.
*/
short async_break; /* break count */
int async_inflow_source; /* input flow control type */
union {
struct {
} _a;
} async_uover;
short async_ext; /* modem status change count */
short async_work; /* work to do flag */
};
/* definitions for async_flags field */
/* the minimum time */
/* needed to be sent */
/* because of transition of flow */
/* control from stop to start */
/* asy_hwtype definitions */
#define ASY16650 0x5
#define ASY16750 0x6
/* definitions for asy_flags field */
#define ASY_NEEDSOFT 0x00000001
#define ASY_DOINGSOFT 0x00000002
#define ASY_PPS 0x00000004
#define ASY_PPS_EDGE 0x00000008
#define ASY_DOINGSOFT_RETRY 0x00000010
#define ASY_RTS_DTR_OFF 0x00000020
#define ASY_IGNORE_CD 0x00000040
#define ASY_CONSOLE 0x00000080
/* definitions for asy_flags2 field */
/* definitions for async_inflow_source field in struct asyncline */
#define IN_FLOW_NULL 0x00000000
#define IN_FLOW_RINGBUFF 0x00000001
#define IN_FLOW_STREAMS 0x00000002
#define IN_FLOW_USER 0x00000004
/*
* OUTLINE defines the high-order flag bit in the minor device number that
* controls use of a tty line for dialin and dialout simultaneously.
*/
#ifdef _LP64
#else
#endif
/*
* ASYSETSOFT macro to pend a soft interrupt if one isn't already pending.
*/
extern int asysoftpend; /* secondary interrupt pending */
#define ASYSETSOFT(asy) { \
mutex_enter(&asy_soft_lock); \
if (!asysoftpend) { \
asysoftpend = 1; \
mutex_exit(&asy_soft_lock); \
} \
else \
mutex_exit(&asy_soft_lock); \
}
#ifdef __cplusplus
}
#endif
#endif /* _SYS_ASY_H */