source: rtems/cpukit/score/src/coretod.c @ 812da54

4.104.114.84.95
Last change on this file since 812da54 was 812da54, checked in by Joel Sherrill <joel.sherrill@…>, on 04/02/07 at 18:23:59

2007-04-02 Joel Sherrill <joel@…>

  • itron/src/itrontime.c, libcsupport/src/gettod.c, posix/include/rtems/posix/time.h, posix/include/rtems/posix/timer.h, posix/src/clockgettime.c, posix/src/clocksettime.c, posix/src/nanosleep.c, posix/src/posixtimespecsubtract.c, posix/src/posixtimespectointerval.c, posix/src/ptimer1.c, posix/src/sleep.c, rtems/Makefile.am, rtems/include/rtems/rtems/clock.h, rtems/include/rtems/rtems/timer.h, rtems/include/rtems/rtems/types.h, rtems/src/clockget.c, rtems/src/clockset.c, rtems/src/clocktodtoseconds.c, rtems/src/clocktodvalidate.c, rtems/src/taskwakewhen.c, score/Makefile.am, score/include/rtems/score/tod.h, score/inline/rtems/score/tod.inl, score/src/coretod.c, score/src/coretodset.c: Convert from Classic API style TOD_Control as fundamental time structure to POSIX struct timespec. Add clock_get_uptime().
  • rtems/src/clockgetuptime.c, score/src/coretodget.c, score/src/coretodgetuptime.c: New files.
  • score/src/coretodtickle.c, score/src/coretodtoseconds.c, score/src/coretodvalidate.c: Removed.
  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  Time of Day (TOD) Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
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 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/score/object.h>
21#include <rtems/score/thread.h>
22#include <rtems/score/tod.h>
23#include <rtems/score/watchdog.h>
24
25/*PAGE
26 *
27 *  _TOD_Handler_initialization
28 *
29 *  This routine initializes the time of day handler.
30 *
31 *  Input parameters:
32 *    microseconds_per_tick - microseconds between clock ticks
33 *
34 *  Output parameters: NONE
35 */
36
37void _TOD_Handler_initialization(
38  uint32_t   microseconds_per_tick
39)
40{
41  _TOD_Microseconds_per_tick = microseconds_per_tick;
42
43  /* POSIX format TOD (timespec) */
44  _TOD_Now.tv_sec  = TOD_SECONDS_1970_THROUGH_1988;
45  _TOD_Now.tv_nsec = 0;
46
47  /* Uptime (timespec) */
48  _TOD_Uptime.tv_sec  = 0;
49  _TOD_Uptime.tv_nsec = 0;
50
51  /* Seconds since RTEMS Epoch (1988) */
52  _TOD_Seconds_since_epoch = 0;
53
54  /* Protect ourselves from a divide by zero fault */
55  if ( microseconds_per_tick == 0 )
56    _TOD_Ticks_per_second = 0;
57  else
58    _TOD_Ticks_per_second =
59       TOD_MICROSECONDS_PER_SECOND / microseconds_per_tick;
60
61  /* TOD has not been set */
62  _TOD_Is_set = FALSE;
63  _TOD_Activate( _TOD_Ticks_per_second );
64}
Note: See TracBrowser for help on using the repository browser.