emuproc.c 18 KB

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