source: rtems/cpukit/posix/src/timerinserthelper.c @ 6d253941

4.115
Last change on this file since 6d253941 was 2903090, checked in by Sebastian Huber <sebastian.huber@…>, on 04/15/15 at 09:26:46

score: Add header to _Watchdog_Remove()

Add watchdog header parameter to _Watchdog_Remove() to be in line with
the other operations. Add _Watchdog_Remove_ticks() and
_Watchdog_Remove_seconds() for convenience.

Update #2307.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 * @file
3 *
4 * @brief Helper Routine for POSIX TIMERS
5 * @ingroup POSIXAPI
6 */
7
8/*
9 *  Helper routine for POSIX timers
10 *
11 *  COPYRIGHT (c) 1989-2007.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#if HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <time.h>
24
25#include <rtems/system.h>
26#include <rtems/seterr.h>
27#include <rtems/score/isr.h>
28#include <rtems/score/watchdogimpl.h>
29#include <rtems/posix/timerimpl.h>
30#include <rtems/posix/ptimer.h>
31
32bool _POSIX_Timer_Insert_helper(
33  Watchdog_Control               *timer,
34  Watchdog_Interval               ticks,
35  Objects_Id                      id,
36  Watchdog_Service_routine_entry  TSR,
37  void                           *arg
38)
39{
40  ISR_Level            level;
41
42  _Watchdog_Remove_ticks( timer );
43  _ISR_Disable( level );
44
45    /*
46     *  Check to see if the watchdog has just been inserted by a
47     *  higher priority interrupt.  If so, abandon this insert.
48     */
49    if ( timer->state != WATCHDOG_INACTIVE ) {
50      _ISR_Enable( level );
51      return false;
52    }
53
54    /*
55     *  OK.  Now we now the timer was not rescheduled by an interrupt
56     *  so we can atomically initialize it as in use.
57     */
58    _Watchdog_Initialize( timer, TSR, id, arg );
59    _Watchdog_Insert_ticks( timer, ticks );
60  _ISR_Enable( level );
61  return true;
62}
Note: See TracBrowser for help on using the repository browser.