opl3sa3reg.h revision 1.2 1 1.2 itohy /* $NetBSD: opl3sa3reg.h,v 1.2 2002/03/10 13:57:10 itohy Exp $ */
2 1.1 itohy
3 1.1 itohy /*-
4 1.1 itohy * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 1.1 itohy * All rights reserved.
6 1.1 itohy *
7 1.1 itohy * This code is derived from software contributed to The NetBSD Foundation
8 1.1 itohy * by ITOH Yasufumi.
9 1.1 itohy *
10 1.1 itohy * Redistribution and use in source and binary forms, with or without
11 1.1 itohy * modification, are permitted provided that the following conditions
12 1.1 itohy * are met:
13 1.1 itohy * 1. Redistributions of source code must retain the above copyright
14 1.1 itohy * notice, this list of conditions and the following disclaimer.
15 1.1 itohy * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 itohy * notice, this list of conditions and the following disclaimer in the
17 1.1 itohy * documentation and/or other materials provided with the distribution.
18 1.1 itohy * 3. All advertising materials mentioning features or use of this software
19 1.1 itohy * must display the following acknowledgement:
20 1.1 itohy * This product includes software developed by the NetBSD
21 1.1 itohy * Foundation, Inc. and its contributors.
22 1.1 itohy * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 itohy * contributors may be used to endorse or promote products derived
24 1.1 itohy * from this software without specific prior written permission.
25 1.1 itohy *
26 1.1 itohy * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 itohy * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 itohy * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 itohy * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 itohy * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 itohy * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 itohy * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 itohy * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 itohy * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 itohy * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 itohy * POSSIBILITY OF SUCH DAMAGE.
37 1.1 itohy */
38 1.1 itohy
39 1.1 itohy /*
40 1.2 itohy * YAMAHA YMF711 (OPL3 Single-chip Audio System 2; OPL3-SA2)
41 1.1 itohy * YAMAHA YMF715x (OPL3 Single-chip Audio System 3; OPL3-SA3)
42 1.1 itohy * control register description
43 1.1 itohy *
44 1.1 itohy * Other ports (SBpro, WSS CODEC, MPU401, OPL3, etc.) are NOT listed here.
45 1.1 itohy */
46 1.1 itohy
47 1.2 itohy /* [2]: OPL3-SA2 only, [3]: OPL3-SA3 only */
48 1.2 itohy
49 1.1 itohy /*
50 1.1 itohy * direct registers
51 1.1 itohy */
52 1.1 itohy
53 1.1 itohy /* offset from the base address */
54 1.1 itohy #define SA3_CTL_INDEX 0 /* Index port (R/W) */
55 1.1 itohy #define SA3_CTL_DATA 1 /* Data register port (R/W) */
56 1.1 itohy
57 1.1 itohy #define SA3_CTL_NPORT 2 /* number of ports */
58 1.1 itohy
59 1.1 itohy /*
60 1.1 itohy * indirect registers
61 1.1 itohy */
62 1.1 itohy
63 1.1 itohy #define SA3_PWR_MNG 0x01 /* Power management (R/W) */
64 1.2 itohy #define SA2_PWR_MNG_SRST 0x80 /* [2] Software reset */
65 1.2 itohy #define SA3_PWR_MNG_ADOWN 0x20 /* [3] Analog Down */
66 1.2 itohy #define SA2_PWR_MNG_CLKO 0x10 /* [2] Master Clock disable */
67 1.2 itohy #define SA2_PWR_MNG_FMPS 0x08 /* [2] OPL3 power down */
68 1.1 itohy #define SA3_PWR_MNG_PSV 0x04 /* Power save */
69 1.1 itohy #define SA3_PWR_MNG_PDN 0x02 /* Power down */
70 1.1 itohy #define SA3_PWR_MNG_PDX 0x01 /* Oscillation stop */
71 1.1 itohy #define SA3_PWR_MNG_DEFAULT 0x00 /* default value */
72 1.1 itohy
73 1.1 itohy #define SA3_SYS_CTL 0x02 /* System control (R/W) */
74 1.1 itohy #define SA3_SYS_CTL_SBHE 0x80 /* 0: AT-bus, 1: XT-bus */
75 1.2 itohy #define SA3_SYS_CTL_YMODE 0x30 /* [3] 3D Enhancement mode */
76 1.1 itohy #define SA3_SYS_CTL_YMODE0 0x00 /* Desktop mode (speaker 5-12cm) */
77 1.1 itohy #define SA3_SYS_CTL_YMODE1 0x10 /* Notebook PC mode (1) (3cm) */
78 1.1 itohy #define SA3_SYS_CTL_YMODE2 0x20 /* Notebook PC mode (2) (1.5cm) */
79 1.1 itohy #define SA3_SYS_CTL_YMODE3 0x30 /* Hi-Fi mode (16-38cm) */
80 1.1 itohy #define SA3_SYS_CTL_IDSEL 0x06 /* Specify DSP version of SBPro */
81 1.1 itohy #define SA3_SYS_CTL_IDSEL0 0x00 /* major 0x03, minor 0x01 */
82 1.1 itohy #define SA3_SYS_CTL_IDSEL1 0x02 /* major 0x02, minor 0x01 */
83 1.1 itohy #define SA3_SYS_CTL_IDSEL2 0x04 /* major 0x01, minor 0x05 */
84 1.1 itohy #define SA3_SYS_CTL_IDSEL3 0x06 /* major 0x00, minor 0x00 */
85 1.1 itohy #define SA3_SYS_CTL_VZE 0x01 /* ZV */
86 1.1 itohy #define SA3_SYS_CTL_DEFAULT 0x00 /* default value */
87 1.1 itohy
88 1.1 itohy #define SA3_IRQ_CONF 0x03 /* Interrupt Channel config (R/W) */
89 1.1 itohy #define SA3_IRQ_CONF_OPL3_B 0x80 /* OPL3 uses IRQ-B */
90 1.1 itohy #define SA3_IRQ_CONF_MPU_B 0x40 /* MPU401 uses IRQ-B */
91 1.1 itohy #define SA3_IRQ_CONF_SB_B 0x20 /* Sound Blaster uses IRQ-B */
92 1.1 itohy #define SA3_IRQ_CONF_WSS_B 0x10 /* WSS CODEC uses IRQ-B */
93 1.1 itohy #define SA3_IRQ_CONF_OPL3_A 0x08 /* OPL3 uses IRQ-A */
94 1.1 itohy #define SA3_IRQ_CONF_MPU_A 0x04 /* MPU401 uses IRQ-A */
95 1.1 itohy #define SA3_IRQ_CONF_SB_A 0x02 /* Sound Blaster uses IRQ-A */
96 1.1 itohy #define SA3_IRQ_CONF_WSS_A 0x01 /* WSS CODEC uses IRQ-A */
97 1.1 itohy #define SA3_IRQ_CONF_DEFAULT (SA3_IRQ_CONF_MPU_B | SA3_IRQ_CONF_SB_B | \
98 1.1 itohy SA3_IRQ_CONF_OPL3_A | SA3_IRQ_CONF_WSS_A)
99 1.1 itohy
100 1.1 itohy #define SA3_IRQA_STAT 0x04 /* Interrupt (IRQ-A) STATUS (RO) */
101 1.1 itohy #define SA3_IRQB_STAT 0x05 /* Interrupt (IRQ-B) STATUS (RO) */
102 1.2 itohy #define SA3_IRQ_STAT_MV 0x40 /* [3] Hardware Volume Interrupt */
103 1.1 itohy #define SA3_IRQ_STAT_OPL3 0x20 /* Internal FM-synthesizer timer */
104 1.1 itohy #define SA3_IRQ_STAT_MPU 0x10 /* MPU401 Interrupt */
105 1.1 itohy #define SA3_IRQ_STAT_SB 0x08 /* Sound Blaster Playback Interrupt */
106 1.1 itohy #define SA3_IRQ_STAT_TI 0x04 /* Timer Flag of CODEC */
107 1.1 itohy #define SA3_IRQ_STAT_CI 0x02 /* Recording Flag of CODEC */
108 1.1 itohy #define SA3_IRQ_STAT_PI 0x01 /* Playback Flag of CODEC */
109 1.1 itohy
110 1.1 itohy #define SA3_DMA_CONF 0x06 /* DMA configuration (R/W) */
111 1.1 itohy #define SA3_DMA_CONF_SB_B 0x40 /* Sound Blaster playback uses DMA-B */
112 1.1 itohy #define SA3_DMA_CONF_WSS_R_B 0x20 /* WSS CODEC recording uses DMA-B */
113 1.1 itohy #define SA3_DMA_CONF_WSS_P_B 0x10 /* WSS CODEC playback uses DMA-B */
114 1.1 itohy #define SA3_DMA_CONF_SB_A 0x04 /* Sound Blaster playback uses DMA-A */
115 1.1 itohy #define SA3_DMA_CONF_WSS_R_A 0x02 /* WSS CODEC recording uses DMA-A */
116 1.1 itohy #define SA3_DMA_CONF_WSS_P_A 0x01 /* WSS CODEC playback uses DMA-A */
117 1.1 itohy #define SA3_DMA_CONF_DEFAULT (SA3_DMA_CONF_SB_B | SA3_DMA_CONF_WSS_R_B | \
118 1.1 itohy SA3_DMA_CONF_WSS_P_A)
119 1.1 itohy
120 1.1 itohy #define SA3_VOL_L 0x07 /* Master Volume Lch (R/W) */
121 1.1 itohy #define SA3_VOL_R 0x08 /* Master Volume Rch (R/W) */
122 1.1 itohy #define SA3_VOL_MUTE 0x80 /* Mute the channel */
123 1.1 itohy #define SA3_VOL_MV 0x0f /* Master Volume bits */
124 1.1 itohy #define SA3_VOL_MV_0 0x00 /* 0dB (maximum volume) */
125 1.1 itohy #define SA3_VOL_MV_2 0x01 /* -2dB */
126 1.1 itohy #define SA3_VOL_MV_4 0x02 /* -4dB */
127 1.1 itohy #define SA3_VOL_MV_6 0x03 /* -6dB */
128 1.1 itohy #define SA3_VOL_MV_8 0x04 /* -8dB */
129 1.1 itohy #define SA3_VOL_MV_10 0x05 /* -10dB */
130 1.1 itohy #define SA3_VOL_MV_12 0x06 /* -12dB */
131 1.1 itohy #define SA3_VOL_MV_14 0x07 /* -14dB (default) */
132 1.1 itohy #define SA3_VOL_MV_16 0x08 /* -16dB */
133 1.1 itohy #define SA3_VOL_MV_18 0x09 /* -18dB */
134 1.1 itohy #define SA3_VOL_MV_20 0x0a /* -20dB */
135 1.1 itohy #define SA3_VOL_MV_22 0x0b /* -22dB */
136 1.1 itohy #define SA3_VOL_MV_24 0x0c /* -24dB */
137 1.1 itohy #define SA3_VOL_MV_26 0x0d /* -26dB */
138 1.1 itohy #define SA3_VOL_MV_28 0x0e /* -28dB */
139 1.1 itohy #define SA3_VOL_MV_30 0x0f /* -30dB (minimum volume) */
140 1.1 itohy #define SA3_VOL_DEFAULT SA3_VOL_MV_14
141 1.1 itohy
142 1.1 itohy #define SA3_MIC_VOL 0x09 /* MIC Volume (R/W) */
143 1.1 itohy #define SA3_MIC_MUTE 0x80 /* Mute Mic Volume */
144 1.1 itohy #define SA3_MIC_MCV 0x1f /* Mic volume bits */
145 1.1 itohy #define SA3_MIC_MCV12 0x00 /* +12.0dB (maximum volume) */
146 1.1 itohy #define SA3_MIC_MCV10_5 0x01 /* +10.5dB */
147 1.1 itohy #define SA3_MIC_MCV9 0x02 /* +9.0dB */
148 1.1 itohy #define SA3_MIC_MCV7_5 0x03 /* +7.5dB */
149 1.1 itohy #define SA3_MIC_MCV6 0x04 /* +6.0dB */
150 1.1 itohy #define SA3_MIC_MCV4_5 0x05 /* +4.5dB */
151 1.1 itohy #define SA3_MIC_MCV3 0x06 /* +3.0dB */
152 1.1 itohy #define SA3_MIC_MCV1_5 0x07 /* +1.5dB */
153 1.1 itohy #define SA3_MIC_MCV_0 0x08 /* 0.0dB (default) */
154 1.1 itohy #define SA3_MIC_MCV_1_5 0x09 /* -1.5dB */
155 1.1 itohy #define SA3_MIC_MCV_3_0 0x0a /* -3.0dB */
156 1.1 itohy #define SA3_MIC_MCV_4_5 0x0b /* -4.5dB */
157 1.1 itohy #define SA3_MIC_MCV_6 0x0c /* -6.0dB */
158 1.1 itohy #define SA3_MIC_MCV_7_5 0x0d /* -7.5dB */
159 1.1 itohy #define SA3_MIC_MCV_9 0x0e /* -9.0dB */
160 1.1 itohy #define SA3_MIC_MCV_10_5 0x0f /* -10.5dB */
161 1.1 itohy #define SA3_MIC_MCV_12 0x10 /* -12.0dB */
162 1.1 itohy #define SA3_MIC_MCV_13_5 0x11 /* -13.5dB */
163 1.1 itohy #define SA3_MIC_MCV_15 0x12 /* -15.0dB */
164 1.1 itohy #define SA3_MIC_MCV_16_5 0x13 /* -16.5dB */
165 1.1 itohy #define SA3_MIC_MCV_18 0x14 /* -18.0dB */
166 1.1 itohy #define SA3_MIC_MCV_19_5 0x15 /* -19.5dB */
167 1.1 itohy #define SA3_MIC_MCV_21 0x16 /* -21.0dB */
168 1.1 itohy #define SA3_MIC_MCV_22_5 0x17 /* -22.5dB */
169 1.1 itohy #define SA3_MIC_MCV_24 0x18 /* -24.0dB */
170 1.1 itohy #define SA3_MIC_MCV_25_5 0x19 /* -25.5dB */
171 1.1 itohy #define SA3_MIC_MCV_27 0x1a /* -27.0dB */
172 1.1 itohy #define SA3_MIC_MCV_28_5 0x1b /* -28.5dB */
173 1.1 itohy #define SA3_MIC_MCV_30 0x1c /* -30.0dB */
174 1.1 itohy #define SA3_MIC_MCV_31_5 0x1d /* -31.5dB */
175 1.1 itohy #define SA3_MIC_MCV_33 0x1e /* -33.0dB */
176 1.1 itohy #define SA3_MIC_MCV_34_5 0x1f /* -34.5dB (minimum volume) */
177 1.1 itohy #define SA3_MIC_VOL_DEFAULT (SA3_MIC_MUTE | SA3_MIC_MCV_0)
178 1.1 itohy
179 1.1 itohy #define SA3_MISC 0x0a /* Miscellaneous */
180 1.1 itohy #define SA3_MISC_VEN 0x80 /* Enable hardware volume control */
181 1.1 itohy #define SA3_MISC_MCSW 0x10 /* A/D is connected to 0: Rch of Mic,
182 1.1 itohy 1: loopback of monaural output */
183 1.1 itohy #define SA3_MISC_MODE 0x08 /* 0: SB mode, 1: WSS mode (RO) */
184 1.2 itohy #define SA3_MISC_VER 0x07 /* Version of OPL3-SA2/OPL3-SA3 (RO) */
185 1.2 itohy #define SA3_MISC_VER_711 1 /* OPL3-SA2 (YMF711) */
186 1.2 itohy #define SA3_MISC_VER_715 2 /* OPL3-SA3 (YMF715) */
187 1.2 itohy #define SA3_MISC_VER_715B 3 /* OPL3-SA3 (YMF715B) */
188 1.2 itohy #define SA3_MISC_VER_715E 4 /* OPL3-SA3 (YMF715E) */
189 1.2 itohy /* (4 or 5?) */
190 1.2 itohy /*#define SA3_MISC_DEFAULT (SA3_MISC_VEN | version) */
191 1.1 itohy
192 1.1 itohy /* WSS DMA Base counters (R/W) used for suspend/resume */
193 1.1 itohy #define SA3_DMA_CNT_PLAY_LOW 0x0b /* Playback Base Counter (Low) */
194 1.1 itohy #define SA3_DMA_CNT_PLAY_HIGH 0x0c /* Playback Base Counter (High) */
195 1.1 itohy #define SA3_DMA_CNT_REC_LOW 0x0d /* Recording Base Counter (Low) */
196 1.1 itohy #define SA3_DMA_CNT_REC_HIGH 0x0e /* Recording Base Counter (High) */
197 1.1 itohy
198 1.2 itohy /* [3] */
199 1.2 itohy #define SA3_WSS_INT_SCAN 0x0f /* WSS Interrupt Scan out/in (R/W)*/
200 1.1 itohy #define SA3_WSS_INT_SCAN_STI 0x04 /* 1: TI = "1" and IRQ active */
201 1.1 itohy #define SA3_WSS_INT_SCAN_SCI 0x02 /* 1: CI = "1" and IRQ active */
202 1.1 itohy #define SA3_WSS_INT_SCAN_SPI 0x01 /* 1: PI = "1" and IRQ active */
203 1.1 itohy #define SA3_WSS_INT_DEFAULT 0x00 /* default value */
204 1.1 itohy
205 1.2 itohy /* [3] */
206 1.1 itohy #define SA3_SB_SCAN 0x10 /* SB Internal State Scan out/in (R/W)*/
207 1.1 itohy #define SA3_SB_SCAN_SBPDA 0x80 /* Sound Blaster Power Down ack */
208 1.1 itohy #define SA3_SB_SCAN_SS 0x08 /* Scan Select */
209 1.1 itohy #define SA3_SB_SCAN_SM 0x04 /* Scan Mode 1: read out, 0: write in */
210 1.1 itohy #define SA3_SB_SCAN_SE 0x02 /* Scan Enable */
211 1.1 itohy #define SA3_SB_SCAN_SBPDR 0x01 /* Sound Blaster Power Down Request */
212 1.1 itohy #define SA3_SB_SCAN_DEFAULT 0x00 /* default value */
213 1.1 itohy
214 1.2 itohy /* [3] */
215 1.1 itohy #define SA3_SB_SCAN_DATA 0x11 /* SB Internal State Scan Data (R/W)*/
216 1.1 itohy
217 1.2 itohy /* [3] */
218 1.1 itohy #define SA3_DPWRDWN 0x12 /* Digital Partial Power Down (R/W) */
219 1.1 itohy #define SA3_DPWRDWN_JOY 0x80 /* Joystick power down */
220 1.1 itohy #define SA3_DPWRDWN_MPU 0x40 /* MPU401 power down */
221 1.1 itohy #define SA3_DPWRDWN_MCLKO 0x20 /* Master Clock disable */
222 1.1 itohy #define SA3_DPWRDWN_FM 0x10 /* FM (OPL3) power down */
223 1.1 itohy #define SA3_DPWRDWN_WSS_R 0x08 /* WSS recording power down */
224 1.1 itohy #define SA3_DPWRDWN_WSS_P 0x04 /* WSS playback power down */
225 1.1 itohy #define SA3_DPWRDWN_SB 0x02 /* Sound Blaster power down */
226 1.1 itohy #define SA3_DPWRDWN_PNP 0x01 /* PnP power down */
227 1.1 itohy #define SA3_DPWRDWN_DEFAULT 0x00 /* default value */
228 1.1 itohy
229 1.2 itohy /* [3] */
230 1.1 itohy #define SA3_APWRDWN 0x13 /* Analog Partial Power Down (R/W) */
231 1.1 itohy #define SA3_APWRDWN_FMDAC 0x10 /* FMDAC for OPL3 power down */
232 1.1 itohy #define SA3_APWRDWN_AD 0x08 /* A/D for WSS recording power down */
233 1.1 itohy #define SA3_APWRDWN_DA 0x04 /* D/A for WSS playback power down */
234 1.1 itohy #define SA3_APWRDWN_SBDAC 0x02 /* D/A for SB power down */
235 1.1 itohy #define SA3_APWRDWN_WIDE 0x01 /* Wide Stereo power down */
236 1.1 itohy #define SA3_APWRDWN_DEFAULT 0x00 /* default value */
237 1.1 itohy
238 1.2 itohy /* [3] */
239 1.1 itohy #define SA3_3D_WIDE 0x14 /* 3D Enhanced control (WIDE) (R/W) */
240 1.1 itohy #define SA3_3D_WIDE_WIDER 0x70 /* Rch of wide 3D enhanced control */
241 1.1 itohy #define SA3_3D_WIDE_WIDEL 0x07 /* Lch of wide 3D enhanced control */
242 1.1 itohy #define SA3_3D_WIDE_DEFAULT 0x00 /* default value */
243 1.1 itohy
244 1.2 itohy /* [3] */
245 1.1 itohy #define SA3_3D_BASS 0x15 /* 3D Enhanced control (BASS) (R/W) */
246 1.1 itohy #define SA3_3D_BASS_BASSR 0x70 /* Rch of bass 3D enhanced control */
247 1.1 itohy #define SA3_3D_BASS_BASSL 0x07 /* Lch of bass 3D enhanced control */
248 1.1 itohy #define SA3_3D_BASS_DEFAULT 0x00 /* default value */
249 1.1 itohy
250 1.2 itohy /* [3] */
251 1.1 itohy #define SA3_3D_TREBLE 0x16 /* 3D Enhanced control (TREBLE) (R/W) */
252 1.1 itohy #define SA3_3D_TREBLE_TRER 0x70 /* Rch of treble 3D enhanced control */
253 1.1 itohy #define SA3_3D_TREBLE_TREL 0x07 /* Lch of treble 3D enhanced control */
254 1.1 itohy #define SA3_3D_TREBLE_DEFAULT 0x00 /* default value */
255 1.1 itohy
256 1.1 itohy /* common to the 3D enhance registers */
257 1.1 itohy #define SA3_3D_BITS 0x07
258 1.1 itohy #define SA3_3D_LSHIFT 0
259 1.1 itohy #define SA3_3D_RSHIFT 4
260 1.1 itohy
261 1.2 itohy /* [3] */
262 1.1 itohy #define SA3_HVOL_INTR_CNF 0x17 /* Hardware Volume Intr Channel (R/W) */
263 1.1 itohy #define SA3_HVOL_INTR_CNF_B 0x20 /* Hardware Volume uses IRQ-B */
264 1.1 itohy #define SA3_HVOL_INTR_CNF_A 0x10 /* Hardware Volume uses IRQ-A */
265 1.1 itohy #define SA3_HVOL_INTR_CNF_DEFAULT 0x00
266 1.1 itohy
267 1.2 itohy /* [3] */
268 1.1 itohy #define SA3_MULTI_STAT 0x18 /* Multi-purpose Select Pin Stat (RO) */
269 1.1 itohy #define SA3_MULTI_STAT_SEL 0x70 /* State of SEL2-0 pins */
270