diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-11-16 13:59:27 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-11-21 16:24:22 +0100 |
commit | 62181b21c2ebe7d5b5f82272dc9bfd4175e4254a (patch) | |
tree | 4c308d3c621ebc1dbade0ec4da3cc880f151447e /cpukit/score/src | |
parent | score: Add _Timestamp_To_timeval() (diff) | |
download | rtems-62181b21c2ebe7d5b5f82272dc9bfd4175e4254a.tar.bz2 |
score: Add and use _TOD_Get_with_nanoseconds()
Delete _TOD_Get_as_timestamp().
Diffstat (limited to 'cpukit/score/src')
-rw-r--r-- | cpukit/score/src/coretodget.c | 22 | ||||
-rw-r--r-- | cpukit/score/src/coretodgetuptime.c | 54 |
2 files changed, 9 insertions, 67 deletions
diff --git a/cpukit/score/src/coretodget.c b/cpukit/score/src/coretodget.c index 94517e5926..448bc7ba55 100644 --- a/cpukit/score/src/coretodget.c +++ b/cpukit/score/src/coretodget.c @@ -10,35 +10,31 @@ */ #if HAVE_CONFIG_H -#include "config.h" + #include "config.h" #endif -#include <rtems/system.h> -#include <rtems/score/isr.h> -#include <rtems/score/timespec.h> -#include <rtems/score/timestamp.h> #include <rtems/score/tod.h> #include <rtems/score/watchdog.h> -void _TOD_Get_as_timestamp( - Timestamp_Control *tod +Timestamp_Control *_TOD_Get_with_nanoseconds( + Timestamp_Control *snapshot, + const Timestamp_Control *clock ) { ISR_Level level; Timestamp_Control offset; Timestamp_Control now; - long nanoseconds; + uint32_t nanoseconds; - /* assume time checked for NULL by caller */ - - /* _TOD.now is the native current time */ _ISR_Disable( level ); - now = _TOD.now; nanoseconds = (*_Watchdog_Nanoseconds_since_tick_handler)(); + now = *clock; _ISR_Enable( level ); _Timestamp_Set( &offset, 0, nanoseconds ); _Timestamp_Add_to( &now, &offset ); - *tod = now; + *snapshot = now; + + return snapshot; } diff --git a/cpukit/score/src/coretodgetuptime.c b/cpukit/score/src/coretodgetuptime.c deleted file mode 100644 index c3c05aed3c..0000000000 --- a/cpukit/score/src/coretodgetuptime.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Time of Day (TOD) Handler - get uptime - */ - -/* COPYRIGHT (c) 1989-2008. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <rtems/system.h> -#include <rtems/score/isr.h> -#include <rtems/score/timestamp.h> -#include <rtems/score/tod.h> -#include <rtems/score/watchdog.h> - -/* - * _TOD_Get_uptime - * - * This routine is used to obtain the system uptime - * - * Input parameters: - * time - pointer to the timestamp structure - * - * Output parameters: NONE - */ - -void _TOD_Get_uptime( - Timestamp_Control *uptime -) -{ - ISR_Level level; - Timestamp_Control offset; - Timestamp_Control up; - long nanoseconds; - - /* assume time checked for NULL by caller */ - - /* _TOD.uptime is in native timestamp format */ - _ISR_Disable( level ); - up = _TOD.uptime; - nanoseconds = (*_Watchdog_Nanoseconds_since_tick_handler)(); - _ISR_Enable( level ); - - _Timestamp_Set( &offset, 0, nanoseconds ); - _Timestamp_Add_to( &up, &offset ); - *uptime = up; -} |