summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pcm/buffer.h
diff options
context:
space:
mode:
authorcg <cg@FreeBSD.org>2001-03-24 23:10:29 +0000
committercg <cg@FreeBSD.org>2001-03-24 23:10:29 +0000
commit11442775804b9679c2c761846072b171d2507840 (patch)
tree2c8e61a99c9323312c5656a92269f975ac6b0c12 /sys/dev/sound/pcm/buffer.h
parentfb291ae7e5515cf63d4544d3eeff0a4c791e3cad (diff)
downloadFreeBSD-src-11442775804b9679c2c761846072b171d2507840.zip
FreeBSD-src-11442775804b9679c2c761846072b171d2507840.tar.gz
mega-commit.
this introduces a new buffering mechanism which results in dramatic simplification of the channel manager. as several structures have changed, we take the opportunity to move their definitions into the source files where they are used, make them private and de-typedef them. the sound drivers are updated to use snd_setup_intr instead of bus_setup_intr, and to comply with the de-typedefed structures. the ac97, mixer and channel layers have been updated with finegrained locking, as have some drivers- not all though. the rest will follow soon.
Diffstat (limited to 'sys/dev/sound/pcm/buffer.h')
-rw-r--r--sys/dev/sound/pcm/buffer.h84
1 files changed, 65 insertions, 19 deletions
diff --git a/sys/dev/sound/pcm/buffer.h b/sys/dev/sound/pcm/buffer.h
index 62058ce..53ac279 100644
--- a/sys/dev/sound/pcm/buffer.h
+++ b/sys/dev/sound/pcm/buffer.h
@@ -26,24 +26,70 @@
* $FreeBSD$
*/
-#define ISA_DMA(b) (((b)->chan >= 0 && (b)->chan != 4 && (b)->chan < 8))
-
-int sndbuf_alloc(snd_dbuf *b, bus_dma_tag_t dmatag, int size);
-int sndbuf_setup(snd_dbuf *b, void *buf, int size);
-void sndbuf_free(snd_dbuf *b);
-int sndbuf_resize(snd_dbuf *b, int blkcnt, int blksz);
-void sndbuf_reset(snd_dbuf *b);
-void sndbuf_clear(snd_dbuf *b, int length);
-int sndbuf_setfmt(snd_dbuf *b, u_int32_t fmt);
-int sndbuf_getbps(snd_dbuf *b);
-void *sndbuf_getbuf(snd_dbuf *b);
-int sndbuf_getsize(snd_dbuf *b);
-int sndbuf_runsz(snd_dbuf *b);
-
-int sndbuf_isadmasetup(snd_dbuf *b, struct resource *drq);
-int sndbuf_isadmasetdir(snd_dbuf *b, int dir);
-void sndbuf_isadma(snd_dbuf *b, int go);
-int sndbuf_isadmaptr(snd_dbuf *b);
-void sndbuf_isadmabounce(snd_dbuf *b);
+#define ISA_DMA(b) (sndbuf_getflags((b)) & SNDBUF_F_ISADMA)
+#define SNDBUF_LOCKASSERT(b)
+
+#define SNDBUF_F_ISADMA 0x00000001
+#define SNDBUF_F_XRUN 0x00000002
+#define SNDBUF_F_RUNNING 0x00000004
+
+struct snd_dbuf *sndbuf_create(char *drv, char *desc);
+void sndbuf_destroy(struct snd_dbuf *b);
+
+void sndbuf_dump(struct snd_dbuf *b, char *s, u_int32_t what);
+
+int sndbuf_alloc(struct snd_dbuf *b, bus_dma_tag_t dmatag, unsigned int size);
+int sndbuf_setup(struct snd_dbuf *b, void *buf, unsigned int size);
+void sndbuf_free(struct snd_dbuf *b);
+int sndbuf_resize(struct snd_dbuf *b, unsigned int blkcnt, unsigned int blksz);
+int sndbuf_remalloc(struct snd_dbuf *b, unsigned int blkcnt, unsigned int blksz);
+void sndbuf_reset(struct snd_dbuf *b);
+void sndbuf_clear(struct snd_dbuf *b, unsigned int length);
+
+u_int32_t sndbuf_getfmt(struct snd_dbuf *b);
+int sndbuf_setfmt(struct snd_dbuf *b, u_int32_t fmt);
+unsigned int sndbuf_getspd(struct snd_dbuf *b);
+void sndbuf_setspd(struct snd_dbuf *b, unsigned int spd);
+unsigned int sndbuf_getbps(struct snd_dbuf *b);
+
+void *sndbuf_getbuf(struct snd_dbuf *b);
+void *sndbuf_getbufofs(struct snd_dbuf *b, unsigned int ofs);
+unsigned int sndbuf_getsize(struct snd_dbuf *b);
+unsigned int sndbuf_getmaxsize(struct snd_dbuf *b);
+unsigned int sndbuf_getalign(struct snd_dbuf *b);
+unsigned int sndbuf_getblkcnt(struct snd_dbuf *b);
+void sndbuf_setblkcnt(struct snd_dbuf *b, unsigned int blkcnt);
+unsigned int sndbuf_getblksz(struct snd_dbuf *b);
+void sndbuf_setblksz(struct snd_dbuf *b, unsigned int blksz);
+unsigned int sndbuf_runsz(struct snd_dbuf *b);
+void sndbuf_setrun(struct snd_dbuf *b, int go);
+struct selinfo *sndbuf_getsel(struct snd_dbuf *b);
+
+unsigned int sndbuf_getxrun(struct snd_dbuf *b);
+void sndbuf_setxrun(struct snd_dbuf *b, unsigned int cnt);
+unsigned int sndbuf_gethwptr(struct snd_dbuf *b);
+void sndbuf_sethwptr(struct snd_dbuf *b, unsigned int ptr);
+unsigned int sndbuf_getfree(struct snd_dbuf *b);
+unsigned int sndbuf_getfreeptr(struct snd_dbuf *b);
+unsigned int sndbuf_getready(struct snd_dbuf *b);
+unsigned int sndbuf_getreadyptr(struct snd_dbuf *b);
+unsigned int sndbuf_getblocks(struct snd_dbuf *b);
+unsigned int sndbuf_getprevblocks(struct snd_dbuf *b);
+unsigned int sndbuf_gettotal(struct snd_dbuf *b);
+void sndbuf_updateprevtotal(struct snd_dbuf *b);
+
+int sndbuf_acquire(struct snd_dbuf *b, u_int8_t *from, unsigned int count);
+int sndbuf_dispose(struct snd_dbuf *b, u_int8_t *to, unsigned int count);
+int sndbuf_uiomove(struct snd_dbuf *b, struct uio *uio, unsigned int count);
+int sndbuf_feed(struct snd_dbuf *from, struct snd_dbuf *to, struct pcm_channel *channel, struct pcm_feeder *feeder, unsigned int count);
+
+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);
OpenPOWER on IntegriCloud