1: /*
   2:  * RP04/RP06 disk driver
   3:  * Modified for Diva Comp V Controller - 33 SEC/TRACK
   4:  */
   5: 
   6: #include <sys/param.h>
   7: #include <sys/inode.h>
   8: #include "../saio.h"
   9: 
  10: struct  device
  11: {
  12:     union {
  13:         int w;
  14:         char    c[2];
  15:     } dvhpcs1;      /* Control and Status register 1 */
  16:     int dvhpwc;     /* Word count register */
  17:     caddr_t dvhpba;     /* UNIBUS address register */
  18:     int dvhpda;     /* Desired address register */
  19:     union {
  20:         int w;
  21:         char    c[2];
  22:     } dvhpcs2;      /* Control and Status register 2*/
  23:     int dvhpds;     /* Drive Status */
  24:     int dvhper1;        /* Error register 1 */
  25:     int dvhpas;     /* Attention Summary */
  26:     int dvhpla;     /* Look ahead */
  27:     int dvhpdb;     /* Data buffer */
  28:     int dvhpmr;     /* Maintenance register */
  29:     int dvhpdt;     /* Drive type */
  30:     int dvhpsn;     /* Serial number */
  31:     int dvhpof;     /* Offset register */
  32:     int dvhpdc;     /* Desired Cylinder address register*/
  33:     int dvhpcc;     /* Current Cylinder */
  34:     int dvhper2;        /* Error register 2 */
  35:     int dvhper3;        /* Error register 3 */
  36:     int dvhpec1;        /* Burst error bit position */
  37:     int dvhpec2;        /* Burst error bit pattern */
  38:     int dvhpbae;        /* 11/70 bus extension */
  39:     int dvhpcs3;
  40: };
  41: 
  42: int     cyloff[] =      /* Cylinder offsets of logical drives */
  43: {
  44:     0,
  45:     15,
  46:     215,
  47:     415,
  48:     615,
  49:     15,
  50:     415,
  51:     15,
  52: };
  53: 
  54: #define DVHPADDR    ((struct device *)0176700)
  55: #define NSECT   33
  56: #define NTRAC   19
  57: #define SDIST   2
  58: #define RDIST   6
  59: 
  60: #define P400    020
  61: #define M400    0220
  62: #define P800    040
  63: #define M800    0240
  64: #define P1200   060
  65: #define M1200   0260
  66: 
  67: #define GO  01
  68: #define PRESET  020
  69: #define RTC 016
  70: #define OFFSET  014
  71: #define SEARCH  030
  72: #define RECAL   06
  73: #define DCLR    010
  74: #define WCOM    060
  75: #define RCOM    070
  76: 
  77: #define IE  0100
  78: #define PIP 020000
  79: #define DRY 0200
  80: #define ERR 040000
  81: #define TRE 040000
  82: #define DCK 0100000
  83: #define WLE 04000
  84: #define ECH 0100
  85: #define VV  0100
  86: #define FMT22   010000
  87: 
  88: dvhpstrategy(io, func)
  89: register struct iob *io;
  90: {
  91:     register unit;
  92:     register i;
  93:     daddr_t bn;
  94:     int sn, cn, tn;
  95: 
  96:     if (((unit = io->i_unit) & 0100) == 0)
  97:         bn = io->i_bn;
  98:     else {
  99:         unit &= 03;
 100:         bn = io->i_bn;
 101:         bn -= io->i_boff;
 102:         i = unit + 1;
 103:         unit = bn%i;
 104:         bn /= i;
 105:         bn += io->i_boff;
 106:     }
 107: 
 108:     DVHPADDR->dvhpcs2.w = (unit&070)>>3;
 109: 
 110:     if((DVHPADDR->dvhpds & VV) == 0) {
 111:         DVHPADDR->dvhpcs1.c[0] = PRESET|GO;
 112:         DVHPADDR->dvhpof = FMT22;
 113:     }
 114:     cn = bn/(NSECT*NTRAC) + cyloff[unit&07];
 115:     sn = bn%(NSECT*NTRAC);
 116:     tn = sn/NSECT;
 117:     sn = sn%NSECT;
 118: 
 119:     DVHPADDR->dvhpdc = cn;
 120:     DVHPADDR->dvhpda = (tn << 8) + sn;
 121:     DVHPADDR->dvhpba = io->i_ma;
 122:     DVHPADDR->dvhpwc = -(io->i_cc>>1);
 123:     unit = (segflag << 8) | GO;
 124:     if (func == READ)
 125:         unit |= RCOM;
 126:     else if (func == WRITE)
 127:         unit |= WCOM;
 128:     DVHPADDR->dvhpcs1.w = unit;
 129:     while ((DVHPADDR->dvhpcs1.w&DRY) == 0)
 130:             ;
 131:     if (DVHPADDR->dvhpcs1.w & TRE) {
 132:         printf("disk error: cyl=%d track=%d sect=%d cs2=%o, er1=%o\n",
 133:             cn, tn, sn, DVHPADDR->dvhpcs2, DVHPADDR->dvhper1);
 134:         return(-1);
 135:     }
 136:     return(io->i_cc);
 137: }

Defined functions

dvhpstrategy defined in line 88; never used

Defined variables

cyloff defined in line 42; used 1 times

Defined struct's

device defined in line 10; never used

Defined macros

DCK defined in line 82; never used
DCLR defined in line 73; never used
DRY defined in line 79; used 1 times
DVHPADDR defined in line 54; used 13 times
ECH defined in line 84; never used
ERR defined in line 80; never used
FMT22 defined in line 86; used 1 times
GO defined in line 67; used 2 times
IE defined in line 77; never used
M1200 defined in line 65; never used
M400 defined in line 61; never used
M800 defined in line 63; never used
NSECT defined in line 55; used 4 times
NTRAC defined in line 56; used 2 times
OFFSET defined in line 70; never used
P1200 defined in line 64; never used
P400 defined in line 60; never used
P800 defined in line 62; never used
PIP defined in line 78; never used
PRESET defined in line 68; used 1 times
RCOM defined in line 75; used 1 times
RDIST defined in line 58; never used
RECAL defined in line 72; never used
RTC defined in line 69; never used
SDIST defined in line 57; never used
SEARCH defined in line 71; never used
TRE defined in line 81; used 1 times
VV defined in line 85; used 1 times
WCOM defined in line 74; used 1 times
WLE defined in line 83; never used
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 919
Valid CSS Valid XHTML 1.0 Strict