source: rtems/cpukit/score/src/coretodtickle.c @ f031df0e

4.115
Last change on this file since f031df0e was f031df0e, checked in by Sebastian Huber <sebastian.huber@…>, on 07/31/13 at 11:42:07

score: Rename tod.h to todimpl.h

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 * @file
3 *
4 * @brief Increments time of day at each clock tick
5 *
6 * @ingroup ScoreTODConstants
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/score/todimpl.h>
22#include <rtems/score/watchdogimpl.h>
23#include <rtems/config.h>
24
25void _TOD_Tickle_ticks( void )
26{
27  Timestamp_Control tick;
28  uint32_t          nanoseconds_per_tick;
29
30  nanoseconds_per_tick = rtems_configuration_get_nanoseconds_per_tick();
31
32  /* Convert the tick quantum to a timestamp */
33  _Timestamp_Set( &tick, 0, nanoseconds_per_tick );
34
35  /* Update the counter of ticks since boot */
36  _Watchdog_Ticks_since_boot += 1;
37
38  /* Update the uptime */
39  _Timestamp_Add_to( &_TOD.uptime, &tick );
40  /* we do not care how much the uptime changed */
41
42  /* Update the current TOD */
43  _Timestamp_Add_to( &_TOD.now, &tick );
44
45  _TOD.seconds_trigger += nanoseconds_per_tick;
46  if ( _TOD.seconds_trigger >= 1000000000UL ) {
47    _TOD.seconds_trigger -= 1000000000UL;
48    _Watchdog_Tickle_seconds();
49  }
50}
51
Note: See TracBrowser for help on using the repository browser.