* <!--
* Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/)
* Copyright 2000 Bernardo Innocenti <bernie@develer.com>
- * All Rights Reserved.
+ * This file is part of DevLib - See devlib/README for information.
* -->
*
* \version $Id$
/*
* $Log$
+ * Revision 1.4 2004/06/06 18:25:44 bernie
+ * Rename event macros to look like regular functions.
+ *
+ * Revision 1.3 2004/06/06 17:18:42 bernie
+ * Fix \!CONFIG_KERN_SIGNALS code paths.
+ *
+ * Revision 1.2 2004/06/03 11:27:09 bernie
+ * Add dual-license information.
+ *
* Revision 1.1 2004/05/23 18:23:30 bernie
* Import drv/timer module.
*
*/
void timer_delay(time_t time)
{
-#ifdef CONFIG_KERN_SIGNALS
+#if defined(CONFIG_KERN_SIGNALS) && CONFIG_KERN_SIGNALS
Timer t;
ASSERT(!sig_check(SIG_SINGLE));
timer_set_delay(&t, time);
timer_add(&t);
sig_wait(SIG_SINGLE);
-#else
+
+#else /* !CONFIG_KERN_SIGNALS */
+
time_t start = timer_gettick();
+ /* Busy wait */
while (timer_gettick() - start < time) { /* nop */ }
-#endif
+
+#endif /* !CONFIG_KERN_SIGNALS */
}
+
/*!
* Wait for the specified amount of time (expressed in microseconds)
*/
hptime_t start = timer_hw_hpread();
hptime_t delay = (uint32_t)usec_delay * TIMER_HW_HPTICKS_PER_SEC / 1000000ul;
- while (timer_hw_hpread() - start < delay)
+ while (timer_hw_hpread() - start < delay)
{}
}
REMOVE((Node *)timer);
/* Execute the associated event */
- DOEVENT_INTR(&timer->expire);
+ event_doIntr(&timer->expire);
}
}