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
> [EMAIL PROTECTED] 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

_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to