| 65 | } |
| 66 | |
| 67 | u64 lv2_timer::check_unlocked(u64 _now) noexcept { |
| 68 | const u64 next = expire; |
| 69 | |
| 70 | if (_now < next || state != SYS_TIMER_STATE_RUN) { |
| 71 | return umax; |
| 72 | } |
| 73 | |
| 74 | if (port) { |
| 75 | port->send(source, data1, data2, next); |
| 76 | } |
| 77 | |
| 78 | if (period) { |
| 79 | // Set next expiration time and check again |
| 80 | const u64 expire0 = rx::add_saturate<u64>(next, period); |
| 81 | expire.release(expire0); |
| 82 | return rx::sub_saturate<u64>(expire0, _now); |
| 83 | } |
| 84 | |
| 85 | // Stop after oneshot |
| 86 | state.release(SYS_TIMER_STATE_STOP); |
| 87 | return umax; |
| 88 | } |
| 89 | |
| 90 | lv2_timer_thread::lv2_timer_thread() { |
| 91 | Emu.PostponeInitCode([this]() { |
no test coverage detected