]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/dde/include/ddekit/interrupt.h
update
[l4.git] / l4 / pkg / dde / include / ddekit / interrupt.h
1 /*
2  * \brief   Hardware-interrupt subsystem
3  * \date    2007-01-26
4  *
5  * DDEKit supports registration of one handler function per interrupt. If any
6  * specific DDE implementation needs to register more than one handler,
7  * multiplexing has to be implemented there!
8  */
9
10 /*
11  * This file is part of DDEKit.
12  *
13  * (c) 2007-2012 Bjoern Doebel <doebel@os.inf.tu-dresden.de>
14  *               Christian Helmuth <ch12@os.inf.tu-dresden.de>
15  *               Thomas Friebel <tf13@os.inf.tu-dresden.de>
16  *     economic rights: Technische Universitaet Dresden (Germany)
17  *
18  * This file is part of TUD:OS and distributed under the terms of the
19  * GNU General Public License 2.
20  * Please see the COPYING-GPL-2 file for details.
21  */
22
23 #pragma once
24
25 #include <l4/sys/compiler.h>
26 #include <l4/dde/ddekit/thread.h>
27
28 EXTERN_C_BEGIN
29
30 #define DDEKIT_IRQ_PRIO         0x11
31
32 #define IRQF_TRIGGER_NONE       0x00000000
33 #define IRQF_TRIGGER_RISING     0x00000001
34 #define IRQF_TRIGGER_FALLING    0x00000002
35 #define IRQF_TRIGGER_HIGH       0x00000004
36 #define IRQF_TRIGGER_LOW        0x00000008
37 #define IRQF_TRIGGER_MASK       (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW | \
38                                  IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)
39 #define IRQF_TRIGGER_PROBE      0x00000010
40
41 /**
42  * Attach to hardware interrupt
43  *
44  * \param irq          IRQ number to attach to
45  * \param shared       set to 1 if interrupt sharing is supported; set to 0
46  *                     otherwise
47  * \param thread_init  called just after DDEKit internal init and before any
48  *                     other function
49  * \param handler      IRQ handler for interrupt irq
50  * \param priv         private token (argument for thread_init and handler)
51  *
52  * \return pointer to interrupt thread created
53  */
54 ddekit_thread_t *ddekit_interrupt_attach(int irq, int shared,
55                                          void(*thread_init)(void *),
56                                          void(*handler)(void *), void *priv);
57
58 /**
59  * Detach from a previously attached interrupt.
60  *
61  * \param irq          IRQ number
62  */
63 void ddekit_interrupt_detach(int irq);
64
65 /**
66  * Block interrupt.
67  *
68  * \param irq          IRQ number to block
69  */
70 void ddekit_interrupt_disable(int irq);
71
72 /**
73  * Enable interrupt.
74  *
75  * \param irq          IRQ number to block
76  */
77 void ddekit_interrupt_enable(int irq);
78
79 /**
80  * Set the trigger mode flags
81  *
82  * \param irq           IRQ number
83  * \param flags         
84  */
85 int ddekit_irq_set_type(int irq, unsigned flags);
86
87 /**
88  * Initialize internal data structures
89  */
90 void ddekit_init_irqs(void);
91
92 EXTERN_C_END