* Absolute clock conversion. Low level function to convert ffcounter to * bintime. The ffcounter is converted using the current ffclock period estimate * or the "interpolated period" to ensure monotonicity. * NOTE: this conversion may have been deferred, and the clock updated since the * hardware counter has been read. */
| 813 | * hardware counter has been read. |
| 814 | */ |
| 815 | void |
| 816 | ffclock_convert_abs(ffcounter ffcount, struct bintime *bt, uint32_t flags) |
| 817 | { |
| 818 | struct fftimehands *ffth; |
| 819 | struct bintime bt2; |
| 820 | ffcounter ffdelta; |
| 821 | uint8_t gen; |
| 822 | |
| 823 | /* |
| 824 | * No locking but check generation has not changed. Also need to make |
| 825 | * sure ffdelta is positive, i.e. ffcount > tick_ffcount. |
| 826 | */ |
| 827 | do { |
| 828 | ffth = fftimehands; |
| 829 | gen = ffth->gen; |
| 830 | if (ffcount > ffth->tick_ffcount) |
| 831 | ffdelta = ffcount - ffth->tick_ffcount; |
| 832 | else |
| 833 | ffdelta = ffth->tick_ffcount - ffcount; |
| 834 | |
| 835 | if ((flags & FFCLOCK_LERP) == FFCLOCK_LERP) { |
| 836 | *bt = ffth->tick_time_lerp; |
| 837 | ffclock_convert_delta(ffdelta, ffth->period_lerp, &bt2); |
| 838 | } else { |
| 839 | *bt = ffth->tick_time; |
| 840 | ffclock_convert_delta(ffdelta, ffth->cest.period, &bt2); |
| 841 | } |
| 842 | |
| 843 | if (ffcount > ffth->tick_ffcount) |
| 844 | bintime_add(bt, &bt2); |
| 845 | else |
| 846 | bintime_sub(bt, &bt2); |
| 847 | } while (gen == 0 || gen != ffth->gen); |
| 848 | } |
| 849 | |
| 850 | /* |
| 851 | * Difference clock conversion. |
no test coverage detected