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

VxWorks

开发平台:

C/C++

  1. /* mb87030_1.h - Fujitsu MB87030 SPC (SCSI Protocol Controller) header */
  2. /* Copyright 1984-1994 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01n,08nov94,jds  renamed for SCSI1 compatability
  7. 01m,24sep92,ccc  changed spcShow() to return STATUS.
  8. 01l,22sep92,rrr  added support for c++
  9. 01k,26may92,rrr  the tree shuffle
  10. 01j,26may92,ajm  got rid of HOST_DEC def's (new compiler)
  11.                   updated copyright
  12. 01i,04oct91,rrr  passed through the ansification filter
  13.   -fixed #else and #endif
  14.   -changed VOID to void
  15.   -changed ASMLANGUAGE to _ASMLANGUAGE
  16.   -changed copyright notice
  17. 01h,28sep91,ajm  ifdef'd HOST_DEC for compiler problem
  18. 01g,19oct90,jcc  changed SPC to MB_87030_SCSI_CTRL in ANSI function prototypes.
  19. 01f,05oct90,shl  added ANSI function prototypes.
  20.                  made #endif ANSI style.
  21.                  added copyright notice.
  22. 01e,20aug90,jcc  changed UTINY and USHORT to UINT8 and UINT16, respectively.
  23. 01d,18jul90,jcc  moved _ASMLANGUAGE conditionals to encompass entire file.
  24. 01c,12jul90,jcc  renamed MPU_DATA_PARITY_XX to SPC_DATA_PARITY_XX; added
  25.  checks for _ASMLANGUAGE around non-assembly legal code.
  26. 01b,18jan90,jcc  created MB_87030_SCSI_CTRL struct with hook into scsiLib;
  27.  replaced old register address macros with pointers.
  28. 01a,08apr89,jcc  written.
  29. */
  30. #ifndef __INCmb87030_1h
  31. #define __INCmb87030_1h
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #ifndef _ASMLANGUAGE
  36. #include "scsiLib.h"
  37. typedef struct /* MB_87030_SCSI_CTRL - Fujitsu mb87030
  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.     UINT16 defaultSelTimeOut; /* default dev. select time-out (units var.) */
  43.     int spcDataParity; /* sense of the input data parity signal */
  44.     UINT8 selectTempReg; /* value for the TEMP reg. during select */
  45.     int busFreeDelay; /* tWAIT for TCL reg. during select (00-0f) */
  46.     volatile UINT8 *pBdidReg; /* ptr bus device ID reg.*/
  47.     volatile UINT8 *pSctlReg; /* ptr control reg. */
  48.     volatile UINT8 *pScmdReg; /* ptr command reg. */
  49.     volatile UINT8 *pTmodReg; /* ptr transfer mode reg. */
  50.     volatile UINT8 *pIntsReg; /* ptr int. sense (R) / reset int. (W) reg. */
  51.     volatile UINT8 *pPsnsReg; /* ptr phase sense (R) reg. */
  52.     volatile UINT8 *pSdgcReg; /* ptr diagnostic control (W) reg. */
  53.     volatile UINT8 *pSstsReg; /* ptr status (R) reg. */
  54.     volatile UINT8 *pSerrReg; /* ptr error status (R) reg. */
  55.     volatile UINT8 *pPctlReg; /* ptr phase control reg. */
  56.     volatile UINT8 *pMbcReg; /* ptr modified byte counter (R) reg. */
  57.     volatile UINT8 *pDregReg; /* ptr data reg. */
  58.     volatile UINT8 *pTempReg; /* ptr temporary reg. */
  59.     volatile UINT8 *pTchReg; /* ptr transfer counter high byte reg. */
  60.     volatile UINT8 *pTcmReg; /* ptr transfer counter middle byte reg. */
  61.     volatile UINT8 *pTclReg; /* ptr transfer counter low byte reg. */
  62.     volatile UINT8 *pExbfReg; /* ptr external buffer reg. */
  63.     } MB_87030_SCSI_CTRL;
  64. /* SPC Parity Possibilities */
  65. #define SPC_DATA_PARITY_LOW 0
  66. #define SPC_DATA_PARITY_HIGH 1
  67. #define SPC_DATA_PARITY_VALID 2
  68. /* SPC Control Register Fields */
  69. #define SPC_SCTL_RESET_AND_DSBL ((UINT8) 0x80)    /* reset and disable */
  70. #define SPC_SCTL_CTRL_RESET     ((UINT8) 0x40)    /* control reset */
  71. #define SPC_SCTL_DIAG_MODE      ((UINT8) 0x20)    /* diagnostic mode */
  72. #define SPC_SCTL_ARBIT_ENBL     ((UINT8) 0x10)    /* arbitration enable */
  73. #define SPC_SCTL_PARITY_ENBL    ((UINT8) 0x08)    /* parity enable */
  74. #define SPC_SCTL_SELECT_ENBL    ((UINT8) 0x04)    /* select enable */
  75. #define SPC_SCTL_RESELECT_ENBL  ((UINT8) 0x02)    /* reselect enable */
  76. #define SPC_SCTL_INT_ENBL       ((UINT8) 0x01)    /* interrupt enable */
  77. /* SPC Command Register Command Codes */
  78. #define SPC_SCMD_CMD_MASK      ((UINT8) 0xe0) /* cmd field bit mask */
  79. #define SPC_SCMD_BUS_RELEASE   ((UINT8) 0x00) /* bus release command code */
  80. #define SPC_SCMD_SELECT        ((UINT8) 0x20) /* select command code */
  81. #define SPC_SCMD_RESET_ATN     ((UINT8) 0x40) /* reset ATN command code */
  82. #define SPC_SCMD_SET_ATN       ((UINT8) 0x60) /* set ATN command code */
  83. #define SPC_SCMD_XFER          ((UINT8) 0x80) /* transfer command code */
  84. #define SPC_SCMD_XFER_PAUSE    ((UINT8) 0xa0) /* transfer pause command code */
  85. #define SPC_SCMD_RESET_ACK_REQ ((UINT8) 0xc0) /* reset ACK/REQ command code */
  86. #define SPC_SCMD_SET_ACK_REQ   ((UINT8) 0xe0) /* set ACK/REQ command code */
  87. /* SPC Command Register Fields */
  88. #define SPC_SCMD_RESET_OUT      ((UINT8) 0x10) /* assert reset line */
  89. #define SPC_SCMD_INTERCEPT_XFER ((UINT8) 0x08) /* set special transfer mode */
  90. #define SPC_SCMD_PRG_XFER       ((UINT8) 0x04) /* program transfer mode */
  91. #define SPC_SCMD_TERM_MODE      ((UINT8) 0x01) /* termination mode */
  92. /* SPC Transfer Mode Register Fields */
  93. #define SPC_TMOD_SYNC_XFER       ((UINT8) 0x80) /* synchronous transfer */
  94. #define SPC_TMOD_MAX_OFFSET_MASK ((UINT8) 0x70) /* max. xfer offset bit mask */
  95. #define SPC_TMOD_MIN_PERIOD_MASK ((UINT8) 0x0c) /* min. xfer period bit mask */
  96. /* SPC Interrupt Sense & Reset Register Fields */
  97. #define SPC_INTS_SELECTED     ((UINT8) 0x80)    /* selected interrupt */
  98. #define SPC_INTS_RESELECTED   ((UINT8) 0x40)    /* reselected interrupt */
  99. #define SPC_INTS_DISCONNECT   ((UINT8) 0x20)    /* disconnect interrupt */
  100. #define SPC_INTS_COM_COMPLETE ((UINT8) 0x10)    /* command complete interrupt */
  101. #define SPC_INTS_SERVICE_REQ  ((UINT8) 0x08)    /* service required interrupt */
  102. #define SPC_INTS_TIMEOUT      ((UINT8) 0x04)    /* timeout interrupt */
  103. #define SPC_INTS_HARD_ERROR   ((UINT8) 0x02)    /* hard error interrupt */
  104. #define SPC_INTS_RESET_COND   ((UINT8) 0x01)    /* reset condition interrupt */
  105. /* SPC Phase Sense Register Fields */
  106. #define SPC_PSNS_REQ          ((UINT8) 0x80)    /* phase sense REQ line */
  107. #define SPC_PSNS_ACK          ((UINT8) 0x40)    /* phase sense ACK line */
  108. #define SPC_PSNS_ATN          ((UINT8) 0x20)    /* phase sense ATN line */
  109. #define SPC_PSNS_SEL          ((UINT8) 0x10)    /* phase sense SEL line */
  110. #define SPC_PSNS_BSY          ((UINT8) 0x08)    /* phase sense BSY line */
  111. #define SPC_PSNS_MSG          ((UINT8) 0x04)    /* phase sense MSG line */
  112. #define SPC_PSNS_C_D          ((UINT8) 0x02)    /* phase sense C/D line */
  113. #define SPC_PSNS_I_O          ((UINT8) 0x01)    /* phase sense I/O line */
  114. #define SPC_PSNS_PHASE_MASK   ((UINT8) 0x07)    /* SCSI bus phase mask */
  115. /* SPC Diag Control Register Fields */
  116. #define SPC_SDGC_DIAG_REQ     ((UINT8) 0x80)   /* diagnostic mode REQ */
  117. #define SPC_SDGC_DIAG_ACK     ((UINT8) 0x40)   /* diagnostic mode ACK */
  118. #define SPC_SDGC_DIAG_BSY     ((UINT8) 0x08)   /* diagnostic mode BSY */
  119. #define SPC_SDGC_DIAG_MSG     ((UINT8) 0x04)   /* diagnostic mode MSG */
  120. #define SPC_SDGC_DIAG_C_D     ((UINT8) 0x02)   /* diagnostic mode C/D */
  121. #define SPC_SDGC_DIAG_I_O     ((UINT8) 0x01)   /* diagnostic mode I/O */
  122. /* SPC Status Register Fields */
  123. #define SPC_SSTS_CONNECTED    ((UINT8) 0xc0)   /* connected to SCSI */
  124. #define SPC_SSTS_INITIATOR    ((UINT8) 0x80)   /* connected as initiator */
  125. #define SPC_SSTS_TARGET       ((UINT8) 0x40)   /* connected as target */
  126. #define SPC_SSTS_BUSY         ((UINT8) 0x20)   /* SPC busy */
  127. #define SPC_SSTS_XFER         ((UINT8) 0x10)   /* transfer in progress */
  128. #define SPC_SSTS_SCSI_RESET   ((UINT8) 0x08)   /* SCSI reset status */
  129. #define SPC_SSTS_TC_0         ((UINT8) 0x04)   /* transfer count = 0 */
  130. #define SPC_SSTS_DREG_FULL    ((UINT8) 0x02)   /* data register full */
  131. #define SPC_SSTS_DREG_EMPTY   ((UINT8) 0x01)   /* data register empty */
  132. /* SPC Status Register Status Codes */
  133. #define SPC_SSTS_OPER_STAT_MASK   ((UINT8) 0xf0) /* bit mask for oper. status */
  134. #define SPC_SSTS_NO_CONNECT_IDLE  ((UINT8) 0x00) /* idle, unconnected to SCSI */
  135. #define SPC_SSTS_SELECT_WAIT      ((UINT8) 0x20) /* waiting for bus free */
  136. #define SPC_SSTS_TARGET_MANUAL    ((UINT8) 0x40) /* target in manual mode */
  137. #define SPC_SSTS_RESELECT_EXEC    ((UINT8) 0x60) /* exec'ing reselect on SCSI */
  138. #define SPC_SSTS_TARGET_XFER      ((UINT8) 0x70) /* target executing transfer */
  139. #define SPC_SSTS_INITIATOR_MANUAL ((UINT8) 0x80) /* init'r in manual mode */
  140. #define SPC_SSTS_INITIATOR_WAIT   ((UINT8) 0x90) /* init'r waiting on xfer com*/
  141. #define SPC_SSTS_SELECT_EXEC      ((UINT8) 0xa0) /* executing select on SCSI */
  142. #define SPC_SSTS_INITIATOR_XFER   ((UINT8) 0xb0) /* init'r executing transfer */
  143. #define SPC_SSTS_DREG_STAT_MASK ((UINT8) 0x03) /* bit mask for dreg. status */
  144. #define SPC_SSTS_DREG_PARTIAL   ((UINT8) 0x00) /* data reg. not empty or full */
  145. #define SPC_SSTS_DREG_UNDEF     ((UINT8) 0x03) /* data reg. state undefined */
  146. /* SPC Error Status Register Fields */
  147. #define SPC_SERR_TC_PARITY    ((UINT8) 0x08) /* transfer counter parity error */
  148. #define SPC_SERR_PHASE_ERROR  ((UINT8) 0x04) /* SCSI phase error */
  149. #define SPC_SERR_SHORT_PERIOD ((UINT8) 0x02) /* short transfer period error */
  150. #define SPC_SERR_OFFSET_ERROR ((UINT8) 0x01) /* transfer offset error */
  151. /* SPC Error Status Register Status Codes */
  152. #define SPC_SERR_PAR_ERROR_MASK ((UINT8) 0xc0)/* bit mask yielding par. error */
  153. #define SPC_SERR_NO_PAR_ERROR   ((UINT8) 0x00)/* no parity error detected */
  154. #define SPC_SERR_PAR_ERROR_OUT  ((UINT8) 0x40)/* parity error on output */
  155. #define SPC_SERR_PAR_ERROR_IN   ((UINT8) 0xc0)/* parity error on input */
  156. /* SPC Phase Control Register Fields */
  157. #define SPC_PCTL_BF_INT_ENBL  ((UINT8) 0x80)    /* bus free interrupt enable */
  158. /* SPC Phase Control Register Options */
  159. #define SPC_PCTL_PHASE_MASK   ((UINT8) 0x07)  /* bit mask yielding xfer phase */
  160. #define SPC_PCTL_DATA_OUT     ((UINT8) 0x00)  /* data out phase */
  161. #define SPC_PCTL_SELECT       ((UINT8) 0x00)  /* select phase */
  162. #define SPC_PCTL_DATA_IN      ((UINT8) 0x01)  /* data in phase */
  163. #define SPC_PCTL_RESELECT     ((UINT8) 0x01)  /* reselect phase */
  164. #define SPC_PCTL_COMMAND      ((UINT8) 0x02)  /* command phase */
  165. #define SPC_PCTL_STATUS       ((UINT8) 0x03)  /* status phase */
  166. #define SPC_PCTL_UNUSED_0     ((UINT8) 0x04)  /* unused */
  167. #define SPC_PCTL_UNUSED_1     ((UINT8) 0x05)  /* unused */
  168. #define SPC_PCTL_MESS_OUT     ((UINT8) 0x06)  /* message out phase */
  169. #define SPC_PCTL_MESS_IN      ((UINT8) 0x07)  /* message in phase */
  170. /* SPC Bit Manipulation Mneumonics */
  171. #define SPC_PRESERVE_BIT        (-1)    /* preserve the bit's current state */
  172. #define SPC_PRESERVE_FIELD      (0xff)  /* preserve the bit field's state */
  173. #define SPC_RESET_BIT           (0)     /* reset the bit */
  174. #define SPC_SET_BIT             (1)     /* set the bit */
  175. /* function declarations */
  176. #if defined(__STDC__) || defined(__cplusplus)
  177. IMPORT    MB_87030_SCSI_CTRL * mb87030CtrlCreate (UINT8 *spcBaseAdrs,
  178.   int regOffset,
  179.   UINT clkPeriod,
  180.   int spcDataParity,
  181.   FUNCPTR spcDmaBytesIn,
  182.   FUNCPTR spcDmaBytesOut);
  183. IMPORT    STATUS       mb87030CtrlInit (MB_87030_SCSI_CTRL *pSpc,
  184. int scsiCtrlBusId,
  185. UINT defaultSelTimeOut,
  186. int scsiPriority);
  187. IMPORT    STATUS       spcShow (SCSI_CTRL *pSpc);
  188. IMPORT    void         spcIntr (MB_87030_SCSI_CTRL *pSpc);
  189. #else
  190. IMPORT    MB_87030_SCSI_CTRL * mb87030CtrlCreate ();
  191. IMPORT    STATUS       mb87030CtrlInit ();
  192. IMPORT    STATUS       spcShow ();
  193. IMPORT    void         spcIntr ();
  194. #endif /* __STDC__ */
  195. #endif /* _ASMLANGUAGE */
  196. #ifdef __cplusplus
  197. }
  198. #endif
  199. #endif /* __INCmb87030_1h */