00001
00022 #ifndef _RTAI_REGISTRY_H
00023 #define _RTAI_REGISTRY_H
00024
00025 #include <rtai/types.h>
00026
00027 #define RT_REGISTRY_SELF RT_HANDLE_INVALID
00028
00029 #if defined(__KERNEL__) && defined(CONFIG_PROC_FS) && defined(CONFIG_RTAI_OPT_NATIVE_REGISTRY)
00030 #define CONFIG_RTAI_NATIVE_EXPORT_REGISTRY 1
00031 #endif
00032
00033 #if defined(__KERNEL__) || defined(__RTAI_SIM__)
00034
00035 #include <nucleus/synch.h>
00036 #include <nucleus/thread.h>
00037
00038 struct rt_object_procnode;
00039
00040 typedef struct rt_object {
00041
00042 xnholder_t link;
00043 #define link2rtobj(laddr) \
00044 ((RT_OBJECT *)(((char *)laddr) - (int)(&((RT_OBJECT *)0)->link)))
00045
00046 void *objaddr;
00047
00048 const char *key;
00049
00050 xnsynch_t safesynch;
00051
00052 u_long safelock;
00053
00054 u_long cstamp;
00055
00056 #if defined(CONFIG_PROC_FS) && defined(__KERNEL__)
00057
00058 struct rt_object_procnode *pnode;
00059
00060 struct proc_dir_entry *proc;
00061
00062 #endif
00063
00064 } RT_OBJECT;
00065
00066 typedef struct rt_hash {
00067
00068 RT_OBJECT *object;
00069
00070 struct rt_hash *next;
00071
00072 } RT_HASH;
00073
00074 #ifdef __cplusplus
00075 extern "C" {
00076 #endif
00077
00078 int __registry_pkg_init(void);
00079
00080 void __registry_pkg_cleanup(void);
00081
00082 #if defined(CONFIG_PROC_FS) && defined(__KERNEL__)
00083
00084 #include <linux/proc_fs.h>
00085
00086 #define RT_OBJECT_PROC_RESERVED1 ((struct proc_dir_entry *)1)
00087 #define RT_OBJECT_PROC_RESERVED2 ((struct proc_dir_entry *)2)
00088
00089 typedef ssize_t link_proc_t(char *buf,
00090 int count,
00091 void *data);
00092
00093 typedef struct rt_object_procnode {
00094
00095 struct proc_dir_entry *dir;
00096 const char *type;
00097 int entries;
00098 read_proc_t *read_proc;
00099 write_proc_t *write_proc;
00100 link_proc_t *link_proc;
00101
00102 } RT_OBJECT_PROCNODE;
00103
00104 #else
00105
00106 typedef struct rt_object_procnode {
00107
00108 const char *type;
00109
00110 } RT_OBJECT_PROCNODE;
00111
00112 #endif
00113
00114
00115
00116 int rt_registry_enter(const char *key,
00117 void *objaddr,
00118 rt_handle_t *phandle,
00119 RT_OBJECT_PROCNODE *pnode);
00120
00121 int rt_registry_bind(const char *key,
00122 RTIME timeout,
00123 rt_handle_t *phandle);
00124
00125 int rt_registry_remove(rt_handle_t handle);
00126
00127 int rt_registry_remove_safe(rt_handle_t handle,
00128 RTIME timeout);
00129
00130 void *rt_registry_get(rt_handle_t handle);
00131
00132 void *rt_registry_fetch(rt_handle_t handle);
00133
00134 u_long rt_registry_put(rt_handle_t handle);
00135
00136 #ifdef __cplusplus
00137 }
00138 #endif
00139
00140 #endif
00141
00142 #endif