sb8_main.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. /*
  2. * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  3. * Uros Bizjak <uros@kss-loka.si>
  4. *
  5. * Routines for control of 8-bit SoundBlaster cards and clones
  6. * Please note: I don't have access to old SB8 soundcards.
  7. *
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. *
  23. * --
  24. *
  25. * Thu Apr 29 20:36:17 BST 1999 George David Morrison <gdm@gedamo.demon.co.uk>
  26. * DSP can't respond to commands whilst in "high speed" mode. Caused
  27. * glitching during playback. Fixed.
  28. *
  29. * Wed Jul 12 22:02:55 CEST 2000 Uros Bizjak <uros@kss-loka.si>
  30. * Cleaned up and rewrote lowlevel routines.
  31. */
  32. #include <asm/io.h>
  33. #include <asm/dma.h>
  34. #include <linux/init.h>
  35. #include <linux/time.h>
  36. #include <sound/core.h>
  37. #include <sound/sb.h>
  38. MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>, Uros Bizjak <uros@kss-loka.si>");
  39. MODULE_DESCRIPTION("Routines for control of 8-bit SoundBlaster cards and clones");
  40. MODULE_LICENSE("GPL");
  41. #define SB8_CLOCK 1000000
  42. #define SB8_DEN(v) ((SB8_CLOCK + (v) / 2) / (v))
  43. #define SB8_RATE(v) (SB8_CLOCK / SB8_DEN(v))
  44. static struct snd_ratnum clock = {
  45. .num = SB8_CLOCK,
  46. .den_min = 1,
  47. .den_max = 256,
  48. .den_step = 1,
  49. };
  50. static struct snd_pcm_hw_constraint_ratnums hw_constraints_clock = {
  51. .nrats = 1,
  52. .rats = &clock,
  53. };
  54. static struct snd_ratnum stereo_clocks[] = {
  55. {
  56. .num = SB8_CLOCK,
  57. .den_min = SB8_DEN(22050),
  58. .den_max = SB8_DEN(22050),
  59. .den_step = 1,
  60. },
  61. {
  62. .num = SB8_CLOCK,
  63. .den_min = SB8_DEN(11025),
  64. .den_max = SB8_DEN(11025),
  65. .den_step = 1,
  66. }
  67. };
  68. static int snd_sb8_hw_constraint_rate_channels(struct snd_pcm_hw_params *params,
  69. struct snd_pcm_hw_rule *rule)
  70. {
  71. struct snd_interval *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
  72. if (c->min > 1) {
  73. unsigned int num = 0, den = 0;
  74. int err = snd_interval_ratnum(hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE),
  75. 2, stereo_clocks, &num, &den);
  76. if (err >= 0 && den) {
  77. params->rate_num = num;
  78. params->rate_den = den;
  79. }
  80. return err;
  81. }
  82. return 0;
  83. }
  84. static int snd_sb8_hw_constraint_channels_rate(struct snd_pcm_hw_params *params,
  85. struct snd_pcm_hw_rule *rule)
  86. {
  87. struct snd_interval *r = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
  88. if (r->min > SB8_RATE(22050) || r->max <= SB8_RATE(11025)) {
  89. struct snd_interval t = { .min = 1, .max = 1 };
  90. return snd_interval_refine(hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS), &t);
  91. }
  92. return 0;
  93. }
  94. static int snd_sb8_playback_prepare(struct snd_pcm_substream *substream)
  95. {
  96. unsigned long flags;
  97. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  98. struct snd_pcm_runtime *runtime = substream->runtime;
  99. unsigned int mixreg, rate, size, count;
  100. rate = runtime->rate;
  101. switch (chip->hardware) {
  102. case SB_HW_PRO:
  103. if (runtime->channels > 1) {
  104. if (snd_BUG_ON(rate != SB8_RATE(11025) &&
  105. rate != SB8_RATE(22050)))
  106. return -EINVAL;
  107. chip->playback_format = SB_DSP_HI_OUTPUT_AUTO;
  108. break;
  109. }
  110. /* fallthru */
  111. case SB_HW_201:
  112. if (rate > 23000) {
  113. chip->playback_format = SB_DSP_HI_OUTPUT_AUTO;
  114. break;
  115. }
  116. /* fallthru */
  117. case SB_HW_20:
  118. chip->playback_format = SB_DSP_LO_OUTPUT_AUTO;
  119. break;
  120. case SB_HW_10:
  121. chip->playback_format = SB_DSP_OUTPUT;
  122. break;
  123. default:
  124. return -EINVAL;
  125. }
  126. size = chip->p_dma_size = snd_pcm_lib_buffer_bytes(substream);
  127. count = chip->p_period_size = snd_pcm_lib_period_bytes(substream);
  128. spin_lock_irqsave(&chip->reg_lock, flags);
  129. snd_sbdsp_command(chip, SB_DSP_SPEAKER_ON);
  130. if (runtime->channels > 1) {
  131. /* set playback stereo mode */
  132. spin_lock(&chip->mixer_lock);
  133. mixreg = snd_sbmixer_read(chip, SB_DSP_STEREO_SW);
  134. snd_sbmixer_write(chip, SB_DSP_STEREO_SW, mixreg | 0x02);
  135. spin_unlock(&chip->mixer_lock);
  136. /* Soundblaster hardware programming reference guide, 3-23 */
  137. snd_sbdsp_command(chip, SB_DSP_DMA8_EXIT);
  138. runtime->dma_area[0] = 0x80;
  139. snd_dma_program(chip->dma8, runtime->dma_addr, 1, DMA_MODE_WRITE);
  140. /* force interrupt */
  141. chip->mode = SB_MODE_HALT;
  142. snd_sbdsp_command(chip, SB_DSP_OUTPUT);
  143. snd_sbdsp_command(chip, 0);
  144. snd_sbdsp_command(chip, 0);
  145. }
  146. snd_sbdsp_command(chip, SB_DSP_SAMPLE_RATE);
  147. if (runtime->channels > 1) {
  148. snd_sbdsp_command(chip, 256 - runtime->rate_den / 2);
  149. spin_lock(&chip->mixer_lock);
  150. /* save output filter status and turn it off */
  151. mixreg = snd_sbmixer_read(chip, SB_DSP_PLAYBACK_FILT);
  152. snd_sbmixer_write(chip, SB_DSP_PLAYBACK_FILT, mixreg | 0x20);
  153. spin_unlock(&chip->mixer_lock);
  154. /* just use force_mode16 for temporary storate... */
  155. chip->force_mode16 = mixreg;
  156. } else {
  157. snd_sbdsp_command(chip, 256 - runtime->rate_den);
  158. }
  159. if (chip->playback_format != SB_DSP_OUTPUT) {
  160. count--;
  161. snd_sbdsp_command(chip, SB_DSP_BLOCK_SIZE);
  162. snd_sbdsp_command(chip, count & 0xff);
  163. snd_sbdsp_command(chip, count >> 8);
  164. }
  165. spin_unlock_irqrestore(&chip->reg_lock, flags);
  166. snd_dma_program(chip->dma8, runtime->dma_addr,
  167. size, DMA_MODE_WRITE | DMA_AUTOINIT);
  168. return 0;
  169. }
  170. static int snd_sb8_playback_trigger(struct snd_pcm_substream *substream,
  171. int cmd)
  172. {
  173. unsigned long flags;
  174. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  175. unsigned int count;
  176. spin_lock_irqsave(&chip->reg_lock, flags);
  177. switch (cmd) {
  178. case SNDRV_PCM_TRIGGER_START:
  179. snd_sbdsp_command(chip, chip->playback_format);
  180. if (chip->playback_format == SB_DSP_OUTPUT) {
  181. count = chip->p_period_size - 1;
  182. snd_sbdsp_command(chip, count & 0xff);
  183. snd_sbdsp_command(chip, count >> 8);
  184. }
  185. break;
  186. case SNDRV_PCM_TRIGGER_STOP:
  187. if (chip->playback_format == SB_DSP_HI_OUTPUT_AUTO) {
  188. struct snd_pcm_runtime *runtime = substream->runtime;
  189. snd_sbdsp_reset(chip);
  190. if (runtime->channels > 1) {
  191. spin_lock(&chip->mixer_lock);
  192. /* restore output filter and set hardware to mono mode */
  193. snd_sbmixer_write(chip, SB_DSP_STEREO_SW, chip->force_mode16 & ~0x02);
  194. spin_unlock(&chip->mixer_lock);
  195. }
  196. } else {
  197. snd_sbdsp_command(chip, SB_DSP_DMA8_OFF);
  198. }
  199. snd_sbdsp_command(chip, SB_DSP_SPEAKER_OFF);
  200. }
  201. spin_unlock_irqrestore(&chip->reg_lock, flags);
  202. chip->mode = (cmd == SNDRV_PCM_TRIGGER_START) ? SB_MODE_PLAYBACK_8 : SB_MODE_HALT;
  203. return 0;
  204. }
  205. static int snd_sb8_hw_params(struct snd_pcm_substream *substream,
  206. struct snd_pcm_hw_params *hw_params)
  207. {
  208. return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
  209. }
  210. static int snd_sb8_hw_free(struct snd_pcm_substream *substream)
  211. {
  212. snd_pcm_lib_free_pages(substream);
  213. return 0;
  214. }
  215. static int snd_sb8_capture_prepare(struct snd_pcm_substream *substream)
  216. {
  217. unsigned long flags;
  218. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  219. struct snd_pcm_runtime *runtime = substream->runtime;
  220. unsigned int mixreg, rate, size, count;
  221. rate = runtime->rate;
  222. switch (chip->hardware) {
  223. case SB_HW_PRO:
  224. if (runtime->channels > 1) {
  225. if (snd_BUG_ON(rate != SB8_RATE(11025) &&
  226. rate != SB8_RATE(22050)))
  227. return -EINVAL;
  228. chip->capture_format = SB_DSP_HI_INPUT_AUTO;
  229. break;
  230. }
  231. chip->capture_format = (rate > 23000) ? SB_DSP_HI_INPUT_AUTO : SB_DSP_LO_INPUT_AUTO;
  232. break;
  233. case SB_HW_201:
  234. if (rate > 13000) {
  235. chip->capture_format = SB_DSP_HI_INPUT_AUTO;
  236. break;
  237. }
  238. /* fallthru */
  239. case SB_HW_20:
  240. chip->capture_format = SB_DSP_LO_INPUT_AUTO;
  241. break;
  242. case SB_HW_10:
  243. chip->capture_format = SB_DSP_INPUT;
  244. break;
  245. default:
  246. return -EINVAL;
  247. }
  248. size = chip->c_dma_size = snd_pcm_lib_buffer_bytes(substream);
  249. count = chip->c_period_size = snd_pcm_lib_period_bytes(substream);
  250. spin_lock_irqsave(&chip->reg_lock, flags);
  251. snd_sbdsp_command(chip, SB_DSP_SPEAKER_OFF);
  252. if (runtime->channels > 1)
  253. snd_sbdsp_command(chip, SB_DSP_STEREO_8BIT);
  254. snd_sbdsp_command(chip, SB_DSP_SAMPLE_RATE);
  255. if (runtime->channels > 1) {
  256. snd_sbdsp_command(chip, 256 - runtime->rate_den / 2);
  257. spin_lock(&chip->mixer_lock);
  258. /* save input filter status and turn it off */
  259. mixreg = snd_sbmixer_read(chip, SB_DSP_CAPTURE_FILT);
  260. snd_sbmixer_write(chip, SB_DSP_CAPTURE_FILT, mixreg | 0x20);
  261. spin_unlock(&chip->mixer_lock);
  262. /* just use force_mode16 for temporary storate... */
  263. chip->force_mode16 = mixreg;
  264. } else {
  265. snd_sbdsp_command(chip, 256 - runtime->rate_den);
  266. }
  267. if (chip->capture_format != SB_DSP_INPUT) {
  268. count--;
  269. snd_sbdsp_command(chip, SB_DSP_BLOCK_SIZE);
  270. snd_sbdsp_command(chip, count & 0xff);
  271. snd_sbdsp_command(chip, count >> 8);
  272. }
  273. spin_unlock_irqrestore(&chip->reg_lock, flags);
  274. snd_dma_program(chip->dma8, runtime->dma_addr,
  275. size, DMA_MODE_READ | DMA_AUTOINIT);
  276. return 0;
  277. }
  278. static int snd_sb8_capture_trigger(struct snd_pcm_substream *substream,
  279. int cmd)
  280. {
  281. unsigned long flags;
  282. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  283. unsigned int count;
  284. spin_lock_irqsave(&chip->reg_lock, flags);
  285. switch (cmd) {
  286. case SNDRV_PCM_TRIGGER_START:
  287. snd_sbdsp_command(chip, chip->capture_format);
  288. if (chip->capture_format == SB_DSP_INPUT) {
  289. count = chip->c_period_size - 1;
  290. snd_sbdsp_command(chip, count & 0xff);
  291. snd_sbdsp_command(chip, count >> 8);
  292. }
  293. break;
  294. case SNDRV_PCM_TRIGGER_STOP:
  295. if (chip->capture_format == SB_DSP_HI_INPUT_AUTO) {
  296. struct snd_pcm_runtime *runtime = substream->runtime;
  297. snd_sbdsp_reset(chip);
  298. if (runtime->channels > 1) {
  299. /* restore input filter status */
  300. spin_lock(&chip->mixer_lock);
  301. snd_sbmixer_write(chip, SB_DSP_CAPTURE_FILT, chip->force_mode16);
  302. spin_unlock(&chip->mixer_lock);
  303. /* set hardware to mono mode */
  304. snd_sbdsp_command(chip, SB_DSP_MONO_8BIT);
  305. }
  306. } else {
  307. snd_sbdsp_command(chip, SB_DSP_DMA8_OFF);
  308. }
  309. snd_sbdsp_command(chip, SB_DSP_SPEAKER_OFF);
  310. }
  311. spin_unlock_irqrestore(&chip->reg_lock, flags);
  312. chip->mode = (cmd == SNDRV_PCM_TRIGGER_START) ? SB_MODE_CAPTURE_8 : SB_MODE_HALT;
  313. return 0;
  314. }
  315. irqreturn_t snd_sb8dsp_interrupt(struct snd_sb *chip)
  316. {
  317. struct snd_pcm_substream *substream;
  318. struct snd_pcm_runtime *runtime;
  319. snd_sb_ack_8bit(chip);
  320. switch (chip->mode) {
  321. case SB_MODE_PLAYBACK_8: /* ok.. playback is active */
  322. substream = chip->playback_substream;
  323. runtime = substream->runtime;
  324. if (chip->playback_format == SB_DSP_OUTPUT)
  325. snd_sb8_playback_trigger(substream, SNDRV_PCM_TRIGGER_START);
  326. snd_pcm_period_elapsed(substream);
  327. break;
  328. case SB_MODE_CAPTURE_8:
  329. substream = chip->capture_substream;
  330. runtime = substream->runtime;
  331. if (chip->capture_format == SB_DSP_INPUT)
  332. snd_sb8_capture_trigger(substream, SNDRV_PCM_TRIGGER_START);
  333. snd_pcm_period_elapsed(substream);
  334. break;
  335. }
  336. return IRQ_HANDLED;
  337. }
  338. static snd_pcm_uframes_t snd_sb8_playback_pointer(struct snd_pcm_substream *substream)
  339. {
  340. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  341. size_t ptr;
  342. if (chip->mode != SB_MODE_PLAYBACK_8)
  343. return 0;
  344. ptr = snd_dma_pointer(chip->dma8, chip->p_dma_size);
  345. return bytes_to_frames(substream->runtime, ptr);
  346. }
  347. static snd_pcm_uframes_t snd_sb8_capture_pointer(struct snd_pcm_substream *substream)
  348. {
  349. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  350. size_t ptr;
  351. if (chip->mode != SB_MODE_CAPTURE_8)
  352. return 0;
  353. ptr = snd_dma_pointer(chip->dma8, chip->c_dma_size);
  354. return bytes_to_frames(substream->runtime, ptr);
  355. }
  356. /*
  357. */
  358. static struct snd_pcm_hardware snd_sb8_playback =
  359. {
  360. .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
  361. SNDRV_PCM_INFO_MMAP_VALID),
  362. .formats = SNDRV_PCM_FMTBIT_U8,
  363. .rates = (SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000 |
  364. SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_22050),
  365. .rate_min = 4000,
  366. .rate_max = 23000,
  367. .channels_min = 1,
  368. .channels_max = 1,
  369. .buffer_bytes_max = 65536,
  370. .period_bytes_min = 64,
  371. .period_bytes_max = 65536,
  372. .periods_min = 1,
  373. .periods_max = 1024,
  374. .fifo_size = 0,
  375. };
  376. static struct snd_pcm_hardware snd_sb8_capture =
  377. {
  378. .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
  379. SNDRV_PCM_INFO_MMAP_VALID),
  380. .formats = SNDRV_PCM_FMTBIT_U8,
  381. .rates = (SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000 |
  382. SNDRV_PCM_RATE_11025),
  383. .rate_min = 4000,
  384. .rate_max = 13000,
  385. .channels_min = 1,
  386. .channels_max = 1,
  387. .buffer_bytes_max = 65536,
  388. .period_bytes_min = 64,
  389. .period_bytes_max = 65536,
  390. .periods_min = 1,
  391. .periods_max = 1024,
  392. .fifo_size = 0,
  393. };
  394. /*
  395. *
  396. */
  397. static int snd_sb8_open(struct snd_pcm_substream *substream)
  398. {
  399. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  400. struct snd_pcm_runtime *runtime = substream->runtime;
  401. unsigned long flags;
  402. spin_lock_irqsave(&chip->open_lock, flags);
  403. if (chip->open) {
  404. spin_unlock_irqrestore(&chip->open_lock, flags);
  405. return -EAGAIN;
  406. }
  407. chip->open |= SB_OPEN_PCM;
  408. spin_unlock_irqrestore(&chip->open_lock, flags);
  409. if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
  410. chip->playback_substream = substream;
  411. runtime->hw = snd_sb8_playback;
  412. } else {
  413. chip->capture_substream = substream;
  414. runtime->hw = snd_sb8_capture;
  415. }
  416. switch (chip->hardware) {
  417. case SB_HW_PRO:
  418. runtime->hw.rate_max = 44100;
  419. runtime->hw.channels_max = 2;
  420. snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
  421. snd_sb8_hw_constraint_rate_channels, NULL,
  422. SNDRV_PCM_HW_PARAM_CHANNELS,
  423. SNDRV_PCM_HW_PARAM_RATE, -1);
  424. snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
  425. snd_sb8_hw_constraint_channels_rate, NULL,
  426. SNDRV_PCM_HW_PARAM_RATE, -1);
  427. break;
  428. case SB_HW_201:
  429. if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
  430. runtime->hw.rate_max = 44100;
  431. } else {
  432. runtime->hw.rate_max = 15000;
  433. }
  434. default:
  435. break;
  436. }
  437. snd_pcm_hw_constraint_ratnums(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
  438. &hw_constraints_clock);
  439. return 0;
  440. }
  441. static int snd_sb8_close(struct snd_pcm_substream *substream)
  442. {
  443. unsigned long flags;
  444. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  445. chip->playback_substream = NULL;
  446. chip->capture_substream = NULL;
  447. spin_lock_irqsave(&chip->open_lock, flags);
  448. chip->open &= ~SB_OPEN_PCM;
  449. spin_unlock_irqrestore(&chip->open_lock, flags);
  450. return 0;
  451. }
  452. /*
  453. * Initialization part
  454. */
  455. static struct snd_pcm_ops snd_sb8_playback_ops = {
  456. .open = snd_sb8_open,
  457. .close = snd_sb8_close,
  458. .ioctl = snd_pcm_lib_ioctl,
  459. .hw_params = snd_sb8_hw_params,
  460. .hw_free = snd_sb8_hw_free,
  461. .prepare = snd_sb8_playback_prepare,
  462. .trigger = snd_sb8_playback_trigger,
  463. .pointer = snd_sb8_playback_pointer,
  464. };
  465. static struct snd_pcm_ops snd_sb8_capture_ops = {
  466. .open = snd_sb8_open,
  467. .close = snd_sb8_close,
  468. .ioctl = snd_pcm_lib_ioctl,
  469. .hw_params = snd_sb8_hw_params,
  470. .hw_free = snd_sb8_hw_free,
  471. .prepare = snd_sb8_capture_prepare,
  472. .trigger = snd_sb8_capture_trigger,
  473. .pointer = snd_sb8_capture_pointer,
  474. };
  475. int snd_sb8dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm)
  476. {
  477. struct snd_card *card = chip->card;
  478. struct snd_pcm *pcm;
  479. int err;
  480. if (rpcm)
  481. *rpcm = NULL;
  482. if ((err = snd_pcm_new(card, "SB8 DSP", device, 1, 1, &pcm)) < 0)
  483. return err;
  484. sprintf(pcm->name, "DSP v%i.%i", chip->version >> 8, chip->version & 0xff);
  485. pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX;
  486. pcm->private_data = chip;
  487. snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sb8_playback_ops);
  488. snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb8_capture_ops);
  489. snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
  490. snd_dma_isa_data(),
  491. 64*1024, 64*1024);
  492. if (rpcm)
  493. *rpcm = pcm;
  494. return 0;
  495. }
  496. EXPORT_SYMBOL(snd_sb8dsp_pcm);
  497. EXPORT_SYMBOL(snd_sb8dsp_interrupt);
  498. /* sb8_midi.c */
  499. EXPORT_SYMBOL(snd_sb8dsp_midi_interrupt);
  500. EXPORT_SYMBOL(snd_sb8dsp_midi);
  501. /*
  502. * INIT part
  503. */
  504. static int __init alsa_sb8_init(void)
  505. {
  506. return 0;
  507. }
  508. static void __exit alsa_sb8_exit(void)
  509. {
  510. }
  511. module_init(alsa_sb8_init)
  512. module_exit(alsa_sb8_exit)