Xenomai API
2.5.6.1
|
00001 /* 00002 * @note Copyright (C) 2001,2002,2003 Philippe Gerum <[email protected]>. 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 /* 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/types.h> 00043 #include <nucleus/stat.h> 00044 00045 struct xnsched; 00046 00047 typedef struct xnintr { 00048 00049 #ifdef CONFIG_XENO_OPT_SHIRQ 00050 struct xnintr *next; /* !< Next object in the IRQ-sharing chain. */ 00051 #endif /* CONFIG_XENO_OPT_SHIRQ */ 00052 00053 unsigned unhandled; /* !< Number of consequent unhandled interrupts */ 00054 00055 xnisr_t isr; /* !< Interrupt service routine. */ 00056 00057 void *cookie; /* !< User-defined cookie value. */ 00058 00059 xnflags_t flags; /* !< Creation flags. */ 00060 00061 unsigned irq; /* !< IRQ number. */ 00062 00063 xniack_t iack; /* !< Interrupt acknowledge routine. */ 00064 00065 const char *name; /* !< Symbolic name. */ 00066 00067 struct { 00068 xnstat_counter_t hits; /* !< Number of handled receipts since attachment. */ 00069 xnstat_exectime_t account; /* !< Runtime accounting entity */ 00070 xnstat_exectime_t sum; /* !< Accumulated accounting entity */ 00071 } stat[XNARCH_NR_CPUS]; 00072 00073 } xnintr_t; 00074 00075 typedef struct xnintr_iterator { 00076 00077 int cpu; /* !< Current CPU in iteration. */ 00078 00079 unsigned long hits; /* !< Current hit counter. */ 00080 00081 xnticks_t exectime_period; /* !< Used CPU time in current accounting period. */ 00082 00083 xnticks_t account_period; /* !< Length of accounting period. */ 00084 00085 xnticks_t exectime_total; /* !< Overall CPU time consumed. */ 00086 00087 int list_rev; /* !< System-wide xnintr list revision (internal use). */ 00088 00089 xnintr_t *prev; /* !< Previously visited xnintr object (internal use). */ 00090 00091 } xnintr_iterator_t; 00092 00093 extern xnintr_t nkclock; 00094 00095 #ifdef __cplusplus 00096 extern "C" { 00097 #endif 00098 00099 int xnintr_mount(void); 00100 00101 void xnintr_clock_handler(void); 00102 00103 void xnintr_host_tick(struct xnsched *sched); 00104 00105 void xnintr_init_proc(void); 00106 00107 void xnintr_cleanup_proc(void); 00108 00109 /* Public interface. */ 00110 00111 int xnintr_init(xnintr_t *intr, 00112 const char *name, 00113 unsigned irq, 00114 xnisr_t isr, 00115 xniack_t iack, 00116 xnflags_t flags); 00117 00118 int xnintr_destroy(xnintr_t *intr); 00119 00120 int xnintr_attach(xnintr_t *intr, 00121 void *cookie); 00122 00123 int xnintr_detach(xnintr_t *intr); 00124 00125 int xnintr_enable(xnintr_t *intr); 00126 00127 int xnintr_disable(xnintr_t *intr); 00128 00129 xnarch_cpumask_t xnintr_affinity(xnintr_t *intr, 00130 xnarch_cpumask_t cpumask); 00131 00132 int xnintr_query_init(xnintr_iterator_t *iterator); 00133 int xnintr_query_next(int irq, xnintr_iterator_t *iterator, char *name_buf); 00134 00135 #ifdef __cplusplus 00136 } 00137 #endif 00138 00139 #endif /* __KERNEL__ || __XENO_SIM__ */ 00140 00141 #endif /* !_XENO_NUCLEUS_INTR_H */