DataMuseum.dk

Presents historical artifacts from the history of:

Regnecentalen RC-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Regnecentalen RC-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦52740534e⟧ TextFile

    Length: 13478 (0x34a6)
    Types: TextFile
    Notes: Uncompressed file

Derivation

└─⟦82ee0715d⟧ Bits:30004771 Terminal Driver Rel. 1.2 (3.5 inch)
└─⟦82ee0715d⟧ UNIX Filesystem
    └─⟦1384761f8⟧ »RCTDR.ISC/new/usr/include/sys/td.h.Z« 
    └─⟦1384761f8⟧ »RCTDR.SCO/new/usr/include/sys/td.h.Z« 
└─⟦ca69fd3f9⟧ Bits:30004770 Terminal Driver Rel. 1.2 (5.25 inch)
└─⟦ca69fd3f9⟧ UNIX Filesystem
    └─⟦1384761f8⟧ »RCTDR.ISC/new/usr/include/sys/td.h.Z« 
    └─⟦1384761f8⟧ »RCTDR.SCO/new/usr/include/sys/td.h.Z« 
        └─⟦this⟧ 

TextFile

/*
 *				Copyright (c) 1991 RC International
 *						All Rights Reserved
 */

/*
 *	Declarations for RC International Terminal Driver
 */

#ident	"@(#)td.h	1.1, RC International, 91/11/15"

#include <sys/csp.h>

typedef unsigned short shared_t;	/* addresses within shared memory	*/

#define	TD_U_UNIT(x)	(x%10)
#define	TD_U_TYPE(x)	((x/10)%10)
#define	TD_U_DEVS(x)	(x/100)

#define	TD_FIXEDTYPE(x)	(x+4)

#define	TD_U_FIELD(d,t,u)	(d*100 + t*10 + u)

#define	RCLAN_TYPE_FIXED	TD_FIXEDTYPE(RCLAN_TYPE)
#define	RCCOM_TYPE_FIXED	TD_FIXEDTYPE(RCCOM_TYPE)

#define	TD_DEVGATE	MUX_GATE

#define	EXBAUD		0070000

#define	TRUE		1
#define	FALSE		0

#define TDTRACE		0				/* minor number for trace			*/
#define TDTEST		1				/* minor number for test			*/
#define TDCONF		2				/* minor number for conf			*/

#define	CHANS		496				/* !!!! OLD STUFF */

#define	TD_POOL		0
#define	TD_FIX		1
#define	TD_MUX		2

#define	MUX_1		5
#define	MUX_2		6
#define MUX_CHAN	48	/* td_chans per MUX board */

#define ASCII		0
#define ISO_HOST	1
#define	IBM_DOS		2

#define	TTOPRI		29
#define	TTIPRI		28

#define	NON_ATT		0
#define	NAME_ATT	3
#define	NOTE_ATT	2

#define MAXOUTS		2	/* at most 2 outputs outstanding				*/
#define ATTN_OUT	4	/* Attentions out for each board				*/

#define CB_SIZE		(sizeof(struct cmd_descr))

#define CAN_SIZE	255 /* max size of count in input buffer			*/
#define CAN2_SIZE	257 /* buffer + 2 for link in canon					*/

/* bits in td_ctlr.state */
#define BD_MISSING		0x0001	/* tdgate1 i.e. 1. intr. not rec. yet 	*/
#define BD_ERROR		0x0002	/* some fatal error occurred			*/
#define	BD_PRESENT		0x0004	/* board present						*/
#define BD_OK			0x0010	/* board downloaded without error		*/
#define BD_FATAL  		(BD_ERROR | BD_MISSING)

#define WANT_CMD_BUF	0x0100	/* set if sleeping for cmd. descr.		*/
#define WANT_OUT_CMD	0x0400	/* set if sleeping for output buffer	*/

/* bits in td_dev.state */
#define	C_INDEV		0x00000001	/* bit  0: INPUT device						*/
#define	C_OUTDEV	0x00000002	/* bit  1: OUTPUT device					*/
#define	C_TERMIO	0x00000004	/* bit  2: TERMIO device					*/
#define	C_PRN		0x00000008	/* bit  3: PRINTER device					*/
#define	C_OPEN		0x00000010	/* bit  4: device open						*/
#define	C_CLOSED	0x00000020	/* bit  5: device closed					*/
#define	C_WOPEN		0x00000040	/* bit  6: waiting for open to finish		*/
#define	C_WCLOSE	0x00000080	/* bit  7: waiting to close					*/
#define	C_INPUT		0x00000100	/* bit  8: input buffer outstanding			*/
#define C_ORDER		0x00000200	/* bit  9: put < get in input buffer		*/
#define C_TIMEOUT	0x00000400	/* bit 10: timeout status (non canon)		*/
								/* bit 11 */
