alarm.h

Go to the documentation of this file.
00001 
00022 #ifndef _RTAI_ALARM_H
00023 #define _RTAI_ALARM_H
00024 
00025 #include <nucleus/timer.h>
00026 #include <nucleus/synch.h>
00027 #include <rtai/types.h>
00028 
00029 typedef struct rt_alarm_info {
00030 
00031     RTIME expiration;           /* !< Expiration date. */
00032 
00033     unsigned long expiries;     /* !< Number of expiries. */
00034 
00035     char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */
00036 
00037 } RT_ALARM_INFO;
00038 
00039 typedef struct rt_alarm_placeholder {
00040     rt_handle_t opaque;
00041 } RT_ALARM_PLACEHOLDER;
00042 
00043 #if defined(__KERNEL__) || defined(__RTAI_SIM__)
00044 
00045 #define RTAI_ALARM_MAGIC 0x55550909
00046 
00047 typedef struct rt_alarm {
00048 
00049     unsigned magic;   /* !< Magic code - must be first */
00050 
00051     xntimer_t timer_base; /* !< Base timer object. */
00052 
00053     rt_handle_t handle; /* !< Handle in registry -- zero if unregistered. */
00054 
00055     rt_alarm_t handler;         /* !< Alarm handler. */
00056     
00057     void *cookie;               /* !< Opaque cookie. */
00058 
00059     unsigned long expiries;     /* !< Number of expiries. */
00060 
00061 #if defined(__KERNEL__) && defined(CONFIG_RTAI_OPT_FUSION)
00062 
00063     pid_t cpid;                 /* !< Creator's pid. */
00064 
00065     xnsynch_t synch_base;       /* !< Synch. base for user-space tasks. */
00066 
00067 #endif /* __KERNEL__ && CONFIG_RTAI_OPT_FUSION */
00068 
00069     char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */
00070 
00071 } RT_ALARM;
00072 
00073 #ifdef __cplusplus
00074 extern "C" {
00075 #endif
00076 
00077 int __alarm_pkg_init(void);
00078 
00079 void __alarm_pkg_cleanup(void);
00080 
00081 int rt_alarm_create(RT_ALARM *alarm,
00082                     const char *name,
00083                     rt_alarm_t handler,
00084                     void *cookie);
00085 
00086 #ifdef __cplusplus
00087 }
00088 #endif
00089 
00090 #else /* !(__KERNEL__ || __RTAI_SIM__) */
00091 
00092 typedef RT_ALARM_PLACEHOLDER RT_ALARM;
00093 
00094 #ifdef __cplusplus
00095 extern "C" {
00096 #endif
00097 
00098 int rt_alarm_create(RT_ALARM *alarm,
00099                     const char *name);
00100 
00101 int rt_alarm_wait(RT_ALARM *alarm);
00102 
00103 #ifdef __cplusplus
00104 }
00105 #endif
00106 
00107 /* No binding for alarms. */
00108 
00109 #endif /* __KERNEL__ || __RTAI_SIM__ */
00110 
00111 #ifdef __cplusplus
00112 extern "C" {
00113 #endif
00114 
00115 /* Public interface. */
00116 
00117 int rt_alarm_delete(RT_ALARM *alarm);
00118 
00119 int rt_alarm_start(RT_ALARM *alarm,
00120                    RTIME value,
00121                    RTIME interval);
00122 
00123 int rt_alarm_stop(RT_ALARM *alarm);
00124 
00125 int rt_alarm_inquire(RT_ALARM *alarm,
00126                      RT_ALARM_INFO *info);
00127 
00128 #ifdef __cplusplus
00129 }
00130 #endif
00131 
00132 #endif /* !_RTAI_ALARM_H */

Generated on Wed Jun 22 22:54:02 2005 for RTAI Fusion API by  doxygen 1.4.1