Research V5 development
authorDennis Ritchie <dmr@research.uucp>
Tue, 26 Nov 1974 23:13:21 +0000 (18:13 -0500)
committerDennis Ritchie <dmr@research.uucp>
Tue, 26 Nov 1974 23:13:21 +0000 (18:13 -0500)
Work on file usr/sys/dmr/vs.c
Work on file usr/sys/dmr/partab.c

Synthesized-from: v5

usr/sys/dmr/partab.c [new file with mode: 0644]
usr/sys/dmr/vs.c [new file with mode: 0644]

diff --git a/usr/sys/dmr/partab.c b/usr/sys/dmr/partab.c
new file mode 100644 (file)
index 0000000..6773fb3
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ *     Copyright 1973 Bell Telephone Laboratories Inc
+ */
+
+char partab[] {
+       0001,0201,0201,0001,0201,0001,0001,0201,
+       0202,0004,0003,0205,0005,0206,0201,0001,
+       0201,0001,0001,0201,0001,0201,0201,0001,
+       0001,0201,0201,0001,0201,0001,0001,0201,
+       0200,0000,0000,0200,0000,0200,0200,0000,
+       0000,0200,0200,0000,0200,0000,0000,0200,
+       0000,0200,0200,0000,0200,0000,0000,0200,
+       0200,0000,0000,0200,0000,0200,0200,0000,
+       0200,0000,0000,0200,0000,0200,0200,0000,
+       0000,0200,0200,0000,0200,0000,0000,0200,
+       0000,0200,0200,0000,0200,0000,0000,0200,
+       0200,0000,0000,0200,0000,0200,0200,0000,
+       0000,0200,0200,0000,0200,0000,0000,0200,
+       0200,0000,0000,0200,0000,0200,0200,0000,
+       0200,0000,0000,0200,0000,0200,0200,0000,
+       0000,0200,0200,0000,0200,0000,0000,0201
+};
diff --git a/usr/sys/dmr/vs.c b/usr/sys/dmr/vs.c
new file mode 100644 (file)
index 0000000..0b3cb60
--- /dev/null
@@ -0,0 +1,124 @@
+#
+/*
+ *     Copyright 1973 Bell Telephone Laboratories Inc
+ */
+
+/*
+ * Screw Works interface via DC-11
+ */
+
+#include "../tty.h"
+
+#define        VSADDR  0174150
+#define        CDLEAD  01
+#define        B1200   030
+#define        STOP1   0400
+#define        CLSEND  02
+#define        RQSEND  01
+
+#define        MAGIC_MAP 0377
+
+struct {
+       int     vsrcsr;
+       int     vsrbuf;
+       int     vsxcsr;
+       int     vsxbuf;
+};
+
+struct {
+       struct  clist   iq;
+       struct  clist   oq;
+} vs;
+
+char   vsmap[] "?0*#?546?213?879?";
+
+vsopen(dev)
+{
+       VSADDR->vsrcsr = IENABLE|B1200|CDLEAD;
+       VSADDR->vsxcsr = STOP1|IENABLE|B1200;
+       vschar(0);
+}
+
+vsclose(dev)
+{
+       VSADDR->vsrcsr =& ~IENABLE;
+       while (getc(&vs.iq) >= 0);
+}
+
+vswrite(dev)
+{
+       register int count, c;
+
+       count = 0;
+       while ((c=cpass()) >= 0) {
+               if (--count <= 0) {
+                       count = 60;
+                       vschar(0);
+               }
+               vschar(c);
+       }
+       vschar(0);
+}
+
+vschar(c)
+{
+
+       c =^ MAGIC_MAP;
+       spl5();
+       while (vs.oq.c_cc > 60) {
+               vsxintr();
+               sleep(&vs.oq, TTIPRI);
+       }
+       putc(c, &vs.oq);
+       vsxintr();
+       spl0();
+}
+
+vsxintr()
+{
+       static lchar;
+       register c;
+       register int *xcsr;
+
+       xcsr = &VSADDR->vsxcsr;
+       if (*xcsr&DONE) {
+               if (lchar==MAGIC_MAP) {
+                       *xcsr =& ~RQSEND;
+                       lchar = 0;
+                       if (vs.oq.c_cc==0)
+                               goto wake;
+               }
+               if ((*xcsr&CLSEND) == 0) {
+                       *xcsr =& ~RQSEND;
+                       *xcsr =| RQSEND;
+                       if ((*xcsr&CLSEND) == 0)
+                               goto wake;
+               }
+               if ((c = getc(&vs.oq)) >= 0)
+                       VSADDR->vsxbuf = lchar = c;
+               if (vs.oq.c_cc <= 15)
+           wake:
+                       wakeup(&vs.oq);
+       }
+}
+
+vsread(dev)
+{
+       register int c;
+
+       spl5();
+       while ((c = getc(&vs.iq)) < 0)
+               sleep(&vs.iq, TTIPRI);
+       spl0();
+       passc(vsmap[c&017]);
+}
+
+vsrintr()
+{
+       register int c;
+
+       c = VSADDR->vsrbuf;
+       if (vs.iq.c_cc<=10)
+               putc(c, &vs.iq);
+       wakeup(&vs.iq);
+}