mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 15:32:25 +00:00
Fiasco.OC: Set interrupt mode in IRQ session
Set IRQ 0-15 to edget/high and 16-23 level low (x86 only). Fixes #153
This commit is contained in:
parent
207abe647b
commit
38e953d913
base-foc/src/core
@ -14,3 +14,5 @@
|
||||
#include <platform.h>
|
||||
|
||||
void Genode::Platform::_setup_io_port_alloc() { }
|
||||
|
||||
void Genode::Platform::setup_irq_mode(unsigned irq_number) { }
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user