[alsa-devel] Could you help me about the ALSA?

Jaroslav Kysela perex at perex.cz
Fri Dec 14 12:01:59 CET 2012


Date 14.12.2012 11:46, Zhang wei wrote:
> Date 14.12.2012 09:55, Zhang wei wrote:
> 
>> Thank you very much.
> 
>> 
> 
>> But if the OS lost or delayed some interrupt(s) the variable
> 
>> hw_ptr_interrupt will smaller than it should be,because delayed update
> 
>> it from last time enter the interrupt.so the
> 
>> 
> 
>> delta = runtime->hw_ptr_interrupt + runtime->period_size;
> 
>> 
> 
>> should be smaller than new_hw_ptr.
> 
>  
> 
> The current 'pos' value from the driver can be smaller (buffer_size
> 
> wrap) than last one. The new_hw_ptr can be lower than delta in this case.
> 
>  
> 
>                        Jaroslav
> 
>  
> 
> Yes,when buffer_size wraped the 'pos' is smallar than last one.If we
> want to confirm the hw_base need to adjust there must be consider
> another confidition:
> 
> hdelta = jiffies - runtime->hw_ptr_jiffies;
> 
>               if (hdelta > runtime->hw_ptr_buffer_jiffies/2)
> 
> how to connect this code with checking unnormal interrupt(lost or delayed)?

This condition is for the double interrupt acknowledge problems (see
comment). It makes sure, that the DMA buffer position was wrapped using
another external timing source. Indeed, it's mostly a lowlevel driver
fault to call this pointer update routine with the in_interrupt flag
when the period was not really elapsed.

> Why we can prove need to adjust the ‘hw_base’when ‘hdelta’>
> hw_ptr_buffer_jiffies/2 ? the former represent the jiffier error between
> this moment and last be here(maybe called from non-interrupt elpased()).
> 
> The later means the time spend on fill the buffer.Then compare them and
> we will find if ‘delta’is bigger means the DMA already fininshed a
> period at least without notice the OS?
> 
> The compariation confused me.I can not get the relationship from the
> result and what the information or clue is ignored by me? Please give me
> some tips. Thank you.

Please, study the comments again.

					Jaroslav

-- 
Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.


More information about the Alsa-devel mailing list