Subject: Re: AZT1020 & isapnp MPU
To: None <port-i386@netbsd.org>
From: doomwarrior <doomwarriorx@gmail.com>
List: port-i386
Date: 04/10/2006 21:54:33
Hi
finally i got it to work. mpu can be used to send and receive midi over
the gameport.
Everything works now. It would be great if someone could look at the
changes and if it's ok commit it.
Some info about my changes. I think the marketing name is AZF3318, but
not quit sure. Never the less
i added a midi name for the mpu_isapnp, because without at least
midiplay crashs because of a null pointer.
Because the AZT has a own MPU isapnp dev, i added some code for sb.c and
sb_isapnp.c to deactivate
attachment of the sb_mpu, because this throws ugly comments about not
finding the mpu.
And i added the mpu in the GENERIC commented out. (to be on the safe side)
Best Regards
Stephan
So here is the patch:
Index: sys/arch/i386/conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/conf/GENERIC,v
retrieving revision 1.740
diff -u -r1.740 GENERIC
--- sys/arch/i386/conf/GENERIC 7 Apr 2006 18:55:22 -0000 1.740
+++ sys/arch/i386/conf/GENERIC 10 Apr 2006 19:33:15 -0000
@@ -1180,6 +1180,7 @@
# MPU 401 UARTs
#mpu* at isa? port 0x330 irq 9 # MPU401 or compatible card
+#mpu* at isapnp?
mpu* at cmpci?
mpu* at eso?
mpu* at fms?
Index: sys/dev/isa/sb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/isa/sb.c,v
retrieving revision 1.81
diff -u -r1.81 sb.c
--- sys/dev/isa/sb.c 11 Dec 2005 12:22:03 -0000 1.81
+++ sys/dev/isa/sb.c 10 Apr 2006 19:33:16 -0000
@@ -234,14 +234,18 @@
audio_attach_mi(&sb_hw_if, sc, &sc->sc_dev);
#if NMPU > 0
- if (sc->sc_hasmpu) {
+ switch(sc->sc_hasmpu) {
+ case -1: /* no mpu */
+ break;
+ case 0: /* try to attach midi directly */
+ midi_attach_mi(&sb_midi_hw_if, sc, &sc->sc_dev);
+ break;
+ case 1: /* search for mpu */
arg.type = AUDIODEV_TYPE_MPU;
arg.hwif = 0;
arg.hdl = 0;
sc->sc_mpudev = config_found(&sc->sc_dev, &arg, audioprint);
- } else {
- midi_attach_mi(&sb_midi_hw_if, sc, &sc->sc_dev);
- }
+ }
#endif
if (sc->sc_model >= SB_20) {
Index: sys/dev/isapnp/isapnpdevs
===================================================================
RCS file: /cvsroot/src/sys/dev/isapnp/isapnpdevs,v
retrieving revision 1.58
diff -u -r1.58 isapnpdevs
--- sys/dev/isapnp/isapnpdevs 19 Feb 2006 21:30:46 -0000 1.58
+++ sys/dev/isapnp/isapnpdevs 10 Apr 2006 19:33:16 -0000
@@ -178,6 +178,7 @@
*/
devlogic mpu AZT0002 0 Aztech AZT2320 MPU401 MIDI
devlogic mpu AZT2001 0 Aztech MPU401 MIDI
+devlogic mpu AZT2004 0 Aztech AZT1020 MPU401 MIDI
devlogic mpu CSC0003 0 CS4235 MPU401 MIDI
/*
Index: sys/dev/isapnp/mpu_isapnp.c
===================================================================
RCS file: /cvsroot/src/sys/dev/isapnp/mpu_isapnp.c,v
retrieving revision 1.12
diff -u -r1.12 mpu_isapnp.c
--- sys/dev/isapnp/mpu_isapnp.c 29 Mar 2006 06:51:47 -0000 1.12
+++ sys/dev/isapnp/mpu_isapnp.c 10 Apr 2006 19:33:16 -0000
@@ -83,6 +83,8 @@
printf("%s: %s %s\n", sc->sc_dev.dv_xname, ipa->ipa_devident,
ipa->ipa_devclass);
+ sc->sc_mpu.model = "Roland MPU-401 MIDI UART";
+
midi_attach_mi(&mpu_midi_hw_if, &sc->sc_mpu, &sc->sc_dev);
sc->sc_ih = isa_intr_establish(ipa->ipa_ic, ipa->ipa_irq[0].num,
Index: sys/dev/isapnp/sb_isapnp.c
===================================================================
RCS file: /cvsroot/src/sys/dev/isapnp/sb_isapnp.c,v
retrieving revision 1.45
diff -u -r1.45 sb_isapnp.c
--- sys/dev/isapnp/sb_isapnp.c 29 Mar 2006 06:51:47 -0000 1.45
+++ sys/dev/isapnp/sb_isapnp.c 10 Apr 2006 19:33:16 -0000
@@ -135,7 +135,13 @@
sc->sc_drq16 = -1;
#if NMPU > 0
- if (ipa->ipa_nio > 1) {
+ /*
+ * Aztech 1020 don't store information about it's mpu in io[1]
+ * It has a seperate pnpdev for the mpu
+ */
+ if (!strncmp(ipa->ipa_devlogic, "AZT1016", 7)) {
+ sc->sc_hasmpu = -1;
+ } else if (ipa->ipa_nio > 1) {
sc->sc_hasmpu = 1;
sc->sc_mpu_iot = ipa->ipa_iot;
sc->sc_mpu_ioh = ipa->ipa_io[1].h;