#define	C_INSLP		0x00001000	/* bit 12: sleep in read					*/
#define	C_OUTSLP	0x00002000	/* bit 13: sleep in write					*/
#define	C_TERMSLP	0x00004000	/* bit 14: sleep in terminate				*/
#define	C_OPENSLP	0x00008000	/* bit 15: sleep in open					*/
#define C_SETMODE	0x00010000	/* bit 16: set_mode active					*/
#define C_STOPPED	0x00020000	/* bit 17: waiting for set_mode				*/
#define C_WAITOUT	0x00040000	/* bit 18: wait for output to finish		*/
#define	C_WATTN		0x00080000	/* bit 19: waiting for specific attention	*/
#define	C_CARR_OFF	0x00100000	/* bit 20: carrier off						*/
#define C_HANGUP	0x00200000	/* bit 21: channel offline					*/
#define	C_REMOTE	0x00400000	/* bit 22: allocated by other board			*/
#define	C_DISCON	0x00800000	/* bit 23: device disconnected				*/
								/* bit 24 */
#define	C_WRITE		0x02000000	/* bit 25: write call active				*/
								/* bit 26 */
#define	C_WCONNECT	0x08000000	/* bit 27: waiting for connection			*/
#define C_TRACE		0x10000000	/* bit 28: tdtrace active					*/
								/* bit 29 */
								/* bit 30 */
								/* bit 31 */


/* Various combinations of above flags					*/

#define	C_LOGIN		(C_INDEV | C_OUTDEV | C_TERMIO)
#define	C_PRINTER	(C_OUTDEV | C_PRN)
#define C_USED		(C_INDEV | C_OUTDEV | C_TERMIO | C_PRN)
#define C_OPENFLAGS	(C_CLOSED | C_OPENSLP | C_OPEN | C_WCLOSE)
#define C_TERMOK	(C_TERMIO | C_OPEN)
#define	C_INOK		(C_INDEV | C_OPEN)
#define	C_OUTOK		(C_OUTDEV | C_OPEN)
#define C_OPENINIT  (C_OPENFLAGS | C_USED) /* Mask for open initialization */
#define SET_STATUS(X)	((td->state & ~C_OPENFLAGS) | X)

#define I_CONV		0160331
#define O_CONV		0163730
#define C_CONV		0106160
#define L_CONV		0177760
#define O_ANYP		0300

#define U_NEU   0x01		/* Neutral device						*/
#define U_LOG   0x02		/* Login device							*/
#define U_PRN   0x04		/* Printer								*/
#define U_COP	0x08		/* Hardcopy device, read only			*/
#define U_MOD   0x10		/* Modem flag							*/
#define U_PAR	0x20		/* Parallel Printer						*/
#define U_NLG	0x40		/* Nologin Device						*/

struct pr_chan_st {			/* Configuration flags pr channel			*/
	ushort		p_cflg; 	/* cflag - see termio						*/
	unchar		p_use;		/* Flags for RC. - C_USED					*/
	unchar		p_tabs;		/* Tab value ln2							*/
	unchar		p_xontime;	/* timeout before xoff is disregarded		*/
	unchar		p_modem;	/* modem type								*/
	ushort		p_res;		/* reserved for future use (should be zero)	*/
};

/*		Xon Timeout : 0  infinit   (Default)			*/
/*                            1   1 sec.				*/
/*                            2   5 sec.				*/
/*                            3  20 sec.				*/

struct param_st {
    char				ps_reserved[16];	/* reserved for funny things	*/
	struct pr_chan_st	p_dev[MUX_CHAN]; 	/* Pr. dev structure			*/
};

struct td_cfg {				/* struct from which td is configured	*/
	short	c_present;		/* controller present					*/
	short	c_unit_no;		/* asl controller number				*/
	short	c_ctlr_type;	/* controller type						*/
	short	c_no_devs;		/* number of chans on controller		*/
};

struct td_board {
	ushort	tb_base;
	ushort	tb_devs;
};

struct mode {
	unsigned short		m_iflag, m_oflag, m_cflag,m_lflag;
	unsigned short		m_intr, m_quit, m_erase, m_kill, m_eof,
						m_nl, m_eol, m_susp, m_bslsh, m_chost;
	unsigned short		m_timeout, m_minimum, m_maximum;
};

struct open_res {
	unsigned short		op_appl;
	struct mode			op_mode;
	char 				op_type[10];
	char				op_name[10];
};

#define	OPB_SIZE	sizeof(struct open_res)

