38 #include <linux/kernel.h>
39 #include <linux/types.h>
44 #include <linux/module.h>
53 #define LOGNAME "msnd"
67 unsigned int io = dev->
io;
77 static int snd_msnd_wait_HC0(
struct snd_msnd *dev)
79 unsigned int io = dev->
io;
94 if (snd_msnd_wait_HC0(dev) == 0) {
96 spin_unlock_irqrestore(&dev->
lock, flags);
99 spin_unlock_irqrestore(&dev->
lock, flags);
108 unsigned char mid,
unsigned char low)
110 unsigned int io = dev->
io;
112 if (snd_msnd_wait_TXDE(dev) == 0) {
131 ": Upload host data not multiple of 3!\n");
135 for (i = 0; i < len; i += 3)
156 if (snd_msnd_wait_TXDE(dev) == 0) {
158 if (dev->
type == msndClassic)
166 spin_unlock_irqrestore(&dev->
lock, flags);
169 spin_unlock_irqrestore(&dev->
lock, flags);
191 if (snd_msnd_wait_TXDE(dev) == 0) {
193 if (dev->
type == msndClassic)
196 spin_unlock_irqrestore(&dev->
lock, flags);
199 spin_unlock_irqrestore(&dev->
lock, flags);
213 static void snd_msnd_dsp_write_flush(
struct snd_msnd *
chip)
236 ": Stopping read for %p\n", file);
237 chip->
mode &= ~FMODE_READ;
243 snd_msnd_dsp_write_flush(chip);
249 LOGNAME ": Stopping write for %p\n", file);
250 chip->
mode &= ~FMODE_WRITE;
312 static int play_banks_submitted;
322 play_banks_submitted = 0;
331 if (play_banks_submitted < 3)
332 ++play_banks_submitted;
367 static void snd_msnd_play_reset_queue(
struct snd_msnd *chip,
368 unsigned int pcm_periods,
369 unsigned int pcm_count)
375 chip->
playLimit = pcm_count * (pcm_periods - 1);
382 for (n = 0; n < pcm_periods; ++
n, pDAQ +=
DAQDS__size) {
395 static void snd_msnd_capture_reset_queue(
struct snd_msnd *chip,
396 unsigned int pcm_periods,
397 unsigned int pcm_count)
417 spin_unlock_irqrestore(&chip->
lock,
flags);
421 snd_printdd(
"snd_msnd_capture_reset_queue() %i\n", pcm_count);
425 for (n = 0; n < pcm_periods; ++
n, pDAQ +=
DAQDS__size) {
450 .buffer_bytes_max = 0x3000,
451 .period_bytes_min = 0x40,
452 .period_bytes_max = 0x1800,
469 .buffer_bytes_max = 0x3000,
470 .period_bytes_min = 0x40,
471 .period_bytes_max = 0x1800,
491 runtime->
hw = snd_msnd_playback;
531 unsigned int pcm_size = snd_pcm_lib_buffer_bytes(substream);
532 unsigned int pcm_count = snd_pcm_lib_period_bytes(substream);
533 unsigned int pcm_periods = pcm_size / pcm_count;
535 snd_msnd_play_reset_queue(chip, pcm_periods, pcm_count);
574 static struct snd_pcm_ops snd_msnd_playback_ops = {
575 .open = snd_msnd_playback_open,
576 .close = snd_msnd_playback_close,
578 .hw_params = snd_msnd_playback_hw_params,
579 .prepare = snd_msnd_playback_prepare,
580 .trigger = snd_msnd_playback_trigger,
581 .pointer = snd_msnd_playback_pointer,
595 runtime->
hw = snd_msnd_capture;
611 unsigned int pcm_size = snd_pcm_lib_buffer_bytes(substream);
612 unsigned int pcm_count = snd_pcm_lib_period_bytes(substream);
613 unsigned int pcm_periods = pcm_size / pcm_count;
615 snd_msnd_capture_reset_queue(chip, pcm_periods, pcm_count);
672 .open = snd_msnd_capture_open,
673 .close = snd_msnd_capture_close,
675 .hw_params = snd_msnd_capture_hw_params,
676 .prepare = snd_msnd_capture_prepare,
677 .trigger = snd_msnd_capture_trigger,
678 .pointer = snd_msnd_capture_pointer,
689 err =
snd_pcm_new(card,
"MSNDPINNACLE", device, 1, 1, &pcm);