scireg.h revision 1.1 1 /*
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Van Jacobson of Lawrence Berkeley Laboratory.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)scireg.h 7.3 (Berkeley) 2/5/91
37 * $Id: scireg.h,v 1.1 1994/02/28 06:06:24 chopps Exp $
38 */
39
40 /*
41 * NCR 5380 SCSI interface hardware description.
42 *
43 */
44
45 typedef struct {
46 unsigned char pad0[1];
47 volatile unsigned char sci_data; /* r: Current data */
48 #define sci_odata sci_data /* w: Out data */
49
50 unsigned char pad1[1];
51 volatile unsigned char sci_icmd; /* rw: Initiator command */
52
53 unsigned char pad2[1];
54 volatile unsigned char sci_mode; /* rw: Mode */
55
56 unsigned char pad3[1];
57 volatile unsigned char sci_tcmd; /* rw: Target command */
58
59 unsigned char pad4[1];
60 volatile unsigned char sci_bus_csr; /* r: Bus Status */
61 #define sci_sel_enb sci_bus_csr /* w: Select enable */
62
63 unsigned char pad5[1];
64 volatile unsigned char sci_csr; /* r: Status */
65 #define sci_dma_send sci_csr /* w: Start dma send data */
66
67 unsigned char pad6[1];
68 volatile unsigned char sci_idata; /* r: Input data */
69 #define sci_trecv sci_idata /* w: Start dma receive, target */
70
71 unsigned char pad7[1];
72 volatile unsigned char sci_iack; /* r: Interrupt Acknowledge */
73 #define sci_irecv sci_iack /* w: Start dma receive, initiator */
74 } sci_regmap_t;
75
76 /*
77 * Initiator command register
78 */
79
80 #define SCI_ICMD_DATA 0x01 /* rw: Assert data bus */
81 #define SCI_ICMD_ATN 0x02 /* rw: Assert ATN signal */
82 #define SCI_ICMD_SEL 0x04 /* rw: Assert SEL signal */
83 #define SCI_ICMD_BSY 0x08 /* rw: Assert BSY signal */
84 #define SCI_ICMD_ACK 0x10 /* rw: Assert ACK signal */
85 #define SCI_ICMD_LST 0x20 /* r: Lost arbitration */
86 #define SCI_ICMD_DIFF SCI_ICMD_LST /* w: Differential cable */
87 #define SCI_ICMD_AIP 0x40 /* r: Arbitration in progress */
88 #define SCI_ICMD_TEST SCI_ICMD_AIP /* w: Test mode */
89 #define SCI_ICMD_RST 0x80 /* rw: Assert RST signal */
90
91
92 /*
93 * Mode register
94 */
95
96 #define SCI_MODE_ARB 0x01 /* rw: Start arbitration */
97 #define SCI_MODE_DMA 0x02 /* rw: Enable DMA xfers */
98 #define SCI_MODE_MONBSY 0x04 /* rw: Monitor BSY signal */
99 #define SCI_MODE_DMA_IE 0x08 /* rw: Enable DMA complete interrupt */
100 #define SCI_MODE_PERR_IE 0x10 /* rw: Interrupt on parity errors */
101 #define SCI_MODE_PAR_CHK 0x20 /* rw: Check parity */
102 #define SCI_MODE_TARGET 0x40 /* rw: Target mode (Initiator if 0) */
103 #define SCI_MODE_BLOCKDMA 0x80 /* rw: Block-mode DMA handshake (MBZ) */
104
105
106 /*
107 * Target command register
108 */
109
110 #define SCI_TCMD_IO 0x01 /* rw: Assert I/O signal */
111 #define SCI_TCMD_CD 0x02 /* rw: Assert C/D signal */
112 #define SCI_TCMD_MSG 0x04 /* rw: Assert MSG signal */
113 #define SCI_TCMD_PHASE_MASK 0x07 /* r: Mask for current bus phase */
114 #define SCI_TCMD_REQ 0x08 /* rw: Assert REQ signal */
115 #define SCI_TCMD_LAST_SENT 0x80 /* ro: Last byte was xferred
116 * (not on 5380/1) */
117
118 #define SCI_PHASE(x) ((x>>2) & 7)
119
120 /*
121 * Current (SCSI) Bus status
122 */
123
124 #define SCI_BUS_DBP 0x01 /* r: Data Bus parity */
125 #define SCI_BUS_SEL 0x02 /* r: SEL signal */
126 #define SCI_BUS_IO 0x04 /* r: I/O signal */
127 #define SCI_BUS_CD 0x08 /* r: C/D signal */
128 #define SCI_BUS_MSG 0x10 /* r: MSG signal */
129 #define SCI_BUS_REQ 0x20 /* r: REQ signal */
130 #define SCI_BUS_BSY 0x40 /* r: BSY signal */
131 #define SCI_BUS_RST 0x80 /* r: RST signal */
132
133 #define SCI_CUR_PHASE(x) SCSI_PHASE((x)>>2)
134
135 /*
136 * Bus and Status register
137 */
138
139 #define SCI_CSR_ACK 0x01 /* r: ACK signal */
140 #define SCI_CSR_ATN 0x02 /* r: ATN signal */
141 #define SCI_CSR_DISC 0x04 /* r: Disconnected (BSY==0) */
142 #define SCI_CSR_PHASE_MATCH 0x08 /* r: Bus and SCI_TCMD match */
143 #define SCI_CSR_INT 0x10 /* r: Interrupt request */
144 #define SCI_CSR_PERR 0x20 /* r: Parity error */
145 #define SCI_CSR_DREQ 0x40 /* r: DMA request */
146 #define SCI_CSR_DONE 0x80 /* r: DMA count is zero */
147
148