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
| 0 | scOpcode | word | operation code |
| 2 | scParam1 | long | first parameter |
| 6 | scParam2 | long | second parameter |
Driver Descriptor Record
| 0 | sbSig | word | device signature |
| 2 | sbBlkSize | word | block size of the device |
| 4 | sbBlkCount | long | number of blocks on the device |
| 8 | sbDevType | word | reserved |
| 10 | sbDevId | word | reserved |
| 12 | sbData | long | reserved |
| 16 | sbDrvrCount | word | number of driver descriptor entries |
| 18 | ddBlock | long | first driver's starting block |
| 22 | ddSize | word | driver's size, in 512-byte blocks |
| 24 | ddType | word | operating system type (MacOS = 1) |
| 26 | ddPad | 486 bytes | additional drivers, if any |
Partition Map Entry
| 0 | pmSig | word | partition signature |
| 2 | pmSigPad | word | reserved |
| 4 | pmMapBlkCnt | long | number of blocks in partition map |
| 8 | pmPyPartStart | long | first physical block of partition |
| 12 | pmPartBlkCnt | long | number of blocks in partition |
| 16 | pmPartName | 32 bytes | partition name |
| 48 | PmParType | 32 bytes | partition type |
| 80 | pmLgDataStart | long | first logical block of data area |
| 84 | pmDataCnt | long | number of blocks in data area |
| 88 | pmPartStatus | long | partition status information |
| 92 | pmLgBootStart | long | first logical block of boot code |
| 96 | pmBootSize | long | size of boot code, in bytes |
| 100 | pmBootAddr | long | boot code load address |
| 104 | pmBootAddr2 | long | reserved |
| 108 | pmBootEntry | long | boot code entry point |
| 112 | pmBootEntry2 | long | reserved |
| 116 | pmBootCksum | long | boot code checksum |
| 120 | pmProcessor | 16 bytes | processor type |
| 136 | pmPad | 376 bytes | reserved |
Record
Trap Macros
Trap Macros Requiring Routine Selectors
_SCSIDispatch
| Selector | Routine |
| $00 | SCSIReset |
| $01 | SCSIGet |
| $02 | SCSISelect |
| $03 | SCSICmd |
| $04 | SCSIComplete |
| $05 | SCSIRead |
| $06 | SCSIWrite |
| $08 | SCSIRBlind |
| $09 | SCSIWBlind |
| $0A | SCSIStat |
| $0B | SCSISelAtn |
| $0C | SCSIMsgIn |
| $0D | SCSIMsgOut |
Result Codes
noErr | 0 | No error |
scCommErr | 2 | Communications error, operation timeout |
scArbNBErr | 3 | Bus busy, arbitration timeout |
scBadParmsErr | 4 | Bad parameter or unrecognized TIB instruction |
scPhaseErr | X | Phase error on the SCSI bus |
scCompareErr | 6 | Comparison error from scComp instruction |
scMgrBusyErr | 7 | SCSI Manager busy |
| scSequenceErr | 8 | Attempted operation is out of sequence |
| scBusTOErr | 9 | Bus timeout during blind transfer |
| scComplPhaseErr | 10 | SCSI bus was not in status phase on entry to SCSIComplete |