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 extern RT_OBJECT __rtai_obj_slots[];
00075
00076 #ifdef __cplusplus
00077 extern "C" {
00078 #endif
00079
00080 int __registry_pkg_init(void);
00081
00082 void __registry_pkg_cleanup(void);
00083
00084 #if defined(CONFIG_PROC_FS) && defined(__KERNEL__)
00085
00086 #include <linux/proc_fs.h>
00087
00088 #define RT_OBJECT_PROC_RESERVED1 ((struct proc_dir_entry *)1)
00089 #define RT_OBJECT_PROC_RESERVED2 ((struct proc_dir_entry *)2)
00090
00091 typedef ssize_t link_proc_t(char *buf,
00092 int count,
00093 void *data);
00094
00095 typedef struct rt_object_procnode {
00096
00097 struct proc_dir_entry *dir;
00098 const char *type;
00099 int entries;
00100 read_proc_t *read_proc;
00101 write_proc_t *write_proc;
00102 link_proc_t *link_proc;
00103
00104 } RT_OBJECT_PROCNODE;
00105
00106 #else
00107
00108 typedef struct rt_object_procnode {
00109
00110 const char *type;
00111
00112 } RT_OBJECT_PROCNODE;
00113
00114 #endif
00115
00116
00117
00118 int rt_registry_enter(const char *key,
00119 void *objaddr,
00120 rt_handle_t *phandle,
00121 RT_OBJECT_PROCNODE *pnode);
00122
00123 int rt_registry_bind(const char *key,
00124 RTIME timeout,
00125 rt_handle_t *phandle);
00126
00127 int rt_registry_remove(rt_handle_t handle);
00128
00129 int rt_registry_remove_safe(rt_handle_t handle,
00130 RTIME timeout);
00131
00132 void *rt_registry_get(rt_handle_t handle);
00133
00134 void *rt_registry_fetch(rt_handle_t handle);
00135
00136 u_long rt_registry_put(rt_handle_t handle);
00137
00138 #ifdef __cplusplus
00139 }
00140 #endif
00141
00142 #endif
00143
00144 #endif