BSD 4_3_Tahoe development
authorCSRG <csrg@ucbvax.Berkeley.EDU>
Wed, 2 Jul 1986 04:31:48 +0000 (20:31 -0800)
committerCSRG <csrg@ucbvax.Berkeley.EDU>
Wed, 2 Jul 1986 04:31:48 +0000 (20:31 -0800)
Work on file usr/src/cci/dr11/makefile
Work on file usr/src/cci/dr11/dstat.c
Work on file usr/src/cci/dr11/loop.c
Work on file usr/src/cci/dr11/dinstall
Work on file usr/src/cci/dr11/mktape

Synthesized-from: CSRG/cd2/4.3tahoe

usr/src/cci/dr11/dinstall [new file with mode: 0755]
usr/src/cci/dr11/dstat.c [new file with mode: 0644]
usr/src/cci/dr11/loop.c [new file with mode: 0644]
usr/src/cci/dr11/makefile [new file with mode: 0644]
usr/src/cci/dr11/mktape [new file with mode: 0755]

diff --git a/usr/src/cci/dr11/dinstall b/usr/src/cci/dr11/dinstall
new file mode 100755 (executable)
index 0000000..dcda4cf
--- /dev/null
@@ -0,0 +1,8 @@
+mkdir /usr/lib/dr11
+mv ./dstat /usr/lib/dr11
+chown root /usr/lib/dr11/*
+chmod a+x /usr/lib/dr11/*
+mknod /dev/dr00 c 16 0
+mknod /dev/dr11 c 17 0
+chmod a+w /dev/dr00 /dev/dr11
+chown root /dev/dr00 /dev/dr11
diff --git a/usr/src/cci/dr11/dstat.c b/usr/src/cci/dr11/dstat.c
new file mode 100644 (file)
index 0000000..751eea3
--- /dev/null
@@ -0,0 +1,133 @@
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/buf.h>
+#include <sys/drreg.h>
+#include <sys/ioctl.h>
+
+struct dr11io drio;
+
+/*
+ *     usage: dstat [-l] [-t second] [unitno]
+*/
+main(argc,argv)
+long argc;
+char *argv[];
+{      register long fd;
+       long loop = 0;
+       long cmd = 0, unit = 0;
+       char *DR11 = "/dev/dr11";
+
+       fd = open(DR11,2);
+       if (fd == -1) {
+               fprintf(stderr,"\ndstat: cannot open %s, ",DR11);
+               perror("");
+               exit(1);
+       }
+       if (argc > 1) { 
+               if (argc > 5) {
+                       usage();
+                       exit(0);
+               }
+               for (argc--,argv++;argc;argc--, argv++) {
+                       if (argv[0][0]=='-')  {
+                               switch (argv[0][1]) {
+                                       case 'l':
+                                               cmd = 1;   /* lpback test */
+                                               break;
+                                       case 't':
+                                               sscanf(argv[1],"%ld",&loop);
+                                               argc--; argv++;
+                                               break;
+                                       default:
+                                               usage();
+                                               exit(0);
+                               }
+                       }
+                       else {
+                               sscanf(argv[0],"%ld",&unit);
+                       }
+               }
+               drio.arg[0] = unit;
+       }
+       if (cmd)
+               lpback(fd,unit,loop);
+       else
+               stat(fd,unit,loop);
+       close(fd);
+}
+
+stat(fd,unit,loop)
+register long fd,unit,loop;
+{      register long err;
+
+again:
+       drio.arg[0] = unit;
+       err = ioctl(fd,DR11STAT,(caddr_t)&drio);
+       if (err) {
+               fprintf(stderr,"\ndstat: cannot ioctl unit %d",unit);
+               perror(" ");
+               exit(0);
+       }
+       prdrio(&drio,unit);
+       if (loop > 0) {
+               sleep(loop);
+               goto again;
+       }
+}
+
+lpback(fd,unit,loop)
+register long fd,unit,loop;
+{
+
+lpagain:
+       lptest(fd,unit);
+       if (loop > 0) {
+               sleep(loop);
+               goto lpagain;
+       }
+}
+
+lptest(fd,unit)
+register long fd,unit;
+{      register long err;
+
+       drio.arg[0] = unit;
+       err = ioctl(fd,DR11STAT,(caddr_t)&drio);
+       if (err) {
+               fprintf(stderr,"\ndstat: cannot ioctl unit %d",unit);
+               perror(" ");
+               exit(0);
+       }
+       prdrio(&drio,unit);
+
+       printf("\n ---- Perform loopback test ----");
+       drio.arg[0] = unit;
+       ioctl(fd,DR11LOOP,(caddr_t)&drio);
+       printf("\n Done....");
+
+       drio.arg[0] = unit;
+       ioctl(fd,DR11STAT,(caddr_t)&drio);
+       prdrio(&drio,unit);
+}
+
+
+prdrio(drio,unit)
+struct dr11io *drio;
+long unit;
+{
+       printf("\n\t------------- DR11 unit %ld Status ------------",unit);
+       printf("\n\t  dr_flags  CSR   istat  idata  modvec  dmacnt  hiadr  loadr");
+       printf("\n\t    %04lx    %04lx  %04lx   %04lx   %04lx    %04ld    %04lx   %04lx",
+               drio->arg[0],drio->arg[1],drio->arg[2],drio->arg[3] & 0xffff,
+               drio->arg[4],drio->arg[5],drio->arg[6],drio->arg[7]);
+       printf("\n");
+}
+
+usage()
+{
+       printf("\nusage: dstat [-l] [unit] [second]");
+       printf("\n\t-l: do loopback test");
+       printf("\n\tunit: controller no");
+       printf("\n\tsecond: interval to perform command");
+}
diff --git a/usr/src/cci/dr11/loop.c b/usr/src/cci/dr11/loop.c
new file mode 100644 (file)
index 0000000..dd2a401
--- /dev/null
@@ -0,0 +1,56 @@
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/buf.h>
+#include <sys/drreg.h>
+#include <sys/ioctl.h>
+
+struct dr11io drio;
+
+/*
+*      DR11 loop back test
+*      usage: loop [unit]
+*/
+main(argc,argv)
+long argc;
+char *argv[];
+{      long fd;
+       char *DR11 = "/dev/dr11";
+       long unit = 0;
+
+       fd = open(DR11,2);
+       if (fd == -1) {
+               fprintf(stderr,"\nloop: cannot open %s",DR11);
+               perror(" : ");
+               exit(1);
+       }
+       if (argc > 1)
+               sscanf(argv[1],"%ld",&unit);
+       drio.arg[0] = unit;     /* Unit no. */
+       ioctl(fd,DR11STAT,(caddr_t)&drio);
+       prdrio(&drio,unit);
+
+       printf("\n ---- Perform loopback test ----");
+       drio.arg[0] = unit;     /* Unit 0 */
+       ioctl(fd,DR11LOOP,(caddr_t)&drio);
+       printf("\n Done....");
+
+       drio.arg[0] = unit;
+       ioctl(fd,DR11STAT,(caddr_t)&drio);
+       prdrio(&drio,unit);
+
+       close(fd);
+}
+
+
+prdrio(drio,unit)
+struct dr11io *drio;
+{
+       printf("\n\t------------- DR11 unit %ld Status ------------",unit);
+       printf("\n\t  dr_flags  CSR   istat  idata  modvec  dmacnt  hiadr  loadr");
+       printf("\n\t    %04lx    %04lx  %04lx   %04lx   %04lx    %04ld    %04lx   %04lx",
+               drio->arg[0],drio->arg[1],drio->arg[2],drio->arg[3] & 0xffff,
+               drio->arg[4],drio->arg[5],drio->arg[6],drio->arg[7]);
+       printf("\n");
+}
+
diff --git a/usr/src/cci/dr11/makefile b/usr/src/cci/dr11/makefile
new file mode 100644 (file)
index 0000000..a48cbd0
--- /dev/null
@@ -0,0 +1,25 @@
+MAKEPARAM = AS=${AS} CC=${CC} LD=${LD} INCLDIR=${INCLDIR} LIBDIR=${LIBDIR} ULIBDIR=${ULIBDIR} DESTDIR=${DESTDIR}
+CFLAGS=        -O
+LDFLAGS=
+OWNER=root
+GROUP=bin
+INCLDIR=
+
+DOBJS= dstat.o
+
+DSOURCES=dstat.c
+
+dstat: ${DOBJS}
+       ${CC} -o dstat ${LDFLAGS} ${DOBJS}
+
+${DOBJS}: ${INCLDIR)/drreg.h
+
+install: dstat
+       echo "install -m 4711 -o ${OWNER} -g ${GROUP} dstat ${DESTDIR}/dstat"
+       install -m 4711 -o ${OWNER} -g ${GROUP} dstat ${DESTDIR}/dstat
+
+clean:
+       rm -f *.o
+       
+lint:
+       -lint -hbacvx ${CFLAGS} ${SOURCES}
diff --git a/usr/src/cci/dr11/mktape b/usr/src/cci/dr11/mktape
new file mode 100755 (executable)
index 0000000..a308d8b
--- /dev/null
@@ -0,0 +1,5 @@
+make INCLDIR=/usr/include/dr11 dstat
+echo "Mount tape, type CR when ready..."
+read x
+tar cvb 20 ./dstat ./loop ./dinstall
+echo "done..."