AmendHub

Download

akuker

/

scsi_test

/

SCSIFindDevices.h

 

(View History)

akuker   Initial commit 2 Latest amendment: 2 on 2022-08-21

1 /*
2 File: SCSIFindDevices.h
3
4 Contains: Include the O.S. files in a specific order to make sure that we have
5 a definition for the _SCSIAtomic trap.
6
7 Written by:
8
9 Copyright: Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved.
10
11 You may incorporate this Apple sample source code into your program(s) without
12 restriction. This Apple sample source code has been provided "AS IS" and the
13 responsibility for its operation is yours. You are not permitted to redistribute
14 this Apple sample source code as "Apple sample source code" after having made
15 changes. If you're going to re-distribute the source, we require that you make
16 it clear in the source that the code was descended from Apple sample source
17 code, but that you've made changes.
18
19 Change History (most recent first):
20 7/14/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1
21
22
23 */
24 #include <Traps.h>
25 #ifndef _SCSIAtomic
26 #define _SCSIAtomic 0xA089
27 #endif
28 /*
29 * This uses the new "common" SCSI.h which is not yet in the public
30 * header folders.
31 */
32 #include "SCSI.h"
33
34 /*
35 * This is a parameter block for SCSIFindNextDevice that contains the data shared
36 * with the calling program and the internal state that the function needs to
37 * sequence between each device. If SCSIFindNextDevice succeeds, the device
38 * inquiry data is stored in the record.
39 */
40 struct SCSIFindDevicesRec {
41 /* Public variables */
42 DeviceIdent deviceID; /* <-> Bus/target/LUN */
43 short maxLUN; /* -> Maximum logical units */
44 Boolean isAsyncSCSIPresent; /* <- TRUE if SCSI Manager 4.3 */
45 long refNum; /* Reserved for the caller */
46 long actualInquirySize; /* <- data length in inquiry */
47 struct SCSI_Inquiry_Data { /* <- Inquiry returns this */
48 unsigned char devType; /* 0 Device type, */
49 unsigned char devTypeMod; /* 1 Device type modifier */
50 unsigned char version; /* 2 ISO/ECMA/ANSI version */
51 unsigned char format; /* 3 Response data format */
52 unsigned char length; /* 4 Additional Length */
53 unsigned char reserved5; /* 5 Reserved */
54 unsigned char reserved6; /* 6 Reserved */
55 unsigned char flags; /* 7 Capability flags */
56 unsigned char vendor[8]; /* 8-15 Vendor-specific */
57 unsigned char product[16]; /* 16-31 Product id */
58 unsigned char revision[4]; /* 32-35 Product revision */
59 unsigned char vendorSpecific[20]; /* 36-55 Vendor stuff */
60 unsigned char moreReserved[40]; /* 56-95 Reserved */
61 } inquiry;
62 /* Private variables */
63 short state; /* Control overall operation */
64 unsigned short lastHostBus; /* Host bus iteration limit */
65 Boolean useAsynchSCSI; /* Is asynch ok on this bus? */
66 unsigned short initiatorID; /* Host processor bus ID */
67 unsigned short maxTargetID; /* Max target on this bus */
68 short maxBusLUN; /* Max LUN on this bus */
69 Boolean enableATN; /* Select with ATN on this bus? */
70 unsigned long execIOPBSize; /* SCSIAction pb size */
71 SCSIExecIOPB *scsiExecIOPB; /* Set on bus-by-bus basis */
72 };
73 typedef struct SCSIFindDevicesRec SCSIFindDevicesRec, *SCSIFindDevicesPtr;
74 /*
75 * Notes on the above:
76 * Public variables:
77 * deviceID This is the current SCSI device. If deviceID.bus == 0xFF
78 * SCSIFindNextDevice will initialize itself.
79 * maxLUN Set to zero to ignore logical units or seven to test
80 * all targets for multiple logical units. Beware: some
81 * devices fail miserably if a non-zero logical unit is
82 * selected.
83 * isAsyncSCSIPresent Set TRUE after the first call to SCSIFindNextDevice if
84 * the asynchronous SCSI Manager (SCSI Manager 4.3) is
85 * running.
86 * actualInquirySize If the function succeeds, it returns the Device Inquiry
87 * information in the inquiry field. actualInquirySize
88 * is the length of the data that was returned.
89 * inquiry This is the device information returned on success.
90 * Private variables:
91 * state This manages the overall code flow in the subroutine.
92 * lastHostBus The highest host bus on this system (if asynch present)
93 * useAsynchSCSI TRUE if the asynchronous SCSI Manager works on this bus
94 * initiatorID The bus ID of the Macintosh. Normally 7
95 * maxTargetID The maximum target bus ID on this host bus.
96 * enableATN Enable "select with attention" if set. This works around
97 * a bug on un-patched Quadra 660-av and 840-av systems.
98 * execIOPBSize The size of the SCSI parameter block.
99 * scsiExecIOPB A pointer to the SCSI parameter block.
100 */
101
102 /*
103 * SCSIFindNextDevice:
104 * Scan the SCSI bus(es) for the next device. This will scan all buses, all
105 * targets, and all logical units in order. To initialize, set deviceID.bus to
106 * 0xFF and maxLUN to zero or seven as needed.
107 * SCSIFindNextDevice allocates memory.
108 *
109 * Return:
110 * noErr The deviceID field contains the next SCSI device and
111 * the inquiry structure contains device-specific information.
112 * eofErr The last device has been found. This is a normal status.
113 * other errors Something horrible happened, such as a memory error.
114 * (If your application calls SCSIFindNextDevice after any
115 * error status, it will start from the beginning.)
116 */
117 OSErr SCSIFindNextDevice(
118 SCSIFindDevicesPtr scsiFindDevicesPtr
119 );