source: rtems/cpukit/score/src/coretodgetuptime.c @ d7c3883

4.115
Last change on this file since d7c3883 was 18657d1, checked in by Sebastian Huber <sebastian.huber@…>, on 12/16/10 at 14:50:12

2010-12-16 Sebastian Huber <sebastian.huber@…>

  • score/src/watchdognanoseconds.c: New file.
  • score/Makefile.am: Reflect change above.
  • score/include/rtems/score/watchdog.h, score/src/coretodget.c, score/src/coretodgetuptime.c: Do not allow NULL as nanoseconds since last tick handler pointer.
  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  Time of Day (TOD) Handler - get uptime
3 */
4
5/*  COPYRIGHT (c) 1989-2008.
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 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/score/isr.h>
21#include <rtems/score/timestamp.h>
22#include <rtems/score/tod.h>
23#include <rtems/score/watchdog.h>
24
25/*
26 *  _TOD_Get_uptime
27 *
28 *  This routine is used to obtain the system uptime
29 *
30 *  Input parameters:
31 *    time  - pointer to the timestamp structure
32 *
33 *  Output parameters: NONE
34 */
35
36void _TOD_Get_uptime(
37  Timestamp_Control *uptime
38)
39{
40  ISR_Level         level;
41  Timestamp_Control offset;
42  Timestamp_Control up;
43  long              nanoseconds;
44
45  /* assume time checked for NULL by caller */
46
47  /* _TOD_Uptime is in native timestamp format */
48  _ISR_Disable( level );
49    up = _TOD_Uptime;
50    nanoseconds = (*_Watchdog_Nanoseconds_since_tick_handler)();
51  _ISR_Enable( level );
52
53  _Timestamp_Set( &offset, 0, nanoseconds );
54  _Timestamp_Add_to( &up, &offset );
55  *uptime = up;
56}
Note: See TracBrowser for help on using the repository browser.