2 /* $NecBSD: tmc18c30reg.h,v 1.4.24.1 2001/06/08 06:27:50 honda Exp $ */
6 * [NetBSD for NEC PC-98 series]
7 * Copyright (c) 1996, 1997, 1998
8 * NetBSD/pc98 porting staff. All rights reserved.
9 * Copyright (c) 1996, 1997, 1998
10 * Kouichi Matsuda. All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
27 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
36 #ifndef _TMC18C30REG_H_
37 #define _TMC18C30REG_H_
39 #define tmc_wdata 0x00
40 #define tmc_rdata 0x00
43 #define BCTL_BUSFREE 0x00
51 #define BCTL_BUSEN 0x80
52 #define tmc_bstat 0x01
53 #define BSTAT_BSY 0x01
54 #define BSTAT_MSG 0x02
56 #define BSTAT_CMD 0x08
57 #define BSTAT_REQ 0x10
58 #define BSTAT_SEL 0x20
59 #define BSTAT_ACK 0x40
62 #define ICTL_FIFO 0x10
63 #define ICTL_ARBIT 0x20
66 #define ICTL_ALLINT (ICTL_ARBIT | ICTL_CD | ICTL_SEL | ICTL_FIFO)
67 #define tmc_astat 0x02
68 #define ASTAT_INT 0x01
69 #define ASTAT_ARBIT 0x02
70 #define ASTAT_PARERR 0x04
71 #define ASTAT_SCSIRST 0x08
72 #define ASTAT_STATMASK 0x0f
73 #define ASTAT_FIFODIR 0x10
74 #define ASTAT_FIFOEN 0x20
75 #define ASTAT_PARENB 0x40
76 #define ASTAT_BUSEN 0x80
78 #define tmc_ssctl 0x03
79 #define SSCTL_FSYNCHEN 0x40
80 #define SSCTL_SYNCHEN 0x80
81 #define tmc_fstat 0x03
84 #define FCTL_CLRFIFO 0x01
85 #define FCTL_ARBIT 0x04
86 #define FCTL_PARENB 0x08
87 #define FCTL_INTEN 0x10
88 #define FCTL_CLRINT 0x20
89 #define FCTL_FIFOW 0x40
90 #define FCTL_FIFOEN 0x80
94 #define tmc_idlsb 0x05
96 #define tmc_idmsb 0x06
101 #define tmc_scsiid 0x08
102 #define tmc_sdna 0x08
104 #define tmc_istat 0x09
105 #define ISTAT_INTEN 0x08
106 #define ISTAT_FIFO 0x10
107 #define ISTAT_ARBIT 0x20
108 #define ISTAT_SEL 0x40
109 #define ISTAT_CD 0x80
111 #define tmc_cfg1 0x0a
113 #define tmc_ioctl 0x0b
114 #define IOCTL_IO32 0x80
115 #define tmc_cfg2 0x0b
117 #define tmc_wfifo 0x0c
118 #define tmc_rfifo 0x0c
120 #define tmc_fdcnt 0x0e
122 /* Information transfer phases */
123 #define BUSFREE_PHASE 0x00
124 #define DATA_OUT_PHASE (BSTAT_BSY)
125 #define DATA_IN_PHASE (BSTAT_BSY|BSTAT_IO)
126 #define COMMAND_PHASE (BSTAT_CMD|BSTAT_BSY)
127 #define STATUS_PHASE (BSTAT_CMD|BSTAT_BSY|BSTAT_IO)
128 #define MESSAGE_OUT_PHASE (BSTAT_CMD|BSTAT_MSG|BSTAT_BSY)
129 #define MESSAGE_IN_PHASE (BSTAT_CMD|BSTAT_MSG|BSTAT_BSY|BSTAT_IO)
130 #define PHASE_RESELECTED (BSTAT_SEL|BSTAT_IO)
132 #define BSTAT_PHMASK (BSTAT_MSG | BSTAT_IO | BSTAT_CMD)
133 #define PHASE_MASK (BSTAT_SEL | BSTAT_BSY | BSTAT_PHMASK)
134 #define RESEL_PHASE_MASK (BSTAT_SEL | BSTAT_PHMASK)
136 #define STG_IS_PHASE_DATA(st) \
137 ((((st) & PHASE_MASK) & ~BSTAT_IO) == BSTAT_BSY)
140 #define TMCCHIP_UNK 0x00
141 #define TMCCHIP_1800 0x01
142 #define TMCCHIP_18C50 0x02
143 #define TMCCHIP_18C30 0x03
147 #endif /* !_TMC18C30REG_H_ */