OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [src/] [drivers/] [irq/] [omap3/] [omap3_intc.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Interrupt Controller - Beagleboard
3
 *
4
 * Copyright 2010 B Labs Ltd.
5
 */
6
 
7
#include <l4/drivers/irq/omap3/omap3_intc.h>
8
#include INC_PLAT(offsets.h)
9
#include INC_PLAT(irq.h)
10
 
11
void omap3_intc_ack_irq(l4id_t irq)
12
{
13
        write(0x1, PLATFORM_INTC_VBASE + OMAP3_INTC_CONTROL);
14
}
15
 
16
void omap3_intc_mask_irq(l4id_t irq)
17
{
18
        omap3_intc_set_irq_status(PLATFORM_INTC_VBASE, OMAP3_INTC_MIR_SET, irq);
19
}
20
 
21
void omap3_intc_unmask_irq(l4id_t irq)
22
{
23
        omap3_intc_set_irq_status(PLATFORM_INTC_VBASE, OMAP3_INTC_MIR_CLR, irq);
24
}
25
 
26
/* End of Interrupt */
27
void omap3_intc_ack_and_mask(l4id_t irq)
28
{
29
        omap3_intc_mask_irq(irq);
30
        omap3_intc_ack_irq(irq);
31
}
32
 
33
l4id_t omap3_intc_read_irq(void *data)
34
{
35
        unsigned int irq = 0;
36
 
37
        if ((irq = (read(PLATFORM_INTC_VBASE + OMAP3_INTC_SIR_IRQ) & 0x7F)))
38
                return irq;
39
 
40
        return -1;
41
}
42
 
43
void omap3_intc_reset(unsigned long base)
44
{
45
        /* Assert Reset */
46
        write(OMAP_INTC_SOFTRESET, (base + OMAP3_INTC_SYSCONFIG));
47
 
48
        /* wait for completion */
49
         while (!(read((base + OMAP3_INTC_SYSSTATUS)) & 0x1));
50
}
51
 
52
void omap3_intc_init(void)
53
{
54
        int i;
55
 
56
        /* Do Soft-Reset */
57
        omap3_intc_reset(PLATFORM_INTC_VBASE);
58
 
59
        /*
60
         * Set All IRQ to IRQ type and
61
         * Priority as 0x0A- some random value
62
         */
63
        for (i = 0; i < IRQS_MAX; i++)
64
                omap3_intc_set_ilr(PLATFORM_INTC_VBASE, i, (0x0A << 2));
65
 
66
        /* Mask(set mask) all interrupts */
67
        for (i = 0; i < IRQS_MAX; i++)
68
                omap3_intc_set_irq_status(PLATFORM_INTC_VBASE,
69
                                          OMAP3_INTC_MIR_SET, i);
70
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.