public inbox for linux-msdos@vger.kernel.org
 help / color / mirror / Atom feed
From: x.zupftom@web.de
To: linux-msdos@vger.kernel.org
Subject: MIDI input patch
Date: Sun, 12 Jul 2009 02:15:14 +0200	[thread overview]
Message-ID: <708619205@web.de> (raw)

Hi,

a year ago (crazy, it's actually to the day a year ago) I sent a patch to the list that Stas Sergeev sent me which fixed a MIDI input problem.  Today I've been installing Dosemu on another machine and found the patch hasn't been applied to the repository.  After applying it manually, everything works fine.  Any reason why it didn't make it into the SVN repository?  Would be great if someone could do it!

Thomas W.



Here is the patch:


Index: src/dosext/sound/sound.c
===================================================================
--- src/dosext/sound/sound.c	(revision 1864)
+++ src/dosext/sound/sound.c	(working copy)
@@ -660,6 +660,8 @@
     S_printf("MPU401: Read data port = 0x%02x, %i bytes still in queue\n",
       r,Q_HOLDS(mpu401_info.data));
     sb_deactivate_irq(SB_IRQ_MIDI);
+    if (Q_HOLDS(mpu401_info.data))
+      sb_activate_irq(SB_IRQ_MIDI);
     break;
   case 1:
      /* Read status port */
Index: src/base/init/config.c
===================================================================
--- src/base/init/config.c	(revision 1864)
+++ src/base/init/config.c	(working copy)
@@ -302,9 +302,9 @@
 	}
     }
 
-    (*print)("\nSOUND:\nsb_base 0x%x\nsb_dma %d\nsb_hdma %d\nsb_irq %d\n"
+    (*print)("\nSOUND:\nengine %d\nsb_base 0x%x\nsb_dma %d\nsb_hdma %d\nsb_irq %d\n"
 	"mpu401_base 0x%x\nsb_dsp \"%s\"\nsb_mixer \"%s\"\nsound_driver \"%s\"\n",
-        config.sb_base, config.sb_dma, config.sb_hdma, config.sb_irq,
+        config.sound, config.sb_base, config.sb_dma, config.sb_hdma, config.sb_irq,
 	config.mpu401_base, config.sb_dsp, config.sb_mixer, config.sound_driver);
     (*print)("\nSOUND_OSS:\noss_min_frags 0x%x\noss_max_frags 0x%x\n"
 	     "oss_stalled_frags 0x%x\noss_do_post %d\noss_min_extra_frags 0x%x\n"
Index: src/base/dev/sb16/sb16.h
===================================================================
--- src/base/dev/sb16/sb16.h	(revision 1864)
+++ src/base/dev/sb16/sb16.h	(working copy)
@@ -83,6 +83,7 @@
 #define DSP_OUT_FIFO_TRIGGER 32
 #define DSP_IN_FIFO_TRIGGER 32
 #define MIDI_FIFO_SIZE 32
+#define MPU401_IN_FIFO_TRIGGER 1
   struct rng_s midi_fifo_in;
   struct rng_s midi_fifo_out;
   void *dspio;
Index: src/base/dev/sb16/sb16.c
===================================================================
--- src/base/dev/sb16/sb16.c	(revision 1864)
+++ src/base/dev/sb16/sb16.c	(working copy)
@@ -323,6 +323,14 @@
     return (sb.mixer_regs[0x82] & type);
 }
 
+static void sb_request_irq(int type)
+{
+    if (type & SB_IRQ_DSP)
+	pic_request(pic_irq_list[sb_get_dsp_irq_num()]);
+    if (type & SB_IRQ_MPU401)
+	pic_request(pic_irq_list[CONFIG_MPU401_IRQ]);
+}
+
 static void sb_activate_irq(int type)
 {
     S_printf("SB: Activating irq type %d\n", type);
@@ -330,10 +338,7 @@
 	S_printf("SB: Warning: Interrupt already active!\n");
 	return;
     }
-    if (type & SB_IRQ_DSP)
-	pic_request(pic_irq_list[sb_get_dsp_irq_num()]);
-    if (type & SB_IRQ_MPU401)
-	pic_request(pic_irq_list[CONFIG_MPU401_IRQ]);
+    sb_request_irq(type);
     sb.mixer_regs[0x82] |= type;
 }
 
