1: /*
   2:  * Copyright (c) 1986 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)rk.c	2.2 (2.11BSD) 1996/3/8
   7:  */
   8: 
   9: /*
  10:  * RK disk driver
  11:  */
  12: 
  13: #include "../h/param.h"
  14: #include "../pdpuba/rkreg.h"
  15: #include "saio.h"
  16: 
  17: #define NRK 2
  18: 
  19:     struct  rkdevice *RKcsr[NRK + 1] =
  20:         {
  21:         (struct rkdevice *)0177400,
  22:         (struct rkdevice *)0,
  23:         (struct rkdevice *)-1
  24:         };
  25: 
  26: rkstrategy(io, func)
  27:     register struct iob *io;
  28: {
  29:     register com;
  30:     register struct rkdevice *rkaddr;
  31:     daddr_t bn;
  32:     int dn, cn, sn, bae, lo16;
  33: 
  34:     bn = io->i_bn;
  35:     dn = io->i_unit;
  36:     cn = bn/12;
  37:     sn = bn%12;
  38:     iomapadr(io->i_ma, &bae, &lo16);
  39:     rkaddr = RKcsr[io->i_ctlr];
  40:     rkaddr->rkda = (dn<<13) | (cn<<4) | sn;
  41:     rkaddr->rkba = (caddr_t)lo16;
  42:     rkaddr->rkwc = -(io->i_cc>>1);
  43:     com = (bae<<4)|RKCS_GO;
  44:     if (func == READ)
  45:         com |= RKCS_RCOM;
  46:     else
  47:         com |= RKCS_WCOM;
  48:     rkaddr->rkcs = com;
  49:     while ((rkaddr->rkcs & RKCS_RDY) == 0)
  50:         continue;
  51:     if (rkaddr->rkcs<0) {   /* error bit */
  52:         printf("%s err cy=%d sc=%d, er=%o, ds=%o\n",
  53:             devname(io), cn, sn, rkaddr->rker, rkaddr->rkds);
  54:         return(-1);
  55:     }
  56:     return(io->i_cc);
  57: }
  58: 
  59: rkopen(io)
  60:     struct iob *io;
  61: {
  62:     return(genopen(NRK, io));
  63: }

Defined functions

rkopen defined in line 59; used 2 times
rkstrategy defined in line 26; used 2 times

Defined variables

RKcsr defined in line 19; used 2 times

Defined macros

NRK defined in line 17; used 2 times
Last modified: 1996-03-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 616
Valid CSS Valid XHTML 1.0 Strict