summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pci/solo.c
diff options
context:
space:
mode:
authorcg <cg@FreeBSD.org>2000-12-23 03:16:13 +0000
committercg <cg@FreeBSD.org>2000-12-23 03:16:13 +0000
commitd0b795f25b705ff883368ba3e49f31c3541d3b11 (patch)
tree076eb63fe5bbf4764062f83df117a0ee11cfc3ed /sys/dev/sound/pci/solo.c
parent818087b543b4be6d1211cb39cb7b7204e9ae9f6c (diff)
downloadFreeBSD-src-d0b795f25b705ff883368ba3e49f31c3541d3b11.zip
FreeBSD-src-d0b795f25b705ff883368ba3e49f31c3541d3b11.tar.gz
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.
Diffstat (limited to 'sys/dev/sound/pci/solo.c')
-rw-r--r--sys/dev/sound/pci/solo.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/dev/sound/pci/solo.c b/sys/dev/sound/pci/solo.c
index 7cb10f3..71a00f1 100644
--- a/sys/dev/sound/pci/solo.c
+++ b/sys/dev/sound/pci/solo.c
@@ -80,7 +80,7 @@ struct ess_chinfo {
pcm_channel *channel;
snd_dbuf *buffer;
int dir, hwch, stopping;
- u_int32_t fmt, spd;
+ u_int32_t fmt, spd, blksz;
};
struct ess_info {
@@ -477,7 +477,7 @@ ess_start(struct ess_chinfo *ch)
struct ess_info *sc = ch->parent;
DEB(printf("ess_start\n"););
- ess_setupch(sc, ch->hwch, ch->dir, ch->spd, ch->fmt, ch->buffer->dl);
+ ess_setupch(sc, ch->hwch, ch->dir, ch->spd, ch->fmt, ch->blksz);
ch->stopping = 0;
if (ch->hwch == 1) {
ess_write(sc, 0xb8, ess_read(sc, 0xb8) | 0x01);
@@ -519,9 +519,8 @@ esschan_init(kobj_t obj, void *devinfo, snd_dbuf *b, pcm_channel *c, int dir)
ch->parent = sc;
ch->channel = c;
ch->buffer = b;
- ch->buffer->bufsize = ESS_BUFFSIZE;
ch->dir = dir;
- if (chn_allocbuf(ch->buffer, sc->parent_dmat) == -1)
+ if (sndbuf_alloc(ch->buffer, sc->parent_dmat, ESS_BUFFSIZE) == -1)
return NULL;
ch->hwch = 1;
if ((dir == PCMDIR_PLAY) && (sc->duplex))
@@ -555,7 +554,10 @@ esschan_setspeed(kobj_t obj, void *data, u_int32_t speed)
static int
esschan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize)
{
- return blocksize;
+ struct ess_chinfo *ch = data;
+
+ ch->blksz = blocksize;
+ return ch->blksz;
}
static int
@@ -570,7 +572,7 @@ esschan_trigger(kobj_t obj, void *data, int go)
switch (go) {
case PCMTRIG_START:
- ess_dmasetup(sc, ch->hwch, vtophys(ch->buffer->buf), ch->buffer->bufsize, ch->dir);
+ ess_dmasetup(sc, ch->hwch, vtophys(sndbuf_getbuf(ch->buffer)), sndbuf_getsize(ch->buffer), ch->dir);
ess_dmatrigger(sc, ch->hwch, 1);
ess_start(ch);
break;
@@ -780,7 +782,7 @@ ess_dmapos(struct ess_info *sc, int ch)
i, p);
i = port_rd(sc->vc, 0x4, 2) + 1;
p = port_rd(sc->vc, 0x4, 2) + 1;
- } while ((p > sc->dmasz[ch -1 ] || i < p || (p - i) > 0x8) && j++ < 1000);
+ } while ((p > sc->dmasz[ch - 1] || i < p || (p - i) > 0x8) && j++ < 1000);
ess_dmatrigger(sc, ch, 1);
}
else if (ch == 2)
OpenPOWER on IntegriCloud