1999-09-01 04:08:39 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk>
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1999-09-01 06:58:27 +00:00
|
|
|
* $FreeBSD$
|
1999-09-01 04:08:39 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/queue.h>
|
|
|
|
|
1999-11-20 16:50:33 +00:00
|
|
|
#include <dev/sound/pcm/sound.h>
|
1999-09-01 04:08:39 +00:00
|
|
|
|
2000-05-27 14:40:17 +00:00
|
|
|
#define OLDPCM_IOCTL
|
|
|
|
|
2001-03-24 23:10:29 +00:00
|
|
|
static int getchns(struct snddev_info *d, int chan, struct pcm_channel **rdch, struct pcm_channel **wrch);
|
1999-09-01 04:08:39 +00:00
|
|
|
|
2001-03-24 23:10:29 +00:00
|
|
|
static struct pcm_channel *
|
|
|
|
allocchn(struct snddev_info *d, int direction)
|
1999-09-01 04:08:39 +00:00
|
|
|
{
|
2001-03-24 23:10:29 +00:00
|
|
|
struct pcm_channel *chns = (direction == PCMDIR_PLAY)? d->play : d->rec;
|
1999-09-01 04:08:39 +00:00
|
|
|
int i, cnt = (direction == PCMDIR_PLAY)? d->playcount : d->reccount;
|
|
|
|
for (i = 0; i < cnt; i++) {
|
2000-06-20 23:27:12 +00:00
|
|
|
if (!(chns[i].flags & (CHN_F_BUSY | CHN_F_DEAD))) {
|
1999-09-01 04:08:39 +00:00
|
|
|
chns[i].flags |= CHN_F_BUSY;
|
|
|
|
return &chns[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2001-03-24 23:10:29 +00:00
|
|
|
getchns(struct snddev_info *d, int chan, struct pcm_channel **rdch, struct pcm_channel **wrch)
|
1999-09-01 04:08:39 +00:00
|
|
|
{
|
1999-12-05 19:09:13 +00:00
|
|
|
KASSERT((d->flags & SD_F_PRIO_SET) != SD_F_PRIO_SET, \
|
|
|
|
("getchns: read and write both prioritised"));
|
|
|
|
|
2000-01-26 20:27:45 +00:00
|
|
|
if ((d->flags & SD_F_SIMPLEX) && (d->flags & SD_F_PRIO_SET)) {
|
2001-03-24 23:10:29 +00:00
|
|
|
*rdch = (d->flags & SD_F_PRIO_RD)? d->arec[chan] : d->fakechan;
|
|
|
|
*wrch = (d->flags & SD_F_PRIO_WR)? d->aplay[chan] : d->fakechan;
|
|
|
|
d->fakechan->flags |= CHN_F_BUSY;
|
1999-09-01 04:08:39 +00:00
|
|
|
} else {
|
|
|
|
*rdch = d->arec[chan];
|
|
|
|
*wrch = d->aplay[chan];
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-03-24 23:10:29 +00:00
|
|
|
setchns(struct snddev_info *d, int chan)
|
1999-09-01 04:08:39 +00:00
|
|
|
{
|
1999-12-05 19:09:13 +00:00
|
|
|
KASSERT((d->flags & SD_F_PRIO_SET) != SD_F_PRIO_SET, \
|
|
|
|
("getchns: read and write both prioritised"));
|
1999-09-01 04:08:39 +00:00
|
|
|
d->flags |= SD_F_DIR_SET;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-03-24 23:10:29 +00:00
|
|
|
dsp_open(struct snddev_info *d, int chan, int oflags, int devtype)
|
1999-09-01 04:08:39 +00:00
|
|
|
{
|
2001-03-24 23:10:29 +00:00
|
|
|
struct pcm_channel *rdch, *wrch;
|
1999-09-01 04:08:39 +00:00
|
|
|
u_int32_t fmt;
|
|
|
|
|
|
|
|
if (chan >= d->chancount) return ENODEV;
|
2000-04-05 01:13:42 +00:00
|
|
|
if ((d->flags & SD_F_SIMPLEX) && (d->ref[chan] > 0)) return EBUSY;
|
2001-03-13 18:43:22 +00:00
|
|
|
|
2000-04-05 01:13:42 +00:00
|
|
|
rdch = d->arec[chan];
|
|
|
|
wrch = d->aplay[chan];
|
1999-09-01 04:08:39 +00:00
|
|
|
if (oflags & FREAD) {
|
2000-04-05 01:13:42 +00:00
|
|
|
if (rdch == NULL) {
|
|
|
|
rdch = allocchn(d, PCMDIR_REC);
|
|
|
|
if (!rdch) return EBUSY;
|
|
|
|
} else return EBUSY;
|
1999-09-01 04:08:39 +00:00
|
|
|
}
|
|
|
|
if (oflags & FWRITE) {
|
2000-04-05 01:13:42 +00:00
|
|
|
if (wrch == NULL) {
|
|
|
|
wrch = allocchn(d, PCMDIR_PLAY);
|
2000-06-20 23:27:12 +00:00
|
|
|
if (!wrch) {
|
|
|
|
if (rdch && (oflags & FREAD))
|
|
|
|
rdch->flags &= ~CHN_F_BUSY;
|
2000-04-05 01:13:42 +00:00
|
|
|
return EBUSY;
|
|
|
|
}
|
|
|
|
} else return EBUSY;
|
1999-09-01 04:08:39 +00:00
|
|
|
}
|
|
|
|
d->aplay[chan] = wrch;
|
|
|
|
d->arec[chan] = rdch;
|
2000-04-05 01:13:42 +00:00
|
|
|
d->ref[chan]++;
|
1999-09-01 04:08:39 +00:00
|
|
|
switch (devtype) {
|
|
|
|
case SND_DEV_DSP16:
|
|
|
|
fmt = AFMT_S16_LE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SND_DEV_DSP:
|
|
|
|
fmt = AFMT_U8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SND_DEV_AUDIO:
|
|
|
|
fmt = AFMT_MU_LAW;
|
|
|
|
break;
|
|
|
|
|
1999-09-28 21:43:35 +00:00
|
|
|
case SND_DEV_NORESET:
|
|
|
|
fmt = 0;
|
|
|
|
break;
|
|
|
|
|
1999-09-01 04:08:39 +00:00
|
|
|
default:
|
|
|
|
return ENXIO;
|
|
|
|
}
|
2001-03-24 23:10:29 +00:00
|
|
|
if (rdch)
|
|
|
|
CHN_LOCK(rdch);
|
|
|
|
if (wrch)
|
|
|
|
CHN_LOCK(wrch);
|
1999-09-01 04:08:39 +00:00
|
|
|
|
2000-04-05 01:13:42 +00:00
|
|
|
if (rdch && (oflags & FREAD)) {
|
2000-04-17 17:06:47 +00:00
|
|
|
chn_reset(rdch, fmt);
|
1999-09-01 04:08:39 +00:00
|
|
|
if (oflags & O_NONBLOCK) rdch->flags |= CHN_F_NBIO;
|
|
|
|
}
|
2000-04-05 01:13:42 +00:00
|
|
|
if (wrch && (oflags & FWRITE)) {
|
2000-04-17 17:06:47 +00:00
|
|
|
chn_reset(wrch, fmt);
|
1999-09-01 04:08:39 +00:00
|
|
|
if (oflags & O_NONBLOCK) wrch->flags |= CHN_F_NBIO;
|
|
|
|
}
|
2001-03-24 23:10:29 +00:00
|
|
|
if (wrch)
|
|
|
|
CHN_UNLOCK(wrch);
|
|
|
|
if (rdch)
|
|
|
|
CHN_UNLOCK(rdch);
|
1999-09-01 04:08:39 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-03-24 23:10:29 +00:00
|
|
|
dsp_close(struct snddev_info *d, int chan, int devtype)
|
1999-09-01 04:08:39 +00:00
|
|
|
{
|
2001-03-24 23:10:29 +00:00
|
|
|
struct pcm_channel *rdch, *wrch;
|
1999-09-01 04:08:39 +00:00
|
|
|
|
2001-03-24 23:10:29 +00:00
|
|
|
d->ref[chan]--;
|
2000-04-05 01:13:42 +00:00
|
|
|
if (d->ref[chan]) return 0;
|
1999-09-01 04:08:39 +00:00
|
|
|
d->flags &= ~SD_F_TRANSIENT;
|
1999-09-04 17:03:59 +00:00
|
|
|
rdch = d->arec[chan];
|
|
|
|
wrch = d->aplay[chan];
|
1999-09-01 04:08:39 +00:00
|
|
|
|
|
|
|
if (rdch) {
|
2001-03-24 23:10:29 +00:00
|
|
|
CHN_LOCK(rdch);
|
1999-09-01 04:08:39 +00:00
|
|
|
chn_abort(rdch);
|
2000-11-07 00:29:24 +00:00
|
|
|
rdch->flags &= ~(CHN_F_BUSY | CHN_F_RUNNING | CHN_F_MAPPED | CHN_F_DEAD);
|
2000-04-17 17:06:47 +00:00
|
|
|
chn_reset(rdch, 0);
|
2001-03-24 23:10:29 +00:00
|
|
|
CHN_UNLOCK(rdch);
|
1999-09-01 04:08:39 +00:00
|
|
|
}
|
1999-12-05 19:09:13 +00:00
|
|
|
if (wrch) {
|
2001-03-24 23:10:29 +00:00
|
|
|
CHN_LOCK(wrch);
|
1999-12-05 19:09:13 +00:00
|
|
|
chn_flush(wrch);
|
2000-11-07 00:29:24 +00:00
|
|
|
wrch->flags &= ~(CHN_F_BUSY | CHN_F_RUNNING | CHN_F_MAPPED | CHN_F_DEAD);
|
2000-04-17 17:06:47 +00:00
|
|
|
chn_reset(wrch, 0);
|
2001-03-24 23:10:29 +00:00
|
|
|
CHN_UNLOCK(wrch);
|
1999-12-05 19:09:13 +00:00
|
|
|
}
|
1999-09-01 04:08:39 +00:00
|
|
|
d->aplay[chan] = NULL;
|
|
|
|
d->arec[chan] = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-03-24 23:10:29 +00:00
|
|
|
dsp_read(struct snddev_info *d, int chan, struct uio *buf, int flag)
|
1999-09-01 04:08:39 +00:00
|
|
|
{
|
2001-03-24 23:10:29 +00:00
|
|
|
struct pcm_channel *rdch, *wrch;
|
|
|
|
int ret;
|
1999-09-01 04:08:39 +00:00
|
|
|
|
|
|
|
if (!(d->flags & SD_F_PRIO_SET)) d->flags |= SD_F_PRIO_RD;
|
|
|
|
if (!(d->flags & SD_F_DIR_SET)) setchns(d, chan);
|
2001-03-24 23:10:29 +00:00
|
|
|
|
1999-09-01 04:08:39 +00:00
|
|
|
getchns(d, chan, &rdch, &wrch);
|
2001-03-24 23:10:29 +00:00
|
|
|
CHN_LOCK(rdch);
|
2000-01-10 07:05:15 +00:00
|
|
|
KASSERT(rdch, ("dsp_read: nonexistant channel"));
|
|
|
|
KASSERT(rdch->flags & CHN_F_BUSY, ("dsp_read: nonbusy channel"));
|
2001-03-24 23:10:29 +00:00
|
|
|
|
|
|
|
if (rdch->flags & (CHN_F_MAPPED | CHN_F_DEAD)) {
|
|
|
|
CHN_UNLOCK(rdch);
|
|
|
|
return EINVAL;
|
|
|
|
}
|
2000-04-17 17:06:47 +00:00
|
|
|
if (!(rdch->flags & CHN_F_RUNNING))
|
1999-09-28 21:43:35 +00:00
|
|
|
rdch->flags |= CHN_F_RUNNING;
|
2001-03-24 23:10:29 +00:00
|
|
|
ret = chn_read(rdch, buf);
|
|
|
|
CHN_UNLOCK(rdch);
|
|
|
|
|
|
|
|
return ret;
|
1999-09-01 04:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-03-24 23:10:29 +00:00
|
|
|
dsp_write(struct snddev_info *d, int chan, struct uio *buf, int flag)
|
1999-09-01 04:08:39 +00:00
|
|
|
{
|
2001-03-24 23:10:29 +00:00
|
|
|
struct pcm_channel *rdch, *wrch;
|
|
|
|
int ret;
|
1999-09-01 04:08:39 +00:00
|
|
|
|
|
|
|
if (!(d->flags & SD_F_PRIO_SET)) d->flags |= SD_F_PRIO_WR;
|
|
|
|
if (!(d->flags & SD_F_DIR_SET)) setchns(d, chan);
|
2001-03-24 23:10:29 +00:00
|
|
|
|
1999-09-01 04:08:39 +00:00
|
|
|
getchns(d, chan, &rdch, &wrch);
|
2001-03-24 23:10:29 +00:00
|
|
|
CHN_LOCK(wrch);
|
1999-12-05 19:09:13 +00:00
|
|
|
KASSERT(wrch, ("dsp_write: nonexistant channel"));
|
|
|
|
KASSERT(wrch->flags & CHN_F_BUSY, ("dsp_write: nonbusy channel"));
|
2001-03-24 23:10:29 +00:00
|
|
|
|
|
|
|
if (wrch->flags & (CHN_F_MAPPED | CHN_F_DEAD)) {
|
|
|
|
CHN_UNLOCK(wrch);
|
|
|
|
return EINVAL;
|
|
|
|
}
|
2000-04-17 17:06:47 +00:00
|
|
|
if (!(wrch->flags & CHN_F_RUNNING))
|
1999-09-28 21:43:35 +00:00
|
|
|
wrch->flags |= CHN_F_RUNNING;
|
2001-03-24 23:10:29 +00:00
|
|
|
ret = chn_write(wrch, buf);
|
|
|
|
CHN_UNLOCK(wrch);
|
|
|
|
|
|
|
|
return ret;
|
1999-09-01 04:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-03-24 23:10:29 +00:00
|
|
|
dsp_ioctl(struct snddev_info *d, int chan, u_long cmd, caddr_t arg)
|
1999-09-01 04:08:39 +00:00
|
|
|
{
|
|
|
|
int ret = 0, *arg_i = (int *)arg;
|
|
|
|
u_long s;
|
2001-03-24 23:10:29 +00:00
|
|
|
struct pcm_channel *wrch = NULL, *rdch = NULL;
|
1999-09-01 04:08:39 +00:00
|
|
|
|
1999-11-13 18:31:31 +00:00
|
|
|
rdch = d->arec[chan];
|
|
|
|
wrch = d->aplay[chan];
|
1999-09-01 04:08:39 +00:00
|
|
|
|
2000-06-20 23:27:12 +00:00
|
|
|
if (rdch && (rdch->flags & CHN_F_DEAD))
|
|
|
|
rdch = NULL;
|
|
|
|
if (wrch && (wrch->flags & CHN_F_DEAD))
|
|
|
|
wrch = NULL;
|
|
|
|
if (!(rdch || wrch))
|
|
|
|
return EINVAL;
|
2001-03-24 23:10:29 +00:00
|
|
|
|
|
|
|
if (wrch)
|
|
|
|
CHN_LOCK(wrch);
|
|
|
|
if (rdch)
|
|
|
|
CHN_LOCK(rdch);
|
1999-09-01 04:08:39 +00:00
|
|
|
/*
|
|
|
|
* all routines are called with int. blocked. Make sure that
|
|
|
|
* ints are re-enabled when calling slow or blocking functions!
|
|
|
|
*/
|
|
|
|
s = spltty();
|
|
|
|
switch(cmd) {
|
2000-04-15 05:04:12 +00:00
|
|
|
#ifdef OLDPCM_IOCTL
|
1999-09-01 04:08:39 +00:00
|
|
|
/*
|
|
|
|
* we start with the new ioctl interface.
|
|
|
|
*/
|
|
|
|
case AIONWRITE: /* how many bytes can write ? */
|
2001-03-24 23:10:29 +00:00
|
|
|
/*
|
|
|
|
if (wrch && wrch->bufhard.dl)
|
|
|
|
while (chn_wrfeed(wrch) == 0);
|
|
|
|
*/
|
|
|
|
*arg_i = wrch? sndbuf_getfree(wrch->bufsoft) : 0;
|
1999-09-01 04:08:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AIOSSIZE: /* set the current blocksize */
|
|
|
|
{
|
|
|
|
struct snd_size *p = (struct snd_size *)arg;
|
2000-05-27 14:40:17 +00:00
|
|
|
if (wrch)
|
|
|
|
chn_setblocksize(wrch, 2, p->play_size);
|
|
|
|
if (rdch)
|
|
|
|
chn_setblocksize(rdch, 2, p->rec_size);
|
1999-09-01 04:08:39 +00:00
|
|
|
}
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
case AIOGSIZE: /* get the current blocksize */
|
|
|
|
{
|
|
|
|
struct snd_size *p = (struct snd_size *)arg;
|
update code dealing with snd_dbuf objects to do so using a functional interface
modify chn_setblocksize() to pick a default soft-blocksize appropriate to the
sample rate and format in use. it will aim for a power of two size small
enough to generate block sizes of at most 20ms. it will also set the
hard-blocksize taking into account rate/format conversions in use.
update drivers to implement setblocksize correctly:
updated, tested: sb16, emu10k1, maestro, solo
updated, untested: ad1816, ess, mss, sb8, csa
not updated: ds1, es137x, fm801, neomagic, t4dwave, via82c686
i lack hardware to test: ad1816, csa, fm801, neomagic
others will be updated/tested in the next few days.
2000-12-23 03:16:13 +00:00
|
|
|
if (wrch)
|
2001-03-24 23:10:29 +00:00
|
|
|
p->play_size = sndbuf_getblksz(wrch->bufsoft);
|
update code dealing with snd_dbuf objects to do so using a functional interface
modify chn_setblocksize() to pick a default soft-blocksize appropriate to the
sample rate and format in use. it will aim for a power of two size small
enough to generate block sizes of at most 20ms. it will also set the
hard-blocksize taking into account rate/format conversions in use.
update drivers to implement setblocksize correctly:
updated, tested: sb16, emu10k1, maestro, solo
updated, untested: ad1816, ess, mss, sb8, csa
not updated: ds1, es137x, fm801, neomagic, t4dwave, via82c686
i lack hardware to test: ad1816, csa, fm801, neomagic
others will be updated/tested in the next few days.
2000-12-23 03:16:13 +00:00
|
|
|
if (rdch)
|
2001-03-24 23:10:29 +00:00
|
|
|
p->rec_size = sndbuf_getblksz(rdch->bufsoft);
|
1999-09-01 04:08:39 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AIOSFMT:
|
|
|
|
{
|
|
|
|
snd_chan_param *p = (snd_chan_param *)arg;
|
|
|
|
if (wrch) {
|
|
|
|
chn_setformat(wrch, p->play_format);
|
|
|
|
chn_setspeed(wrch, p->play_rate);
|
|
|
|
}
|
|
|
|
if (rdch) {
|
|
|
|
chn_setformat(rdch, p->rec_format);
|
|
|
|
chn_setspeed(rdch, p->rec_rate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
|
|
|
|
case AIOGFMT:
|
|
|
|
{
|
|
|
|
snd_chan_param *p = (snd_chan_param *)arg;
|
|
|
|
p->play_rate = wrch? wrch->speed : 0;
|
|
|
|
p->rec_rate = rdch? rdch->speed : 0;
|
|
|
|
p->play_format = wrch? wrch->format : 0;
|
|
|
|
p->rec_format = rdch? rdch->format : 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AIOGCAP: /* get capabilities */
|
|
|
|
{
|
|
|
|
snd_capabilities *p = (snd_capabilities *)arg;
|
2001-03-24 23:10:29 +00:00
|
|
|
struct pcmchan_caps *pcaps = NULL, *rcaps = NULL;
|
1999-09-01 04:08:39 +00:00
|
|
|
if (rdch) rcaps = chn_getcaps(rdch);
|
|
|
|
if (wrch) pcaps = chn_getcaps(wrch);
|
|
|
|
p->rate_min = max(rcaps? rcaps->minspeed : 0,
|
|
|
|
pcaps? pcaps->minspeed : 0);
|
|
|
|
p->rate_max = min(rcaps? rcaps->maxspeed : 1000000,
|
|
|
|
pcaps? pcaps->maxspeed : 1000000);
|
2001-03-24 23:10:29 +00:00
|
|
|
p->bufsize = min(rdch? sndbuf_getsize(rdch->bufsoft) : 1000000,
|
|
|
|
wrch? sndbuf_getsize(wrch->bufsoft) : 1000000);
|
1999-09-01 04:08:39 +00:00
|
|
|
/* XXX bad on sb16 */
|
2000-08-20 22:18:56 +00:00
|
|
|
p->formats = (rdch? chn_getformats(rdch) : 0xffffffff) &
|
|
|
|
(wrch? chn_getformats(wrch) : 0xffffffff);
|
2000-06-07 11:51:30 +00:00
|
|
|
if (rdch && wrch)
|
|
|
|
p->formats |= (d->flags & SD_F_SIMPLEX)? 0 : AFMT_FULLDUPLEX;
|
1999-09-01 04:08:39 +00:00
|
|
|
p->mixers = 1; /* default: one mixer */
|
update code dealing with snd_dbuf objects to do so using a functional interface
modify chn_setblocksize() to pick a default soft-blocksize appropriate to the
sample rate and format in use. it will aim for a power of two size small
enough to generate block sizes of at most 20ms. it will also set the
hard-blocksize taking into account rate/format conversions in use.
update drivers to implement setblocksize correctly:
updated, tested: sb16, emu10k1, maestro, solo
updated, untested: ad1816, ess, mss, sb8, csa
not updated: ds1, es137x, fm801, neomagic, t4dwave, via82c686
i lack hardware to test: ad1816, csa, fm801, neomagic
others will be updated/tested in the next few days.
2000-12-23 03:16:13 +00:00
|
|
|
p->inputs = mix_getdevs(d->mixer);
|
1999-09-01 04:08:39 +00:00
|
|
|
p->left = p->right = 100;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AIOSTOP:
|
update code dealing with snd_dbuf objects to do so using a functional interface
modify chn_setblocksize() to pick a default soft-blocksize appropriate to the
sample rate and format in use. it will aim for a power of two size small
enough to generate block sizes of at most 20ms. it will also set the
hard-blocksize taking into account rate/format conversions in use.
update drivers to implement setblocksize correctly:
updated, tested: sb16, emu10k1, maestro, solo
updated, untested: ad1816, ess, mss, sb8, csa
not updated: ds1, es137x, fm801, neomagic, t4dwave, via82c686
i lack hardware to test: ad1816, csa, fm801, neomagic
others will be updated/tested in the next few days.
2000-12-23 03:16:13 +00:00
|
|
|
if (*arg_i == AIOSYNC_PLAY && wrch)
|
|
|
|
*arg_i = chn_abort(wrch);
|
|
|
|
else if (*arg_i == AIOSYNC_CAPTURE && rdch)
|
|
|
|
*arg_i = chn_abort(rdch);
|
1999-09-01 04:08:39 +00:00
|
|
|
else {
|
|
|
|
printf("AIOSTOP: bad channel 0x%x\n", *arg_i);
|
|
|
|
*arg_i = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AIOSYNC:
|
|
|
|
printf("AIOSYNC chan 0x%03lx pos %lu unimplemented\n",
|
|
|
|
((snd_sync_parm *)arg)->chan, ((snd_sync_parm *)arg)->pos);
|
|
|
|
break;
|
2000-04-23 18:09:18 +00:00
|
|
|
#endif
|
1999-09-19 09:53:57 +00:00
|
|
|
/*
|
|
|
|
* here follow the standard ioctls (filio.h etc.)
|
|
|
|
*/
|
1999-09-01 04:08:39 +00:00
|
|
|
case FIONREAD: /* get # bytes to read */
|
2001-03-24 23:10:29 +00:00
|
|
|
/* if (rdch && rdch->bufhard.dl)
|
|
|
|
while (chn_rdfeed(rdch) == 0);
|
|
|
|
*/ *arg_i = rdch? sndbuf_getready(rdch->bufsoft) : 0;
|
1999-09-01 04:08:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FIOASYNC: /*set/clear async i/o */
|
|
|
|
DEB( printf("FIOASYNC\n") ; )
|
|
|
|
break;
|
2000-04-23 18:09:18 +00:00
|
|
|
|
1999-09-01 04:08:39 +00:00
|
|
|
case SNDCTL_DSP_NONBLOCK:
|
|
|
|
case FIONBIO: /* set/clear non-blocking i/o */
|
|
|
|
if (rdch) rdch->flags &= ~CHN_F_NBIO;
|
|
|
|
if (wrch) wrch->flags &= ~CHN_F_NBIO;
|
|
|
|
if (*arg_i) {
|
|
|
|
if (rdch) rdch->flags |= CHN_F_NBIO;
|
|
|
|
if (wrch) wrch->flags |= CHN_F_NBIO;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
/*
|
1999-09-19 09:53:57 +00:00
|
|
|
* Finally, here is the linux-compatible ioctl interface
|
|
|
|
*/
|
|
|
|
#define THE_REAL_SNDCTL_DSP_GETBLKSIZE _IOWR('P', 4, int)
|
1999-09-01 04:08:39 +00:00
|
|
|
case THE_REAL_SNDCTL_DSP_GETBLKSIZE:
|
|
|
|
case SNDCTL_DSP_GETBLKSIZE:
|
1999-12-29 03:46:54 +00:00
|
|
|
if (wrch)
|
2001-03-24 23:10:29 +00:00
|
|
|
*arg_i = sndbuf_getblksz(wrch->bufsoft);
|
1999-12-29 03:46:54 +00:00
|
|
|
else if (rdch)
|
2001-03-24 23:10:29 +00:00
|
|
|
*arg_i = sndbuf_getblksz(rdch->bufsoft);
|
1999-12-29 03:46:54 +00:00
|
|
|
else
|
|
|
|
*arg_i = 0;
|
1999-09-01 04:08:39 +00:00
|
|
|
break ;
|
|
|
|
|
|
|
|
case SNDCTL_DSP_SETBLKSIZE:
|
2000-04-15 05:04:12 +00:00
|
|
|
RANGE(*arg_i, 16, 65536);
|
|
|
|
if (wrch) chn_setblocksize(wrch, 2, *arg_i);
|
|
|
|
if (rdch) chn_setblocksize(rdch, 2, *arg_i);
|
1999-09-01 04:08:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNDCTL_DSP_RESET:
|
|
|
|
DEB(printf("dsp reset\n"));
|
2001-03-24 23:10:29 +00:00
|
|
|
if (wrch)
|
|
|
|
chn_abort(wrch);
|
|
|
|
if (rdch)
|
|
|
|
chn_abort(rdch);
|
1999-09-01 04:08:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNDCTL_DSP_SYNC:
|
1999-09-19 09:53:57 +00:00
|
|
|
DEB(printf("dsp sync\n"));
|
2001-03-24 23:10:29 +00:00
|
|
|
if (wrch) chn_sync(wrch, sndbuf_getsize(wrch->bufsoft) - 4);
|
1999-09-01 04:08:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNDCTL_DSP_SPEED:
|
2000-05-26 21:55:13 +00:00
|
|
|
if (wrch)
|
|
|
|
ret = chn_setspeed(wrch, *arg_i);
|
|
|
|
if (rdch && ret == 0)
|
|
|
|
ret = chn_setspeed(rdch, *arg_i);
|
1999-09-01 04:08:39 +00:00
|
|
|
/* fallthru */
|
|
|
|
|
|
|
|
case SOUND_PCM_READ_RATE:
|
|
|
|
*arg_i = wrch? wrch->speed : rdch->speed;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SNDCTL_DSP_STEREO:
|
2000-05-26 21:55:13 +00:00
|
|
|
if (wrch)
|
|
|
|
ret = chn_setformat(wrch, (wrch->format & ~AFMT_STEREO) |
|
1999-09-01 04:08:39 +00:00
|
|
|
((*arg_i)? AFMT_STEREO : 0));
|
2000-05-26 21:55:13 +00:00
|
|
|
if (rdch && ret == 0)
|
|
|
|
ret = chn_setformat(rdch, (rdch->format & ~AFMT_STEREO) |
|
1999-09-01 04:08:39 +00:00
|
|
|
((*arg_i)? AFMT_STEREO : 0));
|
|
|
|
*arg_i = ((wrch? wrch->format : rdch->format) & AFMT_STEREO)? 1 : 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SOUND_PCM_WRITE_CHANNELS:
|
2000-05-26 21:55:13 +00:00
|
|
|
/* case SNDCTL_DSP_CHANNELS: ( == SOUND_PCM_WRITE_CHANNELS) */
|
|
|
|
if (*arg_i == 1 || *arg_i == 2) {
|
|
|
|
if (wrch)
|
|
|
|
ret = chn_setformat(wrch, (wrch->format & ~AFMT_STEREO) |
|
1999-09-01 04:08:39 +00:00
|
|
|
((*arg_i == 2)? AFMT_STEREO : 0));
|
2000-05-26 21:55:13 +00:00
|
|
|
if (rdch && ret == 0)
|
|
|
|
ret = chn_setformat(rdch, (rdch->format & ~AFMT_STEREO) |
|
|
|
|
((*arg_i == 2)? AFMT_STEREO : 0));
|
2000-05-27 14:40:17 +00:00
|
|
|
*arg_i = ((wrch? wrch->format : rdch->format) & AFMT_STEREO)? 2 : 1;
|
2000-05-26 21:55:13 +00:00
|
|
|
} else
|
|
|
|
*arg_i = 0;
|
|
|
|
break;
|
1999-09-01 04:08:39 +00:00
|
|
|
|
|
|
|
case SOUND_PCM_READ_CHANNELS:
|
|
|
|
*arg_i = ((wrch? wrch->format : rdch->format) & AFMT_STEREO)? 2 : 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SNDCTL_DSP_GETFMTS: /* returns a mask of supported fmts */
|
2000-08-20 22:18:56 +00:00
|
|
|
*arg_i = wrch? chn_getformats(wrch) : chn_getformats(rdch);
|
1999-09-01 04:08:39 +00:00
|
|
|
break ;
|
|
|
|
|
|
|
|
case SNDCTL_DSP_SETFMT: /* sets _one_ format */
|
|
|
|
splx(s);
|
2000-10-26 01:34:54 +00:00
|
|
|
if ((*arg_i != AFMT_QUERY)) {
|
|
|
|
if (wrch)
|
|
|
|
ret = chn_setformat(wrch, (*arg_i) | (wrch->format & AFMT_STEREO));
|
|
|
|
if (rdch && ret == 0)
|
|
|
|
ret = chn_setformat(rdch, (*arg_i) | (rdch->format & AFMT_STEREO));
|
|
|
|
}
|
2000-12-18 01:36:41 +00:00
|
|
|
*arg_i = (wrch? wrch->format : rdch->format) & ~AFMT_STEREO;
|
1999-09-01 04:08:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNDCTL_DSP_SETFRAGMENT:
|
|
|
|
DEB(printf("SNDCTL_DSP_SETFRAGMENT 0x%08x\n", *(int *)arg));
|
|
|
|
{
|
2001-03-24 23:10:29 +00:00
|
|
|
struct pcm_channel *c = wrch? wrch : rdch;
|
2000-04-15 05:04:12 +00:00
|
|
|
u_int32_t fragln = (*arg_i) & 0x0000ffff;
|
|
|
|
u_int32_t maxfrags = ((*arg_i) & 0xffff0000) >> 16;
|
|
|
|
u_int32_t fragsz;
|
|
|
|
|
|
|
|
RANGE(fragln, 4, 16);
|
|
|
|
fragsz = 1 << fragln;
|
|
|
|
|
|
|
|
if (maxfrags == 0)
|
|
|
|
maxfrags = CHN_2NDBUFMAXSIZE / fragsz;
|
|
|
|
if (maxfrags < 2) {
|
1999-12-29 03:46:54 +00:00
|
|
|
ret = EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
2000-04-15 05:04:12 +00:00
|
|
|
if (maxfrags * fragsz > CHN_2NDBUFMAXSIZE)
|
|
|
|
maxfrags = CHN_2NDBUFMAXSIZE / fragsz;
|
1999-09-01 04:08:39 +00:00
|
|
|
|
2000-04-23 18:09:18 +00:00
|
|
|
DEB(printf("SNDCTL_DSP_SETFRAGMENT %d frags, %d sz\n", maxfrags, fragsz));
|
2000-04-15 05:04:12 +00:00
|
|
|
if (rdch)
|
|
|
|
ret = chn_setblocksize(rdch, maxfrags, fragsz);
|
|
|
|
if (wrch && ret == 0)
|
|
|
|
ret = chn_setblocksize(wrch, maxfrags, fragsz);
|
|
|
|
|
2001-03-24 23:10:29 +00:00
|
|
|
fragsz = sndbuf_getblksz(c->bufsoft);
|
2000-05-26 21:55:13 +00:00
|
|
|
fragln = 0;
|
|
|
|
while (fragsz > 1) {
|
|
|
|
fragln++;
|
|
|
|
fragsz >>= 1;
|
|
|
|
}
|
2001-03-24 23:10:29 +00:00
|
|
|
*arg_i = (sndbuf_getblkcnt(c->bufsoft) << 16) | fragln;
|
1999-09-01 04:08:39 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
1999-12-29 03:46:54 +00:00
|
|
|
case SNDCTL_DSP_GETISPACE: /* XXX Space for reading? Makes no sense... */
|
|
|
|
/* return the size of data available in the input queue */
|
1999-09-01 04:08:39 +00:00
|
|
|
{
|
|
|
|
audio_buf_info *a = (audio_buf_info *)arg;
|
|
|
|
if (rdch) {
|
2001-03-24 23:10:29 +00:00
|
|
|
struct snd_dbuf *bs = rdch->bufsoft;
|
|
|
|
|
|
|
|
chn_rdupdate(rdch);
|
|
|
|
a->bytes = sndbuf_getfree(bs);
|
|
|
|
a->fragments = a->bytes / sndbuf_getblksz(bs);
|
|
|
|
a->fragstotal = sndbuf_getblkcnt(bs);
|
|
|
|
a->fragsize = sndbuf_getblksz(bs);
|
1999-09-01 04:08:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SNDCTL_DSP_GETOSPACE:
|
|
|
|
/* return space available in the output queue */
|
|
|
|
{
|
|
|
|
audio_buf_info *a = (audio_buf_info *)arg;
|
|
|
|
if (wrch) {
|
2001-03-24 23:10:29 +00:00
|
|
|
struct snd_dbuf *bs = wrch->bufsoft;
|
|
|
|
|
|
|
|
chn_wrupdate(wrch);
|
|
|
|
a->bytes = sndbuf_getfree(bs);
|
|
|
|
a->fragments = a->bytes / sndbuf_getblksz(bs);
|
|
|
|
a->fragstotal = sndbuf_getblkcnt(bs);
|
|
|
|
a->fragsize = sndbuf_getblksz(bs);
|
1999-09-01 04:08:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SNDCTL_DSP_GETIPTR:
|
|
|
|
{
|
|
|
|
count_info *a = (count_info *)arg;
|
|
|
|
if (rdch) {
|
2001-03-24 23:10:29 +00:00
|
|
|
struct snd_dbuf *bs = rdch->bufsoft;
|
|
|
|
|
|
|
|
chn_rdupdate(rdch);
|
|
|
|
a->bytes = sndbuf_gettotal(bs);
|
|
|
|
a->blocks = sndbuf_getblocks(bs) - rdch->blocks;
|
|
|
|
a->ptr = sndbuf_getreadyptr(bs);
|
|
|
|
rdch->blocks = sndbuf_getblocks(bs);
|
1999-09-01 04:08:39 +00:00
|
|
|
} else ret = EINVAL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SNDCTL_DSP_GETOPTR:
|
|
|
|
{
|
|
|
|
count_info *a = (count_info *)arg;
|
|
|
|
if (wrch) {
|
2001-03-24 23:10:29 +00:00
|
|
|
struct snd_dbuf *bs = wrch->bufsoft;
|
|
|
|
|
|
|
|
chn_wrupdate(wrch);
|
|
|
|
a->bytes = sndbuf_gettotal(bs);
|
|
|
|
a->blocks = sndbuf_getblocks(bs) - wrch->blocks;
|
|
|
|
a->ptr = sndbuf_getreadyptr(bs);
|
|
|
|
wrch->blocks = sndbuf_getblocks(bs);
|
1999-09-01 04:08:39 +00:00
|
|
|
} else ret = EINVAL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SNDCTL_DSP_GETCAPS:
|
|
|
|
*arg_i = DSP_CAP_REALTIME | DSP_CAP_MMAP | DSP_CAP_TRIGGER;
|
|
|
|
if (rdch && wrch && !(d->flags & SD_F_SIMPLEX))
|
|
|
|
*arg_i |= DSP_CAP_DUPLEX;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SOUND_PCM_READ_BITS:
|
|
|
|
*arg_i = ((wrch? wrch->format : rdch->format) & AFMT_16BIT)? 16 : 8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SNDCTL_DSP_SETTRIGGER:
|
|
|
|
if (rdch) {
|
2000-04-23 18:09:18 +00:00
|
|
|
rdch->flags &= ~(CHN_F_TRIGGERED | CHN_F_NOTRIGGER);
|
2001-03-24 23:10:29 +00:00
|
|
|
if (*arg_i & PCM_ENABLE_INPUT) {
|
1999-09-01 04:08:39 +00:00
|
|
|
rdch->flags |= CHN_F_TRIGGERED;
|
2001-03-24 23:10:29 +00:00
|
|
|
chn_start(rdch, 1);
|
|
|
|
} else
|
2000-04-23 18:09:18 +00:00
|
|
|
rdch->flags |= CHN_F_NOTRIGGER;
|
1999-09-01 04:08:39 +00:00
|
|
|
}
|
|
|
|
if (wrch) {
|
2000-04-23 18:09:18 +00:00
|
|
|
wrch->flags &= ~(CHN_F_TRIGGERED | CHN_F_NOTRIGGER);
|
2001-03-24 23:10:29 +00:00
|
|
|
if (*arg_i & PCM_ENABLE_OUTPUT) {
|
1999-09-01 04:08:39 +00:00
|
|
|
wrch->flags |= CHN_F_TRIGGERED;
|
2001-03-24 23:10:29 +00:00
|
|
|
chn_start(wrch, 1);
|
|
|
|
} else
|
2000-04-23 18:09:18 +00:00
|
|
|
wrch->flags |= CHN_F_NOTRIGGER;
|
1999-09-01 04:08:39 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SNDCTL_DSP_GETTRIGGER:
|
|
|
|
*arg_i = 0;
|
|
|
|
if (wrch && wrch->flags & CHN_F_TRIGGERED)
|
|
|
|
*arg_i |= PCM_ENABLE_OUTPUT;
|
|
|
|
if (rdch && rdch->flags & CHN_F_TRIGGERED)
|
|
|
|
*arg_i |= PCM_ENABLE_INPUT;
|
|
|
|
break;
|
|
|
|
|
1999-12-29 03:46:54 +00:00
|
|
|
case SNDCTL_DSP_GETODELAY:
|
|
|
|
if (wrch) {
|
2001-03-24 23:10:29 +00:00
|
|
|
struct snd_dbuf *b = wrch->bufhard;
|
|
|
|
struct snd_dbuf *bs = wrch->bufsoft;
|
|
|
|
|
|
|
|
chn_wrupdate(wrch);
|
|
|
|
*arg_i = sndbuf_getready(b) + sndbuf_getready(bs);
|
1999-12-29 03:46:54 +00:00
|
|
|
} else
|
|
|
|
ret = EINVAL;
|
|
|
|
break;
|
2000-10-27 22:20:45 +00:00
|
|
|
|
2000-10-26 01:34:54 +00:00
|
|
|
case SNDCTL_DSP_POST:
|
|
|
|
if (wrch) {
|
|
|
|
wrch->flags &= ~CHN_F_NOTRIGGER;
|
|
|
|
chn_start(wrch, 1);
|
|
|
|
}
|
|
|
|
break;
|
2000-10-27 22:20:45 +00:00
|
|
|
|
1999-09-01 04:08:39 +00:00
|
|
|
case SNDCTL_DSP_MAPINBUF:
|
|
|
|
case SNDCTL_DSP_MAPOUTBUF:
|
|
|
|
case SNDCTL_DSP_SETSYNCRO:
|
|
|
|
/* undocumented */
|
|
|
|
|
2001-03-24 23:10:29 +00:00
|
|
|
case SNDCTL_DSP_SUBDIVIDE:
|
1999-09-01 04:08:39 +00:00
|
|
|
case SOUND_PCM_WRITE_FILTER:
|
|
|
|
case SOUND_PCM_READ_FILTER:
|
|
|
|
/* dunno what these do, don't sound important */
|
|
|
|
default:
|
1999-12-05 19:09:13 +00:00
|
|
|
DEB(printf("default ioctl chan%d fn 0x%08lx fail\n", chan, cmd));
|
1999-09-01 04:08:39 +00:00
|
|
|
ret = EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
2001-03-24 23:10:29 +00:00
|
|
|
if (rdch)
|
|
|
|
CHN_UNLOCK(rdch);
|
|
|
|
if (wrch)
|
|
|
|
CHN_UNLOCK(wrch);
|
1999-09-01 04:08:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-03-24 23:10:29 +00:00
|
|
|
dsp_poll(struct snddev_info *d, int chan, int events, struct proc *p)
|
1999-09-01 04:08:39 +00:00
|
|
|
{
|
|
|
|
int ret = 0, e;
|
2001-03-24 23:10:29 +00:00
|
|
|
struct pcm_channel *wrch = NULL, *rdch = NULL;
|
1999-09-01 04:08:39 +00:00
|
|
|
|
|
|
|
getchns(d, chan, &rdch, &wrch);
|
2001-03-24 23:10:29 +00:00
|
|
|
|
1999-09-01 04:08:39 +00:00
|
|
|
e = events & (POLLOUT | POLLWRNORM);
|
|
|
|
if (wrch && e) ret |= chn_poll(wrch, e, p);
|
2001-03-24 23:10:29 +00:00
|
|
|
|
1999-09-01 04:08:39 +00:00
|
|
|
e = events & (POLLIN | POLLRDNORM);
|
|
|
|
if (rdch && e) ret |= chn_poll(rdch, e, p);
|
2001-03-24 23:10:29 +00:00
|
|
|
|
1999-09-01 04:08:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-03-24 23:10:29 +00:00
|
|
|
dsp_mmap(struct snddev_info *d, int chan, vm_offset_t offset, int nprot)
|
1999-09-01 04:08:39 +00:00
|
|
|
{
|
2001-03-24 23:10:29 +00:00
|
|
|
struct pcm_channel *wrch = NULL, *rdch = NULL, *c = NULL;
|
|
|
|
int ret;
|
1999-09-01 04:08:39 +00:00
|
|
|
|
|
|
|
getchns(d, chan, &rdch, &wrch);
|
2001-03-24 23:10:29 +00:00
|
|
|
#if 0
|
|
|
|
/*
|
|
|
|
* XXX the linux api uses the nprot to select read/write bufhard
|
|
|
|
* our vm system doesn't allow this, so force write bufhard
|
|
|
|
*/
|
|
|
|
|
2000-05-26 21:55:13 +00:00
|
|
|
if (1 || (wrch && (nprot & PROT_WRITE)))
|
|
|
|
c = wrch;
|
|
|
|
else if (rdch && (nprot & PROT_READ))
|
|
|
|
c = rdch;
|
2001-03-24 23:10:29 +00:00
|
|
|
#else
|
|
|
|
c = wrch;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (c == NULL)
|
2000-05-26 21:55:13 +00:00
|
|
|
return -1;
|
2001-03-24 23:10:29 +00:00
|
|
|
CHN_LOCK(c);
|
|
|
|
c->flags |= CHN_F_MAPPED;
|
|
|
|
ret = atop(vtophys(((char *)sndbuf_getbuf(c->bufsoft)) + offset));
|
|
|
|
CHN_UNLOCK(c);
|
|
|
|
return ret;
|
1999-09-01 04:08:39 +00:00
|
|
|
}
|
|
|
|
|