ftp.nice.ch/pub/next/tools/scsi/SCSI2_ToolBox.940921.NI.bs.tar.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.
//

//
// 	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.40 94/09/19 17:19:15 chris Exp Locker: chris $"

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

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

// Read and Write Big-Endian Byte Order Values
int readBigEndianLong(void *address);
int readBigEndianShort(void *address);
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);

@interface SCSI: Object
	{

	BOOL isOpen;				// 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 method
+ new;	

// Open, close, select a device
- (int) openTarget: (int) target lun: (int) lun;
- (int) open;
- (int) setTarget: (int) target lun: (int)lun;
- (int) close;

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

// Retrieve Error and Status Information
- (char *) errorString;		
- (char *) returnError: sender;	
- (char *) returnDriverStatus: (char **) driverStat scsiStatus: (char **) scsiStat andExtendedSense: (char **) esense;
- (struct scsi_req *) statusReq;
- (BOOL) isOpen;

// Issue Pre-packaged SCSI commands 	
- (int) inquiry: (struct inquiry2_reply *) ibuffer;	
- (int) readCapacity: (struct capacity2_reply *) rbuffer;
- (int) requestSense: (struct esense2_reply *) rbuffer;
- (int) testUnitReady;
- (int) sendDiagnosticPf: (BOOL) pf selfTest: (BOOL) st deviceOffLine: (BOOL) dol 
	unitOffLine: (BOOL) uol parameterListLength: (int) pll parameterBuffer: (char *) pbuf;
- (int) receiveDiagnosticAlloc: (int) alloc buffer: (char *) buf;
- (int) modeSensePage: (int) page pc: (int) pc dbd: (BOOL) dbd mpbuf: (struct mode_parameters *) mpbuf;

// 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.