00001
00049 #ifndef _RTAI_REGISTRY_H
00050 #define _RTAI_REGISTRY_H
00051
00052 #include <rtai/types.h>
00053
00054 #define RT_REGISTRY_SELF RT_HANDLE_INVALID
00055
00056 #ifdef __KERNEL__
00057
00058 #include <nucleus/synch.h>
00059 #include <nucleus/thread.h>
00060
00061 #define RT_REGISTRY_RECHECK XNTHREAD_SPARE0
00062
00063 typedef struct rt_object {
00064
00065 xnholder_t link;
00066 #define link2rtobj(laddr) \
00067 ((RT_OBJECT *)(((char *)laddr) - (int)(&((RT_OBJECT *)0)->link)))
00068
00069 void *objaddr;
00070
00071 const char *key;
00072
00073 xnsynch_t safesynch;
00074
00075 u_long safelock;
00076
00077 u_long cstamp;
00078
00079 } RT_OBJECT;
00080
00081 typedef struct rt_hash {
00082
00083 RT_OBJECT *object;
00084
00085 struct rt_hash *next;
00086
00087 } RT_HASH;
00088
00089 extern RT_OBJECT __rtai_obj_slots[];
00090
00091 #ifdef __cplusplus
00092 extern "C" {
00093 #endif
00094
00095 int __registry_pkg_init(void);
00096
00097 void __registry_pkg_cleanup(void);
00098
00099
00100
00101 int rt_registry_enter(const char *key,
00102 void *objaddr,
00103 rt_handle_t *phandle);
00104
00105 int rt_registry_bind(const char *key,
00106 RTIME timeout,
00107 rt_handle_t *phandle);
00108
00109 int rt_registry_remove(rt_handle_t handle);
00110
00111 int rt_registry_remove_safe(rt_handle_t handle,
00112 RTIME timeout);
00113
00114 void *rt_registry_get(rt_handle_t handle);
00115
00116 void *rt_registry_fetch(rt_handle_t handle);
00117
00118 u_long rt_registry_put(rt_handle_t handle);
00119
00120 #ifdef __cplusplus
00121 }
00122 #endif
00123
00124 #endif
00125
00126 #endif