AmendHub

Download:

akuker

/

scsi_test

/

amendments

/

3

More files and stuff


akuker made amendment 3 over 2 years ago
--- AsyncSCSIPresent.c Tue Jun 16 01:55:46 2009 +++ AsyncSCSIPresent.c Tue Jun 16 01:55:46 2009 @@ -0,0 +1,58 @@ +/* AsyncSCSIPresent.c */ +/* + * AsyncSCSIPresent.c + * Copyright © 1992-94 Apple Computer Inc. All Rights Reserved. + */ +#include <OSUtils.h> +#include <Traps.h> +#ifndef _SCSIAtomic +/* + * This is needed if you don't have Universal Headers. + */ +#define _SCSIAtomic 0xA089 +#endif + +Boolean AsyncSCSIPresent(void); +static Boolean TrapAvailable( + short theTrap + ); + +Boolean +AsyncSCSIPresent(void) +{ + return (TrapAvailable(_SCSIAtomic)); +} + +/* + * TrapAvailable (see Inside Mac VI 3-8) + */ +#define NumToolboxTraps() ( \ + (NGetTrapAddress(_InitGraf, ToolTrap) \ + == NGetTrapAddress(0xAA6E, ToolTrap)) \ + ? 0x200 : 0x400 \ + ) +#define GetTrapType(theTrap) ( \ + (((theTrap) & 0x0800) != 0) ? ToolTrap : OSTrap \ + ) + +static Boolean +TrapAvailable( + short theTrap + ) +{ + TrapType trapType; + + trapType = GetTrapType(theTrap); + if (trapType == ToolTrap) { + theTrap &= 0x07FF; + if (theTrap >= NumToolboxTraps()) + theTrap = _Unimplemented; + } + return ( + NGetTrapAddress(theTrap, trapType) + != NGetTrapAddress(_Unimplemented, ToolTrap) + ); +} + + + --- DoGetDriveInfo.c Sun Aug 21 21:05:58 2022 +++ DoGetDriveInfo.c Sun Aug 21 21:05:58 2022 @@ -0,0 +1,42 @@ +/* DoGetDriveInfo.c */ +/* + * DoGetDriveInfo.c + * Copyright © 1992-94 Apple Computer Inc. All Rights Reserved. + */ +//#include "SCSISimpleSample.h" + +#include "scsi_test.h" + +/* + * Execute a Bus Inquiry SCSI request on the selected device. If it succeeds, + * display the results. + */ +void +DoGetDriveInfo( + DeviceIdent scsiDevice, /* -> Bus/target/LUN */ + Boolean noIntroMsg, + Boolean useAsynchManager + ) +{ + + ScsiCmdBlock scsiCmdBlock; + SCSI_Inquiry_Data inquiry; +#define SCB (scsiCmdBlock) + + if (noIntroMsg == FALSE) + ShowSCSIBusID(scsiDevice, "\pGet Drive Info"); + CLEAR(SCB); + SCB.scsiDevice = scsiDevice; + SCB.command.scsi6.opcode = kScsiCmdInquiry; + SCB.command.scsi6.len = sizeof inquiry; + SCB.bufferPtr = (Ptr) &inquiry; + SCB.transferSize = sizeof inquiry; + SCB.transferQuantum = 1; /* Force handshake */ + /* All other command bytes are zero */ + DoSCSICommandWithSense(&scsiCmdBlock, TRUE, useAsynchManager); + if (SCB.status == noErr) + DoShowInquiry(scsiDevice, &inquiry); +#undef SCB +} + +