|
|
DataMuseum.dkPresents historical artifacts from the history of: Regnecentalen RC-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Regnecentalen RC-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T U m
Length: 11499 (0x2ceb)
Types: TextFile
Notes: UNIX file
Names: »mux.h«
└─⟦aca99617e⟧ Bits:30004042/update3.imd SW95705I 386/ix Multi-user Release 1.2
└─⟦aca99617e⟧ UNIX Filesystem
└─⟦this⟧ »U3/new/usr/include/sys/mux.h«
/* mux.h
* Started 860116 HCA
*
* Modified for Rel4.0 ( MSL-II) 860528 HCA
*
* 87.04.23 moved from rc39 to xyz
* 87.12.17 AIOC redefined
* 88.01.14 buffer sizes redefined for 64 devices
* 88.07.11 csp version 4
*/
#include "sys/csp.h"
typedef unsigned short mux_t; /*addresses within shared memory*/
#define MUXTEST 255 /* minor number for test */
#define ASCII 0
#define ISO 1
#define IBM_DOS 2
#define MAX_CHAN 48 /* channels per mux board */
#define TTOPRI 29
#define TTIPRI 28
#define MAXOUTS 2 /* at most 2 outputs outstanding */
#define ATTN_OUT 4 /* Attentions out for each board */
#define IB_SIZE 512 /* Input buffer size */
#define ITC_C_BUFFS 200 /* Number of command descriptors */
#define CB_SIZE (sizeof(struct cmd_descr))
#define ITC_O_HIGH 128 /* Max number of output. buffers */
#define ITC_O_LOW 64 /* Min number of output buffers accepted */
#define OB_SIZE 256 /* Size of output buffer */
#define ITCBUFF 255 /* max size of count in input buffer */
#define NOCC 512 /* default size of non canon count */
#define ITCBUFF_2 257 /* buffer + 2 for link in canon */
#define CAN_LIM (IB_SIZE - ITCBUFF_2)
/*bits in mux_status*/
#define ITC_MISSING 0x0001 /* muxgate1 i.e. 1. intr. not rec. yet */
#define ITC_ERROR 0x0002 /* some fatal error occurred */
#define ITC_FATAL (ITC_ERROR | ITC_MISSING)
#define ITC_OK 0x0010 /* board downloaded without error */
#define WANT_C_SPACE 0x1100 /*set if sleeping for cmd. descr. */
#define WANT_O_SPACE 0x1400 /*set if sleeping for output buffer */
#define WANT_SPACE 0x1000 /*set if sleeping for any buffer */
#define AND_SPACE 0xe0ff /*Clear all SPACE flags */
/*bits in chan_status*/
#define C_TASLP 0x000001 /* Sleep in read for terminate input */
#define C_WOPEN1 0x000002 /* Secondary wait for open */
#define C_TERMIO 0x000004 /* Termio dev. read/write/ioctl allowed */
#define C_PRINTER 0x000008 /* Printer device */
#define C_CLOSED 0x000010 /* Channel Closed (Good!) */
#define C_WOPEN 0x000020 /* Want open on channel (Sleeping on open) */
#define C_ISOPEN 0x000040 /* Channel is open (Could be serious!) */
#define C_WCLOSE 0x000080 /* Want close on channel. (Recommendable) */
#define C_IASLP 0x000100 /* Sleep in read */
#define C_ORDER 0x000200 /* Set if put < get in input buffer */
#define C_INOUT 0x000400 /* Input buffer out */
#define C_OASLP 0x000800 /* Sleep in output */
#define C_STOPPED 0x001000 /* Channel is stopped due to set_mode */
#define C_WAITO 0x002000 /* wait for output to finish */
#define C_HANGUP 0x004000 /* Channel offline */
#define C_COPYDEV 0x008000 /* Hardcopy device */
#define C_TIMEOUT 0x010000 /* Timeout status (non canon input) */
#define C_WTO 0x020000 /* Waiting for timeout or open */
#define C_REMOTE 0x040000 /* Allocated by CSPTERM */
#define C_WATTN 0x080000 /* Waiting for specific attention */
#define C_CARR_OFF 0x100000 /* carrier off flag */
#define C_7BIT 0x200000 /* send esc sequence on close */
#define C_SETMODE 0x400000 /* set_mode active */
/* Various combinations of above flags */
#define C_USED (C_TERMIO | C_PRINTER | C_COPYDEV)
#define C_OPENFLAGS (C_CLOSED|C_WOPEN|C_ISOPEN|C_WCLOSE)
#define C_TERMOK (C_TERMIO | C_ISOPEN) /* channel open and TERMIO */
#define C_OPENINIT (C_OPENFLAGS | C_USED) /* Mask for open initialization */
#define SET_STATUS(X) ((tp->chan_status & ~C_OPENFLAGS) | X)
#define U_NEU 0x1 /* Neutral device */
#define U_LOG 0x2 /* Login device */
#define U_PRN 0x4 /* Printer */
#define U_MOD 0x8 /* Modem flag */
#define U_COP 0x10 /* Hardcopy device, read only */
\f
struct pr_chan_st { /* Configuration flags pr channel */
short p_cflg; /* cflag - see termio */
char p_rcfl; /* Flags for RC. - C_USED */
char p_tabs; /* Tab value ln2 */
char p_xontime; /* timeout before xoff is disregarded */
char p_modem; /* modem type */
short 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[MAX_CHAN]; /* Pr. dev structure */
};
struct mux_cfg { /* struct from which mux is configured */
short c_boardno; /* asl board number */
short c_fchan; /* first channel no. on board */
short c_lchan; /* last+1 channel no. on board */
};
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_result {
unsigned short op_appl;
struct mode op_mode;
char op_type[10];
char op_name[10];
};
\f
struct mux_chan { /* per-channel structure */
int chan_status; /* Various flags, See above. */
mux_t ibuff; /* ptr to buffer being used for input */
mux_t put; /* ptr to act. input addr in input buffer */
mux_t get; /* ptr to next read from input buffer */
mux_t next; /* next addr. for link in canon input buffer */
mux_t free; /* consecutive free space in input buffer */
mux_t top; /* first unused byte in input buffer (NON CANON) */
short cc_b; /* In canon: count in current canon input */
/* In non_canon: Total count in input buffer */
struct mux_board * board_p;/* Points to board for this channel */
short chan_no; /* Channel no. on board */
ushort init_cflag; /* Initail cflag from param file */
ushort t_iflag; /* input modes */
ushort t_oflag; /* output modes */
ushort t_cflag; /* control modes */
ushort t_lflag; /* line discipline modes */
ushort t_xflag; /* external protocol modes */
short outputs; /* count of outputs waiting on mux */
short t_pgrp; /* process group name */
short t_delct; /* Canon delimeter counter */
unchar t_cc[NCC + 2]; /* settable control chars */
struct tncon t_tncon;
struct cmd_descr * o_cmd;
int t_ctimeid;
int t_otimeid;
struct open_result t_open_result;
#ifdef VPIX
v86_t * t_pv86;
unchar t_v86int;
#endif
unchar t_cspvers;
unchar close_index;
ulong xt_flags;
proc_t *xt_rproc;
proc_t *xt_wproc;
};
struct mux_board {
struct x_buf xb;
struct mslbuf msl;
short fchan; /* First channel no. on board */
short lchan; /* Last + 1 channel no. on board */
char board_no; /* Board number for this structure */
caddr_t mux_window; /* address of common memory */
mux_t mem_avail; /* Memory available for c,i & o buffers */
short mux_status; /* board status */
struct cmd_descr * chainend;
mux_t c_buffs[256]; /* Addrs of unallocated cmd descr. */
unchar c_get; /* Index for next get */
unchar c_put; /* Index to next put */
mux_t o_buffs[ITC_O_HIGH]; /* Addrs of unallocated output buffs */
int o_free; /* No of o buffs unallocated */
};
\f
struct cmd_descr {
mux_t next; /* next in chain of cmd-descr's */
unchar operation; /* opcode */
unchar channel; /* channel number */
unchar result; /* mux's response */
unchar align; /* Alignment - also used internally by ITC-FW */
mux_t bufadr; /* address of related buffer */
mux_t size; /* size of buffer used */
mux_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 comcb {
unsigned short cb_iflag;
unsigned short cb_oflag;
unsigned short cb_cflag;
unsigned short cb_lflag;
unsigned short cb_timer; /* Timer value in 20ms i.e. 5*vtime */
char cb_intr;
char cb_quit;
char cb_erase;
char cb_kill;
char cb_eof;
char cb_eol;
char cb_sp_e; /* Special disconnect enable */
char cb_sp_c; /* Special disconnect character */
char cb_nl; /* Default cannonical terminator (NEWLINE) */
char cb_count; /* Count in ter_tab */
};
\f
struct memdescr {
mux_t m_paroff; /* Offset to param area in mux window */
mux_t m_prioff; /* Offset to private mem in mux window */
mux_t m_size; /* Size of private mem in mux window */
mux_t m_boff; /* Physical address of window (64K) */
};
/*operation codes*/
#define O_CII_ERR 0 /* Error on CII detected by firmware */
#define O_OPEN 1 /* Open channel */
#define O_CLOSE 2 /* Close channel */
#define O_SET_BUF 3 /* Setup work area for Term.char & fifo */
#define O_SET_MODE 4 /* Set channel mode witk comcb struct */
#define O_PASS 5 /* Pass through command */
#define O_INPUT 6 /* Normal Input command */
#define O_OUT_NOR 7 /* Normal Output command */
#define O_OUT_SPEC 8 /* Output to none open TERMIO device */
#define O_TERM_INP 9 /* Terminated inputs out */
#define O_STATUS 10 /* Channel status (No inputs out) */
#define O_MODEM 11 /* Used for Modem Control */
#define O_CONVERT 12 /* Set conversion */
#define O_ATTENTION 15 /* 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_DESEL 0x46 /* 70 Printer status - deselected */
#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_LIMIT 0x8d /* 141 Response < R_LIMIT */
\f
#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 */