change log for rtems (2011-09-28)

rtems-vc at rtems.org rtems-vc at rtems.org
Wed Sep 28 15:10:25 UTC 2011


 *sh*:
2011-09-28	Sebastian Huber <sebastian.huber at embedded-brains.de>

	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.

M 1.2927  cpukit/ChangeLog
M  1.111  cpukit/score/Makefile.am
M   1.13  cpukit/score/include/rtems/score/timespec.h
M    1.8  cpukit/score/include/rtems/score/timestamp.h
M    1.6  cpukit/score/include/rtems/score/timestamp64.h
R    1.4  cpukit/score/src/timespecgreaterthan.c
M    1.2  cpukit/score/src/ts64addto.c
M    1.4  cpukit/score/src/ts64divide.c
M    1.2  cpukit/score/src/ts64dividebyinteger.c
M    1.2  cpukit/score/src/ts64equalto.c
M    1.3  cpukit/score/src/ts64getnanoseconds.c
M    1.2  cpukit/score/src/ts64getseconds.c
R    1.1  cpukit/score/src/ts64greaterthan.c
M    1.2  cpukit/score/src/ts64lessthan.c
M    1.2  cpukit/score/src/ts64set.c
M    1.2  cpukit/score/src/ts64settozero.c
M    1.2  cpukit/score/src/ts64subtract.c
M    1.4  cpukit/score/src/ts64toticks.c
M    1.2  cpukit/score/src/ts64totimespec.c

diff -u rtems/cpukit/ChangeLog:1.2926 rtems/cpukit/ChangeLog:1.2927
--- rtems/cpukit/ChangeLog:1.2926	Mon Sep 26 19:58:42 2011
+++ rtems/cpukit/ChangeLog	Wed Sep 28 09:42:11 2011
@@ -1,3 +1,21 @@
+2011-09-28	Sebastian Huber <sebastian.huber at embedded-brains.de>
+
+	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.
+
 2011-09-26	Petr Benes <benesp16 at fel.cvut.cz>
 
 	PR 1923/testing

diff -u rtems/cpukit/score/Makefile.am:1.110 rtems/cpukit/score/Makefile.am:1.111
--- rtems/cpukit/score/Makefile.am:1.110	Thu Sep 15 10:49:31 2011
+++ rtems/cpukit/score/Makefile.am	Wed Sep 28 09:42:11 2011
@@ -295,7 +295,7 @@
 
 ## TIMESPEC_C_FILES
 libscore_a_SOURCES += src/timespecaddto.c src/timespecfromticks.c \
-    src/timespecisvalid.c src/timespeclessthan.c src/timespecgreaterthan.c \
+    src/timespecisvalid.c src/timespeclessthan.c \
     src/timespecsubtract.c src/timespectoticks.c src/timespecdivide.c \
     src/timespecdividebyinteger.c
 
@@ -303,7 +303,7 @@
 libscore_a_SOURCES += src/ts64addto.c src/ts64dividebyinteger.c \
     src/ts64divide.c src/ts64equalto.c \
     src/ts64getnanoseconds.c src/ts64getseconds.c \
-    src/ts64greaterthan.c src/ts64lessthan.c \
+    src/ts64lessthan.c \
     src/ts64set.c src/ts64settozero.c src/ts64subtract.c \
     src/ts64toticks.c src/ts64totimespec.c
 

diff -u rtems/cpukit/score/include/rtems/score/timespec.h:1.12 rtems/cpukit/score/include/rtems/score/timespec.h:1.13
--- rtems/cpukit/score/include/rtems/score/timespec.h:1.12	Fri Jun 17 10:40:09 2011
+++ rtems/cpukit/score/include/rtems/score/timespec.h	Wed Sep 28 09:42:11 2011
@@ -131,10 +131,8 @@
  *  @return This method returns true if @a lhs is greater than the @a rhs and
  *          false otherwise.
  */
-bool _Timespec_Greater_than(
-  const struct timespec *lhs,
-  const struct timespec *rhs
-);
+#define _Timespec_Greater_than( _lhs, _rhs ) \
+  _Timespec_Less_than( _rhs, _lhs )
 
 /**
  * @brief Timespec equal to Operator

diff -u rtems/cpukit/score/include/rtems/score/timestamp.h:1.7 rtems/cpukit/score/include/rtems/score/timestamp.h:1.8
--- rtems/cpukit/score/include/rtems/score/timestamp.h:1.7	Fri Jun 17 10:40:09 2011
+++ rtems/cpukit/score/include/rtems/score/timestamp.h	Wed Sep 28 09:42:11 2011
@@ -40,93 +40,33 @@
  */
 /**@{*/
 
