summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorcg <cg@FreeBSD.org>2000-08-09 00:42:00 +0000
committercg <cg@FreeBSD.org>2000-08-09 00:42:00 +0000
commit5d9a1c9f9cc4e7a501c4519e7695756232aad346 (patch)
tree9956ca53c4db277a229ccc457ab42d2353f85fba /sys/dev
parent6dac8645b86bb808d51201173eace0175022b968 (diff)
downloadFreeBSD-src-5d9a1c9f9cc4e7a501c4519e7695756232aad346.zip
FreeBSD-src-5d9a1c9f9cc4e7a501c4519e7695756232aad346.tar.gz
warn if hwptr goes backwards
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/sound/pcm/channel.c8
-rw-r--r--sys/dev/sound/pcm/datatypes.h1
2 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index 23d3232..cd40903 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -186,6 +186,11 @@ chn_dmaupdate(pcm_channel *c)
DEB (int b_rl=b->rl; int b_fl=b->fl; int b_rp=b->rp; int b_fp=b->fp);
hwptr = chn_getptr(c);
+ delta = (b->bufsize + hwptr - b->hp) % b->bufsize;
+ if (delta >= ((b->bufsize * 3) / 4)) {
+ if (!(c->flags & (CHN_F_CLOSING | CHN_F_ABORTING)))
+ device_printf(c->parent->dev, "hwptr went backwards %d -> %d\n", b->hp, hwptr);
+ }
if (c->direction == PCMDIR_PLAY) {
delta = (b->bufsize + hwptr - b->rp) % b->bufsize;
b->rp = hwptr;
@@ -204,6 +209,7 @@ chn_dmaupdate(pcm_channel *c)
DEB(printf("OUCH!(%d) fl %d(%d) delta %d bufsize %d hwptr %d fp %d(%d)\n", chn_updatecount++, b->fl, b_fl, delta, b->bufsize, hwptr, b->fp, b_fp));
}
}
+ b->hp = hwptr;
b->total += delta;
}
@@ -234,7 +240,7 @@ chn_checkunderflow(pcm_channel *c)
b->fl = b->bufsize - b->rl;
b->underflow = 0;
} else {
- /* chn_dmaupdate(c); */
+ chn_dmaupdate(c);
}
}
diff --git a/sys/dev/sound/pcm/datatypes.h b/sys/dev/sound/pcm/datatypes.h
index 986829a0..716c21b 100644
--- a/sys/dev/sound/pcm/datatypes.h
+++ b/sys/dev/sound/pcm/datatypes.h
@@ -63,6 +63,7 @@ struct _snd_dbuf {
volatile int dl; /* transfer size */
volatile int rp, fp; /* pointers to the ready and free area */
volatile int rl, fl; /* lenght of ready and free areas. */
+ volatile int hp;
volatile u_int32_t int_count, prev_int_count;
volatile u_int32_t total, prev_total;
int chan, dir; /* dma channel */
OpenPOWER on IntegriCloud