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 
00107 #ifdef __cplusplus
00108 }
00109 #endif
00110 
00111 #else /* !(__KERNEL__ || __RTAI_SIM__) */
00112 
00113 typedef RT_INTR_PLACEHOLDER RT_INTR;
00114 
00115 #ifdef __cplusplus
00116 extern "C" {
00117 #endif
00118 
00119 int rt_intr_bind(RT_INTR *intr,
00120                  unsigned irq);
00121 
00122 static inline int rt_intr_unbind (RT_INTR *intr)
00123 
00124 {
00125     intr->opaque = RT_HANDLE_INVALID;
00126     return 0;
00127 }
00128 
00129 int rt_intr_create(RT_INTR *intr,
00130                    unsigned irq,
00131                    int mode);
00132 
00133 int rt_intr_wait(RT_INTR *intr,
00134                  RTIME timeout);
00135 
00136 #ifdef __cplusplus
00137 }
00138 #endif
00139 
00140 #endif /* __KERNEL__ || __RTAI_SIM__ */
00141 
00142 #ifdef __cplusplus
00143 extern "C" {
00144 #endif
00145 
00146 /* Public interface. */
00147 
00148 int rt_intr_delete(RT_INTR *intr);
00149 
00150 int rt_intr_enable(RT_INTR *intr);
00151 
00152 int rt_intr_disable(RT_INTR *intr);
00153 
00154 int rt_intr_inquire(RT_INTR *intr,
00155                     RT_INTR_INFO *info);
00156 
00157 #ifdef __cplusplus
00158 }
00159 #endif
00160 
00161 #endif /* !_RTAI_INTR_H */

Generated on Wed Jun 22 22:54:02 2005 for RTAI Fusion API by  doxygen 1.4.1