mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
parent
0b9272bd9c
commit
e6e1d8c144
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013 Genode Labs GmbH
|
||||
* Copyright (C) 2017 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.
|
||||
@ -433,9 +433,9 @@ class Cmu : public Regulator::Driver,
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Cmu()
|
||||
: Genode::Attached_mmio(Genode::Board_base::CMU_MMIO_BASE,
|
||||
Genode::Board_base::CMU_MMIO_SIZE),
|
||||
Cmu(Genode::Env &env)
|
||||
: Genode::Attached_mmio(env, Genode::Board_base::CMU_MMIO_BASE,
|
||||
Genode::Board_base::CMU_MMIO_SIZE),
|
||||
_cpu_freq(CPU_FREQ_1600)
|
||||
{
|
||||
/**
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013 Genode Labs GmbH
|
||||
* Copyright (C) 2017 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.
|
||||
@ -26,6 +26,8 @@ struct Driver_factory : Regulator::Driver_factory
|
||||
Cmu _cmu;
|
||||
Pmu _pmu;
|
||||
|
||||
Driver_factory(Genode::Env &env) : _cmu(env), _pmu(env) { }
|
||||
|
||||
Regulator::Driver &create(Regulator::Regulator_id id) {
|
||||
switch (id) {
|
||||
case Regulator::CLK_CPU:
|
||||
@ -53,7 +55,7 @@ struct Main
|
||||
{
|
||||
Genode::Env & env;
|
||||
Genode::Heap heap { env.ram(), env.rm() };
|
||||
::Driver_factory factory;
|
||||
::Driver_factory factory { env };
|
||||
Regulator::Root root { env, heap, factory };
|
||||
|
||||
Main(Genode::Env & env) : env(env) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013 Genode Labs GmbH
|
||||
* Copyright (C) 2017 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.
|
||||
@ -159,8 +159,9 @@ class Pmu : public Regulator::Driver,
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Pmu() : Genode::Attached_mmio(Genode::Board_base::PMU_MMIO_BASE,
|
||||
Genode::Board_base::PMU_MMIO_SIZE)
|
||||
Pmu(Genode::Env &env)
|
||||
: Genode::Attached_mmio(env, Genode::Board_base::PMU_MMIO_BASE,
|
||||
Genode::Board_base::PMU_MMIO_SIZE)
|
||||
{
|
||||
write<Hdmi_phy_control ::Enable>(0);
|
||||
write<Usbdrd_phy_control ::Enable>(0);
|
||||
|
@ -65,9 +65,9 @@ class Ccm : public Genode::Attached_io_mem_dataspace,
|
||||
|
||||
public:
|
||||
|
||||
Ccm()
|
||||
: Genode::Attached_io_mem_dataspace(Genode::Board_base::CCM_BASE,
|
||||
Genode::Board_base::CCM_SIZE),
|
||||
Ccm(Genode::Env &env)
|
||||
: Genode::Attached_io_mem_dataspace(env, Genode::Board_base::CCM_BASE,
|
||||
Genode::Board_base::CCM_SIZE),
|
||||
Genode::Mmio((Genode::addr_t)local_addr<void>()) { }
|
||||
|
||||
void i2c_1_enable(void) { write<Ccgr1::I2c_1>(3); }
|
||||
|
@ -28,9 +28,9 @@ class Iim : public Genode::Attached_io_mem_dataspace,
|
||||
|
||||
public:
|
||||
|
||||
Iim()
|
||||
: Genode::Attached_io_mem_dataspace(Genode::Board_base::IIM_BASE,
|
||||
Genode::Board_base::IIM_SIZE),
|
||||
Iim(Genode::Env &env)
|
||||
: Genode::Attached_io_mem_dataspace(env, Genode::Board_base::IIM_BASE,
|
||||
Genode::Board_base::IIM_SIZE),
|
||||
Genode::Mmio((Genode::addr_t)local_addr<void>()) {}
|
||||
|
||||
unsigned long revision() { return read<Fuse_bank0_gp6>() & 0xf; }
|
||||
|
@ -58,11 +58,11 @@ class Iomux : public Genode::Attached_io_mem_dataspace,
|
||||
|
||||
public:
|
||||
|
||||
Iomux()
|
||||
: Genode::Attached_io_mem_dataspace(Genode::Board_base::IOMUXC_BASE,
|
||||
Genode::Board_base::IOMUXC_SIZE),
|
||||
Genode::Mmio((Genode::addr_t)local_addr<void>()) {
|
||||
}
|
||||
Iomux(Genode::Env &env)
|
||||
: Genode::Attached_io_mem_dataspace(env, Genode::Board_base::IOMUXC_BASE,
|
||||
Genode::Board_base::IOMUXC_SIZE),
|
||||
Genode::Mmio((Genode::addr_t)local_addr<void>())
|
||||
{ }
|
||||
|
||||
void i2c_2_enable()
|
||||
{
|
||||
|
@ -112,10 +112,12 @@ class Platform::Root : public Genode::Root_component<Platform::Session_component
|
||||
{
|
||||
private:
|
||||
|
||||
Iim _iim;
|
||||
Iomux _iomux;
|
||||
Ccm _ccm;
|
||||
Src _src;
|
||||
Genode::Env &_env;
|
||||
|
||||
Iim _iim { _env };
|
||||
Iomux _iomux { _env };
|
||||
Ccm _ccm { _env };
|
||||
Src _src { _env };
|
||||
|
||||
protected:
|
||||
|
||||
@ -124,9 +126,10 @@ class Platform::Root : public Genode::Root_component<Platform::Session_component
|
||||
|
||||
public:
|
||||
|
||||
Root(Genode::Entrypoint & session_ep,
|
||||
Genode::Allocator & md_alloc)
|
||||
: Genode::Root_component<Session_component>(session_ep, md_alloc) { }
|
||||
Root(Genode::Env &env,
|
||||
Genode::Allocator &md_alloc)
|
||||
: Genode::Root_component<Session_component>(env.ep(), md_alloc), _env(env)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
@ -134,7 +137,7 @@ struct Main
|
||||
{
|
||||
Genode::Env & env;
|
||||
Genode::Heap heap { env.ram(), env.rm() };
|
||||
Platform::Root root { env.ep(), heap };
|
||||
Platform::Root root { env, heap };
|
||||
|
||||
Main(Genode::Env & env) : env(env) {
|
||||
env.parent().announce(env.ep().manage(root)); }
|
||||
|
@ -32,9 +32,9 @@ class Src : public Genode::Attached_io_mem_dataspace,
|
||||
|
||||
public:
|
||||
|
||||
Src()
|
||||
: Genode::Attached_io_mem_dataspace(Genode::Board_base::SRC_BASE,
|
||||
Genode::Board_base::SRC_SIZE),
|
||||
Src(Genode::Env &env)
|
||||
: Genode::Attached_io_mem_dataspace(env, Genode::Board_base::SRC_BASE,
|
||||
Genode::Board_base::SRC_SIZE),
|
||||
Genode::Mmio((Genode::addr_t)local_addr<void>()) {}
|
||||
|
||||
void reset_ipu() { write<Ctrl_reg::Ipu_rst>(1); }
|
||||
|
@ -311,9 +311,9 @@ class Cmu : public Regulator::Driver,
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Cmu()
|
||||
: Genode::Attached_mmio(Genode::Board_base::CMU_MMIO_BASE,
|
||||
Genode::Board_base::CMU_MMIO_SIZE),
|
||||
Cmu(Genode::Env &env)
|
||||
: Genode::Attached_mmio(env, Genode::Board_base::CMU_MMIO_BASE,
|
||||
Genode::Board_base::CMU_MMIO_SIZE),
|
||||
_cpu_freq(CPU_FREQ_1400)
|
||||
{
|
||||
/**
|
||||
|
@ -28,6 +28,8 @@ struct Driver_factory : Regulator::Driver_factory
|
||||
Cmu _cmu;
|
||||
Pmu _pmu;
|
||||
|
||||
Driver_factory(Genode::Env &env) : _cmu(env), _pmu(env) { }
|
||||
|
||||
Regulator::Driver &create(Regulator::Regulator_id id)
|
||||
{
|
||||
switch (id) {
|
||||
@ -46,8 +48,7 @@ struct Driver_factory : Regulator::Driver_factory
|
||||
};
|
||||
}
|
||||
|
||||
void destroy(Regulator::Driver &driver) {
|
||||
}
|
||||
void destroy(Regulator::Driver &driver) { }
|
||||
};
|
||||
|
||||
|
||||
@ -55,7 +56,7 @@ struct Main
|
||||
{
|
||||
Genode::Env & env;
|
||||
Genode::Heap heap { env.ram(), env.rm() };
|
||||
::Driver_factory factory;
|
||||
::Driver_factory factory { env };
|
||||
Regulator::Root root { env, heap, factory };
|
||||
|
||||
Main(Genode::Env & env) : env(env) {
|
||||
|
@ -112,8 +112,9 @@ class Pmu : public Regulator::Driver,
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Pmu() : Genode::Attached_mmio(Genode::Board_base::PMU_MMIO_BASE,
|
||||
Genode::Board_base::PMU_MMIO_SIZE)
|
||||
Pmu(Genode::Env &env)
|
||||
: Genode::Attached_mmio(env, Genode::Board_base::PMU_MMIO_BASE,
|
||||
Genode::Board_base::PMU_MMIO_SIZE)
|
||||
{
|
||||
write<Usbdrd_phy_control::Enable>(0);
|
||||
write<Usbhost_phy1_control::Enable>(0);
|
||||
|
@ -93,8 +93,9 @@ class Platform::Root : public Genode::Root_component<Platform::Session_component
|
||||
|
||||
public:
|
||||
|
||||
Root(Entrypoint & session_ep, Allocator & md_alloc)
|
||||
: Root_component<Session_component>(session_ep, md_alloc) { }
|
||||
Root(Env& env, Allocator & md_alloc)
|
||||
: Root_component<Session_component>(env.ep(), md_alloc), _mbox(env)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
@ -102,7 +103,7 @@ struct Main
|
||||
{
|
||||
Genode::Env & env;
|
||||
Genode::Heap heap { env.ram(), env.rm() };
|
||||
Platform::Root root { env.ep(), heap };
|
||||
Platform::Root root { env, heap };
|
||||
|
||||
Main(Genode::Env & env) : env(env) {
|
||||
env.parent().announce(env.ep().manage(root)); }
|
||||
|
@ -27,6 +27,8 @@ class Mbox : Genode::Attached_mmio
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Env &_env;
|
||||
|
||||
enum { verbose = false };
|
||||
|
||||
typedef Genode::addr_t addr_t;
|
||||
@ -52,8 +54,8 @@ class Mbox : Genode::Attached_mmio
|
||||
};
|
||||
|
||||
enum { MSG_BUFFER_SIZE = 0x1000 };
|
||||
Genode::Attached_ram_dataspace _msg_buffer = { Genode::env()->ram_session(),
|
||||
MSG_BUFFER_SIZE };
|
||||
Genode::Attached_ram_dataspace _msg_buffer { _env.ram(), _env.rm(),
|
||||
MSG_BUFFER_SIZE };
|
||||
|
||||
addr_t const _msg_phys = { Dataspace_client(_msg_buffer.cap()).phys_addr() };
|
||||
|
||||
@ -61,7 +63,9 @@ class Mbox : Genode::Attached_mmio
|
||||
{
|
||||
Timer::Connection timer;
|
||||
void usleep(unsigned us) { timer.usleep(us); }
|
||||
} _delayer;;
|
||||
|
||||
Delayer(Genode::Env &env) : timer(env) { }
|
||||
} _delayer { _env };
|
||||
|
||||
template <typename MESSAGE>
|
||||
MESSAGE &_message()
|
||||
@ -71,7 +75,8 @@ class Mbox : Genode::Attached_mmio
|
||||
|
||||
public:
|
||||
|
||||
Mbox() : Genode::Attached_mmio(BASE, SIZE) { }
|
||||
Mbox(Genode::Env &env)
|
||||
: Genode::Attached_mmio(env, BASE, SIZE), _env(env) { }
|
||||
|
||||
/**
|
||||
* Return reference to typed message buffer
|
||||
|
Loading…
Reference in New Issue
Block a user