mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 13:47:56 +00:00
base-hw: preserve usec accuracy in us_to_ticks
The kernel timer used to truncated timeouts to the next lower millisecond, which not only limits the wakeup accuracy but also results in situations where a user-level timeout is triggered earlier than expected. The latter effect results in the observation of a spurious timeouts and the subsequent programming of another timeout. The patch solves the problem by preserving the sub-milliseconds bits in the 'us_to_ticks' implementation(s). Issue #5142
This commit is contained in:
parent
7ae7b8481a
commit
a0290f8c51
@ -102,7 +102,7 @@ unsigned Timer::interrupt_id() const {
|
|||||||
|
|
||||||
|
|
||||||
time_t Timer::us_to_ticks(time_t const us) const {
|
time_t Timer::us_to_ticks(time_t const us) const {
|
||||||
return (us / 1000) * TICS_PER_MS; }
|
return (us * TICS_PER_MS) / 1000; }
|
||||||
|
|
||||||
|
|
||||||
time_t Timer::_duration() const {
|
time_t Timer::_duration() const {
|
||||||
|
@ -58,7 +58,7 @@ time_t Timer::ticks_to_us(time_t const ticks) const {
|
|||||||
|
|
||||||
|
|
||||||
time_t Timer::us_to_ticks(time_t const us) const {
|
time_t Timer::us_to_ticks(time_t const us) const {
|
||||||
return (us / 1000) * _device.ticks_per_ms; }
|
return (us * _device.ticks_per_ms) / 1000; }
|
||||||
|
|
||||||
|
|
||||||
time_t Timer::_max_value() const {
|
time_t Timer::_max_value() const {
|
||||||
|
@ -84,7 +84,7 @@ time_t Timer::ticks_to_us(time_t const ticks) const {
|
|||||||
|
|
||||||
|
|
||||||
time_t Timer::us_to_ticks(time_t const us) const {
|
time_t Timer::us_to_ticks(time_t const us) const {
|
||||||
return (us / 1000UL) * Board::Timer::TICS_PER_MS; }
|
return (us * Board::Timer::TICS_PER_MS) / 1000; }
|
||||||
|
|
||||||
|
|
||||||
time_t Timer::_max_value() const {
|
time_t Timer::_max_value() const {
|
||||||
|
@ -109,7 +109,7 @@ time_t Timer::ticks_to_us(time_t const ticks) const {
|
|||||||
|
|
||||||
|
|
||||||
time_t Timer::us_to_ticks(time_t const us) const {
|
time_t Timer::us_to_ticks(time_t const us) const {
|
||||||
return (us / 1000) * _device.ticks_per_ms; }
|
return (us * _device.ticks_per_ms) / 1000; }
|
||||||
|
|
||||||
|
|
||||||
time_t Timer::_max_value() const {
|
time_t Timer::_max_value() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user