source: rtems/cpukit/score/src/coretodset.c @ 4f5baff

4.115
Last change on this file since 4f5baff was 1b475860, checked in by Christopher Kerl <zargyyoyo@…>, on Nov 29, 2012 at 7:39:17 PM

score misc: Score misc: Clean up Doxygen #6 (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/7976215

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 * @file
3 *
4 * @brief Set Time of Day Given a Timestamp
5 *
6 * @ingroup ScoreTOD
7 */
8
9/*  COPYRIGHT (c) 1989-2007.
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/score/object.h>
23#include <rtems/score/thread.h>
24#include <rtems/score/timestamp.h>
25#include <rtems/score/tod.h>
26#include <rtems/score/watchdog.h>
27
28void _TOD_Set_with_timestamp(
29  const Timestamp_Control *tod
30)
31{
32  uint32_t nanoseconds = _Timestamp_Get_nanoseconds( tod );
33  Watchdog_Interval seconds_next = _Timestamp_Get_seconds( tod );
34  Watchdog_Interval seconds_now;
35
36  _Thread_Disable_dispatch();
37  _TOD_Deactivate();
38
39  seconds_now = _TOD_Seconds_since_epoch();
40
41  if ( seconds_next < seconds_now )
42    _Watchdog_Adjust_seconds( WATCHDOG_BACKWARD, seconds_now - seconds_next );
43  else
44    _Watchdog_Adjust_seconds( WATCHDOG_FORWARD, seconds_next - seconds_now );
45
46  _TOD.now = *tod;
47  _TOD.seconds_trigger = nanoseconds;
48  _TOD.is_set = true;
49
50  _TOD_Activate();
51  _Thread_Enable_dispatch();
52}
Note: See TracBrowser for help on using the repository browser.