diff options
| author | Cameron Grant <cg@FreeBSD.org> | 2000-08-09 00:42:00 +0000 |
|---|---|---|
| committer | Cameron Grant <cg@FreeBSD.org> | 2000-08-09 00:42:00 +0000 |
| commit | 5fd7b0878e31c190b356a5e9ce143bd0eac5138a (patch) | |
| tree | 54d82aeb291a099feab8ce13762f0f32b9680e5f | |
| parent | b5ee7ec63adb891dcc38446875bc5972e739ca51 (diff) | |
Notes
| -rw-r--r-- | sys/dev/sound/pcm/channel.c | 8 | ||||
| -rw-r--r-- | sys/dev/sound/pcm/datatypes.h | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 23d3232f11ea..cd4090389752 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 986829a0d858..716c21b7c211 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 */ |
