summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-09-30 16:06:22 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-09-30 16:06:22 +0200
commit556a07ca4426f7da288425dd42a98112a77b54f2 (patch)
tree003bbb7ebc5a4b6a95859c6ee94ee079f09c6bcd
parent880d9299f1fc2054f74c32673afe856dd82fc276 (diff)
downloadrtems-libbsd-556a07ca4426f7da288425dd42a98112a77b54f2.tar.bz2
DELAY(): Use rtems_counter_delay_nanoseconds()
-rw-r--r--rtemsbsd/rtems/rtems-bsd-delay.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/rtemsbsd/rtems/rtems-bsd-delay.c b/rtemsbsd/rtems/rtems-bsd-delay.c
index a698117c..1faa9265 100644
--- a/rtemsbsd/rtems/rtems-bsd-delay.c
+++ b/rtemsbsd/rtems/rtems-bsd-delay.c
@@ -7,11 +7,11 @@
*/
/*
- * Copyright (c) 2009, 2010 embedded brains GmbH.
+ * Copyright (c) 2009, 2015 embedded brains GmbH
* All rights reserved.
*
* embedded brains GmbH
- * Obere Lagerstr. 30
+ * Dornierstr. 4
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
@@ -40,24 +40,14 @@
#include <machine/rtems-bsd-kernel-space.h>
-#include <rtems/bsd/sys/param.h>
#include <rtems/bsd/sys/types.h>
#include <sys/systm.h>
-#include <sys/kernel.h>
+#include <rtems/counter.h>
void
DELAY(int usec)
{
- rtems_status_code sc = RTEMS_SUCCESSFUL;
-
- /* FIXME: Integer conversion */
- rtems_interval ticks =
- ((rtems_interval) usec * (rtems_interval) hz) / 1000000;
-
- if (ticks == 0) {
- ticks = 1;
- }
-
- sc = rtems_task_wake_after(ticks);
- BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
+ uint32_t ns = 1000 * (uint32_t)usec;
+ BSD_ASSERT((uint32_t)usec <= UINT32_MAX / 1000);
+ rtems_counter_delay_nanoseconds(ns);
}