From mboxrd@z Thu Jan 1 00:00:00 1970 From: x.zupftom@web.de Subject: MIDI input patch Date: Sun, 12 Jul 2009 02:15:14 +0200 Message-ID: <708619205@web.de> Mime-Version: 1.0 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Sender: linux-msdos-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="iso-8859-1" To: linux-msdos@vger.kernel.org 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 pa= tch 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- src/dosext/sound/sound.c (revision 1864) +++ src/dosext/sound/sound.c (working copy) @@ -660,6 +660,8 @@ S_printf("MPU401: Read data port =3D 0x%02x, %i bytes still in que= ue\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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- src/base/init/config.c (revision 1864) +++ src/base/init/config.c (working copy) @@ -302,9 +302,9 @@ } } =20 - (*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, c= onfig.sb_irq, config.mpu401_base, config.sb_dsp, config.sb_mixer, config.sound_driv= er); (*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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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); } =20 +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] |=3D type; } =20 @@ -351,6 +356,14 @@ } } =20 +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 =3D 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 =3D 0; } else { @@ -1134,7 +1147,7 @@ =20 /* =3D=3D DSP =3D=3D */ 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 =3D 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; =20 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) =3D=3D MPU401_IN_FIFO_TRIGGER) + sb_activate_irq(SB_IRQ_MPU401); + } } =20 void run_new_sb(void) @@ -1382,7 +1401,7 @@ io_device.handler_name =3D "Midi Emulation"; io_device.start_addr =3D config.mpu401_base; io_device.end_addr =3D config.mpu401_base + 0x001; - io_device.irq =3D EMU_NO_IRQ; + io_device.irq =3D CONFIG_MPU401_IRQ; io_device.fd =3D -1; if (port_register_handler(io_device, 0) !=3D 0) error("MPU-401: Cannot registering port handler\n"); ______________________________________________________ GRATIS f=FCr 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