home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / dev / obero / oberon-a / source / amiga / scsidisk.mod < prev    next >
Text File  |  1994-08-08  |  6KB  |  143 lines

  1. (**************************************************************************
  2.  
  3.      $RCSfile: SCSIDisk.mod $
  4.   Description: SCSI command definitions
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.2 $
  8.       $Author: fjc $
  9.         $Date: 1994/08/08 00:47:38 $
  10.  
  11.   $VER: scsidisk.h 36.2 (7.11.90)
  12.   Includes Release 40.15
  13.  
  14.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  15.       All Rights Reserved
  16.  
  17.   Oberon-A interface Copyright © 1994, Frank Copeland.
  18.   This file is part of the Oberon-A Interface.
  19.   See Oberon-A.doc for conditions of use and distribution.
  20.  
  21. ***************************************************************************)
  22.  
  23. MODULE SCSIDisk;
  24.  
  25. (*
  26. ** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
  27. ** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
  28. ** $V- OvflChk       $Z- ZeroVars
  29. *)
  30.  
  31. IMPORT E := Exec;
  32.  
  33.  
  34. (*
  35. **
  36. **      SCSI exec-level device command
  37. **
  38. *)
  39.  
  40.  
  41. (* --------------------------------------------------------------------
  42.  *
  43.  *   SCSI Command
  44.  *      Several Amiga SCSI controller manufacturers are converging on
  45.  *      standard ways to talk to their controllers.  This include
  46.  *      file describes an exec-device command (e.g. for hddisk.device)
  47.  *      that can be used to issue SCSI commands
  48.  *
  49.  *   UNIT NUMBERS
  50.  *      Unit numbers to the OpenDevice call have encoded in them which
  51.  *      SCSI device is being referred to.  The three decimal digits of
  52.  *      the unit number refer to the SCSI Target ID (bus address) in
  53.  *      the 1's digit, the SCSI logical unit (LUN) in the 10's digit,
  54.  *      and the controller board in the 100's digit.
  55.  *
  56.  *      Examples:
  57.  *                0     drive at address 0
  58.  *               12     LUN 1 on multiple drive controller at address 2
  59.  *              104     second controller board, address 4
  60.  *               88     not valid: both logical units and addresses
  61.  *                      range from 0..7.
  62.  *
  63.  *   CAVEATS
  64.  *      Original 2090 code did not support this command.
  65.  *
  66.  *      Commodore 2090/2090A unit numbers are different.  The SCSI
  67.  *      logical unit is the 100's digit, and the SCSI Target ID
  68.  *      is a permuted 1's digit: Target ID 0..6 maps to unit 3..9
  69.  *      (7 is reserved for the controller).
  70.  *
  71.  *          Examples:
  72.  *                3     drive at address 0
  73.  *              109     drive at address 6, logical unit 1
  74.  *                1     not valid: this is not a SCSI unit.  Perhaps
  75.  *                      it's an ST506 unit.
  76.  *
  77.  *      Some controller boards generate a unique name (e.g. 2090A's
  78.  *      iddisk.device) for the second controller board, instead of
  79.  *      implementing the 100's digit.
  80.  *
  81.  *      There are optional restrictions on the alignment, bus
  82.  *      accessability, and size of the data for the data phase.
  83.  *      Be conservative to work with all manufacturer's controllers.
  84.  *
  85.  *------------------------------------------------------------------*)
  86.  
  87. CONST
  88.  
  89.   hdScsiCmd *      = 28;      (* issue a SCSI command to the unit *)
  90.                               (* ioData points to a SCSICmd *)
  91.                               (* ioLength is SIZE (SCSICmd) *)
  92.                               (* ioActual and ioOffset are not used *)
  93.  
  94. TYPE
  95.  
  96.   SCSICmdPtr * = CPOINTER TO SCSICmd;
  97.   SCSICmd * = RECORD
  98.     data *        : E.APTR;   (* word aligned data for SCSI Data Phase *)
  99.                               (* (optional) data need not be byte aligned *)
  100.                               (* (optional) data need not be bus accessable *)
  101.     length *      : E.ULONG;  (* even length of Data area *)
  102.                               (* (optional) data can have odd length *)
  103.                               (* (optional) data length can be > 2**24 *)
  104.     actual *      : E.ULONG;  (* actual Data used *)
  105.     command *     : E.APTR;   (* SCSI Command (same options as Data) *)
  106.     cmdLength *   : E.UWORD;  (* length of Command *)
  107.     cmdActual *   : E.UWORD;  (* actual Command used *)
  108.     flags *       : E.BSET;   (* includes intended data direction *)
  109.     status *      : E.UBYTE;  (* SCSI status of command *)
  110.     senseData *   : E.APTR;   (* sense data: filled if [OLD]AUTOSENSE *)
  111.                               (* is set and Status has CHECK CONDITION *)
  112.                               (* (bit 1) set *)
  113.     senseLength * : E.UWORD;  (* size of SenseData, also bytes to *)
  114.                               (* request w/ AUTOSENSE, must be 4..255 *)
  115.     senseActual * : E.UWORD;  (* amount actually fetched (0 means no sense) *)
  116.   END; (* SCSICmd *)
  117.  
  118. CONST
  119.  
  120. (* ----- scsiFlags -----*)
  121.   scsiWrite *             = {};      (* intended data direction is out *)
  122.   scsiRead *              = {0};     (* intended data direction is in *)
  123.   scsiReadWrite *         = 0;       (* (the bit to test) *)
  124.   scsiNoSense *           = {};      (* no automatic request sense *)
  125.   scsiAutoSense *         = 1;       (* do standard extended request sense *)
  126.                                      (* on check condition *)
  127.   scsiOldAutoSense *      = 2;       (* do 4 byte non-extended request *)
  128.                                      (* sense on check condition *)
  129.  
  130. (* ----- SCSI ioError values -----*)
  131.   hfErrSelfUnit *          = 40;      (* cannot issue SCSI command to self *)
  132.   hfErrDMA *               = 41;      (* DMA error *)
  133.   hfErrPhase *             = 42;      (* illegal or unexpected SCSI phase *)
  134.   hfErrParity *            = 43;      (* SCSI parity error *)
  135.   hfErrSelTimeout *        = 44;      (* Select timed out *)
  136.   hfErrBadStatus *         = 45;      (* status and/or sense error *)
  137.  
  138. (* ----- OpenDevice ioError values -----*)
  139.   hfErrNoBoard *           = 50;      (* Open failed for non-existant board *)
  140.  
  141.  
  142. END SCSIDisk.
  143.