projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
install copy, drtest, pcs750.bin
[unix-history]
/
usr
/
src
/
sys
/
vax
/
stand
/
tm.c
diff --git
a/usr/src/sys/vax/stand/tm.c
b/usr/src/sys/vax/stand/tm.c
index
2c4b9c2
..
5011a1a
100644
(file)
--- a/
usr/src/sys/vax/stand/tm.c
+++ b/
usr/src/sys/vax/stand/tm.c
@@
-1,116
+1,119
@@
-/* tm.c 4.1 %G% */
/*
/*
- * TM tape driver
+ * Copyright (c) 1982 Regents of the University of California.
+ * All rights reserved. The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ * @(#)tm.c 6.2 (Berkeley) %G%
*/
*/
+/*
+ * TM11/TE??
+ */
+#include "../machine/pte.h"
+
#include "../h/param.h"
#include "../h/inode.h"
#include "../h/param.h"
#include "../h/inode.h"
-#include "../h/pte.h"
-#include "../h/uba.h"
-#include "saio.h"
+#include "../h/fs.h"
-struct device {
- short tmer;
- short tmcs;
- short tmbc;
- u_short tmba;
- short tmdb;
- short tmrd;
-};
+#include "../vaxuba/ubareg.h"
+#include "../vaxuba/tmreg.h"
-#define TMADDR ((struct device *)(PHYSUMEM + 0772520 - UNIBASE))
+#include "saio.h"
+#include "savax.h"
-#define GO 01
-#define RCOM 02
-#define WCOM 04
-#define WEOF 06
-#define SFORW 010
-#define SREV 012
-#define WIRG 014
-#define REW 016
-#define DENS 060000 /* 9-channel */
-#define IENABLE 0100
-#define CRDY 0200
-#define GAPSD 010000
-#define TUR 1
-#define SDWN 010
-#define HARD 0102200 /* ILC, EOT, NXM */
-#define EOF 0040000
-#define SSEEK 1
-#define SIO 2
+u_short tmstd[] = { 0172520 };
tmopen(io)
tmopen(io)
-register struct iob *io;
+
register struct iob *io;
{
register skip;
{
register skip;
- tmstrategy(io, REW);
+ tmstrategy(io,
TM_
REW);
skip = io->i_boff;
while (skip--) {
io->i_cc = 0;
skip = io->i_boff;
while (skip--) {
io->i_cc = 0;
- while (tmstrategy(io, SFORW))
- ;
+ tmstrategy(io, TM_SFORW);
}
}
tmclose(io)
}
}
tmclose(io)
-register struct iob *io;
+
register struct iob *io;
{
{
- tmstrategy(io, REW);
+
+ tmstrategy(io, TM_REW);
}
tmstrategy(io, func)
}
tmstrategy(io, func)
-register struct iob *io;
+
register struct iob *io;
{
register int com, unit, errcnt;
{
register int com, unit, errcnt;
- int info;
+ register struct tmdevice *tmaddr =
+ (struct tmdevice *)ubamem(io->i_unit, tmstd[0]);
+ int word, info;
unit = io->i_unit;
errcnt = 0;
retry:
unit = io->i_unit;
errcnt = 0;
retry:
- tmquiet();
- com = (unit<<8)
|DENS
;
+ tmquiet(
tmaddr
);
+ com = (unit<<8);
info = ubasetup(io, 1);
info = ubasetup(io, 1);
-
TMADDR
->tmbc = -io->i_cc;
-
TMADDR
->tmba = info;
+
tmaddr
->tmbc = -io->i_cc;
+
tmaddr
->tmba = info;
if (func == READ)
if (func == READ)
-
TMADDR->tmcs = com | RCOM |
GO;
+
tmaddr->tmcs = com | TM_RCOM | TM_
GO;
else if (func == WRITE)
else if (func == WRITE)
-
TMADDR->tmcs = com | WCOM |
GO;
- else if (func == SREV) {
-
TMADDR
->tmbc = -1;
-
TMADDR->tmcs = com | SREV |
GO;
- return(0);
+
tmaddr->tmcs = com | TM_WCOM | TM_
GO;
+ else if (func ==
TM_
SREV) {
+
tmaddr
->tmbc = -1;
+
tmaddr->tmcs = com | TM_SREV | TM_
GO;
+ return
(0);
} else
} else
- TMADDR->tmcs = com | func | GO;
- while ((TMADDR->tmcs&CRDY) == 0)
- ;
- ubafree(info);
- if (TMADDR->tmer&EOF)
- return(0);
- if (TMADDR->tmer < 0) {
+ tmaddr->tmcs = com | func | TM_GO;
+ for (;;) {
+ word = tmaddr->tmcs;
+ DELAY(100);
+ if (word & TM_CUR)
+ break;
+ }
+ ubafree(io, info);
+ word = tmaddr->tmer;
+ if (word & TMER_EOT)
+ return (0);
+ if (word & TM_ERR) {
+ if (word & TMER_EOF)
+ return (0);
if (errcnt == 0)
if (errcnt == 0)
- printf("t
ape error: er=%o", TMADDR->tmer
);
- if (errcnt
==
10) {
+ printf("t
e error: er=%b", word, TMER_BITS
);
+ if (errcnt
==
10) {
printf("\n");
printf("\n");
- return(-1);
+ return
(-1);
}
errcnt++;
}
errcnt++;
- tmstrategy(io, SREV);
+ tmstrategy(io,
TM_
SREV);
goto retry;
}
if (errcnt)
printf(" recovered by retry\n");
goto retry;
}
if (errcnt)
printf(" recovered by retry\n");
- return( io->i_cc+TMADDR->tmbc );
+ if (word & TMER_EOF)
+ return (0);
+ return (io->i_cc + tmaddr->tmbc);
}
}
-tmquiet()
+tmquiet(tmaddr)
+ register struct tmdevice *tmaddr;
{
{
- while ((TMADDR->tmcs&CRDY) == 0)
- ;
- while ((TMADDR->tmer&TUR) == 0)
- ;
- while ((TMADDR->tmer&SDWN) != 0)
- ;
+ register word;
+ for (;;) {
+ word = tmaddr->tmcs;
+ DELAY(100);
+ if (word&TM_CUR)
+ break;
+ }
+ for (;;) {
+ word = tmaddr->tmer;
+ DELAY(100);
+ if ((word&TMER_TUR) && (word&TMER_SDWN)==0)
+ break;
+ }
}
}