最近在看audio驱动,对snd_pcm_update_hw_ptr0函数表示疑惑:
if (in_interrupt) {
/* we know that one period was processed */
/* delta = "expected next hw_ptr" for in_interrupt != 0 */
delta = runtime->hw_ptr_interrupt + runtime->period_size;
if (delta > new_hw_ptr) {
/* check for double acknowledged interrupts */
hdelta = curr_jiffies - runtime->hw_ptr_jiffies;
if (hdelta > runtime->hw_ptr_buffer_jiffies/2 + 1) {
hw_base += runtime->buffer_size;
if (hw_base >= runtime->boundary) {
hw_base = 0;
crossed_boundary++;
}
new_hw_ptr = hw_base + pos;
goto __delta;
}
}
}
有大佬知道if (hdelta > runtime->hw_ptr_buffer_jiffies/2 + 1)条件表示的是情景吗?runtime->hw_ptr_buffer_jiffies/2 + 1这个值是怎么得出来的?可以详细说说吗?