summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pci/solo.c
diff options
context:
space:
mode:
authornsayer <nsayer@FreeBSD.org>2000-08-13 19:20:02 +0000
committernsayer <nsayer@FreeBSD.org>2000-08-13 19:20:02 +0000
commit301ab84115a0616fcee6d861dbe138e966a50699 (patch)
tree42b9bf29b3f7213aacec6ad71e5281166aa0696b /sys/dev/sound/pci/solo.c
parentdd3d88fc3425822d0e58461c08e0cf562f99b7ff (diff)
downloadFreeBSD-src-301ab84115a0616fcee6d861dbe138e966a50699.zip
FreeBSD-src-301ab84115a0616fcee6d861dbe138e966a50699.tar.gz
This patch appears to solve the problems with recording resulting
in bogus hwptr warnings. Further comments sought on -hackers were not forthcoming. I can only hope that calling DELAY() like this doesn't cause any heartburn.
Diffstat (limited to 'sys/dev/sound/pci/solo.c')
-rw-r--r--sys/dev/sound/pci/solo.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/dev/sound/pci/solo.c b/sys/dev/sound/pci/solo.c
index 2f6a159..5af2730 100644
--- a/sys/dev/sound/pci/solo.c
+++ b/sys/dev/sound/pci/solo.c
@@ -756,7 +756,7 @@ ess_dmasetup(struct ess_info *sc, int ch, u_int32_t base, u_int16_t cnt, int dir
static int
ess_dmapos(struct ess_info *sc, int ch)
{
- int p = 0;
+ int p = 0, i = 0, j = 0;
u_long flags;
KASSERT(ch == 1 || ch == 2, ("bad ch"));
@@ -766,11 +766,20 @@ ess_dmapos(struct ess_info *sc, int ch)
/*
* During recording, this register is known to give back
* garbage if it's not quiescent while being read. That's
- * why we spl, stop the DMA, wait, and be vewy, vewy quiet
+ * why we spl, stop the DMA, and try over and over until
+ * adjacent reads are "close", in the right order and not
+ * bigger than is otherwise possible.
*/
ess_dmatrigger(sc, ch, 0);
- DELAY(20);
- p = port_rd(sc->vc, 0x4, 2) + 1;
+ DELAY(20);
+ do {
+ DELAY(10);
+ if (j > 1)
+ printf("DMA count reg bogus: %04x & %04x\n",
+ i, p);
+ i = port_rd(sc->vc, 0x4, 2) + 1;
+ p = port_rd(sc->vc, 0x4, 2) + 1;
+ } while ((p > sc->dmasz[ch -1 ] || i < p || (p - i) > 0x8) && j++ < 1000);
ess_dmatrigger(sc, ch, 1);
}
else if (ch == 2)
OpenPOWER on IntegriCloud