Changeset 62181b21 in rtems


Ignore:
Timestamp:
Nov 16, 2012, 12:59:27 PM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
bfddb047
Parents:
154721c4
git-author:
Sebastian Huber <sebastian.huber@…> (11/16/12 12:59:27)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/21/12 15:24:22)
Message:

score: Add and use _TOD_Get_with_nanoseconds()

Delete _TOD_Get_as_timestamp().

Location:
cpukit/score
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/Makefile.am

    r154721c4 r62181b21  
    308308## TOD_C_FILES
    309309libscore_a_SOURCES += src/coretod.c src/coretodset.c src/coretodget.c \
    310     src/coretodgetuptime.c src/coretodgetuptimetimespec.c src/coretodtickle.c \
     310    src/coretodgetuptimetimespec.c src/coretodtickle.c \
    311311    src/coretodmsecstoticks.c src/coretodtickspersec.c src/coretodusectoticks.c
    312312
  • cpukit/score/include/rtems/score/tod.h

    r154721c4 r62181b21  
    198198
    199199/**
    200  *  @brief Returns the time of day in @a tod_as_timestamp.
    201  *
    202  *  The @a tod_as_timestamp timestamp represents the time since UNIX epoch.
    203  */
    204 void _TOD_Get_as_timestamp(
    205   Timestamp_Control *tod_as_timestamp
     200 *  @brief Returns a snapshot of a clock.
     201 *
     202 *  This function invokes the nanoseconds extension.
     203 *
     204 *  @param[out] snapshot The snapshot.
     205 *  @param[in] source The clock.
     206 *
     207 *  @return The snapshot.
     208 */
     209Timestamp_Control *_TOD_Get_with_nanoseconds(
     210  Timestamp_Control *snapshot,
     211  const Timestamp_Control *clock
    206212);
    207213
     
    210216)
    211217{
    212   Timestamp_Control tod_as_timestamp;
    213 
    214   _TOD_Get_as_timestamp( &tod_as_timestamp );
    215   _Timestamp_To_timespec( &tod_as_timestamp, tod_as_timespec );
     218  Timestamp_Control  tod_as_timestamp;
     219  Timestamp_Control *tod_as_timestamp_ptr;
     220
     221  tod_as_timestamp_ptr =
     222    _TOD_Get_with_nanoseconds( &tod_as_timestamp, &_TOD.now );
     223  _Timestamp_To_timespec( tod_as_timestamp_ptr, tod_as_timespec );
    216224}
    217225
     
    224232 *  @param[in] time is a pointer to the uptime to be returned
    225233 */
    226 void _TOD_Get_uptime(
     234static inline void _TOD_Get_uptime(
    227235  Timestamp_Control *time
    228 );
     236)
     237{
     238  _TOD_Get_with_nanoseconds( time, &_TOD.uptime );
     239}
    229240
    230241/**
  • cpukit/score/inline/rtems/score/tod.inl

    r154721c4 r62181b21  
    5757)
    5858{
    59   ISR_Level       level;
    60   struct timespec now;
    61   suseconds_t     useconds;
     59  Timestamp_Control  snapshot_as_timestamp;
     60  Timestamp_Control *snapshot_as_timestamp_ptr;
    6261
    63   _ISR_Disable(level);
    64     _TOD_Get( &now );
    65   _ISR_Enable(level);
    66 
    67   useconds = (suseconds_t)now.tv_nsec;
    68   useconds /= (suseconds_t)TOD_NANOSECONDS_PER_MICROSECOND;
    69 
    70   time->tv_sec  = now.tv_sec;
    71   time->tv_usec = useconds;
     62  snapshot_as_timestamp_ptr =
     63    _TOD_Get_with_nanoseconds( &snapshot_as_timestamp, &_TOD.now );
     64  _Timestamp_To_timeval( snapshot_as_timestamp_ptr, time );
    7265}
    7366
  • cpukit/score/src/coretodget.c

    r154721c4 r62181b21  
    1111
    1212#if HAVE_CONFIG_H
    13 #include "config.h"
     13  #include "config.h"
    1414#endif
    1515
    16 #include <rtems/system.h>
    17 #include <rtems/score/isr.h>
    18 #include <rtems/score/timespec.h>
    19 #include <rtems/score/timestamp.h>
    2016#include <rtems/score/tod.h>
    2117#include <rtems/score/watchdog.h>
    2218
    23 void _TOD_Get_as_timestamp(
    24   Timestamp_Control *tod
     19Timestamp_Control *_TOD_Get_with_nanoseconds(
     20  Timestamp_Control *snapshot,
     21  const Timestamp_Control *clock
    2522)
    2623{
     
    2825  Timestamp_Control offset;
    2926  Timestamp_Control now;
    30   long              nanoseconds;
     27  uint32_t          nanoseconds;
    3128
    32   /* assume time checked for NULL by caller */
    33 
    34   /* _TOD.now is the native current time */
    3529  _ISR_Disable( level );
    36     now = _TOD.now;
    3730    nanoseconds = (*_Watchdog_Nanoseconds_since_tick_handler)();
     31    now = *clock;
    3832  _ISR_Enable( level );
    3933
     
    4135  _Timestamp_Add_to( &now, &offset );
    4236
    43   *tod = now;
     37  *snapshot = now;
     38
     39  return snapshot;
    4440}
Note: See TracChangeset for help on using the changeset viewer.