Re: [PATCH] hw/timer/nrf51_timer: Don't lose time when timer is queried in tight loop

2023-06-07 Thread Peter Maydell
On Wed, 7 Jun 2023 at 12:26, Joel Stanley wrote: > > On Tue, 6 Jun 2023 at 13:49, Peter Maydell wrote: > > > > The nrf51_timer has a free-running counter which we implement using > > the pattern of using two fields (update_counter_ns, counter) to track > > the last point at which we calculated th

Re: [PATCH] hw/timer/nrf51_timer: Don't lose time when timer is queried in tight loop

2023-06-07 Thread Joel Stanley
On Tue, 6 Jun 2023 at 13:49, Peter Maydell wrote: > > The nrf51_timer has a free-running counter which we implement using > the pattern of using two fields (update_counter_ns, counter) to track > the last point at which we calculated the counter value, and the > counter value at that time. Then w

[PATCH] hw/timer/nrf51_timer: Don't lose time when timer is queried in tight loop

2023-06-06 Thread Peter Maydell
The nrf51_timer has a free-running counter which we implement using the pattern of using two fields (update_counter_ns, counter) to track the last point at which we calculated the counter value, and the counter value at that time. Then we can find the current counter value by converting the differ