struct td_dev {						/*		per-channel structure			*/
	int					state;		/* 00:	Various flags, See above.		*/
	shared_t			inbuf;		/* 04:	buffer being used for input		*/
	shared_t			put;		/* 06:	act. input addr in inbuf		*/
	shared_t			get;		/* 08:	ptr to next read from inbuf		*/
	shared_t			next;		/* 0a:	next link addr. in canon inbuf	*/
	shared_t			free;		/* 0c:	consecutive free space in inbuf	*/
	shared_t			top;		/* 0e:	first unused in inbuf NON CANON	*/
	short   			ccb;		/* 10:	CANON: count in current line	*/
									/*		NON CANON: Total count in inbuf	*/
	short				chan_no;	/* 12:	Channel no. on board			*/
	struct td_ctlr		* ctlr;		/* 14:	Board pointer for this channel	*/
	ushort				icflag;		/* 18:	Initail cflag from param file 	*/
	ushort				iflag;		/* 1a:	input modes						*/
	ushort				oflag;		/* 1c:	output modes					*/
	ushort				cflag;		/* 1e:	control modes					*/
	ushort				lflag;		/* 20:	line discipline modes			*/
	ushort				xflag;		/* 22:	external protocol modes 		*/
	short				outbufs;	/* 24:	count of outputs waiting on mux	*/
	short				pgrp;		/* 26:	process group name 				*/
	short				delct;		/* 28:	Canon delimeter counter			*/
	unchar				cc[NCC+2];	/* 32:	settable control chars 			*/
	struct tncon		tncon;		/* 40:	*/
	int					ctimeid;	/* 44:	*/
    struct open_res		* open_res;	/* 48:	*/
	struct mode			* mode_buf;	/* 4c:	*/
#ifdef VPIX
    v86_t				* pv86;		/* 50:	*/
    unchar				v86int;		/* 54:	*/
#else
	void				* pv86;		/* 50:  SCO alignment */
    unchar				v86int;		/* 54:	SCO alignment */
#endif
    unchar				cspver;		/* 55:	*/
	shared_t			open_buf;	/* 56:	*/
	struct cmd_descr	* in_cmd;	/* 58:	*/
	struct cmd_descr	* stat_cmd;	/* 5c:	*/
    struct cmd_descr	* out_cmd;	/* 60:	*/
	proc_t				* rproc;	/* 64:	*/
	proc_t				* wproc;	/* 68:	*/
	proc_t				* eproc;	/* 6c:	*/
	char				sel_flg;	/* 70:	*/
	char				mstate;		/* 71:	*/
	unchar				mchar;		/* 72:	*/
	char				merr;		/* 73:	*/
	char				xstate;		/* 74:	*/
	struct emap			* mp;		/* 78:	*/
};									/* 7c:	*/

/* hook for SCO select call */
#define READ_COLLISION		0x02
#define	WRITE_COLLISION		0x04
#define	EXCEPT_COLLISION	0x08
#define	FEXCEPT				0x04

struct cmd_queue {
	struct cmd_descr	* cmd_first;
	struct cmd_descr	* cmd_last;
};

struct td_ctlr {
	struct x_buf		xb;
	struct mslbuf		msl;
	caddr_t				win;		/* address of common memory			*/
	shared_t			in_fifos;	/* address of in_fifo bufs			*/
	shared_t			open_bufs;	/* address of open result bufs		*/
	shared_t			mem; 		/* Memory available for cmds & bufs	*/
	ushort				state;		/* controller status				*/
	ushort				unit;		/* unit number for this structure	*/
	ushort				type;		/* controller type					*/
	ushort				devs;		/* number of devices on controller	*/
	ushort				fchan;		/* First chan no. on controller		*/
	ushort				lchan;		/* Last + 1 chan no. on controller	*/
	ushort				isize;		/* input buffer size				*/
	ushort				osize;		/* output buffer size				*/
	struct cmd_queue	gen_cmd;	/* generel cmds						*/
	struct cmd_queue	out_cmd;	/* output cmds						*/
	struct cmd_descr	* chainend;	/* last cmd in current cmd chain	*/
};

#define	TC_FIXED		0x04

/* cmd->status bits */
#define	C_ANSWER		0x80
#define	C_QUEUE			0x40
#define	C_HOME			0x20
#define	C_SEND			0x10
#define	C_MASK			0xf0

struct cmd_descr {
	shared_t			next;		/* next in chain of cmd-descr's			*/
	unchar				operation;	/* opcode								*/
	unchar				channel;	/* channel number						*/
	unchar				result;		/* mux's response 						*/
	unchar				status;		/* Alignment - used by TCI-FW			*/
	shared_t			bufadr;		/* address of related buffer			*/
	shared_t			size;		/* size of buffer used 					*/
	shared_t			cd_count;	/* actual number of chars read			*/
	unchar				mode;		/* close mode							*/
    unchar				unit;		/* close unit							*/
	unchar				state;		/* line state (offline/online)			*/
    union {
	    unchar	u_prst;	/* printer status (paper end / deselect ..)		*/
	    unchar	u_vrs;	/* csp terminal csp protocol version			*/
    } cmd_union;
};
#define prstat	cmd_union.u_prst
#define cspvers	cmd_union.u_vrs


