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.
Yes,I saw the comment and known the target of the pices of code and known alsa use jiffies as another timing source to detect the wrap situation,but I do not understand how to detect or check that case.In other word,why does alsa use the value runtime->hw_ptr_buffer_jiffies/2 not runtime->hw_ptr_buffer_jiffies/3 or runtime->hw_ptr_buffer_jiffies/4 ...?