zz9kreg.h revision 1.2 1 /* $NetBSD: zz9kreg.h,v 1.2 2025/08/31 19:10:00 rillig Exp $ */
2
3 /*
4 * Copyright (c) 2020 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Alain Runa. Register names derived from original drivers for AmigaOS.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #ifndef ZZ9KREG_H
32 #define ZZ9KREG_H
33
34 /* Expected hardware and firmware versions */
35 #define ZZ9K_HW_VER (0x0000)
36 #define ZZ9K_FW_VER (0x010D) /* v1.13 */
37 #define ZZ9K_FW_VER_MIN (0x010D) /* v1.13 */
38
39 /* Zorro IDs */
40 #define ZZ9K_MANID (0x6D6E)
41 #define ZZ9K_PRODID_Z2 (0x0003)
42 #define ZZ9K_PRODID_Z3 (0x0004)
43
44 /* Address space */
45 #define ZZ9K_REG_BASE (0x00000000)
46 #define ZZ9K_REG_SIZE (0x00002000) /* 8 KB */
47 #define ZZ9K_FB_BASE (0x00010000)
48 #define ZZ9K_FB_SIZE (0x02FF0000) /* 48 MB - 64 KB */
49 #define ZZ9K_RX_BASE (0x00002000)
50 #define ZZ9K_RX_SIZE (0x00002000) /* 8 KB */
51 #define ZZ9K_TX_BASE (0x00008000)
52 #define ZZ9K_TX_SIZE (0x00002000) /* 8 KB */
53
54 /* Color mode */
55 #define ZZ9K_COLOR_8BIT (0)
56 #define ZZ9K_COLOR_16BIT (1)
57 #define ZZ9K_COLOR_32BIT (2)
58 #define ZZ9K_COLOR_15BIT (3)
59
60 /* Modes of ZZ9K_MODE */
61 #define ZZ9K_MODE_1280x720 (0)
62 #define ZZ9K_MODE_800x600 (1)
63 #define ZZ9K_MODE_640x480 (2)
64 #define ZZ9K_MODE_1024x768 (3)
65 #define ZZ9K_MODE_1280x1024 (4)
66 #define ZZ9K_MODE_1920x1080 (5)
67 #define ZZ9K_MODE_720x576p50 (6)
68 #define ZZ9K_MODE_1920x1080p50 (7)
69 #define ZZ9K_MODE_720x480 (8)
70 #define ZZ9K_MODE_640x512 (9)
71 #define ZZ9K_MODE_1600x1200 (10)
72 #define ZZ9K_MODE_2560x1440p30 (11)
73 #define ZZ9K_MODE_720x576p50_NS_PAL (12)
74 #define ZZ9K_MODE_720x480_NS_PAL (13)
75 #define ZZ9K_MODE_720x576p50_NS_NTSC (14)
76 #define ZZ9K_MODE_720x480_NS_NTSC (15)
77 #define ZZ9K_MODE_640x400 (16)
78 #define ZZ9K_MODE_1920x800 (17)
79
80 /* Some registers expect the modes and scale factors shifted */
81 #define ZZ9K_MODE_COLOR_8BIT (ZZ9K_COLOR_8BIT << 8)
82 #define ZZ9K_MODE_COLOR_16BIT (ZZ9K_COLOR_16BIT << 8)
83 #define ZZ9K_MODE_COLOR_32BIT (ZZ9K_COLOR_32BIT << 8)
84 #define ZZ9K_MODE_COLOR_15BIT (ZZ9K_COLOR_15BIT << 8)
85 #define ZZ9K_MODE_SCALE_0 (0 << 12)
86 #define ZZ9K_MODE_SCALE_1 (1 << 12)
87 #define ZZ9K_MODE_SCALE_2 (2 << 12)
88 #define ZZ9K_MODE_SCALE_3 (3 << 12)
89
90 /* Feature of ZZ9K_BLITTER_USER1 for ZZ9K_FEATURE */
91 #define ZZ9K_FEATURE_NONE (0)
92 #define ZZ9K_FEATURE_SECONDARY_PALETTE (1)
93 #define ZZ9K_FEATURE_NONSTANDARD_VSYNC (2)
94
95 /* Video capture pan */
96 #define ZZ9K_CAPTURE_PAN_NTSC (0x00E00000)
97 #define ZZ9K_CAPTURE_PAN_PAL (0x00E00000)
98 #define ZZ9K_CAPTURE_PAN_VGA (0x00DFF2F8)
99
100 /* Modes of ZZ9K_VIDEO_CAPTURE_MODE */
101 #define ZZ9K_CAPTURE_OFF (0)
102 #define ZZ9K_CAPTURE_ON (1)
103
104 /* Operations of MNTZ_VIDEO_CONTROL_OP */
105 #define ZZ9K_OP_NOP (0)
106 #define ZZ9K_OP_PALETTE (3)
107 #define ZZ9K_OP_VSYNC (5)
108
109 #define ZZ9K_PALETTE_SIZE (256)
110
111 /* Options of ZZ9K_BLITTER_OP_COPYRECT */
112 #define ZZ9K_OPT_REGULAR (1)
113 #define ZZ90_OPT_NOMASK (2)
114
115 /* Video Control */
116 #define ZZ9K_VIDEO_CTRL_DATA_HI (0x1000)
117 #define ZZ9K_VIDEO_CTRL_DATA_LO (0x1002)
118 #define ZZ9K_VIDEO_CTRL_OP (0x1004)
119 #define ZZ9K_VIDEO_CAPTURE_MODE (0x1006)
120 #define ZZ9K_VIDEO_BLANK_STATUS (0x1600)
121
122 /* Bits of ZZ9K_CONFIG */
123 #define ZZ9K_CONFIG_INT_ETH (1 << 0)
124 #define ZZ9K_CONFIG_INT_AUDIO (1 << 1)
125 #define ZZ9K_CONFIG_INT_ACK (1 << 3)
126 #define ZZ9K_CONFIG_INT_ACK_ETH (1 << 4)
127 #define ZZ9K_CONFIG_INT_ACK_AUDIO (1 << 5)
128
129 /* Bits of ZZ9K_AUDIO_CONFIG */
130 #define ZZ9K_AUDIO_CONFIG_INT_AUDIO (1 << 0)
131
132 /* Parameters of ZZ9K_AUDIO_PARAM */
133 #define ZZ9K_AP_TX_BUF_OFFS_HI (0)
134 #define ZZ9K_AP_TX_BUF_OFFS_LO (1)
135 #define ZZ9K_AP_RX_BUF_OFFS_HI (2)
136 #define ZZ9K_AP_RX_BUF_OFFS_LO (3)
137 #define ZZ9K_AP_DSP_PROG_OFFS_HI (4)
138 #define ZZ9K_AP_DSP_PROG_OFFS_LO (5)
139 #define ZZ9K_AP_DSP_PARAM_OFFS_HI (6)
140 #define ZZ9K_AP_DSP_PARAM_OFFS_LO (7)
141 #define ZZ9K_AP_DSP_UPLOAD (8)
142 #define ZZ9K_AP_DSP_SET_LOWPASS (9)
143 #define ZZ9K_AP_DSP_SET_VOLUMES (10)
144 #define ZZ9K_AP_DSP_SET_PREFACTOR (11)
145 #define ZZ9K_AP_DSP_SET_EQ_BAND1 (12)
146 #define ZZ9K_AP_DSP_SET_EQ_BAND2 (13)
147 #define ZZ9K_AP_DSP_SET_EQ_BAND3 (14)
148 #define ZZ9K_AP_DSP_SET_EQ_BAND4 (15)
149 #define ZZ9K_AP_DSP_SET_EQ_BAND5 (16)
150 #define ZZ9K_AP_DSP_SET_EQ_BAND6 (17)
151 #define ZZ9K_AP_DSP_SET_EQ_BAND7 (18)
152 #define ZZ9K_AP_DSP_SET_EQ_BAND8 (29)
153 #define ZZ9K_AP_DSP_SET_EQ_BAND9 (20)
154 #define ZZ9K_AP_DSP_SET_EQ_BAND10 (21)
155 #define ZZ9K_AP_DSP_SET_STEREO_VOLUME (22)
156
157 /* Parameters of ZZ9K_DECODER_PARAM */
158 #define ZZ9K_DP_DECODE_CLEAR (0)
159 #define ZZ9K_DP_DECODE_INIT (1)
160 #define ZZ9K_DP_DECODE_RUN (2)
161
162
163 /* REGISTERS */
164
165 /* Config and Video */
166 #define ZZ9K_HW_VERSION 0x00
167 #define ZZ9K_MODE 0x02
168 #define ZZ9K_CONFIG 0x04
169
170 #define ZZ9K_SPRITE_X 0x06
171 #define ZZ9K_SPRITE_Y 0x08
172
173 #define ZZ9K_PAN_PTR_HI 0x0A
174 #define ZZ9K_PAN_PTR_LO 0x0C
175 #define ZZ9K_VIDEOCAP_VMODE 0x0E
176
177 /* Blitter */
178 #define ZZ9K_BLITTER_X1 0x10
179 #define ZZ9K_BLITTER_Y1 0x12
180 #define ZZ9K_BLITTER_X2 0x14
181 #define ZZ9K_BLITTER_Y2 0x16
182 #define ZZ9K_BLITTER_ROW_PITCH 0x18
183 #define ZZ9K_BLITTER_X3 0x1A
184 #define ZZ9K_BLITTER_Y3 0x1C
185 #define ZZ9K_BLITTER_RGB_HI 0x1E
186 #define ZZ9K_BLITTER_RGB_LO 0x20
187 #define ZZ9K_BLITTER_OP_FILLRECT 0x22
188 #define ZZ9K_BLITTER_OP_COPYRECT 0x24
189 #define ZZ9K_BLITTER_OP_FILLTEMPLATE 0x26
190 #define ZZ9K_BLITTER_SRC_HI 0x28
191 #define ZZ9K_BLITTER_SRC_LO 0x2A
192 #define ZZ9K_BLITTER_DST_HI 0x2C
193 #define ZZ9K_BLITTER_DST_LO 0x2E
194 #define ZZ9K_BLITTER_COLORMODE 0x30
195 #define ZZ9K_BLITTER_SRC_PITCH 0x32
196 #define ZZ9K_BLITTER_RGB2_HI 0x34
197 #define ZZ9K_BLITTER_RGB2_LO 0x36
198 #define ZZ9K_BLITTER_OP_P2C 0x38
199 #define ZZ9K_BLITTER_OP_DRAW_LINE 0x3A
200 #define ZZ9K_BLITTER_OP_P2D 0x3C
201 #define ZZ9K_BLITTER_OP_INVERTRECT 0x3E
202
203 #define ZZ9K_BLITTER_USER1 0x40
204 #define ZZ9K_BLITTER_USER2 0x42
205 #define ZZ9K_BLITTER_USER3 0x44
206 #define ZZ9K_BLITTER_USER4 0x46
207
208 /* Sprite cursor */
209 #define ZZ9K_SPRITE_BITMAP 0x48
210 #define ZZ9K_SPRITE_COLORS 0x4A
211
212 #define ZZ9K_VBLANK_STATUS 0x4C
213
214 /* ? */
215 #define ZZ9K_SCRATCH_COPY 0x50
216 #define ZZ9K_CVMODE_PARAM 0x52
217 #define ZZ9K_CVMODE_VAL 0x54
218 #define ZZ9K_CVMODE_SEL 0x56
219 #define ZZ9K_CVMODE 0x58
220
221 /* Blitter */
222 #define ZZ9K_BLITTER_OP_DMA 0x5A
223 #define ZZ9K_BLITTER_OP_ACC 0x5C
224 #define ZZ9K_BLITTER_SPLIT_POS 0x5E
225
226 /* ? */
227 #define ZZ9K_SET_FEATURE 0x60
228
229 /* Audio */
230 #define ZZ9K_AUDIO_SWAB 0x70
231 #define ZZ9K_DECODER_FIFO 0x72
232 #define ZZ9K_AUDIO_SCALE 0x74
233 #define ZZ9K_AUDIO_PARAM 0x76
234 #define ZZ9K_AUDIO_VAL 0x78
235 #define ZZ9K_DECODER_PARAM 0x7A
236 #define ZZ9K_DECODER_VAL 0x7C
237 #define ZZ9K_DECODE 0x7E
238
239 /* Network */
240 #define ZZ9K_ETH_TX 0x80
241 #define ZZ9K_ETH_RX 0x82
242 #define ZZ9K_ETH_MAC_HI 0x84
243 #define ZZ9K_ETH_MAC_MD 0x86
244 #define ZZ9K_ETH_MAC_LO 0x88
245
246 /* ARM processing */
247 #define ZZ9K_ARM_RUN_HI 0x90
248 #define ZZ9K_ARM_RUN_LO 0x92
249 #define ZZ9K_ARM_ARGC 0x94
250 #define ZZ9K_ARM_ARGV0 0x96
251 #define ZZ9K_ARM_ARGV1 0x98
252 #define ZZ9K_ARM_ARGV2 0x9A
253 #define ZZ9K_ARM_ARGV3 0x9C
254 #define ZZ9K_ARM_ARGV4 0x9E
255 #define ZZ9K_ARM_ARGV5 0xA0
256 #define ZZ9K_ARM_ARGV6 0xA2
257 #define ZZ9K_ARM_ARGV7 0xA4
258
259 #define ZZ9K_ARM_EVENT_SERIAL 0xB0
260 #define ZZ9K_ARM_EVENT_CODE 0xB2
261
262 /* Board hardware */
263 #define ZZ9K_FW_VERSION 0xC0
264
265 /* USB */
266 #define ZZ9K_USB_TX_HI 0xD0
267 #define ZZ9K_USB_TX_LO 0xD2
268 #define ZZ9K_USB_RX_HI 0xD4
269 #define ZZ9K_USB_RX_LO 0xD6
270 #define ZZ9K_USB_STATUS 0xD8
271 #define ZZ9K_USB_BUFSEL 0xDA
272 #define ZZ9K_USB_CAPACITY 0xDC
273
274 /* Hardware Status */
275 #define ZZ9K_TEMPERATURE 0xE0
276 #define ZZ9K_VOLTAGE_AUX 0xE2
277 #define ZZ9K_VOLTAGE_CORE 0xE4
278
279 /* Miscellaneous */
280 #define ZZ9K_PRINT_CHR 0xF0
281 #define ZZ9K_PRINT_HEX 0xF2
282 #define ZZ9K_AUDIO_CONFIG 0xF4
283
284 #define ZZ9K_DEBUG 0xFC
285 #define ZZ9K_DEBUG_TIMER 0xFE
286
287
288 #endif /* ZZ9KREG_H */
289