esmreg.h revision 1.6 1 1.6 christos /* $NetBSD: esmreg.h,v 1.6 2005/12/11 12:22:49 christos Exp $ */
2 1.1 rh
3 1.1 rh /*-
4 1.5 keihan * 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 /* -----------------------------
74 1.1 rh * I/O ports
75 1.1 rh */
76 1.1 rh
77 1.1 rh /* Direct Sound Processor (aka WP) */
78 1.1 rh #define PORT_DSP_DATA 0x00 /* WORD RW */
79 1.1 rh #define PORT_DSP_INDEX 0x02 /* WORD RW */
80 1.1 rh #define PORT_INT_STAT 0x04 /* WORD RW */
81 1.1 rh #define PORT_SAMPLE_CNT 0x06 /* WORD RO */
82 1.1 rh
83 1.1 rh /* WaveCache */
84 1.1 rh #define PORT_WAVCACHE_INDEX 0x10 /* WORD RW */
85 1.1 rh #define PORT_WAVCACHE_DATA 0x12 /* WORD RW */
86 1.1 rh #define WAVCACHE_PCMBAR 0x1fc
87 1.1 rh #define WAVCACHE_WTBAR 0x1f0
88 1.1 rh #define WAVCACHE_BASEADDR_SHIFT 12
89 1.1 rh
90 1.1 rh #define WAVCACHE_CHCTL_ADDRTAG_MASK 0xfff8
91 1.1 rh #define WAVCACHE_CHCTL_U8 0x0004
92 1.1 rh #define WAVCACHE_CHCTL_STEREO 0x0002
93 1.1 rh #define WAVCACHE_CHCTL_DECREMENTAL 0x0001
94 1.1 rh
95 1.1 rh #define PORT_WAVCACHE_CTRL 0x14 /* WORD RW */
96 1.1 rh #define WAVCACHE_EXTRA_CH_ENABLED 0x0200
97 1.1 rh #define WAVCACHE_ENABLED 0x0100
98 1.1 rh #define WAVCACHE_CH_60_ENABLED 0x0080
99 1.1 rh #define WAVCACHE_WTSIZE_MASK 0x0060
100 1.1 rh #define WAVCACHE_WTSIZE_1MB 0x0000
101 1.1 rh #define WAVCACHE_WTSIZE_2MB 0x0020
102 1.1 rh #define WAVCACHE_WTSIZE_4MB 0x0040
103 1.1 rh #define WAVCACHE_WTSIZE_8MB 0x0060
104 1.1 rh #define WAVCACHE_SGC_MASK 0x000c
105 1.1 rh #define WAVCACHE_SGC_DISABLED 0x0000
106 1.1 rh #define WAVCACHE_SGC_40_47 0x0004
107 1.1 rh #define WAVCACHE_SGC_32_47 0x0008
108 1.1 rh #define WAVCACHE_TESTMODE 0x0001
109 1.1 rh
110 1.1 rh /* Host Interruption */
111 1.1 rh #define PORT_HOSTINT_CTRL 0x18 /* WORD RW */
112 1.1 rh #define HOSTINT_CTRL_SOFT_RESET 0x8000
113 1.1 rh #define HOSTINT_CTRL_DSOUND_RESET 0x4000
114 1.1 rh #define HOSTINT_CTRL_HW_VOL_TO_PME 0x0400
115 1.1 rh #define HOSTINT_CTRL_CLKRUN_ENABLED 0x0100
116 1.1 rh #define HOSTINT_CTRL_HWVOL_ENABLED 0x0040
117 1.1 rh #define HOSTINT_CTRL_ASSP_INT_ENABLED 0x0010
118 1.1 rh #define HOSTINT_CTRL_ISDN_INT_ENABLED 0x0008
119 1.1 rh #define HOSTINT_CTRL_DSOUND_INT_ENABLED 0x0004
120 1.1 rh #define HOSTINT_CTRL_MPU401_INT_ENABLED 0x0002
121 1.1 rh #define HOSTINT_CTRL_SB_INT_ENABLED 0x0001
122 1.1 rh
123 1.1 rh #define PORT_HOSTINT_STAT 0x1a /* BYTE RW */
124 1.1 rh #define HOSTINT_STAT_HWVOL 0x40
125 1.1 rh #define HOSTINT_STAT_ASSP 0x10
126 1.1 rh #define HOSTINT_STAT_ISDN 0x08
127 1.1 rh #define HOSTINT_STAT_DSOUND 0x04
128 1.1 rh #define HOSTINT_STAT_MPU401 0x02
129 1.1 rh #define HOSTINT_STAT_SB 0x01
130 1.1 rh
131 1.1 rh /* Hardware volume */
132 1.1 rh #define PORT_HWVOL_VOICE_SHADOW 0x1c /* BYTE RW */
133 1.1 rh #define PORT_HWVOL_VOICE 0x1d /* BYTE RW */
134 1.1 rh #define PORT_HWVOL_MASTER_SHADOW 0x1e /* BYTE RW */
135 1.1 rh #define PORT_HWVOL_MASTER 0x1f /* BYTE RW */
136 1.1 rh
137 1.1 rh /* CODEC */
138 1.1 rh #define PORT_CODEC_CMD 0x30 /* BYTE W */
139 1.1 rh #define CODEC_CMD_READ 0x80
140 1.1 rh #define CODEC_CMD_WRITE 0x00
141 1.1 rh #define CODEC_CMD_ADDR_MASK 0x7f
142 1.1 rh
143 1.1 rh #define PORT_CODEC_STAT 0x30 /* BYTE R */
144 1.1 rh #define CODEC_STAT_MASK 0x01
145 1.1 rh #define CODEC_STAT_RW_DONE 0x00
146 1.1 rh #define CODEC_STAT_PROGLESS 0x01
147 1.1 rh
148 1.1 rh #define PORT_CODEC_REG 0x32 /* WORD RW */
149 1.1 rh
150 1.1 rh /* Ring bus control */
151 1.1 rh #define PORT_RINGBUS_CTRL 0x34 /* DWORD RW */
152 1.1 rh #define RINGBUS_CTRL_I2S_ENABLED 0x80000000
153 1.1 rh #define RINGBUS_CTRL_RINGBUS_ENABLED 0x20000000
154 1.1 rh #define RINGBUS_CTRL_ACLINK_ENABLED 0x10000000
155 1.1 rh #define RINGBUS_CTRL_AC97_SWRESET 0x08000000
156 1.1 rh #define RINGBUS_CTRL_IODMA_PLAYBACK_ENABLED 0x04000000
157 1.1 rh #define RINGBUS_CTRL_IODMA_RECORD_ENABLED 0x02000000
158 1.1 rh
159 1.1 rh #define RINGBUS_SRC_MIC 20
160 1.1 rh #define RINGBUS_SRC_I2S 16
161 1.1 rh #define RINGBUS_SRC_ADC 12
162 1.1 rh #define RINGBUS_SRC_MODEM 8
163 1.1 rh #define RINGBUS_SRC_DSOUND 4
164 1.1 rh #define RINGBUS_SRC_ASSP 0
165 1.1 rh
166 1.1 rh #define RINGBUS_DEST_MONORAL 000
167 1.1 rh #define RINGBUS_DEST_STEREO 010
168 1.1 rh #define RINGBUS_DEST_NONE 0
169 1.1 rh #define RINGBUS_DEST_DAC 1
170 1.1 rh #define RINGBUS_DEST_MODEM_IN 2
171 1.1 rh #define RINGBUS_DEST_RESERVED3 3
172 1.1 rh #define RINGBUS_DEST_DSOUND_IN 4
173 1.1 rh #define RINGBUS_DEST_ASSP_IN 5
174 1.1 rh
175 1.1 rh /* General Purpose I/O */
176 1.1 rh #define PORT_GPIO_DATA 0x60 /* WORD RW */
177 1.1 rh #define PORT_GPIO_MASK 0x64 /* WORD RW */
178 1.1 rh #define PORT_GPIO_DIR 0x68 /* WORD RW */
179 1.1 rh
180 1.1 rh /* Application Specific Signal Processor */
181 1.1 rh #define PORT_ASSP_MEM_INDEX 0x80 /* DWORD RW */
182 1.1 rh #define PORT_ASSP_MEM_DATA 0x84 /* WORD RW */
183 1.1 rh #define PORT_ASSP_CTRL_A 0xa2 /* BYTE RW */
184 1.1 rh #define PORT_ASSP_CTRL_B 0xa4 /* BYTE RW */
185 1.1 rh #define PORT_ASSP_CTRL_C 0xa6 /* BYTE RW */
186 1.1 rh #define PORT_ASSP_HOST_WR_INDEX 0xa8 /* BYTE W */
187 1.1 rh #define PORT_ASSP_HOST_WR_DATA 0xaa /* BYTE RW */
188 1.1 rh #define PORT_ASSP_INT_STAT 0xac /* BYTE RW */
189 1.1 rh
190 1.1 rh
191 1.1 rh /* -----------------------------
192 1.1 rh * Wave Processor Indexed Data Registers.
193 1.1 rh */
194 1.1 rh
195 1.1 rh #define WPREG_DATA_PORT 0
196 1.1 rh #define WPREG_CRAM_PTR 1
197 1.1 rh #define WPREG_CRAM_DATA 2
198 1.1 rh #define WPREG_WAVE_DATA 3
199 1.1 rh #define WPREG_WAVE_PTR_LOW 4
200 1.1 rh #define WPREG_WAVE_PTR_HIGH 5
201 1.1 rh
202 1.1 rh #define WPREG_TIMER_FREQ 6
203 1.1 rh #define WP_TIMER_FREQ_PRESCALE_MASK 0x00e0 /* actual - 9 */
204 1.1 rh #define WP_TIMER_FREQ_PRESCALE_SHIFT 5
205 1.1 rh #define WP_TIMER_FREQ_DIVIDE_MASK 0x001f
206 1.1 rh #define WP_TIMER_FREQ_DIVIDE_SHIFT 0
207 1.1 rh
208 1.1 rh #define WPREG_WAVE_ROMRAM 7
209 1.1 rh #define WP_WAVE_VIRTUAL_ENABLED 0x0400
210 1.1 rh #define WP_WAVE_8BITRAM_ENABLED 0x0200
211 1.1 rh #define WP_WAVE_DRAM_ENABLED 0x0100
212 1.1 rh #define WP_WAVE_RAMSPLIT_MASK 0x00ff
213 1.1 rh #define WP_WAVE_RAMSPLIT_SHIFT 0
214 1.1 rh
215 1.1 rh #define WPREG_BASE 12
216 1.1 rh #define WP_PARAOUT_BASE_MASK 0xf000
217 1.1 rh #define WP_PARAOUT_BASE_SHIFT 12
218 1.1 rh #define WP_PARAIN_BASE_MASK 0x0f00
219 1.1 rh #define WP_PARAIN_BASE_SHIFT 8
220 1.1 rh #define WP_SERIAL0_BASE_MASK 0x00f0
221 1.1 rh #define WP_SERIAL0_BASE_SHIFT 4
222 1.1 rh #define WP_SERIAL1_BASE_MASK 0x000f
223 1.1 rh #define WP_SERIAL1_BASE_SHIFT 0
224 1.1 rh
225 1.1 rh #define WPREG_TIMER_ENABLE 17
226 1.1 rh #define WPREG_TIMER_START 23
227 1.1 rh
228 1.1 rh
229 1.1 rh /* -----------------------------
230 1.1 rh * Audio Processing Unit.
231 1.1 rh */
232 1.1 rh #define APUREG_APUTYPE 0
233 1.1 rh #define APU_DMA_ENABLED 0x4000
234 1.1 rh #define APU_INT_ON_LOOP 0x2000
235 1.1 rh #define APU_ENDCURVE 0x1000
236 1.1 rh #define APU_APUTYPE_MASK 0x00f0
237 1.1 rh #define APU_FILTERTYPE_MASK 0x000c
238 1.1 rh #define APU_FILTERQ_MASK 0x0003
239 1.1 rh
240 1.1 rh /* APU types */
241 1.1 rh #define APU_APUTYPE_SHIFT 4
242 1.1 rh
243 1.1 rh #define APUTYPE_INACTIVE 0
244 1.1 rh #define APUTYPE_16BITLINEAR 1
245 1.1 rh #define APUTYPE_16BITSTEREO 2
246 1.1 rh #define APUTYPE_8BITLINEAR 3
247 1.1 rh #define APUTYPE_8BITSTEREO 4
248 1.1 rh #define APUTYPE_8BITDIFF 5
249 1.1 rh #define APUTYPE_DIGITALDELAY 6
250 1.1 rh #define APUTYPE_DUALTAP_READER 7
251 1.1 rh #define APUTYPE_CORRELATOR 8
252 1.1 rh #define APUTYPE_INPUTMIXER 9
253 1.1 rh #define APUTYPE_WAVETABLE 10
254 1.1 rh #define APUTYPE_RATECONV 11
255 1.1 rh #define APUTYPE_16BITPINGPONG 12
256 1.1 rh /* APU type 13 through 15 are reserved. */
257 1.1 rh
258 1.1 rh /* Filter types */
259 1.1 rh #define APU_FILTERTYPE_SHIFT 2
260 1.1 rh
261 1.1 rh #define FILTERTYPE_2POLE_LOPASS 0
262 1.1 rh #define FILTERTYPE_2POLE_BANDPASS 1
263 1.1 rh #define FILTERTYPE_2POLE_HIPASS 2
264 1.1 rh #define FILTERTYPE_1POLE_LOPASS 3
265 1.1 rh #define FILTERTYPE_1POLE_HIPASS 4
266 1.1 rh #define FILTERTYPE_PASSTHROUGH 5
267 1.1 rh
268 1.1 rh /* Filter Q */
269 1.1 rh #define APU_FILTERQ_SHIFT 0
270 1.1 rh
271 1.1 rh #define FILTERQ_LESSQ 0
272 1.1 rh #define FILTERQ_MOREQ 3
273 1.1 rh
274 1.1 rh /* APU register 2 */
275 1.1 rh #define APUREG_FREQ_LOBYTE 2
276 1.1 rh #define APU_FREQ_LOBYTE_MASK 0xff00
277 1.1 rh #define APU_plus6dB 0x0010
278 1.1 rh
279 1.1 rh /* APU register 3 */
280 1.1 rh #define APUREG_FREQ_HIWORD 3
281 1.1 rh #define APU_FREQ_HIWORD_MASK 0x0fff
282 1.1 rh
283 1.1 rh /* Frequency */
284 1.1 rh #define APU_FREQ_LOBYTE_SHIFT 8
285 1.1 rh #define APU_FREQ_HIWORD_SHIFT 0
286 1.1 rh #define FREQ_Hz2DIV(freq) (((u_int64_t)(freq) << 16) / 48000)
287 1.1 rh
288 1.1 rh /* APU register 4 */
289 1.1 rh #define APUREG_WAVESPACE 4
290 1.1 rh #define APU_STEREO 0x8000
291 1.1 rh #define APU_USE_SYSMEM 0x4000
292 1.1 rh #define APU_PCMBAR_MASK 0x6000
293 1.1 rh #define APU_64KPAGE_MASK 0xff00
294 1.1 rh
295 1.1 rh /* PCM Base Address Register selection */
296 1.1 rh #define APU_PCMBAR_SHIFT 13
297 1.1 rh
298 1.1 rh /* 64KW (==128KB) Page */
299 1.1 rh #define APU_64KPAGE_SHIFT 8
300 1.1 rh
301 1.1 rh /* APU register 5 - 7 */
302 1.1 rh #define APUREG_CURPTR 5
303 1.1 rh #define APUREG_ENDPTR 6
304 1.1 rh #define APUREG_LOOPLEN 7
305 1.1 rh
306 1.4 fredette /* APU register 8 */
307 1.4 fredette #define APUREG_EFFECTS_ENV 8
308 1.4 fredette
309 1.1 rh /* APU register 9 */
310 1.1 rh #define APUREG_AMPLITUDE 9
311 1.1 rh #define APU_AMPLITUDE_NOW_MASK 0xff00
312 1.1 rh #define APU_AMPLITUDE_DEST_MASK 0x00ff
313 1.1 rh
314 1.1 rh /* Amplitude now? */
315 1.1 rh #define APU_AMPLITUDE_NOW_SHIFT 8
316 1.1 rh
317 1.1 rh /* APU register 10 */
318 1.1 rh #define APUREG_POSITION 10
319 1.1 rh #define APU_RADIUS_MASK 0x00c0
320 1.1 rh #define APU_PAN_MASK 0x003f
321 1.1 rh
322 1.1 rh /* Radius control. */
323 1.1 rh #define APU_RADIUS_SHIFT 6
324 1.1 rh #define RADIUS_CENTERCIRCLE 0
325 1.1 rh #define RADIUS_MIDDLE 1
326 1.1 rh #define RADIUS_OUTSIDE 2
327 1.1 rh
328 1.1 rh /* Polar pan. */
329 1.1 rh #define APU_PAN_SHIFT 0
330 1.1 rh #define PAN_RIGHT 0x00
331 1.1 rh #define PAN_FRONT 0x08
332 1.1 rh #define PAN_LEFT 0x10
333 1.4 fredette
334 1.4 fredette /* APU register 11 */
335 1.4 fredette #define APUREG_ROUTE 11
336 1.4 fredette #define ROUTE_PARALLEL 0x14
337 1.1 rh
338 1.1 rh
339 1.1 rh /* -----------------------------
340 1.1 rh * Limits.
341 1.1 rh */
342 1.1 rh #define WPWA_MAX ((1 << 22) - 1)
343 1.1 rh #define WPWA_MAXADDR ((1 << 23) - 1)
344 1.1 rh #define MAESTRO_MAXADDR ((1 << 28) - 1)
345 1.1 rh #define WPTIMER_MINDIV 4
346 1.1 rh #define WPTIMER_MAXDIV (32 << 8)
347 1.1 rh
348 1.1 rh #endif /* ESM_REG_H_INCLUDED */
349