From: Jaroslav Kysela <perex@perex.cz>
To: Zhang wei <zhangwei@vimicro.com>
Cc: ALSA development <alsa-devel@alsa-project.org>
Subject: Re: Could you help me about the ALSA?
Date: Fri, 14 Dec 2012 09:36:20 +0100 [thread overview]
Message-ID: <50CAE504.60002@perex.cz> (raw)
In-Reply-To: <6B947C8AC4195040A8C6876A496C644A07BAB641@BJ-MAIL-04.vimicro.com>
Date 14.12.2012 09:07, Zhang wei wrote:
> Good afternoon .
>
> Excuse me if I disturb you, I found your contact information from the
> alsa-devel
> http://mailman.alsa-project.org/pipermail/alsa-devel/2010-August/030605.html
> .
>
> Recently I am studying the alsa-driver and the code blocked me which
> from the function snd_pcm_update_hw_ptr0inthe pcm_lib.c.
>
> =====================start==============================è
>
> if (in_interrupt) {
>
> /* we know that one period was processed */
>
> /* delta = "expected next hw_ptr" for in_interrupt !=
> 0 */
>
> delta = runtime->hw_ptr_interrupt + runtime->period_size;
>
> if (delta > new_hw_ptr) {
>
> /* check for double acknowledged interrupts */
>
> hdelta = jiffies - runtime->hw_ptr_jiffies;
>
> if (hdelta > runtime->hw_ptr_buffer_jiffies/2) {
>
> hw_base += runtime->buffer_size;
>
> if (hw_base >= runtime->boundary)
>
> hw_base = 0;
>
> new_hw_ptr = hw_base + pos;
>
> goto __delta;
>
> }
>
> }
>
> }
>
> ç================end=================================
>
> I’ve already read your mail but I still do not understand your intend. I
> know the target of the pices of code is prevent the variable hw_ptr and
> hw_base delayed update from some kind of case .so my question is
>
> (1) how could happen on delta>new_hw_ptr? And why?
>
> (2) Why we can conclue the hw_ptr crossed the boundary of
> buffer_size when hdelta>runitme->hw_ptr_jiffies/2? What principle we
> based on?
The interrupts can be lost or delayed in some cases (small period sizes
etc.). So you need to check for these situations. The driver returns
only position in the ring buffer without count of "cross" points, so we
need to trace these situations using another clock source (like system
clock).
Jaroslav
--
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next parent reply other threads:[~2012-12-14 8:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <6B947C8AC4195040A8C6876A496C644A07BAB641@BJ-MAIL-04.vimicro.com>
2012-12-14 8:36 ` Jaroslav Kysela [this message]
2012-12-14 8:55 ` 答复: Could you help me about the ALSA? Zhang wei
2012-12-14 9:46 ` Jaroslav Kysela
2012-12-14 10:46 ` Zhang wei
2012-12-14 11:01 ` Jaroslav Kysela
2012-12-16 14:13 ` l9jj
2012-12-17 2:09 ` Zhang wei
2012-12-17 9:43 Zhang wei
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=50CAE504.60002@perex.cz \
--to=perex@perex.cz \
--cc=alsa-devel@alsa-project.org \
--cc=zhangwei@vimicro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).