00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #ifndef _XENO_NUCLEUS_INTR_H
00023 #define _XENO_NUCLEUS_INTR_H
00024 
00025 
00026 #define XN_ISR_NONE      0x1
00027 #define XN_ISR_HANDLED   0x2
00028 
00029 #define XN_ISR_PROPAGATE 0x100
00030 #define XN_ISR_NOENABLE  0x200
00031 #define XN_ISR_BITMASK   (~0xff)
00032 
00033 
00034 #define XN_ISR_SHARED    0x1
00035 #define XN_ISR_EDGE      0x2
00036 
00037 
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; 
00051 #endif 
00052 
00053     unsigned unhandled; 
00054 
00055     xnisr_t isr;        
00056 
00057     void *cookie;       
00058 
00059     xnflags_t flags;    
00060 
00061     unsigned irq;       
00062 
00063     xniack_t iack;      
00064 
00065     const char *name;   
00066 
00067     struct {
00068         xnstat_counter_t hits;    
00069         xnstat_exectime_t account; 
00070         xnstat_exectime_t sum; 
00071     } stat[XNARCH_NR_CPUS];
00072 
00073 } xnintr_t;
00074 
00075 typedef struct xnintr_iterator {
00076 
00077     int cpu;            
00078 
00079     unsigned long hits; 
00080 
00081     xnticks_t exectime_period;  
00082 
00083     xnticks_t account_period; 
00084 
00085     xnticks_t exectime_total;   
00086 
00087     int list_rev;       
00088 
00089     xnintr_t *prev;     
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     
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 
00140 
00141 #endif