1 /* $NetBSD: screg_1185.h,v 1.6 2005/12/11 12:18:24 christos Exp $ */
3 * Copyright (c) 1992, 1993
4 * The Regents of the University of California. All rights reserved.
6 * This code is derived from software contributed to Berkeley by
7 * Sony Corp. and Kazumasa Utashiro of Software Research Associates, Inc.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * from: $Hdr: screg_1185.h,v 4.300 91/06/09 06:22:14 root Rel41 $ SONY
35 * @(#)screg_1185.h 8.1 (Berkeley) 6/11/93
39 * Copyright (c) 1989- by SONY Corporation.
43 * screg_1185.h ver 0.0
44 * for SCSI I/F Chip CXD1185Q
48 * SCSI I/F Chip CXD1185Q Register address assignment
51 # define SCSI_BASE 0xbfe00100
53 # define SCSI_BASE 0xe1900000
56 #define sc_statr *((volatile uint8_t *)(SCSI_BASE + 0x0))
57 #define sc_comr *((volatile uint8_t *)(SCSI_BASE + 0x0))
58 #define sc_datr *((volatile uint8_t *)(SCSI_BASE + 0x1))
59 #define sc_intrq1 *((volatile uint8_t *)(SCSI_BASE + 0x2))
60 #define sc_intrq2 *((volatile uint8_t *)(SCSI_BASE + 0x3))
61 #define sc_envir *((volatile uint8_t *)(SCSI_BASE + 0x3))
62 #define sc_cmonr *((volatile uint8_t *)(SCSI_BASE + 0x4))
63 #define sc_timer *((volatile uint8_t *)(SCSI_BASE + 0x4))
64 #define sc_ffstr *((volatile uint8_t *)(SCSI_BASE + 0x5))
65 #define sc_idenr *((volatile uint8_t *)(SCSI_BASE + 0x6))
66 #define sc_tclow *((volatile uint8_t *)(SCSI_BASE + 0x7))
67 #define sc_tcmid *((volatile uint8_t *)(SCSI_BASE + 0x8))
68 #define sc_tchi *((volatile uint8_t *)(SCSI_BASE + 0x9))
69 #define sc_intok1 *((volatile uint8_t *)(SCSI_BASE + 0xa))
70 #define sc_intok2 *((volatile uint8_t *)(SCSI_BASE + 0xb))
71 #define sc_moder *((volatile uint8_t *)(SCSI_BASE + 0xc))
72 #define sc_syncr *((volatile uint8_t *)(SCSI_BASE + 0xd))
73 #define sc_busconr *((volatile uint8_t *)(SCSI_BASE + 0xe))
74 #define sc_ioptr *((volatile uint8_t *)(SCSI_BASE + 0xf))
77 * CXD1185Q Register bit assignment
80 /* sc_statr (status register) bit define
90 /* sc_comr (command register) bit define
95 /* sc_intrq1 (interrupt request register 1) bit define
103 /* sc_intrq2 (interrupt request register 2) bit define
114 /* sc_envir (environment register) bit define
122 /* sc_cmonr (scsi control monitor register) bit define
133 /* sc_ffstr (FIFO status register) bit define
137 #define R5_FIFOREM 0x1f
139 /* sc_idenr (scsi identify register) bit define
141 #define R6_OID_MASK 0x07
142 #define R6_SID_MASK 0xe0
143 #define R6_TID_MASK 0xe0
145 /* sc_intok1 (interrupt enable register 1) bit define
153 /* sc_intok2 (interrupt enable register 2) bit define
164 /* sc_moder (mode register) bit define
173 /* sc_syncr (synchronous transfer control register) bit define
175 #define Rd_TPD_MASK 0xf0
176 #define Rd_TOF_MASK 0x0f
177 #define MIN_TP 62 /* minimum transfer period 4ns * 25 */
178 #define MAX_OFFSET 15
180 /* sc_busconr (scsi bus control register) bit define
191 /* sc_ioptr (I/O port) bit define
193 #define Rf_PCN_MASK 0xf0
194 # define Rf_PCN3 0x80
195 # define Rf_PCN2 0x40
196 # define Rf_PCN1 0x20
197 # define Rf_PCN0 0x10
198 #define Rf_PRT_MASK 0x0f
210 #define SCMD_NOP 0x00
211 #define SCMD_CHIP_RST 0x01
212 #define SCMD_AST_RST 0x02
213 #define SCMD_FLSH_FIFO 0x03
214 #define SCMD_AST_CTRL 0x04
215 #define SCMD_NGT_CTRL 0x05
216 #define SCMD_AST_DATA 0x06
217 #define SCMD_NGT_DATA 0x07
221 #define SCMD_RESEL 0x40
222 #define SCMD_SEL 0x41
223 #define SCMD_SEL_ATN 0x42
224 #define SCMD_ENB_SEL 0x43
225 #define SCMD_DIS_SEL 0x44
229 #define SCMD_SEND_MES 0x80
230 #define SCMD_SEND_STAT 0x81
231 #define SCMD_SEND_DATA 0x82
232 #define SCMD_DISCONNECT 0x83
233 #define SCMD_RCV_MOUT 0x84
234 #define SCMD_RCV_CMD 0x85
235 #define SCMD_RCV_DATA 0x86
239 #define SCMD_TR_INFO 0xc0
240 #define SCMD_TR_PAD 0xc1
241 #define SCMD_NGT_ACK 0xc2
242 #define SCMD_AST_ATN 0xc3
243 #define SCMD_NGT_ATN 0xc4
247 * scsi parameter definition
252 #define SC_TG_SHIFT 5
256 #define SC_PMASK (R4_MMSG|R4_MCD|R4_MIO)
258 # define DAT_IN R4_MIO
259 # define COM_OUT R4_MCD
260 # define STAT_IN (R4_MCD|R4_MIO)
261 # define MES_OUT (R4_MMSG|R4_MCD)
262 # define MES_IN (R4_MMSG|R4_MCD|R4_MIO)
264 /* scsi command types define
266 #define CMD_TYPEMASK 0xe0
267 # define CMD_T0 0 /* 6 byte commands */
268 # define CMD_T1 0x20 /* 10 byte commands */
269 # define CMD_T5 0xa0 /* 12 byte commands */