emuproc.c 18 KB

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