Include top-level headers from cfg/ subdir.
[bertos.git] / drv / timer.h
index 0d975f30d83a0d75d4582ed9d1cef67adb04756f..bd7b1f7e8154cb1ef760cda37cd6b9c02e9f01dc 100755 (executable)
 
 /*#*
  *#* $Log$
+ *#* Revision 1.24  2005/04/11 19:10:28  bernie
+ *#* Include top-level headers from cfg/ subdir.
+ *#*
+ *#* Revision 1.23  2005/03/01 23:25:46  bernie
+ *#* Move event.h to mware/.
+ *#*
+ *#* Revision 1.22  2004/12/13 12:07:06  bernie
+ *#* DISABLE_IRQSAVE/ENABLE_IRQRESTORE: Convert to IRQ_SAVE_DISABLE/IRQ_RESTORE.
+ *#*
+ *#* Revision 1.21  2004/12/09 08:35:21  bernie
+ *#* Replace IPTR with iptr_t.
+ *#*
+ *#* Revision 1.20  2004/12/08 08:56:41  bernie
+ *#* Rename sigset_t to sigmask_t; Reformat.
+ *#*
  *#* Revision 1.19  2004/12/08 08:30:37  bernie
  *#* Convert to mtime_t; timer_minutes(): Remove.
  *#*
@@ -72,9 +87,9 @@
 #define DRV_TIMER_H
 
 #include <mware/list.h>
-#include <cpu.h>
-#include <compiler.h>
-#include <config.h>
+#include <cfg/cpu.h>
+#include <cfg/compiler.h>
+#include <cfg/config.h>
 
 /*! Number of timer ticks per second. */
 #define TICKS_PER_SEC  ((mtime_t)1000)
@@ -90,11 +105,7 @@ extern void timer_udelay(utime_t utime);
 
 #ifndef CONFIG_TIMER_DISABLE_EVENTS
 
-#if CONFIG_KERNEL
-       #include <kern/event.h>
-#else
-       #include <mware/event.h>
-#endif
+#include <mware/event.h>
 
 /*!
  * The timer driver supports multiple synchronous timers
@@ -117,7 +128,7 @@ extern Timer *timer_abort(Timer *timer);
 #if defined(CONFIG_KERN_SIGNALS) && CONFIG_KERN_SIGNALS
 
 /*! Set the timer so that it sends a signal when it expires */
-INLINE void timer_set_event_signal(Timer* timer, struct Process* proc, sigset_t sigs)
+INLINE void timer_set_event_signal(Timer *timer, struct Process *proc, sigmask_t sigs)
 {
        event_initSignal(&timer->expire, proc, sigs);
 }
@@ -125,13 +136,13 @@ INLINE void timer_set_event_signal(Timer* timer, struct Process* proc, sigset_t
 #endif /* CONFIG_KERN_SIGNALS */
 
 /*! Set the timer so that it calls an user hook when it expires */
-INLINE void timer_set_event_softint(Timer* timer, Hook func, void* user_data)
+INLINE void timer_set_event_softint(Timer *timer, Hook func, iptr_t user_data)
 {
        event_initSoftInt(&timer->expire, func, user_data);
 }
 
 /*! Set the timer delay (the time before the event will be triggered) */
-INLINE void timer_set_delay(Timertimer, mtime_t delay)
+INLINE void timer_set_delay(Timer *timer, mtime_t delay)
 {
        timer->delay = delay;
 }
@@ -167,11 +178,8 @@ extern volatile mtime_t _clock;
 INLINE mtime_t timer_ticks(void)
 {
        mtime_t result;
-       cpuflags_t flags;
 
-       DISABLE_IRQSAVE(flags);
-       result = _clock;
-       ENABLE_IRQRESTORE(flags);
+       ATOMIC(result = _clock);
 
        return result;
 }