emuproc.c 19 KB

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