From: Takashi Iwai Subject: Re: es1938 - patch trying to improve capture hw pointer reads Date: Fri, 25 Jan 2008 17:36:11 +0100 Message-ID: References: <20080123003512.GA6828@lemon.iwr.uni-heidelberg.de> <20080124152102.GE8290@lemon.iwr.uni-heidelberg.de> <20080125002514.GA9015@lemon.iwr.uni-heidelberg.de> <20080125160727.GF9123@lemon.iwr.uni-heidelberg.de> <20080125162928.GH9123@lemon.iwr.uni-heidelberg.de> 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 mx1.suse.de (mail.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id 932D424854 for ; Fri, 25 Jan 2008 17:36:11 +0100 (CET) In-Reply-To: <20080125162928.GH9123@lemon.iwr.uni-heidelberg.de> 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: Hermann Lauer Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Fri, 25 Jan 2008 17:29:28 +0100, Hermann Lauer wrote: > > On Fri, Jan 25, 2008 at 05:19:52PM +0100, Takashi Iwai wrote: > > > > If I interpreted my tests output correctly, the last byte of a period > > > is written by the DMA engine after the interrupt occurs. So the > > > hw pointer probably has to be decremented by one and is then > > > pointing to the last frame (Or even that before: Has the hw pointer to point > > > at the frame which is written at the moment or the one which is > > > guaranteed to be written completely by the hardware ?) > > > > This sounds a bit odd. Isn't it rather the setup of the hardware > > parameter wrong? I mean, the count calculation in *_prepare() can be > > the size - 1? > > At least according to the datasheet the size calculation is correct. > Could you please tell me where the hw pointer exactly should point to ? The hwptr is the position of the current DMA. The data below that point must have been already processed. That's why hwptr returned in snd_pcm_period_elapsed() must be on the period boundary or above. OTOH, it doesn't matter much whether the data above hwptr has been processed or not, e.g. a sloppy pointer callback. Takashi