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(ln) container_of(ln, RT_INTR, link)
00072
00073 xnintr_t intr_base;
00074
00075 void *private_data;
00076
00077 xnhandle_t handle;
00078
00079 char name[XNOBJECT_NAME_LEN];
00080
00081 #if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_PERVASIVE)
00082
00083 int mode;
00084
00085 int pending;
00086
00087 xnsynch_t synch_base;
00088
00089 pid_t cpid;
00090
00091 #endif
00092
00093 } RT_INTR;
00094
00095 #define rt_intr_save(x) splhigh(x)
00096 #define rt_intr_restore(x) splexit(x)
00097 #define rt_intr_unmask() splnone()
00098 #define rt_intr_flags(x) splget(x)
00099
00100 #ifdef __cplusplus
00101 extern "C" {
00102 #endif
00103
00104 int __native_intr_pkg_init(void);
00105
00106 void __native_intr_pkg_cleanup(void);
00107
00108 int rt_intr_create(RT_INTR *intr,
00109 const char *name,
00110 unsigned irq,
00111 rt_isr_t isr,
00112 rt_iack_t iack,
00113 int mode);
00114
00115 #ifdef CONFIG_XENO_OPT_PERVASIVE
00116 int rt_intr_handler(xnintr_t *cookie);
00117 #endif
00118
00119 #ifdef __cplusplus
00120 }
00121 #endif
00122
00123 #else
00124
00125 typedef RT_INTR_PLACEHOLDER RT_INTR;
00126
00127 #ifdef __cplusplus
00128 extern "C" {
00129 #endif
00130
00131 int rt_intr_bind(RT_INTR *intr,
00132 const char *name,
00133 RTIME timeout);
00134
00135 static inline int rt_intr_unbind (RT_INTR *intr)
00136
00137 {
00138 intr->opaque = XN_NO_HANDLE;
00139 return 0;
00140 }
00141
00142 int rt_intr_create(RT_INTR *intr,
00143 const char *name,
00144 unsigned irq,
00145 int mode);
00146
00147 int rt_intr_wait(RT_INTR *intr,
00148 RTIME timeout);
00149
00150 #ifdef __cplusplus
00151 }
00152 #endif
00153
00154 #endif
00155
00156 #ifdef __cplusplus
00157 extern "C" {
00158 #endif
00159
00160
00161
00162 int rt_intr_delete(RT_INTR *intr);
00163
00164 int rt_intr_enable(RT_INTR *intr);
00165
00166 int rt_intr_disable(RT_INTR *intr);
00167
00168 int rt_intr_inquire(RT_INTR *intr,
00169 RT_INTR_INFO *info);
00170
00171 #ifdef __cplusplus
00172 }
00173 #endif
00174
00175 #endif