include/nucleus/intr.h

00001 /*
00002  * 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 
00020 #ifndef _XENO_NUCLEUS_INTR_H
00021 #define _XENO_NUCLEUS_INTR_H
00022 
00023 #include <nucleus/types.h>
00024 
00025 /* Possible return values of ISR. */
00026 #define XN_ISR_NONE      0x1
00027 #define XN_ISR_HANDLED   0x2
00028 /* Additional bits. */
00029 #define XN_ISR_PROPAGATE 0x100
00030 #define XN_ISR_NOENABLE  0x200
00031 #define XN_ISR_BITMASK   (~0xff)
00032 
00033 /* Creation flags. */
00034 #define XN_ISR_SHARED    0x1
00035 #define XN_ISR_EDGE      0x2
00036 
00037 /* Operational flags. */
00038 #define XN_ISR_ATTACHED  0x10000
00039 
00040 #if defined(__KERNEL__) || defined(__XENO_SIM__)
00041 
00042 #include <nucleus/stat.h>
00043 
00044 typedef struct xnintr {
00045 
00046 #if defined(CONFIG_XENO_OPT_SHIRQ_LEVEL) || defined(CONFIG_XENO_OPT_SHIRQ_EDGE)
00047     struct xnintr *next; /* !< Next object in the IRQ-sharing chain. */
00048 #endif /* CONFIG_XENO_OPT_SHIRQ_LEVEL || CONFIG_XENO_OPT_SHIRQ_EDGE */
00049 
00050     unsigned unhandled; /* !< Number of consequent unhandled interrupts */
00051 
00052     xnisr_t isr;        /* !< Interrupt service routine. */
00053 
00054     void *cookie;       /* !< User-defined cookie value. */
00055 
00056     xnflags_t flags;    /* !< Creation flags. */
00057 
00058     unsigned irq;       /* !< IRQ number. */
00059 
00060     xniack_t iack;      /* !< Interrupt acknowledge routine. */
00061 
00062     const char *name;   /* !< Symbolic name. */
00063 
00064     struct {
00065         xnstat_counter_t hits;    /* !< Number of handled receipts since attachment. */
00066         xnstat_runtime_t account; /* !< Runtime accounting entity */
00067     } stat[XNARCH_NR_CPUS];
00068 
00069 } xnintr_t;
00070 
00071 extern xnintr_t nkclock;
00072 #ifdef CONFIG_XENO_OPT_STATS
00073 extern int xnintr_count;
00074 extern int xnintr_list_rev;
00075 #endif
00076 
00077 #ifdef __cplusplus
00078 extern "C" {
00079 #endif
00080 
00081 int xnintr_mount(void);
00082 
00083 void xnintr_clock_handler(void);
00084 
00085 int xnintr_irq_proc(unsigned int irq, char *str);
00086 
00087     /* Public interface. */
00088 
00089 int xnintr_init(xnintr_t *intr,
00090                 const char *name,
00091                 unsigned irq,
00092                 xnisr_t isr,
00093                 xniack_t iack,
00094                 xnflags_t flags);
00095 
00096 int xnintr_destroy(xnintr_t *intr);
00097 
00098 int xnintr_attach(xnintr_t *intr,
00099                   void *cookie);
00100 
00101 int xnintr_detach(xnintr_t *intr);
00102 
00103 int xnintr_enable(xnintr_t *intr);
00104 
00105 int xnintr_disable(xnintr_t *intr);
00106 
00107 xnarch_cpumask_t xnintr_affinity(xnintr_t *intr,
00108                                  xnarch_cpumask_t cpumask);
00109 
00110 int xnintr_query(int irq, int *cpu, xnintr_t **prev, int revision, char *name,
00111                  unsigned long *hits, xnticks_t *runtime,
00112                  xnticks_t *account_period);
00113 
00114 #ifdef __cplusplus
00115 }
00116 #endif
00117 
00118 #endif /* __KERNEL__ || __XENO_SIM__ */
00119 
00120 #endif /* !_XENO_NUCLEUS_INTR_H */

Generated on Mon Dec 25 13:57:10 2006 for Xenomai API by  doxygen 1.4.6