Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Aug 2000 10:04:21 -0700 (PDT)
From:      Nick Sayer <nsayer@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        cg@freebsd.org
Subject:   Re: ESS Solo users, try this patch
Message-ID:  <Pine.BSF.4.21.0008111002110.99078-200000@medusa.kfu.com>
In-Reply-To: <200008110450.VAA93536@medusa.kfu.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
The last patch improved, but did not completely eliminate the warnings.
This one appears to do the job perfectly. The question is, does calling
DELAY() like this cause any concerns for anyone?



[-- Attachment #2 --]
Index: solo.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/sound/pci/solo.c,v
retrieving revision 1.8
diff -u -r1.8 solo.c
--- solo.c	2000/08/09 07:14:56	1.8
+++ solo.c	2000/08/11 17:01:22
@@ -756,7 +756,7 @@
 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 @@
 /*
  * 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)

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0008111002110.99078-200000>