Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/dev/pci Pull up revision 1.45 (requested by hubertf):
details: https://anonhg.NetBSD.org/src/rev/c5e3a595c5b1
branches: netbsd-1-5
changeset: 491469:c5e3a595c5b1
user: he <he%NetBSD.org@localhost>
date: Tue May 01 10:02:12 2001 +0000
description:
Pull up revision 1.45 (requested by hubertf):
Work around race condition by relatching the interrupt. Makes
the eap driver not hang on certain occasions.
diffstat:
sys/dev/pci/eap.c | 53 +++++++++++++++++++++++++++++++----------------------
1 files changed, 31 insertions(+), 22 deletions(-)
diffs (160 lines):
diff -r 8f84cf0c8057 -r c5e3a595c5b1 sys/dev/pci/eap.c
--- a/sys/dev/pci/eap.c Tue May 01 08:57:19 2001 +0000
+++ b/sys/dev/pci/eap.c Tue May 01 10:02:12 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: eap.c,v 1.40.2.1 2000/06/30 16:27:50 simonb Exp $ */
+/* $NetBSD: eap.c,v 1.40.2.2 2001/05/01 10:02:12 he Exp $ */
/* $OpenBSD: eap.c,v 1.6 1999/10/05 19:24:42 csapuntz Exp $ */
/*
@@ -345,7 +345,7 @@
break;
delay(1);
}
- if (to > EAP_WRITE_TIMEOUT)
+ if (to >= EAP_WRITE_TIMEOUT)
printf("%s: eap1371_ready_codec timeout 1\n",
sc->sc_dev.dv_xname);
@@ -359,7 +359,7 @@
break;
delay(1);
}
- if (to > EAP_WRITE_TIMEOUT)
+ if (to >= EAP_READ_TIMEOUT)
printf("%s: eap1371_ready_codec timeout 2\n",
sc->sc_dev.dv_xname);
@@ -369,7 +369,7 @@
break;
delay(1);
}
- if (to > EAP_WRITE_TIMEOUT)
+ if (to >= EAP_READ_TIMEOUT)
printf("%s: eap1371_ready_codec timeout 3\n",
sc->sc_dev.dv_xname);
@@ -461,12 +461,15 @@
src |= E1371_SRC_ADDR(a);
EWRITE4(sc, E1371_SRC, src | E1371_SRC_STATE_OK);
- for (to = 0; to < EAP_READ_TIMEOUT; to++) {
- t = EREAD4(sc, E1371_SRC);
- if ((t & E1371_SRC_STATE_MASK) == E1371_SRC_STATE_OK)
- break;
- delay(1);
+ if ((eap1371_src_wait(sc) & E1371_SRC_STATE_MASK) != E1371_SRC_STATE_OK) {
+ for (to = 0; to < EAP_READ_TIMEOUT; to++) {
+ t = EREAD4(sc, E1371_SRC);
+ if ((t & E1371_SRC_STATE_MASK) == E1371_SRC_STATE_OK)
+ break;
+ delay(1);
+ }
}
+
EWRITE4(sc, E1371_SRC, src);
return t & E1371_SRC_DATAMASK;
@@ -543,7 +546,7 @@
rate = 48000;
if (rate < 4000)
rate = 4000;
- freq = (rate << 15) / 3000;
+ freq = ((rate << 15) + 1500) / 3000;
s = splaudio();
eap1371_src_wait(sc);
@@ -804,6 +807,7 @@
sic = EREAD4(sc, EAP_SIC);
DPRINTFN(5, ("eap_intr: ICSS=0x%08x, SIC=0x%08x\n", intr, sic));
if (intr & EAP_I_ADC) {
+#if 0
/*
* XXX This is a hack!
* The EAP chip sometimes generates the recording interrupt
@@ -824,14 +828,15 @@
}
}
/* Continue with normal interrupt handling. */
+#endif
EWRITE4(sc, EAP_SIC, sic & ~EAP_R1_INTR_EN);
- EWRITE4(sc, EAP_SIC, sic);
+ EWRITE4(sc, EAP_SIC, sic | EAP_R1_INTR_EN);
if (sc->sc_rintr)
sc->sc_rintr(sc->sc_rarg);
}
if (intr & EAP_I_DAC2) {
EWRITE4(sc, EAP_SIC, sic & ~EAP_P2_INTR_EN);
- EWRITE4(sc, EAP_SIC, sic);
+ EWRITE4(sc, EAP_SIC, sic | EAP_P2_INTR_EN);
if (sc->sc_pintr)
sc->sc_pintr(sc->sc_parg);
}
@@ -1132,9 +1137,6 @@
sc->sc_pintr = intr;
sc->sc_parg = arg;
- icsc = EREAD4(sc, EAP_ICSC);
- EWRITE4(sc, EAP_ICSC, icsc & ~EAP_DAC2_EN);
-
sic = EREAD4(sc, EAP_SIC);
sic &= ~(EAP_P2_S_EB | EAP_P2_S_MB | EAP_INC_BITS);
sic |= EAP_SET_P2_ST_INC(0) | EAP_SET_P2_END_INC(param->precision * param->factor / 8);
@@ -1147,7 +1149,8 @@
sic |= EAP_P2_S_MB;
sampshift++;
}
- EWRITE4(sc, EAP_SIC, sic);
+ EWRITE4(sc, EAP_SIC, sic & ~EAP_P2_INTR_EN);
+ EWRITE4(sc, EAP_SIC, sic | EAP_P2_INTR_EN);
for (p = sc->sc_dmas; p && KERNADDR(p) != start; p = p->next)
;
@@ -1164,8 +1167,12 @@
EWRITE4(sc, EAP_DAC2_SIZE,
EAP_SET_SIZE(0, (((char *)end - (char *)start) >> 2) - 1));
- EWRITE2(sc, EAP_DAC2_CSR, (blksize >> sampshift) - 1);
+ EWRITE4(sc, EAP_DAC2_CSR, (blksize >> sampshift) - 1);
+ if (sc->sc_1371)
+ EWRITE4(sc, E1371_SRC, 0);
+
+ icsc = EREAD4(sc, EAP_ICSC);
EWRITE4(sc, EAP_ICSC, icsc | EAP_DAC2_EN);
DPRINTFN(1, ("eap_trigger_output: set ICSC = 0x%08x\n", icsc));
@@ -1198,9 +1205,6 @@
sc->sc_rintr = intr;
sc->sc_rarg = arg;
- icsc = EREAD4(sc, EAP_ICSC);
- EWRITE4(sc, EAP_ICSC, icsc & ~EAP_ADC_EN);
-
sic = EREAD4(sc, EAP_SIC);
sic &= ~(EAP_R1_S_EB | EAP_R1_S_MB);
sampshift = 0;
@@ -1212,7 +1216,8 @@
sic |= EAP_R1_S_MB;
sampshift++;
}
- EWRITE4(sc, EAP_SIC, sic);
+ EWRITE4(sc, EAP_SIC, sic & ~EAP_R1_INTR_EN);
+ EWRITE4(sc, EAP_SIC, sic | EAP_R1_INTR_EN);
for (p = sc->sc_dmas; p && KERNADDR(p) != start; p = p->next)
;
@@ -1229,8 +1234,12 @@
EWRITE4(sc, EAP_ADC_SIZE,
EAP_SET_SIZE(0, (((char *)end - (char *)start) >> 2) - 1));
- EWRITE2(sc, EAP_ADC_CSR, (blksize >> sampshift) - 1);
+ EWRITE4(sc, EAP_ADC_CSR, (blksize >> sampshift) - 1);
+ if (sc->sc_1371)
+ EWRITE4(sc, E1371_SRC, 0);
+
+ icsc = EREAD4(sc, EAP_ICSC);
EWRITE4(sc, EAP_ICSC, icsc | EAP_ADC_EN);
DPRINTFN(1, ("eap_trigger_input: set ICSC = 0x%08x\n", icsc));
Home |
Main Index |
Thread Index |
Old Index