os: add 'clock_rate' to Rpi platform driver

This commit is contained in:
Norman Feske 2014-09-23 16:49:27 +02:00 committed by Christian Helmuth
parent ea9c2199e8
commit 26442f782b
4 changed files with 39 additions and 2 deletions

View File

@ -15,7 +15,7 @@
#define _INCLUDE__PLATFORM_SESSION__CLIENT_H_
#include <base/capability.h>
#include <base/rpc.h>
#include <base/rpc_client.h>
#include <platform_session/platform_session.h>
namespace Platform { struct Client; }
@ -33,6 +33,9 @@ struct Platform::Client : Genode::Rpc_client<Platform::Session>
void power_state(Power power, bool enable) override {
call<Rpc_set_power_state>(power, enable); }
uint32_t clock_rate(Clock clock) {
return call<Rpc_get_clock_rate>(clock); }
};
#endif /* _INCLUDE__PLATFORM_SESSION__CLIENT_H_ */

View File

@ -60,6 +60,13 @@ struct Platform::Session : Genode::Session
*/
virtual void power_state(Power, bool enable) = 0;
enum Clock { CLOCK_EMMC = 1 };
/**
* Request clock rate
*/
virtual uint32_t clock_rate(Clock) = 0;
/*********************
** RPC declaration **
@ -68,9 +75,10 @@ struct Platform::Session : Genode::Session
GENODE_RPC(Rpc_setup_framebuffer, void, setup_framebuffer, Framebuffer_info &);
GENODE_RPC(Rpc_get_power_state, bool, power_state, Power);
GENODE_RPC(Rpc_set_power_state, void, power_state, Power, bool);
GENODE_RPC(Rpc_get_clock_rate, uint32_t, clock_rate, Clock);
GENODE_RPC_INTERFACE(Rpc_setup_framebuffer, Rpc_set_power_state,
Rpc_get_power_state);
Rpc_get_power_state, Rpc_get_clock_rate);
};
#endif /* _INCLUDE__PLATFORM_SESSION__PLATFORM_SESSION_H_ */

View File

@ -73,6 +73,14 @@ class Platform::Session_component : public Genode::Rpc_object<Platform::Session>
msg.append_no_response<Property_command::Set_power_state>(id, enable, true);
_mbox.call<Property_message>();
}
uint32_t clock_rate(Clock id)
{
auto &msg = _mbox.message<Property_message>();
auto const &res = msg.append<Property_command::Get_clock_rate>(id);
_mbox.call<Property_message>();
return res.hz;
}
};

View File

@ -62,6 +62,24 @@ namespace Property_command {
};
};
struct Get_clock_rate
{
static uint32_t opcode() { return 0x00030002; };
struct Request
{
uint32_t const clock_id;
Request(uint32_t clock_id) : clock_id(clock_id) { }
};
struct Response
{
uint32_t const clock_id = 0;
uint32_t const hz = 0;
};
};
struct Allocate_buffer
{
static uint32_t opcode() { return 0x00040001; };