summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/timerinserthelper.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-12-17 16:01:42 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-12-17 16:01:42 +0000
commita6cbc9b8690825aebde9694e9132230d57d53847 (patch)
tree0974c40531822c54d167e4bdea37e57dca40ec9e /cpukit/posix/src/timerinserthelper.c
parentFormatting. (diff)
downloadrtems-a6cbc9b8690825aebde9694e9132230d57d53847.tar.bz2
2007-12-17 Joel Sherrill <joel.sherrill@OARcorp.com>
* posix/Makefile.am, posix/preinstall.am, posix/include/rtems/posix/timer.h, score/src/objectget.c: Split POSIX Timer implementation into multiple files. Add obvious error checks for NULL parameters. Attempt to reduce include files. * posix/src/timercreate.c, posix/src/timerdelete.c, posix/src/timergetoverrun.c, posix/src/timergettime.c, posix/src/timerinserthelper.c, posix/src/timersettime.c, posix/src/timertsr.c: New files. * posix/src/ptimer1.c: Removed.
Diffstat (limited to 'cpukit/posix/src/timerinserthelper.c')
-rw-r--r--cpukit/posix/src/timerinserthelper.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/cpukit/posix/src/timerinserthelper.c b/cpukit/posix/src/timerinserthelper.c
new file mode 100644
index 0000000000..79178ca605
--- /dev/null
+++ b/cpukit/posix/src/timerinserthelper.c
@@ -0,0 +1,57 @@
+/*
+ * Helper routine for POSIX timers
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <time.h>
+
+#include <rtems/system.h>
+#include <rtems/seterr.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/posix/timer.h>
+#include <rtems/posix/ptimer.h>
+
+boolean _POSIX_Timer_Insert_helper(
+ Watchdog_Control *timer,
+ Watchdog_Interval ticks,
+ Objects_Id id,
+ Watchdog_Service_routine_entry TSR,
+ void *arg
+)
+{
+ ISR_Level level;
+
+ (void) _Watchdog_Remove( timer );
+ _ISR_Disable( level );
+
+ /*
+ * Check to see if the watchdog has just been inserted by a
+ * higher priority interrupt. If so, abandon this insert.
+ */
+ if ( timer->state != WATCHDOG_INACTIVE ) {
+ _ISR_Enable( level );
+ return FALSE;
+ }
+
+ /*
+ * OK. Now we now the timer was not rescheduled by an interrupt
+ * so we can atomically initialize it as in use.
+ */
+ _Watchdog_Initialize( timer, TSR, id, arg );
+ _Watchdog_Insert_ticks( timer, ticks );
+ _ISR_Enable( level );
+ return TRUE;
+}