nwb225reg.h revision 1.1 1 /* $NetBSD: nwb225reg.h,v 1.1 2026/09/20 10:29:12 tsutsui Exp $ */
2
3 /*-
4 * Copyright (c) 2026 Izumi Tsutsui. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27 #ifndef _NEWS68K_NWB225REG_H_
28 #define _NEWS68K_NWB225REG_H_
29
30 /* NWB-225 MMIO addresses */
31 #define NWB225_KROM_BASE 0xf0600000UL
32 #define NWB225_KROM_SIZE 0x00100000UL
33 #define NWB225_RCONT_BASE 0xf0700000UL
34 #define NWB225_RCONT_SIZE 0x00100000UL
35
36 /*
37 * ROP controller register/aperture offsets from NWB225_RCONT_BASE
38 */
39
40 /* Status: ROP status register */
41 #define NWB225_STATUS 0x00080000UL
42 #define NWB225_STATUS_REQ 0x0001
43 #define NWB225_STATUS_EXEC 0x0002
44 #define NWB225_STATUS_BUSY (NWB225_STATUS_EXEC | NWB225_STATUS_REQ)
45 #define NWB225_STATUS_DISPVER 0x00e0
46 #define NWB225_STATUS_DISPVER_SHIFT 5
47 #define NWB225_STATUS_4PLANE 0x0080
48
49 /* Command-address flags: A13 Set Shift / A14 Execute */
50 #define NWB225_ROP_ADDR_FLAG_SET_SHIFT 0x00002000UL
51 #define NWB225_ROP_ADDR_FLAG_EXECUTE 0x00004000UL
52
53 /* Command-addresses: COPY and FILL */
54 #define NWB225_ROP_COPY_XR_YR 0x00060300UL
55 #define NWB225_ROP_COPY_XF_YR 0x00060310UL
56 #define NWB225_ROP_COPY_XR_YF 0x00060320UL
57 #define NWB225_ROP_COPY_XF_YF 0x00060330UL
58 #define NWB225_ROP_CONST_FILL 0x000603b0UL
59
60 /* Parameter-addresses: rectangles of COPY, FILL, and HWRITE */
61 /* y must be in the range 0..NWB225_FB_HEIGHT - 1 */
62 #define NWB225_DST_ADDR(y) (0x00008000UL | 2UL * (y))
63 #define NWB225_SRC_ADDR(y) (0x00020000UL | 2UL * (y))
64 /* h must be in the range 1..NWB225_FB_HEIGHT */
65 #define NWB225_HWRITE_LIMIT(h) (0x00040000UL | 2UL * ((h) - 1))
66 #define NWB225_ROP_LIMIT(h) (0x00050000UL | 2UL * ((h) - 1))
67
68 /* Parameter-addresses: ROP func of COPY, FILL, and HWRITE */
69 /* p must be in the range 0..7 and less than dc_nplanes */
70 #define NWB225_ROP_FUNC(p) (0x00060730UL | 2UL * (p))
71
72 /* Parameter-addresses: for host data of HWRITE */
73 #define NWB225_HWRITE_DATA 0x00070230UL
74 #define NWB225_HWRITE_BITS_PER_WORD 16
75
76 #define NWB225_PLANE_CTRL 0x000a0000UL
77 #define NWB225_PLANE_CTRL_SHIFT 8
78
79 #define NWB225_CTL_SELECT 0x000c0000UL
80 #define NWB225_PAL_INDEX 0x000c0000UL
81 #define NWB225_PAL_DATA 0x000c0002UL
82 #define NWB225_CTL_DATA 0x000c0004UL
83 #define NWB225_INIT_BASE 0x000e0000UL
84
85 /* Fixed hardware geometry used by the NWB-225 NEWS-OS/PROM setup */
86 #define NWB225_FB_WIDTH 2048
87 #define NWB225_FB_HEIGHT 1024
88 #define NWB225_VIS_WIDTH 1280
89 #define NWB225_VIS_HEIGHT 1024
90
91 /* NEWS-OS KROM glyph and text-cell geometry */
92 #define NWB225_FONT_WIDTH 12
93 #define NWB225_FONT_HEIGHT 24
94 #define NWB225_CELL_WIDTH 16
95 #define NWB225_CELL_HEIGHT 30
96 #define NWB225_GLYPH_YOFFSET 4
97
98 #define NWB225_KROM_ASCII_FIRST 0x20
99 #define NWB225_KROM_ASCII_LAST 0x7e
100 #define NWB225_KROM_ROWBYTES 4
101 #define NWB225_KROM_ASCII_MASK 0xfff0
102 #define NWB225_TEXT_COLS 80
103 #define NWB225_TEXT_ROWS 33
104 #define NWB225_TEXT_XORIGIN 0
105 #define NWB225_TEXT_YORIGIN 8
106
107 #endif /* _NEWS68K_NWB225REG_H_ */
108 /* $NetBSD: nwb225reg.h,v 1.1 2026/09/20 10:29:12 tsutsui Exp $ */
109
110 /*-
111 * Copyright (c) 2026 Izumi Tsutsui. All rights reserved.
112 *
113 * Redistribution and use in source and binary forms, with or without
114 * modification, are permitted provided that the following conditions
115 * are met:
116 * 1. Redistributions of source code must retain the above copyright
117 * notice, this list of conditions and the following disclaimer.
118 * 2. Redistributions in binary form must reproduce the above copyright
119 * notice, this list of conditions and the following disclaimer in the
120 * documentation and/or other materials provided with the distribution.
121 *
122 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
123 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
124 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
125 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
126 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
127 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
128 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
129 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
130 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
131 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
132 */
133
134 #ifndef _NEWS68K_NWB225REG_H_
135 #define _NEWS68K_NWB225REG_H_
136
137 /* NWB-225 address windows. */
138 #define NWB225_KROM_BASE 0xf0600000UL
139 #define NWB225_KROM_SIZE 0x00100000UL
140 #define NWB225_RCONT_BASE 0xf0700000UL
141 #define NWB225_RCONT_SIZE 0x00100000UL
142
143 /* ROP controller register/aperture offsets from NWB225_RCONT_BASE. */
144 #define NWB225_STATUS 0x00080000UL
145 #define NWB225_STATUS_BUSY 0x0003
146 #define NWB225_STATUS_DISPVER 0x00e0
147 #define NWB225_STATUS_DISPVER_SHIFT 5
148 #define NWB225_STATUS_4PLANE 0x0080
149 #define NWB225_DST_X 0x00008000UL
150 #define NWB225_SRC_X 0x00022000UL
151 #define NWB225_HWRITE_EDGE 0x00044000UL
152 #define NWB225_ROP_EDGE 0x00054000UL
153 #define NWB225_ROP_COPY_RR 0x00060300UL
154 #define NWB225_ROP_COPY_FR 0x00060310UL
155 #define NWB225_ROP_COPY_RF 0x00060320UL
156 #define NWB225_ROP_COPY_FF 0x00060330UL
157 #define NWB225_ROP_CLEAR 0x000603b0UL
158 #define NWB225_ROP_FUNC 0x00060730UL
159 #define NWB225_HWRITE_DATA 0x00070230UL
160 #define NWB225_PLANE_CTRL 0x000a0000UL
161 #define NWB225_CTL_SELECT 0x000c0000UL
162 #define NWB225_PAL_INDEX 0x000c0000UL
163 #define NWB225_PAL_DATA 0x000c0002UL
164 #define NWB225_CTL_DATA 0x000c0004UL
165 #define NWB225_INIT_BASE 0x000e0000UL
166
167 /* Fixed hardware geometry used by the NWB-225 NEWS-OS/PROM setup. */
168 #define NWB225_FB_WIDTH 2048
169 #define NWB225_FB_HEIGHT 1024
170 #define NWB225_VIS_WIDTH 1280
171 #define NWB225_VIS_HEIGHT 1024
172
173 /* NEWS-OS KROM glyph and text-cell geometry. */
174 #define NWB225_FONT_WIDTH 12
175 #define NWB225_FONT_HEIGHT 24
176 #define NWB225_CELL_WIDTH 16
177 #define NWB225_CELL_HEIGHT 30
178 #define NWB225_GLYPH_YOFFSET 4
179
180 #define NWB225_KROM_ASCII_FIRST 0x20
181 #define NWB225_KROM_ASCII_LAST 0x7e
182 #define NWB225_KROM_ROWBYTES 4
183 #define NWB225_KROM_ASCII_MASK 0xfff0
184 #define NWB225_TEXT_COLS 80
185 #define NWB225_TEXT_ROWS 33
186 #define NWB225_TEXT_XORIGIN 0
187 #define NWB225_TEXT_YORIGIN 8
188
189 #endif /* _NEWS68K_NWB225REG_H_ */
190