home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / aspio02.zip / srb.h < prev    next >
C/C++ Source or Header  |  1998-06-21  |  6KB  |  249 lines

  1. /*
  2.  * $Source: R:/source/aspi/RCS/srb.h,v $
  3.  * $Revision: 1.3 $
  4.  * $Date: 1997/09/22 02:32:05 $
  5.  * $Author: vitus $
  6.  *
  7.  * Describes ASPI structures, created from DDK header with
  8.  * same name.
  9.  * Changed for ASPI Router access (buffer management).
  10.  *
  11.  * $Log: srb.h,v $
  12.  * Revision 1.3  1997/09/22 02:32:05  vitus
  13.  * modified comments
  14.  *
  15.  * Revision 1.2  1997/09/17 01:30:38  vitus
  16.  * beautified, added offset comments
  17.  *
  18.  * Revision 1.1  1997/09/08 02:01:04  vitus
  19.  * Initial revision
  20.  * ----------------------------------------
  21.  * Sample code to demonstrate use of ASPI Interface.
  22.  */
  23.  
  24. #ifndef _ASPI_H
  25. #define _ASPI_H
  26. #pragma pack(1)
  27.  
  28. #define ASPI_CMD_LIMIT    6
  29.  
  30. /*
  31.  * ASPI SRB Header
  32.  */
  33.  
  34. typedef struct _ASPI_SRBHDR {            /* ASHD */
  35.  
  36.     UCHAR    CommandCode;            /* 00: */
  37.     UCHAR    ASPIStatus;            /* 01: */
  38.     UCHAR    AdapterIndex;            /* 02: */
  39.     UCHAR    ASPIReqFlags;            /* 03: */
  40.  
  41. } ASPI_SRB_HEADER, *PASPI_SRB_HEADER;
  42.  
  43.  
  44. /*
  45.  * Command Values in ASPI_SRB_HEADER->CommandCode
  46.  */
  47.  
  48. #define ASPI_CMD_ADAPTER_INQUIRY    0x00
  49. #define ASPI_CMD_GET_DEVICE_TYPE    0x01
  50. #define ASPI_CMD_EXECUTE_IO        0x02
  51. #define ASPI_CMD_ABORT_IO        0x03
  52. #define ASPI_CMD_RESET_DEVICE        0x04
  53. #define ASPI_CMD_SET_ADAPTER_PARMS    0x05
  54.  
  55. /*
  56.  * ASPI Status Values in ASPI_SRB_HEADER->ASPIStatus
  57.  */
  58.  
  59. #define ASPI_STATUS_IN_PROGRESS        0x00
  60. #define ASPI_STATUS_NO_ERROR        0x01
  61. #define ASPI_STATUS_ABORTED        0x02
  62. #define ASPI_STATUS_ERROR        0x04
  63. #define ASPI_STATUS_INVALID_COMMAND     0x80
  64. #define ASPI_STATUS_INVALID_ADAPTER    0x81
  65. #define ASPI_STATUS_INVALID_TARGET    0x82
  66.  
  67. /*
  68.  * ASPI Flags in ASPI_SRB_HEADER->ASPIReqFlags
  69.  */
  70.  
  71. #define ASPI_REQFLAG_POST_ENABLE    0x01
  72. #define ASPI_REQFLAG_LINKED_SRB        0x02
  73. #define ASPI_REQFLAG_RESIDUAL        0x04
  74.  
  75. #define ASPI_REQFLAG_DIRECTION_BITS    0x18
  76. #define ASPI_REQFLAG_DIR_TO_HOST    0x08
  77. #define ASPI_REQFLAG_DIR_TO_TARGET    0x10
  78. #define ASPI_REQFLAG_DIR_NO_DATA_XFER    0x18
  79.  
  80. #define ASPI_REQFLAG_SG_ENABLE        0x20
  81.  
  82.  
  83.  
  84.  
  85. /*
  86.  * ASPI ADAPTER INQUIRY SRB            (for ASPI_CMD_ADAPTER_INQUIRY)
  87.  */
  88.  
  89. typedef struct _ASPI_SRB_ADAPTER_INQUIRY {    /* ASAI */
  90.  
  91.     ASPI_SRB_HEADER    SRBHdr;
  92.     UCHAR        Reserved_1[4];
  93.     UCHAR        AdapterCount;
  94.     UCHAR        AdapterTargetID;
  95.     UCHAR        ManagerName[16];
  96.     UCHAR        AdapterName[16];
  97.     UCHAR        AdapterParms[16];
  98.  
  99. /*
  100.  * New fields for an EXTENDED adapter inquiry                            
  101.  */
  102.  
  103.     USHORT        AdapterFeatures;                   
  104.     USHORT        MaximumSGList;                     
  105.     ULONG        MaximumCDBTransfer;                
  106.  
  107. } ASPI_SRB_INQUIRY, *NPASPI_SRB_INQUIRY, FAR *PASPI_SRB_INQUIRY;
  108.  
  109.  
  110. /*
  111.  * Number of bytes in the extended fields -         
  112.  */
  113.  
  114. #define MAX_EXTENDED_COUNT    0x08                            
  115.  
  116. /*
  117.  * Features in ASPI_SRB_ADAPTER_INQUIRY->AdapterFeatures
  118.  */
  119.  
  120. #define ASPI_SCATTER_GATHER    0x01
  121. #define ASPI_RESIDUAL_BYTE    0x02
  122.  
  123.  
  124.  
  125.  
  126. /*
  127.  * ASPI GET DEVICE TYPE SRB        (for ASPI_CMD_DEVICE_TYPE)
  128.  */
  129.  
  130. typedef struct _ASPI_SRB_DEVICE_TYPE {        /* ASDT */
  131.  
  132.     ASPI_SRB_HEADER    SRBHdr;
  133.     UCHAR        Reserved_1[4];
  134.     UCHAR        DeviceTargetID;
  135.     UCHAR        DeviceTargetLUN;
  136.     UCHAR        DeviceType;
  137.  
  138. } ASPI_SRB_DEVICE_TYPE, *PASPI_SRB_DEVICE_TYPE;
  139.  
  140.  
  141.  
  142.  
  143. /*
  144.  * ASPI EXECUTE IO SRB            (for ASPI_CMD_EXECUTE_IO)
  145.  */
  146.  
  147. typedef struct _ASPI_SRB_EXECUTE_IO {        /* ASEI */
  148.  
  149.     ASPI_SRB_HEADER    SRBHdr;
  150.     UCHAR        Reserved_0[2];        /* 04: S/G list */
  151.     UCHAR        Reserved_1[2];        /* 06: */
  152.     UCHAR        DeviceTargetID;        /* 08: */
  153.     UCHAR        DeviceTargetLUN;    /* 09: */
  154.     ULONG        DataXferLen;        /* 0A: */
  155.     UCHAR        SenseDataLen;        /* 0E: */
  156.     void *        pDataBuffer;        /* 0F: */
  157.     void *        pNxtSRB;        /* 13: don't use it! */
  158.     UCHAR        CDBLen;            /* 17: */
  159.     UCHAR        HostStatus;        /* 18: */
  160.     UCHAR        TargetStatus;        /* 19: */
  161.     ULONG        RM_PostAddress;        /* 1A: not called! */
  162.     USHORT        RM_DataSeg;        /* 1E: */
  163.     ULONG        PM_PostAddress;        /* 20: not called! */
  164.     USHORT        PM_DataSeg;        /* 24: */
  165.     ULONG        ppSRB;            /* 26: */
  166.     UCHAR        ASPIWorkSpace[22];    /* 2A: */
  167.     UCHAR        CDB[1];            /* 40: */
  168.  
  169. } ASPI_SRB_EXECUTE_IO, *NPASPI_SRB_EXECUTE_IO, FAR *PASPI_SRB_EXECUTE_IO;
  170.  
  171.  
  172. /*
  173.  * Status returned in ASPI_SRB_EXECUTE_IO->HostStatus
  174.  */
  175.  
  176. #define ASPI_HSTATUS_NO_ERROR        0x00
  177. #define ASPI_HSTATUS_SELECTION_TIMEOUT    0x11
  178. #define ASPI_HSTATUS_DATA_OVERRUN    0x12
  179. #define ASPI_HSTATUS_BUS_FREE        0x13
  180. #define ASPI_HSTATUS_BUS_PHASE_ERROR    0x14
  181. #define ASPI_HSTATUS_BAD_SGLIST        0x1A              
  182.  
  183. /*
  184.  * Status returned in ASPI_SRB_EXECUTE_IO->TargetStatus
  185.  */
  186.  
  187. #define ASPI_TSTATUS_NO_ERROR        0x00
  188. #define ASPI_TSTATUS_CHECK_CONDITION    0x02
  189. #define ASPI_TSTATUS_BUSY        0x08
  190. #define ASPI_TSTATUS_RESERV_CONFLICT    0x18
  191.  
  192.  
  193.  
  194.  
  195. /*
  196.  * ASPI ABORT IO SRB            (for ASPI_CMD_ABORT_IO)
  197.  */
  198.  
  199. typedef struct _ASPI_SRB_ABORT_IO {        /* ASAB */
  200.  
  201.     ASPI_SRB_HEADER    SRBHdr;
  202.     UCHAR        Reserved_1[4];
  203.     UCHAR        ppSRB;
  204.  
  205. } ASPI_SRB_ABORT_IO, *NPASPI_SRB_ABORT_IO, FAR *PASPI_SRB_ABORT_IO;
  206.  
  207.  
  208.  
  209.  
  210. /*
  211.  * ASPI RESET DEVICE SRB        (for ASPI_RESET_DEVICE)
  212.  */
  213.  
  214. typedef struct _ASPI_SRB_RESET_DEVICE {        /* ASRD */
  215.  
  216.     ASPI_SRB_HEADER    SRBHdr;
  217.     UCHAR        Reserved_1[4];
  218.     UCHAR        DeviceTargetID;
  219.     UCHAR        DeviceTargetLUN;
  220.     UCHAR        Reserved_2[14];
  221.     UCHAR        HostStatus;
  222.     UCHAR        TargetStatus;
  223.     ULONG        RM_PostAddress;        /* not called! */
  224.     USHORT        RM_DataSeg;
  225.     ULONG        PM_PostAddress;        /* not called! */
  226.     USHORT        PM_DataSeg;
  227.     UCHAR        ASPIWorkSpace[22];
  228.  
  229. } ASPI_SRB_RESET_DEVICE, *PASPI_SRB_RESET_DEVICE;
  230.  
  231.  
  232.  
  233.  
  234. /*
  235.  * ASPI SET HOST ADAPTER PARAMETERS    (for ASPI_CMD_SET_ADAPTER_PARMS)
  236.  */
  237.  
  238. typedef struct _ASPI_SRB_ADAPTER_PARMS {    /* ASAP */
  239.  
  240.     ASPI_SRB_HEADER    SRBHdr;
  241.     UCHAR        Reserved_1[4];
  242.     UCHAR        AdapterParms[16];
  243.  
  244. }  ASPI_SRB_ADAPTER_PARMS, *PASPI_SRB_ADAPTER_PARMS;
  245.  
  246.  
  247. #pragma pack()
  248. #endif /* !def _ASPI_H */
  249.