source: GPL/trunk/include/linux/interrupt.h@ 438

Last change on this file since 438 was 438, checked in by Paul Smedley, 16 years ago

Move definitions from config.h to interrupt.h

File size: 4.0 KB
Line 
1/* interrupt.h */
2#ifndef _LINUX_INTERRUPT_H
3#define _LINUX_INTERRUPT_H
4
5#include <linux/kernel.h>
6//#include <asm/bitops.h>
7#include <asm/atomic.h>
8
9/*
10 * For 2.4.x compatibility, 2.4.x can use
11 *
12 * typedef void irqreturn_t;
13 * #define IRQ_NONE
14 * #define IRQ_HANDLED
15 * #define IRQ_RETVAL(x)
16 *
17 * To mix old-style and new-style irq handler returns.
18 *
19 * IRQ_NONE means we didn't handle it.
20 * IRQ_HANDLED means that we did have a valid interrupt and handled it.
21 * IRQ_RETVAL(x) selects on the two depending on x being non-zero (for handled)
22 */
23typedef int irqreturn_t;
24
25#define IRQ_NONE (0)
26#define IRQ_HANDLED (1)
27#define IRQ_RETVAL(x) ((x) != 0)
28
29struct irqaction {
30 void (*handler)(int, void *, struct pt_regs *);
31 unsigned long flags;
32 unsigned long mask;
33 const char *name;
34 void *dev_id;
35 struct irqaction *next;
36};
37
38extern volatile unsigned char bh_running;
39
40extern atomic_t bh_mask_count[32];
41extern unsigned long bh_active;
42extern unsigned long bh_mask;
43extern void (*bh_base[32])(void);
44
45void do_bottom_half(void);
46
47/* Who gets which entry in bh_base. Things which will occur most often
48 should come first - in which case NET should be up the top with SERIAL/TQUEUE! */
49
50enum {
51 TIMER_BH = 0,
52 CONSOLE_BH,
53 TQUEUE_BH,
54 DIGI_BH,
55 SERIAL_BH,
56 RISCOM8_BH,
57 SPECIALIX_BH,
58 AURORA_BH,
59 ESP_BH,
60 NET_BH,
61 SCSI_BH,
62 IMMEDIATE_BH,
63 KEYBOARD_BH,
64 CYCLADES_BH,
65 CM206_BH,
66 JS_BH,
67 MACSERIAL_BH,
68 ISICOM_BH
69};
70/* Tasklets --- multithreaded analogue of BHs.
71
72 Main feature differing them of generic softirqs: tasklet
73 is running only on one CPU simultaneously.
74
75 Main feature differing them of BHs: different tasklets
76 may be run simultaneously on different CPUs.
77
78 Properties:
79 * If tasklet_schedule() is called, then tasklet is guaranteed
80 to be executed on some cpu at least once after this.
81 * If the tasklet is already scheduled, but its excecution is still not
82 started, it will be executed only once.
83 * If this tasklet is already running on another CPU (or schedule is called
84 from tasklet itself), it is rescheduled for later.
85 * Tasklet is strictly serialized wrt itself, but not
86 wrt another tasklets. If client needs some intertask synchronization,
87 he makes it with spinlocks.
88 */
89
90struct tasklet_struct {
91 struct tasklet_struct *next; /* linked list of active bh's */
92 unsigned long sync; /* must be initialized to zero */
93 void (*func)(void *); /* function to call */
94 void *data; /* argument to function */
95};
96
97extern void tasklet_hi_schedule(struct tasklet_struct *t);
98
99#define tasklet_schedule tasklet_hi_schedule
100
101extern void tasklet_init(struct tasklet_struct *t,
102 void (*func)(unsigned long), unsigned long data);
103
104/*
105 * Autoprobing for irqs:
106 *
107 * probe_irq_on() and probe_irq_off() provide robust primitives
108 * for accurate IRQ probing during kernel initialization. They are
109 * reasonably simple to use, are not "fooled" by spurious interrupts,
110 * and, unlike other attempts at IRQ probing, they do not get hung on
111 * stuck interrupts (such as unused PS2 mouse interfaces on ASUS boards).
112 *
113 * For reasonably foolproof probing, use them as follows:
114 *
115 * 1. clear and/or mask the device's internal interrupt.
116 * 2. sti();
117 * 3. irqs = probe_irq_on(); // "take over" all unassigned idle IRQs
118 * 4. enable the device and cause it to trigger an interrupt.
119 * 5. wait for the device to interrupt, using non-intrusive polling or a delay.
120 * 6. irq = probe_irq_off(irqs); // get IRQ number, 0=none, negative=multiple
121 * 7. service the device to clear its pending interrupt.
122 * 8. loop again if paranoia is required.
123 *
124 * probe_irq_on() returns a mask of allocated irq's.
125 *
126 * probe_irq_off() takes the mask as a parameter,
127 * and returns the irq number which occurred,
128 * or zero if none occurred, or a negative irq number
129 * if more than one irq occurred.
130 */
131extern unsigned long probe_irq_on(void); /* returns 0 on failure */
132extern int probe_irq_off(unsigned long); /* returns 0 or negative on failure */
133
134#endif
Note: See TracBrowser for help on using the repository browser.