+#include <rtems/score/cpu.h>
 #include <rtems/score/timespec.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/*
- *  NOTE: Eventually each port should select what it should use!!!
- *
- *  These control which implementation of SuperCore Timestamp is used.
- *
- *  if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
- *     struct timespec is used
- *  else if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)
- *     int64_t is used
- *
- *  When int64_t is used, then
- *     if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
- *        the methods are inlined
- *     else
- *        the methods are NOT inlined
- *
- *  Performance of int64_t versus struct timespec
- *  =============================================
- *
- *  On PowerPC/psim, inlined int64_t saves ~50 instructions on each
- *    _Thread_Dispatch operation which results in a context switch.
- *    This works out to be about 10% faster dispatches and 7.5% faster
- *    blocking semaphore obtains.  The following numbers are in instructions
- *    and from tm02 and tm26.
- *
- *                         timespec  int64  inlined int64
- *    dispatch:              446      446      400
- *    blocking sem obtain:   627      626      581
- *
- *  On SPARC/sis, inlined int64_t shows the same percentage gains.
- *    The following numbers are in microseconds and from tm02 and tm26.
- *
- *                         timespec  int64  inlined int64
- *    dispatch:               59       61       53
- *    blocking sem obtain:    98      100       92
- *
- *  Inlining appears to have a tendency to increase the size of
- *    some executables.
- *  Not inlining reduces the execution improvement but does not seem to
- *    be an improvement on the PowerPC and SPARC. The struct timespec
- *    and the executables with int64 not inlined are about the same size.
- *
- *  Once there has some analysis of which algorithm and configuration
- *  is best suited to each target, these defines should be moved to
- *  the appropriate score/cpu cpu.h file.  In the meantime, it is
- *  appropriate to select an implementation here using CPU macros.
- */
-
-#define CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC
-/*
-#define CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64
-#define CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE
-*/
-
-/*
- *  Verify something is defined.
- */
-#if !defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC) && \
-    !defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)
-  #error "No SuperCore Timestamp implementation selected."
-#endif
-
-/*
- * Verify that more than one is not defined.
- */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC) && \
-    defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)
-  #error "Too many SuperCore Timestamp implementations selected."
+#if ! ( ( CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE \
+    && CPU_TIMESTAMP_USE_INT64 == FALSE \
+    && CPU_TIMESTAMP_USE_INT64_INLINE == FALSE ) \
+  || ( CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == FALSE \
+    && CPU_TIMESTAMP_USE_INT64 == TRUE \
+    && CPU_TIMESTAMP_USE_INT64_INLINE == FALSE ) \
+  || ( CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == FALSE \
+    && CPU_TIMESTAMP_USE_INT64 == FALSE \
+    && CPU_TIMESTAMP_USE_INT64_INLINE == TRUE ) )
+  #error "Invalid SuperCore Timestamp implementations selection."
 #endif
 
