install copy, drtest, pcs750.bin
[unix-history] / usr / src / sys / vax / stand / tm.c
index 950d1eb..5011a1a 100644 (file)
@@ -1,17 +1,26 @@
-/*     tm.c    4.4     81/04/03        */
+/*
+ * 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??
  */
 
 /*
  * 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/ubareg.h"
+#include "../h/fs.h"
+
+#include "../vaxuba/ubareg.h"
+#include "../vaxuba/tmreg.h"
+
 #include "saio.h"
 #include "savax.h"
 
 #include "saio.h"
 #include "savax.h"
 
-#include "../h/tmreg.h"
 
 u_short        tmstd[] = { 0172520 };
 
 
 u_short        tmstd[] = { 0172520 };
 
@@ -39,8 +48,8 @@ tmstrategy(io, func)
        register struct iob *io;
 {
        register int com, unit, errcnt;
        register struct iob *io;
 {
        register int com, unit, errcnt;
-       register struct device *tmaddr =
-           (struct device *)ubamem(io->i_unit, tmstd[0]);
+       register struct tmdevice *tmaddr =
+           (struct tmdevice *)ubamem(io->i_unit, tmstd[0]);
        int word, info;
 
        unit = io->i_unit;
        int word, info;
 
        unit = io->i_unit;
@@ -63,20 +72,22 @@ retry:
                tmaddr->tmcs = com | func | TM_GO;
        for (;;) {
                word = tmaddr->tmcs;
                tmaddr->tmcs = com | func | TM_GO;
        for (;;) {
                word = tmaddr->tmcs;
-               if (word&TM_CUR)
+               DELAY(100);
+               if (word & TM_CUR)
                        break;
        }
        ubafree(io, info);
        word = tmaddr->tmer;
                        break;
        }
        ubafree(io, info);
        word = tmaddr->tmer;
-       printf("tmer %b\n", word, TMER_BITS);
-       if (word&TMER_EOT)
-               return(0);
-       if (word < 0) {
+       if (word & TMER_EOT)
+               return (0);
+       if (word & TM_ERR) {
+               if (word & TMER_EOF)
+                       return (0);
                if (errcnt == 0)
                if (errcnt == 0)
-                       printf("te error: er=%b", tmaddr->tmer, TMER_BITS);
-               if (errcnt==10) {
+                       printf("te error: er=%b", word, TMER_BITS);
+               if (errcnt == 10) {
                        printf("\n");
                        printf("\n");
-                       return(-1);
+                       return (-1);
                }
                errcnt++;
                tmstrategy(io, TM_SREV);
                }
                errcnt++;
                tmstrategy(io, TM_SREV);
@@ -84,20 +95,24 @@ retry:
        }
        if (errcnt)
                printf(" recovered by retry\n");
        }
        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(tmaddr)
 }
 
 tmquiet(tmaddr)
-       register struct device *tmaddr;
+       register struct tmdevice *tmaddr;
 {
        register word;
        for (;;) {
                word = tmaddr->tmcs;
 {
        register word;
        for (;;) {
                word = tmaddr->tmcs;
+               DELAY(100);
                if (word&TM_CUR)
                        break;
        }
        for (;;) {
                word = tmaddr->tmer;
                if (word&TM_CUR)
                        break;
        }
        for (;;) {
                word = tmaddr->tmer;
+               DELAY(100);
                if ((word&TMER_TUR) && (word&TMER_SDWN)==0)
                        break;
        }
                if ((word&TMER_TUR) && (word&TMER_SDWN)==0)
                        break;
        }