From: Takashi Iwai Subject: Re: my driver can't reproduce continuously Date: Mon, 27 Jul 2009 11:34:41 +0200 Message-ID: References: <20090723100640.GB25013@sirena.org.uk> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 2F56D24367 for ; Mon, 27 Jul 2009 11:34:42 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Kuninori Morimoto Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Mon, 27 Jul 2009 16:43:05 +0900, Kuninori Morimoto wrote: > > > Dear Takashi > > Thank you for your comment > > > > when 1st buffer was send, > > > driver stop. > > > 2nd trigger function isn't called. > > > > Check the raw value returned from the pointer callback, too. > > This can be the real cause. > > I might have been doing a very big misunderstanding. > > > The pointer callback is supposed to give the currently played position > > offset in a ring buffer, and ranged from 0 to buffer_size-1. > > Does this "ring buffer" mean > I should transmit runtime->dma_area many times > from offset 0x0 ?? Yes and no. A ring buffer may contain multiple "periods" (or "fragments") in it. In your case, a ring buffer has 4 periods. Until these 4 periods are sent out, the offset goes incrementally. Once it reaches to buffer_size, it returns to zero again. > => when I call 4th elapsed, > should I send runtime->dma_area + 0x0 again ? Yes. > If so, > my driver get STOP on trigger funtion many times > even if I didn't stop it. > > START > STOP > underrun!!! > START > STOP > underrun!!! > ... > > Does this correct operation ? Yes, because the PCM core thinks a buffer underrun happens, judging from the pointer callback value your driver returned. That's why I asked many times to check the values returned from the pointer callback. This value and the timing of snd_pcm_period_elapsed() is the only information the PCM core checks. Takashi