00001
00022 #ifndef _XENO_INTR_H
00023 #define _XENO_INTR_H
00024
00025 #include <nucleus/synch.h>
00026 #include <nucleus/intr.h>
00027 #include <native/types.h>
00028
00029
00030 #define I_NOAUTOENA XN_ISR_NOENABLE
00031
00032 #define I_PROPAGATE XN_ISR_PROPAGATE
00033
00034
00035 typedef struct rt_intr_info {
00036
00037 unsigned irq;
00038
00039 unsigned long hits;
00040
00041
00042 char name[XNOBJECT_NAME_LEN];
00043
00044 } RT_INTR_INFO;
00045
00046 typedef struct rt_intr_placeholder {
00047 xnhandle_t opaque;
00048 } RT_INTR_PLACEHOLDER;
00049
00050 #if defined(__KERNEL__) || defined(__XENO_SIM__)
00051
00052 #define XENO_INTR_MAGIC 0x55550a0a
00053
00054
00055 #define I_SHARED XN_ISR_SHARED
00056 #define I_EDGE XN_ISR_EDGE
00057
00058 #define RT_INTR_HANDLED XN_ISR_HANDLED
00059 #define RT_INTR_NONE XN_ISR_NONE
00060 #define RT_INTR_PROPAGATE XN_ISR_PROPAGATE
00061 #define RT_INTR_NOENABLE XN_ISR_NOENABLE
00062
00063 #define I_DESC(xintr) ((RT_INTR *)(xintr)->cookie)
00064
00065 typedef struct rt_intr {
00066
00067 unsigned magic;
00068
00069 xnholder_t link;
00070
00071 #define link2intr(laddr) \
00072 ((RT_INTR *)(((char *)laddr) - (int)(&((RT_INTR *)0)->link)))
00073
00074 xnintr_t intr_base;
00075
00076 void *private_data;
00077
00078 xnhandle_t handle;
00079
00080 char name[XNOBJECT_NAME_LEN];
00081
00082 #if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_PERVASIVE)
00083
00084 int mode;
00085
00086 int pending;
00087
00088 xnsynch_t synch_base;
00089
00090 pid_t cpid;
00091
00092 #endif
00093
00094 } RT_INTR;
00095
00096 #define rt_intr_save(x) splhigh(x)
00097 #define rt_intr_restore(x) splexit(x)
00098 #define rt_intr_unmask() splnone()
00099 #define rt_intr_flags(x) splget(x)
00100
00101 #ifdef __cplusplus
00102 extern "C" {
00103 #endif
00104
00105 int __native_intr_pkg_init(void);
00106
00107 void __native_intr_pkg_cleanup(void);
00108
00109 int rt_intr_create(RT_INTR *intr,
00110 const char *name,
00111 unsigned irq,
00112 rt_isr_t isr,
00113 rt_iack_t iack,
00114 int mode);
00115
00116 #ifdef CONFIG_XENO_OPT_PERVASIVE
00117 int rt_intr_handler(xnintr_t *cookie);
00118 #endif
00119
00120 #ifdef __cplusplus
00121 }
00122 #endif
00123
00124 #else
00125
00126 typedef RT_INTR_PLACEHOLDER RT_INTR;
00127
00128 #ifdef __cplusplus
00129 extern "C" {
00130 #endif
00131
00132 int rt_intr_bind(RT_INTR *intr,
00133 const char *name,
00134 RTIME timeout);
00135
00136 static inline int rt_intr_unbind (RT_INTR *intr)
00137
00138 {
00139 intr->opaque = XN_NO_HANDLE;
00140 return 0;
00141 }
00142
00143 int rt_intr_create(RT_INTR *intr,
00144 const char *name,
00145 unsigned irq,
00146 int mode);
00147
00148 int rt_intr_wait(RT_INTR *intr,
00149 RTIME timeout);
00150
00151 #ifdef __cplusplus
00152 }
00153 #endif
00154
00155 #endif
00156
00157 #ifdef __cplusplus
00158 extern "C" {
00159 #endif
00160
00161
00162
00163 int rt_intr_delete(RT_INTR *intr);
00164
00165 int rt_intr_enable(RT_INTR *intr);
00166
00167 int rt_intr_disable(RT_INTR *intr);
00168
00169 int rt_intr_inquire(RT_INTR *intr,
00170 RT_INTR_INFO *info);
00171
00172 #ifdef __cplusplus
00173 }
00174 #endif
00175
00176 #endif