alarm.h

Go to the documentation of this file.
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;           /* !< Expiration date. */
00059 
00060     unsigned long nexpiries;    /* !< Number of expiries. */
00061 
00062     char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */
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;   /* !< Magic code - must be first */
00077 
00078     xntimer_t timer_base; /* !< Base timer object. */
00079 
00080     rt_handle_t handle; /* !< Handle in registry -- zero if unregistered. */
00081 
00082     rt_alarm_t handler;         /* !< Alarm handler. */
00083     
00084     void *cookie;               /* !< Opaque cookie. */
00085 
00086     unsigned long nexpiries;    /* !< Number of expiries. */
00087 
00088 #if defined(__KERNEL__) && defined(CONFIG_RTAI_OPT_FUSION)
00089 
00090     int source;                 /* !< Creator's space. */
00091 
00092     xnsynch_t synch_base;       /* !< Synch. base for user-space tasks. */
00093 
00094 #endif /* __KERNEL__ && CONFIG_RTAI_OPT_FUSION */
00095 
00096     char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */
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 /* !(__KERNEL__ || __RTAI_SIM__) */
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 /* No binding for alarms. */
00127 
00128 #endif /* __KERNEL__ || __RTAI_SIM__ */
00129 
00130 #ifdef __cplusplus
00131 extern "C" {
00132 #endif
00133 
00134 /* Public interface. */
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 /* !_RTAI_ALARM_H */

Generated on Mon Dec 13 09:49:49 2004 for RTAI API by  doxygen 1.3.9.1