source: rtems/cpukit/score/src/coretodtickle.c @ 25f5730f

4.115
Last change on this file since 25f5730f 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
RevLine 
[1b475860]1/**
2 * @file
3 *
4 * @brief Increments time of day at each clock tick
5 *
6 * @ingroup ScoreTODConstants
[412dbff6]7 */
8
9/*  COPYRIGHT (c) 1989-2007.
[fc054ca]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
[c499856]14 *  http://www.rtems.org/license/LICENSE.
[fc054ca]15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
[f031df0e]21#include <rtems/score/todimpl.h>
[4b48ece0]22#include <rtems/score/watchdogimpl.h>
[26fb4aa]23#include <rtems/config.h>
[fc054ca]24
25void _TOD_Tickle_ticks( void )
26{
[9bf7467]27  TOD_Control       *tod = &_TOD;
[d50acdbb]28  ISR_lock_Context   lock_context;
[9bf7467]29  Timestamp_Control  tick;
30  uint32_t           nanoseconds_per_tick;
[c34bb0d]31
32  nanoseconds_per_tick = rtems_configuration_get_nanoseconds_per_tick();
[fc054ca]33
[c16bcc0]34  /* Convert the tick quantum to a timestamp */
[c34bb0d]35  _Timestamp_Set( &tick, 0, nanoseconds_per_tick );
[fc054ca]36
37  /* Update the counter of ticks since boot */
38  _Watchdog_Ticks_since_boot += 1;
39
[d50acdbb]40  _TOD_Acquire( tod, &lock_context );
[9bf7467]41
[c34bb0d]42  /* Update the uptime */
[9bf7467]43  _Timestamp_Add_to( &tod->uptime, &tick );
[fc054ca]44
[c34bb0d]45  /* Update the current TOD */
[9bf7467]46  _Timestamp_Add_to( &tod->now, &tick );
47
[d50acdbb]48  _TOD_Release( tod, &lock_context );
[c34bb0d]49
50  _TOD.seconds_trigger += nanoseconds_per_tick;
51  if ( _TOD.seconds_trigger >= 1000000000UL ) {
52    _TOD.seconds_trigger -= 1000000000UL;
[fc054ca]53    _Watchdog_Tickle_seconds();
54  }
55}
56
Note: See TracBrowser for help on using the repository browser.