
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)?
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.