summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pcm
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/sound/pcm')
-rw-r--r--sys/dev/sound/pcm/buffer.c95
-rw-r--r--sys/dev/sound/pcm/buffer.h38
-rw-r--r--sys/dev/sound/pcm/channel.c8
-rw-r--r--sys/dev/sound/pcm/sound.h7
4 files changed, 33 insertions, 115 deletions
diff --git a/sys/dev/sound/pcm/buffer.c b/sys/dev/sound/pcm/buffer.c
index dd74271..645e3b3 100644
--- a/sys/dev/sound/pcm/buffer.c
+++ b/sys/dev/sound/pcm/buffer.c
@@ -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 */
-}
-
diff --git a/sys/dev/sound/pcm/buffer.h b/sys/dev/sound/pcm/buffer.h
index 930d2e5..d25ceec 100644
--- a/sys/dev/sound/pcm/buffer.h
+++ b/sys/dev/sound/pcm/buffer.h
@@ -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);
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index 68fc573..8c139b0 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -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;
diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h
index 5038a28..1daed2a 100644
--- a/sys/dev/sound/pcm/sound.h
+++ b/sys/dev/sound/pcm/sound.h
@@ -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
OpenPOWER on IntegriCloud