Skip to contentSkip to conversation

HDSP midi debugged

DISCUSSION Marcus Andersson 2 participants 3 messages Jun 27, 2003 – Jun 29, 2003

lore
Share & tools
lore
#0 lore raw

Hi,

I have found the reason for the loss of input bytes on the hdsp midi, but I don't know how to correctly fix it.

The function snd_hdsp_midi_input_trigger() is repeatedly called with up==true. This results in the input being flushed. Definitely not good.

Can someone tell me what this function is supposed to do? What does 'up' mean? Why is the input flushed here?

Marcus

-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner. Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php

#1 lore raw
Quoted 10 lines · Marcus Andersson

Hi,

I have found the reason for the loss of input bytes on the hdsp midi, but I don't know how to correctly fix it.

The function snd_hdsp_midi_input_trigger() is repeatedly called with up==true. This results in the input being flushed. Definitely not good.

Can someone tell me what this function is supposed to do? What does 'up' mean? Why is the input flushed here?

The input should be flushed only when the input was not triggered before. The input is triggered constantly, because there is some polled hardware available.

This patch should fix this problem (commited also to CVS):

Index: hdsp.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/rme9652/hdsp.c,v retrieving revision 1.36

hdsp.c +7 -9
diff -u -r1.36 hdsp.c
@@ -1137,21 +1137,19 @@
 	hdsp_t *hdsp;
 	hdsp_midi_t *hmidi;
 	unsigned long flags;
+	u32 ie;
 
 	hmidi = (hdsp_midi_t *) substream->rmidi->private_data;
 	hdsp = hmidi->hdsp;
+	ie = hmidi->id ? HDSP_Midi1InterruptEnable : HDSP_Midi0InterruptEnable;
 	spin_lock_irqsave (&hdsp->lock, flags);
 	if (up) {
-		snd_hdsp_flush_midi_input (hdsp, hmidi->id);
-		if (hmidi->id) 
-			hdsp->control_register |= HDSP_Midi1InterruptEnable;
-		else 
-			hdsp->control_register |= HDSP_Midi0InterruptEnable;
+		if (!(hdsp->control_register & ie)) {
+			snd_hdsp_flush_midi_input (hdsp, hmidi->id);
+			hdsp->control_register |= ie;
+		}
 	} else {
-		if (hmidi->id) 
-			hdsp->control_register &= ~HDSP_Midi1InterruptEnable;
-		else 
-			hdsp->control_register &= ~HDSP_Midi0InterruptEnable;
+		hdsp->control_register &= ~ie;
 	}
 
 	hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner. Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php

#2 lore raw
Quoted 11 lines · Jaroslav Kysela
Quoted 8 lines · Marcus Andersson

Hi,

I have found the reason for the loss of input bytes on the hdsp midi, but I don't know how to correctly fix it.

The function snd_hdsp_midi_input_trigger() is repeatedly called with up==true. This results in the input being flushed. Definitely not good.

Quoted 8 lines
Quoted 2 lines

Can someone tell me what this function is supposed to do? What does 'up' mean? Why is the input flushed here?

The input should be flushed only when the input was not triggered before. The input is triggered constantly, because there is some polled hardware available.

This patch should fix this problem (commited also to CVS):

Thank you. It solves all my midi problems with the hdsp.

Marcus

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01