ftp.nice.ch/pub/next/tools/scsi/SCSI2_ToolBox.941207.NI.bs.gnutar.gz#/SCSI2_ToolBox/SCSI2_Kit/Source/SCSI.h

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

//
//	SCSI2_Class - provides architecture independendent low-level
//				  SCSI device access.
//
//	Copyright (C) 1994 by Christopher Wolf.
//
//	This library is free software; you can redistribute it and/or
//	modify it under the terms of the GNU Library General Public
//	License as published by the Free Software Foundation; either
//	version 2 of the License, or (at your option) any later version.
//
//	This library is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//	Library General Public License for more details.
//
//	You should have received a copy of the GNU Library General Public
//	License along with this library; if not, write to the Free
//	Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//	Bug-reports, comments and questions should be directed to:
//		Christopher Wolf <chris@alchemy.geo.cornell.edu>
//
//	Portions of this code are derived from an earlier work 
//	(SCSI Inquirer) Copyright (C) 1990, 1991, 1992 by Jiro Nakamura
//	and used with permission.
//
//	Portions of this code  are derived from code provided by
//	Andreas Ploeger and used with permission
//

//
// 	For best results view this file with a tab size of 4 and
//	a display width of 132 columns or wider.
//

//	file version information
#define RCSSH "$Id: SCSI.h,v 0.63 94/11/17 21:07:29 chris Exp $"

//	generic Unix headers
#import <objc/Object.h>
#import <sys/types.h>

//	SCSI2 class specific headers
#import "scsi2reg.h"

// Read and Write Big-Endian Byte Order Values
u_int readBigEndianLong(void *address);
u_int readBigEndianShort(void *address);
u_int readBigEndianValue(void *address, int numBits);
void writeBigEndianLong(int value, void *address);
void writeBigEndianShort(int value, void *address);
void writeBigEndianValue(int value, void *address, int numBits);

// 	debugging/error print function
typedef void(*PrintFunction)(const char*format, ...);
PrintFunction dprintf;		

@interface SCSI: Object
	{

	BOOL isOpen;				// 	TRUE if SCSI device open

	int target, lun;			// 	Target / logical unit
	int fd;						// 	File descriptor
	int ioctlCode;				// 	Type of ioctl's to use (varies depending on device type)
	BOOL immed;					//	Indicates long commands should return immediately
	int timeout;				// 	Time-out for commands    
	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

	}


//	Set/read instance variables
- (void) setImmediate: (BOOL)immediate;
- (BOOL) immediate;
- (void) setTimeout: (int)to;
- (int) timeout;

// 	Open, close, select a device
- (int) openDevice: (const char *) deviceName ioctlCode: (int) iCode;
- (int) setDevice: (const char *) deviceName ioctlCode: (int) iCode;
- (int) openTarget: (int) target lun: (int) lun;
- (int) setTarget: (int) target lun: (int)lun;
- (int) openSCSI;
- (int) closeSCSI;

// 	Find a device
- (int) findDevice;	
- (int) findDevice: (int) trg;		
- (BOOL) isDevice;	

// 	Error output and status reporting 
+ (PrintFunction)dprintf;
+ setDprintf:(PrintFunction)pf;
- (char *) errorString;		
- (char *) returnError: sender;	
- (char *) returnDriverStatus: (char **) driverStat scsiStatus: (char **) scsiStat andExtendedSense: (char **) esense;
- (struct scsi_req *) statusReq;
- (BOOL) isOpen;
- (int) fd;

// 	Issue Pre-packaged SCSI commands 	
- (int) inquiry: (struct inquiry_reply *) ibuffer;	
- (int) readCapacity: (struct capacity_reply *) rbuffer;
- (int) requestSense: (struct esense_reply *) rbuffer;
- (int) testUnitReady;
- (int)	sendDiagnostic: (char *)dbuf size: (u_char)size pf: (BOOL)pf st: (BOOL)st  dol: (BOOL)dol uol: (BOOL)uol;
- (int) receiveDiagnostic: (char *)dbuf size: (u_char)size;
- (int) modeSenseRaw: (mode_parameter_list *)mpl size: (u_char)size page: (u_char)page pc: (u_char)pc dbd: (BOOL) dbd;
- (int) modeSenseCooked: (mode_page *)mp size: (u_char)size page: (u_char)page pc: (u_char)pc;
- (int) modeSelectRaw: (mode_parameter_list *)mpl size: (u_char)size save: (BOOL)save;

// 	Issue Low Level SCSI Commands
- (int) executeRequest: (struct scsi_req *) sp;
- (int) executeBusReset;
+ (void) clearCommandBlock: (union cdb *) cdbp;

// 	Private methods
- (int) performRequest;

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

@end

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