summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/coretod.c
blob: a6c85f128b46da63a60f3420830b2e96b61ce9f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
 * @file
 *
 * @brief Initializes the Time of Day Handler
 *
 * @ingroup ScoreTODConstants
 */

/*  COPYRIGHT (c) 1989-2008.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.com/license/LICENSE.
 */

#if HAVE_CONFIG_H
#include "config.h"
#endif

#include <rtems/score/todimpl.h>

static uint32_t _TOD_Nanoseconds_since_tick_default_handler( void )
{
  return 0;
}

void _TOD_Handler_initialization(void)
{
  TOD_Control *tod = &_TOD;

  _ISR_lock_Initialize( &tod->lock, "TOD" );

  _Timestamp_Set( &tod->now, TOD_SECONDS_1970_THROUGH_1988, 0 );

  _Timestamp_Set_to_zero( &tod->uptime );

  tod->nanoseconds_since_last_tick =
    _TOD_Nanoseconds_since_tick_default_handler;

  /* TOD has not been set */
  tod->is_set = false;
}