1 | /*
|
---|
2 | * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
|
---|
3 | * Creative Labs, Inc.
|
---|
4 | * Routines for control of EMU10K1 chips / proc interface routines
|
---|
5 | *
|
---|
6 | * BUGS:
|
---|
7 | * --
|
---|
8 | *
|
---|
9 | * TODO:
|
---|
10 | * --
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or modify
|
---|
13 | * it under the terms of the GNU General Public License as published by
|
---|
14 | * the Free Software Foundation; either version 2 of the License, or
|
---|
15 | * (at your option) any later version.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful,
|
---|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
20 | * GNU General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, write to the Free Software
|
---|
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
25 | *
|
---|
26 | */
|
---|
27 |
|
---|
28 | #define __NO_VERSION__
|
---|
29 | #include <sound/driver.h>
|
---|
30 | #include <linux/slab.h>
|
---|
31 | #include <sound/core.h>
|
---|
32 | #include <sound/emu10k1.h>
|
---|
33 |
|
---|
34 | static void snd_emu10k1_proc_spdif_status(emu10k1_t * emu,
|
---|
35 | snd_info_buffer_t * buffer,
|
---|
36 | char *title,
|
---|
37 | int status_reg,
|
---|
38 | int rate_reg)
|
---|
39 | {
|
---|
40 | static char *clkaccy[4] = { "1000ppm", "50ppm", "variable", "unknown" };
|
---|
41 | static int samplerate[16] = { 44100, 1, 48000, 32000, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
|
---|
42 | static char *channel[16] = { "unspec", "left", "right", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" };
|
---|
43 | static char *emphasis[8] = { "none", "50/15 usec 2 channel", "2", "3", "4", "5", "6", "7" };
|
---|
44 | unsigned int status, rate = 0;
|
---|
45 |
|
---|
46 | status = snd_emu10k1_ptr_read(emu, status_reg, 0);
|
---|
47 | if (rate_reg > 0)
|
---|
48 | rate = snd_emu10k1_ptr_read(emu, rate_reg, 0);
|
---|
49 |
|
---|
50 | snd_iprintf(buffer, "\n%s\n", title);
|
---|
51 |
|
---|
52 | snd_iprintf(buffer, "Professional Mode : %s\n", (status & SPCS_PROFESSIONAL) ? "yes" : "no");
|
---|
53 | snd_iprintf(buffer, "Not Audio Data : %s\n", (status & SPCS_NOTAUDIODATA) ? "yes" : "no");
|
---|
54 | snd_iprintf(buffer, "Copyright : %s\n", (status & SPCS_COPYRIGHT) ? "yes" : "no");
|
---|
55 | snd_iprintf(buffer, "Emphasis : %s\n", emphasis[(status & SPCS_EMPHASISMASK) >> 3]);
|
---|
56 | snd_iprintf(buffer, "Mode : %i\n", (status & SPCS_MODEMASK) >> 6);
|
---|
57 | snd_iprintf(buffer, "Category Code : 0x%x\n", (status & SPCS_CATEGORYCODEMASK) >> 8);
|
---|
58 | snd_iprintf(buffer, "Generation Status : %s\n", status & SPCS_GENERATIONSTATUS ? "original" : "copy");
|
---|
59 | snd_iprintf(buffer, "Source Mask : %i\n", (status & SPCS_SOURCENUMMASK) >> 16);
|
---|
60 | snd_iprintf(buffer, "Channel Number : %s\n", channel[(status & SPCS_CHANNELNUMMASK) >> 20]);
|
---|
61 | snd_iprintf(buffer, "Sample Rate : %iHz\n", samplerate[(status & SPCS_SAMPLERATEMASK) >> 24]);
|
---|
62 | snd_iprintf(buffer, "Clock Accuracy : %s\n", clkaccy[(status & SPCS_CLKACCYMASK) >> 28]);
|
---|
63 |
|
---|
64 | if (rate_reg > 0) {
|
---|
65 | snd_iprintf(buffer, "S/PDIF Locked : %s\n", rate & SRCS_SPDIFLOCKED ? "on" : "off");
|
---|
66 | snd_iprintf(buffer, "Rate Locked : %s\n", rate & SRCS_RATELOCKED ? "on" : "off");
|
---|
67 | snd_iprintf(buffer, "Estimated Sample Rate : 0x%x\n", rate & SRCS_ESTSAMPLERATE);
|
---|
68 | }
|
---|
69 | }
|
---|
70 |
|
---|
71 | static void snd_emu10k1_proc_read(snd_info_entry_t *entry,
|
---|
72 | snd_info_buffer_t * buffer)
|
---|
73 | {
|
---|
74 | /* FIXME - output names are in emufx.c too */
|
---|
75 | static char *creative_outs[32] = {
|
---|
76 | /* 00 */ "AC97 Left",
|
---|
77 | /* 01 */ "AC97 Right",
|
---|
78 | /* 02 */ "Optical IEC958 Left",
|
---|
79 | /* 03 */ "Optical IEC958 Right",
|
---|
80 | /* 04 */ "Center",
|
---|
81 | /* 05 */ "LFE",
|
---|
82 | /* 06 */ "Headphone Left",
|
---|
83 | /* 07 */ "Headphone Right",
|
---|
84 | /* 08 */ "Surround Left",
|
---|
85 | /* 09 */ "Surround Right",
|
---|
86 | /* 10 */ "PCM Capture Left",
|
---|
87 | /* 11 */ "PCM Capture Right",
|
---|
88 | /* 12 */ "MIC Capture",
|
---|
89 | /* 13 */ "AC97 Surround Left",
|
---|
90 | /* 14 */ "AC97 Surround Right",
|
---|
91 | /* 15 */ "???",
|
---|
92 | /* 16 */ "???",
|
---|
93 | /* 17 */ "Analog Center",
|
---|
94 | /* 18 */ "Analog LFE",
|
---|
95 | /* 19 */ "???",
|
---|
96 | /* 20 */ "???",
|
---|
97 | /* 21 */ "???",
|
---|
98 | /* 22 */ "???",
|
---|
99 | /* 23 */ "???",
|
---|
100 | /* 24 */ "???",
|
---|
101 | /* 25 */ "???",
|
---|
102 | /* 26 */ "???",
|
---|
103 | /* 27 */ "???",
|
---|
104 | /* 28 */ "???",
|
---|
105 | /* 29 */ "???",
|
---|
106 | /* 30 */ "???",
|
---|
107 | /* 31 */ "???"
|
---|
108 | };
|
---|
109 |
|
---|
110 | static char *audigy_outs[64] = {
|
---|
111 | /* 00 */ "Digital Front Left",
|
---|
112 | /* 01 */ "Digital Front Right",
|
---|
113 | /* 02 */ "Digital Center",
|
---|
114 | /* 03 */ "Digital LEF",
|
---|
115 | /* 04 */ "Headphone Left",
|
---|
116 | /* 05 */ "Headphone Right",
|
---|
117 | /* 06 */ "Digital Rear Left",
|
---|
118 | /* 07 */ "Digital Rear Right",
|
---|
119 | /* 08 */ "Front Left",
|
---|
120 | /* 09 */ "Front Right",
|
---|
121 | /* 10 */ "Center",
|
---|
122 | /* 11 */ "LFE",
|
---|
123 | /* 12 */ "???",
|
---|
124 | /* 13 */ "???",
|
---|
125 | /* 14 */ "Rear Left",
|
---|
126 | /* 15 */ "Rear Right",
|
---|
127 | /* 16 */ "AC97 Front Left",
|
---|
128 | /* 17 */ "AC97 Front Right",
|
---|
129 | /* 18 */ "ADC Caputre Left",
|
---|
130 | /* 19 */ "ADC Capture Right",
|
---|
131 | /* 20 */ "???",
|
---|
132 | /* 21 */ "???",
|
---|
133 | /* 22 */ "???",
|
---|
134 | /* 23 */ "???",
|
---|
135 | /* 24 */ "???",
|
---|
136 | /* 25 */ "???",
|
---|
137 | /* 26 */ "???",
|
---|
138 | /* 27 */ "???",
|
---|
139 | /* 28 */ "???",
|
---|
140 | /* 29 */ "???",
|
---|
141 | /* 30 */ "???",
|
---|
142 | /* 31 */ "???",
|
---|
143 | /* 32 */ "FXBUS2_0",
|
---|
144 | /* 33 */ "FXBUS2_1",
|
---|
145 | /* 34 */ "FXBUS2_2",
|
---|
146 | /* 35 */ "FXBUS2_3",
|
---|
147 | /* 36 */ "FXBUS2_4",
|
---|
148 | /* 37 */ "FXBUS2_5",
|
---|
149 | /* 38 */ "FXBUS2_6",
|
---|
150 | /* 39 */ "FXBUS2_7",
|
---|
151 | /* 40 */ "FXBUS2_8",
|
---|
152 | /* 41 */ "FXBUS2_9",
|
---|
153 | /* 42 */ "FXBUS2_10",
|
---|
154 | /* 43 */ "FXBUS2_11",
|
---|
155 | /* 44 */ "FXBUS2_12",
|
---|
156 | /* 45 */ "FXBUS2_13",
|
---|
157 | /* 46 */ "FXBUS2_14",
|
---|
158 | /* 47 */ "FXBUS2_15",
|
---|
159 | /* 48 */ "FXBUS2_16",
|
---|
160 | /* 49 */ "FXBUS2_17",
|
---|
161 | /* 50 */ "FXBUS2_18",
|
---|
162 | /* 51 */ "FXBUS2_19",
|
---|
163 | /* 52 */ "FXBUS2_20",
|
---|
164 | /* 53 */ "FXBUS2_21",
|
---|
165 | /* 54 */ "FXBUS2_22",
|
---|
166 | /* 55 */ "FXBUS2_23",
|
---|
167 | /* 56 */ "FXBUS2_24",
|
---|
168 | /* 57 */ "FXBUS2_25",
|
---|
169 | /* 58 */ "FXBUS2_26",
|
---|
170 | /* 59 */ "FXBUS2_27",
|
---|
171 | /* 60 */ "FXBUS2_28",
|
---|
172 | /* 61 */ "FXBUS2_29",
|
---|
173 | /* 62 */ "FXBUS2_30",
|
---|
174 | /* 63 */ "FXBUS2_31"
|
---|
175 | };
|
---|
176 |
|
---|
177 | emu10k1_t *emu = entry->private_data;
|
---|
178 | unsigned int val;
|
---|
179 | int nefx = emu->audigy ? 64 : 32;
|
---|
180 | char **outputs = emu->audigy ? audigy_outs : creative_outs;
|
---|
181 | int idx;
|
---|
182 |
|
---|
183 | snd_iprintf(buffer, "EMU10K1\n\n");
|
---|
184 | snd_iprintf(buffer, "Card : %s\n",
|
---|
185 | emu->audigy ? "Audigy" : (emu->card_capabilities->ecard ? "EMU APS" : "Creative"));
|
---|
186 | snd_iprintf(buffer, "Internal TRAM (words) : 0x%x\n", emu->fx8010.itram_size);
|
---|
187 | snd_iprintf(buffer, "External TRAM (words) : 0x%x\n", emu->fx8010.etram_pages.bytes);
|
---|
188 | snd_iprintf(buffer, "\n");
|
---|
189 | if (emu->audigy) {
|
---|
190 | snd_iprintf(buffer, "Effect Send Routing : A=%i, B=%i, C=%i, D=%i\n",
|
---|
191 | val & 0x3f,
|
---|
192 | (val >> 8) & 0x3f,
|
---|
193 | (val >> 16) & 0x3f,
|
---|
194 | (val >> 24) & 0x3f);
|
---|
195 | } else {
|
---|
196 | snd_iprintf(buffer, "Effect Send Routing : A=%i, B=%i, C=%i, D=%i\n",
|
---|
197 | (val >> 16) & 0x0f,
|
---|
198 | (val >> 20) & 0x0f,
|
---|
199 | (val >> 24) & 0x0f,
|
---|
200 | (val >> 28) & 0x0f);
|
---|
201 | }
|
---|
202 | snd_iprintf(buffer, "\nCaptured FX Outputs :\n");
|
---|
203 | for (idx = 0; idx < nefx; idx++) {
|
---|
204 | if (emu->efx_voices_mask[idx/32] & (1 << (idx%32)))
|
---|
205 | snd_iprintf(buffer, " Output %02i [%s]\n", idx, outputs[idx]);
|
---|
206 | }
|
---|
207 | snd_iprintf(buffer, "\nAll FX Outputs :\n");
|
---|
208 | for (idx = 0; idx < (emu->audigy ? 64 : 32); idx++)
|
---|
209 | snd_iprintf(buffer, " Output %02i [%s]\n", idx, outputs[idx]);
|
---|
210 | snd_emu10k1_proc_spdif_status(emu, buffer, "S/PDIF Output 0", SPCS0, -1);
|
---|
211 | snd_emu10k1_proc_spdif_status(emu, buffer, "S/PDIF Output 1", SPCS1, -1);
|
---|
212 | snd_emu10k1_proc_spdif_status(emu, buffer, "S/PDIF Output 2/3", SPCS2, -1);
|
---|
213 | snd_emu10k1_proc_spdif_status(emu, buffer, "CD-ROM S/PDIF", CDCS, CDSRCS);
|
---|
214 | snd_emu10k1_proc_spdif_status(emu, buffer, "General purpose S/PDIF", GPSCS, GPSRCS);
|
---|
215 | val = snd_emu10k1_ptr_read(emu, ZVSRCS, 0);
|
---|
216 | snd_iprintf(buffer, "\nZoomed Video\n");
|
---|
217 | snd_iprintf(buffer, "Rate Locked : %s\n", val & SRCS_RATELOCKED ? "on" : "off");
|
---|
218 | snd_iprintf(buffer, "Estimated Sample Rate : 0x%x\n", val & SRCS_ESTSAMPLERATE);
|
---|
219 | }
|
---|
220 |
|
---|
221 | static void snd_emu10k1_proc_acode_read(snd_info_entry_t *entry,
|
---|
222 | snd_info_buffer_t * buffer)
|
---|
223 | {
|
---|
224 | u32 pc;
|
---|
225 | emu10k1_t *emu = entry->private_data;
|
---|
226 |
|
---|
227 | snd_iprintf(buffer, "FX8010 Instruction List '%s'\n", emu->fx8010.name);
|
---|
228 | snd_iprintf(buffer, " Code dump :\n");
|
---|
229 | for (pc = 0; pc < (emu->audigy ? 1024 : 512); pc++) {
|
---|
230 | u32 low, high;
|
---|
231 |
|
---|
232 | low = snd_emu10k1_efx_read(emu, pc * 2);
|
---|
233 | high = snd_emu10k1_efx_read(emu, pc * 2 + 1);
|
---|
234 | if (emu->audigy)
|
---|
235 | snd_iprintf(buffer, " OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n",
|
---|
236 | (high >> 24) & 0x0f,
|
---|
237 | (high >> 12) & 0x7ff,
|
---|
238 | (high >> 0) & 0x7ff,
|
---|
239 | (low >> 12) & 0x7ff,
|
---|
240 | (low >> 0) & 0x7ff,
|
---|
241 | pc,
|
---|
242 | high, low);
|
---|
243 | else
|
---|
244 | snd_iprintf(buffer, " OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n",
|
---|
245 | (high >> 20) & 0x0f,
|
---|
246 | (high >> 10) & 0x3ff,
|
---|
247 | (high >> 0) & 0x3ff,
|
---|
248 | (low >> 10) & 0x3ff,
|
---|
249 | (low >> 0) & 0x3ff,
|
---|
250 | pc,
|
---|
251 | high, low);
|
---|
252 | }
|
---|
253 | }
|
---|
254 |
|
---|
255 | #define TOTAL_SIZE_GPR (0x100*4)
|
---|
256 | #define A_TOTAL_SIZE_GPR (0x200*4)
|
---|
257 | #define TOTAL_SIZE_TANKMEM_DATA (0xa0*4)
|
---|
258 | #define TOTAL_SIZE_TANKMEM_ADDR (0xa0*4)
|
---|
259 | #define A_TOTAL_SIZE_TANKMEM_DATA (0x100*4)
|
---|
260 | #define A_TOTAL_SIZE_TANKMEM_ADDR (0x100*4)
|
---|
261 | #define TOTAL_SIZE_CODE (0x200*8)
|
---|
262 | #define A_TOTAL_SIZE_CODE (0x400*8)
|
---|
263 |
|
---|
264 | static long snd_emu10k1_fx8010_read(snd_info_entry_t *entry, void *file_private_data,
|
---|
265 | struct file *file, char __user *buf,
|
---|
266 | unsigned long count, unsigned long pos)
|
---|
267 | {
|
---|
268 | long size;
|
---|
269 | emu10k1_t *emu = entry->private_data;
|
---|
270 | unsigned int offset;
|
---|
271 | int tram_addr = 0;
|
---|
272 |
|
---|
273 | if (!strcmp(entry->name, "fx8010_tram_addr")) {
|
---|
274 | offset = TANKMEMADDRREGBASE;
|
---|
275 | tram_addr = 1;
|
---|
276 | } else if (!strcmp(entry->name, "fx8010_tram_data")) {
|
---|
277 | offset = TANKMEMDATAREGBASE;
|
---|
278 | } else if (!strcmp(entry->name, "fx8010_code")) {
|
---|
279 | offset = emu->audigy ? A_MICROCODEBASE : MICROCODEBASE;
|
---|
280 | } else {
|
---|
281 | offset = emu->audigy ? A_FXGPREGBASE : FXGPREGBASE;
|
---|
282 | }
|
---|
283 | size = count;
|
---|
284 | if (pos + size > entry->size)
|
---|
285 | size = (long)entry->size - pos;
|
---|
286 | if (size > 0) {
|
---|
287 | unsigned int *tmp;
|
---|
288 | long res;
|
---|
289 | unsigned int idx;
|
---|
290 | if ((tmp = kmalloc(size + 8, GFP_KERNEL)) == NULL)
|
---|
291 | return -ENOMEM;
|
---|
292 | for (idx = 0; idx < ((pos & 3) + size + 3) >> 2; idx++)
|
---|
293 | if (tram_addr && emu->audigy) {
|
---|
294 | tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0) >> 11;
|
---|
295 | tmp[idx] |= snd_emu10k1_ptr_read(emu, 0x100 + idx + (pos >> 2), 0) << 20;
|
---|
296 | } else
|
---|
297 | tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0);
|
---|
298 | if (copy_to_user(buf, ((char *)tmp) + (pos & 3), size))
|
---|
299 | res = -EFAULT;
|
---|
300 | else {
|
---|
301 | res = size;
|
---|
302 | }
|
---|
303 | kfree(tmp);
|
---|
304 | return res;
|
---|
305 | }
|
---|
306 | return 0;
|
---|
307 | }
|
---|
308 |
|
---|
309 | static void snd_emu10k1_proc_voices_read(snd_info_entry_t *entry,
|
---|
310 | snd_info_buffer_t * buffer)
|
---|
311 | {
|
---|
312 | emu10k1_t *emu = entry->private_data;
|
---|
313 | emu10k1_voice_t *voice;
|
---|
314 | int idx;
|
---|
315 |
|
---|
316 | snd_iprintf(buffer, "ch\tuse\tpcm\tefx\tsynth\tmidi\n");
|
---|
317 | for (idx = 0; idx < NUM_G; idx++) {
|
---|
318 | voice = &emu->voices[idx];
|
---|
319 | snd_iprintf(buffer, "%i\t%i\t%i\t%i\t%i\t%i\n",
|
---|
320 | idx,
|
---|
321 | voice->use,
|
---|
322 | voice->pcm,
|
---|
323 | voice->efx,
|
---|
324 | voice->synth,
|
---|
325 | voice->midi);
|
---|
326 | }
|
---|
327 | }
|
---|
328 |
|
---|
329 | #ifdef CONFIG_SND_DEBUG
|
---|
330 | static void snd_emu_proc_io_reg_read(snd_info_entry_t *entry,
|
---|
331 | snd_info_buffer_t * buffer)
|
---|
332 | {
|
---|
333 | emu10k1_t *emu = entry->private_data;
|
---|
334 | unsigned long value;
|
---|
335 | unsigned long flags;
|
---|
336 | int i;
|
---|
337 | snd_iprintf(buffer, "IO Registers:\n\n");
|
---|
338 | for(i = 0; i < 0x40; i+=4) {
|
---|
339 | spin_lock_irqsave(&emu->emu_lock, flags);
|
---|
340 | value = inl(emu->port + i);
|
---|
341 | spin_unlock_irqrestore(&emu->emu_lock, flags);
|
---|
342 | snd_iprintf(buffer, "%02X: %08lX\n", i, value);
|
---|
343 | }
|
---|
344 | }
|
---|
345 |
|
---|
346 | static void snd_emu_proc_io_reg_write(snd_info_entry_t *entry,
|
---|
347 | snd_info_buffer_t * buffer)
|
---|
348 | {
|
---|
349 | emu10k1_t *emu = entry->private_data;
|
---|
350 | unsigned long flags;
|
---|
351 | char line[64];
|
---|
352 | u32 reg, val;
|
---|
353 | while (!snd_info_get_line(buffer, line, sizeof(line))) {
|
---|
354 | if (sscanf(line, "%x %x", ®, &val) != 2)
|
---|
355 | continue;
|
---|
356 | if ((reg < 0x40) && (reg >=0) && (val <= 0xffffffff) ) {
|
---|
357 | spin_lock_irqsave(&emu->emu_lock, flags);
|
---|
358 | outl(val, emu->port + (reg & 0xfffffffc));
|
---|
359 | spin_unlock_irqrestore(&emu->emu_lock, flags);
|
---|
360 | }
|
---|
361 | }
|
---|
362 | }
|
---|
363 |
|
---|
364 | static unsigned int snd_ptr_read(emu10k1_t * emu,
|
---|
365 | unsigned int iobase,
|
---|
366 | unsigned int reg,
|
---|
367 | unsigned int chn)
|
---|
368 | {
|
---|
369 | unsigned long flags;
|
---|
370 | unsigned int regptr, val;
|
---|
371 |
|
---|
372 | regptr = (reg << 16) | chn;
|
---|
373 |
|
---|
374 | spin_lock_irqsave(&emu->emu_lock, flags);
|
---|
375 | outl(regptr, emu->port + iobase + PTR);
|
---|
376 | val = inl(emu->port + iobase + DATA);
|
---|
377 | spin_unlock_irqrestore(&emu->emu_lock, flags);
|
---|
378 | return val;
|
---|
379 | }
|
---|
380 |
|
---|
381 | static void snd_ptr_write(emu10k1_t *emu,
|
---|
382 | unsigned int iobase,
|
---|
383 | unsigned int reg,
|
---|
384 | unsigned int chn,
|
---|
385 | unsigned int data)
|
---|
386 | {
|
---|
387 | unsigned int regptr;
|
---|
388 | unsigned long flags;
|
---|
389 |
|
---|
390 | regptr = (reg << 16) | chn;
|
---|
391 |
|
---|
392 | spin_lock_irqsave(&emu->emu_lock, flags);
|
---|
393 | outl(regptr, emu->port + iobase + PTR);
|
---|
394 | outl(data, emu->port + iobase + DATA);
|
---|
395 | spin_unlock_irqrestore(&emu->emu_lock, flags);
|
---|
396 | }
|
---|
397 |
|
---|
398 |
|
---|
399 | static void snd_emu_proc_ptr_reg_read(snd_info_entry_t *entry,
|
---|
400 | snd_info_buffer_t * buffer, int iobase, int offset, int length)
|
---|
401 | {
|
---|
402 | emu10k1_t *emu = entry->private_data;
|
---|
403 | unsigned long value;
|
---|
404 | int i,j;
|
---|
405 | if (offset+length > 0x80) {
|
---|
406 | snd_iprintf(buffer, "Input values out of range\n");
|
---|
407 | return;
|
---|
408 | }
|
---|
409 | snd_iprintf(buffer, "Registers 0x%x\n", iobase);
|
---|
410 | for(i = offset; i < offset+length; i++) {
|
---|
411 | snd_iprintf(buffer, "%02X: ",i);
|
---|
412 | for (j = 0; j < 64; j++) {
|
---|
413 | if(iobase == 0)
|
---|
414 | value = snd_ptr_read(emu, 0, i, j);
|
---|
415 | else
|
---|
416 | value = snd_ptr_read(emu, 0x20, i, j);
|
---|
417 | snd_iprintf(buffer, "%08lX ", value);
|
---|
418 | }
|
---|
419 | snd_iprintf(buffer, "\n");
|
---|
420 | }
|
---|
421 | }
|
---|
422 |
|
---|
423 | static void snd_emu_proc_ptr_reg_write(snd_info_entry_t *entry,
|
---|
424 | snd_info_buffer_t * buffer, int iobase)
|
---|
425 | {
|
---|
426 | emu10k1_t *emu = entry->private_data;
|
---|
427 | char line[64];
|
---|
428 | unsigned int reg, channel_id , val;
|
---|
429 | while (!snd_info_get_line(buffer, line, sizeof(line))) {
|
---|
430 | if (sscanf(line, "%x %x %x", ®, &channel_id, &val) != 3)
|
---|
431 | continue;
|
---|
432 | if ((reg < 0x80) && (reg >=0) && (val <= 0xffffffff) && (channel_id >=0) && (channel_id <= 3) )
|
---|
433 | snd_ptr_write(emu, iobase, reg, channel_id, val);
|
---|
434 | }
|
---|
435 | }
|
---|
436 |
|
---|
437 | static void snd_emu_proc_ptr_reg_write00(snd_info_entry_t *entry,
|
---|
438 | snd_info_buffer_t * buffer)
|
---|
439 | {
|
---|
440 | snd_emu_proc_ptr_reg_write(entry, buffer, 0);
|
---|
441 | }
|
---|
442 |
|
---|
443 | static void snd_emu_proc_ptr_reg_write20(snd_info_entry_t *entry,
|
---|
444 | snd_info_buffer_t * buffer)
|
---|
445 | {
|
---|
446 | snd_emu_proc_ptr_reg_write(entry, buffer, 0x20);
|
---|
447 | }
|
---|
448 |
|
---|
449 |
|
---|
450 | static void snd_emu_proc_ptr_reg_read00a(snd_info_entry_t *entry,
|
---|
451 | snd_info_buffer_t * buffer)
|
---|
452 | {
|
---|
453 | snd_emu_proc_ptr_reg_read(entry, buffer, 0, 0, 0x40);
|
---|
454 | }
|
---|
455 |
|
---|
456 | static void snd_emu_proc_ptr_reg_read00b(snd_info_entry_t *entry,
|
---|
457 | snd_info_buffer_t * buffer)
|
---|
458 | {
|
---|
459 | snd_emu_proc_ptr_reg_read(entry, buffer, 0, 0x40, 0x40);
|
---|
460 | }
|
---|
461 |
|
---|
462 | static void snd_emu_proc_ptr_reg_read20a(snd_info_entry_t *entry,
|
---|
463 | snd_info_buffer_t * buffer)
|
---|
464 | {
|
---|
465 | snd_emu_proc_ptr_reg_read(entry, buffer, 0x20, 0, 0x40);
|
---|
466 | }
|
---|
467 |
|
---|
468 | static void snd_emu_proc_ptr_reg_read20b(snd_info_entry_t *entry,
|
---|
469 | snd_info_buffer_t * buffer)
|
---|
470 | {
|
---|
471 | snd_emu_proc_ptr_reg_read(entry, buffer, 0x20, 0x40, 0x40);
|
---|
472 | }
|
---|
473 | #endif
|
---|
474 |
|
---|
475 |
|
---|
476 | #ifdef TARGET_OS2
|
---|
477 | static struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = {
|
---|
478 | 0, 0, snd_emu10k1_fx8010_read, 0, 0,0,0,0
|
---|
479 | };
|
---|
480 | #else
|
---|
481 | static struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = {
|
---|
482 | read: snd_emu10k1_fx8010_read,
|
---|
483 | };
|
---|
484 | #endif
|
---|
485 | int __devinit snd_emu10k1_proc_init(emu10k1_t * emu)
|
---|
486 | {
|
---|
487 | snd_info_entry_t *entry;
|
---|
488 | #ifdef CONFIG_SND_DEBUG
|
---|
489 | if (! snd_card_proc_new(emu->card, "io_regs", &entry)) {
|
---|
490 | snd_info_set_text_ops(entry, emu, 1024, snd_emu_proc_io_reg_read);
|
---|
491 | entry->c.text.write_size = 64;
|
---|
492 | entry->c.text.write = snd_emu_proc_io_reg_write;
|
---|
493 | }
|
---|
494 | if (! snd_card_proc_new(emu->card, "ptr_regs00a", &entry)) {
|
---|
495 | snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read00a);
|
---|
496 | entry->c.text.write_size = 64;
|
---|
497 | entry->c.text.write = snd_emu_proc_ptr_reg_write00;
|
---|
498 | }
|
---|
499 | if (! snd_card_proc_new(emu->card, "ptr_regs00b", &entry)) {
|
---|
500 | snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read00b);
|
---|
501 | entry->c.text.write_size = 64;
|
---|
502 | entry->c.text.write = snd_emu_proc_ptr_reg_write00;
|
---|
503 | }
|
---|
504 | if (! snd_card_proc_new(emu->card, "ptr_regs20a", &entry)) {
|
---|
505 | snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read20a);
|
---|
506 | entry->c.text.write_size = 64;
|
---|
507 | entry->c.text.write = snd_emu_proc_ptr_reg_write20;
|
---|
508 | }
|
---|
509 | if (! snd_card_proc_new(emu->card, "ptr_regs20b", &entry)) {
|
---|
510 | snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read20b);
|
---|
511 | entry->c.text.write_size = 64;
|
---|
512 | entry->c.text.write = snd_emu_proc_ptr_reg_write20;
|
---|
513 | }
|
---|
514 | #endif
|
---|
515 |
|
---|
516 | if (! snd_card_proc_new(emu->card, "emu10k1", &entry))
|
---|
517 | snd_info_set_text_ops(entry, emu, 1024, snd_emu10k1_proc_read);
|
---|
518 |
|
---|
519 | if (! snd_card_proc_new(emu->card, "voices", &entry))
|
---|
520 | snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_voices_read);
|
---|
521 |
|
---|
522 | if (! snd_card_proc_new(emu->card, "fx8010_gpr", &entry)) {
|
---|
523 | entry->content = SNDRV_INFO_CONTENT_DATA;
|
---|
524 | entry->private_data = emu;
|
---|
525 | entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
|
---|
526 | entry->size = emu->audigy ? A_TOTAL_SIZE_GPR : TOTAL_SIZE_GPR;
|
---|
527 | entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
|
---|
528 | }
|
---|
529 | if (! snd_card_proc_new(emu->card, "fx8010_tram_data", &entry)) {
|
---|
530 | entry->content = SNDRV_INFO_CONTENT_DATA;
|
---|
531 | entry->private_data = emu;
|
---|
532 | entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
|
---|
533 | entry->size = emu->audigy ? A_TOTAL_SIZE_TANKMEM_DATA : TOTAL_SIZE_TANKMEM_DATA ;
|
---|
534 | entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
|
---|
535 | }
|
---|
536 | if (! snd_card_proc_new(emu->card, "fx8010_tram_addr", &entry)) {
|
---|
537 | entry->content = SNDRV_INFO_CONTENT_DATA;
|
---|
538 | entry->private_data = emu;
|
---|
539 | entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
|
---|
540 | entry->size = emu->audigy ? A_TOTAL_SIZE_TANKMEM_ADDR : TOTAL_SIZE_TANKMEM_ADDR ;
|
---|
541 | entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
|
---|
542 | }
|
---|
543 | if (! snd_card_proc_new(emu->card, "fx8010_code", &entry)) {
|
---|
544 | entry->content = SNDRV_INFO_CONTENT_DATA;
|
---|
545 | entry->private_data = emu;
|
---|
546 | entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
|
---|
547 | entry->size = emu->audigy ? A_TOTAL_SIZE_CODE : TOTAL_SIZE_CODE;
|
---|
548 | entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
|
---|
549 | }
|
---|
550 | if (! snd_card_proc_new(emu->card, "fx8010_acode", &entry)) {
|
---|
551 | entry->content = SNDRV_INFO_CONTENT_TEXT;
|
---|
552 | entry->private_data = emu;
|
---|
553 | entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
|
---|
554 | entry->c.text.read_size = 128*1024;
|
---|
555 | entry->c.text.read = snd_emu10k1_proc_acode_read;
|
---|
556 | }
|
---|
557 | return 0;
|
---|
558 | }
|
---|
559 |
|
---|