Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Devices /
Chapter 3 - SCSI Manager


Summary of the SCSI Manager

Pascal Summary

Constants

CONST
   scInc       = 1;     {transfer data, increment buffer pointer}
   scNoInc     = 2;     {transfer data, don't increment pointer}
   scAdd       = 3;     {add long to address}
   scMove      = 4;     {move long to address}
   scLoop      = 5;     {decrement counter and loop if > 0}
   scNop       = 6;     {no operation}
   scStop      = 7;     {stop TIB execution}
   scComp      = 8;     {compare SCSI data with memory}
   {signature values}
   sbSIGWord   = $4552;    {driver descriptor map signature}
   pMapSIG     = $504D;    {partition map signature}

Data Types

TYPE SCSIInstr =
   RECORD
      scOpcode:         Integer;    {operation code}
      scParam1:         LongInt;    {first parameter}
      scParam2:         LongInt;    {second parameter}
   END;
   Block0 = 
   PACKED RECORD
      sbSig:         Integer;    {device signature}
      sbBlkSize:     Integer;    {block size of the device}
      sbBlkCount:    LongInt;    {number of blocks on the device}
      sbDevType:     Integer;    {reserved}
      sbDevId:       Integer;    {reserved}
      sbData:        LongInt;    {reserved}
      sbDrvrCount:   Integer;    {number of driver descriptor entries}
      ddBlock:       LongInt;    {first driver's starting block}
      ddSize:        Integer;    {size of the driver, in 512-byte blocks}
      ddType:        Integer;    {operating system type (MacOS = 1)}
      ddPad:         ARRAY [0..242] OF Integer; {additional drivers, if any}
   END;
   Partition = 
   RECORD
      pmSig:         Integer;    {partition signature}
      pmSigPad:      Integer;    {reserved}
      pmMapBlkCnt:   LongInt;    {number of blocks in partition map}
      pmPyPartStart: LongInt;    {first physical block of partition}
      pmPartBlkCnt:  LongInt;    {number of blocks in partition}
      pmPartName:    PACKED ARRAY [0..31] OF Char; {partition name}
      pmParType:     PACKED ARRAY [0..31] OF Char; {partition type}
      pmLgDataStart: LongInt;    {first logical block of data area}
      pmDataCnt:     LongInt;    {number of blocks in data area}
      pmPartStatus:  LongInt;    {partition status information}
      pmLgBootStart: LongInt;    {first logical block of boot code}
      pmBootSize:    LongInt;    {size of boot code, in bytes}
      pmBootAddr:    LongInt;    {boot code load address}
      pmBootAddr2:   LongInt;    {reserved}
      pmBootEntry:   LongInt;    {boot code entry point}
      pmBootEntry2:  LongInt;    {reserved}
      pmBootCksum:   LongInt;    {boot code checksum}
      pmProcessor:   PACKED ARRAY [0..15] OF Char; {processor type}
      pmPad:         ARRAY [0..187] OF Integer;    {reserved}
   END;

Routines

FUNCTION SCSIReset		: OSErr;
FUNCTION SCSIGet		: OSErr;
FUNCTION SCSISelect		(targetID: Integer): OSErr;
FUNCTION SCSISelAtn		(targetID: Integer): OSErr;
FUNCTION SCSICmd		(buffer: Ptr; count: Integer): OSErr;
FUNCTION SCSIMsgIn		(VAR message: Integer): OSErr;
FUNCTION SCSIMsgOut		(message: Integer): OSErr;
FUNCTION SCSIRead		(tibPtr: Ptr): OSErr;
FUNCTION SCSIRBlind		(tibPtr: Ptr): OSErr;
FUNCTION SCSIWrite		(tibPtr: Ptr): OSErr;
FUNCTION SCSIWBlind		(tibPtr: Ptr): OSErr;
FUNCTION SCSIComplete		(VAR stat: Integer; VAR message: Integer; 
				wait: LongInt): OSErr;
FUNCTION SCSIStat		: Integer;

C Summary

Constants

enum {
   /* TIB instruction opcodes */
   scInc       = 1,        /* transfer data, increment buffer pointer */
   scNoInc     = 2,        /* transfer data, don't increment pointer */
   scAdd       = 3,        /* add long to address */
   scMove      = 4,        /* move long to address */
   scLoop      = 5,        /* decrement counter and loop if > 0 */
   scNop       = 6,        /* no operation */
   scStop      = 7,        /* stop TIB execution */
   scComp      = 8,        /* compare SCSI data with memory */
   /* signature values */
   sbSIGWord   = 0x4552,   /* driver descriptor map signature */
   pMapSIG     = 0x504D    /* partition map signature */
};

Data Types

struct SCSIInstr {
   unsigned short    scOpcode;      /* operation code */
   unsigned long     scParam1;      /* first parameter */
   unsigned long     scParam2;      /* second parameter */
};
typedef struct SCSIInstr SCSIInstr;
struct Block0 {
   unsigned short    sbSig;         /* device signature */
   unsigned short    sbBlkSize;     /* block size of the device*/
   unsigned long     sbBlkCount;    /* number of blocks on the device*/
   unsigned short    sbDevType;     /* reserved */
   unsigned short    sbDevId;       /* reserved */
   unsigned long     sbData;        /* reserved */
   unsigned short    sbDrvrCount;   /* number of driver descriptor entries */
   unsigned long     ddBlock;       /* first driver's starting block */
   unsigned short    ddSize;        /* driver's size, in 512-byte blocks */
   unsigned short    ddType;        /* operating system type (MacOS = 1) */
   unsigned short    ddPad[243];    /* additional drivers, if any */
};
typedef struct Block0 Block0;
Partition {
   unsigned short    pmSig;         /* partition signature */
   unsigned short    pmSigPad;      /* reserved */
   unsigned long     pmMapBlkCnt;   /* number of blocks in partition map */
   unsigned long     pmPyPartStart; /* first physical block of partition */
   unsigned long     pmPartBlkCnt;  /* number of blocks in partition */
   unsigned char     pmPartName[32];/* partition name */
   unsigned char     pmParType[32]; /* partition type */
   unsigned long     pmLgDataStart; /* first logical block of data area */
   unsigned long     pmDataCnt;     /* number of blocks in data area */
   unsigned long     pmPartStatus;  /* partition status information */
   unsigned long     pmLgBootStart; /* first logical block of boot code */
   unsigned long     pmBootSize;    /* size of boot code, in bytes */
   unsigned long     pmBootAddr;    /* boot code load address */
   unsigned long     pmBootAddr2;   /* reserved */
   unsigned long     pmBootEntry;   /* boot code entry point */
   unsigned long     pmBootEntry2;  /* reserved */
   unsigned long     pmBootCksum;   /* boot code checksum */
   unsigned char     pmProcessor[16];  /* processor type */
   unsigned short    pmPad[188];    /* reserved */
};
typedef struct Partition Partition;

Functions

pascal OSErr SCSIReset     (void);
pascal OSErr SCSIGet       (void);
pascal OSErr SCSISelect    (short targetID);
pascal OSErr SCSISelAtn    (short targetID);
pascal OSErr SCSICmd       (Ptr buffer, short count);
pascal OSErr SCSIMsgIn     (short *message);
pascal OSErr SCSIMsgOut    (short message);
pascal OSErr SCSIRead      (Ptr tibPtr);
pascal OSErr SCSIRBlind    (Ptr tibPtr);
pascal OSErr SCSIWrite     (Ptr tibPtr);
pascal OSErr SCSIWBlind    (Ptr tibPtr);
pascal OSErr SCSIComplete  (short *stat, short *message, 
                            unsigned long wait);
pascal short SCSIStat      (void);

Assembly-Language Summary

Data Structures

Transfer Instruction Block
0scOpcodewordoperation code
2scParam1longfirst parameter
6scParam2longsecond parameter

Driver Descriptor Record
0sbSigworddevice signature
2sbBlkSizewordblock size of the device
4sbBlkCountlongnumber of blocks on the device
8sbDevTypewordreserved
10sbDevIdwordreserved
12sbDatalongreserved
16sbDrvrCountwordnumber of driver descriptor entries
18ddBlocklongfirst driver's starting block
22ddSizeworddriver's size, in 512-byte blocks
24ddTypewordoperating system type (MacOS = 1)
26ddPad486 bytesadditional drivers, if any

Partition Map Entry
0pmSigwordpartition signature
2pmSigPadwordreserved
4pmMapBlkCntlongnumber of blocks in partition map
8pmPyPartStartlongfirst physical block of partition
12pmPartBlkCntlongnumber of blocks in partition
16pmPartName32 bytespartition name
48PmParType32 bytespartition type
80pmLgDataStartlongfirst logical block of data area
84pmDataCntlongnumber of blocks in data area
88pmPartStatuslongpartition status information
92pmLgBootStartlongfirst logical block of boot code
96pmBootSizelongsize of boot code, in bytes
100pmBootAddrlongboot code load address
104pmBootAddr2longreserved
108pmBootEntrylongboot code entry point
112pmBootEntry2longreserved
116pmBootCksumlongboot code checksum
120pmProcessor16 bytesprocessor type
136pmPad376 bytesreserved
Record

Trap Macros

Trap Macros Requiring Routine Selectors

_SCSIDispatch
SelectorRoutine
$00SCSIReset
$01SCSIGet
$02SCSISelect
$03SCSICmd
$04SCSIComplete
$05SCSIRead
$06SCSIWrite
$08SCSIRBlind
$09SCSIWBlind
$0ASCSIStat
$0BSCSISelAtn
$0CSCSIMsgIn
$0DSCSIMsgOut

Result Codes
noErr0No error
scCommErr2Communications error, operation timeout
scArbNBErr3Bus busy, arbitration timeout
scBadParmsErr4Bad parameter or unrecognized TIB instruction
scPhaseErrXPhase error on the SCSI bus
scCompareErr6Comparison error from scComp instruction
scMgrBusyErr7SCSI Manager busy
scSequenceErr8Attempted operation is out of sequence
scBusTOErr9Bus timeout during blind transfer
scComplPhaseErr10SCSI bus was not in status phase on entry to SCSIComplete


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996