emuproc.c 20 KB

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