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

4.10
Last change on this file since e3f6d35 was 9dc2c8d, checked in by Joel Sherrill <joel.sherrill@…>, on 12/10/08 at 22:13:28

2008-12-10 Joel Sherrill <joel.sherrill@…>

  • rtems/include/rtems/rtems/ratemon.h, rtems/include/rtems/rtems/types.h, rtems/src/ratemongetstatistics.c, rtems/src/ratemongetstatus.c, rtems/src/ratemonperiod.c, rtems/src/ratemonreportstatistics.c, score/include/rtems/score/thread.h, score/src/coretodgetuptime.c: Make all Thread and Period Statistics use publicly defined types. Do not leak the SuperCore? Timestamp type through the APIs.
  • 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  nanoseconds = 0;
49  _ISR_Disable( level );
50    up = _TOD_Uptime;
51    if ( _Watchdog_Nanoseconds_since_tick_handler )
52      nanoseconds = (*_Watchdog_Nanoseconds_since_tick_handler)();
53  _ISR_Enable( level );
54
55  _Timestamp_Set( &offset, 0, nanoseconds );
56  _Timestamp_Add_to( &up, &offset );
57  *uptime = up;
58}
Note: See TracBrowser for help on using the repository browser.