Reduce amount of macro magic. Use the same special characters as nroff
[netbsd-mini2440.git] / dist / pdisk / DoSCSICommand.h
blob337ddbee6950330f015084e991672996e1ac8a56
1 /*
2 * DoScsiCommand.h -
4 * Modifed by Eryk Vershen
5 * from an original by Martin Minow
6 */
8 /*
9 * Copyright 1993-1998 by Apple Computer, Inc.
10 * All Rights Reserved
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.
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.
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.
29 #ifndef __DoScsiCommand__
30 #define __DoScsiCommand__
32 #include <SCSI.h>
33 #include "MacSCSICommand.h"
37 * Defines
39 #ifndef EXTERN
40 #define EXTERN extern
41 #endif
43 #ifndef TRUE
44 #define TRUE 1
45 #define FALSE 0
46 #endif
48 #ifndef NULL
49 #define NULL 0
50 #endif
52 #define kOriginalSCSIBusAdaptor (0xFF)
54 #define SameSCSIDevice(a, b) ((*((UInt32 *) &a)) == (*((UInt32 *) &b)))
57 * Cheap 'n dirty memory clear routine.
59 #define CLEAR(dst) clear_memory((void *) &dst, sizeof dst)
63 * Types
65 #if !defined(__NewTypesDefined__)
66 #define __NewTypesDefined__
67 typedef signed char SInt8;
68 typedef signed short SInt16;
69 typedef signed long SInt32;
70 typedef unsigned char UInt8;
71 typedef unsigned short UInt16;
72 typedef unsigned long UInt32;
73 typedef unsigned long ItemCount;
74 typedef unsigned long ByteCount;
75 #endif
79 * Global Constants
81 enum {
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)
94 * Global Variables
96 EXTERN int gSCSIHiBusID;
97 EXTERN SCSIExecIOPB *gSCSIExecIOPBPtr;
98 EXTERN UInt32 gSCSIExecIOPBPtrLen;
102 * Forward declarations
104 void AllocatePB();
105 Boolean IsIllegalRequest(OSErr scsiStatus, const SCSI_Sense_Data *senseDataPtr);
106 Boolean IsNoMedia(OSErr scsiStatus, const SCSI_Sense_Data *senseDataPtr);
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.
114 * DoSCSICommand throws really serious errors, but returns SCSI errors such
115 * as dataRunError and scsiDeviceNotThere.
117 OSErr 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
130 #endif /* __DoScsiCommand__ */