summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pcm
diff options
context:
space:
mode:
authorcg <cg@FreeBSD.org>2000-06-20 23:42:08 +0000
committercg <cg@FreeBSD.org>2000-06-20 23:42:08 +0000
commitcdd0f2dff31cfdde6515c141351b99e6caa38395 (patch)
treecb9b6afc44fc19ef5e3ce4481efe878d2cb68dcf /sys/dev/sound/pcm
parentcc71ce279b47c761c710b6ca373564677dc63303 (diff)
downloadFreeBSD-src-cdd0f2dff31cfdde6515c141351b99e6caa38395.zip
FreeBSD-src-cdd0f2dff31cfdde6515c141351b99e6caa38395.tar.gz
add record channel irq timeouts too
Diffstat (limited to 'sys/dev/sound/pcm')
-rw-r--r--sys/dev/sound/pcm/channel.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index 9f81751..cb2c9e5 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -700,7 +700,7 @@ chn_rdintr(pcm_channel *c)
int
chn_read(pcm_channel *c, struct uio *buf)
{
- int ret = 0, timeout, limit, res;
+ int ret = 0, timeout, limit, res, count;
long s;
snd_dbuf *b = &c->buffer;
snd_dbuf *bs = &c->buffer2nd;
@@ -734,12 +734,18 @@ chn_read(pcm_channel *c, struct uio *buf)
chn_start(c);
if (!(c->flags & CHN_F_NBIO)) {
+ count = hz;
/* Wait until all samples are captured. */
- while (buf->uio_resid > 0) {
+ while ((buf->uio_resid > 0) && (count > 0)) {
/* Suck up the DMA and secondary buffers. */
chn_dmaupdate(c);
+ res = buf->uio_resid;
while (chn_rdfeed(c) > 0);
while (chn_rdfeed2nd(c, buf) > 0);
+ if (buf->uio_resid < res)
+ count = hz;
+ else
+ count--;
/* Have we finished to feed the uio? */
if (buf->uio_resid == 0)
@@ -754,6 +760,10 @@ chn_read(pcm_channel *c, struct uio *buf)
if (ret == EINTR || ret == ERESTART)
break;
}
+ if (count == 0) {
+ c->flags |= CHN_F_DEAD;
+ device_printf(c->parent->dev, "record interrupt timeout, channel dead\n");
+ }
} else {
/* If no pcm data was read on nonblocking, return EAGAIN. */
if (buf->uio_resid == res)
OpenPOWER on IntegriCloud