usb rpi: get rid of local hardware timer

We used a hardware timer locally in the RPI USB driver because a timer
connection was not precise enough to fullfill the host controllers
requirements.

With the modern timer connection interface, however, reading out time at
a connection is microseconds precise and we can remove the local timer.
But we cannot use the same timer connection for doing legacy-interface
stuff like usleep (currently used in LX kit) and modern-interface stuff
like curr_time. Thus, we open two connections for now.

Ref #2400
This commit is contained in:
Martin Stein
2017-08-08 15:46:53 +02:00
committed by Christian Helmuth
parent b6efa7f6f9
commit 47dc708887
3 changed files with 4 additions and 138 deletions

View File

@ -81,11 +81,11 @@ class Lx_kit::Timer : public Lx::Timer
unsigned long &_jiffies;
::Timer::Connection _timer_conn;
::Timer::Connection _timer_conn_modern;
Lx_kit::List<Context> _list;
Lx::Task _timer_task;
Genode::Signal_handler<Lx_kit::Timer> _dispatcher;
Genode::Tslab<Context, 32 * sizeof(Context)> _timer_alloc;
Lx::jiffies_update_func _jiffies_func = nullptr;
/**
* Lookup local timer
@ -177,6 +177,7 @@ class Lx_kit::Timer : public Lx::Timer
:
_jiffies(jiffies),
_timer_conn(env),
_timer_conn_modern(env),
_timer_task(Timer::run_timer, reinterpret_cast<void*>(this),
"timer", Lx::Task::PRIORITY_2, Lx::scheduler()),
_dispatcher(ep, *this, &Lx_kit::Timer::_handle),
@ -292,10 +293,7 @@ class Lx_kit::Timer : public Lx::Timer
}
void update_jiffies() {
_jiffies = _jiffies_func ? _jiffies_func() : msecs_to_jiffies(_timer_conn.elapsed_ms()); }
void register_jiffies_func(Lx::jiffies_update_func func) {
_jiffies_func = func; }
_jiffies = usecs_to_jiffies(_timer_conn_modern.curr_time().trunc_to_plain_us().value); }
void usleep(unsigned us) {
_timer_conn.usleep(us); }
@ -319,9 +317,3 @@ void Lx::timer_update_jiffies()
{
timer().update_jiffies();
}
void Lx::register_jiffies_func(jiffies_update_func func)
{
dynamic_cast<Lx_kit::Timer &>(timer()).register_jiffies_func(func);
}