1: /*
2: * TJU16 tape driver
3: */
4:
5: #include <sys/param.h>
6: #include <sys/inode.h>
7: #include "../saio.h"
8:
9: struct device
10: {
11: int htcs1;
12: int htwc;
13: caddr_t htba;
14: int htfc;
15: int htcs2;
16: int htds;
17: int hter;
18: int htas;
19: int htck;
20: int htdb;
21: int htmr;
22: int htdt;
23: int htsn;
24: int httc;
25: int htbae; /* 11/70 bus extension */
26: int htcs3;
27: };
28:
29:
30:
31: #define HTADDR ((struct device *)0172440)
32:
33: #define GO 01
34: #define WCOM 060
35: #define RCOM 070
36: #define NOP 0
37: #define WEOF 026
38: #define SFORW 030
39: #define SREV 032
40: #define ERASE 024
41: #define REW 06
42: #define DCLR 010
43: #define CLR 040
44: #define P800 01300 /* 800 + pdp11 mode */
45: #define P1600 02300 /* 1600 + pdp11 mode */
46: #define IENABLE 0100
47: #define RDY 0200
48: #define TM 04
49: #define DRY 0200
50: #define EOT 02000
51: #define CS 02000
52: #define COR 0100000
53: #define PES 040
54: #define WRL 04000
55: #define MOL 010000
56: #define PIP 020000
57: #define ERR 040000
58: #define FCE 01000
59: #define TRE 040000
60: #define HARD 064023 /* UNS|OPI|NEF|FMT|RMR|ILR|ILF */
61:
62: #define SIO 1
63: #define SSFOR 2
64: #define SSREV 3
65: #define SRETRY 4
66: #define SCOM 5
67: #define SOK 6
68:
69: extern int tapemark; /* flag to indicate tapemark encountered
70: (see SYS.c as to how its used) */
71:
72: htopen(io)
73: register struct iob *io;
74: {
75: register skip;
76: int i;
77:
78: htstrategy(io, REW);
79: skip = io->i_boff;
80: while (skip--) {
81: io->i_cc = -1;
82: while (htstrategy(io, SFORW))
83: ;
84: i = 0;
85: while (--i)
86: ;
87: htstrategy(io, NOP);
88: }
89: }
90:
91: htclose(io)
92: register struct iob *io;
93: {
94: htstrategy(io, REW);
95: }
96:
97: htstrategy(io, func)
98: register struct iob *io;
99: {
100: register unit, den, errcnt;
101:
102: unit = io->i_unit;
103: errcnt = 0;
104: retry:
105: HTADDR->htcs2 = (unit>>03)&07;
106: if(unit > 3)
107: den = P1600;
108: else
109: den = P800;
110: den |= (unit&07);
111: htquiet();
112: if((HTADDR->httc&03777) != den)
113: HTADDR->httc = den;
114: HTADDR->htba = io->i_ma;
115: HTADDR->htfc = -io->i_cc;
116: HTADDR->htwc = -(io->i_cc>>1);
117: den = ((segflag) << 8) | GO;
118: if (func == READ)
119: den =| RCOM;
120: else if (func == WRITE)
121: den =| WCOM;
122: else if (func == SREV) {
123: HTADDR->htfc = -1;
124: HTADDR->htcs1 = den | SREV;
125: return(0);
126: } else
127: den |= func;
128: HTADDR->htcs1 = den;
129: while ((HTADDR->htcs1&RDY) == 0)
130: ;
131: if (HTADDR->htds&TM) {
132: tapemark = 1;
133: htinit();
134: return(0);
135: }
136: if (HTADDR->htcs1&TRE) {
137: if (errcnt == 0)
138: printf("tape error: cs2=%o, er=%o",
139: HTADDR->htcs2, HTADDR->hter);
140: htinit();
141: if (errcnt == 10) {
142: printf("\n");
143: return(-1);
144: }
145: errcnt++;
146: htstrategy(io, SREV);
147: goto retry;
148: }
149: if (errcnt)
150: printf(" recovered by retry\n");
151: return(io->i_cc+HTADDR->htfc);
152: }
153:
154: htinit()
155: {
156: int omt, ocs2;
157:
158: omt = HTADDR->httc & 03777;
159: ocs2 = HTADDR->htcs2 & 07;
160:
161: HTADDR->htcs2 = CLR;
162: HTADDR->htcs2 = ocs2;
163: HTADDR->httc = omt;
164: HTADDR->htcs1 = DCLR|GO;
165: }
166:
167: htquiet()
168: {
169: while ((HTADDR->htcs1&RDY) == 0)
170: ;
171: while (HTADDR->htds&PIP)
172: ;
173: }
Defined functions
Defined struct's
device
defined in line
9;
never used
Defined macros
CLR
defined in line
43; used 1 times
COR
defined in line
52;
never used
CS
defined in line
51;
never used
DCLR
defined in line
42; used 1 times
DRY
defined in line
49;
never used
EOT
defined in line
50;
never used
ERASE
defined in line
40;
never used
ERR
defined in line
57;
never used
FCE
defined in line
58;
never used
GO
defined in line
33; used 2 times
HARD
defined in line
60;
never used
HTADDR
defined in line
31; used 23 times
MOL
defined in line
55;
never used
NOP
defined in line
36; used 1 times
P1600
defined in line
45; used 1 times
P800
defined in line
44; used 1 times
PES
defined in line
53;
never used
PIP
defined in line
56; used 1 times
RCOM
defined in line
35; used 1 times
RDY
defined in line
47; used 2 times
REW
defined in line
41; used 2 times
SCOM
defined in line
66;
never used
SFORW
defined in line
38; used 1 times
SIO
defined in line
62;
never used
SOK
defined in line
67;
never used
SREV
defined in line
39; used 3 times
SSFOR
defined in line
63;
never used
SSREV
defined in line
64;
never used
TM
defined in line
48; used 1 times
TRE
defined in line
59; used 1 times
WCOM
defined in line
34; used 1 times
WEOF
defined in line
37;
never used
WRL
defined in line
54;
never used