summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorcg <cg@FreeBSD.org>2000-05-26 21:15:47 +0000
committercg <cg@FreeBSD.org>2000-05-26 21:15:47 +0000
commite7de7487d9f2c8301120a8d7b0764cff65dead8c (patch)
treeef0510b1c060f4f7b7834089dfe7d1fc9ed32632 /sys
parent8c66999e1dece9580671edf7cd994284f29eacee (diff)
downloadFreeBSD-src-e7de7487d9f2c8301120a8d7b0764cff65dead8c.zip
FreeBSD-src-e7de7487d9f2c8301120a8d7b0764cff65dead8c.tar.gz
handle emulated dma reads
don't try to get sample size from snd_dbuf
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/sound/isa/ad1816.c4
-rw-r--r--sys/dev/sound/isa/ess.c2
-rw-r--r--sys/dev/sound/isa/mss.c16
-rw-r--r--sys/dev/sound/isa/sb.c2
-rw-r--r--sys/dev/sound/isa/sb16.c2
-rw-r--r--sys/dev/sound/isa/sb8.c2
-rw-r--r--sys/dev/sound/pci/aureal.c5
-rw-r--r--sys/dev/sound/pci/csapcm.c4
-rw-r--r--sys/dev/sound/pci/emu10k1.c4
-rw-r--r--sys/dev/sound/pci/es137x.c11
-rw-r--r--sys/dev/sound/pci/neomagic.c3
-rw-r--r--sys/dev/sound/pci/t4dwave.c14
-rw-r--r--sys/dev/sound/pcm/channel.h1
13 files changed, 51 insertions, 19 deletions
diff --git a/sys/dev/sound/isa/ad1816.c b/sys/dev/sound/isa/ad1816.c
index 549ed51..bcf0715 100644
--- a/sys/dev/sound/isa/ad1816.c
+++ b/sys/dev/sound/isa/ad1816.c
@@ -403,7 +403,9 @@ ad1816chan_trigger(void *data, int go)
struct ad1816_info *ad1816 = ch->parent;
int wr, reg;
- if (go == PCMTRIG_EMLDMAWR) return 0;
+ if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+ return 0;
+
buf_isadma(ch->buffer, go);
wr = (ch->dir == PCMDIR_PLAY);
reg = wr? AD1816_PLAY : AD1816_CAPT;
diff --git a/sys/dev/sound/isa/ess.c b/sys/dev/sound/isa/ess.c
index 879c029..ffdad21 100644
--- a/sys/dev/sound/isa/ess.c
+++ b/sys/dev/sound/isa/ess.c
@@ -678,7 +678,7 @@ esschan_trigger(void *data, int go)
{
struct ess_chinfo *ch = data;
- if (go == PCMTRIG_EMLDMAWR)
+ if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
return 0;
switch (go) {
diff --git a/sys/dev/sound/isa/mss.c b/sys/dev/sound/isa/mss.c
index 3094b9e..1db56c2 100644
--- a/sys/dev/sound/isa/mss.c
+++ b/sys/dev/sound/isa/mss.c
@@ -49,6 +49,7 @@ struct mss_chinfo {
pcm_channel *channel;
snd_dbuf *buffer;
int dir;
+ u_int32_t fmt;
};
struct mss_info {
@@ -1293,6 +1294,7 @@ mss_format(struct mss_chinfo *ch, u_int32_t format)
{AFMT_U8, AFMT_MU_LAW, AFMT_S16_LE, AFMT_A_LAW,
-1, AFMT_IMA_ADPCM, AFMT_U16_BE, -1};
+ ch->fmt = format;
for (i = 0; i < 8; i++) if (arg == fmts[i]) break;
arg = i << 1;
if (format & AFMT_STEREO) arg |= 1;
@@ -1309,13 +1311,17 @@ mss_trigger(struct mss_chinfo *ch, int go)
{
struct mss_info *mss = ch->parent;
u_char m;
- int retry, wr, cnt;
+ int retry, wr, cnt, ss;
- wr = (ch->dir == PCMDIR_PLAY)? 1 : 0;
+ ss = 1;
+ ss <<= (ch->fmt & AFMT_STEREO)? 1 : 0;
+ ss <<= (ch->fmt & AFMT_16BIT)? 1 : 0;
+
+ wr = (ch->dir == PCMDIR_PLAY)? 1 : 0;
m = ad_read(mss, 9);
switch (go) {
case PCMTRIG_START:
- cnt = (ch->buffer->dl / ch->buffer->sample_size) - 1;
+ cnt = (ch->buffer->dl / ss) - 1;
DEB(if (m & 4) printf("OUCH! reg 9 0x%02x\n", m););
m |= wr? I9_PEN : I9_CEN; /* enable DMA */
@@ -1768,7 +1774,9 @@ msschan_trigger(void *data, int go)
{
struct mss_chinfo *ch = data;
- if (go == PCMTRIG_EMLDMAWR) return 0;
+ if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+ return 0;
+
buf_isadma(ch->buffer, go);
mss_trigger(ch, go);
return 0;
diff --git a/sys/dev/sound/isa/sb.c b/sys/dev/sound/isa/sb.c
index 6b1aa4b..a784311 100644
--- a/sys/dev/sound/isa/sb.c
+++ b/sys/dev/sound/isa/sb.c
@@ -689,7 +689,7 @@ sbchan_trigger(void *data, int go)
{
struct sb_chinfo *ch = data;
- if (go == PCMTRIG_EMLDMAWR)
+ if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
return 0;
buf_isadma(ch->buffer, go);
diff --git a/sys/dev/sound/isa/sb16.c b/sys/dev/sound/isa/sb16.c
index 6b1aa4b..a784311 100644
--- a/sys/dev/sound/isa/sb16.c
+++ b/sys/dev/sound/isa/sb16.c
@@ -689,7 +689,7 @@ sbchan_trigger(void *data, int go)
{
struct sb_chinfo *ch = data;
- if (go == PCMTRIG_EMLDMAWR)
+ if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
return 0;
buf_isadma(ch->buffer, go);
diff --git a/sys/dev/sound/isa/sb8.c b/sys/dev/sound/isa/sb8.c
index 6b1aa4b..a784311 100644
--- a/sys/dev/sound/isa/sb8.c
+++ b/sys/dev/sound/isa/sb8.c
@@ -689,7 +689,7 @@ sbchan_trigger(void *data, int go)
{
struct sb_chinfo *ch = data;
- if (go == PCMTRIG_EMLDMAWR)
+ if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
return 0;
buf_isadma(ch->buffer, go);
diff --git a/sys/dev/sound/pci/aureal.c b/sys/dev/sound/pci/aureal.c
index c16fffa7..c1e040d 100644
--- a/sys/dev/sound/pci/aureal.c
+++ b/sys/dev/sound/pci/aureal.c
@@ -350,7 +350,10 @@ auchan_trigger(void *data, int go)
{
struct au_chinfo *ch = data;
struct au_info *au = ch->parent;
- if (go == PCMTRIG_EMLDMAWR) return 0;
+
+ if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+ return 0;
+
if (ch->dir == PCMDIR_PLAY) {
au_setadb(au, 0x11, (go)? 1 : 0);
if (!go) {
diff --git a/sys/dev/sound/pci/csapcm.c b/sys/dev/sound/pci/csapcm.c
index 0f56ee5..8e63ee7 100644
--- a/sys/dev/sound/pci/csapcm.c
+++ b/sys/dev/sound/pci/csapcm.c
@@ -388,7 +388,9 @@ csachan_trigger(void *data, int go)
struct csa_chinfo *ch = data;
struct csa_info *csa = ch->parent;
- if (go == PCMTRIG_EMLDMAWR) return 0;
+ if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+ return 0;
+
if (ch->dir == PCMDIR_PLAY) {
if (go == PCMTRIG_START)
csa_startplaydma(csa);
diff --git a/sys/dev/sound/pci/emu10k1.c b/sys/dev/sound/pci/emu10k1.c
index e8dcc6e..7c144df 100644
--- a/sys/dev/sound/pci/emu10k1.c
+++ b/sys/dev/sound/pci/emu10k1.c
@@ -672,7 +672,9 @@ emuchan_trigger(void *data, int go)
struct sc_chinfo *ch = data;
struct sc_info *sc = ch->parent;
- if (go == PCMTRIG_EMLDMAWR) return 0;
+ if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+ return 0;
+
if (go == PCMTRIG_START) {
emu_vsetup(ch);
emu_vwrite(sc, ch->master);
diff --git a/sys/dev/sound/pci/es137x.c b/sys/dev/sound/pci/es137x.c
index 7e72a49..4094d55 100644
--- a/sys/dev/sound/pci/es137x.c
+++ b/sys/dev/sound/pci/es137x.c
@@ -365,9 +365,16 @@ eschan_trigger(void *data, int go)
{
struct es_chinfo *ch = data;
struct es_info *es = ch->parent;
- unsigned cnt = ch->buffer->dl / ch->buffer->sample_size - 1;
+ unsigned ss, cnt;
+
+ if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+ return 0;
+
+ ss = 1;
+ ss <<= (ch->fmt & AFMT_STEREO)? 1 : 0;
+ ss <<= (ch->fmt & AFMT_16BIT)? 1 : 0;
+ cnt = ch->buffer->dl / ss - 1;
- if (go == PCMTRIG_EMLDMAWR) return 0;
if (ch->dir == PCMDIR_PLAY) {
if (go == PCMTRIG_START) {
int b = (ch->fmt & AFMT_S16_LE)? 2 : 1;
diff --git a/sys/dev/sound/pci/neomagic.c b/sys/dev/sound/pci/neomagic.c
index a5dbaa1..638ac96 100644
--- a/sys/dev/sound/pci/neomagic.c
+++ b/sys/dev/sound/pci/neomagic.c
@@ -396,7 +396,8 @@ nmchan_trigger(void *data, int go)
struct sc_info *sc = ch->parent;
int ssz;
- if (go == PCMTRIG_EMLDMAWR) return 0;
+ if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+ return 0;
ssz = (ch->fmt & AFMT_16BIT)? 2 : 1;
if (ch->fmt & AFMT_STEREO)
diff --git a/sys/dev/sound/pci/t4dwave.c b/sys/dev/sound/pci/t4dwave.c
index 135641f..29cf9b7 100644
--- a/sys/dev/sound/pci/t4dwave.c
+++ b/sys/dev/sound/pci/t4dwave.c
@@ -52,7 +52,7 @@ struct tr_chinfo {
u_int32_t eso, delta;
u_int32_t rvol, cvol;
u_int32_t gvsel, pan, vol, ctrl;
- int index;
+ int index, ss;
snd_dbuf *buffer;
pcm_channel *channel;
struct tr_info *parent;
@@ -438,9 +438,12 @@ trchan_setformat(void *data, u_int32_t format)
struct tr_info *tr = ch->parent;
u_int32_t bits = tr_fmttobits(format);
+ ch->ss = 1;
+ ch->ss <<= (format & AFMT_STEREO)? 1 : 0;
+ ch->ss <<= (format & AFMT_16BIT)? 1 : 0;
if (ch->index >= 0) {
tr_rdch(tr, ch->index, ch);
- ch->eso = (ch->buffer->bufsize / ch->buffer->sample_size) - 1;
+ ch->eso = (ch->buffer->bufsize / ch->ss) - 1;
ch->ctrl = bits | 0x01;
tr_wrch(tr, ch->index, ch);
} else {
@@ -488,7 +491,9 @@ trchan_trigger(void *data, int go)
struct tr_chinfo *ch = data;
struct tr_info *tr = ch->parent;
- if (go == PCMTRIG_EMLDMAWR) return 0;
+ if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD)
+ return 0;
+
if (ch->index >= 0) {
if (go == PCMTRIG_START) {
tr_rdch(tr, ch->index, ch);
@@ -508,9 +513,10 @@ trchan_getptr(void *data)
{
struct tr_chinfo *ch = data;
struct tr_info *tr = ch->parent;
+
if (ch->index >= 0) {
tr_rdch(tr, ch->index, ch);
- return ch->cso * ch->buffer->sample_size;
+ return ch->cso * ch->ss;
} else return tr_rd(tr, TR_REG_DMAR0, 4) - vtophys(ch->buffer->buf);
}
diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h
index edc3096..0c13b65 100644
--- a/sys/dev/sound/pcm/channel.h
+++ b/sys/dev/sound/pcm/channel.h
@@ -63,6 +63,7 @@ extern pcm_feeder feeder_root;
#define PCMTRIG_START 1
#define PCMTRIG_EMLDMAWR 2
+#define PCMTRIG_EMLDMARD 3
#define PCMTRIG_STOP 0
#define PCMTRIG_ABORT -1
OpenPOWER on IntegriCloud