source: rtems/cpukit/posix/src/timerinserthelper.c @ 2903090

4.115
Last change on this file since 2903090 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
RevLine 
[ab87219]1/**
2 * @file
3 *
4 * @brief Helper Routine for POSIX TIMERS
[5cb175bb]5 * @ingroup POSIXAPI
[ab87219]6 */
7
[a6cbc9b]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
[c499856]16 *  http://www.rtems.org/license/LICENSE.
[a6cbc9b]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>
[4b48ece0]28#include <rtems/score/watchdogimpl.h>
[f17c779]29#include <rtems/posix/timerimpl.h>
[a6cbc9b]30#include <rtems/posix/ptimer.h>
31
[f8437c8]32bool _POSIX_Timer_Insert_helper(
[a6cbc9b]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
[2903090]42  _Watchdog_Remove_ticks( timer );
[a6cbc9b]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 );
[f8437c8]51      return false;
[a6cbc9b]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 );
[f8437c8]61  return true;
[a6cbc9b]62}
Note: See TracBrowser for help on using the repository browser.