summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorcg <cg@FreeBSD.org>1999-12-19 15:27:24 +0000
committercg <cg@FreeBSD.org>1999-12-19 15:27:24 +0000
commit6221457152a03f0af8bd48449a5670fb9e6d417e (patch)
tree4afe7e8e2f0b4a0c74124321b6379153f9c973dd /sys/dev
parent34deed4b4fbb189128d375832693f0c5afdf6cb1 (diff)
downloadFreeBSD-src-6221457152a03f0af8bd48449a5670fb9e6d417e.zip
FreeBSD-src-6221457152a03f0af8bd48449a5670fb9e6d417e.tar.gz
move make_dev operations for audio channels to pcm_addchan(). in theory,
with modifications to MAKEDEV this will allow use of multiple output streams on cards supporting it, eg trident 4dwave.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/sound/pcm/sound.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c
index a76a6b0..1d26f45 100644
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -84,7 +84,7 @@ minor = (channel << 8) + (unit << 4) + dev
#define PCMCHAN(x) ((PCMMINOR(x) & 0x0000ff00) >> 8)
#define PCMUNIT(x) ((PCMMINOR(x) & 0x000000f0) >> 4)
#define PCMDEV(x) (PCMMINOR(x) & 0x0000000f)
-#define PCMMKMINOR(u, d) (((u) & 0x0f) << 4 | ((d) & 0x0f))
+#define PCMMKMINOR(u, d, c) ((((c) & 0xff) << 8) | (((u) & 0x0f) << 4) | ((d) & 0x0f))
static devclass_t pcm_devclass;
@@ -97,12 +97,20 @@ gsd(int unit)
int
pcm_addchan(device_t dev, int dir, pcm_channel *templ, void *devinfo)
{
+ int unit = device_get_unit(dev);
snddev_info *d = device_get_softc(dev);
pcm_channel *ch;
ch = (dir == PCMDIR_PLAY)? &d->play[d->playcount++] : &d->rec[d->reccount++];
*ch = *templ;
chn_init(ch, devinfo, dir);
+ make_dev(&snd_cdevsw, PCMMKMINOR(unit, SND_DEV_DSP, d->chancount),
+ UID_ROOT, GID_WHEEL, 0666, "dsp%d.%d", unit, d->chancount);
+ make_dev(&snd_cdevsw, PCMMKMINOR(unit, SND_DEV_AUDIO, d->chancount),
+ UID_ROOT, GID_WHEEL, 0666, "audio%d.%d", unit, d->chancount);
+ make_dev(&snd_cdevsw, PCMMKMINOR(unit, SND_DEV_DSP16, d->chancount),
+ UID_ROOT, GID_WHEEL, 0666, "dspW%d.%d", unit, d->chancount);
+ /* XXX SND_DEV_NORESET? */
d->chancount++;
return 0;
}
@@ -144,18 +152,11 @@ pcm_register(device_t dev, void *devinfo, int numplay, int numrec)
if (!pcm_devclass) {
pcm_devclass = device_get_devclass(dev);
- make_dev(&snd_cdevsw, PCMMKMINOR(0, SND_DEV_STATUS),
+ make_dev(&snd_cdevsw, PCMMKMINOR(0, SND_DEV_STATUS, 0),
UID_ROOT, GID_WHEEL, 0444, "sndstat");
}
- make_dev(&snd_cdevsw, PCMMKMINOR(unit, SND_DEV_CTL),
+ make_dev(&snd_cdevsw, PCMMKMINOR(unit, SND_DEV_CTL, 0),
UID_ROOT, GID_WHEEL, 0666, "mixer%d", unit);
- make_dev(&snd_cdevsw, PCMMKMINOR(unit, SND_DEV_DSP),
- UID_ROOT, GID_WHEEL, 0666, "dsp%d", unit);
- make_dev(&snd_cdevsw, PCMMKMINOR(unit, SND_DEV_AUDIO),
- UID_ROOT, GID_WHEEL, 0666, "audio%d", unit);
- make_dev(&snd_cdevsw, PCMMKMINOR(unit, SND_DEV_DSP16),
- UID_ROOT, GID_WHEEL, 0666, "dspW%d", unit);
- /* XXX SND_DEV_NORESET? */
d->devinfo = devinfo;
d->chancount = d->playcount = d->reccount = 0;
sz = (numplay + numrec) * sizeof(pcm_channel *);
OpenPOWER on IntegriCloud