1: #
   2: /*
   3:  */
   4: 
   5: /*
   6:  * GP DR11C driver used for C/A/T
   7:  */
   8: 
   9: #include <sys/param.h>
  10: #include <sys/dir.h>
  11: #include <sys/user.h>
  12: #include <sys/tty.h>
  13: 
  14: #ifdef  UCB_SCCSID
  15: static  char sccs_id[] = "@(#)cat.c	3.1";
  16: #endif
  17: 
  18: 
  19: #define CATADDR ((struct catdev *)0167770)
  20: #define PCAT    (PZERO+9)
  21: #define CATHIWAT    100
  22: #define CATLOWAT    30
  23: 
  24: struct {
  25:     int catlock;
  26:     struct  clist   oq;
  27: } cat;
  28: 
  29: struct catdev {
  30:     int catcsr;
  31:     int catbuf;
  32: };
  33: 
  34: ctopen(dev)
  35: {
  36:     if (cat.catlock==0) {
  37:         cat.catlock++;
  38:         CATADDR->catcsr |= IENABLE;
  39:     } else
  40:         u.u_error = ENXIO;
  41: }
  42: 
  43: ctclose()
  44: {
  45:     cat.catlock = 0;
  46:     catintr();
  47: }
  48: 
  49: ctwrite(dev)
  50: {
  51:     register c;
  52:     extern lbolt;
  53: 
  54:     while ((c=cpass()) >= 0) {
  55:         spl5();
  56:         while (cat.oq.c_cc > CATHIWAT)
  57:             sleep((caddr_t)&cat.oq, PCAT);
  58:         while (putc(c, &cat.oq) < 0)
  59:             sleep((caddr_t)&lbolt, PCAT);
  60:         catintr();
  61:         spl0();
  62:     }
  63: }
  64: 
  65: catintr()
  66: {
  67:     register int c;
  68: 
  69:     if (CATADDR->catcsr&DONE) {
  70:         if ((c = getc(&cat.oq)) >= 0) {
  71:             CATADDR->catbuf = c;
  72:             if (cat.oq.c_cc==0 || cat.oq.c_cc==CATLOWAT)
  73:                 wakeup((caddr_t)&cat.oq);
  74:         } else {
  75:             if (cat.catlock==0)
  76:                 CATADDR->catcsr = 0;
  77:         }
  78:     }
  79: }

Defined functions

catintr defined in line 65; used 2 times
ctclose defined in line 43; never used
ctopen defined in line 34; never used
ctwrite defined in line 49; never used

Defined variables

sccs_id defined in line 15; never used

Defined struct's

catdev defined in line 29; never used

Defined macros

CATADDR defined in line 19; used 4 times
CATHIWAT defined in line 21; used 1 times
  • in line 56
CATLOWAT defined in line 22; used 1 times
  • in line 72
PCAT defined in line 20; used 2 times
Last modified: 1983-08-06
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 808
Valid CSS Valid XHTML 1.0 Strict