mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
timeout: use uint64_t for all plain time values
This enforces the use of unsigned 64-bit values for time in the duration type, the timeout framework, the timer session, the userland timer-drivers, and the alarm framework on all platforms. The commit also adapts the code that uses these tools accross all basic repositories (base, base-*, os. gems, libports, ports, dde_*) to use unsigned 64-bit values for time as well as far as this does not imply profound modifications. Fixes #3208
This commit is contained in:
committed by
Christian Helmuth
parent
e072ee480b
commit
181c78d482
@@ -27,15 +27,15 @@ struct Timer::Session_client : Genode::Rpc_client<Session>
|
||||
explicit Session_client(Session_capability session)
|
||||
: Genode::Rpc_client<Session>(session) { }
|
||||
|
||||
void trigger_once(unsigned us) override { call<Rpc_trigger_once>(us); }
|
||||
void trigger_once(uint64_t us) override { call<Rpc_trigger_once>(us); }
|
||||
|
||||
void trigger_periodic(unsigned us) override { call<Rpc_trigger_periodic>(us); }
|
||||
void trigger_periodic(uint64_t us) override { call<Rpc_trigger_periodic>(us); }
|
||||
|
||||
void sigh(Signal_context_capability sigh) override { call<Rpc_sigh>(sigh); }
|
||||
|
||||
unsigned long elapsed_ms() const override { return call<Rpc_elapsed_ms>(); }
|
||||
uint64_t elapsed_ms() const override { return call<Rpc_elapsed_ms>(); }
|
||||
|
||||
unsigned long elapsed_us() const override { return call<Rpc_elapsed_us>(); }
|
||||
uint64_t elapsed_us() const override { return call<Rpc_elapsed_us>(); }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__TIMER_SESSION__CLIENT_H_ */
|
||||
|
||||
@@ -205,22 +205,22 @@ class Timer::Connection : public Genode::Connection<Session>,
|
||||
|
||||
Timeout_handler *_handler { nullptr };
|
||||
Lock _real_time_lock { Lock::UNLOCKED };
|
||||
unsigned long _us { elapsed_us() };
|
||||
uint64_t _us { elapsed_us() };
|
||||
Timestamp _ts { _timestamp() };
|
||||
Duration _real_time { Microseconds(_us) };
|
||||
Duration _interpolated_time { _real_time };
|
||||
unsigned _interpolation_quality { 0 };
|
||||
unsigned long _us_to_ts_factor { 1UL };
|
||||
uint64_t _us_to_ts_factor { 1UL };
|
||||
unsigned _us_to_ts_factor_shift { 0 };
|
||||
|
||||
Timestamp _timestamp();
|
||||
|
||||
void _update_interpolation_quality(unsigned long min_factor,
|
||||
unsigned long max_factor);
|
||||
void _update_interpolation_quality(uint64_t min_factor,
|
||||
uint64_t max_factor);
|
||||
|
||||
unsigned long _ts_to_us_ratio(Timestamp ts,
|
||||
unsigned long us,
|
||||
unsigned shift);
|
||||
uint64_t _ts_to_us_ratio(Timestamp ts,
|
||||
uint64_t us,
|
||||
unsigned shift);
|
||||
|
||||
void _update_real_time();
|
||||
|
||||
@@ -284,7 +284,7 @@ class Timer::Connection : public Genode::Connection<Session>,
|
||||
* \noapi
|
||||
* \deprecated Use One_shot_timeout (or Periodic_timeout) instead
|
||||
*/
|
||||
void usleep(unsigned us) override
|
||||
void usleep(uint64_t us) override
|
||||
{
|
||||
if (_mode == MODERN) {
|
||||
throw Cannot_use_both_legacy_and_modern_interface();
|
||||
@@ -322,7 +322,7 @@ class Timer::Connection : public Genode::Connection<Session>,
|
||||
* \noapi
|
||||
* \deprecated Use One_shot_timeout (or Periodic_timeout) instead
|
||||
*/
|
||||
void msleep(unsigned ms) override
|
||||
void msleep(uint64_t ms) override
|
||||
{
|
||||
if (_mode == MODERN) {
|
||||
throw Cannot_use_both_legacy_and_modern_interface();
|
||||
|
||||
@@ -19,7 +19,12 @@
|
||||
#include <base/signal.h>
|
||||
#include <session/session.h>
|
||||
|
||||
namespace Timer { struct Session; }
|
||||
namespace Timer {
|
||||
|
||||
using Genode::uint64_t;
|
||||
|
||||
struct Session;
|
||||
}
|
||||
|
||||
|
||||
struct Timer::Session : Genode::Session
|
||||
@@ -38,7 +43,7 @@ struct Timer::Session : Genode::Session
|
||||
/**
|
||||
* Program single timeout (relative from now in microseconds)
|
||||
*/
|
||||
virtual void trigger_once(unsigned us) = 0;
|
||||
virtual void trigger_once(uint64_t us) = 0;
|
||||
|
||||
/**
|
||||
* Program periodic timeout (in microseconds)
|
||||
@@ -46,7 +51,7 @@ struct Timer::Session : Genode::Session
|
||||
* The first period will be triggered after 'us' at the latest,
|
||||
* but it might be triggered earlier as well.
|
||||
*/
|
||||
virtual void trigger_periodic(unsigned us) = 0;
|
||||
virtual void trigger_periodic(uint64_t us) = 0;
|
||||
|
||||
/**
|
||||
* Register timeout signal handler
|
||||
@@ -56,32 +61,32 @@ struct Timer::Session : Genode::Session
|
||||
/**
|
||||
* Return number of elapsed milliseconds since session creation
|
||||
*/
|
||||
virtual unsigned long elapsed_ms() const = 0;
|
||||
virtual uint64_t elapsed_ms() const = 0;
|
||||
|
||||
virtual unsigned long elapsed_us() const = 0;
|
||||
virtual uint64_t elapsed_us() const = 0;
|
||||
|
||||
/**
|
||||
* Client-side convenience method for sleeping the specified number
|
||||
* of milliseconds
|
||||
*/
|
||||
virtual void msleep(unsigned ms) = 0;
|
||||
virtual void msleep(uint64_t ms) = 0;
|
||||
|
||||
/**
|
||||
* Client-side convenience method for sleeping the specified number
|
||||
* of microseconds
|
||||
*/
|
||||
virtual void usleep(unsigned us) = 0;
|
||||
virtual void usleep(uint64_t us) = 0;
|
||||
|
||||
|
||||
/*********************
|
||||
** RPC declaration **
|
||||
*********************/
|
||||
|
||||
GENODE_RPC(Rpc_trigger_once, void, trigger_once, unsigned);
|
||||
GENODE_RPC(Rpc_trigger_periodic, void, trigger_periodic, unsigned);
|
||||
GENODE_RPC(Rpc_trigger_once, void, trigger_once, uint64_t);
|
||||
GENODE_RPC(Rpc_trigger_periodic, void, trigger_periodic, uint64_t);
|
||||
GENODE_RPC(Rpc_sigh, void, sigh, Genode::Signal_context_capability);
|
||||
GENODE_RPC(Rpc_elapsed_ms, unsigned long, elapsed_ms);
|
||||
GENODE_RPC(Rpc_elapsed_us, unsigned long, elapsed_us);
|
||||
GENODE_RPC(Rpc_elapsed_ms, uint64_t, elapsed_ms);
|
||||
GENODE_RPC(Rpc_elapsed_us, uint64_t, elapsed_us);
|
||||
|
||||
GENODE_RPC_INTERFACE(Rpc_trigger_once, Rpc_trigger_periodic,
|
||||
Rpc_sigh, Rpc_elapsed_ms, Rpc_elapsed_us);
|
||||
|
||||
Reference in New Issue
Block a user