source: rtems/cpukit/score/src/coretod.c @ f26145b

4.104.114.84.95
Last change on this file since f26145b was a8eed23, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/27/05 at 05:57:05

Include config.h.

  • 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  _TOD_Seconds_since_epoch = 0;
44
45  _TOD_Current.year   = TOD_BASE_YEAR;
46  _TOD_Current.month  = 1;
47  _TOD_Current.day    = 1;
48  _TOD_Current.hour   = 0;
49  _TOD_Current.minute = 0;
50  _TOD_Current.second = 0;
51  _TOD_Current.ticks  = 0;
52
53  if ( microseconds_per_tick == 0 )
54    _TOD_Ticks_per_second = 0;
55  else
56    _TOD_Ticks_per_second =
57       TOD_MICROSECONDS_PER_SECOND / microseconds_per_tick;
58
59  _Watchdog_Initialize( &_TOD_Seconds_watchdog, _TOD_Tickle, 0, NULL );
60
61  _TOD_Is_set = FALSE;
62  _TOD_Activate( _TOD_Ticks_per_second );
63}
Note: See TracBrowser for help on using the repository browser.