mirror of
https://github.com/drasko/codezero.git
synced 2026-01-17 05:13:16 +01:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user