Linux Sound Driver & TB Pinnacle

Andrew Veliath (andrewtv@usa.net)
Tue, 14 Apr 1998 00:57:59 -0300


Hello,

I'm working on an OSS/Free compatible sound driver for the TB Pinnacle
(and eventually all Multisound cards). I currently have the mixer
working for my TB Pinnacle (if anyone has a Pinnacle and wants to
alpha/beta test, let me know). The module I'm writing gets inserted
as follows:

insmod sound
insmod multisound type=3 io=0x210 irq=5 sma=0xd8000

Now, for the audio part, since these cards do not use DMA transfer, we
can do sort of a pseudo-DMA transfer. I noticed the GUS driver
employs a flag called DMA_NODMA, but the card actually does use a DMA
channel, so it still allocates one. If I'm going to work on any audio
related abilities, I have to modify the sound driver to accept it.

This module doesn't even want a DMA channel, so I'd propose something
along the lines of a pseudo-DMA channel, where sound_install_audiodrv
is called with DMA_PSEUDO as an audio flag, which automatically
selects DMA_NODMA as dmap flags when the device is opened. The
attached simple patch implements this change (I used a bit between
DMA_HARDSTOP and DMA_EXACT, it was just there and didn't seem to be
used).

One minor thing--considering that Alan is making many changes to the
sound driver, are there any plans to move some of the sound driver
headers to include/linux to make writing pure sound driver modules
easier to write (i.e. soundmodule.h, sound_config.h, etc.)? Then one
wouldn't need the kernel sources, just the include files.

Andrew

diff -ur /tmp/linux/drivers/sound/dev_table.h ./dev_table.h
--- /tmp/linux/drivers/sound/dev_table.h Tue Apr 14 00:07:37 1998
+++ ./dev_table.h Mon Apr 13 23:57:10 1998
@@ -207,6 +207,7 @@
#define DMA_DUPLEX 0x04
#define DMA_PSEUDO_AUTOMODE 0x08
#define DMA_HARDSTOP 0x10
+#define DMA_PSEUDO 0x20
#define DMA_EXACT 0x40
#define DMA_NORESET 0x80
int format_mask; /* Bitmask for supported audio formats */
diff -ur /tmp/linux/drivers/sound/dmabuf.c ./dmabuf.c
--- /tmp/linux/drivers/sound/dmabuf.c Tue Apr 14 00:07:37 1998
+++ ./dmabuf.c Mon Apr 13 23:59:43 1998
@@ -171,6 +171,7 @@
static int open_dmap(struct audio_operations *adev, int mode, struct dma_buffparms *dmap)
{
int err;
+ int nodma = adev->flags & DMA_PSEUDO;

if (dmap->flags & DMA_BUSY)
return -EBUSY;
@@ -181,7 +182,7 @@
printk(KERN_WARNING "Sound: DMA buffers not available\n");
return -ENOSPC; /* Memory allocation failed during boot */
}
- if (sound_open_dma(dmap->dma, adev->name)) {
+ if (!nodma && sound_open_dma(dmap->dma, adev->name)) {
printk(KERN_WARNING "Unable to grab(2) DMA%d for the audio driver\n", dmap->dma);
return -EBUSY;
}
@@ -196,12 +197,15 @@
dmap->needs_reorg = 1;
dmap->audio_callback = NULL;
dmap->callback_parm = 0;
+ if (nodma)
+ dmap->flags |= DMA_NODMA;
return 0;
}

static void close_dmap(struct audio_operations *adev, struct dma_buffparms *dmap)
{
- sound_close_dma(dmap->dma);
+ if (!(adev->flags & DMA_PSEUDO))
+ sound_close_dma(dmap->dma);
if (dmap->flags & DMA_BUSY)
dmap->dma_mode = DMODE_NONE;
dmap->flags &= ~DMA_BUSY;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu