home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / OB3.2D4.DMS / in.adf / Interfaces / SCSIDisk.mod < prev    next >
Encoding:
Text File  |  1992-12-17  |  5.2 KB  |  117 lines

  1. (*-------------------------------------------------------------------------*)
  2. (*                                                                         *)
  3. (*  Amiga Oberon Interface Module:                    Date: 02-Nov-92      *)
  4. (*                                                                         *)
  5. (*   © 1992 by Fridtjof Siebert                                            *)
  6. (*                                                                         *)
  7. (*-------------------------------------------------------------------------*)
  8.  
  9. MODULE SCSIDisk;   (* $Implementation- *)
  10.  
  11. IMPORT e * := Exec;
  12.  
  13. (*--------------------------------------------------------------------
  14.  *
  15.  *   SCSI Command
  16.  *      Several Amiga SCSI controller manufacturers are converging on
  17.  *      standard ways to talk to their controllers.  This include
  18.  *      file describes an exec-device command (e.g. for hddisk.device)
  19.  *      that can be used to issue SCSI commands
  20.  *
  21.  *   UNIT NUMBERS
  22.  *      Unit numbers to the OpenDevice call have encoded in them which
  23.  *      SCSI device is being referred to.  The three decimal digits of
  24.  *      the unit number refer to the SCSI Target ID (bus address) in
  25.  *      the 1's digit, the SCSI logical unit (LUN) in the 10's digit,
  26.  *      and the controller board in the 100's digit.
  27.  *
  28.  *      Examples:
  29.  *                0     drive at address 0
  30.  *               12     LUN 1 on multiple drive controller at address 2
  31.  *              104     second controller board, address 4
  32.  *               88     not valid: both logical units and addresses
  33.  *                      range from 0..7.
  34.  *
  35.  *   CAVEATS
  36.  *      Original 2090 code did not support this command.
  37.  *
  38.  *      Commodore 2090/2090A unit numbers are different.  The SCSI
  39.  *      logical unit is the 100's digit, and the SCSI Target ID
  40.  *      is a permuted 1's digit: Target ID 0..6 maps to unit 3..9
  41.  *      (7 is reserved for the controller).
  42.  *
  43.  *          Examples:
  44.  *                3     drive at address 0
  45.  *              109     drive at address 6, logical unit 1
  46.  *                1     not valid: this is not a SCSI unit.  Perhaps
  47.  *                      it's an ST506 unit.
  48.  *
  49.  *      Some controller boards generate a unique name (e.g. 2090A's
  50.  *      iddisk.device) for the second controller board, instead of
  51.  *      implementing the 100's digit.
  52.  *
  53.  *      There are optional restrictions on the alignment, bus
  54.  *      accessability, and size of the data for the data phase.
  55.  *      Be conservative to work with all manufacturer's controllers.
  56.  *
  57.  *------------------------------------------------------------------*)
  58.  
  59. CONST
  60.  
  61.   scsiCmd * = 28;               (* issue a SCSI command to the unit *)
  62.                                 (* io_Data points to a SCSICmd *)
  63.                                 (* io_Length is sizeof(struct SCSICmd) *)
  64.                                 (* io_Actual and io_Offset are not used *)
  65.  
  66. TYPE
  67.  
  68.   SCSICmdPtr * = UNTRACED POINTER TO SCSICmd;
  69.   SCSICmd * = STRUCT
  70.     data * : e.APTR;          (* word aligned data for SCSI Data Phase *)
  71.                               (* (optional) data need not be byte aligned *)
  72.                               (* (optional) data need not be bus accessable *)
  73.     length * : LONGINT;       (* even length of Data area *)
  74.                               (* (optional) data can have odd length *)
  75.                               (* (optional) data length can be > 2**24 *)
  76.     actual * : LONGINT;       (* actual Data used *)
  77.     command * : e.APTR;       (* SCSI Command (same options as scsi_Data) *)
  78.     cmdLength * : INTEGER;    (* length of Command *)
  79.     cmdActual * : INTEGER;    (* actual Command used *)
  80.     flags * : SHORTSET;       (* includes intended data direction *)
  81.     status * : SHORTINT;      (* SCSI status of command *)
  82.     senseData * : e.APTR;     (* sense data: filled if SCSIF_[OLD]AUTOSENSE *)
  83.                               (* is set and scsi_Status has CHECK CONDITION *)
  84.                               (* (bit 1) set *)
  85.     senseLength * : INTEGER;  (* size of scsi_SenseData, also bytes to *)
  86.                               (* request w/ SCSIF_AUTOSENSE, must be 4..255 *)
  87.     senseActual * : INTEGER;  (* amount actually fetched (0 means no sense) *)
  88.   END;
  89.  
  90.  
  91. CONST
  92.  
  93. (*----- scsi_Flags -----*)
  94.   write         * = SHORTSET{};       (* intended data direction is out *)
  95.   read          * = 0;                (* intended data direction is in *)
  96.   readWrite     * = 0;                (* (the bit to test) *)
  97.  
  98.   noSense       * = SHORTSET{};       (* no automatic request sense *)
  99.   autoSense     * = 1;                (* do standard extended request sense *)
  100.                                       (* on check condition *)
  101.   oldAutoSense  * = 2;                (* do 4 byte non-extended request *)
  102.                                       (* sense on check condition *)
  103.  
  104. (*----- SCSI io_Error values -----*)
  105.   selfUnit      * = 40;     (* cannot issue SCSI command to self *)
  106.   dma           * = 41;     (* DMA error *)
  107.   phase         * = 42;     (* illegal or unexpected SCSI phase *)
  108.   parity        * = 43;     (* SCSI parity error *)
  109.   selTimeout    * = 44;     (* Select timed out *)
  110.   badStatus     * = 45;     (* status and/or sense error *)
  111.  
  112. (*----- OpenDevice io_Error values -----*)
  113.   noBoard       * = 50;     (* Open failed for non-existant board *)
  114.  
  115. END SCSIDisk.
  116.  
  117.