mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 10:01:57 +00:00
os: add 'clock_rate' to Rpi platform driver
This commit is contained in:
parent
ea9c2199e8
commit
26442f782b
@ -15,7 +15,7 @@
|
|||||||
#define _INCLUDE__PLATFORM_SESSION__CLIENT_H_
|
#define _INCLUDE__PLATFORM_SESSION__CLIENT_H_
|
||||||
|
|
||||||
#include <base/capability.h>
|
#include <base/capability.h>
|
||||||
#include <base/rpc.h>
|
#include <base/rpc_client.h>
|
||||||
#include <platform_session/platform_session.h>
|
#include <platform_session/platform_session.h>
|
||||||
|
|
||||||
namespace Platform { struct Client; }
|
namespace Platform { struct Client; }
|
||||||
@ -33,6 +33,9 @@ struct Platform::Client : Genode::Rpc_client<Platform::Session>
|
|||||||
|
|
||||||
void power_state(Power power, bool enable) override {
|
void power_state(Power power, bool enable) override {
|
||||||
call<Rpc_set_power_state>(power, enable); }
|
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_ */
|
#endif /* _INCLUDE__PLATFORM_SESSION__CLIENT_H_ */
|
||||||
|
@ -60,6 +60,13 @@ struct Platform::Session : Genode::Session
|
|||||||
*/
|
*/
|
||||||
virtual void power_state(Power, bool enable) = 0;
|
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 **
|
** RPC declaration **
|
||||||
@ -68,9 +75,10 @@ struct Platform::Session : Genode::Session
|
|||||||
GENODE_RPC(Rpc_setup_framebuffer, void, setup_framebuffer, Framebuffer_info &);
|
GENODE_RPC(Rpc_setup_framebuffer, void, setup_framebuffer, Framebuffer_info &);
|
||||||
GENODE_RPC(Rpc_get_power_state, bool, power_state, Power);
|
GENODE_RPC(Rpc_get_power_state, bool, power_state, Power);
|
||||||
GENODE_RPC(Rpc_set_power_state, void, power_state, Power, bool);
|
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,
|
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_ */
|
#endif /* _INCLUDE__PLATFORM_SESSION__PLATFORM_SESSION_H_ */
|
||||||
|
@ -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);
|
msg.append_no_response<Property_command::Set_power_state>(id, enable, true);
|
||||||
_mbox.call<Property_message>();
|
_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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -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
|
struct Allocate_buffer
|
||||||
{
|
{
|
||||||
static uint32_t opcode() { return 0x00040001; };
|
static uint32_t opcode() { return 0x00040001; };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user