From 59b2ebda097c9cfbaeffa3663b1481edc3819a66 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Tigeot?= Date: Sat, 7 Jul 2012 23:00:02 +0200 Subject: [PATCH] sound: Create the first /dev/dsp* links At this point the sound device can be used, albeit by only one application at the same time. --- sys/dev/sound/pcm/dsp.c | 8 ++++---- sys/dev/sound/pcm/sound.c | 9 +++++++++ sys/dev/sound/pcm/sound.h | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index eaeb7d2cd0..dbc0d7560d 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -547,10 +547,6 @@ dsp_open(struct dev_open_args *ap) break; } - /* No matching devtype? */ - if (fmt == 0 || spd == 0) - panic("impossible devtype %d", devtype); - rdch = NULL; wrch = NULL; rderror = 0; @@ -2405,6 +2401,10 @@ dsp_stdclone(const char *name, char *namep, char *sep, int use_sep, int *u, int return (0); } +/* + * for i = 0 to channels of device N + * if dspN.i isn't busy and in the right dir, create a dev_t and return it + */ int dsp_clone(struct dev_clone_args *ap) { diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 44b5c197e5..0568652a0f 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -1121,6 +1122,14 @@ pcm_register(device_t dev, void *devinfo, int numplay, int numrec) if (d->flags & SD_F_EQ) feeder_eq_initsys(dev); + /* XXX use make_autoclone_dev? */ + /* XXX PCMMAXCHAN can be created for regular channels */ + d->dsp_clonedev = make_dev(&dsp_ops, + PCMMINOR(device_get_unit(dev)), + UID_ROOT, GID_WHEEL, 0666, "dsp%d", + device_get_unit(dev)); + devfs_clone_handler_add(devtoname(d->dsp_clonedev), dsp_clone); + sndstat_register(dev, d->status, sndstat_prepare_pcm); return 0; diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index 6deb2e0919..942ffe044b 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -402,6 +402,7 @@ struct snddev_info { char status[SND_STATUSLEN]; struct lock *lock; struct cdev *mixer_dev; + struct cdev *dsp_clonedev; uint32_t pvchanrate, pvchanformat; uint32_t rvchanrate, rvchanformat; int32_t eqpreamp; -- 2.41.0