File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / sys / bsc / bsc.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:24:19 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v12b, v121, HEAD
Power 6/32 Unix version 1.2b

/*	D.L.Buck and Associates, Inc. - %H%
 *	%W% %Q% CCI
 *
 *	BISYNC Driver
 *	... header definitions for driver body
 */

#define MXVIOC_B	4	/* Max BISYNC controllers can be supported */
				/* Can be 16 by reset this definition 	*/
#define	NBSC	4		/* No of single-station/controller */
#define	NBSM	4		/* No of multipoint station/controller */
#define MX_NBSM MXVIOC_B*NBSM
#define MX_NBSC MXVIOC_B*NBSC
#define NBSSUB	16		/* Only allow 16 subdev/multipoint station */
#define	LDISP	6
#define	BSCPRI	TTIPRI		/* sleep priority for BISYNC driver */
#define SSLOCK  0x80		/* lock for single station*/

struct xlist {				/* Transmit list structure	*/
	short xnum;			/* # bytes to send, and flags	*/
	char *xptr;			/* Ptr to bytes to be sent	*/
	};

/* BSC Device Structure:						*/
struct bsc {
	unsigned long  b_hlflgs;	/* general use flags */
	char *b_rclptr; 		/* receive list */
	char *b_rxcls;			/* ptr to ebcdic/ascii char class tbl*/
	char *b_rxdptr;			/* ptr to data area in buffer */
	char *b_rxhptr;			/* ptr to hdr area in iocout */
	short b_sema;			/* Synchronization mechanism */
	short b_lock;			/* Lock on device */
					/* if unused , zero*/
					/* if locked for single station,*/
					/* value will be the number of */
					/* stations using this */
	short b_bscto;			/* timeout count */
	short b_rxhcnt;			/* count of header bytes */
	short b_rxcnt;			/* count of data bytes */
	short b_tmperr;			/* # temporary errors in psm */
	short b_cntl;			/* low-level control flags */
	short b_rxst0;			/* low-level rcv state */
	short b_bsize;			/* # bytes in buffer (to follow) */
	char b_state;			/* protocol machine state */
	char b_nstate;			/* state to follow end of send */
	char b_class0;			/* low-level rcv char type */
	char b_class1;			/* last frame type received */
	char b_mode;			/* current mode (see below) */
	char b_trace;			/* trace mode flag */
	char b_psmbsy;			/* psm busy flag */
	char b_alarm;			/* alarm clock */
	char b_alenb;			/* alarm enabled */
	char b_crc[2];			/* cyclic redundancy check */
	short b_rdflag;			/* if set, have read a block */
	char *b_devregs;		/* ** system-specific device regs */
	struct vxcmd *b_cmdbuf;		/* ** command buffer */
	struct bscio b_iocin;		/* SET parameters from ioctl */
	struct bscio b_iocout;		/* GET parameters for  ioctl */
	char b_buffer[BSCMBLK];		/* bsc buffer */
	struct xlist b_txlst[7];	/* Transmit list		*/
	struct xlist *b_txlptr;		/* Ptr to current b_txlst elem.	*/
};

/* Structure definitions for station-specific data:			*/
struct bscsub {
	long  bs_flags;			/* Flags: like hlflgs		*/
	char bs_mode;			/* Mode: see below		*/
	char bs_err;			/* Error indicator		*/
	short bs_size;			/* Tx block size		*/
	short bs_rdflg;			/* Station's rd timeout ctr	*/
	short bs_sema;			/* Station's semaphore		*/
	char bs_buf[256];		/* Station's Tx buffer		*/
};

/* states: see bscpsm.c */

/* class0: see bscll.c */

/* class1: */

#define C_RTO	-1
#define C_ENQ	0
#define C_EOT	1
#define C_NAK	2
#define C_ETX	3
#define C_ETB	4
#define C_WAK	5
#define C_RVI	6
#define C_AK0	7
#define C_AK1	8
#define C_TTD	9
#define	C_IUS	99		/* (not used) */
#define	NC	10		/* # of frame types */

/* modes: */
#define BSC_CLOSED	0	/* closed */
#define BSC_INIT	1	/* never been used for reading or writing */
#define BSC_IDLE	2	/* been used, but inactive at the moment */
#define BSC_READ	3	/* in use now for reading */
#define BSC_WRITE	4	/* in use now for writing */
#define	BSC_CL1		5	/* closing - send disconnect */
#define	BSC_CL2		6	/* disconnect sent */

/* driver bits in b_hlflgs: */
#define BSC_SWAK	0x10000	/* send WACK */
#define BSC_FULL	0x8000	/* buffer is presently full */
#define BSC_XTRN	0x4000	/* send next block as transparent */
#define BSC_XSOH	0x2000	/* send next block with leading SOH, not STX */
#define BSC_XLAST	0x1000	/* next block is last to be sent - term. with ETX */
#define BSC_ACK		0x0800	/* even/odd acknowledgement for next block */
#define BSC_CRCERR	0x0400	/* received last block with crc error */
#define	BSC_DSR		0x0200	/* present DSR status */
#define	BSC_POLLWT	0x0100	/* Wait for Poll/Select */
#define BSC_ERR		0x0080  /* error bit */
/* remainder of bits defined in bscio.h */

/* semaphore definitions: */
#define	BSC_DBUSY	1	/* Driver busy */
#define	BSC_PBUSY	2	/* PSM busy */
#define	BSC_DDONE	4	/* Driver done */
#define	BSC_PDONE	8	/* PSM done */
#define BSC_FACK	0x20	/* Fast ack mode for read->write */
#define BSC_SEENBUF	0x10	/* Read buffer before fast ack */
#define	BSC_NDLY	0x40	/* read-no-delay mode */
#define	BSC_INPSM	0x80	/* PSM executing */

/* extra flags for xnum and b_cntl: */

#define	X_SHUT	0x8000	/* Shut down transmitter */
#define	X_SYNC	0x4000	/* Send two sync characters */
#define	X_CRC	0x2000	/* This block to have crc accumulated */
#define	X_SKIP	0x1000	/* Skip crc accum on next character */
#define	X_IUS	0x0800	/* IUS being sent (as well as crc) */
#define	X_ACMCRC 0x100	/* Accumulate CRC on next byte */

struct state {		/* psm state table definition */
	char s_type;		/* d: decision, e: error, f:function,
				 * r: receive,	s:send
				 */
	unsigned char s_next;	/* next state ... d: unused, f: always used,
				 *		  e, s: always used,
				 *		  r: used in timeout
				 */
	char s_ord;		/* r: ordinal of receive list,
				 * s: ordinal of send list;
				 * f,d: ordinal of function;
				 * e: ordinal of error
				 */
};

#define EBCSYN		0x32		/* EBCDIC for SYNchronous idle */
#define ASCSYN		0x16		/* ASCII  for SYNchronous idle */

/* multipoint mode codes */
/* set for each individual station in bscsub.bs_mode*/

#define  BS_FREE   0
#define  BS_IDLE   1
#define  BS_READ   2
#define  BS_WRITE  3

/* multipoint flag codes */
/*set for each station in bscsub.bs_flags*/

#define  BS_ERR   0x0080
#define  BS_FULL  0x8000
#define  BS_LAST  0x1000

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.