mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-22 16:59:03 +00: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
@ -51,7 +51,7 @@ class Framebuffer::Driver
|
||||
Timer::Connection _timer;
|
||||
Genode::Reporter _reporter;
|
||||
Genode::Signal_handler<Driver> _poll_handler;
|
||||
unsigned long _poll_ms = 0;
|
||||
Genode::uint64_t _poll_ms = 0;
|
||||
|
||||
Genode::Signal_context_capability _config_sigh;
|
||||
|
||||
@ -74,7 +74,7 @@ class Framebuffer::Driver
|
||||
unsigned pitch() const { return _config._lx.pitch; }
|
||||
|
||||
void finish_initialization();
|
||||
void set_polling(unsigned long poll);
|
||||
void set_polling(Genode::uint64_t poll);
|
||||
void update_mode();
|
||||
void generate_report();
|
||||
|
||||
@ -117,8 +117,8 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
|
||||
Genode::Attached_ram_dataspace _ds;
|
||||
bool _in_mode_change = true;
|
||||
|
||||
unsigned long _polling_from_config() {
|
||||
return _config.xml().attribute_value<unsigned long>("poll", 0); }
|
||||
Genode::uint64_t _polling_from_config() {
|
||||
return _config.xml().attribute_value<Genode::uint64_t>("poll", 0); }
|
||||
|
||||
public:
|
||||
|
||||
|
@ -170,7 +170,7 @@ void Framebuffer::Driver::_poll()
|
||||
}
|
||||
|
||||
|
||||
void Framebuffer::Driver::set_polling(unsigned long poll)
|
||||
void Framebuffer::Driver::set_polling(Genode::uint64_t poll)
|
||||
{
|
||||
if (poll == _poll_ms) return;
|
||||
|
||||
|
@ -368,8 +368,8 @@ struct Wifi::Frontend
|
||||
bool _deferred_config_update { false };
|
||||
bool _single_autoconnect { false };
|
||||
|
||||
unsigned _connected_scan_interval { 30 };
|
||||
unsigned _scan_interval { 5 };
|
||||
Genode::uint64_t _connected_scan_interval { 30 };
|
||||
Genode::uint64_t _scan_interval { 5 };
|
||||
|
||||
void _config_update(bool signal)
|
||||
{
|
||||
@ -385,12 +385,12 @@ struct Wifi::Frontend
|
||||
/* only evaluated at start-up */
|
||||
_use_11n = config.attribute_value("use_11n", _use_11n);
|
||||
|
||||
unsigned connected_scan_interval =
|
||||
Genode::uint64_t connected_scan_interval =
|
||||
Util::check_time(config.attribute_value("connected_scan_interval",
|
||||
_connected_scan_interval),
|
||||
0, 15*60);
|
||||
|
||||
unsigned scan_interval =
|
||||
Genode::uint64_t scan_interval =
|
||||
Util::check_time(config.attribute_value("scan_interval",
|
||||
_scan_interval),
|
||||
5, 15*60);
|
||||
@ -699,7 +699,7 @@ struct Wifi::Frontend
|
||||
|
||||
bool _arm_scan_timer(bool connected)
|
||||
{
|
||||
unsigned const sec = connected ? _connected_scan_interval : _scan_interval;
|
||||
Genode::uint64_t const sec = connected ? _connected_scan_interval : _scan_interval;
|
||||
if (!sec) { return false; }
|
||||
|
||||
if (_verbose) {
|
||||
|
@ -78,7 +78,7 @@ namespace Util {
|
||||
return 2 * (level + 100);
|
||||
}
|
||||
|
||||
inline unsigned check_time(unsigned value, unsigned min, unsigned max)
|
||||
inline Genode::uint64_t check_time(Genode::uint64_t value, Genode::uint64_t min, Genode::uint64_t max)
|
||||
{
|
||||
if (value < min) { return min; }
|
||||
else if (value > max) { return max; }
|
||||
|
@ -19,6 +19,8 @@
|
||||
** linux/jiffies.h **
|
||||
*********************/
|
||||
|
||||
#include <base/fixed_stdint.h>
|
||||
|
||||
#define MAX_JIFFY_OFFSET ((LONG_MAX >> 1)-1)
|
||||
|
||||
extern unsigned long jiffies;
|
||||
@ -29,11 +31,11 @@ enum {
|
||||
JIFFIES_TICK_NS = 1000ULL*1000*1000/HZ,
|
||||
};
|
||||
|
||||
static inline unsigned long msecs_to_jiffies(const unsigned int m) { return m / JIFFIES_TICK_MS; }
|
||||
static inline unsigned long usecs_to_jiffies(const unsigned int u) { return u / JIFFIES_TICK_US; }
|
||||
static inline unsigned long msecs_to_jiffies(const genode_uint64_t m) { return m / JIFFIES_TICK_MS; }
|
||||
static inline unsigned long usecs_to_jiffies(const genode_uint64_t u) { return u / JIFFIES_TICK_US; }
|
||||
|
||||
static inline unsigned int jiffies_to_msecs(const unsigned long j) { return j * JIFFIES_TICK_MS; }
|
||||
static inline u64 jiffies_to_nsecs(const unsigned long j) { return (u64)j * JIFFIES_TICK_NS; }
|
||||
static inline genode_uint64_t jiffies_to_msecs(const unsigned long j) { return j * JIFFIES_TICK_MS; }
|
||||
static inline genode_uint64_t jiffies_to_nsecs(const unsigned long j) { return (u64)j * JIFFIES_TICK_NS; }
|
||||
|
||||
clock_t jiffies_to_clock_t(unsigned long x);
|
||||
static inline clock_t jiffies_delta_to_clock_t(long delta)
|
||||
|
@ -86,7 +86,7 @@ class Lx::Timer
|
||||
/**
|
||||
* Suspend calling thread
|
||||
*/
|
||||
virtual void usleep(unsigned us) = 0;
|
||||
virtual void usleep(Genode::uint64_t us) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -127,8 +127,8 @@ class Lx::Timer
|
||||
return;
|
||||
|
||||
/* calculate relative microseconds for trigger */
|
||||
unsigned long us = ctx->timeout > jiffies ?
|
||||
jiffies_to_msecs(ctx->timeout - jiffies) * 1000 : 0;
|
||||
Genode::uint64_t us = ctx->timeout > jiffies ?
|
||||
(Genode::uint64_t)jiffies_to_msecs(ctx->timeout - jiffies) * 1000 : 0;
|
||||
_timers_one_shot.schedule(Genode::Microseconds{us});
|
||||
}
|
||||
|
||||
|
@ -69,12 +69,12 @@ class Lx_kit::Scheduler : public Lx::Scheduler
|
||||
|
||||
struct Logger : Genode::Thread
|
||||
{
|
||||
Timer::Connection _timer;
|
||||
Lx::Scheduler &_scheduler;
|
||||
unsigned const _interval;
|
||||
Timer::Connection _timer;
|
||||
Lx::Scheduler &_scheduler;
|
||||
Genode::uint64_t const _interval;
|
||||
|
||||
Logger(Genode::Env &env, Lx::Scheduler &scheduler,
|
||||
unsigned interval_seconds)
|
||||
Genode::uint64_t interval_seconds)
|
||||
:
|
||||
Genode::Thread(env, "logger", 0x4000),
|
||||
_timer(env), _scheduler(scheduler),
|
||||
|
@ -114,8 +114,8 @@ class Lx_kit::Timer : public Lx::Timer
|
||||
return;
|
||||
|
||||
/* calculate relative microseconds for trigger */
|
||||
unsigned long us = ctx->timeout > _jiffies ?
|
||||
jiffies_to_msecs(ctx->timeout - _jiffies) * 1000 : 0;
|
||||
Genode::uint64_t us = ctx->timeout > _jiffies ?
|
||||
(Genode::uint64_t)jiffies_to_msecs(ctx->timeout - _jiffies) * 1000 : 0;
|
||||
_timer_conn.trigger_once(us);
|
||||
}
|
||||
|
||||
@ -290,10 +290,10 @@ class Lx_kit::Timer : public Lx::Timer
|
||||
* Do not use lx_emul usecs_to_jiffies(unsigned int) because
|
||||
* of implicit truncation!
|
||||
*/
|
||||
_jiffies = _timer_conn_modern.curr_time().trunc_to_plain_ms().value / JIFFIES_TICK_MS;
|
||||
_jiffies = (Genode::uint64_t)_timer_conn_modern.curr_time().trunc_to_plain_ms().value / JIFFIES_TICK_MS;
|
||||
}
|
||||
|
||||
void usleep(unsigned us) {
|
||||
void usleep(Genode::uint64_t us) {
|
||||
_timer_conn.usleep(us); }
|
||||
};
|
||||
|
||||
|
@ -50,7 +50,7 @@ struct Framebuffer_controller
|
||||
timer_handler(env.ep(), *this, &Framebuffer_controller::handle_timer)
|
||||
{
|
||||
Attached_rom_dataspace config(env, "config");
|
||||
unsigned long const period_ms = config.xml().attribute_value("artifical_update_ms", 0UL);
|
||||
Genode::uint64_t const period_ms = config.xml().attribute_value("artifical_update_ms", (Genode::uint64_t)0);
|
||||
|
||||
rom.sigh(rom_sigh);
|
||||
|
||||
|
Reference in New Issue
Block a user