00001
00049 #ifndef _RTAI_ALARM_H
00050 #define _RTAI_ALARM_H
00051
00052 #include <nucleus/timer.h>
00053 #include <nucleus/synch.h>
00054 #include <rtai/types.h>
00055
00056 typedef struct rt_alarm_info {
00057
00058 RTIME expiration;
00059
00060 unsigned long nexpiries;
00061
00062 char name[XNOBJECT_NAME_LEN];
00063
00064 } RT_ALARM_INFO;
00065
00066 typedef struct rt_alarm_placeholder {
00067 rt_handle_t opaque;
00068 } RT_ALARM_PLACEHOLDER;
00069
00070 #if defined(__KERNEL__) || defined(__RTAI_SIM__)
00071
00072 #define RTAI_ALARM_MAGIC 0x55550909
00073
00074 typedef struct rt_alarm {
00075
00076 unsigned magic;
00077
00078 xntimer_t timer_base;
00079
00080 rt_handle_t handle;
00081
00082 rt_alarm_t handler;
00083
00084 void *cookie;
00085
00086 unsigned long nexpiries;
00087
00088 #if defined(__KERNEL__) && defined(CONFIG_RTAI_OPT_FUSION)
00089
00090 int source;
00091
00092 xnsynch_t synch_base;
00093
00094 #endif
00095
00096 char name[XNOBJECT_NAME_LEN];
00097
00098 } RT_ALARM;
00099
00100 #ifdef __cplusplus
00101 extern "C" {
00102 #endif
00103
00104 int __alarm_pkg_init(void);
00105
00106 void __alarm_pkg_cleanup(void);
00107
00108 int rt_alarm_create(RT_ALARM *alarm,
00109 const char *name,
00110 rt_alarm_t handler,
00111 void *cookie);
00112
00113 #ifdef __cplusplus
00114 }
00115 #endif
00116
00117 #else
00118
00119 typedef RT_ALARM_PLACEHOLDER RT_ALARM;
00120
00121 int rt_alarm_create(RT_ALARM *alarm,
00122 const char *name);
00123
00124 int rt_alarm_wait(RT_ALARM *alarm);
00125
00126
00127
00128 #endif
00129
00130 #ifdef __cplusplus
00131 extern "C" {
00132 #endif
00133
00134
00135
00136 int rt_alarm_delete(RT_ALARM *alarm);
00137
00138 int rt_alarm_start(RT_ALARM *alarm,
00139 RTIME value,
00140 RTIME interval);
00141
00142 int rt_alarm_stop(RT_ALARM *alarm);
00143
00144 int rt_alarm_inquire(RT_ALARM *alarm,
00145 RT_ALARM_INFO *info);
00146
00147 #ifdef __cplusplus
00148 }
00149 #endif
00150
00151 #endif