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

4.11
Last change on this file since f031df0e was f031df0e, checked in by Sebastian Huber <sebastian.huber@…>, on Jul 31, 2013 at 11:42:07 AM

score: Rename tod.h to todimpl.h

  • Property mode set to 100644
File size: 1006 bytes
RevLine 
[355ee7d]1/**
2 *  @file
[812da54]3 *
[355ee7d]4 *  @brief Returns a Current TOD with Nanosecond Granularity
5 *  @ingroup ScoreTODConstants
6 */
7
8/*
[6a614160]9 *  COPYRIGHT (c) 1989-2008.
[812da54]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
[62181b21]18  #include "config.h"
[812da54]19#endif
20
[f031df0e]21#include <rtems/score/todimpl.h>
[88c74ab]22#include <rtems/score/isrlevel.h>
[4b48ece0]23#include <rtems/score/watchdogimpl.h>
[812da54]24
[62181b21]25Timestamp_Control *_TOD_Get_with_nanoseconds(
26  Timestamp_Control *snapshot,
27  const Timestamp_Control *clock
[812da54]28)
29{
[c16bcc0]30  ISR_Level         level;
31  Timestamp_Control offset;
32  Timestamp_Control now;
[62181b21]33  uint32_t          nanoseconds;
[812da54]34
35  _ISR_Disable( level );
[18657d1]36    nanoseconds = (*_Watchdog_Nanoseconds_since_tick_handler)();
[62181b21]37    now = *clock;
[812da54]38  _ISR_Enable( level );
39
[c16bcc0]40  _Timestamp_Set( &offset, 0, nanoseconds );
41  _Timestamp_Add_to( &now, &offset );
[8d7aea0d]42
[62181b21]43  *snapshot = now;
44
45  return snapshot;
[812da54]46}
Note: See TracBrowser for help on using the repository browser.