@@ -351,6 +356,14 @@
     }
 }
 
+static void sb_run_irq(int type)
+{
+    if (!sb_irq_active(type))
+	return;
+    S_printf("SB: Run irq type %d\n", type);
+    sb_request_irq(type);
+}
+
 void sb_handle_dma(void)
 {
     sb.dma_count--;
@@ -528,7 +541,7 @@
 		/* for High-Speed mode reset means only exit High-Speed */
 		S_printf("SB: Reset called, exiting High-Speed DMA mode\n");
 		sb.dma_cmd = 0;
-	    } else if (sb_midi_input() && sb_midi_uart()) {
+	    } else if (sb_midi_uart()) {
 		S_printf("SB: Reset called, exiting UART midi mode\n");
 		sb.midi_cmd = 0;
 	    } else {
@@ -1134,7 +1147,7 @@
 
 	/* == DSP == */
     case 0x0C:			/* dsp write register */
-	if (sb_midi_input() && sb_midi_uart()) {
+	if (sb_midi_uart()) {
 	    sb_write_midi(value);
 	    break;
 	}
@@ -1200,8 +1213,11 @@
 	rng_get(&sb.dsp_queue, &value);
 	S_printf("SB: Read 0x%x from SB DSP\n", value);
 	result = value;
-	if (sb_midi_input() && sb_midi_int())
-	    sb_deactivate_irq(SB_IRQ_MIDI);
+	if (sb_midi_int()) {
+	    if (!rng_count(&sb.dsp_queue))
+		sb_deactivate_irq(SB_IRQ_MIDI);
+	    sb_run_irq(SB_IRQ_MIDI);
+	}
 	break;
 
     case 0x0C:			/* DSP Write Buffer Status */
@@ -1284,6 +1300,7 @@
 	     r, rng_count(&sb.midi_fifo_in));
 	if (!rng_count(&sb.midi_fifo_in))
 	    sb_deactivate_irq(SB_IRQ_MPU401);
+	sb_run_irq(SB_IRQ_MPU401);
 	break;
     case 1:
 	/* Read status port */
@@ -1357,8 +1374,10 @@
 	    process_sb_midi_input();
 	if (sb_midi_int())
 	    sb_activate_irq(SB_IRQ_MIDI);
-    } else if (sb.mpu401_uart)
-	sb_activate_irq(SB_IRQ_MPU401);
+    } else if (sb.mpu401_uart) {
+	if (rng_count(&sb.midi_fifo_in) == MPU401_IN_FIFO_TRIGGER)
+	    sb_activate_irq(SB_IRQ_MPU401);
+    }
 }
 
 void run_new_sb(void)
@@ -1382,7 +1401,7 @@
     io_device.handler_name = "Midi Emulation";
     io_device.start_addr = config.mpu401_base;
     io_device.end_addr = config.mpu401_base + 0x001;
-    io_device.irq = EMU_NO_IRQ;
+    io_device.irq = CONFIG_MPU401_IRQ;
     io_device.fd = -1;
     if (port_register_handler(io_device, 0) != 0)
 	error("MPU-401: Cannot registering port handler\n");







______________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de

--
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2009-07-12  0:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-12  0:15 x.zupftom [this message]
2009-07-12  1:20 ` MIDI input patch Samuel Bronson
  -- strict thread matches above, loose matches on Subject: below --
2009-07-12  0:41 x.zupftom
2009-07-12 12:49 x.zupftom
2009-07-12 14:19 ` Samuel Bronson
2009-07-12 14:30   ` Dave Phillips
2009-07-12 17:03 x.zupftom
2009-07-12 17:49 x.zupftom
2009-07-12 21:56 ` Bart Oldeman
2009-07-13  6:28 x.zupftom
2009-07-17  9:56 x.zupftom
2009-07-17 11:10 x.zupftom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=708619205@web.de \
    --to=x.zupftom@web.de \
    --cc=linux-msdos@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox