include/nucleus/intr.h

00001 /*
00002  * @note Copyright (C) 2001,2002,2003 Philippe Gerum <rpm@xenomai.org>.
00003  *
00004  * Xenomai is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published
00006  * by the Free Software Foundation; either version 2 of the License,
00007  * or (at your option) any later version.
00008  *
00009  * Xenomai is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with Xenomai; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00017  * 02111-1307, USA.
00018  *
00019  * \ingroup intr
00020  */
00021 
00022 #ifndef _XENO_NUCLEUS_INTR_H
00023 #define _XENO_NUCLEUS_INTR_H
00024 
00025 #include <nucleus/types.h>
00026 
00027 /* Possible return values of ISR. */
00028 #define XN_ISR_NONE      0x1
00029 #define XN_ISR_HANDLED   0x2
00030 /* Additional bits. */
00031 #define XN_ISR_PROPAGATE 0x100
00032 #define XN_ISR_NOENABLE  0x200
00033 #define XN_ISR_BITMASK   (~0xff)
00034 
00035 /* Creation flags. */
00036 #define XN_ISR_SHARED    0x1
00037 #define XN_ISR_EDGE      0x2
00038 
00039 /* Operational flags. */
00040 #define XN_ISR_ATTACHED  0x10000
00041 
00042 #if defined(__KERNEL__) || defined(__XENO_SIM__)
00043 
00044 #include <nucleus/stat.h>
00045 
00046 typedef struct xnintr {
00047 
00048 #ifdef CONFIG_XENO_OPT_SHIRQ
00049     struct xnintr *next; /* !< Next object in the IRQ-sharing chain. */
00050 #endif /* CONFIG_XENO_OPT_SHIRQ */
00051 
00052     unsigned unhandled; /* !< Number of consequent unhandled interrupts */
00053 
00054     xnisr_t isr;        /* !< Interrupt service routine. */
00055 
00056     void *cookie;       /* !< User-defined cookie value. */
00057 
00058     xnflags_t flags;    /* !< Creation flags. */
00059 
00060     unsigned irq;       /* !< IRQ number. */
00061 
00062     xniack_t iack;      /* !< Interrupt acknowledge routine. */
00063 
00064     const char *name;   /* !< Symbolic name. */
00065 
00066     struct {
00067         xnstat_counter_t hits;    /* !< Number of handled receipts since attachment. */
00068         xnstat_exectime_t account; /* !< Runtime accounting entity */
00069     } stat[XNARCH_NR_CPUS];
00070 
00071 } xnintr_t;
00072 
00073 extern xnintr_t nkclock;
00074 #ifdef CONFIG_XENO_OPT_STATS
00075 extern int xnintr_count;
00076 extern int xnintr_list_rev;
00077 #endif
00078 
00079 #ifdef __cplusplus
00080 extern "C" {
00081 #endif
00082 
00083 int xnintr_mount(void);
00084 
00085 void xnintr_clock_handler(void);
00086 
00087 int xnintr_irq_proc(unsigned int irq, char *str);
00088 
00089     /* Public interface. */
00090 
00091 int xnintr_init(xnintr_t *intr,
00092                 const char *name,
00093                 unsigned irq,
00094                 xnisr_t isr,
00095                 xniack_t iack,
00096                 xnflags_t flags);
00097 
00098 int xnintr_destroy(xnintr_t *intr);
00099 
00100 int xnintr_attach(xnintr_t *intr,
00101                   void *cookie);
00102 
00103 int xnintr_detach(xnintr_t *intr);
00104 
00105 int xnintr_enable(xnintr_t *intr);
00106 
00107 int xnintr_disable(xnintr_t *intr);
00108 
00109 xnarch_cpumask_t xnintr_affinity(xnintr_t *intr,
00110                                  xnarch_cpumask_t cpumask);
00111 
00112 int xnintr_query(int irq, int *cpu, xnintr_t **prev, int revision, char *name,
00113                  unsigned long *hits, xnticks_t *exectime,
00114                  xnticks_t *account_period);
00115 
00116 #ifdef __cplusplus
00117 }
00118 #endif
00119 
00120 #endif /* __KERNEL__ || __XENO_SIM__ */
00121 
00122 #endif /* !_XENO_NUCLEUS_INTR_H */

Generated on Mon Mar 24 18:02:40 2008 for Xenomai API by  doxygen 1.5.3