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

VxWorks

开发平台:

C/C++

  1. /* ncr5390_1.h - NCR 53C90 Advanced SCSI Controller header file */
  2. /* Copyright 1984-1996 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01i,07may96,dds  fixed for SCSI1 & SCSI2 compatiblity.
  7. 01h,08nov94,jds  renamed for SCSI1 compatability
  8. 01g,22sep92,rrr  added support for c++
  9. 01f,27aug92,ccc  added function prototypes.
  10. 01e,26may92,rrr  the tree shuffle
  11. 01d,26may92,ajm  got rid of HOST_DEC def's (new compiler)
  12. 01c,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. 01b,28sep91,ajm  ifdef'd HOST_DEC for compiler problem
  18. 01a,16may90,trl   written
  19. */
  20. #ifndef __INCncr5390_1h
  21. #define __INCncr5390_1h
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #ifndef _ASMLANGUAGE
  26. #include "scsiLib.h"
  27. /* SCSI controller structure */
  28. typedef struct                  /* NCR_5390_SCSI_CTRL - NCR 5390
  29.                                    SCSI controller info */
  30.     {
  31.     SCSI_CTRL scsiCtrl;         /* generic SCSI controller info */
  32.     SCSI_PHYS_DEV *pDevToSelect;/* device to select at intr. level or NULL */
  33.     int   devType; /* type of device (see define's below) */
  34.     TBOOL slowCableMode; /* TRUE to select slow cable mode */
  35.     TBOOL resetReportDsbl; /* TRUE to disable SCSI bus reset reporting */
  36.     TBOOL parityTestMode; /* TRUE to enable par test mode (DO NOT USE!) */
  37.     TBOOL parityCheckEnbl; /* TRUE to enable parity checking */
  38.     UINT8 defaultSelTimeOut;    /* default dev. select time-out (units var.) */
  39.     UINT8 clkCvtFactor;     /* value of the clock conversion factor */
  40.     UINT8 savedStatReg;        /* status register from last interrupt */
  41.     UINT8 savedIntrReg;        /* interrupt register from last interrupt */
  42.     UINT8 savedStepReg;        /* sequence step register from last interrupt */
  43.     volatile UINT8 *pTclReg; /* ptr xfer count LSB reg */
  44.     volatile UINT8 *pTchReg; /* ptr xfer count MSB reg */
  45.     volatile UINT8 *pFifoReg; /* ptr FIFO reg */
  46.     volatile UINT8 *pCmdReg; /* ptr command reg */
  47.     volatile UINT8 *pStatReg; /* ptr status reg */
  48.     volatile UINT8 *pIntrReg; /* ptr interrupt reg */
  49.     volatile UINT8 *pStepReg; /* ptr sequence step reg */
  50.     volatile UINT8 *pFlgsReg; /* ptr FIFO flags reg */
  51.     volatile UINT8 *pCfg1Reg; /* ptr configuration 1 reg */
  52.     volatile UINT8 *pClkReg; /* ptr clock conversion factor reg */
  53.     volatile UINT8 *pTestReg; /* ptr test mode reg */
  54.     volatile UINT8 *pCfg2Reg; /* ptr configuration 2 reg */
  55.     } NCR_5390_SCSI_CTRL;
  56. typedef struct ncr5390functbl
  57.     {
  58.     FUNCPTR ascCommand;
  59.     FUNCPTR ascIntr;
  60.     FUNCPTR ascRegRead;
  61.     FUNCPTR ascRegWrite;
  62.     FUNCPTR ascXferCountGet;
  63.     FUNCPTR ascXferCountSet;
  64.     FUNCPTR ncr5390CtrlInit;
  65.     FUNCPTR ncr5390Show;
  66.     } SCSIDRV_FUNC_TBL;
  67. #if FALSE
  68. struct scsi
  69.     {
  70.     int tcl;                 /* transfer count register, low byte */
  71.     int tch;                 /* transfer count register, high byte */
  72.     int fifo;                /* fifo register */
  73.     int cmd;                 /* command register */
  74.     int sts_bid;             /* status and bus-id register */
  75.     int intsts_tmo;          /* interrupt status and timeout register */
  76.     int step_period;         /* step and period register */
  77.     int fifoflag_offset;     /* fifo flag and offset register */
  78.     int conf1;               /* configuration register 1 */
  79.     int clock;               /* clock conversion factor register */
  80.     int test;                /* test register */
  81.     int conf2;               /* configuration register 2 */
  82.     };
  83. /* defines for the overlapping registers */
  84. #define int_sts           intsts_tmo          /* interrupt status */
  85. #define tmo               intsts_tmo          /* select/reselect timeout */
  86. #define step              step_period         /* sequence step */
  87. #define period            step_period         /* sync period */
  88. #define fifo_flags        fifoflag_offset     /* fifo flags */
  89. #define offset            fifoflag_offset     /* sync offset */
  90. #endif /* FALSE */
  91. /* defines for the overlapping registers */
  92. #define pBidReg           pStatReg /* select/reselect bus id */
  93. #define pTmoReg           pIntrReg /* select/reselect bus id */
  94. /* ASC device types */
  95. #define ASC_NCR5390 0
  96. #define ASC_NCR5390A 1
  97. #define ASC_NCR5390B 2
  98. #define ASC_NCR5394 3
  99. #define ASC_NCR5395 4
  100. #define ASC_NCR5396 5
  101. /* FIFO register */
  102. #define NCR5390_FIFO_DEPTH       16
  103. /* command register */
  104. #define NCR5390_NOP              0x00
  105. #define NCR5390_FIFO_FLUSH       0x01
  106. #define NCR5390_CHIP_RESET       0x02
  107. #define NCR5390_BUS_RESET        0x03
  108. #define NCR5390_INFO_TRANSFER    0x10
  109. #define NCR5390_I_CMD_COMPLETE   0x11
  110. #define NCR5390_MSG_ACCEPTED     0x12
  111. #define NCR5390_SET_ATTENTION    0x13
  112. #define NCR5390_SEND_MESSAGE     0x20
  113. #define NCR5390_SEND_STATUS      0x21
  114. #define NCR5390_SEND_DATA        0x22
  115. #define NCR5390_DISCONNECT_SEQ   0x23
  116. #define NCR5390_TERMINATE_SEQ    0x24
  117. #define NCR5390_T_CMD_COMPLETE   0x25
  118. #define NCR5390_DISCONNECT       0x27
  119. #define NCR5390_RCV_MESSAGE      0x28
  120. #define NCR5390_RCV_COMMAND      0x29
  121. #define NCR5390_RCV_DATA         0x2a
  122. #define NCR5390_RCV_CMD_SEQ      0x2b
  123. #define NCR5390_RESELECT         0x40
  124. #define NCR5390_SELECT           0x41
  125. #define NCR5390_ATN_SELECT       0x42
  126. #define NCR5390_STOP_SELECT      0x43
  127. #define NCR5390_SELECTION_ENBL   0x44
  128. #define NCR5390_SELECTION_DSBL   0x45
  129. #define NCR5390_DMA_OP           0x80
  130. /* status register */
  131. #define NCR5390_DOUT_PHASE       0x00
  132. #define NCR5390_DIN_PHASE        0x01
  133. #define NCR5390_CMND_PHASE       0x02
  134. #define NCR5390_STAT_PHASE       0x03
  135. #define NCR5390_MSGOUT_PHASE     0x06
  136. #define NCR5390_MSGIN_PHASE      0x07
  137. #define NCR5390_PHASE_MASK       0x07
  138. #define NCR5390_VAL_GROUP        0x08
  139. #define NCR5390_TERMINAL_CNT     0x10
  140. #define NCR5390_PARITY_ERR       0x20
  141. #define NCR5390_GROSS_ERR        0x40
  142. #define NCR5390_INTERRUPT        0x80
  143. /* interrupt status register */
  144. #define NCR5390_SELECTED          0x01
  145. #define NCR5390_ATN_SELECTED      0x02
  146. #define NCR5390_RESELECTED        0x04
  147. #define NCR5390_FUNC_COMPLETE     0x08
  148. #define NCR5390_BUS_SERVICE       0x10
  149. #define NCR5390_DISCONNECTED      0x20
  150. #define NCR5390_ILLEGAL_CMD       0x40
  151. #define NCR5390_SCSI_RESET        0x80
  152. /* fifo flags register */
  153. #define NCR5390_MORE_DATA         0x1f
  154. /* configuration register 1 */
  155. #define NCR5390_OWN_ID_MASK       0x07
  156. #define NCR5390_CHIPTEST_ENBL     0x08
  157. #define NCR5390_PAR_CHECK_ENBL    0x10
  158. #define NCR5390_PAR_TEST_ENBL     0x20
  159. #define NCR5390_RESET_REP_DSBL    0x40
  160. #define NCR5390_SLOW_CABLE        0x80
  161. /* test register */
  162. #define NCR5390_TARGET     0x01
  163. #define NCR5390_INITIATOR         0x02
  164. #define NCR5390_HIGH_IMP          0x04
  165. /* configuration register 2 */
  166. #define NCR5390_DMA_PAR_ENBL      0x01
  167. #define NCR5390_REG_PAR_ENBL      0x02
  168. #define NCR5390_PARITY_ABORT      0x04
  169. #define NCR5390_SCSI_2            0x08
  170. #define NCR5390_DREQ_HIGH_IMP     0x10
  171. typedef NCR_5390_SCSI_CTRL ASC;
  172. /* external declarations */
  173. extern SCSIDRV_FUNC_TBL *pNcr5390IfTbl;
  174. #if defined(__STDC__) || defined(__cplusplus)
  175. IMPORT  void ncr5390IfTblInit ();
  176. IMPORT STATUS ascProgBytesIn (SCSI_PHYS_DEV *, UINT8 *, int, int);
  177. IMPORT STATUS ascProgBytesOut (SCSI_PHYS_DEV *, UINT8 *, int, int);
  178. IMPORT NCR_5390_SCSI_CTRL * ncr5390CtrlCreate (UINT8 *, int, UINT,
  179. FUNCPTR, FUNCPTR);
  180. #ifndef NCR5390_1_LOCAL_FUNCS
  181. IMPORT void ascCommand (ASC *, FAST int);
  182. IMPORT void ascIntr (ASC *);
  183. IMPORT void ascXferCountGet (FAST ASC *, FAST int *);
  184. IMPORT STATUS ascXferCountSet (FAST ASC *, FAST int);
  185. IMPORT STATUS ncr5390CtrlInit (FAST ASC *, FAST int, FAST UINT, int);
  186. IMPORT STATUS nc5390Show ( FAST SCSI_CTRL *);
  187. #endif
  188. #else /* __STDC__ */
  189. IMPORT  void ncr5390IfTblInit ();
  190. IMPORT NCR_5390_SCSI_CTRL * ncr5390CtrlCreate ();
  191. IMPORT STATUS ascProgBytesIn ();
  192. IMPORT STATUS ascProgBytesOut ();
  193. #ifndef NCR5390_1_LOCAL_FUNCS
  194. IMPORT void ascCommand ();
  195. IMPORT void ascIntr ();
  196. IMPORT void ascXferCountGet ();
  197. IMPORT STATUS ascXferCountSet ();
  198. IMPORT STATUS ncr5390CtrlInit ();
  199. IMPORT STATUS nc5390Show ();
  200. #endif
  201. #endif /* __STDC__ */
  202. #endif /* _ASMLANGUAGE */
  203. #ifdef __cplusplus
  204. }
  205. #endif
  206. #endif /* __INCncr5390_1h */