ncr810Script.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:9k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* ncr810Script.h - NCR 810 Script definition header */
  2. /* Copyright 1984-1994 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01c,28jan99,dat  Fixed HTH timeout, part of SPR 22597
  7. 01b,21nov96,dds  Added compiler directives to turn optmization off when
  8.                  compiling the ncr810Shared data structure.
  9. 01a,25may95,jds  Created script and driver header; adapted from ncr710 driver
  10. */
  11. #ifndef __INCncr810Scripth
  12. #define __INCncr810Scripth
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #ifndef _ASMLANGUAGE
  17. #ifndef NCR_COMPILE
  18. /*
  19.  *  Entry points defined by PROCs in the script.
  20.  */
  21. extern ULONG ncr810Wait[]; /* wait for re-select or host cmd   */
  22. extern ULONG ncr810InitStart[]; /* start new initiator thread       */
  23. extern ULONG ncr810InitContinue[]; /* continue an initiator thread     */
  24. extern ULONG ncr810TgtDisconnect[]; /* disconnect from SCSI bus         */
  25. #if CPU_FAMILY==I960
  26. #pragma align 1                 /* tell gcc960 not to optimize alignments */
  27. #endif  /* CPU_FAMILY==I960 */
  28. /*
  29.  *  Structure giving parameters for block moves using the NCR 810's
  30.  *  indirect addressing ("MOVE FROM") capability.
  31.  */
  32. typedef struct moveParams
  33.     {
  34.     ULONG  size; /* # bytes to move to/from SCSI */
  35.     UINT8 *addr; /* where in memory they go/come */
  36.     } MOVE_PARAMS;
  37. /*
  38.  *  Shared structure defining all information about a SCSI nexus which has
  39.  *  to be visible to the script.  Note that this structure must not be
  40.  *  changed without corresponding changes to the OFFSET_* definitions below.
  41.  *
  42.  *  IMPORTANT NOTE: Every element in this structure _must_ be aligned on
  43.  *  a 4-byte boundary, otherwise the script will fail (illegal instruction).
  44.  */
  45. typedef struct ncr810Shared
  46.     {
  47.     ULONG       device; /* target bus ID, sync xfer params */
  48.     MOVE_PARAMS command; /* command bytes sent to target    */
  49.     MOVE_PARAMS data; /* data bytes to/from target       */
  50.     MOVE_PARAMS status; /* command status byte from target */
  51.     MOVE_PARAMS identOut; /* outgoing identification msg     */
  52.     MOVE_PARAMS identIn; /* incoming identification msg     */
  53.     MOVE_PARAMS msgOut; /* message bytes sent to target    */
  54.     MOVE_PARAMS msgIn; /* message bytes recvd from target */
  55.     MOVE_PARAMS msgInSecond; /* second byte of multi-byte msg   */
  56.     MOVE_PARAMS msgInRest; /* remainder of multi-byte message */
  57.     } NCR810_SHARED;
  58. #if CPU_FAMILY==I960
  59. #pragma align 0                 /* tell gcc960 not to optimize alignments */
  60. #endif  /* CPU_FAMILY==I960 */
  61. #endif /* NCR_COMPILE */
  62. /*
  63.  *  The following offsets are used in the script.  They _MUST_ be kept in
  64.  *  sync with the definition of the NCR810_NEXUS structure above.
  65.  */
  66. #define SIZEOF_ULONG         4
  67. #define SIZEOF_MOVE_PARAMS   8
  68. #define OFFSET_DEVICE      0
  69. #define OFFSET_CMD        (OFFSET_DEVICE          + SIZEOF_ULONG)
  70. #define OFFSET_DATA       (OFFSET_CMD             + SIZEOF_MOVE_PARAMS)
  71. #define OFFSET_STATUS      (OFFSET_DATA            + SIZEOF_MOVE_PARAMS)
  72. #define OFFSET_IDENT_OUT     (OFFSET_STATUS          + SIZEOF_MOVE_PARAMS)
  73. #define OFFSET_IDENT_IN     (OFFSET_IDENT_OUT       + SIZEOF_MOVE_PARAMS)
  74. #define OFFSET_MSG_OUT      (OFFSET_IDENT_IN        + SIZEOF_MOVE_PARAMS)
  75. #define OFFSET_MSG_IN      (OFFSET_MSG_OUT         + SIZEOF_MOVE_PARAMS)
  76. #define OFFSET_MSG_IN_SECOND (OFFSET_MSG_IN          + SIZEOF_MOVE_PARAMS)
  77. #define OFFSET_MSG_IN_REST (OFFSET_MSG_IN_SECOND   + SIZEOF_MOVE_PARAMS)
  78. /*
  79.  *  Scratch registers used for data transfer to host
  80.  *
  81.  */
  82. #define HOST_FLAGS          scratcha0 /* host <-> SIOP: flags - see below  */
  83. #define MSG_OUT_STATE     scratcha1 /* host <-> SIOP: pending,sent,none  */
  84. #define MSG_IN_STATE     scratcha2 /* host <-> SIOP: pending,sent,none  */
  85. #define TARGET_BUS_ID     scratcha3 /* host <-  SIOP: bus IDs asserted   */
  86. #define CURRENT_PHASE     scratcha3   /* host <-  SIOP: phase in progress  */
  87. /* Bitmasks for HOST_FLAGS */
  88. #define FLAGS_IDENTIFY     0x01 /* assert ATN on select, to IDENTIFY */
  89. /*
  90.  *  These definitions provide meaningful aliases for use in "ncr810Lib.c".
  91.  *  I don't like #defining names of structure members, but it's better than
  92.  *  having "scratch0" and so forth all over the place ...  Be careful of
  93.  *  clashes with ordinary variable names.
  94.  */
  95. #define nHostFlags        scratcha0 /* (r/w) flag bits as defined above  */
  96. #define nMsgOutState     scratcha1 /* (r/w) state of message out buffer */
  97. #define nMsgInState      scratcha2 /* (r/w) state of message in  buffer */
  98. #define nBusIdBits       scratcha3 /* (r-o) bus ID bits set on reselect */
  99. #define nBusPhase         scratcha3 /* (r-o) most recent phase; mismatch */
  100. /*
  101.  *  SCSI phases - defined here to avoid including "scsiLib.h".  Must match !
  102.  */
  103. #define PHASE_NONE         0xff /* no info transfer pending */
  104. #define PHASE_DATA_OUT         0 /* data out (to target)     */
  105. #define PHASE_DATA_IN          1 /* data in (from target)    */
  106. #define PHASE_COMMAND         2 /* command (to target)      */
  107. #define PHASE_STATUS          3 /* status (from target)     */
  108. #define PHASE_MSG_OUT          6 /* message out (to target)  */
  109. #define PHASE_MSG_IN           7 /* message in (from target) */
  110. /*
  111.  *  SCSI messages - defined here to avoid including "scsiLib.h".  Must match !
  112.  */
  113. #define M_CMD_COMPLETE          0x00 /* command complete msg. */
  114. #define M_EXT_MSG               0x01 /* extended message msg. */
  115. #define M_DISCONNECT            0x04 /* disconnect msg.       */
  116. #define M_ABORT                 0x06 /* abort msg.            */
  117. #define M_NO_OP                 0x08 /* no operation msg.     */
  118. #define M_ABORT_TAG             0x0d /* abort tag msg.        */
  119. /*
  120.  *  SCSI message in status - must match SCSI_MSG_IN_STATE enum in "scsiLib.h"
  121.  */
  122. #define M_IN_NONE        0 /* no message in in progress     */
  123. #define M_IN_SECOND_BYTE     1    /* next byte is second of two    */
  124. #define M_IN_EXT_MSG_LEN 2 /* next byte is ext msg length   */
  125. #define M_IN_EXT_MSG_DATA     3 /* next byte(s) are ext msg data */
  126. /*
  127.  *  SCSI message out status - must match SCSI_MSG_OUT_STATE enum in "scsiLib.h"
  128.  */
  129. #define M_OUT_NONE        0 /* no message out in progress */
  130. #define M_OUT_PENDING      1 /* message out ready to send  */
  131. #define M_OUT_SENT        2 /* message out has been sent  */
  132. /*
  133.  *  Script status interrupt codes
  134.  */
  135. #define NCR810_READY      0 /* ready to start new host command  */
  136. #define NCR810_SCRIPT_ABORTED      1 /* have aborted a running script    */
  137. #define NCR810_MESSAGE_OUT_SENT     10 /* have successfully sent a message */
  138. #define NCR810_MESSAGE_IN_RECVD     11 /* have received a complete message */
  139. #define NCR810_EXT_MESSAGE_SIZE     12 /* have read size of extended msg   */
  140. #define NCR810_NO_MSG_OUT        13 /* msg out req. with no msg pending */
  141. #define NCR810_CMD_COMPLETE     20 /* SCSI command completed           */
  142. #define NCR810_DISCONNECTED        21 /* target has disconnected          */
  143. #define NCR810_RESELECTED     22 /* have been reselected by target   */
  144. #define NCR810_SELECTED          23 /* have been selected as a target   */
  145. #define NCR810_SPURIOUS_CMD      30 /* spurious interrupt of resel wait */
  146. #define NCR810_ILLEGAL_PHASE     31 /* target requested phase 4 or 5    */
  147. #define NCR810_NO_IDENTIFY       32 /* no IDENTIFY after reselection    */
  148. /*
  149.  *  Note: the following are not generated by the script, but it seems
  150.  *  sensible to define them here for continuity.
  151.  */
  152. #define NCR810_PHASE_MISMATCH     50 /* unexpected phase change occurred  */
  153. #define NCR810_SCSI_TIMEOUT      51 /* select, reselect or xfer timeout  */
  154. #define NCR810_HANDSHAKE_TIMEOUT    54  /* handshake timeout */
  155. #define NCR810_SCSI_BUS_RESET     52 /* SCSI bus has been reset           */
  156. #define NCR810_UNEXPECTED_DISCON    53 /* target disconnected unexpectedly  */
  157. #define NCR810_SINGLE_STEP       60 /* single-step completed             */
  158. #define NCR810_FATAL_ERROR       99 /* bus error, illegal opcode, etc.   */
  159. /*
  160.  *  NCR 810 register bit definitions
  161.  *
  162.  *  Note: there are similar definitions in "ncr810.h".
  163.  */
  164. #define SBCL_SEL          0x10 /* 1 => SCSI SEL signal asserted  */
  165. #define SBCL_ATN          0x08 /* 1 => SCSI ATN signal asserted  */
  166. #define SCNTL0_TARGET_MODE   0x01 /* 1 => SIOP is in target mode    */
  167. #define SCNTL1_CONNECTED     0x10 /* 1 => SIOP is connected to SCSI */
  168. #define SIEN0_MISMATCH_ATN    0x80 /* 1 => mismatch/ATN intr enabled */
  169. #define CTEST2_SIGNAL      0x40 /* 1 => signal pending from host  */
  170. #define STIME0_HTH_MASK  0xf0 /* Handshake-to-handshake timeout mask*/
  171. #define STIME0_SEL_MASK 0x0f /* Select timeout bit-mask */
  172. #define STIME0_HTH_TIMEOUT 0xd0 /* Handshake-to-handshake timeout valu*/
  173. #define STIME0_SEL_TIMEOUT 0x0d /* Select timeout value */
  174. #endif  /* _ASMLANGUAGE */
  175. #ifdef __cplusplus
  176. }
  177. #endif
  178. #endif /* __INCncr810Scripth */