source: rtems/cpukit/score/src/coretodget.c @ 62181b21

4.11
Last change on this file since 62181b21 was 62181b21, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 16, 2012 at 12:59:27 PM

score: Add and use _TOD_Get_with_nanoseconds()

Delete _TOD_Get_as_timestamp().

  • Property mode set to 100644
File size: 893 bytes
Line 
1/*
2 *  Time of Day (TOD) Handler - get TOD
3 *
4 *  COPYRIGHT (c) 1989-2008.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 */
11
12#if HAVE_CONFIG_H
13  #include "config.h"
14#endif
15
16#include <rtems/score/tod.h>
17#include <rtems/score/watchdog.h>
18
19Timestamp_Control *_TOD_Get_with_nanoseconds(
20  Timestamp_Control *snapshot,
21  const Timestamp_Control *clock
22)
23{
24  ISR_Level         level;
25  Timestamp_Control offset;
26  Timestamp_Control now;
27  uint32_t          nanoseconds;
28
29  _ISR_Disable( level );
30    nanoseconds = (*_Watchdog_Nanoseconds_since_tick_handler)();
31    now = *clock;
32  _ISR_Enable( level );
33
34  _Timestamp_Set( &offset, 0, nanoseconds );
35  _Timestamp_Add_to( &now, &offset );
36
37  *snapshot = now;
38
39  return snapshot;
40}
Note: See TracBrowser for help on using the repository browser.