intr.h

Go to the documentation of this file.
00001 
00022 #ifndef _RTAI_INTR_H
00023 #define _RTAI_INTR_H
00024 
00025 #include <nucleus/synch.h>
00026 #include <nucleus/intr.h>
00027 #include <rtai/types.h>
00028 
00029 /* Creation flag. */
00030 #define I_AUTOENA    XN_ISR_ENABLE /* Auto-enable interrupt channel
00031                                       after each IRQ. */
00032 #define I_PROPAGATE  XN_ISR_CHAINED /* Propagate IRQs down the
00033                                        pipeline after processing; IOW,
00034                                        pass them to Linux. */
00035 typedef struct rt_intr_info {
00036 
00037     unsigned irq;       /* !< Interrupt request number. */
00038 
00039     unsigned long hits; /* !< Number of receipts (since attachment). */
00040 
00041     char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */
00042 
00043 } RT_INTR_INFO;
00044 
00045 typedef struct rt_intr_placeholder {
00046     rt_handle_t opaque;
00047 } RT_INTR_PLACEHOLDER;
00048 
00049 #if defined(__KERNEL__) || defined(__RTAI_SIM__)
00050 
00051 #define RTAI_INTR_MAGIC 0x55550a0a
00052 
00053 #define RT_INTR_HANDLED XN_ISR_HANDLED
00054 #define RT_INTR_CHAINED XN_ISR_CHAINED
00055 #define RT_INTR_ENABLE  XN_ISR_ENABLE
00056 
00057 #define I_DESC(xintr)  ((RT_INTR *)(xintr)->cookie)
00058 
00059 typedef struct rt_intr {
00060 
00061     unsigned magic;   /* !< Magic code - must be first */
00062 
00063     xnholder_t link;    /* !< Link in global interrupt queue. */
00064 
00065 #define link2intr(laddr) \
00066 ((RT_INTR *)(((char *)laddr) - (int)(&((RT_INTR *)0)->link)))
00067 
00068     xnintr_t intr_base;   /* !< Base interrupt object. */
00069 
00070     void *private_data; /* !< Private user-defined data. */
00071 
00072     rt_handle_t handle; /* !< Handle in registry -- zero if unregistered. */
00073 
00074     char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */
00075 
00076 #if defined(__KERNEL__) && defined(CONFIG_RTAI_OPT_FUSION)
00077 
00078     int mode;           /* !< Interrupt control mode. */
00079 
00080     int pending;        /* !< Pending hits to process. */
00081 
00082     xnsynch_t synch_base; /* !< Base synchronization object. */
00083 
00084     pid_t cpid;                 /* !< Creator's pid. */
00085 
00086 #endif /* __KERNEL__ && CONFIG_RTAI_OPT_FUSION */
00087 
00088 } RT_INTR;
00089 
00090 #define rt_intr_save(x)    splhigh(x)
00091 #define rt_intr_restore(x) splexit(x)
00092 #define rt_intr_unmask()   splnone()
00093 #define rt_intr_flags(x)   splget(x)
00094 
00095 #ifdef __cplusplus
00096 extern "C" {
00097 #endif
00098 
00099 int __intr_pkg_init(void);
00100 
00101 void __intr_pkg_cleanup(void);
00102 
00103 int rt_intr_create(RT_INTR *intr,
00104                    unsigned irq,
00105                    rt_isr_t isr,
00106                    rt_iack_t iack);
00107 
00108 #ifdef CONFIG_RTAI_OPT_FUSION
00109 int rt_intr_handler(xnintr_t *cookie);
00110 #endif /* CONFIG_RTAI_OPT_FUSION */
00111 
00112 #ifdef __cplusplus
00113 }
00114 #endif
00115 
00116 #else /* !(__KERNEL__ || __RTAI_SIM__) */
00117 
00118 typedef RT_INTR_PLACEHOLDER RT_INTR;
00119 
00120 #ifdef __cplusplus
00121 extern "C" {
00122 #endif
00123 
00124 int rt_intr_bind(RT_INTR *intr,
00125                  unsigned irq,
00126                  RTIME timeout);
00127 
00128 static inline int rt_intr_unbind (RT_INTR *intr)
00129 
00130 {
00131     intr->opaque = RT_HANDLE_INVALID;
00132     return 0;
00133 }
00134 
00135 int rt_intr_create(RT_INTR *intr,
00136                    unsigned irq,
00137                    int mode);
00138 
00139 int rt_intr_wait(RT_INTR *intr,
00140                  RTIME timeout);
00141 
00142 #ifdef __cplusplus
00143 }
00144 #endif
00145 
00146 #endif /* __KERNEL__ || __RTAI_SIM__ */
00147 
00148 #ifdef __cplusplus
00149 extern "C" {
00150 #endif
00151 
00152 /* Public interface. */
00153 
00154 int rt_intr_delete(RT_INTR *intr);
00155 
00156 int rt_intr_enable(RT_INTR *intr);
00157 
00158 int rt_intr_disable(RT_INTR *intr);
00159 
00160 int rt_intr_inquire(RT_INTR *intr,
00161                     RT_INTR_INFO *info);
00162 
00163 #ifdef __cplusplus
00164 }
00165 #endif
00166 
00167 #endif /* !_RTAI_INTR_H */

Generated on Sat Sep 3 12:32:47 2005 for RTAI Fusion API by  doxygen 1.4.2