mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-24 15:56:41 +00:00
parent
bb26a986e6
commit
046ebc3d34
@ -7,6 +7,7 @@
|
|||||||
<event/>
|
<event/>
|
||||||
<nic/>
|
<nic/>
|
||||||
<uplink/>
|
<uplink/>
|
||||||
|
<rom/>
|
||||||
</provides>
|
</provides>
|
||||||
|
|
||||||
<config>
|
<config>
|
||||||
@ -16,6 +17,7 @@
|
|||||||
<event/>
|
<event/>
|
||||||
<nic/>
|
<nic/>
|
||||||
<uplink/>
|
<uplink/>
|
||||||
|
<rom/>
|
||||||
</config>
|
</config>
|
||||||
|
|
||||||
<content>
|
<content>
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
<start name="black_hole" caps="100">
|
<start name="black_hole" caps="100">
|
||||||
<resource name="RAM" quantum="1M"/>
|
<resource name="RAM" quantum="1M"/>
|
||||||
<provides>
|
<provides>
|
||||||
|
<service name="ROM"/>
|
||||||
<service name="Uplink"/>
|
<service name="Uplink"/>
|
||||||
<service name="Nic"/>
|
<service name="Nic"/>
|
||||||
<service name="Event"/>
|
<service name="Event"/>
|
||||||
@ -38,6 +39,7 @@
|
|||||||
<service name="Audio_out"/>
|
<service name="Audio_out"/>
|
||||||
</provides>
|
</provides>
|
||||||
<config>
|
<config>
|
||||||
|
<rom/>
|
||||||
<uplink/>
|
<uplink/>
|
||||||
<nic/>
|
<nic/>
|
||||||
<event/>
|
<event/>
|
||||||
@ -57,16 +59,17 @@
|
|||||||
<start name="test-black_hole" caps="100">
|
<start name="test-black_hole" caps="100">
|
||||||
<resource name="RAM" quantum="10M"/>
|
<resource name="RAM" quantum="10M"/>
|
||||||
<route>
|
<route>
|
||||||
<service name="Uplink"> <child name="black_hole"/> </service>
|
<service name="ROM" label="any_label"> <child name="black_hole"/> </service>
|
||||||
<service name="Nic"> <child name="black_hole"/> </service>
|
<service name="Uplink"> <child name="black_hole"/> </service>
|
||||||
<service name="Event"> <child name="black_hole"/> </service>
|
<service name="Nic"> <child name="black_hole"/> </service>
|
||||||
<service name="Capture"> <child name="black_hole"/> </service>
|
<service name="Event"> <child name="black_hole"/> </service>
|
||||||
<service name="Audio_in"> <child name="black_hole"/> </service>
|
<service name="Capture"> <child name="black_hole"/> </service>
|
||||||
<service name="Audio_out"> <child name="black_hole"/> </service>
|
<service name="Audio_in"> <child name="black_hole"/> </service>
|
||||||
<service name="ROM"> <parent/> </service>
|
<service name="Audio_out"> <child name="black_hole"/> </service>
|
||||||
<service name="PD"> <parent/> </service>
|
<service name="ROM" > <parent/> </service>
|
||||||
<service name="LOG"> <parent/> </service>
|
<service name="PD"> <parent/> </service>
|
||||||
<service name="CPU"> <parent/> </service>
|
<service name="LOG"> <parent/> </service>
|
||||||
|
<service name="CPU"> <parent/> </service>
|
||||||
</route>
|
</route>
|
||||||
</start>
|
</start>
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ in the configuration of the component:
|
|||||||
* Event
|
* Event
|
||||||
* Nic
|
* Nic
|
||||||
* Uplink
|
* Uplink
|
||||||
|
* ROM
|
||||||
|
|
||||||
<config>
|
<config>
|
||||||
<audio_in/>
|
<audio_in/>
|
||||||
@ -18,4 +19,5 @@ in the configuration of the component:
|
|||||||
<event/>
|
<event/>
|
||||||
<nic/>
|
<nic/>
|
||||||
<uplink/>
|
<uplink/>
|
||||||
|
<rom/>
|
||||||
</config>
|
</config>
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
<xs:element name="config">
|
<xs:element name="config">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:element name="rom"/>
|
||||||
<xs:element name="uplink"/>
|
<xs:element name="uplink"/>
|
||||||
<xs:element name="nic"/>
|
<xs:element name="nic"/>
|
||||||
<xs:element name="event"/>
|
<xs:element name="event"/>
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "nic.h"
|
#include "nic.h"
|
||||||
#include "uplink.h"
|
#include "uplink.h"
|
||||||
|
#include "rom.h"
|
||||||
|
|
||||||
|
|
||||||
/***************
|
/***************
|
||||||
@ -47,6 +48,7 @@ struct Black_hole::Main
|
|||||||
Genode::Constructible<Event_root> event_root { };
|
Genode::Constructible<Event_root> event_root { };
|
||||||
Genode::Constructible<Nic_root> nic_root { };
|
Genode::Constructible<Nic_root> nic_root { };
|
||||||
Genode::Constructible<Uplink_root> uplink_root { };
|
Genode::Constructible<Uplink_root> uplink_root { };
|
||||||
|
Genode::Constructible<Rom_root> rom_root { };
|
||||||
|
|
||||||
Main(Genode::Env &env) : env(env)
|
Main(Genode::Env &env) : env(env)
|
||||||
{
|
{
|
||||||
@ -56,12 +58,10 @@ struct Black_hole::Main
|
|||||||
audio_in_root.construct(env, heap);
|
audio_in_root.construct(env, heap);
|
||||||
env.parent().announce(env.ep().manage(*audio_in_root));
|
env.parent().announce(env.ep().manage(*audio_in_root));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_config_rom.xml().has_sub_node("audio_out")) {
|
if (_config_rom.xml().has_sub_node("audio_out")) {
|
||||||
audio_out_root.construct(env, heap);
|
audio_out_root.construct(env, heap);
|
||||||
env.parent().announce(env.ep().manage(*audio_out_root));
|
env.parent().announce(env.ep().manage(*audio_out_root));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_config_rom.xml().has_sub_node("capture")) {
|
if (_config_rom.xml().has_sub_node("capture")) {
|
||||||
capture_root.construct(env, heap);
|
capture_root.construct(env, heap);
|
||||||
env.parent().announce(env.ep().manage(*capture_root));
|
env.parent().announce(env.ep().manage(*capture_root));
|
||||||
@ -70,16 +70,18 @@ struct Black_hole::Main
|
|||||||
event_root.construct(env, heap);
|
event_root.construct(env, heap);
|
||||||
env.parent().announce(env.ep().manage(*event_root));
|
env.parent().announce(env.ep().manage(*event_root));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_config_rom.xml().has_sub_node("nic")) {
|
if (_config_rom.xml().has_sub_node("nic")) {
|
||||||
nic_root.construct(env, heap);
|
nic_root.construct(env, heap);
|
||||||
env.parent().announce(env.ep().manage(*nic_root));
|
env.parent().announce(env.ep().manage(*nic_root));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_config_rom.xml().has_sub_node("uplink")) {
|
if (_config_rom.xml().has_sub_node("uplink")) {
|
||||||
uplink_root.construct(env, heap);
|
uplink_root.construct(env, heap);
|
||||||
env.parent().announce(env.ep().manage(*uplink_root));
|
env.parent().announce(env.ep().manage(*uplink_root));
|
||||||
}
|
}
|
||||||
|
if (_config_rom.xml().has_sub_node("rom")) {
|
||||||
|
rom_root.construct(env, heap);
|
||||||
|
env.parent().announce(env.ep().manage(*rom_root));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
91
repos/os/src/server/black_hole/rom.h
Normal file
91
repos/os/src/server/black_hole/rom.h
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* \brief ROM session component and root
|
||||||
|
* \author Martin Stein
|
||||||
|
* \date 2022-03-11
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2022 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ROM_H_
|
||||||
|
#define _ROM_H_
|
||||||
|
|
||||||
|
/* base includes */
|
||||||
|
#include <base/attached_ram_dataspace.h>
|
||||||
|
#include <rom_session/rom_session.h>
|
||||||
|
#include <root/component.h>
|
||||||
|
|
||||||
|
namespace Black_hole {
|
||||||
|
|
||||||
|
using namespace Genode;
|
||||||
|
|
||||||
|
class Rom_session;
|
||||||
|
class Rom_root;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Black_hole::Rom_session : public Session_object<Genode::Rom_session>
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
enum { RAM_DS_SIZE = 16 };
|
||||||
|
|
||||||
|
Env &_env;
|
||||||
|
Attached_ram_dataspace _ram_ds { _env.ram(), _env.rm(), RAM_DS_SIZE };
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Rom_session(Env &env,
|
||||||
|
Resources const &resources,
|
||||||
|
Label const &label,
|
||||||
|
Diag const &diag)
|
||||||
|
:
|
||||||
|
Session_object(env.ep(), resources, label, diag),
|
||||||
|
_env { env }
|
||||||
|
{
|
||||||
|
copy_cstring(_ram_ds.local_addr<char>(), "<empty/>", RAM_DS_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rom_dataspace_capability dataspace() override
|
||||||
|
{
|
||||||
|
return
|
||||||
|
static_cap_cast<Rom_dataspace>(
|
||||||
|
static_cap_cast<Dataspace>(_ram_ds.cap()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void sigh(Signal_context_capability /* sigh */) override { }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Black_hole::Rom_root : public Root_component<Rom_session>
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
Env &_env;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
Rom_session *_create_session(const char *args) override
|
||||||
|
{
|
||||||
|
return new (md_alloc())
|
||||||
|
Rom_session {
|
||||||
|
_env, session_resources_from_args(args),
|
||||||
|
session_label_from_args(args),
|
||||||
|
session_diag_from_args(args) };
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Rom_root(Env &env,
|
||||||
|
Allocator &alloc)
|
||||||
|
:
|
||||||
|
Root_component<Rom_session> { &env.ep().rpc_ep(), &alloc },
|
||||||
|
_env { env }
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* _ROM_H_ */
|
@ -19,6 +19,8 @@
|
|||||||
#include <base/component.h>
|
#include <base/component.h>
|
||||||
#include <base/heap.h>
|
#include <base/heap.h>
|
||||||
#include <util/reconstructible.h>
|
#include <util/reconstructible.h>
|
||||||
|
#include <rom_session/connection.h>
|
||||||
|
#include <base/attached_rom_dataspace.h>
|
||||||
|
|
||||||
/* os includes */
|
/* os includes */
|
||||||
#include <event_session/connection.h>
|
#include <event_session/connection.h>
|
||||||
@ -38,6 +40,7 @@ namespace Black_hole_test {
|
|||||||
class Uplink_test;
|
class Uplink_test;
|
||||||
class Capture_test;
|
class Capture_test;
|
||||||
class Event_test;
|
class Event_test;
|
||||||
|
class Rom_test;
|
||||||
class Main;
|
class Main;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,6 +298,35 @@ class Black_hole_test::Event_test
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Black_hole_test::Rom_test
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
Env &_env;
|
||||||
|
Attached_rom_dataspace _rom_ds { _env, "any_label" };
|
||||||
|
bool _finished { false };
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Rom_test(Env &env)
|
||||||
|
:
|
||||||
|
_env { env }
|
||||||
|
{
|
||||||
|
String<16> const str { Cstring { _rom_ds.local_addr<char>() } };
|
||||||
|
if (str != "<empty/>") {
|
||||||
|
class Unexpected_rom_content { };
|
||||||
|
throw Unexpected_rom_content { };
|
||||||
|
}
|
||||||
|
_finished = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool finished() const
|
||||||
|
{
|
||||||
|
return _finished;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class Black_hole_test::Main
|
class Black_hole_test::Main
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -308,6 +340,7 @@ class Black_hole_test::Main
|
|||||||
Uplink_test _uplink_test { _env, _heap, _signal_handler };
|
Uplink_test _uplink_test { _env, _heap, _signal_handler };
|
||||||
Capture_test _capture_test { _env };
|
Capture_test _capture_test { _env };
|
||||||
Event_test _event_test { _env };
|
Event_test _event_test { _env };
|
||||||
|
Rom_test _rom_test { _env };
|
||||||
|
|
||||||
void _handle_signal()
|
void _handle_signal()
|
||||||
{
|
{
|
||||||
@ -321,7 +354,8 @@ class Black_hole_test::Main
|
|||||||
if (_nic_test.finished() &&
|
if (_nic_test.finished() &&
|
||||||
_uplink_test.finished() &&
|
_uplink_test.finished() &&
|
||||||
_capture_test.finished() &&
|
_capture_test.finished() &&
|
||||||
_event_test.finished()) {
|
_event_test.finished() &&
|
||||||
|
_rom_test.finished()) {
|
||||||
|
|
||||||
log("Finished");
|
log("Finished");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user