All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Blechmann <tim@klingt.org>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: pointer callback question
Date: Thu, 26 Feb 2009 15:44:13 +0100	[thread overview]
Message-ID: <49A6AABD.7040300@klingt.org> (raw)
In-Reply-To: <s5hy6wbillh.wl%tiwai@suse.de>


[-- Attachment #1.1: Type: text/plain, Size: 2852 bytes --]

hello takashi,

>>>> the brief log is (4 periods of 64 frames):
>>>> stream_pointer at 64
>>>> stream_pointer at 128
>>>> stream_pointer at 192
>>>> stream_pointer at 256
>>> This is invalid.  The pointer callback must return 0 in this case.
>>> The value the pointer callback returns is between 0 and buffer_size-1.
>> sry, typo, 5 periods of 64 frames
> 
> Then it must be OK.  If the stream is stopped, it's likely by the
> buffer underrun detection or so...
> 
> BTW, you should be sure that the buffer size is aligned to the period 
> size if such a design is assumed.  Without the extra constraint, it
> could be unaligned as default.

now i am trying to debug it some more. the lx6464es card provides
commands to send audio buffers to the card, and issues an interrupt,
when the buffer has been processed. i am using one dma buffer of
period_bytes*periods (128 frames, 3 bytes per sample, 64 channels, 5
periods)

for the startup, i am sending a number of buffers to the card (periods):
[ 2825.545296] LX6464ES: starting: buffer index 0 on ef620000 (24576 bytes)
[ 2825.545385] LX6464ES: starting: buffer index 1 on ef626000 (24576 bytes)
[ 2825.545474] LX6464ES: starting: buffer index 2 on ef62c000 (24576 bytes)
[ 2825.545568] LX6464ES: starting: buffer index 3 on ef632000 (24576 bytes)
[ 2825.545662] LX6464ES: starting: buffer index 4 on ef638000 (24576 bytes)

for each buffer, the card issues an `end of buffer' interrupt, in which
i send a new buffer to the card and call snd_pcm_period_elapsed with an
updated hw pointer:
[ 2825.548340] LX6464ES: interrupt: gave buffer index 0 on ef620000
(24576 bytes)
[ 2825.548385] LX6464ES: stream_pointer at 128
[ 2825.550986] LX6464ES: interrupt: gave buffer index 1 on ef626000
(24576 bytes)
[ 2825.551029] LX6464ES: stream_pointer at 256
[ 2825.553653] LX6464ES: interrupt: gave buffer index 2 on ef62c000
(24576 bytes)
[ 2825.553695] LX6464ES: stream_pointer at 384
[ 2825.556353] LX6464ES: interrupt: gave buffer index 3 on ef632000
(24576 bytes)
[ 2825.556397] LX6464ES: stream_pointer at 512
[ 2825.559014] LX6464ES: interrupt: gave buffer index 4 on ef638000
(24576 bytes)
[ 2825.559061] LX6464ES: stream_pointer at 0

directly after returning 0 from the pointer callback, alsa requests a stop:
[ 2825.559067] ->lx_pcm_trigger
the timing seems to be fine (2.7 ms for 128 frames).

any idea, why alsa wants to stop the transfer? am i missing something,
like to i need to inform alsa, that the cyclic buffer wraps around?

the code is available at [1]

thanks, tim

[1]
http://tim.klingt.org/git?p=digigram.git;a=shortlog;h=refs/heads/digigram

-- 
tim@klingt.org
http://tim.klingt.org

Relying on the government to protect your privacy is like asking a
peeping tom to install your window blinds.
  John Perry Barlow


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2009-02-26 14:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-12 17:50 pointer callback question Tim Blechmann
2009-02-12 17:54 ` Takashi Iwai
2009-02-12 17:55   ` Tim Blechmann
2009-02-12 17:58     ` Takashi Iwai
2009-02-12 18:04       ` Tim Blechmann
2009-02-13  6:26         ` Takashi Iwai
2009-02-26 14:44       ` Tim Blechmann [this message]
2009-02-28 12:48         ` Tim Blechmann

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=49A6AABD.7040300@klingt.org \
    --to=tim@klingt.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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.