home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / aspisrc.zip / Aspirout.h < prev    next >
C/C++ Source or Header  |  1997-05-31  |  6KB  |  145 lines

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