|
|
1.1 root 1: /* D.L.Buck and Associates, Inc. - %H%
2: * %W% %Q% CCI
3: *
4: * BISYNC Driver
5: * ... header definitions for driver body
6: */
7:
8: #define MXVIOC_B 4 /* Max BISYNC controllers can be supported */
9: /* Can be 16 by reset this definition */
10: #define NBSC 4 /* No of single-station/controller */
11: #define NBSM 4 /* No of multipoint station/controller */
12: #define MX_NBSM MXVIOC_B*NBSM
13: #define MX_NBSC MXVIOC_B*NBSC
14: #define NBSSUB 16 /* Only allow 16 subdev/multipoint station */
15: #define LDISP 6
16: #define BSCPRI TTIPRI /* sleep priority for BISYNC driver */
17: #define SSLOCK 0x80 /* lock for single station*/
18:
19: struct xlist { /* Transmit list structure */
20: short xnum; /* # bytes to send, and flags */
21: char *xptr; /* Ptr to bytes to be sent */
22: };
23:
24: /* BSC Device Structure: */
25: struct bsc {
26: unsigned long b_hlflgs; /* general use flags */
27: char *b_rclptr; /* receive list */
28: char *b_rxcls; /* ptr to ebcdic/ascii char class tbl*/
29: char *b_rxdptr; /* ptr to data area in buffer */
30: char *b_rxhptr; /* ptr to hdr area in iocout */
31: short b_sema; /* Synchronization mechanism */
32: short b_lock; /* Lock on device */
33: /* if unused , zero*/
34: /* if locked for single station,*/
35: /* value will be the number of */
36: /* stations using this */
37: short b_bscto; /* timeout count */
38: short b_rxhcnt; /* count of header bytes */
39: short b_rxcnt; /* count of data bytes */
40: short b_tmperr; /* # temporary errors in psm */
41: short b_cntl; /* low-level control flags */
42: short b_rxst0; /* low-level rcv state */
43: short b_bsize; /* # bytes in buffer (to follow) */
44: char b_state; /* protocol machine state */
45: char b_nstate; /* state to follow end of send */
46: char b_class0; /* low-level rcv char type */
47: char b_class1; /* last frame type received */
48: char b_mode; /* current mode (see below) */
49: char b_trace; /* trace mode flag */
50: char b_psmbsy; /* psm busy flag */
51: char b_alarm; /* alarm clock */
52: char b_alenb; /* alarm enabled */
53: char b_crc[2]; /* cyclic redundancy check */
54: short b_rdflag; /* if set, have read a block */
55: char *b_devregs; /* ** system-specific device regs */
56: struct vxcmd *b_cmdbuf; /* ** command buffer */
57: struct bscio b_iocin; /* SET parameters from ioctl */
58: struct bscio b_iocout; /* GET parameters for ioctl */
59: char b_buffer[BSCMBLK]; /* bsc buffer */
60: struct xlist b_txlst[7]; /* Transmit list */
61: struct xlist *b_txlptr; /* Ptr to current b_txlst elem. */
62: };
63:
64: /* Structure definitions for station-specific data: */
65: struct bscsub {
66: long bs_flags; /* Flags: like hlflgs */
67: char bs_mode; /* Mode: see below */
68: char bs_err; /* Error indicator */
69: short bs_size; /* Tx block size */
70: short bs_rdflg; /* Station's rd timeout ctr */
71: short bs_sema; /* Station's semaphore */
72: char bs_buf[256]; /* Station's Tx buffer */
73: };
74:
75: /* states: see bscpsm.c */
76:
77: /* class0: see bscll.c */
78:
79: /* class1: */
80:
81: #define C_RTO -1
82: #define C_ENQ 0
83: #define C_EOT 1
84: #define C_NAK 2
85: #define C_ETX 3
86: #define C_ETB 4
87: #define C_WAK 5
88: #define C_RVI 6
89: #define C_AK0 7
90: #define C_AK1 8
91: #define C_TTD 9
92: #define C_IUS 99 /* (not used) */
93: #define NC 10 /* # of frame types */
94:
95: /* modes: */
96: #define BSC_CLOSED 0 /* closed */
97: #define BSC_INIT 1 /* never been used for reading or writing */
98: #define BSC_IDLE 2 /* been used, but inactive at the moment */
99: #define BSC_READ 3 /* in use now for reading */
100: #define BSC_WRITE 4 /* in use now for writing */
101: #define BSC_CL1 5 /* closing - send disconnect */
102: #define BSC_CL2 6 /* disconnect sent */
103:
104: /* driver bits in b_hlflgs: */
105: #define BSC_SWAK 0x10000 /* send WACK */
106: #define BSC_FULL 0x8000 /* buffer is presently full */
107: #define BSC_XTRN 0x4000 /* send next block as transparent */
108: #define BSC_XSOH 0x2000 /* send next block with leading SOH, not STX */
109: #define BSC_XLAST 0x1000 /* next block is last to be sent - term. with ETX */
110: #define BSC_ACK 0x0800 /* even/odd acknowledgement for next block */
111: #define BSC_CRCERR 0x0400 /* received last block with crc error */
112: #define BSC_DSR 0x0200 /* present DSR status */
113: #define BSC_POLLWT 0x0100 /* Wait for Poll/Select */
114: #define BSC_ERR 0x0080 /* error bit */
115: /* remainder of bits defined in bscio.h */
116:
117: /* semaphore definitions: */
118: #define BSC_DBUSY 1 /* Driver busy */
119: #define BSC_PBUSY 2 /* PSM busy */
120: #define BSC_DDONE 4 /* Driver done */
121: #define BSC_PDONE 8 /* PSM done */
122: #define BSC_FACK 0x20 /* Fast ack mode for read->write */
123: #define BSC_SEENBUF 0x10 /* Read buffer before fast ack */
124: #define BSC_NDLY 0x40 /* read-no-delay mode */
125: #define BSC_INPSM 0x80 /* PSM executing */
126:
127: /* extra flags for xnum and b_cntl: */
128:
129: #define X_SHUT 0x8000 /* Shut down transmitter */
130: #define X_SYNC 0x4000 /* Send two sync characters */
131: #define X_CRC 0x2000 /* This block to have crc accumulated */
132: #define X_SKIP 0x1000 /* Skip crc accum on next character */
133: #define X_IUS 0x0800 /* IUS being sent (as well as crc) */
134: #define X_ACMCRC 0x100 /* Accumulate CRC on next byte */
135:
136: struct state { /* psm state table definition */
137: char s_type; /* d: decision, e: error, f:function,
138: * r: receive, s:send
139: */
140: unsigned char s_next; /* next state ... d: unused, f: always used,
141: * e, s: always used,
142: * r: used in timeout
143: */
144: char s_ord; /* r: ordinal of receive list,
145: * s: ordinal of send list;
146: * f,d: ordinal of function;
147: * e: ordinal of error
148: */
149: };
150:
151: #define EBCSYN 0x32 /* EBCDIC for SYNchronous idle */
152: #define ASCSYN 0x16 /* ASCII for SYNchronous idle */
153:
154: /* multipoint mode codes */
155: /* set for each individual station in bscsub.bs_mode*/
156:
157: #define BS_FREE 0
158: #define BS_IDLE 1
159: #define BS_READ 2
160: #define BS_WRITE 3
161:
162: /* multipoint flag codes */
163: /*set for each station in bscsub.bs_flags*/
164:
165: #define BS_ERR 0x0080
166: #define BS_FULL 0x8000
167: #define BS_LAST 0x1000
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.