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

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.3 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.org/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  TOD_Control       *tod = &_TOD;
28  ISR_lock_Context   lock_context;
29  Timestamp_Control  tick;
30  uint32_t           nanoseconds_per_tick;
31
32  nanoseconds_per_tick = rtems_configuration_get_nanoseconds_per_tick();
33
34  /* Convert the tick quantum to a timestamp */
35  _Timestamp_Set( &tick, 0, nanoseconds_per_tick );
36
37  /* Update the counter of ticks since boot */
38  _Watchdog_Ticks_since_boot += 1;
39
40  _TOD_Acquire( tod, &lock_context );
41
42  /* Update the uptime */
43  _Timestamp_Add_to( &tod->uptime, &tick );
44
45  /* Update the current TOD */
46  _Timestamp_Add_to( &tod->now, &tick );
47
48  _TOD_Release( tod, &lock_context );
49
50  _TOD.seconds_trigger += nanoseconds_per_tick;
51  if ( _TOD.seconds_trigger >= 1000000000UL ) {
52    _TOD.seconds_trigger -= 1000000000UL;
53    _Watchdog_Tickle_seconds();
54  }
55}
56
Note: See TracBrowser for help on using the repository browser.