1: /*
   2:  * RK disk driver
   3:  */
   4: 
   5: #include <sys/param.h>
   6: #include <sys/inode.h>
   7: #include "../saio.h"
   8: 
   9: #define RKADDR  ((struct device *)0177400)
  10: #define NRK 4
  11: #define NRKBLK  4872
  12: 
  13: #define RESET   0
  14: #define WCOM    2
  15: #define RCOM    4
  16: #define GO  01
  17: #define DRESET  014
  18: #define IENABLE 0100
  19: #define DRY 0200
  20: #define ARDY    0100
  21: #define WLO 020000
  22: #define CTLRDY  0200
  23: 
  24: struct  device
  25: {
  26:     int rkds;
  27:     int rker;
  28:     int rkcs;
  29:     int rkwc;
  30:     caddr_t rkba;
  31:     int rkda;
  32: };
  33: 
  34: rkstrategy(io, func)
  35: register struct iob *io;
  36: {
  37:     register com;
  38:     daddr_t bn;
  39:     int dn, cn, sn;
  40: 
  41:     bn = io->i_bn;
  42:     dn = io->i_unit;
  43:     cn = bn/12;
  44:     sn = bn%12;
  45:     RKADDR->rkda = (dn<<13) | (cn<<4) | sn;
  46:     RKADDR->rkba = io->i_ma;
  47:     RKADDR->rkwc = -(io->i_cc>>1);
  48:     com = (segflag<<4)|GO;
  49:     if (func == READ)
  50:         com |= RCOM; else
  51:         com |= WCOM;
  52:     RKADDR->rkcs = com;
  53:     while ((RKADDR->rkcs&CTLRDY) == 0)
  54:         ;
  55:     if (RKADDR->rkcs<0) {   /* error bit */
  56:         printf("disk error: cyl=%d, sector=%d, er=%o, ds=%o\n",
  57:             cn, sn, RKADDR->rker, RKADDR->rkds);
  58:         return(-1);
  59:     }
  60:     return(io->i_cc);
  61: }

Defined functions

rkstrategy defined in line 34; used 2 times

Defined struct's

device defined in line 24; never used

Defined macros

ARDY defined in line 20; never used
CTLRDY defined in line 22; used 1 times
  • in line 53
DRESET defined in line 17; never used
DRY defined in line 19; never used
GO defined in line 16; used 1 times
  • in line 48
IENABLE defined in line 18; never used
NRK defined in line 10; never used
NRKBLK defined in line 11; never used
RCOM defined in line 15; used 1 times
  • in line 50
RESET defined in line 13; never used
RKADDR defined in line 9; used 8 times
WCOM defined in line 14; used 1 times
  • in line 51
WLO defined in line 21; never used
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 947
Valid CSS Valid XHTML 1.0 Strict