home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.1 (Developer) [x86] / NeXT Step 3.1 Intel dev.cdr.dmg / NextDeveloper / Headers / bsd / dev / SCSIGeneric.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-30  |  2.2 KB  |  96 lines

  1. /*     Copyright (c) 1992 NeXT Computer, Inc.  All rights reserved. 
  2.  *
  3.  * SCSIGeneric.h - ObjC Interface to Generic SCSI Driver.
  4.  *
  5.  * HISTORY
  6.  * 19-Aug-92    Doug Mitchell at NeXT
  7.  *      Created. 
  8.  */
  9.  
  10. #ifndef    _DRIVERKIT_SCSIGENERIC_H_
  11. #define _DRIVERKIT_SCSIGENERIC_H_
  12.  
  13. #import <driverkit/IODevice.h>
  14. #import <driverkit/return.h>
  15. #import <driverkit/scsiTypes.h>
  16.  
  17. @interface SCSIGeneric:IODevice
  18. {
  19.     unsigned char    _target;
  20.     unsigned char    _lun;
  21.     unsigned        _controllerNum;        // SCSIController unit number
  22.     unsigned    _autoSense:1,
  23.             _isReserved,
  24.             _targLunValid:1;
  25.     id        _controller;        // SCSIController to which 
  26.                         //    we're attached
  27.     id        _openLock;        // NXLock; serializes opens
  28.                         //    and closes
  29.     id        _owner;            // nil means no owner
  30. }
  31.  
  32. + (BOOL)probe : deviceDescription;
  33. + (IODeviceStyle)deviceStyle;
  34. + (Protocol **)requiredProtocols;
  35.  
  36. - (int)sgInit            : (unsigned)unitNum 
  37.                   controller : controller;
  38.  
  39. - (unsigned char)target;
  40. - (unsigned char)lun;
  41.  
  42. /*
  43.  * Acquire and release, to allow exclusive access to this device.
  44.  * -acquire returns non-zero if device in use, else marks device as in use 
  45.  * and returns zero. -release returns non-zero if device not currently
  46.  * in use by 'caller'.
  47.  */
  48. - (int)acquire            : caller;
  49. - (int)release            : caller;
  50.  
  51. /* 
  52.  * ioctl equivalents.
  53.  */
  54.  
  55. /*
  56.  * Set target and lun. If isRoot is true, this will succeed even if specified
  57.  * target/lun are currently reserved.
  58.  */
  59. - (IOReturn)setTarget        : (unsigned char)target
  60.                   lun:(unsigned char)lun
  61.                   isRoot:(BOOL)isRoot;
  62.  
  63. /*
  64.  * Set controller number.
  65.  */
  66. - (IOReturn)setController       : (unsigned)controllerNum;
  67.  
  68. /*
  69.  * Enable/disable 'autosense' mechanism.
  70.  */
  71. - (IOReturn)enableAutoSense;
  72. - (IOReturn)disableAutoSense;
  73.  
  74. /*
  75.  * Execute CDB. *sense will contain sense data if autosense is enabled
  76.  * and command resulted in Check status.
  77.  */
  78. - (sc_status_t)executeRequest    : (IOSCSIRequest *)scsiReq
  79.                      buffer:(void *)buffer /* data destination */
  80.                    client:(vm_task_t)client
  81.                    senseBuf:(esense_reply_t *)senseBuf;
  82.               
  83. /*
  84.  * Reset SCSI bus. We can't authorize this; caller should ensure that 
  85.  * client is root!
  86.  */
  87. - (sc_status_t) resetSCSIBus;    
  88.  
  89. - controller;
  90.  
  91. @end
  92.  
  93. #endif    _DRIVERKIT_SCSIGENERIC_H_
  94.  
  95.  
  96.