All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: tomasz motylewski <T.Motylewski@bfad.de>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: cs4281 - only 2 periods supported?
Date: Mon, 10 Jun 2002 15:54:39 +0200	[thread overview]
Message-ID: <s5hu1ob2q8w.wl@alsa2.suse.de> (raw)
In-Reply-To: <Pine.LNX.4.21.0206081818030.7067-100000@mailserver.intern.bfad.de>

At Sat, 8 Jun 2002 18:46:10 +0200 (CEST),
tomasz motylewski wrote:
> 
> 
> I have seen that alsa-driver-0.9.0rc1 cs4281.c driver supports only 2 periods.
> 
> There exists an unofficial patch for alsa-driver-0.5.12a done by
> Pekka.Pessi@nokia.com. I have seen that some parts of it are included in
> 0.9.0rc1, some are obsolete, but the limit of only 2 periods is not fixed in
> 0.9.0rc1 (playback). 
> 
> Especially snd_cs4281_start_new_dma(cs4281_t *chip, cs4281_dma_t *dma) and
> changes to the interrupt handler are not in 0.9.0rc1 (and I believe also not in
> CVS).
> 
> I am trying to backport it now, but it seems some interfaces have changed.
> 
> For exaple what the "pointer" function should return?
 
the current offset pointer of dma in frames on the buffer.
if the current pointer is at the top of the buffer, then returns zero.
if it's at the X-th frame, then returns X.

> I do not understand the following code in alsa-kernel/core/pcm_lib.c:
> 
>     new_hw_ptr = runtime->hw_ptr_base + pos;
>         
>     hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size;
>         
>     delta = hw_ptr_interrupt - new_hw_ptr;
>     if (delta > 0) {
>         if (delta < runtime->buffer_size / 2) {
>             snd_printd("Unexpected hw_pointer value (stream = %i, delta: -%ld,
> max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream,
> (long) delta, runtime->buffer_size /
> 2);                                                                                   return
> 0;
>         }               
>         runtime->hw_ptr_base += runtime->buffer_size;
>         if (runtime->hw_ptr_base == runtime->boundary)
>             runtime->hw_ptr_base = 0;
>         new_hw_ptr = runtime->hw_ptr_base + pos;
>     }           
>     runtime->status->hw_ptr = new_hw_ptr;
>     runtime->hw_ptr_interrupt = new_hw_ptr - (runtime->hw_ptr_base + pos) %
> runtime->period_size;                                     
> 
> Why is runtime->buffer_size the whole buffer or the period size? What is in
> bytes, what in frames? Is there any function/field giving size of a single
> frame in bytes?

1 frame = channels * sample-width bytes

1 sample = sapmle-width bytes


the bit-size of frame is given in runtime->frame_bits.

runtime->buffer_size and period_size are in frames.
you can guess easily from their type names.

there are convenient functions to convert between frames and bytes
defined in pcm.h, such as bytes_to_frames() and frames_to_bytes().


Takashi

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

      reply	other threads:[~2002-06-10 13:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-22 15:59 Linux driver for cs4281 with TWO cs4299 codecs? tomasz motylewski
2002-05-22 18:11 ` Takashi Iwai
2002-05-22 18:33   ` tomasz motylewski
2002-05-22 21:15   ` tomasz motylewski
2002-05-23  8:40     ` Takashi Iwai
2002-05-23 10:27       ` tomasz motylewski
2002-05-27 16:37         ` tomasz motylewski
2002-05-27 16:49           ` Takashi Iwai
2002-05-28 20:10           ` does CS4281 have enough SRC for 4 input + 4 output channels? tomasz motylewski
2002-05-29 16:53           ` cs4281 with TWO cs4299 codecs - something works tomasz motylewski
2002-06-08 16:46             ` cs4281 - only 2 periods supported? tomasz motylewski
2002-06-10 13:54               ` Takashi Iwai [this message]

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=s5hu1ob2q8w.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=T.Motylewski@bfad.de \
    --cc=alsa-devel@lists.sourceforge.net \
    /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.