xref: /dflybsd-src/sys/dev/drm/include/linux/interrupt.h (revision 77a6b00ef8ace2311e2ca8ea29f7c9828b88614b)
11e59d133SFrançois Tigeot /*
2*77a6b00eSFrançois Tigeot  * Copyright (c) 2017-2020 François Tigeot <ftigeot@wolfpond.org>
31e59d133SFrançois Tigeot  * All rights reserved.
41e59d133SFrançois Tigeot  *
51e59d133SFrançois Tigeot  * Redistribution and use in source and binary forms, with or without
61e59d133SFrançois Tigeot  * modification, are permitted provided that the following conditions
71e59d133SFrançois Tigeot  * are met:
81e59d133SFrançois Tigeot  * 1. Redistributions of source code must retain the above copyright
91e59d133SFrançois Tigeot  *    notice unmodified, this list of conditions, and the following
101e59d133SFrançois Tigeot  *    disclaimer.
111e59d133SFrançois Tigeot  * 2. Redistributions in binary form must reproduce the above copyright
121e59d133SFrançois Tigeot  *    notice, this list of conditions and the following disclaimer in the
131e59d133SFrançois Tigeot  *    documentation and/or other materials provided with the distribution.
141e59d133SFrançois Tigeot  *
151e59d133SFrançois Tigeot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
161e59d133SFrançois Tigeot  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
171e59d133SFrançois Tigeot  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
181e59d133SFrançois Tigeot  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
191e59d133SFrançois Tigeot  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
201e59d133SFrançois Tigeot  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
211e59d133SFrançois Tigeot  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
221e59d133SFrançois Tigeot  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
231e59d133SFrançois Tigeot  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
241e59d133SFrançois Tigeot  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
251e59d133SFrançois Tigeot  */
261e59d133SFrançois Tigeot 
271e59d133SFrançois Tigeot #ifndef _LINUX_INTERRUPT_H_
281e59d133SFrançois Tigeot #define _LINUX_INTERRUPT_H_
291e59d133SFrançois Tigeot 
301e59d133SFrançois Tigeot #include <linux/kernel.h>
311e59d133SFrançois Tigeot #include <linux/bitops.h>
32237ffc69SFrançois Tigeot #include <linux/preempt.h>
33d6aa1cc5SFrançois Tigeot #include <linux/cpumask.h>
34de2d8016SFrançois Tigeot #include <linux/irqreturn.h>
351334141fSFrançois Tigeot #include <linux/hardirq.h>
36de2d8016SFrançois Tigeot #include <linux/irqflags.h>
375915b712SFrançois Tigeot #include <linux/hrtimer.h>
381e59d133SFrançois Tigeot #include <linux/kref.h>
391e59d133SFrançois Tigeot 
401e59d133SFrançois Tigeot #include <linux/atomic.h>
411e59d133SFrançois Tigeot 
42183e2373SFrançois Tigeot #define IRQF_SHARED	0x00000080
43183e2373SFrançois Tigeot 
441e59d133SFrançois Tigeot struct tasklet_struct {
451e59d133SFrançois Tigeot 	unsigned long state;
461e59d133SFrançois Tigeot 	void (*func)(unsigned long);
471e59d133SFrançois Tigeot 	unsigned long data;
481e59d133SFrançois Tigeot };
491e59d133SFrançois Tigeot 
501e59d133SFrançois Tigeot enum {
511e59d133SFrançois Tigeot 	TASKLET_STATE_SCHED,
52*77a6b00eSFrançois Tigeot 	TASKLET_STATE_RUN,
53*77a6b00eSFrançois Tigeot 	TASKLET_IS_DYING
541e59d133SFrançois Tigeot };
551e59d133SFrançois Tigeot 
56183e2373SFrançois Tigeot typedef irqreturn_t (*irq_handler_t)(int, void *);
57183e2373SFrançois Tigeot 
58183e2373SFrançois Tigeot int request_irq(unsigned int irq, irq_handler_t handler,
59183e2373SFrançois Tigeot 		unsigned long flags, const char *name, void *dev);
60183e2373SFrançois Tigeot 
61183e2373SFrançois Tigeot void free_irq(unsigned int irq, void *dev_id);
62183e2373SFrançois Tigeot 
63bb7b9e8bSFrançois Tigeot void disable_irq(unsigned int irq);
64bb7b9e8bSFrançois Tigeot void enable_irq(unsigned int irq);
65bb7b9e8bSFrançois Tigeot 
66*77a6b00eSFrançois Tigeot void tasklet_init(struct tasklet_struct *t,
67*77a6b00eSFrançois Tigeot 		  void (*func)(unsigned long), unsigned long data);
68*77a6b00eSFrançois Tigeot void tasklet_schedule(struct tasklet_struct *t);
69*77a6b00eSFrançois Tigeot void tasklet_hi_schedule(struct tasklet_struct *t);
70*77a6b00eSFrançois Tigeot void tasklet_kill(struct tasklet_struct *t);
71*77a6b00eSFrançois Tigeot 
721e59d133SFrançois Tigeot #endif	/* _LINUX_INTERRUPT_H_ */
73