ftp.nice.ch/pub/next/tools/scsi/SCSIInquire.3.0.s.tar.gz#/Inquirer/SCSI.h

This is SCSI.h in view mode; [Download] [Up]

//
// SCSI.h
//
// SCSI generic driver object library 
// Version 3 (Revision 3.0)
//
// The SCSI class source, header, and documentation are all:
// Copyright (c) 1990 by Jiro Nakamura and Canon, Inc. 
// Copyright (c) 1991 by Jiro Nakamura and Canon, Inc.
// Copyright (c) 1992 by Jiro Nakamura
// All Rights Reserved.
//
//
// See Class Documentation for information. I am not a great comment-person, 
// although I am not too proud of that fact....
//
// Original Author:	Jiro Nakamura
// Created:		June 12, 1990
//
// RCS Information
// Revision Number->	$Revision: 3.1 $
// Last Revised->	$Date: 92/11/13 02:31:45 $
// ------------------
// History:
//	16-May-92	Jiro
//		Cleaned up for commercial release (Rev 3.0)
//	12-Jul-91	Jiro
//		Added all the stuff from SCSICommander and such. (Rev 2.0)
//		Version 2 of the class.
//	 6-Aug-90	Jiro
//		Cleaned up code. Removed dead fragments (Rev. 1.1)
//	 3-Aug-90	Jiro    
//		Added READ CAPACITY. (Rev. 1.0.1)
//	12-Jul-90	Jiro Nakamura
//		Fixed up for Revision 1.0 (Version 1).	
// 	12-Jun-90	Jiro Nakamura
//		Created.

#import <objc/Object.h>
#import <sys/types.h>
#import <bsd/dev/scsireg.h>
#import "scsi2reg.h"

#ifndef KILOBYTE
	#define KILOBYTE	(1024.0)
	#define MEGABYTE	(1024.0 * 1024.0)
#endif

	
@interface SCSI: Object
{
	BOOL scsiOpen;			// TRUE if SCSI device open

	int target, lun;		// Target/ logical unit
	int fd;				// File descriptor
	char *dev_name;			// Generic SCSI Device
	
	struct scsi_req sr;		// SCSI command request	parameters
	struct scsi_adr sa;		// SCSI address parameters
	
	char	errorString[100];	// English error information
}

// Factory methods
+ new;			// Overrides superclass
+ (void) clearCommandBlock: (union cdb *) cdbp;


// Opening and closing the driver
- (int) openSCSI;
- (int) openSCSIAt: (int) trg lun: (int) ln;
- (int) closeSCSI;


// Setting the target SCSI ID and logical unit
- (int) setTarget: (int) target lun: (int)lun;


// Returning English error information
- (char *) errorString;		// Subclass modifies this appropriately
- (char *) returnError: sender;	// Bus level error messages
- (char *) returnDriverStatus: (char **) driverStatus scsiStatus:
	(char **) scsiSctatus andExtendedSense: (char **) esense;


// User Macro Commands
- (int) findDevice;			// Just [self findDevice: 0];
- (int) findDevice: (int) trg;		// Wrap on findDeviceSCSI:
- (BOOL) isDevice;			// Wrap on isDeviceSCSI 
- (int) inquiry: (struct inquiry_reply *) ibuffer;	
- (int) modeSensePage: (int) page pc: (int) pc dbd: (BOOL) dbd
	mpbuf: (struct mode_parameters *) mpbuf;
- (int) readCapacity: (struct capacity_reply *) rbuffer;
- (int) receiveDiagnosticAlloc: (int) alloc   buffer: (char *) buf;
- (int) requestSense: (union esenseReply *) rbuffer;
- (int) sendDiagnosticPf: (BOOL) pf selfTest: (BOOL) st 
	deviceOffLine: (BOOL) dol unitOffLine: (BOOL) uol
	parameterListLength: (int) pll parameterBuffer: (char *) pbuf;
- (int) testUnitReady;


// Pseudo-basic SCSI commands
- (BOOL) isDeviceSCSI;			// Subclass Responsibility
- (int) findDeviceSCSI: (int) trg;	// Is this our device?

// Basic SCSI commands. Structures are in <nextdev/scsireg.h> 
- (int) inquirySCSI: 		(struct inquiry_reply *) ibuffer;
- (int) modeSenseSCSIPage: (int) page pc: (int) pc dbd: (BOOL) dbd
	mpbuf: (struct mode_parameters *) mpbuf;	
- (int) readCapacitySCSI:	(struct capacity_reply *) rbuffer;
- (int) receiveDiagnosticSCSIAlloc: (int) alloc   buffer: (char *) buf;
- (int)	requestSenseSCSI:	(union esenseReply *)  rbuffer;
- (int) sendDiagnosticSCSIPf: (BOOL) pf selfTest: (BOOL) st 
	deviceOffLine: (BOOL) dol unitOffLine: (BOOL) uol
	parameterListLength: (int) pll parameterBuffer: (char *) pbuf;
- (int) testUnitReadySCSI;


// Variable accessors
- (struct scsi_req *) statusReq;
- (BOOL) scsiOpen;

// Accessory Methods (use at own risk)
- (const char *) identifyDeviceType: (struct inquiry_reply *)  ibuffer;

// Archiving methods
- write: (NXTypedStream *) stream;
- read: (NXTypedStream *) stream;

// For use by professionals only
- (int) executeRequest: (struct scsi_req *) sp;
- (int) executeBusReset;

// Internal Routines -- Only subclasses should use these
- (int) performSCSIRequest;
@end


These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.