1/* 2 * DoScsiCommand.h - 3 * 4 * Modifed by Eryk Vershen 5 * from an original by Martin Minow 6 */ 7 8/* 9 * Copyright 1993-1998 by Apple Computer, Inc. 10 * All Rights Reserved 11 * 12 * Permission to use, copy, modify, and distribute this software and 13 * its documentation for any purpose and without fee is hereby granted, 14 * provided that the above copyright notice appears in all copies and 15 * that both the copyright notice and this permission notice appear in 16 * supporting documentation. 17 * 18 * APPLE COMPUTER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 19 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 20 * FOR A PARTICULAR PURPOSE. 21 * 22 * IN NO EVENT SHALL APPLE COMPUTER BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 23 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 24 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 25 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 26 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 27 */ 28 29#ifndef __DoScsiCommand__ 30#define __DoScsiCommand__ 31 32#include <SCSI.h> 33#include "MacSCSICommand.h" 34 35 36/* 37 * Defines 38 */ 39#ifndef EXTERN 40#define EXTERN extern 41#endif 42 43#ifndef TRUE 44#define TRUE 1 45#define FALSE 0 46#endif 47 48#ifndef NULL 49#define NULL 0 50#endif 51 52#define kOriginalSCSIBusAdaptor (0xFF) 53 54#define SameSCSIDevice(a, b) ((*((UInt32 *) &a)) == (*((UInt32 *) &b))) 55 56/* 57 * Cheap 'n dirty memory clear routine. 58 */ 59#define CLEAR(dst) clear_memory((void *) &dst, sizeof dst) 60 61 62/* 63 * Types 64 */ 65#if !defined(__NewTypesDefined__) 66#define __NewTypesDefined__ 67typedef signed char SInt8; 68typedef signed short SInt16; 69typedef signed long SInt32; 70typedef unsigned char UInt8; 71typedef unsigned short UInt16; 72typedef unsigned long UInt32; 73typedef unsigned long ItemCount; 74typedef unsigned long ByteCount; 75#endif 76 77 78/* 79 * Global Constants 80 */ 81enum { 82 bit0 = (1 << 0), 83 bit1 = (1 << 1), 84 bit2 = (1 << 2), 85 bit3 = (1 << 3), 86 bit4 = (1 << 4), 87 bit5 = (1 << 5), 88 bit6 = (1 << 6), 89 bit7 = (1 << 7) 90}; 91 92 93/* 94 * Global Variables 95 */ 96EXTERN int gSCSIHiBusID; 97EXTERN SCSIExecIOPB *gSCSIExecIOPBPtr; 98EXTERN UInt32 gSCSIExecIOPBPtrLen; 99 100 101/* 102 * Forward declarations 103 */ 104void AllocatePB(); 105Boolean IsIllegalRequest(OSErr scsiStatus, const SCSI_Sense_Data *senseDataPtr); 106Boolean IsNoMedia(OSErr scsiStatus, const SCSI_Sense_Data *senseDataPtr); 107/* 108 * All SCSI Commands come here. 109 * if scsiDevice.busID == kOriginalSCSIBusAdaptor, IM-IV SCSI will be called. 110 * scsiFlags should be scsiDirectionNone, scsiDirectionIn, or scsiDirectionOut 111 * actualTransferCount may be NULL if you don't care. 112 * Both old and new SCSI return SCSI Manager 4.3 errors. 113 * 114 * DoSCSICommand throws really serious errors, but returns SCSI errors such 115 * as dataRunError and scsiDeviceNotThere. 116 */ 117OSErr DoSCSICommand( 118 DeviceIdent scsiDevice, 119 ConstStr255Param currentAction, 120 const SCSI_CommandPtr callerSCSICommand, 121 Ptr dataBuffer, 122 ByteCount dataLength, 123 UInt32 scsiFlags, 124 ByteCount *actualTransferCount, 125 SCSI_Sense_Data *sensePtr, 126 StringPtr senseMessage 127); 128 129 130#endif /* __DoScsiCommand__ */ 131