Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pad Update pad due to changes in audio. sc_bytes_co...
details: https://anonhg.NetBSD.org/src/rev/052acf847b1a
branches: trunk
changeset: 821979:052acf847b1a
user: nat <nat%NetBSD.org@localhost>
date: Thu Feb 23 23:13:27 2017 +0000
description:
Update pad due to changes in audio. sc_bytes_count and BYTESTOSLEEP are
no longer required.
diffstat:
sys/dev/pad/pad.c | 29 ++++++++++-------------------
sys/dev/pad/padvar.h | 3 +--
2 files changed, 11 insertions(+), 21 deletions(-)
diffs (88 lines):
diff -r ae1e5271f220 -r 052acf847b1a sys/dev/pad/pad.c
--- a/sys/dev/pad/pad.c Thu Feb 23 22:33:31 2017 +0000
+++ b/sys/dev/pad/pad.c Thu Feb 23 23:13:27 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.27 2017/01/26 04:10:27 nat Exp $ */
+/* $NetBSD: pad.c,v 1.28 2017/02/23 23:13:27 nat Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.27 2017/01/26 04:10:27 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.28 2017/02/23 23:13:27 nat Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -321,7 +321,6 @@
}
getmicrotime(&sc->sc_last);
- sc->sc_bytes_count = 0;
return 0;
}
@@ -342,8 +341,7 @@
}
#define PAD_BYTES_PER_SEC (44100 * sizeof(int16_t) * 2)
-#define TIMENEXTREAD (20 * 1000)
-#define BYTESTOSLEEP ((PAD_BYTES_PER_SEC / (1000000 / TIMENEXTREAD)) + PAD_BLKSIZE)
+#define TIMENEXTREAD (PAD_BLKSIZE * 1000 / PAD_BYTES_PER_SEC)
int
pad_read(dev_t dev, struct uio *uio, int flags)
@@ -371,27 +369,20 @@
nowusec = (now.tv_sec * 1000000) + now.tv_usec;
lastusec = (sc->sc_last.tv_sec * 1000000) +
sc->sc_last.tv_usec;
- if (lastusec + TIMENEXTREAD > nowusec &&
- sc->sc_bytes_count >= BYTESTOSLEEP) {
+ if (lastusec + TIMENEXTREAD > nowusec) {
wait_ticks = (hz * ((lastusec + TIMENEXTREAD) -
nowusec)) / 1000000;
if (wait_ticks > 0) {
kpause("padwait", TRUE, wait_ticks,
- &sc->sc_lock);
+ &sc->sc_lock);
}
-
- sc->sc_bytes_count -= BYTESTOSLEEP;
- getmicrotime(&sc->sc_last);
- } else if (sc->sc_bytes_count >= BYTESTOSLEEP) {
- sc->sc_bytes_count -= BYTESTOSLEEP;
- getmicrotime(&sc->sc_last);
- } else if (lastusec + TIMENEXTREAD <= nowusec)
- getmicrotime(&sc->sc_last);
-
+ }
+ sc->sc_last.tv_sec =
+ (lastusec + TIMENEXTREAD) / 1000000;
+ sc->sc_last.tv_usec =
+ (lastusec + TIMENEXTREAD) % 1000000;
err = pad_get_block(sc, &pb, min(uio->uio_resid, PAD_BLKSIZE));
if (!err) {
- sc->sc_bytes_count += pb.pb_len;
-
mutex_exit(&sc->sc_lock);
err = uiomove(pb.pb_ptr, pb.pb_len, uio);
continue;
diff -r ae1e5271f220 -r 052acf847b1a sys/dev/pad/padvar.h
--- a/sys/dev/pad/padvar.h Thu Feb 23 22:33:31 2017 +0000
+++ b/sys/dev/pad/padvar.h Thu Feb 23 23:13:27 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: padvar.h,v 1.6 2016/02/26 13:17:04 nat Exp $ */
+/* $NetBSD: padvar.h,v 1.7 2017/02/23 23:13:27 nat Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -52,7 +52,6 @@
uint8_t sc_swvol;
struct timeval sc_last;
- int sc_bytes_count;
} pad_softc_t;
#endif /* !_SYS_DEV_PAD_PADVAR_H */
Home |
Main Index |
Thread Index |
Old Index