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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [linux/] [interrupt.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
/* interrupt.h */
2
#ifndef _LINUX_INTERRUPT_H
3
#define _LINUX_INTERRUPT_H
4
 
5
#include <linux/kernel.h>
6
#include <asm/bitops.h>
7
 
8
struct irqaction {
9
        void (*handler)(int, void *, struct pt_regs *);
10
        unsigned long flags;
11
        unsigned long mask;
12
        const char *name;
13
        void *dev_id;
14
        struct irqaction *next;
15
};
16
 
17
extern unsigned long intr_count;
18
 
19
extern int bh_mask_count[32];
20
extern unsigned long bh_active;
21
extern unsigned long bh_mask;
22
extern void (*bh_base[32])(void);
23
 
24
asmlinkage void do_bottom_half(void);
25
 
26
/* Who gets which entry in bh_base.  Things which will occur most often
27
   should come first - in which case NET should be up the top with SERIAL/TQUEUE! */
28
 
29
enum {
30
        TIMER_BH = 0,
31
        CONSOLE_BH,
32
        TQUEUE_BH,
33
        DIGI_BH,
34
        SERIAL_BH,
35
        RISCOM8_BH,
36
        SPECIALIX_BH,
37
        BAYCOM_BH,
38
        NET_BH,
39
        IMMEDIATE_BH,
40
        KEYBOARD_BH,
41
        CYCLADES_BH,
42
        CM206_BH,
43
        ISICOM_BH
44
};
45
 
46
extern inline void init_bh(int nr, void (*routine)(void))
47
{
48
        bh_base[nr] = routine;
49
        bh_mask_count[nr] = 0;
50
        bh_mask |= 1 << nr;
51
}
52
 
53
extern inline void mark_bh(int nr)
54
{
55
        set_bit(nr, &bh_active);
56
}
57
 
58
/*
59
 * These use a mask count to correctly handle
60
 * nested disable/enable calls
61
 */
62
extern inline void disable_bh(int nr)
63
{
64
        bh_mask &= ~(1 << nr);
65
        bh_mask_count[nr]++;
66
}
67
 
68
extern inline void enable_bh(int nr)
69
{
70
        if (!--bh_mask_count[nr])
71
                bh_mask |= 1 << nr;
72
}
73
 
74
/*
75
 * start_bh_atomic/end_bh_atomic also nest
76
 * naturally by using a counter
77
 */
78
extern inline void start_bh_atomic(void)
79
{
80
        intr_count++;
81
        barrier();
82
}
83
 
84
extern inline void end_bh_atomic(void)
85
{
86
        barrier();
87
        intr_count--;
88
}
89
 
90
/*
91
 * Autoprobing for irqs:
92
 *
93
 * probe_irq_on() and probe_irq_off() provide robust primitives
94
 * for accurate IRQ probing during kernel initialization.  They are
95
 * reasonably simple to use, are not "fooled" by spurious interrupts,
96
 * and, unlike other attempts at IRQ probing, they do not get hung on
97
 * stuck interrupts (such as unused PS2 mouse interfaces on ASUS boards).
98
 *
99
 * For reasonably foolproof probing, use them as follows:
100
 *
101
 * 1. clear and/or mask the device's internal interrupt.
102
 * 2. sti();
103
 * 3. irqs = probe_irq_on();      // "take over" all unassigned idle IRQs
104
 * 4. enable the device and cause it to trigger an interrupt.
105
 * 5. wait for the device to interrupt, using non-intrusive polling or a delay.
106
 * 6. irq = probe_irq_off(irqs);  // get IRQ number, 0=none, negative=multiple
107
 * 7. service the device to clear its pending interrupt.
108
 * 8. loop again if paranoia is required.
109
 *
110
 * probe_irq_on() returns a mask of allocated irq's.
111
 *
112
 * probe_irq_off() takes the mask as a parameter,
113
 * and returns the irq number which occurred,
114
 * or zero if none occurred, or a negative irq number
115
 * if more than one irq occurred.
116
 */
117
extern unsigned long probe_irq_on(void);        /* returns 0 on failure */
118
extern int probe_irq_off(unsigned long);        /* returns 0 or negative on failure */
119
 
120
#endif

powered by: WebSVN 2.1.0

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