/* * \brief Driver for Raspberry Pi specific platform devices * \author Norman Feske * \date 2013-09-16 */ /* * Copyright (C) 2013 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. */ /* Genode includes */ #include #include #include #include #include /* platform includes */ #include #include /* local includes */ #include #include #include namespace Platform { class Session_component; class Root; } class Platform::Session_component : public Genode::Rpc_object { private: Mbox &_mbox; public: /** * Constructor */ Session_component(Mbox &mbox) : _mbox(mbox) { } /********************************** ** Platform session interface ** **********************************/ void setup_framebuffer(Framebuffer_info &info) { auto const &msg = _mbox.message(info); _mbox.call(); info = msg; } bool power_state(Power id) { auto &msg = _mbox.message(); auto const &res = msg.append(id); _mbox.call(); return res.state; } void power_state(Power id, bool enable) { auto &msg = _mbox.message(); msg.append_no_response(id, enable, true); _mbox.call(); } uint32_t clock_rate(Clock id) { auto &msg = _mbox.message(); auto const &res = msg.append(id); _mbox.call(); return res.hz; } }; class Platform::Root : public Genode::Root_component { private: Mbox _mbox; protected: Session_component *_create_session(const char *args) { return new (md_alloc()) Session_component(_mbox); } public: Root(Rpc_entrypoint *session_ep, Allocator *md_alloc) : Root_component(session_ep, md_alloc) { } }; int main(int, char **) { using namespace Platform; PINF("--- Raspberry Pi platform driver ---\n"); 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; }