struct memdescr {
	shared_t			m_paroff;	/* Offset to param area in mux window	*/
	shared_t			m_prioff;	/* Offset to private mem in mux window	*/
	shared_t			m_size;		/* Size of private mem in mux window	*/
	shared_t			m_boff;		/* Physical address of window (64K)		*/
};

/* operation codes */

#define TCI_BOARD_STATUS	0x00	/* Error on CII  detected by firmware   */
#define TCI_OPEN			0x01	/* Open channel							*/
#define	TCI_CLOSE			0x02	/* Close channel						*/
#define TCI_ASSIGN			0x03	/* Setup work area for Term.char & fifo */
#define	TCI_SET_MODE		0x04	/* Set channel mode witk mode struct	*/
#define TCI_LINK			0x05	/* Pass through command					*/
#define	TCI_INPUT			0x06	/* Normal Input command					*/
#define	TCI_OUTPUT			0x07	/* Normal Output command				*/
#define	TCI_WRITE			0x08	/* Output to none open TERMIO device	*/
#define	TCI_TERMINATE		0x09	/* Terminated inputs out				*/
#define	TCI_STATUS			0x0a	/* Channel status (No inputs out) 		*/
#define TCI_MODEM_CNTRL		0x0b	/* Used for Modem Control				*/
#define TCI_SET_CONV		0x0c	/* Set conversion						*/
#define TCI_ATTENTION		0x0f	/* Channel attention command			*/

/* possible responses */

#define	R_OK		0		/* Response ok.						*/
#define R_NL		0x00	/* 00 input terminated with newline	*/
#define R_EOL		0x01	/* 01 input terminated by eol char	*/
#define R_EOF		0x02	/* 02 input terminated by eof char	*/
#define R_FULL		0x20	/* 32 input buffer full				*/
#define R_TERMIN	0x21    /* 33 input terminated by request	*/
#define R_TIMEOUT	0x22	/* 34 input terminated by timeout	*/
#define R_INTR		0x40	/* 64 intr char typed 				*/
#define R_QUIT		0x41	/* 65 quit char typed 				*/
#define R_OFFL		0x42 	/* 66 device offline  				*/
#define R_CLOSED	0x43	/* 67 device closed					*/
#define R_NO_PROC	0x44	/* 68 Output buffer not processed	*/
#define R_ONL		0x45	/* 69 device online					*/
#define R_BRKINTR	0x46	/* 70 BREAK interrupt received		*/
#define	R_REGRET	0x48	/* 72 Command regretted				*/
#define R_ISOPEN	0x49	/* 73 Channel in use from CSP-LAN ?	*/
#define R_SPECIAL	0x40	/* Regret,intr,quit or offline flag	*/
#define R_ERROR		0x80	/* 128 Fatal error flag				*/
#define	R_INVALID	0x81	/* 129 Invalid operation			*/
#define	R_ILLEGAL	0x82	/* 130 Illegal channel no. 			*/
#define	R_NO_CONF	0x83	/* 131 Channel not configured 		*/
#define	R_UNUSED	0x84	/* 132 Channel is configured unused	*/
#define	R_NO_OPEN	0x85	/* 133 Channel is not opened		*/
#define R_BUSY		0x87	/* 135 Channel is used by CSPTERM	*/
#define	R_ILL_MODEM	0x88	/* 136 Illegal modem cntrl command	*/
#define R_LIMIT		0x8d	/* 141 Response < R_LIMIT			*/

#ifdef VPIX
#define AIOC    ('A'<<8)
#define AIOCINTTYPE     (AIOC|60)        /* set pseudorupt personality */
#define AIOCDOSMODE     (AIOC|61)        /* set DOSMODE */
#define AIOCNONDOSMODE  (AIOC|62)        /* reset DOSMODE */
#define AIOCSERIALOUT   (AIOC|63)        /* serial device data write */
#define AIOCSERIALIN    (AIOC|64)        /* serial device data read */
#define AIOCSETSS       (AIOC|65)        /* set start/stop chars */
#define AIOCINFO        (AIOC|66)        /* tell user what device we are */
#endif /* VPIX */


/* Some macro's for easy reading */

#define	CMD_PTR(X)		(struct cmd_descr *)((int)(tc->win + X))
#define	CMD_OFF(X)		(shared_t)((int)X - (int)(tc->win))
#define	NIL(X)			((struct X *)NULL)
#define SHARED_PTR(X,Y)	(struct X *)((int)(tc->win + Y))