Lines Matching refs:now
42 static uint32_t counter_from_tickoff(int64_t now, int64_t tick_offset, int frq) in counter_from_tickoff() argument
44 return muldiv64(now - tick_offset, frq, NANOSECONDS_PER_SECOND); in counter_from_tickoff()
47 static int64_t tickoff_from_counter(int64_t now, uint32_t count, int frq) in tickoff_from_counter() argument
49 return now - muldiv64(count, NANOSECONDS_PER_SECOND, frq); in tickoff_from_counter()
59 int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); in resync_counter() local
60 int64_t elapsed = now - s->pscntr_sync_ticks; in resync_counter()
127 int64_t now; in mps2_fpgaio_read() local
152 now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); in mps2_fpgaio_read()
153 r = counter_from_tickoff(now, s->clk1hz_tick_offset, 1); in mps2_fpgaio_read()
156 now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); in mps2_fpgaio_read()
157 r = counter_from_tickoff(now, s->clk100hz_tick_offset, 100); in mps2_fpgaio_read()
190 int64_t now; in mps2_fpgaio_write() local
227 now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); in mps2_fpgaio_write()
228 s->clk1hz_tick_offset = tickoff_from_counter(now, value, 1); in mps2_fpgaio_write()
231 now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); in mps2_fpgaio_write()
232 s->clk100hz_tick_offset = tickoff_from_counter(now, value, 100); in mps2_fpgaio_write()
259 int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); in mps2_fpgaio_reset() local
265 s->clk1hz_tick_offset = tickoff_from_counter(now, 0, 1); in mps2_fpgaio_reset()
266 s->clk100hz_tick_offset = tickoff_from_counter(now, 0, 100); in mps2_fpgaio_reset()
269 s->pscntr_sync_ticks = now; in mps2_fpgaio_reset()