mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-20 00:52:01 +00:00
os: platform_drv (arm) API transition (ref #1987)
This commit is contained in:
parent
3ae19a9eb7
commit
6775b4077d
repos/os
include/regulator
src/drivers/platform/spec
@ -29,23 +29,17 @@ class Regulator::Session_component : public Regulator::Session_rpc_object
|
||||
{
|
||||
private:
|
||||
|
||||
Driver_factory &_driver_factory;
|
||||
Driver &_driver;
|
||||
Driver_factory & _driver_factory;
|
||||
Driver & _driver;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Session_component(Regulator_id regulator_id,
|
||||
Driver_factory &driver_factory)
|
||||
Session_component(Regulator_id regulator_id,
|
||||
Driver_factory & driver_factory)
|
||||
: Session_rpc_object(regulator_id),
|
||||
_driver_factory(driver_factory),
|
||||
_driver(_driver_factory.create(regulator_id)) { }
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~Session_component()
|
||||
{
|
||||
_driver.state(_id, false);
|
||||
@ -69,8 +63,7 @@ class Regulator::Root :
|
||||
{
|
||||
private:
|
||||
|
||||
Driver_factory &_driver_factory;
|
||||
Genode::Rpc_entrypoint &_ep;
|
||||
Regulator::Driver_factory & _driver_factory;
|
||||
|
||||
protected:
|
||||
|
||||
@ -100,12 +93,12 @@ class Regulator::Root :
|
||||
|
||||
public:
|
||||
|
||||
Root(Genode::Rpc_entrypoint *session_ep,
|
||||
Genode::Allocator *md_alloc,
|
||||
Driver_factory &driver_factory)
|
||||
: Genode::Root_component<Regulator::Session_component>(session_ep,
|
||||
Root(Genode::Env & env,
|
||||
Genode::Allocator & md_alloc,
|
||||
Regulator::Driver_factory & driver_factory)
|
||||
: Genode::Root_component<Regulator::Session_component>(env.ep(),
|
||||
md_alloc),
|
||||
_driver_factory(driver_factory), _ep(*session_ep) { }
|
||||
_driver_factory(driver_factory) { }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__REGULATOR__COMPONENT_H_ */
|
||||
|
@ -12,8 +12,8 @@
|
||||
*/
|
||||
|
||||
#include <base/log.h>
|
||||
#include <base/sleep.h>
|
||||
#include <cap_session/connection.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/component.h>
|
||||
#include <regulator/component.h>
|
||||
#include <regulator/consts.h>
|
||||
|
||||
@ -46,22 +46,24 @@ struct Driver_factory : Regulator::Driver_factory
|
||||
}
|
||||
|
||||
void destroy(Regulator::Driver &driver) { }
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(int, char **)
|
||||
struct Main
|
||||
{
|
||||
using namespace Genode;
|
||||
Genode::Env & env;
|
||||
Genode::Heap heap { env.ram(), env.rm() };
|
||||
::Driver_factory factory;
|
||||
Regulator::Root root { env, heap, factory };
|
||||
|
||||
log("--- Arndale platform driver ---");
|
||||
Main(Genode::Env & env) : env(env) {
|
||||
env.parent().announce(env.ep().manage(root)); }
|
||||
};
|
||||
|
||||
static Cap_connection cap;
|
||||
static Rpc_entrypoint ep(&cap, 4096, "arndale_plat_ep");
|
||||
static ::Driver_factory driver_factory;
|
||||
static Regulator::Root reg_root(&ep, env()->heap(), driver_factory);
|
||||
env()->parent()->announce(ep.manage(®_root));
|
||||
|
||||
sleep_forever();
|
||||
return 0;
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
Genode::log("--- Arndale platform driver ---");
|
||||
|
||||
static Main main(env);
|
||||
}
|
||||
|
@ -12,9 +12,8 @@
|
||||
*/
|
||||
|
||||
#include <base/log.h>
|
||||
#include <base/sleep.h>
|
||||
#include <base/rpc_server.h>
|
||||
#include <cap_session/connection.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/component.h>
|
||||
#include <root/component.h>
|
||||
#include <platform_session/platform_session.h>
|
||||
|
||||
@ -125,23 +124,26 @@ class Platform::Root : public Genode::Root_component<Platform::Session_component
|
||||
|
||||
public:
|
||||
|
||||
Root(Genode::Rpc_entrypoint *session_ep,
|
||||
Genode::Allocator *md_alloc)
|
||||
Root(Genode::Entrypoint & session_ep,
|
||||
Genode::Allocator & md_alloc)
|
||||
: Genode::Root_component<Session_component>(session_ep, md_alloc) { }
|
||||
};
|
||||
|
||||
|
||||
int main(int, char **)
|
||||
struct Main
|
||||
{
|
||||
using namespace Genode;
|
||||
Genode::Env & env;
|
||||
Genode::Heap heap { env.ram(), env.rm() };
|
||||
Platform::Root root { env.ep(), heap };
|
||||
|
||||
Main(Genode::Env & env) : env(env) {
|
||||
env.parent().announce(env.ep().manage(root)); }
|
||||
};
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
Genode::log("--- i.MX53 platform driver ---");
|
||||
|
||||
static Cap_connection cap;
|
||||
static Rpc_entrypoint ep(&cap, 4096, "imx53_plat_ep");
|
||||
static Platform::Root plat_root(&ep, env()->heap());
|
||||
env()->parent()->announce(ep.manage(&plat_root));
|
||||
|
||||
sleep_forever();
|
||||
return 0;
|
||||
static Main main(env);
|
||||
}
|
||||
|
@ -14,15 +14,16 @@
|
||||
*/
|
||||
|
||||
#include <base/log.h>
|
||||
#include <base/sleep.h>
|
||||
#include <cap_session/connection.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/component.h>
|
||||
#include <regulator/component.h>
|
||||
#include <regulator/consts.h>
|
||||
|
||||
#include <cmu.h>
|
||||
#include <pmu.h>
|
||||
|
||||
struct Driver_factory: Regulator::Driver_factory
|
||||
|
||||
struct Driver_factory : Regulator::Driver_factory
|
||||
{
|
||||
Cmu _cmu;
|
||||
Pmu _pmu;
|
||||
@ -49,19 +50,22 @@ struct Driver_factory: Regulator::Driver_factory
|
||||
}
|
||||
};
|
||||
|
||||
int main(int, char **)
|
||||
|
||||
struct Main
|
||||
{
|
||||
using namespace Genode;
|
||||
Genode::Env & env;
|
||||
Genode::Heap heap { env.ram(), env.rm() };
|
||||
::Driver_factory factory;
|
||||
Regulator::Root root { env, heap, factory };
|
||||
|
||||
log("--- Odroid-x2 platform driver ---");
|
||||
Main(Genode::Env & env) : env(env) {
|
||||
env.parent().announce(env.ep().manage(root)); }
|
||||
};
|
||||
|
||||
static Cap_connection cap;
|
||||
static Rpc_entrypoint ep(&cap, 4096, "odroid_x2_plat_ep");
|
||||
static ::Driver_factory driver_factory;
|
||||
static Regulator::Root reg_root(&ep, env()->heap(), driver_factory);
|
||||
env()->parent()->announce(ep.manage(®_root));
|
||||
|
||||
log("--- Odroid-x2 platform driver. Done ---");
|
||||
sleep_forever();
|
||||
return 0;
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
Genode::log("--- Odroid X2 platform driver ---");
|
||||
|
||||
static Main main(env);
|
||||
}
|
||||
|
@ -13,9 +13,8 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <base/sleep.h>
|
||||
#include <base/rpc_server.h>
|
||||
#include <cap_session/connection.h>
|
||||
#include <base/component.h>
|
||||
#include <base/heap.h>
|
||||
#include <root/component.h>
|
||||
|
||||
/* platform includes */
|
||||
@ -42,9 +41,6 @@ class Platform::Session_component : public Genode::Rpc_object<Platform::Session>
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Session_component(Mbox &mbox) : _mbox(mbox) { }
|
||||
|
||||
|
||||
@ -97,22 +93,25 @@ class Platform::Root : public Genode::Root_component<Platform::Session_component
|
||||
|
||||
public:
|
||||
|
||||
Root(Rpc_entrypoint *session_ep, Allocator *md_alloc)
|
||||
Root(Entrypoint & session_ep, Allocator & md_alloc)
|
||||
: Root_component<Session_component>(session_ep, md_alloc) { }
|
||||
};
|
||||
|
||||
|
||||
int main(int, char **)
|
||||
struct Main
|
||||
{
|
||||
using namespace Platform;
|
||||
Genode::Env & env;
|
||||
Genode::Heap heap { env.ram(), env.rm() };
|
||||
Platform::Root root { env.ep(), heap };
|
||||
|
||||
Main(Genode::Env & env) : env(env) {
|
||||
env.parent().announce(env.ep().manage(root)); }
|
||||
};
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
Genode::log("--- Raspberry Pi platform driver ---");
|
||||
|
||||
static Cap_connection cap;
|
||||
static Rpc_entrypoint ep(&cap, 4096, "rpi_plat_ep");
|
||||
static Platform::Root plat_root(&ep, env()->heap());
|
||||
env()->parent()->announce(ep.manage(&plat_root));
|
||||
|
||||
sleep_forever();
|
||||
return 0;
|
||||
static Main main(env);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user