All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Schmidt <mista.tapas@gmx.net>
To: Lee Revell <rlrevell@joe-job.com>
Cc: tapas <tapas@affenbande.org>, Ingo Molnar <mingo@elte.hu>,
	Paul Davis <paul@linuxaudiosystems.com>,
	Jaroslav Kysela <perex@suse.cz>,
	jackit-devel@lists.sourceforge.net,
	alsa-devel <alsa-devel@lists.sourceforge.net>
Subject: Re: Re: [Jackit-devel] irq handler top half timestamps
Date: Mon, 20 Dec 2004 16:08:55 +0100	[thread overview]
Message-ID: <20041220160855.699a1014@mango.fruits.de> (raw)
In-Reply-To: <1103499499.32415.35.camel@krustophenia.net>

On Sun, 19 Dec 2004 18:38:19 -0500
Lee Revell <rlrevell@joe-job.com> wrote:

> OK the interrupt handler calls snd_pcm_period_elapsed, which calls
> snd_pcm_update_hw_ptr_interrupt, which calls snd_pcm_update_hw_ptr_pos.
> snd_pcm_update_hw_ptr_pos does this (from alsa-kernel/core/pcm-lib.c):
> 
> 151         pos = substream->ops->pointer(substream);
> 152         if (pos == SNDRV_PCM_POS_XRUN)
> 153                 return pos; /* XRUN */
> 154         if (runtime->tstamp_mode & SNDRV_PCM_TSTAMP_MMAP)
> 155                 snd_timestamp_now((snd_timestamp_t*)&runtime->status->tstamp, runtime->tstamp_timespec);

I see. And all these calls have constant execution time?

> 
> Here is snd_timestamp_now (from alsa-kernel/include/core.h):
> 
> 464 static inline void snd_timestamp_now(struct timespec *tstamp, int timespec)
> 465 {
> 466         struct timeval val;
> 467         /* FIXME: use a linear time source */
> 468         do_gettimeofday(&val);
> 469         tstamp->tv_sec = val.tv_sec;
> 470         tstamp->tv_nsec = val.tv_usec;
> 471         if (timespec)
> 472                 tstamp->tv_nsec *= 1000L;
> 473 }
> 
> Note the FIXME.
> 
> So this timestamp should be OK for our purposes.  Note the pointer
> callback is called before the timestamp is taken, so this will introduce
> variable delay as the pointer callback is different in every driver and
> requires accessing the PCI bus to read the pointer from the hardware.
> 
> The API function to get the timestamp is snd_pcm_status_get_tstamp,
> defined in alsa-lib/src/pcm/pcm.c.

Hmm,

how is do_gettimeofday implemented? Is it based on the TSC? It seems it
is for X86 which has a TSC. into arch/i386/kernel/time.c also points out
that it is subject to adjustments due to NTP.

I suppose it would be better to get the TSC timestamp directly as Ingo's
patch produces for RP kernels. OTOH gettimeofday is a more general API
and i suppose it should provide the best timestamping mechanism a
platform can offer, right?

I might be talking out of my behind here though. As i don't know pretty
much anything about ALSA nor kernel internals..

Flo

-- 
Palimm Palimm!
http://affenbande.org/~tapas/


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

  reply	other threads:[~2004-12-20 15:08 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20041209180706.GA11397@elte.hu>
     [not found] ` <200412091819.iB9IJiLX013123@localhost.localdomain>
     [not found]   ` <20041209183342.GB13132@elte.hu>
     [not found]     ` <20041209220741.7562b6a0@mango.fruits.de>
2004-12-09 21:10       ` irq handler top half timestamps Lee Revell
2004-12-10  1:35         ` Re: [Jackit-devel] " Florian Schmidt
2004-12-10  7:52           ` [Alsa-devel] " Jaroslav Kysela
2004-12-10 17:23             ` Florian Schmidt
2004-12-10 17:17               ` Re: [Jackit-devel] " Paul Davis
2004-12-10 17:54                 ` [Alsa-devel] " Florian Schmidt
2004-12-10 19:00                   ` Re: [Jackit-devel] " Lee Revell
2004-12-10 20:51                     ` Paul Davis
2004-12-10 21:01                       ` Lee Revell
2004-12-11  0:56                         ` Florian Schmidt
2004-12-11  2:22                           ` Florian Schmidt
2004-12-15 23:32                             ` [Alsa-devel] " Florian Schmidt
2004-12-16  9:18                               ` Ingo Molnar
2004-12-16 16:33                                 ` tapas
2004-12-16 18:35                                   ` Re: [Jackit-devel] " Lee Revell
2004-12-19 23:45                                     ` Florian Schmidt
2004-12-19 23:38                                       ` [Alsa-devel] " Lee Revell
2004-12-20 15:08                                         ` Florian Schmidt [this message]
2004-12-21  1:30                                           ` Florian Schmidt
2004-12-21  1:49                                             ` Re: [Jackit-devel] " Lee Revell
2004-12-11  3:17                           ` [Alsa-devel] " Lee Revell
2004-12-20 10:57                             ` Re: [Jackit-devel] " Martijn Sipkema
2004-12-20 11:10                               ` Clemens Ladisch
2004-12-20 11:50                                 ` Martijn Sipkema
2004-12-20 11:52                                 ` [Alsa-devel] " James Courtier-Dutton
2004-12-10  7:41         ` Jaroslav Kysela

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=20041220160855.699a1014@mango.fruits.de \
    --to=mista.tapas@gmx.net \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=jackit-devel@lists.sourceforge.net \
    --cc=mingo@elte.hu \
    --cc=paul@linuxaudiosystems.com \
    --cc=perex@suse.cz \
    --cc=rlrevell@joe-job.com \
    --cc=tapas@affenbande.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.