mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-12 21:53:28 +00:00
parent
4aa33bce33
commit
5a9016b010
@ -41,9 +41,9 @@ namespace Audio_in {
|
||||
|
||||
namespace Audio {
|
||||
|
||||
void update_config(Genode::Env &, Genode::Xml_node);
|
||||
void update_config(Genode::Env &, Genode::Xml_node const &);
|
||||
|
||||
void init_driver(Genode::Env &, Genode::Allocator &, Genode::Xml_node,
|
||||
void init_driver(Genode::Env &, Genode::Allocator &, Genode::Xml_node const &,
|
||||
Genode::Signal_context_capability);
|
||||
|
||||
void play_sigh(Genode::Signal_context_capability cap);
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <base/env.h>
|
||||
#include <base/log.h>
|
||||
#include <os/reporter.h>
|
||||
#include <os/buffered_xml.h>
|
||||
#include <util/xml_node.h>
|
||||
|
||||
/* format-string includes */
|
||||
@ -387,7 +388,7 @@ static void report_mixer_state(Mixer &mixer, Genode::Env *env = nullptr)
|
||||
}
|
||||
|
||||
|
||||
static void configure_mixer(Genode::Env &env, Mixer &mixer, Genode::Xml_node config)
|
||||
static void configure_mixer(Genode::Env &env, Mixer &mixer, Genode::Xml_node const &config)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
@ -396,7 +397,7 @@ static void configure_mixer(Genode::Env &env, Mixer &mixer, Genode::Xml_node con
|
||||
Mic_mode mode = config.attribute_value("mic_priority", Mic_mode("external"));
|
||||
mic_priority_external = (mode == "internal") ? false : true;
|
||||
|
||||
config.for_each_sub_node("mixer", [&] (Xml_node node) {
|
||||
config.for_each_sub_node("mixer", [&] (Xml_node const &node) {
|
||||
|
||||
typedef String<32> Field;
|
||||
typedef String<16> Value;
|
||||
@ -412,7 +413,7 @@ static void configure_mixer(Genode::Env &env, Mixer &mixer, Genode::Xml_node con
|
||||
}
|
||||
|
||||
|
||||
static bool configure_audio_device(Genode::Env &env, dev_t dev, Genode::Xml_node config)
|
||||
static bool configure_audio_device(Genode::Env &env, dev_t dev, Genode::Xml_node const &config)
|
||||
{
|
||||
struct audio_swpar ap;
|
||||
|
||||
@ -478,14 +479,14 @@ namespace {
|
||||
{
|
||||
Genode::Env &env;
|
||||
Genode::Allocator &alloc;
|
||||
Genode::Xml_node config;
|
||||
Genode::Buffered_xml const config;
|
||||
Genode::Signal_context_capability announce_sigh;
|
||||
|
||||
Task_args(Genode::Env &env, Genode::Allocator &alloc,
|
||||
Genode::Xml_node config,
|
||||
Genode::Xml_node const &config,
|
||||
Genode::Signal_context_capability announce_sigh)
|
||||
:
|
||||
env(env), alloc(alloc), config(config),
|
||||
env(env), alloc(alloc), config(alloc, config),
|
||||
announce_sigh(announce_sigh)
|
||||
{ }
|
||||
};
|
||||
@ -516,7 +517,7 @@ namespace {
|
||||
|
||||
template <typename... ARGS>
|
||||
Task(Genode::Env &env, Genode::Allocator &alloc,
|
||||
Genode::Xml_node config,
|
||||
Genode::Xml_node const &config,
|
||||
Genode::Signal_context_capability announce_sigh)
|
||||
:
|
||||
_args { env, alloc, config, announce_sigh },
|
||||
@ -571,7 +572,7 @@ void run_bsd(void *p)
|
||||
}
|
||||
|
||||
adev_usuable = configure_audio_device(task->_args.env, adev,
|
||||
task->_args.config);
|
||||
task->_args.config.xml);
|
||||
|
||||
if (adev_usuable && task->_args.announce_sigh.valid()) {
|
||||
Genode::Signal_transmitter(task->_args.announce_sigh).submit();
|
||||
@ -633,7 +634,7 @@ extern "C" void notify_hp_sense(int const sense)
|
||||
** private Audio namespace **
|
||||
*****************************/
|
||||
|
||||
void Audio::update_config(Genode::Env &env, Genode::Xml_node config)
|
||||
void Audio::update_config(Genode::Env &env, Genode::Xml_node const &config)
|
||||
{
|
||||
if (mixer.info == nullptr) { return; }
|
||||
|
||||
@ -647,7 +648,7 @@ static Task *_bsd_task;
|
||||
|
||||
|
||||
void Audio::init_driver(Genode::Env &env, Genode::Allocator &alloc,
|
||||
Genode::Xml_node config,
|
||||
Genode::Xml_node const &config,
|
||||
Genode::Signal_context_capability announce_sigh)
|
||||
{
|
||||
Bsd::mem_init(env, alloc);
|
||||
|
@ -101,7 +101,7 @@ class Pci_driver
|
||||
bool device_list = false;
|
||||
while (!device_list) {
|
||||
pci.update();
|
||||
pci.with_xml([&] (Xml_node & xml) {
|
||||
pci.with_xml([&] (Xml_node const &xml) {
|
||||
if (xml.num_sub_nodes()) {
|
||||
pci.sigh(Signal_context_capability());
|
||||
if (handler.constructed())
|
||||
@ -153,15 +153,15 @@ class Pci_driver
|
||||
|
||||
bool found = false;
|
||||
_pci.update();
|
||||
_pci.with_xml([&] (Xml_node node) {
|
||||
node.for_each_sub_node("device", [&] (Xml_node node)
|
||||
_pci.with_xml([&] (Xml_node const &node) {
|
||||
node.for_each_sub_node("device", [&] (Xml_node const &node)
|
||||
{
|
||||
/* only use the first successfully probed device */
|
||||
if (found) return;
|
||||
|
||||
String<16> name = node.attribute_value("name", String<16>());
|
||||
|
||||
node.with_optional_sub_node("pci-config", [&] (Xml_node node)
|
||||
node.with_optional_sub_node("pci-config", [&] (Xml_node const &node)
|
||||
{
|
||||
_vendor_id = node.attribute_value("vendor_id", 0U);
|
||||
_device_id = node.attribute_value("device_id", 0U);
|
||||
|
@ -185,10 +185,10 @@ struct Pci_driver
|
||||
Pci_driver(Genode::Env &env) : _env(env)
|
||||
{
|
||||
_pci.update();
|
||||
_pci.with_xml([&] (Xml_node node) {
|
||||
node.with_optional_sub_node("device", [&] (Xml_node node)
|
||||
_pci.with_xml([&] (Xml_node const &node) {
|
||||
node.with_optional_sub_node("device", [&] (Xml_node const &node)
|
||||
{
|
||||
node.with_optional_sub_node("pci-config", [&] (Xml_node node)
|
||||
node.with_optional_sub_node("pci-config", [&] (Xml_node const &node)
|
||||
{
|
||||
_name = node.attribute_value("name", String<16>());
|
||||
_pci_info.vendor = node.attribute_value("vendor_id", 0U);
|
||||
@ -198,13 +198,13 @@ struct Pci_driver
|
||||
_pci_info.name = _name.string();
|
||||
});
|
||||
|
||||
node.with_optional_sub_node("io_mem", [&] (Xml_node node)
|
||||
node.with_optional_sub_node("io_mem", [&] (Xml_node const &node)
|
||||
{
|
||||
_mmio.construct(_dev);
|
||||
_pci_info.io_mem_addr = (addr_t)_mmio->local_addr<void>();
|
||||
});
|
||||
|
||||
node.with_optional_sub_node("io_port", [&] (Xml_node node)
|
||||
node.with_optional_sub_node("io_port", [&] (Xml_node const &node)
|
||||
{
|
||||
_io_port.construct(_dev);
|
||||
_pci_info.io_port_start = 0x10;
|
||||
|
@ -35,7 +35,7 @@ struct Usb::Led_state
|
||||
|
||||
Led_state(Genode::Env &env, Name const &name) : _env(env), _name(name) { }
|
||||
|
||||
void update(Genode::Xml_node config, Genode::Signal_context_capability sigh)
|
||||
void update(Genode::Xml_node const &config, Genode::Signal_context_capability sigh)
|
||||
{
|
||||
using Attr = Genode::String<32>;
|
||||
using Value = Genode::String<16>;
|
||||
|
@ -82,7 +82,7 @@ struct Main
|
||||
void handle_config()
|
||||
{
|
||||
config_rom.update();
|
||||
Genode::Xml_node config = config_rom.xml();
|
||||
Genode::Xml_node const &config = config_rom.xml();
|
||||
capslock.update(config, config_handler);
|
||||
numlock .update(config, config_handler);
|
||||
scrlock .update(config, config_handler);
|
||||
|
@ -25,9 +25,9 @@ unsigned short emul_intel_gmch_control_reg()
|
||||
using namespace Genode;
|
||||
|
||||
unsigned short ret = 0;
|
||||
Lx_kit::env().devices.with_xml([&] (Xml_node node) {
|
||||
node.for_each_sub_node("device", [&] (Xml_node node) {
|
||||
node.for_each_sub_node("pci-config", [&] (Xml_node node) {
|
||||
Lx_kit::env().devices.with_xml([&] (Xml_node const &node) {
|
||||
node.for_each_sub_node("device", [&] (Xml_node const &node) {
|
||||
node.for_each_sub_node("pci-config", [&] (Xml_node const &node) {
|
||||
unsigned short gmch =
|
||||
node.attribute_value<unsigned short>("intel_gmch_control", 0U);
|
||||
if (gmch) ret = gmch;
|
||||
|
@ -49,7 +49,7 @@ struct Verify::Main
|
||||
return Message();
|
||||
}
|
||||
|
||||
void _process_verify_node(Xml_node, Xml_generator &);
|
||||
void _process_verify_node(Xml_node const &, Xml_generator &);
|
||||
void _handle_config_with_libc();
|
||||
void _handle_config() { Libc::with_libc([&] () { _handle_config_with_libc(); }); }
|
||||
|
||||
@ -63,7 +63,7 @@ struct Verify::Main
|
||||
};
|
||||
|
||||
|
||||
void Verify::Main::_process_verify_node(Xml_node node, Xml_generator &xml)
|
||||
void Verify::Main::_process_verify_node(Xml_node const &node, Xml_generator &xml)
|
||||
{
|
||||
Path const data_path = node.attribute_value("path", Path());
|
||||
Path const pubkey_path = node.attribute_value("pubkey", Path());
|
||||
@ -86,7 +86,7 @@ void Verify::Main::_process_verify_node(Xml_node node, Xml_generator &xml)
|
||||
|
||||
void Verify::Main::_handle_config_with_libc()
|
||||
{
|
||||
Xml_node const config = _config.xml();
|
||||
Xml_node const &config = _config.xml();
|
||||
|
||||
_verbose = _config.xml().attribute_value("verbose", false);
|
||||
|
||||
@ -95,7 +95,7 @@ void Verify::Main::_handle_config_with_libc()
|
||||
}
|
||||
|
||||
_reporter->generate([&] (Xml_generator &xml) {
|
||||
config.for_each_sub_node("verify", [&] (Xml_node node) {
|
||||
config.for_each_sub_node("verify", [&] (Xml_node const &node) {
|
||||
_process_verify_node(node, xml); }); });
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user