diff --git a/base-foc/src/core/arm/platform_arm.cc b/base-foc/src/core/arm/platform_arm.cc index 9ef144fc4..33877c19a 100644 --- a/base-foc/src/core/arm/platform_arm.cc +++ b/base-foc/src/core/arm/platform_arm.cc @@ -14,3 +14,5 @@ #include void Genode::Platform::_setup_io_port_alloc() { } + +void Genode::Platform::setup_irq_mode(unsigned irq_number) { } diff --git a/base-foc/src/core/include/platform.h b/base-foc/src/core/include/platform.h index 74356efb0..ae2b3b887 100644 --- a/base-foc/src/core/include/platform.h +++ b/base-foc/src/core/include/platform.h @@ -125,6 +125,11 @@ namespace Genode { */ Core_pager *core_pager(); + /** + * Set interrupt mode (e.g., level or edge) + */ + static void setup_irq_mode(unsigned irq_number); + /** * Constructor */ diff --git a/base-foc/src/core/irq_session_component.cc b/base-foc/src/core/irq_session_component.cc index 54fe8226a..9f7353aa9 100644 --- a/base-foc/src/core/irq_session_component.cc +++ b/base-foc/src/core/irq_session_component.cc @@ -20,6 +20,7 @@ /* core includes */ #include #include +#include #include /* Fiasco includes */ @@ -122,6 +123,9 @@ Irq_session_component::Irq_session_component(Cap_session *cap_session, if (l4_error(l4_icu_bind(L4_BASE_ICU_CAP, irq_number, _irq.capability()))) PERR("Binding IRQ%ld to the ICU failed", irq_number); + /* set interrupt mode */ + Platform::setup_irq_mode(irq_number); + if (l4_error(l4_irq_attach(_irq.capability(), irq_number, Interrupt_handler::handler_cap()))) PERR("Error attaching to IRQ %ld", irq_number); diff --git a/base-foc/src/core/x86/platform_x86.cc b/base-foc/src/core/x86/platform_x86.cc index b9f94bc4f..a788bedad 100644 --- a/base-foc/src/core/x86/platform_x86.cc +++ b/base-foc/src/core/x86/platform_x86.cc @@ -21,6 +21,7 @@ /* Fiasco.OC includes */ namespace Fiasco { #include +#include } void Genode::Platform::_setup_io_port_alloc() @@ -42,3 +43,14 @@ void Genode::Platform::_setup_io_port_alloc() /* setup allocator */ _io_port_alloc.add_range(0, 0x10000); } + + +void Genode::Platform::setup_irq_mode(unsigned irq_number) +{ + using namespace Fiasco; + + /* set IRQ below 16 to edge/high and others to level/low */ + l4_umword_t mode = irq_number < 16 ? L4_IRQ_F_POS_EDGE : L4_IRQ_F_LEVEL_LOW; + if (l4_error(l4_icu_set_mode(L4_BASE_ICU_CAP, irq_number, mode))) + PERR("Setting mode for IRQ%u failed", irq_number); +}