summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2003-01-29 20:32:24 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2003-01-29 20:32:24 +0000
commit9b540209eaccb994a3897232f29e91ff7bf0f375 (patch)
tree8ff304db38d91fcf15bb5875b02b736274fc04ac /sys
parent381975c6234532150c545ad42892a923d1b48dc8 (diff)
make it work on both yamaha and ensoniq mpus; from hunter@dg.net.ua
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/isa/mpu_isa.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/sys/dev/isa/mpu_isa.c b/sys/dev/isa/mpu_isa.c
index 2982e0be40d..d273c8016ec 100644
--- a/sys/dev/isa/mpu_isa.c
+++ b/sys/dev/isa/mpu_isa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpu_isa.c,v 1.1 2002/11/28 23:24:53 mickey Exp $ */
+/* $OpenBSD: mpu_isa.c,v 1.2 2003/01/29 20:32:23 mickey Exp $ */
/*
* Copyright (c) 2002 Sergey Smitienko. All rights reserved.
@@ -94,18 +94,23 @@ mpu_test (iot, iobase)
goto done;
for (i = 0; i < MPU_MAXWAIT; i++) {
- if (!(MPU_GETSTATUS(iot, ioh) & MPU_OUTPUT_BUSY))
- goto done;
- delay (10);
- }
- bus_space_write_1(iot, ioh, MPU_COMMAND, MPU_RESET);
-
- for (i = 0; i < 2 * MPU_MAXWAIT; i++)
- if (!(MPU_GETSTATUS(iot, ioh) & MPU_INPUT_EMPTY) &&
- bus_space_read_1(iot, ioh, MPU_DATA) == MPU_ACK) {
+ if (!MPU_GETSTATUS(iot, ioh) & MPU_OUTPUT_BUSY)) {
rc = 1;
break;
}
+ delay (10);
+ }
+
+ if (rc == 1) {
+ bus_space_write_1(iot, ioh, MPU_COMMAND, MPU_RESET);
+ rc = 0;
+ for (i = 0; i < 2 * MPU_MAXWAIT; i++)
+ if (!(MPU_GETSTATUS(iot, ioh) & MPU_INPUT_EMPTY) &&
+ bus_space_read_1(iot, ioh, MPU_DATA) == MPU_ACK) {
+ rc = 1;
+ break;
+ }
+ }
done:
bus_space_unmap(iot, ioh, MPU401_NPORT);