source: rtems/cpukit/score/src/coretodtickle.c @ 3246b0f8

4.115
Last change on this file since 3246b0f8 was 3246b0f8, checked in by Sebastian Huber <sebastian.huber@…>, on 06/13/12 at 09:29:53

score: New structure TOD_Control

Group the global TOD variables (_TOD_Now, _TOD_Uptime, and _TOD_Is_set)
in a structure to reduce address loads in _TOD_Tickle_ticks().

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *  Time of Day (TOD) Handler -- Tickle Ticks
3 */
4
5/*  COPYRIGHT (c) 1989-2007.
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
13#if HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#include <rtems/system.h>
18#include <rtems/score/object.h>
19#include <rtems/score/thread.h>
20#include <rtems/score/timestamp.h>
21#include <rtems/score/tod.h>
22#include <rtems/score/watchdog.h>
23#include <rtems/config.h>
24
25/*
26 *  _TOD_Tickle_ticks
27 *
28 *  This routine processes a clock tick.
29 *
30 *  Input parameters: NONE
31 *
32 *  Output parameters: NONE
33 */
34
35void _TOD_Tickle_ticks( void )
36{
37  Timestamp_Control tick;
38  uint32_t          seconds;
39
40  /* Convert the tick quantum to a timestamp */
41  _Timestamp_Set( &tick, 0, rtems_configuration_get_nanoseconds_per_tick() );
42
43  /* Update the counter of ticks since boot */
44  _Watchdog_Ticks_since_boot += 1;
45
46  /* Update the timespec format uptime */
47  _Timestamp_Add_to( &_TOD.uptime, &tick );
48  /* we do not care how much the uptime changed */
49
50  /* Update the timespec format TOD */
51  seconds = _Timestamp_Add_to_at_tick( &_TOD.now, &tick );
52  while ( seconds ) {
53    _Watchdog_Tickle_seconds();
54    seconds--;
55  }
56}
57
Note: See TracBrowser for help on using the repository browser.