-/**
- *   Include any implementation specific header files
- */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)
+#if CPU_TIMESTAMP_USE_INT64 == TRUE || CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
   #include <rtems/score/timestamp64.h>
 #endif
 
 /**
  *   Define the Timestamp control type.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   typedef struct timespec Timestamp_Control;
 #else
   typedef Timestamp64_Control Timestamp_Control;
@@ -142,7 +82,7 @@
  *  @param[in] _seconds is the seconds portion of the timestamp
  *  @param[in] _nanoseconds is the nanoseconds portion of the timestamp
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   #define _Timestamp_Set( _time, _seconds, _nanoseconds ) \
           _Timespec_Set( _time, _seconds, _nanoseconds )
 #else
@@ -158,7 +98,7 @@
  *
  *  @param[in] _time points to the timestamp instance to zero.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   #define _Timestamp_Set_to_zero( _time ) \
           _Timespec_Set_to_zero( _time )
 #else
@@ -176,7 +116,7 @@
  *  @return This method returns true if @a time is valid and
  *          false otherwise.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   #define _Timestamp_Is_valid( _time ) \
           _Timespec_Is_valid( _time )
 #else
@@ -195,7 +135,7 @@
  *  @return This method returns true if @a _lhs is less than the @a _rhs and
  *          false otherwise.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   #define _Timestamp_Less_than( _lhs, _rhs ) \
           _Timespec_Less_than( _lhs, _rhs )
 #else
@@ -214,13 +154,8 @@
  *  @return This method returns true if @a _lhs is greater than the @a _rhs and
  *          false otherwise.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
-  #define _Timestamp_Greater_than( _lhs, _rhs ) \
-          _Timespec_Greater_than( _lhs, _rhs )
-#else
-  #define _Timestamp_Greater_than( _lhs, _rhs ) \
-	  _Timestamp64_Greater_than( _lhs, _rhs )
-#endif
+#define _Timestamp_Greater_than( _lhs, _rhs ) \
+  _Timestamp_Less_than( _rhs, _lhs )
 
 /**
  *  @brief Timestamp equal to Operator
@@ -233,7 +168,7 @@
  *  @return This method returns true if @a _lhs is equal to  @a _rhs and
  *          false otherwise.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   #define _Timestamp_Equal_to( _lhs, _rhs ) \
           _Timespec_Equal_to( _lhs, _rhs )
 #else
@@ -252,7 +187,7 @@
  *
  *  @return This method returns the number of seconds @a time increased by.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   #define _Timestamp_Add_to( _time, _add ) \
           _Timespec_Add_to( _time, _add )
 #else
@@ -277,7 +212,7 @@
  *
  *  @return This method returns the number of seconds @a time increased by.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   #define _Timestamp_Add_to_at_tick( _time, _add ) \
           _Timespec_Add_to( _time, _add )
 #else
@@ -295,7 +230,7 @@
  *
  *  @return This method returns the number of ticks computed.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   #define _Timestamp_To_ticks( _time ) \
           _Timespec_To_ticks( _time )
 #else
@@ -312,7 +247,7 @@
  *  @param[in] _time points to the timestamp format time result
  *  @param[in] _ticks points to the number of ticks to be filled in
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   #define _Timestamp_From_ticks( _ticks, _time ) \
           _Timespec_From_ticks( _ticks, _time )
 #else
@@ -333,7 +268,7 @@
  *
  *  @return This method fills in @a _result.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   #define _Timestamp_Subtract( _start, _end, _result ) \
           _Timespec_Subtract( _start, _end, _result )
 #else
@@ -354,7 +289,7 @@
  *
  *  @return This method fills in @a result.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   #define _Timestamp_Divide_by_integer( _time, _iterations, _result ) \
           _Timespec_Divide_by_integer(_time, _iterations, _result )
 #else
@@ -375,7 +310,7 @@
  *
  *  @return This method fills in @a result.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   #define _Timestamp_Divide( _lhs, _rhs, _ival_percentage, _fval_percentage ) \
           _Timespec_Divide( _lhs, _rhs, _ival_percentage, _fval_percentage )
 #else
@@ -392,7 +327,7 @@
  *
  *  @return The seconds portion of @a _time.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   #define _Timestamp_Get_seconds( _time ) \
           _Timespec_Get_seconds( _time )
 #else
@@ -409,7 +344,7 @@
  *
  *  @return The nanoseconds portion of @a _time.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   #define _Timestamp_Get_nanoseconds( _time ) \
           _Timespec_Get_nanoseconds( _time )
 #else
@@ -425,7 +360,7 @@
  *  @param[in] _timestamp points to the timestamp
  *  @param[in] _timespec points to the timespec
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
   /* in this case we know they are the same type so use simple assignment */
   #define _Timestamp_To_timespec( _timestamp, _timespec  ) \
           *(_timespec) = *(_timestamp)

diff -u rtems/cpukit/score/include/rtems/score/timestamp64.h:1.5 rtems/cpukit/score/include/rtems/score/timestamp64.h:1.6
--- rtems/cpukit/score/include/rtems/score/timestamp64.h:1.5	Fri Jun 17 10:40:09 2011
+++ rtems/cpukit/score/include/rtems/score/timestamp64.h	Wed Sep 28 09:42:12 2011
@@ -44,7 +44,7 @@
 /*
  *  Verify something is defined.
  */
-#if !defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)
+#if CPU_TIMESTAMP_USE_INT64 != TRUE && CPU_TIMESTAMP_USE_INT64_INLINE != TRUE
   #error "SuperCore Timestamp64 implementation included but not defined."
 #endif
 
@@ -53,6 +53,18 @@
  */
 typedef int64_t Timestamp64_Control;
 
