xref: /dragonfly/sys/dev/drm/include/linux/interrupt.h (revision 1a05b9d1)
1 /*
2  * Copyright (c) 2017-2020 François Tigeot <ftigeot@wolfpond.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice unmodified, this list of conditions, and the following
10  *    disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  */
26 
27 #ifndef _LINUX_INTERRUPT_H_
28 #define _LINUX_INTERRUPT_H_
29 
30 #include <linux/kernel.h>
31 #include <linux/bitops.h>
32 #include <linux/preempt.h>
33 #include <linux/cpumask.h>
34 #include <linux/irqreturn.h>
35 #include <linux/hardirq.h>
36 #include <linux/irqflags.h>
37 #include <linux/hrtimer.h>
38 #include <linux/kref.h>
39 
40 #include <linux/atomic.h>
41 
42 #define IRQF_SHARED	0x00000080
43 
44 struct tasklet_struct {
45 	unsigned long state;
46 	void (*func)(unsigned long);
47 	unsigned long data;
48 };
49 
50 enum {
51 	TASKLET_STATE_SCHED,
52 	TASKLET_STATE_RUN,
53 	TASKLET_IS_DYING
54 };
55 
56 typedef irqreturn_t (*irq_handler_t)(int, void *);
57 
58 int request_irq(unsigned int irq, irq_handler_t handler,
59 		unsigned long flags, const char *name, void *dev);
60 
61 void free_irq(unsigned int irq, void *dev_id);
62 
63 void disable_irq(unsigned int irq);
64 void enable_irq(unsigned int irq);
65 
66 void tasklet_init(struct tasklet_struct *t,
67 		  void (*func)(unsigned long), unsigned long data);
68 void tasklet_schedule(struct tasklet_struct *t);
69 void tasklet_hi_schedule(struct tasklet_struct *t);
70 void tasklet_kill(struct tasklet_struct *t);
71 
72 #endif	/* _LINUX_INTERRUPT_H_ */
73