home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / os2 / gtak212b.zip / SOURCE.ZIP / TAPE / aspi.h next >
C/C++ Source or Header  |  1992-09-02  |  5KB  |  156 lines

  1. /*****************************************************************************
  2.  * $Id: aspi.h,v 1.2 1992/09/02 19:05:27 ak Exp $
  3.  *****************************************************************************
  4.  * $Log: aspi.h,v $
  5.  * Revision 1.2  1992/09/02  19:05:27  ak
  6.  * Version 2.0
  7.  * - EMX version
  8.  * - AIX version
  9.  * - SCSI-2 commands
  10.  * - ADD Driver
  11.  * - blocksize support
  12.  *
  13.  * Revision 1.1.1.1  1992/01/06  20:27:18  ak
  14.  * Interface now based on ST01 and ASPI.
  15.  * AHA_DRVR no longer supported.
  16.  * Files reorganized.
  17.  *
  18.  * Revision 1.1  1992/01/06  20:27:17  ak
  19.  * Initial revision
  20.  *
  21.  *****************************************************************************/
  22.  
  23. #pragma ZTC align 1
  24. #pragma pack(1)        /* MSC */
  25.  
  26.     /* SRB command */
  27. #define SRB_Inquiry    0x00
  28. #define SRB_Device    0x01
  29. #define SRB_Command    0x02
  30. #define SRB_Abort    0x03
  31. #define SRB_Reset    0x04
  32. #define SRB_Param    0x05
  33.  
  34.     /* SRB status */
  35. #define SRB_Busy    0x00    /* SCSI request in progress */
  36. #define SRB_Done    0x01    /* SCSI request completed without error */
  37. #define SRB_Aborted    0x02    /* SCSI aborted by host */
  38. #define SRB_BadAbort    0x03    /* Unable to abort SCSI request */
  39. #define SRB_Error    0x04    /* SCSI request completed with error */
  40. #define SRB_BusyPost    0x10    /* SCSI request in progress with POST - Nokia */
  41. #define SRB_InvalidCmd    0x80    /* Invalid SCSI request */
  42. #define SRB_InvalidHA    0x81    /* Invalid Hhost adapter number */
  43. #define SRB_BadDevice    0x82    /* SCSI device not installed */
  44.  
  45.     /* SRB flags */
  46. #define SRB_Post    0x01    /* Post vector valid */
  47. #define SRB_Link    0x02    /* Link vector valid */
  48. #define SRB_SG        0x04    /* Nokia: scatter/gather */
  49.                 /* S/G: n * (4 bytes length, 4 bytes addr) */
  50.                 /* No of s/g items not limited by HA spec. */
  51. #define SRB_NoCheck    0x00    /* determined by command, not checked  */
  52. #define SRB_Read    0x08    /* target to host, length checked  */
  53. #define SRB_Write    0x10    /* host to target, length checked  */
  54. #define SRB_NoTransfer    0x18    /* no data transfer  */
  55. #define SRB_DirMask    0x18    /* bit mask */
  56.  
  57.     /* SRB host adapter status */
  58. #define SRB_NoError    0x00    /* No host adapter detected error */
  59. #define SRB_Timeout    0x11    /* Selection timeout */
  60. #define SRB_DataLength    0x12    /* Data over/underrun */
  61. #define SRB_BusFree    0x13    /* Unexpected bus free */
  62. #define SRB_BusSequence    0x14    /* Target bus sequence failure */
  63.  
  64.     /* SRB target status field */
  65. #define SRB_NoStatus    0x00    /* No target status */
  66. #define SRB_CheckStatus    0x02    /* Check status (sense data valid) */
  67. #define SRB_LUN_Busy    0x08    /* Specified LUN is busy */
  68. #define SRB_Reserved    0x18    /* Reservation conflict */
  69.  
  70. #define MaxCDBStatus    64    /* max size of CDB + status */
  71.  
  72. typedef struct SRB SRB;
  73. struct SRB {
  74.     unsigned char    cmd,                /* 00 */
  75.             status,                /* 01 */
  76.             ha_num,                /* 02 */
  77.             flags;                /* 03 */
  78.     unsigned long    res_04_07;            /* 04..07 */
  79.     union {                        /* 08 */
  80.  
  81.     /* SRB_Inquiry */
  82.         struct {
  83.             unsigned char    num_ha,        /* 08 */
  84.                     ha_target,    /* 09 */
  85.                     aspimgr_id[16],    /* 0A..19 */
  86.                     host_id[16],    /* 1A..29 */
  87.                     unique_id[16];    /* 2A..39 */
  88.         } inq;
  89.  
  90.     /* SRB_Device */
  91.         struct {
  92.             unsigned char    target,        /* 08 */
  93.                     lun,        /* 09 */
  94.                     devtype;    /* 0A */
  95.         } dev;
  96.  
  97.     /* SRB_Command */
  98.         struct {
  99.             unsigned char    target,        /* 08 */
  100.                     lun;        /* 09 */
  101.             unsigned long    data_len;    /* 0A..0D */
  102.             unsigned char    sense_len;    /* 0E */
  103.             #ifdef OS2
  104.             unsigned long    data_ptr;    /* 0F..12 */
  105.             unsigned long    link_ptr;    /* 13..16 */
  106.             #else
  107.             void _far *    data_ptr;    /* 0F..12 */
  108.             void _far *    link_ptr;    /* 13..16 */
  109.             #endif
  110.             unsigned char    cdb_len,    /* 17 */
  111.                     ha_status,    /* 18 */
  112.                     target_status;    /* 19 */
  113.             #ifdef OS2
  114.             void (_far * realpost) (unsigned, unsigned long);
  115.             unsigned short    realDS;            /* 1A..1F */
  116.             void (_far * protpost) (unsigned, unsigned long);
  117.             unsigned short    protDS;            /* 20..25 */
  118.             unsigned long    phys_addr_srb;    /* 26..29 */
  119.             #else
  120.             void    (_far *    post) (SRB *);    /* 1A..1D */
  121.             unsigned char    res_1E_29[12];    /* 1E..29 */
  122.             #endif
  123.             unsigned char    res_2A_3F[22];    /* 2A..3F */
  124.             unsigned char    cdb_st[64];    /* 40..7F CDB+status */
  125.             unsigned char    res_80_BF[64];    /* 80..BF */
  126.         } cmd;
  127.  
  128.     /* SRB_Abort */
  129.         struct {
  130.             #ifdef OS2
  131.             unsigned long    phys_addr_srb;    /* 08..0B */
  132.             #else
  133.             void _far *    srb;        /* 08..0B */
  134.             #endif
  135.         } abt;
  136.  
  137.     /* SRB_Reset */
  138.         struct {
  139.             unsigned char    target,        /* 08 */
  140.                     lun,        /* 09 */
  141.                     res_0A_17[14],    /* 0A..17 */
  142.                     ha_status,    /* 18 */
  143.                     target_status;    /* 19 */
  144.         } res;
  145.  
  146.     /* SRB_Param - unused by ASPI4OS2 */
  147.         struct {
  148.             unsigned char    unique[16];    /* 08..17 */
  149.         } par;
  150.  
  151.     } u;
  152. };
  153.  
  154. #pragma ZTC align
  155. #pragma pack()
  156.