esmreg.h revision 1.1 1 1.1 rh /* $NetBSD: esmreg.h,v 1.1 2001/01/08 19:54:31 rh Exp $ */
2 1.1 rh
3 1.1 rh /*-
4 1.1 rh * Copyright (c) 2000, 2001 Rene Hexel <rh (at) netbsd.org>
5 1.1 rh * All rights reserved.
6 1.1 rh *
7 1.1 rh * Copyright (c) 1999-2000 Taku YAMAMOTO <taku (at) cent.saitama-u.ac.jp>
8 1.1 rh * All rights reserved.
9 1.1 rh *
10 1.1 rh * Redistribution and use in source and binary forms, with or without
11 1.1 rh * modification, are permitted provided that the following conditions
12 1.1 rh * are met:
13 1.1 rh * 1. Redistributions of source code must retain the above copyright
14 1.1 rh * notice, this list of conditions and the following disclaimer.
15 1.1 rh * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 rh * notice, this list of conditions and the following disclaimer in the
17 1.1 rh * documentation and/or other materials provided with the distribution.
18 1.1 rh *
19 1.1 rh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 1.1 rh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 1.1 rh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 1.1 rh * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 1.1 rh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 1.1 rh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 1.1 rh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 1.1 rh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 1.1 rh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 1.1 rh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 1.1 rh * SUCH DAMAGE.
30 1.1 rh *
31 1.1 rh * Taku Id: maestro_reg.h,v 1.10 2000/08/29 17:27:29 taku Exp
32 1.1 rh * FreeBSD: /c/ncvs/src/sys/dev/sound/pci/maestro_reg.h,v 1.1 2000/09/06 20:10:54 cg Exp
33 1.1 rh */
34 1.1 rh
35 1.1 rh #ifndef ESM_REG_H_INCLUDED
36 1.1 rh #define ESM_REG_H_INCLUDED
37 1.1 rh
38 1.1 rh /* -----------------------------
39 1.1 rh * PCI config registers
40 1.1 rh */
41 1.1 rh
42 1.1 rh /* Legacy emulation */
43 1.1 rh #define CONF_LEGACY 0x40
44 1.1 rh
45 1.1 rh #define LEGACY_DISABLED 0x8000
46 1.1 rh
47 1.1 rh /* Chip configurations */
48 1.1 rh #define CONF_MAESTRO 0x50
49 1.1 rh #define MAESTRO_CHIBUS 0x00100000
50 1.1 rh #define MAESTRO_POSTEDWRITE 0x00000080
51 1.1 rh #define MAESTRO_DMA_PCITIMING 0x00000040
52 1.1 rh #define MAESTRO_SWAP_LR 0x00000010
53 1.1 rh
54 1.1 rh /* ACPI configurations */
55 1.1 rh #define CONF_ACPI_STOPCLOCK 0x54
56 1.1 rh #define ACPI_PART_2ndC_CLOCK 15
57 1.1 rh #define ACPI_PART_CODEC_CLOCK 14
58 1.1 rh #define ACPI_PART_978 13 /* Docking station or something */
59 1.1 rh #define ACPI_PART_SPDIF 12
60 1.1 rh #define ACPI_PART_GLUE 11 /* What? */
61 1.1 rh #define ACPI_PART_DAA 10
62 1.1 rh #define ACPI_PART_PCI_IF 9
63 1.1 rh #define ACPI_PART_HW_VOL 8
64 1.1 rh #define ACPI_PART_GPIO 7
65 1.1 rh #define ACPI_PART_ASSP 6
66 1.1 rh #define ACPI_PART_SB 5
67 1.1 rh #define ACPI_PART_FM 4
68 1.1 rh #define ACPI_PART_RINGBUS 3
69 1.1 rh #define ACPI_PART_MIDI 2
70 1.1 rh #define ACPI_PART_GAME_PORT 1
71 1.1 rh #define ACPI_PART_WP 0
72 1.1 rh
73 1.1 rh /* Power management */
74 1.1 rh #define CONF_PM_PTR 0x34 /* BYTE R */
75 1.1 rh #define PM_CID 0 /* BYTE R */
76 1.1 rh #define PPMI_CID 1
77 1.1 rh #define PM_CTRL 4 /* BYTE RW */
78 1.1 rh #define PPMI_D0 0 /* Full power */
79 1.1 rh #define PPMI_D1 1 /* Medium power */
80 1.1 rh #define PPMI_D2 2 /* Low power */
81 1.1 rh #define PPMI_D3 3 /* Turned off */
82 1.1 rh
83 1.1 rh
84 1.1 rh /* -----------------------------
85 1.1 rh * I/O ports
86 1.1 rh */
87 1.1 rh
88 1.1 rh /* Direct Sound Processor (aka WP) */
89 1.1 rh #define PORT_DSP_DATA 0x00 /* WORD RW */
90 1.1 rh #define PORT_DSP_INDEX 0x02 /* WORD RW */
91 1.1 rh #define PORT_INT_STAT 0x04 /* WORD RW */
92 1.1 rh #define PORT_SAMPLE_CNT 0x06 /* WORD RO */
93 1.1 rh
94 1.1 rh /* WaveCache */
95 1.1 rh #define PORT_WAVCACHE_INDEX 0x10 /* WORD RW */
96 1.1 rh #define PORT_WAVCACHE_DATA 0x12 /* WORD RW */
97 1.1 rh #define WAVCACHE_PCMBAR 0x1fc
98 1.1 rh #define WAVCACHE_WTBAR 0x1f0
99 1.1 rh #define WAVCACHE_BASEADDR_SHIFT 12
100 1.1 rh
101 1.1 rh #define WAVCACHE_CHCTL_ADDRTAG_MASK 0xfff8
102 1.1 rh #define WAVCACHE_CHCTL_U8 0x0004
103 1.1 rh #define WAVCACHE_CHCTL_STEREO 0x0002
104 1.1 rh #define WAVCACHE_CHCTL_DECREMENTAL 0x0001
105 1.1 rh
106 1.1 rh #define PORT_WAVCACHE_CTRL 0x14 /* WORD RW */
107 1.1 rh #define WAVCACHE_EXTRA_CH_ENABLED 0x0200
108 1.1 rh #define WAVCACHE_ENABLED 0x0100
109 1.1 rh #define WAVCACHE_CH_60_ENABLED 0x0080
110 1.1 rh #define WAVCACHE_WTSIZE_MASK 0x0060
111 1.1 rh #define WAVCACHE_WTSIZE_1MB 0x0000
112 1.1 rh #define WAVCACHE_WTSIZE_2MB 0x0020
113 1.1 rh #define WAVCACHE_WTSIZE_4MB 0x0040
114 1.1 rh #define WAVCACHE_WTSIZE_8MB 0x0060
115 1.1 rh #define WAVCACHE_SGC_MASK 0x000c
116 1.1 rh #define WAVCACHE_SGC_DISABLED 0x0000
117 1.1 rh #define WAVCACHE_SGC_40_47 0x0004
118 1.1 rh #define WAVCACHE_SGC_32_47 0x0008
119 1.1 rh #define WAVCACHE_TESTMODE 0x0001
120 1.1 rh
121 1.1 rh /* Host Interruption */
122 1.1 rh #define PORT_HOSTINT_CTRL 0x18 /* WORD RW */
123 1.1 rh #define HOSTINT_CTRL_SOFT_RESET 0x8000
124 1.1 rh #define HOSTINT_CTRL_DSOUND_RESET 0x4000
125 1.1 rh #define HOSTINT_CTRL_HW_VOL_TO_PME 0x0400
126 1.1 rh #define HOSTINT_CTRL_CLKRUN_ENABLED 0x0100
127 1.1 rh #define HOSTINT_CTRL_HWVOL_ENABLED 0x0040
128 1.1 rh #define HOSTINT_CTRL_ASSP_INT_ENABLED 0x0010
129 1.1 rh #define HOSTINT_CTRL_ISDN_INT_ENABLED 0x0008
130 1.1 rh #define HOSTINT_CTRL_DSOUND_INT_ENABLED 0x0004
131 1.1 rh #define HOSTINT_CTRL_MPU401_INT_ENABLED 0x0002
132 1.1 rh #define HOSTINT_CTRL_SB_INT_ENABLED 0x0001
133 1.1 rh
134 1.1 rh #define PORT_HOSTINT_STAT 0x1a /* BYTE RW */
135 1.1 rh #define HOSTINT_STAT_HWVOL 0x40
136 1.1 rh #define HOSTINT_STAT_ASSP 0x10
137 1.1 rh #define HOSTINT_STAT_ISDN 0x08
138 1.1 rh #define HOSTINT_STAT_DSOUND 0x04
139 1.1 rh #define HOSTINT_STAT_MPU401 0x02
140 1.1 rh #define HOSTINT_STAT_SB 0x01
141 1.1 rh
142 1.1 rh /* Hardware volume */
143 1.1 rh #define PORT_HWVOL_VOICE_SHADOW 0x1c /* BYTE RW */
144 1.1 rh #define PORT_HWVOL_VOICE 0x1d /* BYTE RW */
145 1.1 rh #define PORT_HWVOL_MASTER_SHADOW 0x1e /* BYTE RW */
146 1.1 rh #define PORT_HWVOL_MASTER 0x1f /* BYTE RW */
147 1.1 rh
148 1.1 rh /* CODEC */
149 1.1 rh #define PORT_CODEC_CMD 0x30 /* BYTE W */
150 1.1 rh #define CODEC_CMD_READ 0x80
151 1.1 rh #define CODEC_CMD_WRITE 0x00
152 1.1 rh #define CODEC_CMD_ADDR_MASK 0x7f
153 1.1 rh
154 1.1 rh #define PORT_CODEC_STAT 0x30 /* BYTE R */
155 1.1 rh #define CODEC_STAT_MASK 0x01
156 1.1 rh #define CODEC_STAT_RW_DONE 0x00
157 1.1 rh #define CODEC_STAT_PROGLESS 0x01
158 1.1 rh
159 1.1 rh #define PORT_CODEC_REG 0x32 /* WORD RW */
160 1.1 rh
161 1.1 rh /* Ring bus control */
162 1.1 rh #define PORT_RINGBUS_CTRL 0x34 /* DWORD RW */
163 1.1 rh #define RINGBUS_CTRL_I2S_ENABLED 0x80000000
164 1.1 rh #define RINGBUS_CTRL_RINGBUS_ENABLED 0x20000000
165 1.1 rh #define RINGBUS_CTRL_ACLINK_ENABLED 0x10000000
166 1.1 rh #define RINGBUS_CTRL_AC97_SWRESET 0x08000000
167 1.1 rh #define RINGBUS_CTRL_IODMA_PLAYBACK_ENABLED 0x04000000
168 1.1 rh #define RINGBUS_CTRL_IODMA_RECORD_ENABLED 0x02000000
169 1.1 rh
170 1.1 rh #define RINGBUS_SRC_MIC 20
171 1.1 rh #define RINGBUS_SRC_I2S 16
172 1.1 rh #define RINGBUS_SRC_ADC 12
173 1.1 rh #define RINGBUS_SRC_MODEM 8
174 1.1 rh #define RINGBUS_SRC_DSOUND 4
175 1.1 rh #define RINGBUS_SRC_ASSP 0
176 1.1 rh
177 1.1 rh #define RINGBUS_DEST_MONORAL 000
178 1.1 rh #define RINGBUS_DEST_STEREO 010
179 1.1 rh #define RINGBUS_DEST_NONE 0
180 1.1 rh #define RINGBUS_DEST_DAC 1
181 1.1 rh #define RINGBUS_DEST_MODEM_IN 2
182 1.1 rh #define RINGBUS_DEST_RESERVED3 3
183 1.1 rh #define RINGBUS_DEST_DSOUND_IN 4
184 1.1 rh #define RINGBUS_DEST_ASSP_IN 5
185 1.1 rh
186 1.1 rh /* General Purpose I/O */
187 1.1 rh #define PORT_GPIO_DATA 0x60 /* WORD RW */
188 1.1 rh #define PORT_GPIO_MASK 0x64 /* WORD RW */
189 1.1 rh #define PORT_GPIO_DIR 0x68 /* WORD RW */
190 1.1 rh
191 1.1 rh /* Application Specific Signal Processor */
192 1.1 rh #define PORT_ASSP_MEM_INDEX 0x80 /* DWORD RW */
193 1.1 rh #define PORT_ASSP_MEM_DATA 0x84 /* WORD RW */
194 1.1 rh #define PORT_ASSP_CTRL_A 0xa2 /* BYTE RW */
195 1.1 rh #define PORT_ASSP_CTRL_B 0xa4 /* BYTE RW */
196 1.1 rh #define PORT_ASSP_CTRL_C 0xa6 /* BYTE RW */
197 1.1 rh #define PORT_ASSP_HOST_WR_INDEX 0xa8 /* BYTE W */
198 1.1 rh #define PORT_ASSP_HOST_WR_DATA 0xaa /* BYTE RW */
199 1.1 rh #define PORT_ASSP_INT_STAT 0xac /* BYTE RW */
200 1.1 rh
201 1.1 rh
202 1.1 rh /* -----------------------------
203 1.1 rh * Wave Processor Indexed Data Registers.
204 1.1 rh */
205 1.1 rh
206 1.1 rh #define WPREG_DATA_PORT 0
207 1.1 rh #define WPREG_CRAM_PTR 1
208 1.1 rh #define WPREG_CRAM_DATA 2
209 1.1 rh #define WPREG_WAVE_DATA 3
210 1.1 rh #define WPREG_WAVE_PTR_LOW 4
211 1.1 rh #define WPREG_WAVE_PTR_HIGH 5
212 1.1 rh
213 1.1 rh #define WPREG_TIMER_FREQ 6
214 1.1 rh #define WP_TIMER_FREQ_PRESCALE_MASK 0x00e0 /* actual - 9 */
215 1.1 rh #define WP_TIMER_FREQ_PRESCALE_SHIFT 5
216 1.1 rh #define WP_TIMER_FREQ_DIVIDE_MASK 0x001f
217 1.1 rh #define WP_TIMER_FREQ_DIVIDE_SHIFT 0
218 1.1 rh
219 1.1 rh #define WPREG_WAVE_ROMRAM 7
220 1.1 rh #define WP_WAVE_VIRTUAL_ENABLED 0x0400
221 1.1 rh #define WP_WAVE_8BITRAM_ENABLED 0x0200
222 1.1 rh #define WP_WAVE_DRAM_ENABLED 0x0100
223 1.1 rh #define WP_WAVE_RAMSPLIT_MASK 0x00ff
224 1.1 rh #define WP_WAVE_RAMSPLIT_SHIFT 0
225 1.1 rh
226 1.1 rh #define WPREG_BASE 12
227 1.1 rh #define WP_PARAOUT_BASE_MASK 0xf000
228 1.1 rh #define WP_PARAOUT_BASE_SHIFT 12
229 1.1 rh #define WP_PARAIN_BASE_MASK 0x0f00
230 1.1 rh #define WP_PARAIN_BASE_SHIFT 8
231 1.1 rh #define WP_SERIAL0_BASE_MASK 0x00f0
232 1.1 rh #define WP_SERIAL0_BASE_SHIFT 4
233 1.1 rh #define WP_SERIAL1_BASE_MASK 0x000f
234 1.1 rh #define WP_SERIAL1_BASE_SHIFT 0
235 1.1 rh
236 1.1 rh #define WPREG_TIMER_ENABLE 17
237 1.1 rh #define WPREG_TIMER_START 23
238 1.1 rh
239 1.1 rh
240 1.1 rh /* -----------------------------
241 1.1 rh * Audio Processing Unit.
242 1.1 rh */
243 1.1 rh #define APUREG_APUTYPE 0
244 1.1 rh #define APU_DMA_ENABLED 0x4000
245 1.1 rh #define APU_INT_ON_LOOP 0x2000
246 1.1 rh #define APU_ENDCURVE 0x1000
247 1.1 rh #define APU_APUTYPE_MASK 0x00f0
248 1.1 rh #define APU_FILTERTYPE_MASK 0x000c
249 1.1 rh #define APU_FILTERQ_MASK 0x0003
250 1.1 rh
251 1.1 rh /* APU types */
252 1.1 rh #define APU_APUTYPE_SHIFT 4
253 1.1 rh
254 1.1 rh #define APUTYPE_INACTIVE 0
255 1.1 rh #define APUTYPE_16BITLINEAR 1
256 1.1 rh #define APUTYPE_16BITSTEREO 2
257 1.1 rh #define APUTYPE_8BITLINEAR 3
258 1.1 rh #define APUTYPE_8BITSTEREO 4
259 1.1 rh #define APUTYPE_8BITDIFF 5
260 1.1 rh #define APUTYPE_DIGITALDELAY 6
261 1.1 rh #define APUTYPE_DUALTAP_READER 7
262 1.1 rh #define APUTYPE_CORRELATOR 8
263 1.1 rh #define APUTYPE_INPUTMIXER 9
264 1.1 rh #define APUTYPE_WAVETABLE 10
265 1.1 rh #define APUTYPE_RATECONV 11
266 1.1 rh #define APUTYPE_16BITPINGPONG 12
267 1.1 rh /* APU type 13 through 15 are reserved. */
268 1.1 rh
269 1.1 rh /* Filter types */
270 1.1 rh #define APU_FILTERTYPE_SHIFT 2
271 1.1 rh
272 1.1 rh #define FILTERTYPE_2POLE_LOPASS 0
273 1.1 rh #define FILTERTYPE_2POLE_BANDPASS 1
274 1.1 rh #define FILTERTYPE_2POLE_HIPASS 2
275 1.1 rh #define FILTERTYPE_1POLE_LOPASS 3
276 1.1 rh #define FILTERTYPE_1POLE_HIPASS 4
277 1.1 rh #define FILTERTYPE_PASSTHROUGH 5
278 1.1 rh
279 1.1 rh /* Filter Q */
280 1.1 rh #define APU_FILTERQ_SHIFT 0
281 1.1 rh
282 1.1 rh #define FILTERQ_LESSQ 0
283 1.1 rh #define FILTERQ_MOREQ 3
284 1.1 rh
285 1.1 rh /* APU register 2 */
286 1.1 rh #define APUREG_FREQ_LOBYTE 2
287 1.1 rh #define APU_FREQ_LOBYTE_MASK 0xff00
288 1.1 rh #define APU_plus6dB 0x0010
289 1.1 rh
290 1.1 rh /* APU register 3 */
291 1.1 rh #define APUREG_FREQ_HIWORD 3
292 1.1 rh #define APU_FREQ_HIWORD_MASK 0x0fff
293 1.1 rh
294 1.1 rh /* Frequency */
295 1.1 rh #define APU_FREQ_LOBYTE_SHIFT 8
296 1.1 rh #define APU_FREQ_HIWORD_SHIFT 0
297 1.1 rh #define FREQ_Hz2DIV(freq) (((u_int64_t)(freq) << 16) / 48000)
298 1.1 rh
299 1.1 rh /* APU register 4 */
300 1.1 rh #define APUREG_WAVESPACE 4
301 1.1 rh #define APU_STEREO 0x8000
302 1.1 rh #define APU_USE_SYSMEM 0x4000
303 1.1 rh #define APU_PCMBAR_MASK 0x6000
304 1.1 rh #define APU_64KPAGE_MASK 0xff00
305 1.1 rh
306 1.1 rh /* PCM Base Address Register selection */
307 1.1 rh #define APU_PCMBAR_SHIFT 13
308 1.1 rh
309 1.1 rh /* 64KW (==128KB) Page */
310 1.1 rh #define APU_64KPAGE_SHIFT 8
311 1.1 rh
312 1.1 rh /* APU register 5 - 7 */
313 1.1 rh #define APUREG_CURPTR 5
314 1.1 rh #define APUREG_ENDPTR 6
315 1.1 rh #define APUREG_LOOPLEN 7
316 1.1 rh
317 1.1 rh /* APU register 9 */
318 1.1 rh #define APUREG_AMPLITUDE 9
319 1.1 rh #define APU_AMPLITUDE_NOW_MASK 0xff00
320 1.1 rh #define APU_AMPLITUDE_DEST_MASK 0x00ff
321 1.1 rh
322 1.1 rh /* Amplitude now? */
323 1.1 rh #define APU_AMPLITUDE_NOW_SHIFT 8
324 1.1 rh
325 1.1 rh /* APU register 10 */
326 1.1 rh #define APUREG_POSITION 10
327 1.1 rh #define APU_RADIUS_MASK 0x00c0
328 1.1 rh #define APU_PAN_MASK 0x003f
329 1.1 rh
330 1.1 rh /* Radius control. */
331 1.1 rh #define APU_RADIUS_SHIFT 6
332 1.1 rh #define RADIUS_CENTERCIRCLE 0
333 1.1 rh #define RADIUS_MIDDLE 1
334 1.1 rh #define RADIUS_OUTSIDE 2
335 1.1 rh
336 1.1 rh /* Polar pan. */
337 1.1 rh #define APU_PAN_SHIFT 0
338 1.1 rh #define PAN_RIGHT 0x00
339 1.1 rh #define PAN_FRONT 0x08
340 1.1 rh #define PAN_LEFT 0x10
341 1.1 rh
342 1.1 rh
343 1.1 rh /* -----------------------------
344 1.1 rh * Limits.
345 1.1 rh */
346 1.1 rh #define WPWA_MAX ((1 << 22) - 1)
347 1.1 rh #define WPWA_MAXADDR ((1 << 23) - 1)
348 1.1 rh #define MAESTRO_MAXADDR ((1 << 28) - 1)
349 1.1 rh #define WPTIMER_MINDIV 4
350 1.1 rh #define WPTIMER_MAXDIV (32 << 8)
351 1.1 rh
352 1.1 rh #endif /* ESM_REG_H_INCLUDED */
353