source: rtems/cpukit/rtems/src/taskwakewhen.c @ 52adc808

4.115
Last change on this file since 52adc808 was 52adc808, checked in by Alex Ivanov <alexivanov97@…>, on 12/02/12 at 16:03:09

score misc: Clean up Doxygen #12 (GCI 2012)

This patch is a task from GCI 2012 which improves the Doxygen
comments in the RTEMS source.

http://www.google-melange.com/gci/task/view/google/gci2012/8025203

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Task Wake When
5 *  @ingroup ClassicTasks
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-1999.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/rtems/status.h>
23#include <rtems/rtems/support.h>
24#include <rtems/rtems/modes.h>
25#include <rtems/rtems/clock.h>
26#include <rtems/score/object.h>
27#include <rtems/score/stack.h>
28#include <rtems/score/states.h>
29#include <rtems/rtems/tasks.h>
30#include <rtems/score/thread.h>
31#include <rtems/score/threadq.h>
32#include <rtems/score/tod.h>
33#include <rtems/score/wkspace.h>
34#include <rtems/score/apiext.h>
35#include <rtems/score/sysstate.h>
36
37rtems_status_code rtems_task_wake_when(
38  rtems_time_of_day *time_buffer
39)
40{
41  Watchdog_Interval   seconds;
42
43  if ( !_TOD.is_set )
44    return RTEMS_NOT_DEFINED;
45
46  if ( !time_buffer )
47    return RTEMS_INVALID_ADDRESS;
48
49  time_buffer->ticks = 0;
50
51  if ( !_TOD_Validate( time_buffer ) )
52    return RTEMS_INVALID_CLOCK;
53
54  seconds = _TOD_To_seconds( time_buffer );
55
56  if ( seconds <= _TOD_Seconds_since_epoch() )
57    return RTEMS_INVALID_CLOCK;
58
59  _Thread_Disable_dispatch();
60    _Thread_Set_state( _Thread_Executing, STATES_WAITING_FOR_TIME );
61    _Watchdog_Initialize(
62      &_Thread_Executing->Timer,
63      _Thread_Delay_ended,
64      _Thread_Executing->Object.id,
65      NULL
66    );
67    _Watchdog_Insert_seconds(
68      &_Thread_Executing->Timer,
69      seconds - _TOD_Seconds_since_epoch()
70    );
71  _Thread_Enable_dispatch();
72  return RTEMS_SUCCESSFUL;
73}
Note: See TracBrowser for help on using the repository browser.