Fiasco.OC: Set interrupt mode in IRQ session

Set IRQ 0-15 to edget/high and 16-23 level low (x86 only). Fixes 
This commit is contained in:
Sebastian Sumpf 2012-03-16 14:47:41 +01:00 committed by Norman Feske
parent 207abe647b
commit 38e953d913
4 changed files with 23 additions and 0 deletions

View File

@ -14,3 +14,5 @@
#include <platform.h>
void Genode::Platform::_setup_io_port_alloc() { }
void Genode::Platform::setup_irq_mode(unsigned irq_number) { }

View File

@ -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
*/

View File

@ -20,6 +20,7 @@
/* core includes */
#include <irq_root.h>
#include <irq_session_component.h>
#include <platform.h>
#include <util.h>
/* 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);

View File

@ -21,6 +21,7 @@
/* Fiasco.OC includes */
namespace Fiasco {
#include <l4/sys/ipc.h>
#include <l4/sys/icu.h>
}
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);
}