All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Mark Knecht <mknecht@controlnet.com>
Cc: Marcus Andersson <054185595@telia.com>, alsa-devel@lists.sourceforge.net
Subject: Re: hdsp and midi problems
Date: Mon, 23 Jun 2003 18:32:43 +0200	[thread overview]
Message-ID: <s5h3ci03gb8.wl@alsa2.suse.de> (raw)
In-Reply-To: <NDBBLGIKBJENLAMOLFHGOEPKCIAB.mknecht@controlnet.com>

[-- Attachment #1: Type: text/plain, Size: 964 bytes --]

At Mon, 23 Jun 2003 06:38:20 -0700,
Mark Knecht wrote:
> 
> >
> >
> > More information,
> >
> > when I run the program with 100% load using my VIA motherboard midi, I
> > loose no bytes as far as I can see.
> >
> > I use alsa 0.9.4
> >
> > Marcus
> 
> Marcus,
>    The HDSP 9652 MIDI interface has (for me under Linux) always dropped lots
> of notes. Mostly I find it interesting that it drops note off information
> and doesn't seem to drop note-on. I cannot be sure how well it handles
> controller information.

do you mean dropping notes in reading MIDI?
well, IIRC, you reported also that the behavior of MIDI out is
strange...  oh sigh.

> 
>    The same machine booted into Windows runs perfectly, so I'm pretty sure
> it's not a hardware issue.

dropping a note is surely a bug of the driver.
unless the FIFO overflows, no dropping should happen.

btw, could you try the attached patch?
(and in-advance-scheduled excuse if it causes a hang-up :)


Takashi

[-- Attachment #2: hdsp-midi-test.dif --]
[-- Type: application/octet-stream, Size: 2422 bytes --]

Index: alsa-kernel/pci/rme9652/hdsp.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/rme9652/hdsp.c,v
retrieving revision 1.34
diff -u -r1.34 hdsp.c
--- alsa-kernel/pci/rme9652/hdsp.c	18 Jun 2003 10:34:11 -0000	1.34
+++ alsa-kernel/pci/rme9652/hdsp.c	23 Jun 2003 14:04:20 -0000
@@ -1103,7 +1134,7 @@
 	int i;
 
 	spin_lock_irqsave (&hmidi->lock, flags);
-	if ((n_pending = snd_hdsp_midi_input_available (hmidi->hdsp, hmidi->id)) > 0) {
+	while ((n_pending = snd_hdsp_midi_input_available (hmidi->hdsp, hmidi->id)) > 0) {
 		if (hmidi->input) {
 			if (n_pending > (int)sizeof (buf)) {
 				n_pending = sizeof (buf);
@@ -1122,12 +1153,6 @@
 		}
 	}
 	hmidi->pending = 0;
-	if (hmidi->id) {
-		hmidi->hdsp->control_register |= HDSP_Midi1InterruptEnable;
-	} else {
-		hmidi->hdsp->control_register |= HDSP_Midi0InterruptEnable;
-	}
-	hdsp_write(hmidi->hdsp, HDSP_controlRegister, hmidi->hdsp->control_register);
 	spin_unlock_irqrestore (&hmidi->lock, flags);
 	return snd_hdsp_midi_output_write (hmidi);
 }
@@ -3155,35 +3157,38 @@
 
 	hdsp_write(hdsp, HDSP_interruptConfirmation, 0);
 
+	spin_lock (&hdsp->lock);
+
 	midi0status = hdsp_read (hdsp, HDSP_midiStatusIn0) & 0xff;
 	midi1status = hdsp_read (hdsp, HDSP_midiStatusIn1) & 0xff;
 	
 	if (audio) {
 		if (hdsp->capture_substream) {
+			spin_unlock (&hdsp->lock);
 			snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream);
+			spin_lock (&hdsp->lock);
 		}
 		
 		if (hdsp->playback_substream) {
+			spin_unlock (&hdsp->lock);
 			snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream);
+			spin_lock (&hdsp->lock);
 		}
 	}
 	
 	if (midi0 && midi0status) {
-		/* we disable interrupts for this input until processing is done */
-		hdsp->control_register &= ~HDSP_Midi0InterruptEnable;
-		hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
 		hdsp->midi[0].pending = 1;
 		schedule = 1;
 	}
 	if (midi1 && midi1status) {
-		/* we disable interrupts for this input until processing is done */
-		hdsp->control_register &= ~HDSP_Midi1InterruptEnable;
-		hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
 		hdsp->midi[1].pending = 1;
 		schedule = 1;
 	}
 	if (schedule)
-	    tasklet_hi_schedule(&hdsp->midi_tasklet);
+		tasklet_hi_schedule(&hdsp->midi_tasklet);
+
+	spin_unlock (&hdsp->lock);
+
 	return IRQ_HANDLED;
 }
 

  parent reply	other threads:[~2003-06-23 16:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-21 20:08 hdsp and midi problems Marcus Andersson
2003-06-21 20:14 ` Marcus Andersson
2003-06-23 13:38   ` Mark Knecht
2003-06-23 15:53     ` Marcus Andersson
2003-06-23 16:33       ` Takashi Iwai
2003-06-23 16:46         ` Marcus Andersson
2003-06-23 17:03           ` Takashi Iwai
2003-06-23 17:14             ` Marcus Andersson
2003-06-23 16:46         ` Jaroslav Kysela
2003-06-23 16:54           ` Takashi Iwai
2003-06-23 16:32     ` Takashi Iwai [this message]
2003-06-23 16:58       ` Mark Knecht
2003-06-23 17:11       ` Marcus Andersson
2003-06-23 18:12         ` Marcus Andersson

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=s5h3ci03gb8.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=054185595@telia.com \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=mknecht@controlnet.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.