/* $Copyright:	$
 * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 
 * Sequent Computer Systems, Inc.   All rights reserved.
 *  
 * This software is furnished under a license and may be used
 * only in accordance with the terms of that license and with the
 * inclusion of the above copyright notice.   This software may not
 * be provided or otherwise made available to, or used by, any
 * other person.  No title to or ownership of the software is
 * hereby transferred.
 */

#ident "$Header: sec_modes.h 1.3 89/08/07 $"

#ifndef	_SYS_SEC_MODES_H_

/*
 * sec_modes.h
 * 	Definitions of the structures used for geting and setting
 *	modes on the SCED board.
 */

/* $Log:	sec_modes.h,v $
 */


/*
 * structure for set modes command.  Ptr to this goes in channel status ptr
 */
struct sec_smode {
	int	sm_status;			/* status from this cmd */
	union {
		struct sec_cons_modes {
			short	cm_baud;	/* baud rate */
			short	cm_flags;	/* flags for stop bits, dtr etc */
		} sm_cons;
		struct sec_ether_smodes {
			unchar	esm_addr[6];	/* ether address */
			short	esm_size;	/* constant iat chunk size */
			short	esm_flags;	/* receive mode flag */
		} sm_ether;
		struct sec_scsi_smodes {
			short	ssm_timeout;	/* bus timeout */
			short	ssm_flags;	/* used Single ended or diff connect */
		} sm_scsi;
		struct sec_tod_modes {
			int	tod_freq;	/* interrupt frequency */
			int	tod_newtime;	/* new time for TOD clock */
		} sm_tod;
		int	sm_wdt_mode;		/* wd timer mode */
 		struct sec_board_modes {
 			struct sec_powerup *sec_powerup;
 			short	sec_dopoll;
			short	sec_errlight;		/* error light */
 			struct reboot	*sec_reboot;	/* see cfg.h */
 		} sm_board;
		struct cons_mem sm_mem;
#ifdef	KERNEL_PROFILING
		struct kp_modes sm_kp;
#endif	/* KERNEL_PROFILING  */
	} sm_un;
};

/* Console Flags */
#define SCONS_STOP1		0x0000
#define SCONS_STOP1P5		0x0001
#define SCONS_STOP2		0x0002
#define SCONS_ALL_STOP		0x0003

#define SCONS_DATA8		0x0000
#define SCONS_DATA7		0x0004
#define SCONS_ALL_DATA		0x0004

#define SCONS_NO_PARITY		0x0000
#define SCONS_EVEN_PARITY	0x0008
#define SCONS_ODD_PARITY	0x0010
#define SCONS_ALL_PARITY	0x0018

#define SCONS_SEND_CARRIER	0x0000
#define SCONS_IGN_CARRIER	0x0020

#define SCONS_SET_DTR		0x0000
#define SCONS_CLEAR_DTR		0x0040

#define SCONS_SEND_BREAK	0x0000
#define SCONS_DIAG_BREAK	0x0080
#define SCONS_IGNORE_BREAK	0x0100
#define SCONS_ALL_BREAK		0x0180

#define SCONS_DHMODE		0x0000
#define SCONS_DZMODE		0x0200

#define SCONS_CARRIER_SET	0x0000
#define SCONS_CARRIER_CLEAR	0x0400

#define SCONS_SET_RTS		0x0000
#define SCONS_CLEAR_RTS		0x0800

#define SCONS_CLEAR_BREAK	0x0000
#define SCONS_SET_BREAK		0x1000

#define SCONS_CRT_ERASE		0x8000

#define SCONS_SETABLE	(SCONS_ALL_STOP | SCONS_ALL_DATA \
	| SCONS_ALL_PARITY | SCONS_IGN_CARRIER | SCONS_CLEAR_DTR \
	| SCONS_CLEAR_RTS | SCONS_SET_BREAK)

#define SCONS_PRESERVE	(SCONS_ALL_BREAK | SCONS_CRT_ERASE)

#define SCONS_TRANSIENT	(0xFFFF & ~(SCONS_PRESERVE | SCONS_SETABLE))

/* Console info error bits */
#define SCONS_TIMEOUT		0x1
#define SCONS_BREAK_DET		0x2
#define SCONS_CARR_DET		0x4
#define SCONS_OVRFLOW		0x8
#define SCONS_FLUSHED		0x10
#define SCONS_PARITY_ERR	0x20
#define SCONS_FRAME_ERR		0x40

/* Ether mode flags */
#define SETHER_DISABLE		0
#define SETHER_PROMISCUOUS	1
#define SETHER_S_AND_B		2
#define SETHER_MULTICAST	3
#define SETHER_LOOPBACK		4

/* Front panel error light */
#define SERR_LIGHT_ON		 1
#define SERR_LIGHT_SAME		 0
#define SERR_LIGHT_OFF		-1


/* value of the cib_status pointer upon SINST_RETTODIAG command */
#define SRD_BREAK	(int *)0	/* returning from BREAK, halts */
#define SRD_POWERUP	(int *)1	/* use powerup defaults */
#define SRD_REBOOT	(int *)2	/* use setmode data */

/*
 * structure for get modes command.  Ptr to this goes in channel status ptr
 */
struct sec_gmode {
	int	gm_status;		/* status from this instruction */
	union {
		struct sec_cons_modes gm_cons;		/* console data */
		struct sec_ether_gmodes {
			struct sec_ether_smodes egm_sm;	/* same as set modes */
			int egm_rx_ovfl;	/* number of dma overflows */
			int egm_rx_crc;		/* number of crc errors */
			int egm_rx_dribbles;	/* number of dribbles */
			int egm_rx_short;	/* number of short packets */
			int egm_rx_good;	/* number of good packets */
			int egm_tx_unfl;	/* number of dma underflows */
			int egm_tx_coll;	/* number of collisions */
			int egm_tx_16x_coll;	/* number of 16x collisions */
			int egm_tx_good;	/* number of good packets sent */
		} gm_ether;
		struct sec_wdt_gmodes {
			int gwdt_time;		/* time between expirations */
			int gwdt_expired;	/* number of times light has expired */
		} gm_wdt;
		struct sec_tod_modes	gm_tod;	/* time of day data */
		struct sec_scsi_gmodes {
			struct	sec_scsi_smodes sgm_sm;	/* same as scsi set mode */
			int	sgm_bus_parity;	/* number of bus parity errors seen */
		} gm_scsi;
 		struct sec_board_modes	gm_board; /* same as board set mode */
		struct cons_mem gm_mem;
#ifdef	KERNEL_PROFILING
		struct kp_modes gm_kp;
#endif	/* KERNEL_PROFILING  */
	} gm_un;
};

#define	_SYS_SEC_MODES_H_
#endif	/* _SYS_SEC_MODES_H_ */
