zsdev.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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_ZSDEV_H
#define _SYS_ZSDEV_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Onboard serial ports.
* Device dependent software definitions.
* All interfaces described in this file are private to the Sun 'zs' driver
* implementation and may change at any time without notice.
*/
/*
* Chip, buffer, and register definitions for Z8530 SCC
*/
#include <sys/dditypes.h>
#include <sys/ser_zscc.h>
#ifdef _MACHDEP
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _MACHDEP
#define ZSDELAY()
#define ZSFLUSH()
#define ZSNEXTPOLL(zscurr)
#endif
/*
* OUTLINE defines the high-order flag bit in the minor device number that
* controls use of a tty line for dialin and dialout simultaneously.
*/
extern int zs_usec_delay;
#define SDLCFLAG 0x7E
#define ZS_OFF 0
/*
* Modem control commands.
*/
#define DMSET 0
#define DMBIS 1
#define DMBIC 2
#define DMGET 3
/*
* Macros to access a port
*/
((struct zscc_device *) \
ZSDELAY(); \
((struct zscc_device *) \
ZSDELAY(); \
}
((struct zscc_device *) \
ZSDELAY(); \
((struct zscc_device *) \
ZSDELAY(); \
}
ZSDELAY(); \
ZSDELAY(); \
}
((struct zscc_device *) \
ZSDELAY(); \
var = ((struct zscc_device *) \
ZSDELAY(); \
}
((struct zscc_device *) \
ZSDELAY(); \
var = ((struct zscc_device *) \
ZSDELAY(); \
}
register struct zscc_device *tmp; \
ZSDELAY(); \
ZSDELAY(); \
}
ZSDELAY(); \
ZSDELAY(); \
}
ZSDELAY(); \
ZSDELAY(); \
}
#define SCC_WRITE0(val) { \
ZSDELAY(); \
ZSFLUSH(); \
}
#define SCC_WRITEDATA(val) { \
ZSDELAY(); \
ZSFLUSH(); \
}
/*
* Protocol specific entry points for driver routines.
*/
struct zsops {
void (*zsop_txint)(); /* xmit buffer empty */
void (*zsop_xsint)(); /* external/status */
void (*zsop_rxint)(); /* receive char available */
void (*zsop_srint)(); /* special receive condition */
int (*zsop_softint)(); /* second stage interrupt handler */
int (*zsop_suspend)(); /* suspend driver */
int (*zsop_resume)(); /* resume driver */
};
/*
* 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 zs_flags, zs_wreg and zs_next fields can be altered by interrupt
* handling code that runs at ZS_PL_HI (IPL 12), so they must be protected
* by the mutex whose handle is stored in zs_excl_hi. All others can be
* protected by the zs_excl mutex, which is lower priority and adaptive.
*/
struct zscom {
void (*zs_txint)(); /* SCC interrupt vector routines */
unsigned char *zs_wr_cur;
unsigned char *zs_wr_lim;
void (*zs_rxint)(); /* SCC interrupt vector routines */
unsigned char *zs_rd_cur;
unsigned char *zs_rd_lim;
void (*zs_xsint)(); /* SCC interrupt vector routines */
void (*zs_srint)(); /* SCC interrupt vector routines */
int (*zs_suspend)(); /* routine to suspend driver */
int (*zs_resume)(); /* routine to resume driver */
short zs_unit; /* which channel (0:NZSLINE) */
/*
* The zs_wreg, zs_next and zs_flags fields
* are protected by zs_excl_hi.
*/
};
/*
* Definition for zs_flags field
*
* ZS_CLOSED is for synchronizing with za_soft_active an za_kick_active.
*/
#define ZS_NEEDSOFT 0x00000001
#define ZS_PROGRESS 0x00000002
#ifdef _KERNEL
#define ZS_H_LOG_MAX 0x8000
/*
* ZSSETSOFT macro to pend a level 3 interrupt if one isn't already pending.
*/
extern int zssoftpend; /* secondary interrupt pending */
extern ddi_softintr_t zs_softintr_id;
if (!zssoftpend) { \
zssoftpend = 1; \
} \
}
#endif /* _KERNEL */
/*
* Lock priority definitions.
* XXX: These should be obtained from configuration data, eventually.
*/
/*
* Definitions for generic SCC programming routine
*/
struct zs_prog {
};
/*
* Definitions for zs_prog flags field
*/
extern void setzssoft(void);
extern char *zssoftCAR;
extern int nzs;
extern struct zsops zsops_null;
extern int zs_drain_check;
#ifdef __cplusplus
}
#endif
#endif /* !_SYS_ZSDEV_H */