Changeset 3a42e6fd in rtems


Ignore:
Timestamp:
09/28/11 14:42:12 (12 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
33c0f97
Parents:
c18be8ee
Message:

2011-09-28 Sebastian Huber <sebastian.huber@…>

PR 1914/cpukit

  • score/src/timespecgreaterthan.c, score/src/ts64greaterthan.c: Removed files.
  • score/Makefile.am: Reflect changes above.
  • score/include/rtems/score/timespec.h, score/include/rtems/score/timestamp.h, score/include/rtems/score/timestamp64.h, score/src/ts64addto.c, score/src/ts64divide.c, score/src/ts64dividebyinteger.c, score/src/ts64equalto.c, score/src/ts64getnanoseconds.c, score/src/ts64getseconds.c, score/src/ts64lessthan.c, score/src/ts64set.c, score/src/ts64settozero.c, score/src/ts64subtract.c, score/src/ts64toticks.c, score/src/ts64totimespec.c: Use CPU_TIMESTAMP_USE_STRUCT_TIMESPEC, CPU_TIMESTAMP_USE_INT64, and CPU_TIMESTAMP_USE_INT64_INLINE. Removed copy and paste.
Location:
cpukit
Files:
2 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    rc18be8ee r3a42e6fd  
     12011-09-28      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        PR 1914/cpukit
     4        * score/src/timespecgreaterthan.c, score/src/ts64greaterthan.c:
     5        Removed files.
     6        * score/Makefile.am: Reflect changes above.
     7        * score/include/rtems/score/timespec.h,
     8        score/include/rtems/score/timestamp.h,
     9        score/include/rtems/score/timestamp64.h, score/src/ts64addto.c,
     10        score/src/ts64divide.c, score/src/ts64dividebyinteger.c,
     11        score/src/ts64equalto.c, score/src/ts64getnanoseconds.c,
     12        score/src/ts64getseconds.c, score/src/ts64lessthan.c,
     13        score/src/ts64set.c, score/src/ts64settozero.c,
     14        score/src/ts64subtract.c, score/src/ts64toticks.c,
     15        score/src/ts64totimespec.c: Use CPU_TIMESTAMP_USE_STRUCT_TIMESPEC,
     16        CPU_TIMESTAMP_USE_INT64, and CPU_TIMESTAMP_USE_INT64_INLINE.  Removed
     17        copy and paste.
     18
    1192011-09-26      Petr Benes <benesp16@fel.cvut.cz>
    220
  • cpukit/score/Makefile.am

    rc18be8ee r3a42e6fd  
    296296## TIMESPEC_C_FILES
    297297libscore_a_SOURCES += src/timespecaddto.c src/timespecfromticks.c \
    298     src/timespecisvalid.c src/timespeclessthan.c src/timespecgreaterthan.c \
     298    src/timespecisvalid.c src/timespeclessthan.c \
    299299    src/timespecsubtract.c src/timespectoticks.c src/timespecdivide.c \
    300300    src/timespecdividebyinteger.c
     
    304304    src/ts64divide.c src/ts64equalto.c \
    305305    src/ts64getnanoseconds.c src/ts64getseconds.c \
    306     src/ts64greaterthan.c src/ts64lessthan.c \
     306    src/ts64lessthan.c \
    307307    src/ts64set.c src/ts64settozero.c src/ts64subtract.c \
    308308    src/ts64toticks.c src/ts64totimespec.c
  • cpukit/score/include/rtems/score/timespec.h

    rc18be8ee r3a42e6fd  
    132132 *          false otherwise.
    133133 */
    134 bool _Timespec_Greater_than(
    135   const struct timespec *lhs,
    136   const struct timespec *rhs
    137 );
     134#define _Timespec_Greater_than( _lhs, _rhs ) \
     135  _Timespec_Less_than( _rhs, _lhs )
    138136
    139137/**
  • cpukit/score/include/rtems/score/timestamp.h

    rc18be8ee r3a42e6fd  
    4141/**@{*/
    4242
     43#include <rtems/score/cpu.h>
    4344#include <rtems/score/timespec.h>
    4445
     
    4748#endif
    4849
    49 /*
    50  *  NOTE: Eventually each port should select what it should use!!!
    51  *
    52  *  These control which implementation of SuperCore Timestamp is used.
    53  *
    54  *  if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
    55  *     struct timespec is used
    56  *  else if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)
    57  *     int64_t is used
    58  *
    59  *  When int64_t is used, then
    60  *     if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
    61  *        the methods are inlined
    62  *     else
    63  *        the methods are NOT inlined
    64  *
    65  *  Performance of int64_t versus struct timespec
    66  *  =============================================
    67  *
    68  *  On PowerPC/psim, inlined int64_t saves ~50 instructions on each
    69  *    _Thread_Dispatch operation which results in a context switch.
    70  *    This works out to be about 10% faster dispatches and 7.5% faster
    71  *    blocking semaphore obtains.  The following numbers are in instructions
    72  *    and from tm02 and tm26.
    73  *
    74  *                         timespec  int64  inlined int64
    75  *    dispatch:              446      446      400
    76  *    blocking sem obtain:   627      626      581
    77  *
    78  *  On SPARC/sis, inlined int64_t shows the same percentage gains.
    79  *    The following numbers are in microseconds and from tm02 and tm26.
    80  *
    81  *                         timespec  int64  inlined int64
    82  *    dispatch:               59       61       53
    83  *    blocking sem obtain:    98      100       92
    84  *
    85  *  Inlining appears to have a tendency to increase the size of
    86  *    some executables.
    87  *  Not inlining reduces the execution improvement but does not seem to
    88  *    be an improvement on the PowerPC and SPARC. The struct timespec
    89  *    and the executables with int64 not inlined are about the same size.
    90  *
    91  *  Once there has some analysis of which algorithm and configuration
    92  *  is best suited to each target, these defines should be moved to
    93  *  the appropriate score/cpu cpu.h file.  In the meantime, it is
    94  *  appropriate to select an implementation here using CPU macros.
    95  */
    96 
    97 #define CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC
    98 /*
    99 #define CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64
    100 #define CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE
    101 */
    102 
    103 /*
    104  *  Verify something is defined.
    105  */
    106 #if !defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC) && \
    107     !defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)
    108   #error "No SuperCore Timestamp implementation selected."
    109 #endif
    110 
    111 /*
    112  * Verify that more than one is not defined.
    113  */
    114 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC) && \
    115     defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)
    116   #error "Too many SuperCore Timestamp implementations selected."
    117 #endif
    118 
    119 /**
    120  *   Include any implementation specific header files
    121  */
    122 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)
     50#if ! ( ( CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE \
     51    && CPU_TIMESTAMP_USE_INT64 == FALSE \
     52    && CPU_TIMESTAMP_USE_INT64_INLINE == FALSE ) \
     53  || ( CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == FALSE \
     54    && CPU_TIMESTAMP_USE_INT64 == TRUE \
     55    && CPU_TIMESTAMP_USE_INT64_INLINE == FALSE ) \
     56  || ( CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == FALSE \
     57    && CPU_TIMESTAMP_USE_INT64 == FALSE \
     58    && CPU_TIMESTAMP_USE_INT64_INLINE == TRUE ) )
     59  #error "Invalid SuperCore Timestamp implementations selection."
     60#endif
     61
     62#if CPU_TIMESTAMP_USE_INT64 == TRUE || CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
    12363  #include <rtems/score/timestamp64.h>
    12464#endif
     
    12767 *   Define the Timestamp control type.
    12868 */
    129 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     69#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    13070  typedef struct timespec Timestamp_Control;
    13171#else
     
    14383 *  @param[in] _nanoseconds is the nanoseconds portion of the timestamp
    14484 */
    145 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     85#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    14686  #define _Timestamp_Set( _time, _seconds, _nanoseconds ) \
    14787          _Timespec_Set( _time, _seconds, _nanoseconds )
     
    15999 *  @param[in] _time points to the timestamp instance to zero.
    160100 */
    161 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     101#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    162102  #define _Timestamp_Set_to_zero( _time ) \
    163103          _Timespec_Set_to_zero( _time )
     
    177117 *          false otherwise.
    178118 */
    179 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     119#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    180120  #define _Timestamp_Is_valid( _time ) \
    181121          _Timespec_Is_valid( _time )
     
    196136 *          false otherwise.
    197137 */
    198 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     138#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    199139  #define _Timestamp_Less_than( _lhs, _rhs ) \
    200140          _Timespec_Less_than( _lhs, _rhs )
     
    215155 *          false otherwise.
    216156 */
    217 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
    218   #define _Timestamp_Greater_than( _lhs, _rhs ) \
    219           _Timespec_Greater_than( _lhs, _rhs )
    220 #else
    221   #define _Timestamp_Greater_than( _lhs, _rhs ) \
    222           _Timestamp64_Greater_than( _lhs, _rhs )
    223 #endif
     157#define _Timestamp_Greater_than( _lhs, _rhs ) \
     158  _Timestamp_Less_than( _rhs, _lhs )
    224159
    225160/**
     
    234169 *          false otherwise.
    235170 */
    236 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     171#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    237172  #define _Timestamp_Equal_to( _lhs, _rhs ) \
    238173          _Timespec_Equal_to( _lhs, _rhs )
     
    253188 *  @return This method returns the number of seconds @a time increased by.
    254189 */
    255 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     190#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    256191  #define _Timestamp_Add_to( _time, _add ) \
    257192          _Timespec_Add_to( _time, _add )
     
    278213 *  @return This method returns the number of seconds @a time increased by.
    279214 */
    280 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     215#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    281216  #define _Timestamp_Add_to_at_tick( _time, _add ) \
    282217          _Timespec_Add_to( _time, _add )
     
    296231 *  @return This method returns the number of ticks computed.
    297232 */
    298 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     233#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    299234  #define _Timestamp_To_ticks( _time ) \
    300235          _Timespec_To_ticks( _time )
     
    313248 *  @param[in] _ticks points to the number of ticks to be filled in
    314249 */
    315 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     250#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    316251  #define _Timestamp_From_ticks( _ticks, _time ) \
    317252          _Timespec_From_ticks( _ticks, _time )
     
    334269 *  @return This method fills in @a _result.
    335270 */
    336 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     271#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    337272  #define _Timestamp_Subtract( _start, _end, _result ) \
    338273          _Timespec_Subtract( _start, _end, _result )
     
    355290 *  @return This method fills in @a result.
    356291 */
    357 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     292#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    358293  #define _Timestamp_Divide_by_integer( _time, _iterations, _result ) \
    359294          _Timespec_Divide_by_integer(_time, _iterations, _result )
     
    376311 *  @return This method fills in @a result.
    377312 */
    378 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     313#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    379314  #define _Timestamp_Divide( _lhs, _rhs, _ival_percentage, _fval_percentage ) \
    380315          _Timespec_Divide( _lhs, _rhs, _ival_percentage, _fval_percentage )
     
    393328 *  @return The seconds portion of @a _time.
    394329 */
    395 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     330#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    396331  #define _Timestamp_Get_seconds( _time ) \
    397332          _Timespec_Get_seconds( _time )
     
    410345 *  @return The nanoseconds portion of @a _time.
    411346 */
    412 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     347#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    413348  #define _Timestamp_Get_nanoseconds( _time ) \
    414349          _Timespec_Get_nanoseconds( _time )
     
    426361 *  @param[in] _timespec points to the timespec
    427362 */
    428 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
     363#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
    429364  /* in this case we know they are the same type so use simple assignment */
    430365  #define _Timestamp_To_timespec( _timestamp, _timespec  ) \
  • cpukit/score/include/rtems/score/timestamp64.h

    rc18be8ee r3a42e6fd  
    4545 *  Verify something is defined.
    4646 */
    47 #if !defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)
     47#if CPU_TIMESTAMP_USE_INT64 != TRUE && CPU_TIMESTAMP_USE_INT64_INLINE != TRUE
    4848  #error "SuperCore Timestamp64 implementation included but not defined."
    4949#endif
     
    5353 */
    5454typedef int64_t Timestamp64_Control;
     55
     56static inline void _Timestamp64_implementation_Set(
     57  Timestamp64_Control *_time,
     58  long                 _seconds,
     59  long                 _nanoseconds
     60)
     61{
     62  Timestamp64_Control _seconds64 = _seconds;
     63  Timestamp64_Control _nanoseconds64 = _nanoseconds;
     64
     65  *_time = _seconds64 * 1000000000L + _nanoseconds64;
     66}
    5567
    5668/**
     
    6476 *  @param[in] _nanoseconds is the nanoseconds portion of the timestamp
    6577 */
    66 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     78#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
    6779  #define _Timestamp64_Set( _time, _seconds, _nanoseconds ) \
    68           do { \
    69             *(_time) = ((int64_t)_seconds * 1000000000); \
    70             *(_time) += (int64_t)(_nanoseconds); \
    71           } while (0)
     80    _Timestamp64_implementation_Set( _time, _seconds, _nanoseconds )
    7281#else
    7382  void _Timestamp64_Set(
     
    7887#endif
    7988
     89static inline void _Timestamp64_implementation_Set_to_zero(
     90  Timestamp64_Control *_time
     91)
     92{
     93  *_time = 0;
     94}
     95
    8096/**
    8197 *  @brief Zero Timestamp
     
    86102 *  @param[in] _time points to the timestamp instance to zero.
    87103 */
    88 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     104#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
    89105  #define _Timestamp64_Set_to_zero( _time ) \
    90           *(_time) = 0
     106    _Timestamp64_implementation_Set_to_zero( _time )
    91107#else
    92108  void _Timestamp64_Set_to_zero(
     
    106122 */
    107123#define _Timestamp64_Is_valid( _time ) \
    108         (1)
     124  (1)
     125
     126static inline bool _Timestamp64_implementation_Less_than(
     127  const Timestamp64_Control *_lhs,
     128  const Timestamp64_Control *_rhs
     129)
     130{
     131  return *_lhs < *_rhs;
     132}
    109133
    110134/**
     
    119143 *          false otherwise.
    120144 */
    121 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     145#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
    122146  #define _Timestamp64_Less_than( _lhs, _rhs ) \
    123           (*(_lhs) < *(_rhs))
     147    _Timestamp64_implementation_Less_than( _lhs, _rhs )
    124148#else
    125149  bool _Timestamp64_Less_than(
    126     Timestamp64_Control *_lhs,
    127     Timestamp64_Control *_rhs
    128   );
    129 #endif
    130 
    131 /**
    132  *  @brief Timestamp Greater Than Operator
    133  *
    134  *  This method is the greater than operator for timestamps.
     150    const Timestamp64_Control *_lhs,
     151    const Timestamp64_Control *_rhs
     152  );
     153#endif
     154
     155static inline bool _Timestamp64_implementation_Equal_to(
     156  const Timestamp64_Control *_lhs,
     157  const Timestamp64_Control *_rhs
     158)
     159{
     160  return *_lhs == *_rhs;
     161}
     162
     163#define _Timestamp64_Greater_than( _lhs, _rhs ) \
     164  _Timestamp64_Less_than( _rhs, _lhs )
     165
     166/**
     167 *  @brief Timestamp equal to Operator
     168 *
     169 *  This method is the is equal to than operator for timestamps.
    135170 *
    136171 *  @param[in] _lhs points to the left hand side timestamp
    137172 *  @param[in] _rhs points to the right hand side timestamp
    138173 *
    139  *  @return This method returns true if @a _lhs is greater than the @a _rhs and
    140  *          false otherwise.
    141  */
    142 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
    143   #define _Timestamp64_Greater_than( _lhs, _rhs ) \
    144           (*(_lhs) > *(_rhs))
    145 #else
    146   bool _Timestamp64_Greater_than(
    147     Timestamp64_Control *_lhs,
    148     Timestamp64_Control *_rhs
    149   );
    150 #endif
    151 
    152 /**
    153  *  @brief Timestamp equal to Operator
    154  *
    155  *  This method is the is equal to than operator for timestamps.
    156  *
    157  *  @param[in] _lhs points to the left hand side timestamp
    158  *  @param[in] _rhs points to the right hand side timestamp
    159  *
    160174 *  @return This method returns true if @a _lhs is equal to  @a _rhs and
    161175 *          false otherwise.
    162176 */
    163 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     177#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
    164178  #define _Timestamp64_Equal_to( _lhs, _rhs ) \
    165           (*(_lhs) == *(_rhs))
     179    _Timestamp64_implementation_Equal_to( _lhs, _rhs )
    166180#else
    167181  bool _Timestamp64_Equal_to(
    168     Timestamp64_Control *_lhs,
    169     Timestamp64_Control *_rhs
    170   );
    171 #endif
     182    const Timestamp64_Control *_lhs,
     183    const Timestamp64_Control *_rhs
     184  );
     185#endif
     186
     187static inline void _Timestamp64_implementation_Add_to(
     188  Timestamp64_Control       *_time,
     189  const Timestamp64_Control *_add
     190)
     191{
     192  *_time += *_add;
     193}
    172194
    173195/**
     
    182204 *  @return This method returns the number of seconds @a time increased by.
    183205 */
    184 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     206#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
    185207  #define _Timestamp64_Add_to( _time, _add ) \
    186           *(_time) += *(_add)
     208    _Timestamp64_implementation_Add_to( _time, _add )
    187209#else
    188210  void _Timestamp64_Add_to(
    189     Timestamp64_Control *_time,
    190     Timestamp64_Control *_add
     211    Timestamp64_Control       *_time,
     212    const Timestamp64_Control *_add
    191213  );
    192214#endif
     
    211233static inline uint32_t _Timestamp64_Add_to_at_tick(
    212234  Timestamp64_Control *_time,
    213   Timestamp64_Control *_add
    214 )
    215 {
    216   Timestamp64_Control start = *_time / 1000000000;
     235  const Timestamp64_Control *_add
     236)
     237{
     238  Timestamp64_Control _start = *_time / 1000000000L;
    217239  *_time += *_add;
    218   if ( ((*_time) / 1000000000) != start ) {
     240  if ( ((*_time) / 1000000000L) != _start ) {
    219241    return 1;
    220242  }
     
    243265 *
    244266 *  @param[in] _time points to the timestamp format time result
    245  *  @param[in] _ticks points to the number of ticks to be filled in
     267 *  @param[out] _ticks points to the number of ticks to be filled in
    246268 */
    247269void _Timestamp64_From_ticks(
     
    250272);
    251273
     274static inline void _Timestamp64_implementation_Subtract(
     275  const Timestamp64_Control *_start,
     276  const Timestamp64_Control *_end,
     277  Timestamp64_Control       *_result
     278)
     279{
     280  *_result = *_end - *_start;
     281}
     282
    252283/**
    253284 *  @brief Subtract Two Timestamp
     
    258289 *  @param[in] _start points to the starting time
    259290 *  @param[in] _end points to the ending time
    260  *  @param[in] _result points to the difference between
     291 *  @param[out] _result points to the difference between
    261292 *             starting and ending time.
    262  *
    263  *  @return This method fills in @a _result.
    264  */
    265 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     293 */
     294#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
    266295  #define _Timestamp64_Subtract( _start, _end, _result ) \
    267           do { \
    268              *(_result) = *(_end) - *(_start); \
    269           } while (0)
     296    _Timestamp64_implementation_Subtract( _start, _end, _result )
    270297#else
    271298  void _Timestamp64_Subtract(
    272     Timestamp64_Control *_start,
    273     Timestamp64_Control *_end,
    274     Timestamp64_Control *_result
    275   );
    276 #endif
     299    const Timestamp64_Control *_start,
     300    const Timestamp64_Control *_end,
     301    Timestamp64_Control       *_result
     302  );
     303#endif
     304
     305static inline void _Timestamp64_implementation_Divide_by_integer(
     306  const Timestamp64_Control *_time,
     307  uint32_t             _iterations,
     308  Timestamp64_Control *_result
     309)
     310{
     311  *_result = *_time / _iterations;
     312}
    277313
    278314/**
     
    285321 *  @param[in] _time points to the total
    286322 *  @param[in] _iterations is the number of iterations
    287  *  @param[in] _result points to the average time.
    288  *
    289  *  @return This method fills in @a result.
    290  */
    291 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     323 *  @param[out] _result points to the average time.
     324 */
     325#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
    292326  #define _Timestamp64_Divide_by_integer( _time, _iterations, _result ) \
    293           do { \
    294              *(_result) = *(_time) / (_iterations); \
    295           } while (0)
     327    _Timestamp64_implementation_Divide_by_integer( _time, _iterations, _result )
    296328#else
    297329  void _Timestamp64_Divide_by_integer(
    298     Timestamp64_Control *_time,
    299     uint32_t             _iterations,
    300     Timestamp64_Control *_result
     330    const Timestamp64_Control *_time,
     331    uint32_t                   _iterations,
     332    Timestamp64_Control       *_result
    301333  );
    302334#endif
     
    310342 *  @param[in] _lhs points to the left hand number
    311343 *  @param[in] _rhs points to the right hand number
    312  *  @param[in] _ival_percentage points to the integer portion of the average
    313  *  @param[in] _fval_percentage points to the thousandths of percentage
    314  *
    315  *  @return This method fills in @a result.
     344 *  @param[out] _ival_percentage points to the integer portion of the average
     345 *  @param[out] _fval_percentage points to the thousandths of percentage
    316346 */
    317347void _Timestamp64_Divide(
     
    322352);
    323353
     354static inline uint32_t _Timestamp64_implementation_Get_seconds(
     355  const Timestamp64_Control *_time
     356)
     357{
     358  return (uint32_t) (*_time / 1000000000L);
     359}
     360
    324361/**
    325362 *  @brief Get Seconds Portion of Timestamp
     
    331368 *  @return The seconds portion of @a _time.
    332369 */
    333 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     370#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
    334371  #define _Timestamp64_Get_seconds( _time ) \
    335           (*(_time) / 1000000000)
     372    _Timestamp64_implementation_Get_seconds( _time )
    336373#else
    337374  uint32_t _Timestamp64_Get_seconds(
    338     Timestamp64_Control *_time
    339   );
    340 #endif
     375    const Timestamp64_Control *_time
     376  );
     377#endif
     378
     379static inline uint32_t _Timestamp64_implementation_Get_nanoseconds(
     380  const Timestamp64_Control *_time
     381)
     382{
     383  return (uint32_t) (*_time % 1000000000L);
     384}
    341385
    342386/**
     
    349393 *  @return The nanoseconds portion of @a _time.
    350394 */
    351 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     395#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
    352396  #define _Timestamp64_Get_nanoseconds( _time ) \
    353           (*(_time) % 1000000000)
     397    _Timestamp64_implementation_Get_nanoseconds( _time )
    354398#else
    355399  uint32_t _Timestamp64_Get_nanoseconds(
    356     Timestamp64_Control *_time
    357   );
    358 #endif
     400    const Timestamp64_Control *_time
     401  );
     402#endif
     403
     404static inline void _Timestamp64_implementation_To_timespec(
     405  const Timestamp64_Control *_timestamp,
     406  struct timespec           *_timespec
     407)
     408{
     409  _timespec->tv_sec = *_timestamp / 1000000000L;
     410  _timespec->tv_nsec = *_timestamp % 1000000000L;
     411}
    359412
    360413/**
     
    364417 *
    365418 *  @param[in] _timestamp points to the timestamp
    366  *  @param[in] _timespec points to the timespec
    367  */
    368 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     419 *  @param[out] _timespec points to the timespec
     420 */
     421#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
    369422  #define _Timestamp64_To_timespec( _timestamp, _timespec  ) \
    370         do { \
    371           (_timespec)->tv_sec = *(_timestamp) / 1000000000; \
    372           (_timespec)->tv_nsec = *(_timestamp) % 1000000000; \
    373         } while (0)
     423    _Timestamp64_implementation_To_timespec( _timestamp, _timespec )
    374424#else
    375425  void _Timestamp64_To_timespec(
    376     Timestamp64_Control *_timestamp,
    377     struct timespec     *_timespec
     426    const Timestamp64_Control *_timestamp,
     427    struct timespec           *_timespec
    378428  );
    379429#endif
  • cpukit/score/src/ts64addto.c

    rc18be8ee r3a42e6fd  
    1818#endif
    1919
    20 #include <sys/types.h>
    21 
    22 #include <rtems/system.h>
    2320#include <rtems/score/timestamp.h>
    2421
    25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
    26     !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     22#if CPU_TIMESTAMP_USE_INT64 == TRUE
    2723void _Timestamp64_Add_to(
    28   Timestamp64_Control *_time,
    29   Timestamp64_Control *_add
     24  Timestamp64_Control       *_time,
     25  const Timestamp64_Control *_add
    3026)
    3127{
    32   *_time += *_add;
     28  _Timestamp64_implementation_Add_to( _time, _add );
    3329}
    3430#endif
  • cpukit/score/src/ts64divide.c

    rc18be8ee r3a42e6fd  
    1818#endif
    1919
    20 #include <rtems/system.h>
    21 #include <sys/types.h>
    2220#include <rtems/score/timestamp.h>
    2321
    2422/* This method is never inlined. */
    25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)
     23#if CPU_TIMESTAMP_USE_INT64 == TRUE || CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
    2624void _Timestamp64_Divide(
    2725  const Timestamp64_Control *_lhs,
  • cpukit/score/src/ts64dividebyinteger.c

    rc18be8ee r3a42e6fd  
    1818#endif
    1919
    20 #include <sys/types.h>
    21 
    22 #include <rtems/system.h>
    2320#include <rtems/score/timestamp.h>
    2421
    25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
    26     !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     22#if CPU_TIMESTAMP_USE_INT64 == TRUE
    2723void _Timestamp64_Divide_by_integer(
    28   Timestamp64_Control *_time,
    29   uint32_t             _iterations,
    30   Timestamp64_Control *_result
     24  const Timestamp64_Control *_time,
     25  uint32_t                   _iterations,
     26  Timestamp64_Control       *_result
    3127)
    3228{
    33   *_result = *_time / _iterations;
     29  _Timestamp64_implementation_Divide_by_integer( _time, _iterations, _result );
    3430}
    3531#endif
  • cpukit/score/src/ts64equalto.c

    rc18be8ee r3a42e6fd  
    1818#endif
    1919
    20 #include <sys/types.h>
    21 
    22 #include <rtems/system.h>
    2320#include <rtems/score/timestamp.h>
    2421
    25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
    26     !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     22#if CPU_TIMESTAMP_USE_INT64 == TRUE
    2723bool _Timestamp64_Equal_to(
    28   Timestamp64_Control *_lhs,
    29   Timestamp64_Control *_rhs
     24  const Timestamp64_Control *_lhs,
     25  const Timestamp64_Control *_rhs
    3026)
    3127{
    32   return (*(_lhs) == *(_rhs));
     28  _Timestamp64_implementation_Equal_to( _lhs, _rhs );
    3329}
    3430#endif
  • cpukit/score/src/ts64getnanoseconds.c

    rc18be8ee r3a42e6fd  
    1818#endif
    1919
    20 #include <sys/types.h>
    21 
    22 #include <rtems/system.h>
    2320#include <rtems/score/timestamp.h>
    2421
    25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
    26     !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     22#if CPU_TIMESTAMP_USE_INT64 == TRUE
    2723uint32_t _Timestamp64_Get_nanoseconds(
    28   Timestamp64_Control *_time
     24  const Timestamp64_Control *_time
    2925)
    3026{
    31   return *(_time) % 1000000000;
     27  _Timestamp64_implementation_Get_nanoseconds( _time );
    3228}
    3329#endif
  • cpukit/score/src/ts64getseconds.c

    rc18be8ee r3a42e6fd  
    1818#endif
    1919
    20 #include <sys/types.h>
    21 
    22 #include <rtems/system.h>
    2320#include <rtems/score/timestamp.h>
    2421
    25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
    26     !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     22#if CPU_TIMESTAMP_USE_INT64 == TRUE
    2723uint32_t _Timestamp64_Get_seconds(
    28   Timestamp64_Control *_time
     24  const Timestamp64_Control *_time
    2925)
    3026{
    31   return *(_time) / 1000000000;
     27  _Timestamp64_implementation_Get_seconds( _time );
    3228}
    3329#endif
  • cpukit/score/src/ts64lessthan.c

    rc18be8ee r3a42e6fd  
    1818#endif
    1919
    20 #include <sys/types.h>
    21 
    22 #include <rtems/system.h>
    2320#include <rtems/score/timestamp.h>
    2421
    25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
    26     !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     22#if CPU_TIMESTAMP_USE_INT64 == TRUE
    2723bool _Timestamp64_Less_than(
    28   Timestamp64_Control *_lhs,
    29   Timestamp64_Control *_rhs
     24  const Timestamp64_Control *_lhs,
     25  const Timestamp64_Control *_rhs
    3026)
    3127{
    32   return (*(_lhs) < *(_rhs));
     28  _Timestamp64_implementation_Less_than( _lhs, _rhs );
    3329}
    3430#endif
  • cpukit/score/src/ts64set.c

    rc18be8ee r3a42e6fd  
    1818#endif
    1919
    20 #include <sys/types.h>
    21 
    22 #include <rtems/system.h>
    2320#include <rtems/score/timestamp.h>
    2421
    25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
    26     !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     22#if CPU_TIMESTAMP_USE_INT64 == TRUE
    2723void _Timestamp64_Set(
    2824  Timestamp64_Control *_time,
     
    3127)
    3228{
    33   int64_t time;
    34 
    35   time = (int64_t)_seconds * 1000000000;
    36   time += (int64_t)_nanoseconds;
    37   *_time = time;
     29  _Timestamp64_implementation_Set( _time, _seconds, _nanoseconds );
    3830}
    3931#endif
  • cpukit/score/src/ts64settozero.c

    rc18be8ee r3a42e6fd  
    1818#endif
    1919
    20 #include <sys/types.h>
    21 
    22 #include <rtems/system.h>
    2320#include <rtems/score/timestamp.h>
    2421
    25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
    26     !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     22#if CPU_TIMESTAMP_USE_INT64 == TRUE
    2723void _Timestamp64_Set_to_zero(
    2824  Timestamp64_Control *_time
    2925)
    3026{
    31   *_time = 0;
     27  _Timestamp64_implementation_Set_to_zero( _time );
    3228}
    3329#endif
  • cpukit/score/src/ts64subtract.c

    rc18be8ee r3a42e6fd  
    1818#endif
    1919
    20 #include <sys/types.h>
    21 
    22 #include <rtems/system.h>
    2320#include <rtems/score/timestamp.h>
    2421
    25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
    26     !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     22#if CPU_TIMESTAMP_USE_INT64 == TRUE
    2723void _Timestamp64_Subtract(
    28   Timestamp64_Control *_start,
    29   Timestamp64_Control *_end,
    30   Timestamp64_Control *_result
     24  const Timestamp64_Control *_start,
     25  const Timestamp64_Control *_end,
     26  Timestamp64_Control       *_result
    3127)
    3228{
    33   *_result = *_end - *_start;
     29  _Timestamp64_implementation_Subtract( _start, _end, _result );
    3430}
    3531#endif
  • cpukit/score/src/ts64toticks.c

    rc18be8ee r3a42e6fd  
    2525#include <rtems/score/tod.h>
    2626
    27 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
    28     !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     27#if CPU_TIMESTAMP_USE_INT64 == TRUE
    2928uint32_t _Timestamp64_To_ticks(
    3029  const Timestamp64_Control *time
  • cpukit/score/src/ts64totimespec.c

    rc18be8ee r3a42e6fd  
    1818#endif
    1919
    20 #include <sys/types.h>
    21 
    22 #include <rtems/system.h>
    2320#include <rtems/score/timestamp.h>
    2421
    25 #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
    26     !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
     22#if CPU_TIMESTAMP_USE_INT64 == TRUE
    2723void _Timestamp64_To_timespec(
    28   Timestamp64_Control *_timestamp,
    29   struct timespec     *_timespec
     24  const Timestamp64_Control *_timestamp,
     25  struct timespec           *_timespec
    3026)
    3127{
    32   _timespec->tv_sec = *_timestamp / 1000000000;
    33   _timespec->tv_nsec = *_timestamp % 1000000000;
     28  _Timestamp64_implementation_To_timespec( _timestamp, _timespec );
    3429}
    3530#endif
Note: See TracChangeset for help on using the changeset viewer.