xref: /openbmc/linux/sound/isa/gus/gus_io.c (revision 1da177e4)
1 /*
2  *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
3  *  I/O routines for GF1/InterWave synthesizer chips
4  *
5  *
6  *   This program is free software; you can redistribute it and/or modify
7  *   it under the terms of the GNU General Public License as published by
8  *   the Free Software Foundation; either version 2 of the License, or
9  *   (at your option) any later version.
10  *
11  *   This program is distributed in the hope that it will be useful,
12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *   GNU General Public License for more details.
15  *
16  *   You should have received a copy of the GNU General Public License
17  *   along with this program; if not, write to the Free Software
18  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19  *
20  */
21 
22 #include <sound/driver.h>
23 #include <linux/delay.h>
24 #include <linux/time.h>
25 #include <sound/core.h>
26 #include <sound/gus.h>
27 
28 void snd_gf1_delay(snd_gus_card_t * gus)
29 {
30 	int i;
31 
32 	for (i = 0; i < 6; i++) {
33 		mb();
34 		inb(GUSP(gus, DRAM));
35 	}
36 }
37 
38 /*
39  *  =======================================================================
40  */
41 
42 /*
43  *  ok.. stop of control registers (wave & ramp) need some special things..
44  *       big UltraClick (tm) elimination...
45  */
46 
47 static inline void __snd_gf1_ctrl_stop(snd_gus_card_t * gus, unsigned char reg)
48 {
49 	unsigned char value;
50 
51 	outb(reg | 0x80, gus->gf1.reg_regsel);
52 	mb();
53 	value = inb(gus->gf1.reg_data8);
54 	mb();
55 	outb(reg, gus->gf1.reg_regsel);
56 	mb();
57 	outb((value | 0x03) & ~(0x80 | 0x20), gus->gf1.reg_data8);
58 	mb();
59 }
60 
61 static inline void __snd_gf1_write8(snd_gus_card_t * gus,
62 				    unsigned char reg,
63 				    unsigned char data)
64 {
65 	outb(reg, gus->gf1.reg_regsel);
66 	mb();
67 	outb(data, gus->gf1.reg_data8);
68 	mb();
69 }
70 
71 static inline unsigned char __snd_gf1_look8(snd_gus_card_t * gus,
72 					    unsigned char reg)
73 {
74 	outb(reg, gus->gf1.reg_regsel);
75 	mb();
76 	return inb(gus->gf1.reg_data8);
77 }
78 
79 static inline void __snd_gf1_write16(snd_gus_card_t * gus,
80 				     unsigned char reg, unsigned int data)
81 {
82 	outb(reg, gus->gf1.reg_regsel);
83 	mb();
84 	outw((unsigned short) data, gus->gf1.reg_data16);
85 	mb();
86 }
87 
88 static inline unsigned short __snd_gf1_look16(snd_gus_card_t * gus,
89 					      unsigned char reg)
90 {
91 	outb(reg, gus->gf1.reg_regsel);
92 	mb();
93 	return inw(gus->gf1.reg_data16);
94 }
95 
96 static inline void __snd_gf1_adlib_write(snd_gus_card_t * gus,
97 					 unsigned char reg, unsigned char data)
98 {
99 	outb(reg, gus->gf1.reg_timerctrl);
100 	inb(gus->gf1.reg_timerctrl);
101 	inb(gus->gf1.reg_timerctrl);
102 	outb(data, gus->gf1.reg_timerdata);
103 	inb(gus->gf1.reg_timerctrl);
104 	inb(gus->gf1.reg_timerctrl);
105 }
106 
107 static inline void __snd_gf1_write_addr(snd_gus_card_t * gus, unsigned char reg,
108                                         unsigned int addr, int w_16bit)
109 {
110 	if (gus->gf1.enh_mode) {
111 		if (w_16bit)
112 			addr = ((addr >> 1) & ~0x0000000f) | (addr & 0x0000000f);
113 		__snd_gf1_write8(gus, SNDRV_GF1_VB_UPPER_ADDRESS, (unsigned char) ((addr >> 26) & 0x03));
114 	} else if (w_16bit)
115 		addr = (addr & 0x00c0000f) | ((addr & 0x003ffff0) >> 1);
116 	__snd_gf1_write16(gus, reg, (unsigned short) (addr >> 11));
117 	__snd_gf1_write16(gus, reg + 1, (unsigned short) (addr << 5));
118 }
119 
120 static inline unsigned int __snd_gf1_read_addr(snd_gus_card_t * gus,
121 					       unsigned char reg, short w_16bit)
122 {
123 	unsigned int res;
124 
125 	res = ((unsigned int) __snd_gf1_look16(gus, reg | 0x80) << 11) & 0xfff800;
126 	res |= ((unsigned int) __snd_gf1_look16(gus, (reg + 1) | 0x80) >> 5) & 0x0007ff;
127 	if (gus->gf1.enh_mode) {
128 		res |= (unsigned int) __snd_gf1_look8(gus, SNDRV_GF1_VB_UPPER_ADDRESS | 0x80) << 26;
129 		if (w_16bit)
130 			res = ((res << 1) & 0xffffffe0) | (res & 0x0000000f);
131 	} else if (w_16bit)
132 		res = ((res & 0x001ffff0) << 1) | (res & 0x00c0000f);
133 	return res;
134 }
135 
136 
137 /*
138  *  =======================================================================
139  */
140 
141 void snd_gf1_ctrl_stop(snd_gus_card_t * gus, unsigned char reg)
142 {
143 	__snd_gf1_ctrl_stop(gus, reg);
144 }
145 
146 void snd_gf1_write8(snd_gus_card_t * gus,
147 		    unsigned char reg,
148 		    unsigned char data)
149 {
150 	__snd_gf1_write8(gus, reg, data);
151 }
152 
153 unsigned char snd_gf1_look8(snd_gus_card_t * gus, unsigned char reg)
154 {
155 	return __snd_gf1_look8(gus, reg);
156 }
157 
158 void snd_gf1_write16(snd_gus_card_t * gus,
159 		     unsigned char reg,
160 		     unsigned int data)
161 {
162 	__snd_gf1_write16(gus, reg, data);
163 }
164 
165 unsigned short snd_gf1_look16(snd_gus_card_t * gus, unsigned char reg)
166 {
167 	return __snd_gf1_look16(gus, reg);
168 }
169 
170 void snd_gf1_adlib_write(snd_gus_card_t * gus,
171                          unsigned char reg,
172                          unsigned char data)
173 {
174 	__snd_gf1_adlib_write(gus, reg, data);
175 }
176 
177 void snd_gf1_write_addr(snd_gus_card_t * gus, unsigned char reg,
178                         unsigned int addr, short w_16bit)
179 {
180 	__snd_gf1_write_addr(gus, reg, addr, w_16bit);
181 }
182 
183 unsigned int snd_gf1_read_addr(snd_gus_card_t * gus,
184                                unsigned char reg,
185                                short w_16bit)
186 {
187 	return __snd_gf1_read_addr(gus, reg, w_16bit);
188 }
189 
190 /*
191 
192  */
193 
194 void snd_gf1_i_ctrl_stop(snd_gus_card_t * gus, unsigned char reg)
195 {
196 	unsigned long flags;
197 
198 	spin_lock_irqsave(&gus->reg_lock, flags);
199 	__snd_gf1_ctrl_stop(gus, reg);
200 	spin_unlock_irqrestore(&gus->reg_lock, flags);
201 }
202 
203 void snd_gf1_i_write8(snd_gus_card_t * gus,
204 		      unsigned char reg,
205                       unsigned char data)
206 {
207 	unsigned long flags;
208 
209 	spin_lock_irqsave(&gus->reg_lock, flags);
210 	__snd_gf1_write8(gus, reg, data);
211 	spin_unlock_irqrestore(&gus->reg_lock, flags);
212 }
213 
214 unsigned char snd_gf1_i_look8(snd_gus_card_t * gus, unsigned char reg)
215 {
216 	unsigned long flags;
217 	unsigned char res;
218 
219 	spin_lock_irqsave(&gus->reg_lock, flags);
220 	res = __snd_gf1_look8(gus, reg);
221 	spin_unlock_irqrestore(&gus->reg_lock, flags);
222 	return res;
223 }
224 
225 void snd_gf1_i_write16(snd_gus_card_t * gus,
226 		       unsigned char reg,
227 		       unsigned int data)
228 {
229 	unsigned long flags;
230 
231 	spin_lock_irqsave(&gus->reg_lock, flags);
232 	__snd_gf1_write16(gus, reg, data);
233 	spin_unlock_irqrestore(&gus->reg_lock, flags);
234 }
235 
236 unsigned short snd_gf1_i_look16(snd_gus_card_t * gus, unsigned char reg)
237 {
238 	unsigned long flags;
239 	unsigned short res;
240 
241 	spin_lock_irqsave(&gus->reg_lock, flags);
242 	res = __snd_gf1_look16(gus, reg);
243 	spin_unlock_irqrestore(&gus->reg_lock, flags);
244 	return res;
245 }
246 
247 void snd_gf1_i_adlib_write(snd_gus_card_t * gus,
248 		           unsigned char reg,
249 		           unsigned char data)
250 {
251 	unsigned long flags;
252 
253 	spin_lock_irqsave(&gus->reg_lock, flags);
254 	__snd_gf1_adlib_write(gus, reg, data);
255 	spin_unlock_irqrestore(&gus->reg_lock, flags);
256 }
257 
258 void snd_gf1_i_write_addr(snd_gus_card_t * gus, unsigned char reg,
259 			  unsigned int addr, short w_16bit)
260 {
261 	unsigned long flags;
262 
263 	spin_lock_irqsave(&gus->reg_lock, flags);
264 	__snd_gf1_write_addr(gus, reg, addr, w_16bit);
265 	spin_unlock_irqrestore(&gus->reg_lock, flags);
266 }
267 
268 unsigned int snd_gf1_i_read_addr(snd_gus_card_t * gus,
269 				 unsigned char reg, short w_16bit)
270 {
271 	unsigned int res;
272 	unsigned long flags;
273 
274 	spin_lock_irqsave(&gus->reg_lock, flags);
275 	res = __snd_gf1_read_addr(gus, reg, w_16bit);
276 	spin_unlock_irqrestore(&gus->reg_lock, flags);
277 	return res;
278 }
279 
280 /*
281 
282  */
283 
284 void snd_gf1_dram_addr(snd_gus_card_t * gus, unsigned int addr)
285 {
286 	outb(0x43, gus->gf1.reg_regsel);
287 	mb();
288 	outw((unsigned short) addr, gus->gf1.reg_data16);
289 	mb();
290 	outb(0x44, gus->gf1.reg_regsel);
291 	mb();
292 	outb((unsigned char) (addr >> 16), gus->gf1.reg_data8);
293 	mb();
294 }
295 
296 void snd_gf1_poke(snd_gus_card_t * gus, unsigned int addr, unsigned char data)
297 {
298 	unsigned long flags;
299 
300 	spin_lock_irqsave(&gus->reg_lock, flags);
301 	outb(SNDRV_GF1_GW_DRAM_IO_LOW, gus->gf1.reg_regsel);
302 	mb();
303 	outw((unsigned short) addr, gus->gf1.reg_data16);
304 	mb();
305 	outb(SNDRV_GF1_GB_DRAM_IO_HIGH, gus->gf1.reg_regsel);
306 	mb();
307 	outb((unsigned char) (addr >> 16), gus->gf1.reg_data8);
308 	mb();
309 	outb(data, gus->gf1.reg_dram);
310 	spin_unlock_irqrestore(&gus->reg_lock, flags);
311 }
312 
313 unsigned char snd_gf1_peek(snd_gus_card_t * gus, unsigned int addr)
314 {
315 	unsigned long flags;
316 	unsigned char res;
317 
318 	spin_lock_irqsave(&gus->reg_lock, flags);
319 	outb(SNDRV_GF1_GW_DRAM_IO_LOW, gus->gf1.reg_regsel);
320 	mb();
321 	outw((unsigned short) addr, gus->gf1.reg_data16);
322 	mb();
323 	outb(SNDRV_GF1_GB_DRAM_IO_HIGH, gus->gf1.reg_regsel);
324 	mb();
325 	outb((unsigned char) (addr >> 16), gus->gf1.reg_data8);
326 	mb();
327 	res = inb(gus->gf1.reg_dram);
328 	spin_unlock_irqrestore(&gus->reg_lock, flags);
329 	return res;
330 }
331 
332 void snd_gf1_pokew(snd_gus_card_t * gus, unsigned int addr, unsigned short data)
333 {
334 	unsigned long flags;
335 
336 #ifdef CONFIG_SND_DEBUG
337 	if (!gus->interwave)
338 		snd_printk("snd_gf1_pokew - GF1!!!\n");
339 #endif
340 	spin_lock_irqsave(&gus->reg_lock, flags);
341 	outb(SNDRV_GF1_GW_DRAM_IO_LOW, gus->gf1.reg_regsel);
342 	mb();
343 	outw((unsigned short) addr, gus->gf1.reg_data16);
344 	mb();
345 	outb(SNDRV_GF1_GB_DRAM_IO_HIGH, gus->gf1.reg_regsel);
346 	mb();
347 	outb((unsigned char) (addr >> 16), gus->gf1.reg_data8);
348 	mb();
349 	outb(SNDRV_GF1_GW_DRAM_IO16, gus->gf1.reg_regsel);
350 	mb();
351 	outw(data, gus->gf1.reg_data16);
352 	spin_unlock_irqrestore(&gus->reg_lock, flags);
353 }
354 
355 unsigned short snd_gf1_peekw(snd_gus_card_t * gus, unsigned int addr)
356 {
357 	unsigned long flags;
358 	unsigned short res;
359 
360 #ifdef CONFIG_SND_DEBUG
361 	if (!gus->interwave)
362 		snd_printk("snd_gf1_peekw - GF1!!!\n");
363 #endif
364 	spin_lock_irqsave(&gus->reg_lock, flags);
365 	outb(SNDRV_GF1_GW_DRAM_IO_LOW, gus->gf1.reg_regsel);
366 	mb();
367 	outw((unsigned short) addr, gus->gf1.reg_data16);
368 	mb();
369 	outb(SNDRV_GF1_GB_DRAM_IO_HIGH, gus->gf1.reg_regsel);
370 	mb();
371 	outb((unsigned char) (addr >> 16), gus->gf1.reg_data8);
372 	mb();
373 	outb(SNDRV_GF1_GW_DRAM_IO16, gus->gf1.reg_regsel);
374 	mb();
375 	res = inw(gus->gf1.reg_data16);
376 	spin_unlock_irqrestore(&gus->reg_lock, flags);
377 	return res;
378 }
379 
380 void snd_gf1_dram_setmem(snd_gus_card_t * gus, unsigned int addr,
381 			 unsigned short value, unsigned int count)
382 {
383 	unsigned long port;
384 	unsigned long flags;
385 
386 #ifdef CONFIG_SND_DEBUG
387 	if (!gus->interwave)
388 		snd_printk("snd_gf1_dram_setmem - GF1!!!\n");
389 #endif
390 	addr &= ~1;
391 	count >>= 1;
392 	port = GUSP(gus, GF1DATALOW);
393 	spin_lock_irqsave(&gus->reg_lock, flags);
394 	outb(SNDRV_GF1_GW_DRAM_IO_LOW, gus->gf1.reg_regsel);
395 	mb();
396 	outw((unsigned short) addr, gus->gf1.reg_data16);
397 	mb();
398 	outb(SNDRV_GF1_GB_DRAM_IO_HIGH, gus->gf1.reg_regsel);
399 	mb();
400 	outb((unsigned char) (addr >> 16), gus->gf1.reg_data8);
401 	mb();
402 	outb(SNDRV_GF1_GW_DRAM_IO16, gus->gf1.reg_regsel);
403 	while (count--)
404 		outw(value, port);
405 	spin_unlock_irqrestore(&gus->reg_lock, flags);
406 }
407 
408 /*
409 
410  */
411 
412 void snd_gf1_select_active_voices(snd_gus_card_t * gus)
413 {
414 	unsigned short voices;
415 
416 	static unsigned short voices_tbl[32 - 14 + 1] =
417 	{
418 	    44100, 41160, 38587, 36317, 34300, 32494, 30870, 29400, 28063, 26843,
419 	    25725, 24696, 23746, 22866, 22050, 21289, 20580, 19916, 19293
420 	};
421 
422 	voices = gus->gf1.active_voices;
423 	if (voices > 32)
424 		voices = 32;
425 	if (voices < 14)
426 		voices = 14;
427 	if (gus->gf1.enh_mode)
428 		voices = 32;
429 	gus->gf1.active_voices = voices;
430 	gus->gf1.playback_freq =
431 	    gus->gf1.enh_mode ? 44100 : voices_tbl[voices - 14];
432 	if (!gus->gf1.enh_mode) {
433 		snd_gf1_i_write8(gus, SNDRV_GF1_GB_ACTIVE_VOICES, 0xc0 | (voices - 1));
434 		udelay(100);
435 	}
436 }
437 
438 #ifdef CONFIG_SND_DEBUG
439 
440 void snd_gf1_print_voice_registers(snd_gus_card_t * gus)
441 {
442 	unsigned char mode;
443 	int voice, ctrl;
444 
445 	voice = gus->gf1.active_voice;
446 	printk(" -%i- GF1  voice ctrl, ramp ctrl  = 0x%x, 0x%x\n", voice, ctrl = snd_gf1_i_read8(gus, 0), snd_gf1_i_read8(gus, 0x0d));
447 	printk(" -%i- GF1  frequency              = 0x%x\n", voice, snd_gf1_i_read16(gus, 1));
448 	printk(" -%i- GF1  loop start, end        = 0x%x (0x%x), 0x%x (0x%x)\n", voice, snd_gf1_i_read_addr(gus, 2, ctrl & 4), snd_gf1_i_read_addr(gus, 2, (ctrl & 4) ^ 4), snd_gf1_i_read_addr(gus, 4, ctrl & 4), snd_gf1_i_read_addr(gus, 4, (ctrl & 4) ^ 4));
449 	printk(" -%i- GF1  ramp start, end, rate  = 0x%x, 0x%x, 0x%x\n", voice, snd_gf1_i_read8(gus, 7), snd_gf1_i_read8(gus, 8), snd_gf1_i_read8(gus, 6));
450 	printk(" -%i- GF1  volume                 = 0x%x\n", voice, snd_gf1_i_read16(gus, 9));
451 	printk(" -%i- GF1  position               = 0x%x (0x%x)\n", voice, snd_gf1_i_read_addr(gus, 0x0a, ctrl & 4), snd_gf1_i_read_addr(gus, 0x0a, (ctrl & 4) ^ 4));
452 	if (gus->interwave && snd_gf1_i_read8(gus, 0x19) & 0x01) {	/* enhanced mode */
453 		mode = snd_gf1_i_read8(gus, 0x15);
454 		printk(" -%i- GFA1 mode                   = 0x%x\n", voice, mode);
455 		if (mode & 0x01) {	/* Effect processor */
456 			printk(" -%i- GFA1 effect address         = 0x%x\n", voice, snd_gf1_i_read_addr(gus, 0x11, ctrl & 4));
457 			printk(" -%i- GFA1 effect volume          = 0x%x\n", voice, snd_gf1_i_read16(gus, 0x16));
458 			printk(" -%i- GFA1 effect volume final    = 0x%x\n", voice, snd_gf1_i_read16(gus, 0x1d));
459 			printk(" -%i- GFA1 effect acumulator      = 0x%x\n", voice, snd_gf1_i_read8(gus, 0x14));
460 		}
461 		if (mode & 0x20) {
462 			printk(" -%i- GFA1 left offset            = 0x%x (%i)\n", voice, snd_gf1_i_read16(gus, 0x13), snd_gf1_i_read16(gus, 0x13) >> 4);
463 			printk(" -%i- GFA1 left offset final      = 0x%x (%i)\n", voice, snd_gf1_i_read16(gus, 0x1c), snd_gf1_i_read16(gus, 0x1c) >> 4);
464 			printk(" -%i- GFA1 right offset           = 0x%x (%i)\n", voice, snd_gf1_i_read16(gus, 0x0c), snd_gf1_i_read16(gus, 0x0c) >> 4);
465 			printk(" -%i- GFA1 right offset final     = 0x%x (%i)\n", voice, snd_gf1_i_read16(gus, 0x1b), snd_gf1_i_read16(gus, 0x1b) >> 4);
466 		} else
467 			printk(" -%i- GF1  pan                    = 0x%x\n", voice, snd_gf1_i_read8(gus, 0x0c));
468 	} else
469 		printk(" -%i- GF1  pan                    = 0x%x\n", voice, snd_gf1_i_read8(gus, 0x0c));
470 }
471 
472 void snd_gf1_print_global_registers(snd_gus_card_t * gus)
473 {
474 	unsigned char global_mode = 0x00;
475 
476 	printk(" -G- GF1 active voices            = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_ACTIVE_VOICES));
477 	if (gus->interwave) {
478 		global_mode = snd_gf1_i_read8(gus, SNDRV_GF1_GB_GLOBAL_MODE);
479 		printk(" -G- GF1 global mode              = 0x%x\n", global_mode);
480 	}
481 	if (global_mode & 0x02)	/* LFO enabled? */
482 		printk(" -G- GF1 LFO base                 = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_LFO_BASE));
483 	printk(" -G- GF1 voices IRQ read          = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_VOICES_IRQ_READ));
484 	printk(" -G- GF1 DRAM DMA control         = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_DRAM_DMA_CONTROL));
485 	printk(" -G- GF1 DRAM DMA high/low        = 0x%x/0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_DRAM_DMA_HIGH), snd_gf1_i_read16(gus, SNDRV_GF1_GW_DRAM_DMA_LOW));
486 	printk(" -G- GF1 DRAM IO high/low         = 0x%x/0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_DRAM_IO_HIGH), snd_gf1_i_read16(gus, SNDRV_GF1_GW_DRAM_IO_LOW));
487 	if (!gus->interwave)
488 		printk(" -G- GF1 record DMA control       = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL));
489 	printk(" -G- GF1 DRAM IO 16               = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_DRAM_IO16));
490 	if (gus->gf1.enh_mode) {
491 		printk(" -G- GFA1 memory config           = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_MEMORY_CONFIG));
492 		printk(" -G- GFA1 memory control          = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_MEMORY_CONTROL));
493 		printk(" -G- GFA1 FIFO record base        = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_FIFO_RECORD_BASE_ADDR));
494 		printk(" -G- GFA1 FIFO playback base      = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_FIFO_PLAY_BASE_ADDR));
495 		printk(" -G- GFA1 interleave control      = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_INTERLEAVE));
496 	}
497 }
498 
499 void snd_gf1_print_setup_registers(snd_gus_card_t * gus)
500 {
501 	printk(" -S- mix control                  = 0x%x\n", inb(GUSP(gus, MIXCNTRLREG)));
502 	printk(" -S- IRQ status                   = 0x%x\n", inb(GUSP(gus, IRQSTAT)));
503 	printk(" -S- timer control                = 0x%x\n", inb(GUSP(gus, TIMERCNTRL)));
504 	printk(" -S- timer data                   = 0x%x\n", inb(GUSP(gus, TIMERDATA)));
505 	printk(" -S- status read                  = 0x%x\n", inb(GUSP(gus, REGCNTRLS)));
506 	printk(" -S- Sound Blaster control        = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_SOUND_BLASTER_CONTROL));
507 	printk(" -S- AdLib timer 1/2              = 0x%x/0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_ADLIB_TIMER_1), snd_gf1_i_look8(gus, SNDRV_GF1_GB_ADLIB_TIMER_2));
508 	printk(" -S- reset                        = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET));
509 	if (gus->interwave) {
510 		printk(" -S- compatibility                = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_COMPATIBILITY));
511 		printk(" -S- decode control               = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_DECODE_CONTROL));
512 		printk(" -S- version number               = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_VERSION_NUMBER));
513 		printk(" -S- MPU-401 emul. control A/B    = 0x%x/0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_MPU401_CONTROL_A), snd_gf1_i_look8(gus, SNDRV_GF1_GB_MPU401_CONTROL_B));
514 		printk(" -S- emulation IRQ                = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_EMULATION_IRQ));
515 	}
516 }
517 
518 void snd_gf1_peek_print_block(snd_gus_card_t * gus, unsigned int addr, int count, int w_16bit)
519 {
520 	if (!w_16bit) {
521 		while (count-- > 0)
522 			printk(count > 0 ? "%02x:" : "%02x", snd_gf1_peek(gus, addr++));
523 	} else {
524 		while (count-- > 0) {
525 			printk(count > 0 ? "%04x:" : "%04x", snd_gf1_peek(gus, addr) | (snd_gf1_peek(gus, addr + 1) << 8));
526 			addr += 2;
527 		}
528 	}
529 }
530 
531 #endif
532