source: rtems/cpukit/rtems/src/timerfirewhen.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.2 KB
Line 
1/*
2 *  Timer Manager - rtems_timer_fire_when 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_when
28 *
29 *  This directive allows a thread to start a timer.
30 *
31 *  Input parameters:
32 *    id        - timer id
33 *    wall_time - time of day to fire timer
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_when(
43  rtems_id                            id,
44  rtems_time_of_day                  *wall_time,
45  rtems_timer_service_routine_entry   routine,
46  void                               *user_data
47)
48{
49  Timer_Control       *the_timer;
50  Objects_Locations    location;
51  rtems_interval       seconds;
52
53  if ( !_TOD_Is_set )
54    return RTEMS_NOT_DEFINED;
55
56  if ( !_TOD_Validate( wall_time ) )
57    return RTEMS_INVALID_CLOCK;
58
59  if ( !routine )
60    return RTEMS_INVALID_ADDRESS;
61
62  seconds = _TOD_To_seconds( wall_time );
63  if ( seconds <= _TOD_Seconds_since_epoch() )
64    return RTEMS_INVALID_CLOCK;
65
66  the_timer = _Timer_Get( id, &location );
67  switch ( location ) {
68
69    case OBJECTS_LOCAL:
70      (void) _Watchdog_Remove( &the_timer->Ticker );
71      the_timer->the_class = TIMER_TIME_OF_DAY;
72      _Watchdog_Initialize( &the_timer->Ticker, routine, id, user_data );
73      _Watchdog_Insert_seconds(
74         &the_timer->Ticker,
75         seconds - _TOD_Seconds_since_epoch()
76       );
77      _Thread_Enable_dispatch();
78      return RTEMS_SUCCESSFUL;
79
80#if defined(RTEMS_MULTIPROCESSING)
81    case OBJECTS_REMOTE:            /* should never return this */
82#endif
83    case OBJECTS_ERROR:
84      break;
85  }
86
87  return RTEMS_INVALID_ID;
88}
Note: See TracBrowser for help on using the repository browser.