+static inline void _Timestamp64_implementation_Set(
+  Timestamp64_Control *_time,
+  long                 _seconds,
+  long                 _nanoseconds
+)
+{
+  Timestamp64_Control _seconds64 = _seconds;
+  Timestamp64_Control _nanoseconds64 = _nanoseconds;
+
+  *_time = _seconds64 * 1000000000L + _nanoseconds64;
+}
+
 /**
  *  @brief Set Timestamp to Seconds Nanosecond
  *
@@ -63,12 +75,9 @@
  *  @param[in] _seconds is the seconds portion of the timestamp
  *  @param[in] _nanoseconds is the nanoseconds portion of the timestamp
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
   #define _Timestamp64_Set( _time, _seconds, _nanoseconds ) \
-	  do { \
-	    *(_time) = ((int64_t)_seconds * 1000000000); \
-	    *(_time) += (int64_t)(_nanoseconds); \
-	  } while (0)
+    _Timestamp64_implementation_Set( _time, _seconds, _nanoseconds )
 #else
   void _Timestamp64_Set(
     Timestamp64_Control *_time,
@@ -77,6 +86,13 @@
   );
 #endif
 
+static inline void _Timestamp64_implementation_Set_to_zero(
+  Timestamp64_Control *_time
+)
+{
+  *_time = 0;
+}
+
 /**
  *  @brief Zero Timestamp
  *
@@ -85,9 +101,9 @@
  *
  *  @param[in] _time points to the timestamp instance to zero.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
   #define _Timestamp64_Set_to_zero( _time ) \
-	  *(_time) = 0
+    _Timestamp64_implementation_Set_to_zero( _time )
 #else
   void _Timestamp64_Set_to_zero(
     Timestamp64_Control *_time
@@ -105,7 +121,15 @@
  *          false otherwise.
  */
 #define _Timestamp64_Is_valid( _time ) \
