mirror of
https://github.com/genodelabs/genode.git
synced 2025-03-14 16:26:30 +00:00
parent
69e8e9f3f1
commit
916d036b58
@ -155,7 +155,7 @@ class Sculpt::Drivers::Instance : Noncopyable,
|
||||
_nic_driver .gen_start_node (xml);
|
||||
}
|
||||
|
||||
void with(With_storage_devices::Callback const &fn) const
|
||||
void with(With_storage_devices::Ft const &fn) const
|
||||
{
|
||||
_usb_driver.with_devices([&] (Xml_node const &usb_devices) {
|
||||
_ahci_driver.with_ports([&] (Xml_node const &ahci_ports) {
|
||||
@ -167,9 +167,9 @@ class Sculpt::Drivers::Instance : Noncopyable,
|
||||
.mmc = mmc_devices }); }); }); }); });
|
||||
}
|
||||
|
||||
void with(With_board_info::Callback const &fn) const { fn(_board_info); }
|
||||
void with_platform_info(With_xml::Callback const &fn) const { fn(_platform.xml()); }
|
||||
void with_fb_connectors(With_xml::Callback const &fn) const { _fb_driver.with_connectors(fn); }
|
||||
void with(With_board_info::Ft const &fn) const { fn(_board_info); }
|
||||
void with_platform_info(With_xml::Ft const &fn) const { fn(_platform.xml()); }
|
||||
void with_fb_connectors(With_xml::Ft const &fn) const { _fb_driver.with_connectors(fn); }
|
||||
|
||||
bool suspend_supported() const
|
||||
{
|
||||
@ -203,10 +203,10 @@ Sculpt::Drivers::Drivers(Env &env, Children &children, Info const &info, Action
|
||||
_instance(_construct_instance(env, children, info, action))
|
||||
{ }
|
||||
|
||||
void Drivers::_with(With_storage_devices::Callback const &fn) const { _instance.with(fn); }
|
||||
void Drivers::_with(With_board_info::Callback const &fn) const { _instance.with(fn); }
|
||||
void Drivers::_with_platform_info(With_xml::Callback const &fn) const { _instance.with_platform_info(fn); }
|
||||
void Drivers::_with_fb_connectors(With_xml::Callback const &fn) const { _instance.with_fb_connectors(fn); }
|
||||
void Drivers::_with(With_storage_devices::Ft const &fn) const { _instance.with(fn); }
|
||||
void Drivers::_with(With_board_info::Ft const &fn) const { _instance.with(fn); }
|
||||
void Drivers::_with_platform_info(With_xml::Ft const &fn) const { _instance.with_platform_info(fn); }
|
||||
void Drivers::_with_fb_connectors(With_xml::Ft const &fn) const { _instance.with_fb_connectors(fn); }
|
||||
|
||||
void Drivers::update_usb () { _instance.update_usb(); }
|
||||
void Drivers::update_soc (Board_info::Soc soc) { _instance.update_soc(soc); }
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
/* local includes */
|
||||
#include <xml.h>
|
||||
#include <util/callable.h>
|
||||
#include <model/child_state.h>
|
||||
#include <model/board_info.h>
|
||||
#include <driver/fb.h>
|
||||
@ -52,14 +53,14 @@ class Sculpt::Drivers : Noncopyable
|
||||
|
||||
static Instance &_construct_instance(auto &&...);
|
||||
|
||||
using With_storage_devices = With<Storage_devices const &>;
|
||||
using With_board_info = With<Board_info const &>;
|
||||
using With_xml = With<Xml_node const &>;
|
||||
using With_storage_devices = Callable<void, Storage_devices const &>;
|
||||
using With_board_info = Callable<void, Board_info const &>;
|
||||
using With_xml = Callable<void, Xml_node const &>;
|
||||
|
||||
void _with(With_storage_devices::Callback const &) const;
|
||||
void _with(With_board_info::Callback const &) const;
|
||||
void _with_platform_info(With_xml::Callback const &) const;
|
||||
void _with_fb_connectors(With_xml::Callback const &) const;
|
||||
void _with(With_storage_devices::Ft const &) const;
|
||||
void _with(With_board_info::Ft const &) const;
|
||||
void _with_platform_info(With_xml::Ft const &) const;
|
||||
void _with_fb_connectors(With_xml::Ft const &) const;
|
||||
|
||||
public:
|
||||
|
||||
@ -71,8 +72,8 @@ class Sculpt::Drivers : Noncopyable
|
||||
|
||||
void gen_start_nodes(Xml_generator &) const;
|
||||
|
||||
void with_storage_devices(auto const &fn) const { _with(With_storage_devices::Fn { fn }); }
|
||||
void with_board_info (auto const &fn) const { _with(With_board_info::Fn { fn }); }
|
||||
void with_storage_devices(auto const &fn) const { _with(With_storage_devices::Fn { fn }); }
|
||||
void with_board_info (auto const &fn) const { _with(With_board_info::Fn { fn }); }
|
||||
void with_platform_info (auto const &fn) const { _with_platform_info(With_xml::Fn { fn }); }
|
||||
void with_fb_connectors (auto const &fn) const { _with_fb_connectors(With_xml::Fn { fn }); }
|
||||
|
||||
|
@ -69,26 +69,6 @@ namespace Sculpt {
|
||||
*/
|
||||
struct Verify { bool value; };
|
||||
|
||||
/**
|
||||
* Utility for passing lambda arguments to non-template functions
|
||||
*/
|
||||
template <typename... ARGS>
|
||||
struct With
|
||||
{
|
||||
struct Callback : Interface
|
||||
{
|
||||
virtual void operator () (ARGS &&...) const = 0;
|
||||
};
|
||||
|
||||
template <typename FN>
|
||||
struct Fn : Callback
|
||||
{
|
||||
FN const &_fn;
|
||||
Fn(FN const &fn) : _fn(fn) { };
|
||||
void operator () (ARGS &&... args) const override { _fn(args...); }
|
||||
};
|
||||
};
|
||||
|
||||
struct Progress { bool progress; };
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user