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

VxWorks

开发平台:

C/C++

  1. /* wd33c93_1.h - Western Digital WD33C93 SBIC (SCSI-Bus Interface Ctrl) header
  2. */
  3. /* Copyright 1984-1994 Wind River Systems, Inc. */
  4. /*
  5. modification history
  6. --------------------
  7. 01o,10oct94,jds  fixed for SCSI1 and SCSI2 compatability
  8. 01n,22sep92,rrr  added support for c++
  9. 01m,22jul92,wmd  added definition of WDREG.
  10. 01l,03jun92,ccc  added control register bits.
  11. 01k,26may92,rrr  the tree shuffle
  12. 01j,26may92,ajm  got rid of HOST_DEC def's (new compiler)
  13. 01i,21apr92,ccc  added sbicXferCountSet() declaration.
  14. 01h,04oct91,rrr  passed through the ansification filter
  15.   -fixed #else and #endif
  16.   -changed VOID to void
  17.   -changed ASMLANGUAGE to _ASMLANGUAGE
  18.   -changed copyright notice
  19. 01g,28sep91,ajm  ifdef'd HOST_DEC for compiler problem
  20. 01f,24oct90,dnw  declarations for void routines.
  21. 01e,19oct90,jcc  changed SBIC to WD_33C93_SCSI_CTRL in ANSI function prototypes;
  22.  removed unused macros.
  23. 01d,05oct90,shl  added ANSI function prototypes.
  24.                  made #endif ANSI style.
  25.                  added copyright notice.
  26. 01c,20aug90,jcc  changed UTINY to UINT8.
  27. 01b,18jul90,jcc  moved _ASMLANGUAGE conditionals to encompass entire file.
  28. 01a,27feb90,jcc  written based on old version from EDI
  29. */
  30. #ifndef __INCwd33c93_1h
  31. #define __INCwd33c93_1h
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #ifndef _ASMLANGUAGE
  36. #include "scsiLib.h"
  37. typedef struct                  /* WD_33C93_SCSI_CTRL - Western Digital wd33c93
  38.                                    SCSI controller info */
  39.     {
  40.     SCSI_CTRL scsiCtrl;         /* generic SCSI controller info */
  41.     SCSI_PHYS_DEV *pDevToSelect;/* device to select at intr. level or NULL */
  42.     int   devType;              /* type of device (see define's below) */
  43.     FUNCPTR sbicScsiReset; /* function to perform RESET on SCSI bus */
  44.     UINT8 scsiStatusCode; /* status code of last interrupt */
  45.     UINT8 defaultSelTimeOut; /* default dev. select time-out (units var.) */
  46.     volatile UINT8 *pAdrsReg; /* ptr address reg.*/
  47.     volatile UINT8 *pAuxStatReg;/* ptr aux. status reg.*/
  48.     volatile UINT8 *pRegFile; /* ptr register file */
  49.     } WD_33C93_SCSI_CTRL;
  50. typedef struct wd33c93functbl
  51.     {
  52.     FUNCPTR sbicCommand;
  53.     FUNCPTR sbicIntr;
  54.     FUNCPTR sbicRegRead;
  55.     FUNCPTR sbicRegWrite;
  56.     FUNCPTR sbicXferCountGet;
  57.     FUNCPTR sbicXferCountSet;
  58.     FUNCPTR wd33c93CtrlInit;
  59.     FUNCPTR wd33c93Show;
  60.     } SCSIDRV_FUNC_TBL;
  61. /* SBIC device type */
  62. #define SBIC_WD33C93 0
  63. #define SBIC_WD33C93A 1
  64. /* SBIC command set */
  65. #define SBIC_CMD_RESET ((UINT8) 0x00)
  66. #define SBIC_CMD_ABORT ((UINT8) 0x01)
  67. #define SBIC_CMD_SET_ATN ((UINT8) 0x02)
  68. #define SBIC_CMD_NEG_ACK ((UINT8) 0x03)
  69. #define SBIC_CMD_DISCONNECT ((UINT8) 0x04)
  70. #define SBIC_CMD_RESELECT ((UINT8) 0x05)
  71. #define SBIC_CMD_SEL_ATN ((UINT8) 0x06)
  72. #define SBIC_CMD_SELECT ((UINT8) 0x07)
  73. #define SBIC_CMD_SEL_ATN_XFER ((UINT8) 0x08)
  74. #define SBIC_CMD_SELECT_XFER ((UINT8) 0x09)
  75. #define SBIC_CMD_RESELECT_RECV ((UINT8) 0x0a)
  76. #define SBIC_CMD_RESELECT_SEND ((UINT8) 0x0b)
  77. #define SBIC_CMD_WAIT_SEL_RCV ((UINT8) 0x0c)
  78. #define SBIC_CMD_RECV_CMD ((UINT8) 0x10)
  79. #define SBIC_CMD_RECV_DATA ((UINT8) 0x11)
  80. #define SBIC_CMD_RECV_MSG_OUT ((UINT8) 0x12)
  81. #define SBIC_CMD_RECV_INFO_OUT ((UINT8) 0x13)
  82. #define SBIC_CMD_SEND_STATUS ((UINT8) 0x14)
  83. #define SBIC_CMD_SEND_DATA ((UINT8) 0x15)
  84. #define SBIC_CMD_SEND_MSG_IN ((UINT8) 0x16)
  85. #define SBIC_CMD_SEND_INFO_IN ((UINT8) 0x17)
  86. #define SBIC_CMD_XLATE_ADDR ((UINT8) 0x18)
  87. #define SBIC_CMD_XFER_INFO ((UINT8) 0x20)
  88. #define SBIC_CMD_XFER_PAD ((UINT8) 0x21)
  89. #define SBIC_CMD_SING_BYTE_XFER ((UINT8) 0x80)
  90. /*  Status Register Codes   */
  91. #define STAT_GROUP(arg) ((arg) & 0xf0)  /* reason for interrupt */
  92. #define STAT_CODE(arg) ((arg) & 0x0f)  /* detail about reason */
  93. #define STAT_XFER(arg)       ((arg) & 0x08)  /* transfer was in progress */
  94. #define STAT_MCI_BITS ((UINT8) 0x07) /* MSG, C/D and I/O bits */
  95. #define STAT_PHASE_REQ   ((UINT8) 0x08)
  96. #define STAT_GROUP_RESET  ((UINT8) 0x00)
  97. #define STAT_GROUP_SUCCESSFUL  ((UINT8) 0x10)
  98. #define STAT_GROUP_PAUSE_ABORTED ((UINT8) 0x20)
  99. #define STAT_GROUP_TERMINATED  ((UINT8) 0x40)
  100. #define STAT_GROUP_SERVICE_REQ  ((UINT8) 0x80)
  101. #define STAT_SUCC_RESET ((UINT8) 0x00)
  102. #define STAT_SUCC_RESELECT ((UINT8) 0x10)
  103. #define STAT_SUCC_SELECT ((UINT8) 0x11)
  104. #define STAT_SUCC_SEND_RECV ((UINT8) 0x13)
  105. #define STAT_SUCC_SEND_RECV_ATN ((UINT8) 0x14)
  106. #define STAT_SUCC_XLATE_ADRS ((UINT8) 0x15)
  107. #define STAT_SUCC_SEL_XFER ((UINT8) 0x16)
  108. #define STAT_SUCC_XFER_MCI ((UINT8) 0x1f)
  109. #define STAT_PAUSE_MSG_IN ((UINT8) 0x20)
  110. #define STAT_ABORT_SELX_SAVP    ((UINT8) 0x21) /* SEL/Xfer Aborted; Save Ptrs */
  111. #define STAT_ABORT_SELECT ((UINT8) 0x22) /* SELECT Aborted */
  112. #define STAT_ABORT_RESELECT ((UINT8) 0x22) /* RESELECT Aborted */
  113. #define STAT_ABORT_RECV ((UINT8) 0x23) /* ReCeiVe Aborted; No ATN */
  114. #define STAT_ABORT_SEND ((UINT8) 0x23) /* SeND Aborted; No ATN */
  115. #define STAT_ABORT_RECV_ATN ((UINT8) 0x24) /* ReCeiVe Aborted; w/ATN */
  116. #define STAT_ABORT_SEND_ATN ((UINT8) 0x24) /* SeND Aborted; w/ATN */
  117. #define STAT_ABORT_XFER_MCI ((UINT8) 0x2f) /* Xfer Aborted; new MCI rqst */
  118. #define STAT_TERM_INVALID_CMD ((UINT8) 0x40) /* Invalid Command */
  119. #define STAT_TERM_UNEXP_DISCON ((UINT8) 0x41) /* Unexpected Disconnect */
  120. #define STAT_TERM_TIMEOUT ((UINT8) 0x42) /* Selection Timeout */
  121. #define STAT_TERM_PAR_ERR ((UINT8) 0x43) /* Parity Error; No ATN */
  122. #define STAT_TERM_PAR_ERR_ATN ((UINT8) 0x44) /* Parity Error; w/ATN */
  123. #define STAT_TERM_ADRS_ERR ((UINT8) 0x45) /* Address exceeds disk bounds */
  124. #define STAT_TERM_BAD_RESEL ((UINT8) 0x46) /* Wrong target reselected */
  125. #define STAT_TERM_BAD_BYTE ((UINT8) 0x47) /* Incorrect Message Byte rcvd */
  126. #define STAT_TERM_UNX_PHASE   ((UINT8) 0x4f) /* Unexpected MCI (new phase) */
  127. #define STAT_SERV_REQ_RESELECT ((UINT8) 0x80) /* Reselected */
  128. #define STAT_SERV_REQ_SEL ((UINT8) 0x82) /* Selected; No ATN */
  129. #define STAT_SERV_REQ_SEL_ATN ((UINT8) 0x83) /* Selected; w/ATN */
  130. #define STAT_SERV_REQ_ATN ((UINT8) 0x84) /* ATN asserted */
  131. #define STAT_SERV_REQ_DISCON ((UINT8) 0x85) /* Disconnect */
  132. #define STAT_SERV_REQ_ASSERTED ((UINT8) 0x8f) /* Request -- MCI gives reason */
  133. #define AUX_STAT_REG            (0x00)
  134. #define ADDRESS_REG             (0x00)
  135. #define GENERIC_REG             (0x01)
  136. #define SBIC_REG_OWN_ID ((UINT8) 0x00)
  137. #define SBIC_REG_CONTROL ((UINT8) 0x01)
  138. #define SBIC_REG_TO_PERIOD ((UINT8) 0x02)
  139. #define SBIC_REG_CDB_1 ((UINT8) 0x03)
  140. #define SBIC_REG_CDB_2 ((UINT8) 0x04)
  141. #define SBIC_REG_TOT_CLY_MSB ((UINT8) 0x05)
  142. #define SBIC_REG_TOT_CLY_LSB ((UINT8) 0x06)
  143. #define SBIC_REG_LOG_ADR_MSB ((UINT8) 0x07)
  144. #define SBIC_REG_LOG_ADR_2SB ((UINT8) 0x08)
  145. #define SBIC_REG_LOG_ADR_3SB ((UINT8) 0x09)
  146. #define SBIC_REG_LOG_ADR_LSB ((UINT8) 0x0a)
  147. #define SBIC_REG_SECTOR_NUM ((UINT8) 0x0b)
  148. #define SBIC_REG_HEAD_NUM ((UINT8) 0x0c)
  149. #define SBIC_REG_CYL_NUM_MSB ((UINT8) 0x0d)
  150. #define SBIC_REG_CYL_NUM_LSB ((UINT8) 0x0e)
  151. #define SBIC_REG_TARGET_LUN ((UINT8) 0x0f)
  152. #define SBIC_REG_TARGET_STAT ((UINT8) 0x0f)
  153. #define SBIC_REG_COMMAND_PHASE ((UINT8) 0x10)
  154. #define SBIC_REG_SYNC_XFER ((UINT8) 0x11)
  155. #define SBIC_REG_XFER_COUNT_MSB ((UINT8) 0x12)
  156. #define SBIC_REG_XFER_COUNT_2SB ((UINT8) 0x13)
  157. #define SBIC_REG_XFER_COUNT_LSB ((UINT8) 0x14)
  158. #define SBIC_REG_DEST_ID ((UINT8) 0x15)
  159. #define SBIC_REG_SOURCE_ID ((UINT8) 0x16)
  160. #define SBIC_REG_SCSI_STATUS ((UINT8) 0x17)
  161. #define SBIC_REG_COMMAND ((UINT8) 0x18)
  162. #define SBIC_REG_DATA ((UINT8) 0x19)
  163. #define SBIC_REG_PADa ((UINT8) 0x1a)
  164. #define SBIC_REG_PADb ((UINT8) 0x1b)
  165. #define SBIC_REG_PADc ((UINT8) 0x1c)
  166. #define SBIC_REG_PADd ((UINT8) 0x1d)
  167. #define SBIC_REG_PADe ((UINT8) 0x1e)
  168. #define SBIC_REG_AUX_STATUS ((UINT8) 0x1f)
  169. /* auxiliary status register bits */
  170. #define SBIC_AUX_STAT_INT_PEND   ((UINT8) 0x80) /* interrupt pending bit */
  171. #define SBIC_AUX_STAT_LCI   ((UINT8) 0x40) /* last commmand ignored bit */
  172. #define SBIC_AUX_STAT_BUSY   ((UINT8) 0x20) /* busy bit */
  173. #define SBIC_AUX_STAT_CMD_IN_PROG ((UINT8) 0x10) /* command in progress bit */
  174. #define SBIC_AUX_STAT_PAR_ERROR   ((UINT8) 0x02) /* parity erro bit */
  175. #define SBIC_AUX_STAT_DBUF_READY  ((UINT8) 0x01) /* data buffer ready bit */
  176. /* control register bits */
  177. #define SBIC_CTRL_HALT_SPE ((UINT8) 0x01) /* halt on SCSI parity error */
  178. #define SBIC_CTRL_HALT_ATN ((UINT8) 0x02) /* halt on attention */
  179. #define SBIC_CTRL_INTM_DIS ((UINT8) 0x04) /* intermediate disconnect */
  180. #define SBIC_CTRL_END_DIS_INT ((UINT8) 0x08) /* ending disconnect inter */
  181. #define SBIC_CTRL_HALT_HPE ((UINT8) 0x10) /* halt on host parity error */
  182. #define SBIC_CTRL_DMA_POLLED ((UINT8) 0x00) /* polled i/o; on DMA */
  183. #define SBIC_CTRL_DMA_BURST ((UINT8) 0x20) /* burst mode; demand mode */
  184. #define SBIC_CTRL_DMA_WDBUS ((UINT8) 0x40) /* wd bus mode */
  185. #define SBIC_CTRL_DMA_BYTE ((UINT8) 0x80) /* regular DMA mode */
  186. /* frequency select codes (wd33c93a only) */
  187. #define SBIC_FREQ_SELECT_LOW 0x00 /*  8 - 10 MHz clock */
  188. #define SBIC_FREQ_SELECT_MID 0x40 /* 12 - 15 MHz clock */
  189. #define SBIC_FREQ_SELECT_HIGH 0x80 /*      16 MHz clock */
  190. /* variable declarations */
  191. extern SCSI_CTRL *pSysScsiCtrl;
  192. extern SCSIDRV_FUNC_TBL *pWd33c93IfTbl;
  193. /* function declarations */
  194. #if defined(__STDC__) || defined(__cplusplus)
  195. extern  void wd33c93IfTblInit ();
  196. extern  STATUS sbicProgBytesOut (SCSI_PHYS_DEV *, UINT8 *, int, int);
  197. extern  STATUS sbicProgBytesIn (SCSI_PHYS_DEV *, FAST UINT8 *, FAST int, int);
  198. extern WD_33C93_SCSI_CTRL *wd33c93CtrlCreate (UINT8 *, int, UINT, int,
  199.                                            FUNCPTR, FUNCPTR, FUNCPTR);
  200. #ifndef WD33C93_1_LOCAL_FUNCS
  201. extern STATUS wd33c93CtrlInit (WD_33C93_SCSI_CTRL *, int, UINT, int);
  202. extern STATUS sbicShow (SCSI_CTRL *);
  203. extern void sbicIntr (WD_33C93_SCSI_CTRL *);
  204. extern void sbicCommand (WD_33C93_SCSI_CTRL *, UINT8);
  205. extern void sbicRegWrite (WD_33C93_SCSI_CTRL *, UINT8, UINT8);
  206. extern STATUS sbicXferCountSet (WD_33C93_SCSI_CTRL *, UINT);
  207. #endif
  208. #else
  209. extern  void wd33c93IfTblInit ();
  210. extern  STATUS sbicProgBytesOut ();
  211. extern  STATUS sbicProgBytesIn ();
  212. extern WD_33C93_SCSI_CTRL * wd33c93CtrlCreate ();
  213. #ifndef WD33C93_1_LOCAL_FUNCS
  214. extern STATUS wd33c93CtrlInit ();
  215. extern STATUS sbicShow ();
  216. extern void sbicIntr ();
  217. extern void sbicCommand ();
  218. extern void sbicRegWrite ();
  219. extern STATUS sbicXferCountSet ();
  220. #endif
  221. #endif /* __STDC__ */
  222. #endif /* _ASMLANGUAGE */
  223. #ifdef __cplusplus
  224. }
  225. #endif
  226. #endif /* __INCwd33c93_1h */