-	(1)
+  (1)
+
+static inline bool _Timestamp64_implementation_Less_than(
+  const Timestamp64_Control *_lhs,
+  const Timestamp64_Control *_rhs
+)
+{
+  return *_lhs < *_rhs;
+}
 
 /**
  *  @brief Timestamp Less Than Operator
@@ -118,36 +142,26 @@
  *  @return This method returns true if @a _lhs is less than the @a _rhs and
  *          false otherwise.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
   #define _Timestamp64_Less_than( _lhs, _rhs ) \
-	  (*(_lhs) < *(_rhs))
+    _Timestamp64_implementation_Less_than( _lhs, _rhs )
 #else
   bool _Timestamp64_Less_than(
-    Timestamp64_Control *_lhs,
-    Timestamp64_Control *_rhs
+    const Timestamp64_Control *_lhs,
+    const Timestamp64_Control *_rhs
   );
 #endif
 
-/**
- *  @brief Timestamp Greater Than Operator
- *
- *  This method is the greater than operator for timestamps.
- *
- *  @param[in] _lhs points to the left hand side timestamp
- *  @param[in] _rhs points to the right hand side timestamp
- *
- *  @return This method returns true if @a _lhs is greater than the @a _rhs and
- *          false otherwise.
- */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
-  #define _Timestamp64_Greater_than( _lhs, _rhs ) \
-	  (*(_lhs) > *(_rhs))
-#else
-  bool _Timestamp64_Greater_than(
-    Timestamp64_Control *_lhs,
-    Timestamp64_Control *_rhs
-  );
-#endif
+static inline bool _Timestamp64_implementation_Equal_to(
+  const Timestamp64_Control *_lhs,
+  const Timestamp64_Control *_rhs
+)
+{
+  return *_lhs == *_rhs;
+}
+
+#define _Timestamp64_Greater_than( _lhs, _rhs ) \
+  _Timestamp64_Less_than( _rhs, _lhs )
 
 /**
  *  @brief Timestamp equal to Operator
@@ -160,16 +174,24 @@
  *  @return This method returns true if @a _lhs is equal to  @a _rhs and
  *          false otherwise.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
   #define _Timestamp64_Equal_to( _lhs, _rhs ) \
-	  (*(_lhs) == *(_rhs))
+    _Timestamp64_implementation_Equal_to( _lhs, _rhs )
 #else
   bool _Timestamp64_Equal_to(
-    Timestamp64_Control *_lhs,
-    Timestamp64_Control *_rhs
+    const Timestamp64_Control *_lhs,
+    const Timestamp64_Control *_rhs
   );
 #endif
 
+static inline void _Timestamp64_implementation_Add_to(
+  Timestamp64_Control       *_time,
+  const Timestamp64_Control *_add
+)
+{
+  *_time += *_add;
+}
+
 /**
  *  @brief Add to a Timestamp
  *
@@ -181,13 +203,13 @@
  *
  *  @return This method returns the number of seconds @a time increased by.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
   #define _Timestamp64_Add_to( _time, _add ) \
-	  *(_time) += *(_add)
+    _Timestamp64_implementation_Add_to( _time, _add )
 #else
   void _Timestamp64_Add_to(
-    Timestamp64_Control *_time,
-    Timestamp64_Control *_add
+    Timestamp64_Control       *_time,
+    const Timestamp64_Control *_add
   );
 #endif
 
@@ -210,12 +232,12 @@
  */
 static inline uint32_t _Timestamp64_Add_to_at_tick(
   Timestamp64_Control *_time,
-  Timestamp64_Control *_add
+  const Timestamp64_Control *_add
 )
 {
-  Timestamp64_Control start = *_time / 1000000000;
+  Timestamp64_Control _start = *_time / 1000000000L;
   *_time += *_add;
-  if ( ((*_time) / 1000000000) != start ) {
+  if ( ((*_time) / 1000000000L) != _start ) {
     return 1;
   }
   return 0;
@@ -242,13 +264,22 @@
  *  timestamp format @a _time.
  *
  *  @param[in] _time points to the timestamp format time result
- *  @param[in] _ticks points to the number of ticks to be filled in
+ *  @param[out] _ticks points to the number of ticks to be filled in
  */
 void _Timestamp64_From_ticks(
   uint32_t             _ticks,
   Timestamp64_Control *_time
 );
 
+static inline void _Timestamp64_implementation_Subtract(
+  const Timestamp64_Control *_start,
+  const Timestamp64_Control *_end,
+  Timestamp64_Control       *_result
+)
+{
+  *_result = *_end - *_start;
+}
+
 /**
  *  @brief Subtract Two Timestamp
  *
@@ -257,24 +288,29 @@
  *
  *  @param[in] _start points to the starting time
  *  @param[in] _end points to the ending time
- *  @param[in] _result points to the difference between
+ *  @param[out] _result points to the difference between
  *             starting and ending time.
- *
- *  @return This method fills in @a _result.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
   #define _Timestamp64_Subtract( _start, _end, _result ) \
-	  do { \
-	     *(_result) = *(_end) - *(_start); \
-	  } while (0)
+    _Timestamp64_implementation_Subtract( _start, _end, _result )
 #else
   void _Timestamp64_Subtract(
-    Timestamp64_Control *_start,
-    Timestamp64_Control *_end,
-    Timestamp64_Control *_result
+    const Timestamp64_Control *_start,
+    const Timestamp64_Control *_end,
+    Timestamp64_Control       *_result
   );
 #endif
 
+static inline void _Timestamp64_implementation_Divide_by_integer(
+  const Timestamp64_Control *_time,
+  uint32_t             _iterations,
+  Timestamp64_Control *_result
+)
+{
+  *_result = *_time / _iterations;
+}
+
 /**
  *  @brief Divide Timestamp By Integer
  *
@@ -284,20 +320,16 @@
  *
  *  @param[in] _time points to the total
  *  @param[in] _iterations is the number of iterations
- *  @param[in] _result points to the average time.
- *
- *  @return This method fills in @a result.
+ *  @param[out] _result points to the average time.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
   #define _Timestamp64_Divide_by_integer( _time, _iterations, _result ) \
-	  do { \
-	     *(_result) = *(_time) / (_iterations); \
-	  } while (0)
+    _Timestamp64_implementation_Divide_by_integer( _time, _iterations, _result )
 #else
   void _Timestamp64_Divide_by_integer(
-    Timestamp64_Control *_time,
-    uint32_t             _iterations,
-    Timestamp64_Control *_result
+    const Timestamp64_Control *_time,
+    uint32_t                   _iterations,
+    Timestamp64_Control       *_result
   );
 #endif
 
@@ -309,10 +341,8 @@
  *
  *  @param[in] _lhs points to the left hand number
  *  @param[in] _rhs points to the right hand number
- *  @param[in] _ival_percentage points to the integer portion of the average
- *  @param[in] _fval_percentage points to the thousandths of percentage
- *
- *  @return This method fills in @a result.
+ *  @param[out] _ival_percentage points to the integer portion of the average
+ *  @param[out] _fval_percentage points to the thousandths of percentage
  */
 void _Timestamp64_Divide(
   const Timestamp64_Control *_lhs,
@@ -321,6 +351,13 @@
   uint32_t                  *_fval_percentage
 );
 
+static inline uint32_t _Timestamp64_implementation_Get_seconds(
+  const Timestamp64_Control *_time
+)
+{
+  return (uint32_t) (*_time / 1000000000L);
+}
+
 /**
  *  @brief Get Seconds Portion of Timestamp
  *
@@ -330,15 +367,22 @@
  *
  *  @return The seconds portion of @a _time.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
   #define _Timestamp64_Get_seconds( _time ) \
-	  (*(_time) / 1000000000)
+    _Timestamp64_implementation_Get_seconds( _time )
 #else
   uint32_t _Timestamp64_Get_seconds(
-    Timestamp64_Control *_time
+    const Timestamp64_Control *_time
   );
 #endif
 
+static inline uint32_t _Timestamp64_implementation_Get_nanoseconds(
+  const Timestamp64_Control *_time
+)
+{
+  return (uint32_t) (*_time % 1000000000L);
+}
+
 /**
  *  @brief Get Nanoseconds Portion of Timestamp
  *
@@ -348,33 +392,39 @@
  *
  *  @return The nanoseconds portion of @a _time.
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
   #define _Timestamp64_Get_nanoseconds( _time ) \
-	  (*(_time) % 1000000000)
+    _Timestamp64_implementation_Get_nanoseconds( _time )
 #else
   uint32_t _Timestamp64_Get_nanoseconds(
-    Timestamp64_Control *_time
+    const Timestamp64_Control *_time
   );
 #endif
 
+static inline void _Timestamp64_implementation_To_timespec(
+  const Timestamp64_Control *_timestamp,
+  struct timespec           *_timespec
+)
+{
+  _timespec->tv_sec = *_timestamp / 1000000000L;
+  _timespec->tv_nsec = *_timestamp % 1000000000L;
+}
+
 /**
  *  @brief Convert Timestamp to struct timespec
  *
  *  This method returns the seconds portion of the specified timestamp
  *
  *  @param[in] _timestamp points to the timestamp
- *  @param[in] _timespec points to the timespec
+ *  @param[out] _timespec points to the timespec
  */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
   #define _Timestamp64_To_timespec( _timestamp, _timespec  ) \
-	do { \
-	  (_timespec)->tv_sec = *(_timestamp) / 1000000000; \
-	  (_timespec)->tv_nsec = *(_timestamp) % 1000000000; \
-	} while (0)
+    _Timestamp64_implementation_To_timespec( _timestamp, _timespec )
 #else
   void _Timestamp64_To_timespec(
-    Timestamp64_Control *_timestamp,
-    struct timespec     *_timespec
+    const Timestamp64_Control *_timestamp,
+    struct timespec           *_timespec
   );
 #endif
 

diff -u rtems/cpukit/score/src/ts64addto.c:1.1 rtems/cpukit/score/src/ts64addto.c:1.2
--- rtems/cpukit/score/src/ts64addto.c:1.1	Tue Dec  9 15:27:35 2008
+++ rtems/cpukit/score/src/ts64addto.c	Wed Sep 28 09:42:12 2011
@@ -17,18 +17,14 @@
 #include "config.h"
 #endif
 
-#include <sys/types.h>
-
-#include <rtems/system.h>
 #include <rtems/score/timestamp.h>
 
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
-    !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64 == TRUE
 void _Timestamp64_Add_to(
-  Timestamp64_Control *_time,
-  Timestamp64_Control *_add
+  Timestamp64_Control       *_time,
+  const Timestamp64_Control *_add
 )
 {
-  *_time += *_add;
+  _Timestamp64_implementation_Add_to( _time, _add );
 }
 #endif

diff -u rtems/cpukit/score/src/ts64divide.c:1.3 rtems/cpukit/score/src/ts64divide.c:1.4
--- rtems/cpukit/score/src/ts64divide.c:1.3	Sun Nov 29 07:51:52 2009
+++ rtems/cpukit/score/src/ts64divide.c	Wed Sep 28 09:42:12 2011
@@ -17,12 +17,10 @@
 #include "config.h"
 #endif
 
-#include <rtems/system.h>
-#include <sys/types.h>
 #include <rtems/score/timestamp.h>
 
 /* This method is never inlined. */
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)
+#if CPU_TIMESTAMP_USE_INT64 == TRUE || CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
 void _Timestamp64_Divide(
   const Timestamp64_Control *_lhs,
   const Timestamp64_Control *_rhs,

diff -u rtems/cpukit/score/src/ts64dividebyinteger.c:1.1 rtems/cpukit/score/src/ts64dividebyinteger.c:1.2
--- rtems/cpukit/score/src/ts64dividebyinteger.c:1.1	Tue Dec  9 15:27:35 2008
+++ rtems/cpukit/score/src/ts64dividebyinteger.c	Wed Sep 28 09:42:12 2011
@@ -17,19 +17,15 @@
 #include "config.h"
 #endif
 
-#include <sys/types.h>
-
-#include <rtems/system.h>
 #include <rtems/score/timestamp.h>
 
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
-    !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64 == TRUE
 void _Timestamp64_Divide_by_integer(
-  Timestamp64_Control *_time,
-  uint32_t             _iterations,
-  Timestamp64_Control *_result
+  const Timestamp64_Control *_time,
+  uint32_t                   _iterations,
+  Timestamp64_Control       *_result
 )
 {
-  *_result = *_time / _iterations;
+  _Timestamp64_implementation_Divide_by_integer( _time, _iterations, _result );
 }
 #endif

diff -u rtems/cpukit/score/src/ts64equalto.c:1.1 rtems/cpukit/score/src/ts64equalto.c:1.2
--- rtems/cpukit/score/src/ts64equalto.c:1.1	Tue Dec  9 15:27:35 2008
+++ rtems/cpukit/score/src/ts64equalto.c	Wed Sep 28 09:42:12 2011
@@ -17,18 +17,14 @@
 #include "config.h"
 #endif
 
-#include <sys/types.h>
-
-#include <rtems/system.h>
 #include <rtems/score/timestamp.h>
 
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
-    !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64 == TRUE
 bool _Timestamp64_Equal_to(
-  Timestamp64_Control *_lhs,
-  Timestamp64_Control *_rhs
+  const Timestamp64_Control *_lhs,
+  const Timestamp64_Control *_rhs
 )
 {
-  return (*(_lhs) == *(_rhs));
+  _Timestamp64_implementation_Equal_to( _lhs, _rhs );
 }
 #endif

diff -u rtems/cpukit/score/src/ts64getnanoseconds.c:1.2 rtems/cpukit/score/src/ts64getnanoseconds.c:1.3
--- rtems/cpukit/score/src/ts64getnanoseconds.c:1.2	Sun Nov 29 07:51:52 2009
+++ rtems/cpukit/score/src/ts64getnanoseconds.c	Wed Sep 28 09:42:12 2011
@@ -17,17 +17,13 @@
 #include "config.h"
 #endif
 
-#include <sys/types.h>
-
-#include <rtems/system.h>
 #include <rtems/score/timestamp.h>
 
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
-    !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64 == TRUE
 uint32_t _Timestamp64_Get_nanoseconds(
-  Timestamp64_Control *_time
+  const Timestamp64_Control *_time
 )
 {
-  return *(_time) % 1000000000;
+  _Timestamp64_implementation_Get_nanoseconds( _time );
 }
 #endif

diff -u rtems/cpukit/score/src/ts64getseconds.c:1.1 rtems/cpukit/score/src/ts64getseconds.c:1.2
--- rtems/cpukit/score/src/ts64getseconds.c:1.1	Tue Dec  9 15:27:35 2008
+++ rtems/cpukit/score/src/ts64getseconds.c	Wed Sep 28 09:42:12 2011
@@ -17,17 +17,13 @@
 #include "config.h"
 #endif
 
-#include <sys/types.h>
-
-#include <rtems/system.h>
 #include <rtems/score/timestamp.h>
 
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
-    !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64 == TRUE
 uint32_t _Timestamp64_Get_seconds(
-  Timestamp64_Control *_time
+  const Timestamp64_Control *_time
 )
 {
-  return *(_time) / 1000000000;
+  _Timestamp64_implementation_Get_seconds( _time );
 }
 #endif

diff -u rtems/cpukit/score/src/ts64lessthan.c:1.1 rtems/cpukit/score/src/ts64lessthan.c:1.2
--- rtems/cpukit/score/src/ts64lessthan.c:1.1	Tue Dec  9 15:27:35 2008
+++ rtems/cpukit/score/src/ts64lessthan.c	Wed Sep 28 09:42:12 2011
@@ -17,18 +17,14 @@
 #include "config.h"
 #endif
 
-#include <sys/types.h>
-
-#include <rtems/system.h>
 #include <rtems/score/timestamp.h>
 
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
-    !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64 == TRUE
 bool _Timestamp64_Less_than(
-  Timestamp64_Control *_lhs,
-  Timestamp64_Control *_rhs
+  const Timestamp64_Control *_lhs,
+  const Timestamp64_Control *_rhs
 )
 {
-  return (*(_lhs) < *(_rhs));
+  _Timestamp64_implementation_Less_than( _lhs, _rhs );
 }
 #endif

diff -u rtems/cpukit/score/src/ts64set.c:1.1 rtems/cpukit/score/src/ts64set.c:1.2
--- rtems/cpukit/score/src/ts64set.c:1.1	Tue Dec  9 15:27:35 2008
+++ rtems/cpukit/score/src/ts64set.c	Wed Sep 28 09:42:12 2011
@@ -17,23 +17,15 @@
 #include "config.h"
 #endif
 
-#include <sys/types.h>
-
-#include <rtems/system.h>
 #include <rtems/score/timestamp.h>
 
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
-    !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64 == TRUE
 void _Timestamp64_Set(
   Timestamp64_Control *_time,
   long                 _seconds,
   long                 _nanoseconds
 )
 {
-  int64_t time;
-
-  time = (int64_t)_seconds * 1000000000;
-  time += (int64_t)_nanoseconds;
-  *_time = time;
+  _Timestamp64_implementation_Set( _time, _seconds, _nanoseconds );
 }
 #endif

diff -u rtems/cpukit/score/src/ts64settozero.c:1.1 rtems/cpukit/score/src/ts64settozero.c:1.2
--- rtems/cpukit/score/src/ts64settozero.c:1.1	Tue Dec  9 15:27:35 2008
+++ rtems/cpukit/score/src/ts64settozero.c	Wed Sep 28 09:42:12 2011
@@ -17,17 +17,13 @@
 #include "config.h"
 #endif
 
-#include <sys/types.h>
-
-#include <rtems/system.h>
 #include <rtems/score/timestamp.h>
 
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
-    !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64 == TRUE
 void _Timestamp64_Set_to_zero(
   Timestamp64_Control *_time
 )
 {
-  *_time = 0;
+  _Timestamp64_implementation_Set_to_zero( _time );
 }
 #endif

diff -u rtems/cpukit/score/src/ts64subtract.c:1.1 rtems/cpukit/score/src/ts64subtract.c:1.2
--- rtems/cpukit/score/src/ts64subtract.c:1.1	Tue Dec  9 15:27:35 2008
+++ rtems/cpukit/score/src/ts64subtract.c	Wed Sep 28 09:42:12 2011
@@ -17,19 +17,15 @@
 #include "config.h"
 #endif
 
-#include <sys/types.h>
-
-#include <rtems/system.h>
 #include <rtems/score/timestamp.h>
 
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
-    !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64 == TRUE
 void _Timestamp64_Subtract(
-  Timestamp64_Control *_start,
-  Timestamp64_Control *_end,
-  Timestamp64_Control *_result
+  const Timestamp64_Control *_start,
+  const Timestamp64_Control *_end,
+  Timestamp64_Control       *_result
 )
 {
-  *_result = *_end - *_start;
+  _Timestamp64_implementation_Subtract( _start, _end, _result );
 }
 #endif

diff -u rtems/cpukit/score/src/ts64toticks.c:1.3 rtems/cpukit/score/src/ts64toticks.c:1.4
--- rtems/cpukit/score/src/ts64toticks.c:1.3	Sun Nov 29 07:51:52 2009
+++ rtems/cpukit/score/src/ts64toticks.c	Wed Sep 28 09:42:12 2011
@@ -24,8 +24,7 @@
 #include <rtems/score/timestamp.h>
 #include <rtems/score/tod.h>
 
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
-    !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64 == TRUE
 uint32_t _Timestamp64_To_ticks(
   const Timestamp64_Control *time
 )

diff -u rtems/cpukit/score/src/ts64totimespec.c:1.1 rtems/cpukit/score/src/ts64totimespec.c:1.2
--- rtems/cpukit/score/src/ts64totimespec.c:1.1	Tue Dec  9 15:27:35 2008
+++ rtems/cpukit/score/src/ts64totimespec.c	Wed Sep 28 09:42:12 2011
@@ -17,19 +17,14 @@
 #include "config.h"
 #endif
 
-#include <sys/types.h>
-
-#include <rtems/system.h>
 #include <rtems/score/timestamp.h>
 
-#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
-    !defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
+#if CPU_TIMESTAMP_USE_INT64 == TRUE
 void _Timestamp64_To_timespec(
-  Timestamp64_Control *_timestamp,
-  struct timespec     *_timespec
+  const Timestamp64_Control *_timestamp,
+  struct timespec           *_timespec
 )
 {
-  _timespec->tv_sec = *_timestamp / 1000000000;
-  _timespec->tv_nsec = *_timestamp % 1000000000;
+  _Timestamp64_implementation_To_timespec( _timestamp, _timespec );
 }
 #endif



--

Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110928/5f9751e9/attachment-0001.html>


More information about the vc mailing list