Preliminary irq registration call + irq capability checking

Need to add irqctrl capabilities and irq bits to device memory
caps.

Also need to initialize irq field of devmem caps.
This commit is contained in:
Bahadir Balban
2009-11-28 19:13:23 +02:00
parent b5e6c66426
commit 6e40a2b601
17 changed files with 380 additions and 110 deletions

View File

@@ -10,6 +10,7 @@
#include <l4/lib/bit.h>
#include <l4/drivers/irq/pl190/pl190_vic.h>
#include <l4/generic/irq.h>
/* FIXME: Fix the stupid uart driver and change to single definition of this! */
#if defined(read)
@@ -28,13 +29,16 @@
: clrbit(bitvect, (base + reg)))
/* Returns the irq number on this chip converting the irq bitvector */
int pl190_read_irq(void)
l4id_t pl190_read_irq(void)
{
/* This also correctly returns a negative value for a spurious irq. */
return 31 - __clz(read(PL190_VIC_IRQSTATUS));
l4id_t irq;
if ((irq =__clz(read(PL190_VIC_IRQSTATUS))))
return irq;
else
return IRQ_NIL;
}
void pl190_mask_irq(int irq)
void pl190_mask_irq(l4id_t irq)
{
/* Reading WO registers blows QEMU/PB926.
* setbit((1 << irq), PL190_VIC_INTENCLEAR); */
@@ -42,32 +46,37 @@ void pl190_mask_irq(int irq)
}
/* Ack is same as mask */
void pl190_ack_irq(int irq)
void pl190_ack_irq(l4id_t irq)
{
pl190_mask_irq(irq);
}
void pl190_unmask_irq(int irq)
void pl190_unmask_irq(l4id_t irq)
{
setbit(1 << irq, PL190_VIC_INTENABLE);
}
int pl190_sic_read_irq(void)
l4id_t pl190_sic_read_irq(void)
{
return 32 - __clz(read(PL190_SIC_STATUS));
l4id_t irq;
if ((irq =__clz(read(PL190_SIC_STATUS))))
return irq;
else
return IRQ_NIL;
}
void pl190_sic_mask_irq(int irq)
void pl190_sic_mask_irq(l4id_t irq)
{
write(1 << irq, PL190_SIC_ENCLR);
}
void pl190_sic_ack_irq(int irq)
void pl190_sic_ack_irq(l4id_t irq)
{
pl190_sic_mask_irq(irq);
}
void pl190_sic_unmask_irq(int irq)
void pl190_sic_unmask_irq(l4id_t irq)
{
setbit(1 << irq, PL190_SIC_ENSET);
}