- Clean up ISA DMA supports.
- Rename all sndbuf_isadma* functions to sndbuf_dma* and move them into sys/dev/sound/isa/sndbuf_dma.c. No response from: sound
This commit is contained in:
parent
e495da0cd3
commit
3391eada81
@ -663,6 +663,7 @@ dev/sound/isa/sb16.c optional pcm isa
|
||||
dev/sound/isa/sb8.c optional pcm isa
|
||||
dev/sound/isa/sbc.c optional pcm isa
|
||||
dev/sound/isa/sbc.c optional sbc isa
|
||||
dev/sound/isa/sndbuf_dma.c optional pcm isa
|
||||
dev/sound/isa/uartsio.c optional midi isa
|
||||
dev/sound/midi/midi.c optional midi
|
||||
dev/sound/midi/midibuf.c optional midi
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include <dev/sound/pcm/sound.h>
|
||||
#include <dev/sound/isa/ad1816.h>
|
||||
|
||||
#include <isa/isavar.h>
|
||||
|
||||
#include "mixer_if.h"
|
||||
|
||||
SND_DECLARE_FILE("$FreeBSD$");
|
||||
@ -322,7 +324,7 @@ ad1816chan_setdir(kobj_t obj, void *data, int dir)
|
||||
struct ad1816_chinfo *ch = data;
|
||||
struct ad1816_info *ad1816 = ch->parent;
|
||||
|
||||
sndbuf_isadmasetup(ch->buffer, (dir == PCMDIR_PLAY)? ad1816->drq1 : ad1816->drq2);
|
||||
sndbuf_dmasetup(ch->buffer, (dir == PCMDIR_PLAY)? ad1816->drq1 : ad1816->drq2);
|
||||
ch->dir = dir;
|
||||
return 0;
|
||||
}
|
||||
@ -407,7 +409,7 @@ ad1816chan_trigger(kobj_t obj, void *data, int go)
|
||||
if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
|
||||
return 0;
|
||||
|
||||
sndbuf_isadma(ch->buffer, go);
|
||||
sndbuf_dma(ch->buffer, go);
|
||||
wr = (ch->dir == PCMDIR_PLAY);
|
||||
reg = wr? AD1816_PLAY : AD1816_CAPT;
|
||||
ad1816_lock(ad1816);
|
||||
@ -453,7 +455,7 @@ static int
|
||||
ad1816chan_getptr(kobj_t obj, void *data)
|
||||
{
|
||||
struct ad1816_chinfo *ch = data;
|
||||
return sndbuf_isadmaptr(ch->buffer);
|
||||
return sndbuf_dmaptr(ch->buffer);
|
||||
}
|
||||
|
||||
static struct pcmchan_caps *
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include <dev/sound/isa/sb.h>
|
||||
#include <dev/sound/chip.h>
|
||||
|
||||
#include <isa/isavar.h>
|
||||
|
||||
#include "mixer_if.h"
|
||||
|
||||
SND_DECLARE_FILE("$FreeBSD$");
|
||||
@ -367,7 +369,7 @@ ess_intr(void *arg)
|
||||
chn_intr(sc->pch.channel);
|
||||
if (sc->pch.stopping) {
|
||||
sc->pch.run = 0;
|
||||
sndbuf_isadma(sc->pch.buffer, PCMTRIG_STOP);
|
||||
sndbuf_dma(sc->pch.buffer, PCMTRIG_STOP);
|
||||
sc->pch.stopping = 0;
|
||||
if (sc->pch.hwch == 1)
|
||||
ess_write(sc, 0xb8, ess_read(sc, 0xb8) & ~0x01);
|
||||
@ -381,7 +383,7 @@ ess_intr(void *arg)
|
||||
chn_intr(sc->rch.channel);
|
||||
if (sc->rch.stopping) {
|
||||
sc->rch.run = 0;
|
||||
sndbuf_isadma(sc->rch.buffer, PCMTRIG_STOP);
|
||||
sndbuf_dma(sc->rch.buffer, PCMTRIG_STOP);
|
||||
sc->rch.stopping = 0;
|
||||
/* XXX: will this stop audio2? */
|
||||
ess_write(sc, 0xb8, ess_read(sc, 0xb8) & ~0x01);
|
||||
@ -565,7 +567,7 @@ esschan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *
|
||||
ch->hwch = 1;
|
||||
if ((dir == PCMDIR_PLAY) && (sc->duplex))
|
||||
ch->hwch = 2;
|
||||
sndbuf_isadmasetup(ch->buffer, (ch->hwch == 1)? sc->drq1 : sc->drq2);
|
||||
sndbuf_dmasetup(ch->buffer, (ch->hwch == 1)? sc->drq1 : sc->drq2);
|
||||
return ch;
|
||||
}
|
||||
|
||||
@ -612,7 +614,7 @@ esschan_trigger(kobj_t obj, void *data, int go)
|
||||
switch (go) {
|
||||
case PCMTRIG_START:
|
||||
ch->run = 1;
|
||||
sndbuf_isadma(ch->buffer, go);
|
||||
sndbuf_dma(ch->buffer, go);
|
||||
ess_start(ch);
|
||||
break;
|
||||
|
||||
@ -630,7 +632,7 @@ esschan_getptr(kobj_t obj, void *data)
|
||||
{
|
||||
struct ess_chinfo *ch = data;
|
||||
|
||||
return sndbuf_isadmaptr(ch->buffer);
|
||||
return sndbuf_dmaptr(ch->buffer);
|
||||
}
|
||||
|
||||
static struct pcmchan_caps *
|
||||
|
@ -36,6 +36,8 @@ SND_DECLARE_FILE("$FreeBSD$");
|
||||
#include <dev/sound/isa/sb.h>
|
||||
#include <dev/sound/chip.h>
|
||||
|
||||
#include <isa/isavar.h>
|
||||
|
||||
#include "mixer_if.h"
|
||||
|
||||
#define MSS_DEFAULT_BUFSZ (4096)
|
||||
@ -1127,7 +1129,7 @@ msschan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *
|
||||
ch->buffer = b;
|
||||
ch->dir = dir;
|
||||
if (sndbuf_alloc(ch->buffer, mss->parent_dmat, mss->bufsize) == -1) return NULL;
|
||||
sndbuf_isadmasetup(ch->buffer, (dir == PCMDIR_PLAY)? mss->drq1 : mss->drq2);
|
||||
sndbuf_dmasetup(ch->buffer, (dir == PCMDIR_PLAY)? mss->drq1 : mss->drq2);
|
||||
return ch;
|
||||
}
|
||||
|
||||
@ -1177,7 +1179,7 @@ msschan_trigger(kobj_t obj, void *data, int go)
|
||||
if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
|
||||
return 0;
|
||||
|
||||
sndbuf_isadma(ch->buffer, go);
|
||||
sndbuf_dma(ch->buffer, go);
|
||||
mss_lock(mss);
|
||||
mss_trigger(ch, go);
|
||||
mss_unlock(mss);
|
||||
@ -1188,7 +1190,7 @@ static int
|
||||
msschan_getptr(kobj_t obj, void *data)
|
||||
{
|
||||
struct mss_chinfo *ch = data;
|
||||
return sndbuf_isadmaptr(ch->buffer);
|
||||
return sndbuf_dmaptr(ch->buffer);
|
||||
}
|
||||
|
||||
static struct pcmchan_caps *
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include <dev/sound/isa/sb.h>
|
||||
#include <dev/sound/chip.h>
|
||||
|
||||
#include <isa/isavar.h>
|
||||
|
||||
#include "mixer_if.h"
|
||||
|
||||
SND_DECLARE_FILE("$FreeBSD$");
|
||||
@ -540,43 +542,43 @@ sb_setup(struct sb_info *sb)
|
||||
|
||||
sb_lock(sb);
|
||||
if (sb->bd_flags & BD_F_DMARUN)
|
||||
sndbuf_isadma(sb->pch.buffer, PCMTRIG_STOP);
|
||||
sndbuf_dma(sb->pch.buffer, PCMTRIG_STOP);
|
||||
if (sb->bd_flags & BD_F_DMARUN2)
|
||||
sndbuf_isadma(sb->rch.buffer, PCMTRIG_STOP);
|
||||
sndbuf_dma(sb->rch.buffer, PCMTRIG_STOP);
|
||||
sb->bd_flags &= ~(BD_F_DMARUN | BD_F_DMARUN2);
|
||||
|
||||
sb_reset_dsp(sb);
|
||||
|
||||
if (sb->bd_flags & BD_F_SB16X) {
|
||||
pprio = sb->pch.run? 1 : 0;
|
||||
sndbuf_isadmasetup(sb->pch.buffer, pprio? sb->drq1 : NULL);
|
||||
sndbuf_dmasetup(sb->pch.buffer, pprio? sb->drq1 : NULL);
|
||||
sb->pch.dch = pprio? 1 : 0;
|
||||
sndbuf_isadmasetup(sb->rch.buffer, pprio? sb->drq2 : sb->drq1);
|
||||
sndbuf_dmasetup(sb->rch.buffer, pprio? sb->drq2 : sb->drq1);
|
||||
sb->rch.dch = pprio? 2 : 1;
|
||||
} else {
|
||||
if (sb->pch.run && sb->rch.run) {
|
||||
pprio = (sb->rch.fmt & AFMT_16BIT)? 0 : 1;
|
||||
sndbuf_isadmasetup(sb->pch.buffer, pprio? sb->drq2 : sb->drq1);
|
||||
sndbuf_dmasetup(sb->pch.buffer, pprio? sb->drq2 : sb->drq1);
|
||||
sb->pch.dch = pprio? 2 : 1;
|
||||
sndbuf_isadmasetup(sb->rch.buffer, pprio? sb->drq1 : sb->drq2);
|
||||
sndbuf_dmasetup(sb->rch.buffer, pprio? sb->drq1 : sb->drq2);
|
||||
sb->rch.dch = pprio? 1 : 2;
|
||||
} else {
|
||||
if (sb->pch.run) {
|
||||
sndbuf_isadmasetup(sb->pch.buffer, (sb->pch.fmt & AFMT_16BIT)? sb->drq2 : sb->drq1);
|
||||
sndbuf_dmasetup(sb->pch.buffer, (sb->pch.fmt & AFMT_16BIT)? sb->drq2 : sb->drq1);
|
||||
sb->pch.dch = (sb->pch.fmt & AFMT_16BIT)? 2 : 1;
|
||||
sndbuf_isadmasetup(sb->rch.buffer, (sb->pch.fmt & AFMT_16BIT)? sb->drq1 : sb->drq2);
|
||||
sndbuf_dmasetup(sb->rch.buffer, (sb->pch.fmt & AFMT_16BIT)? sb->drq1 : sb->drq2);
|
||||
sb->rch.dch = (sb->pch.fmt & AFMT_16BIT)? 1 : 2;
|
||||
} else if (sb->rch.run) {
|
||||
sndbuf_isadmasetup(sb->pch.buffer, (sb->rch.fmt & AFMT_16BIT)? sb->drq1 : sb->drq2);
|
||||
sndbuf_dmasetup(sb->pch.buffer, (sb->rch.fmt & AFMT_16BIT)? sb->drq1 : sb->drq2);
|
||||
sb->pch.dch = (sb->rch.fmt & AFMT_16BIT)? 1 : 2;
|
||||
sndbuf_isadmasetup(sb->rch.buffer, (sb->rch.fmt & AFMT_16BIT)? sb->drq2 : sb->drq1);
|
||||
sndbuf_dmasetup(sb->rch.buffer, (sb->rch.fmt & AFMT_16BIT)? sb->drq2 : sb->drq1);
|
||||
sb->rch.dch = (sb->rch.fmt & AFMT_16BIT)? 2 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sndbuf_isadmasetdir(sb->pch.buffer, PCMDIR_PLAY);
|
||||
sndbuf_isadmasetdir(sb->rch.buffer, PCMDIR_REC);
|
||||
sndbuf_dmasetdir(sb->pch.buffer, PCMDIR_PLAY);
|
||||
sndbuf_dmasetdir(sb->rch.buffer, PCMDIR_REC);
|
||||
|
||||
/*
|
||||
printf("setup: [pch = %d, pfmt = %d, pgo = %d] [rch = %d, rfmt = %d, rgo = %d]\n",
|
||||
@ -604,7 +606,7 @@ sb_setup(struct sb_info *sb)
|
||||
v = (ch->fmt & AFMT_STEREO)? DSP_F16_STEREO : 0;
|
||||
v |= (ch->fmt & AFMT_SIGNED)? DSP_F16_SIGNED : 0;
|
||||
sb_cmd2(sb, v, l);
|
||||
sndbuf_isadma(ch->buffer, PCMTRIG_START);
|
||||
sndbuf_dma(ch->buffer, PCMTRIG_START);
|
||||
sb->bd_flags |= BD_F_DMARUN;
|
||||
}
|
||||
|
||||
@ -629,7 +631,7 @@ sb_setup(struct sb_info *sb)
|
||||
v = (ch->fmt & AFMT_STEREO)? DSP_F16_STEREO : 0;
|
||||
v |= (ch->fmt & AFMT_SIGNED)? DSP_F16_SIGNED : 0;
|
||||
sb_cmd2(sb, v, l);
|
||||
sndbuf_isadma(ch->buffer, PCMTRIG_START);
|
||||
sndbuf_dma(ch->buffer, PCMTRIG_START);
|
||||
sb->bd_flags |= BD_F_DMARUN2;
|
||||
}
|
||||
sb_unlock(sb);
|
||||
@ -710,7 +712,7 @@ sb16chan_getptr(kobj_t obj, void *data)
|
||||
{
|
||||
struct sb_chinfo *ch = data;
|
||||
|
||||
return sndbuf_isadmaptr(ch->buffer);
|
||||
return sndbuf_dmaptr(ch->buffer);
|
||||
}
|
||||
|
||||
static struct pcmchan_caps *
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include <dev/sound/isa/sb.h>
|
||||
#include <dev/sound/chip.h>
|
||||
|
||||
#include <isa/isavar.h>
|
||||
|
||||
#include "mixer_if.h"
|
||||
|
||||
SND_DECLARE_FILE("$FreeBSD$");
|
||||
@ -582,7 +584,7 @@ sbchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c
|
||||
ch->buffer = b;
|
||||
if (sndbuf_alloc(ch->buffer, sb->parent_dmat, sb->bufsize) == -1)
|
||||
return NULL;
|
||||
sndbuf_isadmasetup(ch->buffer, sb->drq);
|
||||
sndbuf_dmasetup(ch->buffer, sb->drq);
|
||||
return ch;
|
||||
}
|
||||
|
||||
@ -621,7 +623,7 @@ sbchan_trigger(kobj_t obj, void *data, int go)
|
||||
if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
|
||||
return 0;
|
||||
|
||||
sndbuf_isadma(ch->buffer, go);
|
||||
sndbuf_dma(ch->buffer, go);
|
||||
if (go == PCMTRIG_START)
|
||||
sb_start(ch);
|
||||
else
|
||||
@ -634,7 +636,7 @@ sbchan_getptr(kobj_t obj, void *data)
|
||||
{
|
||||
struct sb_chinfo *ch = data;
|
||||
|
||||
return sndbuf_isadmaptr(ch->buffer);
|
||||
return sndbuf_dmaptr(ch->buffer);
|
||||
}
|
||||
|
||||
static struct pcmchan_caps *
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include <dev/sound/pcm/sound.h>
|
||||
#include <dev/sound/isa/sb.h>
|
||||
|
||||
#include <isa/isavar.h>
|
||||
|
||||
SND_DECLARE_FILE("$FreeBSD$");
|
||||
|
||||
#define IO_MAX 3
|
||||
|
103
sys/dev/sound/isa/sndbuf_dma.c
Normal file
103
sys/dev/sound/isa/sndbuf_dma.c
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <dev/sound/pcm/sound.h>
|
||||
|
||||
#include <isa/isavar.h>
|
||||
|
||||
SND_DECLARE_FILE("$FreeBSD$");
|
||||
|
||||
int
|
||||
sndbuf_dmasetup(struct snd_dbuf *b, struct resource *drq)
|
||||
{
|
||||
/* should do isa_dma_acquire/isa_dma_release here */
|
||||
if (drq == NULL) {
|
||||
b->dmachan = -1;
|
||||
} else {
|
||||
sndbuf_setflags(b, SNDBUF_F_DMA, 1);
|
||||
b->dmachan = rman_get_start(drq);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sndbuf_dmasetdir(struct snd_dbuf *b, int dir)
|
||||
{
|
||||
KASSERT(b, ("sndbuf_dmasetdir called with b == NULL"));
|
||||
KASSERT(sndbuf_getflags(b) & SNDBUF_F_DMA, ("sndbuf_dmasetdir called on non-ISA buffer"));
|
||||
|
||||
b->dir = (dir == PCMDIR_PLAY)? ISADMA_WRITE : ISADMA_READ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
sndbuf_dma(struct snd_dbuf *b, int go)
|
||||
{
|
||||
KASSERT(b, ("sndbuf_dma called with b == NULL"));
|
||||
KASSERT(sndbuf_getflags(b) & SNDBUF_F_DMA, ("sndbuf_dma called on non-ISA buffer"));
|
||||
|
||||
switch (go) {
|
||||
case PCMTRIG_START:
|
||||
/* isa_dmainit(b->chan, size); */
|
||||
isa_dmastart(b->dir | ISADMA_RAW, b->buf, b->bufsize, b->dmachan);
|
||||
break;
|
||||
|
||||
case PCMTRIG_STOP:
|
||||
case PCMTRIG_ABORT:
|
||||
isa_dmastop(b->dmachan);
|
||||
isa_dmadone(b->dir | ISADMA_RAW, b->buf, b->bufsize, b->dmachan);
|
||||
break;
|
||||
}
|
||||
|
||||
DEB(printf("buf 0x%p ISA DMA %s, channel %d\n",
|
||||
b,
|
||||
(go == PCMTRIG_START)? "started" : "stopped",
|
||||
b->dmachan));
|
||||
}
|
||||
|
||||
int
|
||||
sndbuf_dmaptr(struct snd_dbuf *b)
|
||||
{
|
||||
int i;
|
||||
|
||||
KASSERT(b, ("sndbuf_dmaptr called with b == NULL"));
|
||||
KASSERT(sndbuf_getflags(b) & SNDBUF_F_DMA, ("sndbuf_dmaptr called on non-ISA buffer"));
|
||||
|
||||
if (!sndbuf_runsz(b))
|
||||
return 0;
|
||||
i = isa_dmastatus(b->dmachan);
|
||||
KASSERT(i >= 0, ("isa_dmastatus returned %d", i));
|
||||
return b->bufsize - i;
|
||||
}
|
||||
|
||||
void
|
||||
sndbuf_dmabounce(struct snd_dbuf *b)
|
||||
{
|
||||
KASSERT(b, ("sndbuf_dmabounce called with b == NULL"));
|
||||
KASSERT(sndbuf_getflags(b) & SNDBUF_F_DMA, ("sndbuf_dmabounce called on non-ISA buffer"));
|
||||
|
||||
/* tell isa_dma to bounce data in/out */
|
||||
}
|
@ -30,27 +30,6 @@
|
||||
|
||||
SND_DECLARE_FILE("$FreeBSD$");
|
||||
|
||||
#define SNDBUF_NAMELEN 48
|
||||
struct snd_dbuf {
|
||||
device_t dev;
|
||||
u_int8_t *buf, *tmpbuf;
|
||||
unsigned int bufsize, maxsize;
|
||||
volatile int dl; /* transfer size */
|
||||
volatile int rp; /* pointers to the ready area */
|
||||
volatile int rl; /* length of ready area */
|
||||
volatile int hp;
|
||||
volatile u_int32_t total, prev_total;
|
||||
int isadmachan, dir; /* dma channel */
|
||||
u_int32_t fmt, spd, bps;
|
||||
unsigned int blksz, blkcnt;
|
||||
int xrun;
|
||||
u_int32_t flags;
|
||||
bus_dmamap_t dmamap;
|
||||
bus_dma_tag_t dmatag;
|
||||
struct selinfo sel;
|
||||
char name[SNDBUF_NAMELEN];
|
||||
};
|
||||
|
||||
struct snd_dbuf *
|
||||
sndbuf_create(device_t dev, char *drv, char *desc)
|
||||
{
|
||||
@ -587,77 +566,3 @@ sndbuf_setflags(struct snd_dbuf *b, u_int32_t flags, int on)
|
||||
b->flags |= flags;
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
|
||||
int
|
||||
sndbuf_isadmasetup(struct snd_dbuf *b, struct resource *drq)
|
||||
{
|
||||
/* should do isa_dma_acquire/isa_dma_release here */
|
||||
if (drq == NULL) {
|
||||
b->isadmachan = -1;
|
||||
} else {
|
||||
sndbuf_setflags(b, SNDBUF_F_ISADMA, 1);
|
||||
b->isadmachan = rman_get_start(drq);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sndbuf_isadmasetdir(struct snd_dbuf *b, int dir)
|
||||
{
|
||||
KASSERT(b, ("sndbuf_isadmasetdir called with b == NULL"));
|
||||
KASSERT(sndbuf_getflags(b) & SNDBUF_F_ISADMA, ("sndbuf_isadmasetdir called on non-ISA buffer"));
|
||||
|
||||
b->dir = (dir == PCMDIR_PLAY)? ISADMA_WRITE : ISADMA_READ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
sndbuf_isadma(struct snd_dbuf *b, int go)
|
||||
{
|
||||
KASSERT(b, ("sndbuf_isadma called with b == NULL"));
|
||||
KASSERT(sndbuf_getflags(b) & SNDBUF_F_ISADMA, ("sndbuf_isadma called on non-ISA buffer"));
|
||||
|
||||
switch (go) {
|
||||
case PCMTRIG_START:
|
||||
/* isa_dmainit(b->chan, size); */
|
||||
isa_dmastart(b->dir | ISADMA_RAW, b->buf, b->bufsize, b->isadmachan);
|
||||
break;
|
||||
|
||||
case PCMTRIG_STOP:
|
||||
case PCMTRIG_ABORT:
|
||||
isa_dmastop(b->isadmachan);
|
||||
isa_dmadone(b->dir | ISADMA_RAW, b->buf, b->bufsize, b->isadmachan);
|
||||
break;
|
||||
}
|
||||
|
||||
DEB(printf("buf 0x%p ISA DMA %s, channel %d\n",
|
||||
b,
|
||||
(go == PCMTRIG_START)? "started" : "stopped",
|
||||
b->isadmachan));
|
||||
}
|
||||
|
||||
int
|
||||
sndbuf_isadmaptr(struct snd_dbuf *b)
|
||||
{
|
||||
int i;
|
||||
|
||||
KASSERT(b, ("sndbuf_isadmaptr called with b == NULL"));
|
||||
KASSERT(sndbuf_getflags(b) & SNDBUF_F_ISADMA, ("sndbuf_isadmaptr called on non-ISA buffer"));
|
||||
|
||||
if (!sndbuf_runsz(b))
|
||||
return 0;
|
||||
i = isa_dmastatus(b->isadmachan);
|
||||
KASSERT(i >= 0, ("isa_dmastatus returned %d", i));
|
||||
return b->bufsize - i;
|
||||
}
|
||||
|
||||
void
|
||||
sndbuf_isadmabounce(struct snd_dbuf *b)
|
||||
{
|
||||
KASSERT(b, ("sndbuf_isadmabounce called with b == NULL"));
|
||||
KASSERT(sndbuf_getflags(b) & SNDBUF_F_ISADMA, ("sndbuf_isadmabounce called on non-ISA buffer"));
|
||||
|
||||
/* tell isa_dma to bounce data in/out */
|
||||
}
|
||||
|
||||
|
@ -26,13 +26,35 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define ISA_DMA(b) (sndbuf_getflags((b)) & SNDBUF_F_ISADMA)
|
||||
#define SND_DMA(b) (sndbuf_getflags((b)) & SNDBUF_F_DMA)
|
||||
#define SNDBUF_LOCKASSERT(b)
|
||||
|
||||
#define SNDBUF_F_ISADMA 0x00000001
|
||||
#define SNDBUF_F_DMA 0x00000001
|
||||
#define SNDBUF_F_XRUN 0x00000002
|
||||
#define SNDBUF_F_RUNNING 0x00000004
|
||||
|
||||
#define SNDBUF_NAMELEN 48
|
||||
|
||||
struct snd_dbuf {
|
||||
device_t dev;
|
||||
u_int8_t *buf, *tmpbuf;
|
||||
unsigned int bufsize, maxsize;
|
||||
volatile int dl; /* transfer size */
|
||||
volatile int rp; /* pointers to the ready area */
|
||||
volatile int rl; /* length of ready area */
|
||||
volatile int hp;
|
||||
volatile u_int32_t total, prev_total;
|
||||
int dmachan, dir; /* dma channel */
|
||||
u_int32_t fmt, spd, bps;
|
||||
unsigned int blksz, blkcnt;
|
||||
int xrun;
|
||||
u_int32_t flags;
|
||||
bus_dmamap_t dmamap;
|
||||
bus_dma_tag_t dmatag;
|
||||
struct selinfo sel;
|
||||
char name[SNDBUF_NAMELEN];
|
||||
};
|
||||
|
||||
struct snd_dbuf *sndbuf_create(device_t dev, char *drv, char *desc);
|
||||
void sndbuf_destroy(struct snd_dbuf *b);
|
||||
|
||||
@ -87,10 +109,8 @@ int sndbuf_feed(struct snd_dbuf *from, struct snd_dbuf *to, struct pcm_channel *
|
||||
u_int32_t sndbuf_getflags(struct snd_dbuf *b);
|
||||
void sndbuf_setflags(struct snd_dbuf *b, u_int32_t flags, int on);
|
||||
|
||||
int sndbuf_isadmasetup(struct snd_dbuf *b, struct resource *drq);
|
||||
int sndbuf_isadmasetdir(struct snd_dbuf *b, int dir);
|
||||
void sndbuf_isadma(struct snd_dbuf *b, int go);
|
||||
int sndbuf_isadmaptr(struct snd_dbuf *b);
|
||||
void sndbuf_isadmabounce(struct snd_dbuf *b);
|
||||
|
||||
|
||||
int sndbuf_dmasetup(struct snd_dbuf *b, struct resource *drq);
|
||||
int sndbuf_dmasetdir(struct snd_dbuf *b, int dir);
|
||||
void sndbuf_dma(struct snd_dbuf *b, int go);
|
||||
int sndbuf_dmaptr(struct snd_dbuf *b);
|
||||
void sndbuf_dmabounce(struct snd_dbuf *b);
|
||||
|
@ -767,8 +767,8 @@ chn_setdir(struct pcm_channel *c, int dir)
|
||||
CHN_LOCKASSERT(c);
|
||||
c->direction = dir;
|
||||
r = CHANNEL_SETDIR(c->methods, c->devinfo, c->direction);
|
||||
if (!r && ISA_DMA(b))
|
||||
sndbuf_isadmasetdir(b, c->direction);
|
||||
if (!r && SND_DMA(b))
|
||||
sndbuf_dmasetdir(b, c->direction);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -980,8 +980,8 @@ chn_trigger(struct pcm_channel *c, int go)
|
||||
int ret;
|
||||
|
||||
CHN_LOCKASSERT(c);
|
||||
if (ISA_DMA(b) && (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD))
|
||||
sndbuf_isadmabounce(b);
|
||||
if (SND_DMA(b) && (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD))
|
||||
sndbuf_dmabounce(b);
|
||||
ret = CHANNEL_TRIGGER(c->methods, c->devinfo, go);
|
||||
|
||||
return ret;
|
||||
|
@ -64,7 +64,6 @@
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/soundcard.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <isa/isavar.h>
|
||||
#include <sys/kobj.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
@ -104,12 +103,6 @@ struct snd_mixer;
|
||||
#define PCM_SOFTC_SIZE 512
|
||||
|
||||
#define SND_STATUSLEN 64
|
||||
/* descriptor of audio device */
|
||||
#ifndef ISADMA_WRITE
|
||||
#define ISADMA_WRITE B_WRITE
|
||||
#define ISADMA_READ B_READ
|
||||
#define ISADMA_RAW B_RAW
|
||||
#endif
|
||||
|
||||
#define PCM_MODVER 1
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../../dev/sound/pcm
|
||||
.PATH: ${.CURDIR}/../../../dev/sound/isa
|
||||
|
||||
KMOD= snd_pcm
|
||||
SRCS= device_if.h bus_if.h isa_if.h pci_if.h
|
||||
@ -9,6 +10,7 @@ SRCS+= ac97_if.c channel_if.c feeder_if.c mixer_if.c
|
||||
SRCS+= ac97.c ac97_patch.c buffer.c channel.c dsp.c
|
||||
SRCS+= fake.c feeder.c feeder_fmt.c feeder_rate.c
|
||||
SRCS+= mixer.c sndstat.c sound.c vchan.c
|
||||
SRCS+= sndbuf_dma.c
|
||||
|
||||
EXPORT_SYMS= YES # XXX evaluate
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../../dev/sound/pcm
|
||||
.PATH: ${.CURDIR}/../../../dev/sound/isa
|
||||
|
||||
KMOD= snd_pcm
|
||||
SRCS= device_if.h bus_if.h isa_if.h pci_if.h
|
||||
@ -9,6 +10,7 @@ SRCS+= ac97_if.c channel_if.c feeder_if.c mixer_if.c
|
||||
SRCS+= ac97.c ac97_patch.c buffer.c channel.c dsp.c
|
||||
SRCS+= fake.c feeder.c feeder_fmt.c feeder_rate.c
|
||||
SRCS+= mixer.c sndstat.c sound.c vchan.c
|
||||
SRCS+= sndbuf_dma.c
|
||||
|
||||
EXPORT_SYMS= YES # XXX evaluate
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user