home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXTSTEP 3.2 (Developer)
/
NS_dev_3.2.iso
/
NextDeveloper
/
Headers
/
driverkit
/
scsiTypes.h
< prev
next >
Wrap
Text File
|
1993-06-30
|
3KB
|
128 lines
/* Copyright (c) 1991 NeXT Computer, Inc. All rights reserved.
*
* scsiTypes.h - Exported API of SCSIController class.
*
* HISTORY
* 11-Feb-91 Doug Mitchell at NeXT
* Created.
*/
#import <objc/objc.h>
#import <driverkit/driverTypes.h>
#import <kernserv/clock_timer.h>
#import <bsd/dev/scsireg.h>
/*
* Buffers aligned to IO_SCSI_DMA_ALIGNMENT (both start and end addresses) are
* guaranteed to be legal.
*/
#define IO_SCSI_DMA_ALIGNMENT 64
/*
* Argument to executeRequest:buffer:client method.
*/
typedef struct {
/*** inputs ***/
unsigned char target; /* SCSI target ID */
unsigned char lun; /* logical unit */
cdb_t cdb; /* command descriptor block -
* one of three formats */
BOOL read; /* expected DMA direction
* (YES if read) */
int maxTransfer; /* maximum number of bytes to
* transfer */
int timeoutLength; /* I/O timeout in seconds */
unsigned disconnect:1; /* OK to disconnect */
unsigned pad:31;
/*** outputs ***/
sc_status_t driverStatus; /* driver status */
unsigned char scsiStatus; /* SCSI status byte */
int bytesTransferred; /* actual number of bytes
* transferred by DMA */
ns_time_t totalTime; /* total execution time */
ns_time_t latentTime; /* disconnect time */
esense_reply_t senseData; /* extended sense if
* driverStatus = SR_IOST_CHKSV
*/
} IOSCSIRequest;
/*
* Exported protocol for SCSIController object.
*/
@protocol IOSCSIControllerExported
/*
* Attempt to reserve specified target and lun for calling device. Returns
* non-zero if device already reserved.
*/
- (int)reserveTarget : (unsigned char)target
lun : (unsigned char)lun
forOwner : owner;
- (void)releaseTarget : (unsigned char)target
lun : (unsigned char)lun
forOwner : owner;
/*
* Standard I/O methods.
*
* executeRequest requires buffers aligned to IO_SCSI_DMA_ALIGNMENT.
*/
- (sc_status_t) executeRequest : (IOSCSIRequest *)scsiReq
buffer : (void *)buffer /* data destination */
client : (vm_task_t)client;
- (sc_status_t) resetSCSIBus; /* reset the bus */
/*
* Convert an sc_status_t to an IOReturn.
*/
- (IOReturn)returnFromScStatus : (sc_status_t)sc_status;
/*
* Determine maximum DMA which can be peformed in a single call to
* executeRequest:buffer:client:.
*/
- (unsigned)maxTransfer;
/*
* Return required DMA alignment for current architecture.
*/
- (void)getDMAAlignment : (IODMAAlignment *)alignment;
/*
* Allocate some well-aligned memory.
* Usage:
*
* void *freePtr;
* void *alignedPtr;
* unsigned freeCnt;
*
* alignedPtr = [controllerId allocateBufferOfLength:someLength
* actualStart:&freePtr
* actualLength:&freeCnt];
* ...
* when done...
*
* IOFree(freePtr, freeCnt);
*/
- (void *)allocateBufferOfLength: (unsigned)length
actualStart : (void **)actualStart
actualLength : (unsigned *)actualLength;
@end
/*
* Public IONamedValue arrays.
*/
extern IONamedValue IOScStatusStrings[];
extern IONamedValue IOSCSISenseStrings[];
extern IONamedValue IOSCSIOpcodeStrings[];