Rename ser_emul.c to ser_posix.c.
[bertos.git] / drv / timer.h
index 7bde5f5bb9667d2d0b2917fd89cc605afca5f3f2..c78bee39eeb2886e32e0efe52e82d18b368b6b90 100755 (executable)
@@ -3,7 +3,7 @@
  * <!--
  * Copyright 2003, 2004, 2005 Develer S.r.l. (http://www.develer.com/)
  * Copyright 2000 Bernardo Innocenti <bernie@develer.com>
- * This file is part of DevLib - See devlib/README for information.
+ * This file is part of DevLib - See README.devlib for information.
  * -->
  *
  * \version $Id$
 
 /*#*
  *#* $Log$
+ *#* Revision 1.28  2006/02/17 22:24:21  bernie
+ *#* Update POSIX timer emulator.
+ *#*
+ *#* Revision 1.27  2005/11/27 03:04:19  bernie
+ *#* Move test code to timer_test.c; Add OS_HOSTED support.
+ *#*
+ *#* Revision 1.26  2005/11/04 16:20:02  bernie
+ *#* Fix reference to README.devlib in header.
+ *#*
  *#* Revision 1.25  2005/07/19 07:26:37  bernie
  *#* Refactor to decouple timer ticks from milliseconds.
  *#*
 #ifndef DRV_TIMER_H
 #define DRV_TIMER_H
 
-#include <cfg/debug.h>
+#include <cfg/os.h>
+#include <cfg/cpu.h>
+
+/*
+ * Include platform-specific binding header if we're hosted.
+ * Try the CPU specific one for bare-metal environments.
+ */
+#if OS_HOSTED
+       #include OS_HEADER(timer)
+#else
+       #include CPU_HEADER(timer)
+#endif
 
-#include CPU_HEADER(timer)
 #include <mware/list.h>
-#include <cfg/cpu.h>
+#include <cfg/debug.h>
 #include <cfg/compiler.h>
 #include <appconfig.h>
 
@@ -190,7 +209,7 @@ INLINE hptime_t us_to_hptime(utime_t us)
        #if TIMER_HW_HPTICKS_PER_SEC > 10000000UL
                return(us * ((TIMER_HW_HPTICKS_PER_SEC + 500000UL) / 1000000UL));
        #else
-               return((us * TIMER_HW_HPTICKS_PER_SEC + 500000UL) / 1000000UL));
+               return((us * TIMER_HW_HPTICKS_PER_SEC + 500000UL) / 1000000UL);
        #endif /* TIMER_HW_HPTICKS_PER_SEC > 10000000UL */
 }
 
@@ -221,10 +240,6 @@ INLINE void timer_udelay(utime_t delay)
 }
 #endif
 
-#if CONFIG_TEST
-void timer_test(void);
-#endif /* CONFIG_TEST */
-
 #ifndef CONFIG_TIMER_DISABLE_EVENTS
 
 #include <mware/event.h>