From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: hdsp and midi problems Date: Mon, 23 Jun 2003 18:32:43 +0200 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: <3EF4BCA2.578FD128@telia.com> Mime-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: multipart/mixed; boundary="Multipart_Mon_Jun_23_18:32:43_2003-1" Return-path: In-Reply-To: Errors-To: alsa-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: To: Mark Knecht Cc: Marcus Andersson <054185595@telia.com>, alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org --Multipart_Mon_Jun_23_18:32:43_2003-1 Content-Type: text/plain; charset=US-ASCII 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 --Multipart_Mon_Jun_23_18:32:43_2003-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="hdsp-midi-test.dif" Content-Transfer-Encoding: 7bit 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; } --Multipart_Mon_Jun_23_18:32:43_2003-1-- ------------------------------------------------------- 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