diff options
author | cg <cg@FreeBSD.org> | 2000-09-01 20:09:24 +0000 |
---|---|---|
committer | cg <cg@FreeBSD.org> | 2000-09-01 20:09:24 +0000 |
commit | a6b7de97e3e709e699c0638c9ff07e8fc3477772 (patch) | |
tree | ba5ec2ebf628be720fad52ae78db04a46cc46680 /sys/dev/sound/pcm/channel.c | |
parent | e95936f6ddf2411361330abe8f44903c01b42fe5 (diff) | |
download | FreeBSD-src-a6b7de97e3e709e699c0638c9ff07e8fc3477772.zip FreeBSD-src-a6b7de97e3e709e699c0638c9ff07e8fc3477772.tar.gz |
change mixer api slightly
change channel interface - kobj implementation coming soonish
make pcm_makelinks not panic if modular
add pcm_unregister()
these changes support newpcm kld unloading, but this is only implemented
by ds1.c
Diffstat (limited to 'sys/dev/sound/pcm/channel.c')
-rw-r--r-- | sys/dev/sound/pcm/channel.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 2e292b7..af338628 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -850,13 +850,20 @@ chn_dma_setmap(void *arg, bus_dma_segment_t *segs, int nseg, int error) int chn_allocbuf(snd_dbuf *b, bus_dma_tag_t parent_dmat) { - if (bus_dmamem_alloc(parent_dmat, (void **)&b->buf, + b->parent_dmat = parent_dmat; + if (bus_dmamem_alloc(b->parent_dmat, (void **)&b->buf, BUS_DMA_NOWAIT, &b->dmamap)) return -1; - if (bus_dmamap_load(parent_dmat, b->dmamap, b->buf, + if (bus_dmamap_load(b->parent_dmat, b->dmamap, b->buf, b->bufsize, chn_dma_setmap, b, 0)) return -1; return 0; } +void +chn_freebuf(snd_dbuf *b) +{ + bus_dmamem_free(b->parent_dmat, b->buf, b->dmamap); +} + static void buf_clear(snd_dbuf *b, u_int32_t fmt, int length) { @@ -1152,6 +1159,21 @@ chn_init(pcm_channel *c, void *devinfo, int dir) } int +chn_kill(pcm_channel *c) +{ + chn_trigger(c, PCMTRIG_ABORT); + while (chn_removefeeder(c) == 0); + free(c->feeder->desc, M_DEVBUF); + free(c->feeder, M_DEVBUF); + if (c->free) + c->free(c->devinfo); + else + chn_freebuf(&c->buffer); + c->flags |= CHN_F_DEAD; + return 0; +} + +int chn_setdir(pcm_channel *c, int dir) { int r; |