Xenomai  3.0.8
intr.h
1 /*
2  * Copyright (C) 2001,2002,2003 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * Xenomai is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published
6  * by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  *
9  * Xenomai is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Xenomai; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17  * 02111-1307, USA.
18  */
19 #ifndef _COBALT_KERNEL_INTR_H
20 #define _COBALT_KERNEL_INTR_H
21 
22 #include <linux/spinlock.h>
23 #include <cobalt/kernel/stat.h>
24 
30 /* Possible return values of a handler. */
31 #define XN_IRQ_NONE 0x1
32 #define XN_IRQ_HANDLED 0x2
33 #define XN_IRQ_STATMASK (XN_IRQ_NONE|XN_IRQ_HANDLED)
34 #define XN_IRQ_PROPAGATE 0x100
35 #define XN_IRQ_DISABLE 0x200
36 
37 /* Init flags. */
38 #define XN_IRQTYPE_SHARED 0x1
39 #define XN_IRQTYPE_EDGE 0x2
40 
41 /* Status bits. */
42 #define XN_IRQSTAT_ATTACHED 0
43 #define _XN_IRQSTAT_ATTACHED (1 << XN_IRQSTAT_ATTACHED)
44 #define XN_IRQSTAT_DISABLED 1
45 #define _XN_IRQSTAT_DISABLED (1 << XN_IRQSTAT_DISABLED)
46 
47 struct xnintr;
48 struct xnsched;
49 
50 typedef int (*xnisr_t)(struct xnintr *intr);
51 
52 typedef void (*xniack_t)(unsigned irq, void *arg);
53 
54 struct xnirqstat {
56  xnstat_counter_t hits;
58  xnstat_exectime_t account;
60  xnstat_exectime_t sum;
61 };
62 
63 struct xnintr {
64 #ifdef CONFIG_XENO_OPT_SHIRQ
65 
66  struct xnintr *next;
67 #endif
68 
69  unsigned int unhandled;
71  xnisr_t isr;
73  void *cookie;
75  unsigned long status;
77  int flags;
79  unsigned int irq;
81  xniack_t iack;
83  const char *name;
85  raw_spinlock_t lock;
86 #ifdef CONFIG_XENO_OPT_STATS
87 
88  struct xnirqstat *stats;
89 #endif
90 };
91 
92 struct xnintr_iterator {
93  int cpu;
94  unsigned long hits;
95  xnticks_t exectime_period;
96  xnticks_t account_period;
97  xnticks_t exectime_total;
98  int list_rev;
99  struct xnintr *prev;
100 };
101 
102 extern struct xnintr nktimer;
103 
104 int xnintr_mount(void);
105 
106 void xnintr_core_clock_handler(void);
107 
108 void xnintr_host_tick(struct xnsched *sched);
109 
110 void xnintr_init_proc(void);
111 
112 void xnintr_cleanup_proc(void);
113 
114  /* Public interface. */
115 
116 int xnintr_init(struct xnintr *intr,
117  const char *name,
118  unsigned irq,
119  xnisr_t isr,
120  xniack_t iack,
121  int flags);
122 
123 void xnintr_destroy(struct xnintr *intr);
124 
125 int xnintr_attach(struct xnintr *intr,
126  void *cookie);
127 
128 void xnintr_detach(struct xnintr *intr);
129 
130 void xnintr_enable(struct xnintr *intr);
131 
132 void xnintr_disable(struct xnintr *intr);
133 
134 void xnintr_affinity(struct xnintr *intr,
135  cpumask_t cpumask);
136 
137 int xnintr_query_init(struct xnintr_iterator *iterator);
138 
139 int xnintr_get_query_lock(void);
140 
141 void xnintr_put_query_lock(void);
142 
143 int xnintr_query_next(int irq, struct xnintr_iterator *iterator,
144  char *name_buf);
145 
148 #endif /* !_COBALT_KERNEL_INTR_H */
void xnintr_enable(struct xnintr *intr)
Enable an interrupt line.
Definition: intr.c:892
void xnintr_detach(struct xnintr *intr)
Detach an interrupt descriptor.
Definition: intr.c:866
void xnintr_disable(struct xnintr *intr)
Disable an interrupt line.
Definition: intr.c:923
int xnintr_init(struct xnintr *intr, const char *name, unsigned int irq, xnisr_t isr, xniack_t iack, int flags)
Initialize an interrupt descriptor.
Definition: intr.c:736
Scheduling information structure.
Definition: sched.h:58
void xnintr_affinity(struct xnintr *intr, cpumask_t cpumask)
Set processor affinity of interrupt.
Definition: intr.c:963
int xnintr_attach(struct xnintr *intr, void *cookie)
Attach an interrupt descriptor.
Definition: intr.c:814
void xnintr_destroy(struct xnintr *intr)
Destroy an interrupt descriptor.
Definition: intr.c:776