source: rtems/cpukit/rtems/src/timerfireafter.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 *  Timer Manager - rtems_timer_fire_after directive
3 *
4 *
5 *  COPYRIGHT (c) 1989-2007.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 */
12
13#if HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#include <rtems/system.h>
18#include <rtems/rtems/status.h>
19#include <rtems/rtems/support.h>
20#include <rtems/score/object.h>
21#include <rtems/score/thread.h>
22#include <rtems/rtems/timer.h>
23#include <rtems/score/tod.h>
24#include <rtems/score/watchdog.h>
25
26/*
27 *  rtems_timer_fire_after
28 *
29 *  This directive allows a thread to start a timer.
30 *
31 *  Input parameters:
32 *    id        - timer id
33 *    ticks     - interval until routine is fired
34 *    routine   - routine to schedule
35 *    user_data - passed as argument to routine when it is fired
36 *
37 *  Output parameters:
38 *    RTEMS_SUCCESSFUL - if successful
39 *    error code       - if unsuccessful
40 */
41
42rtems_status_code rtems_timer_fire_after(
43  rtems_id                           id,
44  rtems_interval                     ticks,
45  rtems_timer_service_routine_entry  routine,
46  void                              *user_data
47)
48{
49  Timer_Control      *the_timer;
50  Objects_Locations   location;
51  ISR_Level           level;
52
53  if ( ticks == 0 )
54    return RTEMS_INVALID_NUMBER;
55
56  if ( !routine )
57    return RTEMS_INVALID_ADDRESS;
58
59  the_timer = _Timer_Get( id, &location );
60  switch ( location ) {
61
62    case OBJECTS_LOCAL:
63      (void) _Watchdog_Remove( &the_timer->Ticker );
64
65      _ISR_Disable( level );
66
67        /*
68         *  Check to see if the watchdog has just been inserted by a
69         *  higher priority interrupt.  If so, abandon this insert.
70         */
71
72        if ( the_timer->Ticker.state != WATCHDOG_INACTIVE ) {
73          _ISR_Enable( level );
74          _Thread_Enable_dispatch();
75          return RTEMS_SUCCESSFUL;
76        }
77
78        /*
79         *  OK.  Now we now the timer was not rescheduled by an interrupt
80         *  so we can atomically initialize it as in use.
81         */
82
83        the_timer->the_class = TIMER_INTERVAL;
84        _Watchdog_Initialize( &the_timer->Ticker, routine, id, user_data );
85      _ISR_Enable( level );
86
87
88      _Watchdog_Insert_ticks( &the_timer->Ticker, ticks );
89      _Thread_Enable_dispatch();
90      return RTEMS_SUCCESSFUL;
91
92#if defined(RTEMS_MULTIPROCESSING)
93    case OBJECTS_REMOTE:            /* should never return this */
94#endif
95    case OBJECTS_ERROR:
96      break;
97  }
98
99  return RTEMS_INVALID_ID;
100}
Note: See TracBrowser for help on using the repository browser.