00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 #ifndef _RTDM_INTERNAL_H
00021 #define _RTDM_INTERNAL_H
00022 
00023 #include <linux/list.h>
00024 #include <linux/proc_fs.h>
00025 #include <linux/sem.h>
00026 
00027 #include <nucleus/pod.h>
00028 #include <nucleus/ppd.h>
00029 #include <rtdm/rtdm_driver.h>
00030 
00031 #ifndef CONFIG_XENO_OPT_DEBUG_RTDM_APPL
00032 #define CONFIG_XENO_OPT_DEBUG_RTDM_APPL 0
00033 #endif
00034 
00035 #define RTDM_FD_MAX                     CONFIG_XENO_OPT_RTDM_FILDES
00036 
00037 #define DEF_DEVNAME_HASHTAB_SIZE        256     
00038 #define DEF_PROTO_HASHTAB_SIZE          256     
00039 
00040 struct rtdm_fildes {
00041         struct rtdm_dev_context *context;
00042 };
00043 
00044 struct rtdm_process {
00045 #ifdef CONFIG_PROC_FS
00046         char name[32];
00047         pid_t pid;
00048 #endif 
00049 
00050         xnshadow_ppd_t ppd;
00051 };
00052 
00053 DECLARE_EXTERN_XNLOCK(rt_fildes_lock);
00054 DECLARE_EXTERN_XNLOCK(rt_dev_lock);
00055 
00056 extern int __rtdm_muxid;
00057 extern struct rtdm_fildes fildes_table[];
00058 extern int open_fildes;
00059 extern struct semaphore nrt_dev_lock;
00060 extern unsigned int devname_hashtab_size;
00061 extern unsigned int protocol_hashtab_size;
00062 extern struct list_head *rtdm_named_devices;
00063 extern struct list_head *rtdm_protocol_devices;
00064 extern struct proc_dir_entry *rtdm_proc_root;
00065 
00066 #ifdef MODULE
00067 #define rtdm_initialised 1
00068 #else 
00069 extern int rtdm_initialised;
00070 #endif 
00071 
00072 void cleanup_owned_contexts(void *user_info);
00073 int rtdm_no_support(void);
00074 struct rtdm_device *get_named_device(const char *name);
00075 struct rtdm_device *get_protocol_device(int protocol_family, int socket_type);
00076 
00077 static inline void rtdm_dereference_device(struct rtdm_device *device)
00078 {
00079         atomic_dec(&device->reserved.refcount);
00080 }
00081 
00082 int __init rtdm_dev_init(void);
00083 
00084 static inline void rtdm_dev_cleanup(void)
00085 {
00086         kfree(rtdm_named_devices);
00087         kfree(rtdm_protocol_devices);
00088 }
00089 
00090 int rtdm_proc_register_device(struct rtdm_device *device);
00091 int __init rtdm_proc_init(void);
00092 void rtdm_proc_cleanup(void);
00093 
00094 #endif