skins/rtai/sem.h

Go to the documentation of this file.
00001 00049 #ifndef _RTAI_SEM_H 00050 #define _RTAI_SEM_H 00051 00052 #include <nucleus/synch.h> 00053 #include <rtai/types.h> 00054 00055 /* Creation flags. */ 00056 #define S_PRIO XNSYNCH_PRIO /* Pend by task priority order. */ 00057 #define S_FIFO XNSYNCH_FIFO /* Pend by FIFO order. */ 00058 00059 typedef struct rt_sem_info { 00060 00061 unsigned long count; /* !< Current semaphore value. */ 00062 00063 int nsleepers; /* !< Number of pending tasks. */ 00064 00065 char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */ 00066 00067 } RT_SEM_INFO; 00068 00069 typedef struct rt_sem_placeholder { 00070 rt_handle_t opaque; 00071 } RT_SEM_PLACEHOLDER; 00072 00073 #if defined(__KERNEL__) || defined(__RTAI_SIM__) 00074 00075 #define RTAI_SEM_MAGIC 0x55550303 00076 00077 typedef struct rt_sem { 00078 00079 unsigned magic; /* !< Magic code - must be first */ 00080 00081 xnsynch_t synch_base; /* !< Base synchronization object. */ 00082 00083 unsigned long count; /* !< Current semaphore value. */ 00084 00085 rt_handle_t handle; /* !< Handle in registry -- zero if unregistered. */ 00086 00087 char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */ 00088 00089 } RT_SEM; 00090 00091 #ifdef __cplusplus 00092 extern "C" { 00093 #endif 00094 00095 int __sem_pkg_init(void); 00096 00097 void __sem_pkg_cleanup(void); 00098 00099 #ifdef __cplusplus 00100 } 00101 #endif 00102 00103 #else /* !(__KERNEL__ || __RTAI_SIM__) */ 00104 00105 typedef RT_SEM_PLACEHOLDER RT_SEM; 00106 00107 int rt_sem_bind(RT_SEM *sem, 00108 const char *name); 00109 00110 #endif /* __KERNEL__ || __RTAI_SIM__ */ 00111 00112 #ifdef __cplusplus 00113 extern "C" { 00114 #endif 00115 00116 /* Public interface. */ 00117 00118 int rt_sem_create(RT_SEM *sem, 00119 const char *name, 00120 unsigned long icount, 00121 int mode); 00122 00123 int rt_sem_delete(RT_SEM *sem); 00124 00125 int rt_sem_p(RT_SEM *sem, 00126 RTIME timeout); 00127 00128 int rt_sem_v(RT_SEM *sem); 00129 00130 int rt_sem_inquire(RT_SEM *sem, 00131 RT_SEM_INFO *info); 00132 00133 #ifdef __cplusplus 00134 } 00135 #endif 00136 00137 #endif /* !_RTAI_SEM_H */

Generated on Mon Aug 30 13:58:39 2004 for RTAI API by doxygen 1.3.8