forked from Imagelibrary/rtems
2011-09-28 Sebastian Huber <sebastian.huber@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.
This commit is contained in:
@@ -1,3 +1,21 @@
|
|||||||
|
2011-09-28 Sebastian Huber <sebastian.huber@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@fel.cvut.cz>
|
2011-09-26 Petr Benes <benesp16@fel.cvut.cz>
|
||||||
|
|
||||||
PR 1923/testing
|
PR 1923/testing
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ libscore_a_SOURCES += src/threadq.c src/threadqdequeue.c \
|
|||||||
|
|
||||||
## TIMESPEC_C_FILES
|
## TIMESPEC_C_FILES
|
||||||
libscore_a_SOURCES += src/timespecaddto.c src/timespecfromticks.c \
|
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/timespecsubtract.c src/timespectoticks.c src/timespecdivide.c \
|
||||||
src/timespecdividebyinteger.c
|
src/timespecdividebyinteger.c
|
||||||
|
|
||||||
@@ -303,7 +303,7 @@ libscore_a_SOURCES += src/timespecaddto.c src/timespecfromticks.c \
|
|||||||
libscore_a_SOURCES += src/ts64addto.c src/ts64dividebyinteger.c \
|
libscore_a_SOURCES += src/ts64addto.c src/ts64dividebyinteger.c \
|
||||||
src/ts64divide.c src/ts64equalto.c \
|
src/ts64divide.c src/ts64equalto.c \
|
||||||
src/ts64getnanoseconds.c src/ts64getseconds.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/ts64set.c src/ts64settozero.c src/ts64subtract.c \
|
||||||
src/ts64toticks.c src/ts64totimespec.c
|
src/ts64toticks.c src/ts64totimespec.c
|
||||||
|
|
||||||
|
|||||||
@@ -131,10 +131,8 @@ bool _Timespec_Less_than(
|
|||||||
* @return This method returns true if @a lhs is greater than the @a rhs and
|
* @return This method returns true if @a lhs is greater than the @a rhs and
|
||||||
* false otherwise.
|
* false otherwise.
|
||||||
*/
|
*/
|
||||||
bool _Timespec_Greater_than(
|
#define _Timespec_Greater_than( _lhs, _rhs ) \
|
||||||
const struct timespec *lhs,
|
_Timespec_Less_than( _rhs, _lhs )
|
||||||
const struct timespec *rhs
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Timespec equal to Operator
|
* @brief Timespec equal to Operator
|
||||||
|
|||||||
@@ -40,93 +40,33 @@
|
|||||||
*/
|
*/
|
||||||
/**@{*/
|
/**@{*/
|
||||||
|
|
||||||
|
#include <rtems/score/cpu.h>
|
||||||
#include <rtems/score/timespec.h>
|
#include <rtems/score/timespec.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
#if ! ( ( CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE \
|
||||||
* NOTE: Eventually each port should select what it should use!!!
|
&& CPU_TIMESTAMP_USE_INT64 == FALSE \
|
||||||
*
|
&& CPU_TIMESTAMP_USE_INT64_INLINE == FALSE ) \
|
||||||
* These control which implementation of SuperCore Timestamp is used.
|
|| ( CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == FALSE \
|
||||||
*
|
&& CPU_TIMESTAMP_USE_INT64 == TRUE \
|
||||||
* if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
|
&& CPU_TIMESTAMP_USE_INT64_INLINE == FALSE ) \
|
||||||
* struct timespec is used
|
|| ( CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == FALSE \
|
||||||
* else if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)
|
&& CPU_TIMESTAMP_USE_INT64 == FALSE \
|
||||||
* int64_t is used
|
&& CPU_TIMESTAMP_USE_INT64_INLINE == TRUE ) )
|
||||||
*
|
#error "Invalid SuperCore Timestamp implementations selection."
|
||||||
* 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
|
#endif
|
||||||
|
|
||||||
/*
|
#if CPU_TIMESTAMP_USE_INT64 == TRUE || CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
|
||||||
* 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."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Include any implementation specific header files
|
|
||||||
*/
|
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64)
|
|
||||||
#include <rtems/score/timestamp64.h>
|
#include <rtems/score/timestamp64.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the Timestamp control type.
|
* 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;
|
typedef struct timespec Timestamp_Control;
|
||||||
#else
|
#else
|
||||||
typedef Timestamp64_Control Timestamp_Control;
|
typedef Timestamp64_Control Timestamp_Control;
|
||||||
@@ -142,7 +82,7 @@ extern "C" {
|
|||||||
* @param[in] _seconds is the seconds portion of the timestamp
|
* @param[in] _seconds is the seconds portion of the timestamp
|
||||||
* @param[in] _nanoseconds is the nanoseconds 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 ) \
|
#define _Timestamp_Set( _time, _seconds, _nanoseconds ) \
|
||||||
_Timespec_Set( _time, _seconds, _nanoseconds )
|
_Timespec_Set( _time, _seconds, _nanoseconds )
|
||||||
#else
|
#else
|
||||||
@@ -158,7 +98,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* @param[in] _time points to the timestamp instance to zero.
|
* @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 ) \
|
#define _Timestamp_Set_to_zero( _time ) \
|
||||||
_Timespec_Set_to_zero( _time )
|
_Timespec_Set_to_zero( _time )
|
||||||
#else
|
#else
|
||||||
@@ -176,7 +116,7 @@ extern "C" {
|
|||||||
* @return This method returns true if @a time is valid and
|
* @return This method returns true if @a time is valid and
|
||||||
* false otherwise.
|
* false otherwise.
|
||||||
*/
|
*/
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
|
#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
|
||||||
#define _Timestamp_Is_valid( _time ) \
|
#define _Timestamp_Is_valid( _time ) \
|
||||||
_Timespec_Is_valid( _time )
|
_Timespec_Is_valid( _time )
|
||||||
#else
|
#else
|
||||||
@@ -195,7 +135,7 @@ extern "C" {
|
|||||||
* @return This method returns true if @a _lhs is less than the @a _rhs and
|
* @return This method returns true if @a _lhs is less than the @a _rhs and
|
||||||
* false otherwise.
|
* false otherwise.
|
||||||
*/
|
*/
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
|
#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
|
||||||
#define _Timestamp_Less_than( _lhs, _rhs ) \
|
#define _Timestamp_Less_than( _lhs, _rhs ) \
|
||||||
_Timespec_Less_than( _lhs, _rhs )
|
_Timespec_Less_than( _lhs, _rhs )
|
||||||
#else
|
#else
|
||||||
@@ -214,13 +154,8 @@ extern "C" {
|
|||||||
* @return This method returns true if @a _lhs is greater than the @a _rhs and
|
* @return This method returns true if @a _lhs is greater than the @a _rhs and
|
||||||
* false otherwise.
|
* false otherwise.
|
||||||
*/
|
*/
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
|
|
||||||
#define _Timestamp_Greater_than( _lhs, _rhs ) \
|
#define _Timestamp_Greater_than( _lhs, _rhs ) \
|
||||||
_Timespec_Greater_than( _lhs, _rhs )
|
_Timestamp_Less_than( _rhs, _lhs )
|
||||||
#else
|
|
||||||
#define _Timestamp_Greater_than( _lhs, _rhs ) \
|
|
||||||
_Timestamp64_Greater_than( _lhs, _rhs )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Timestamp equal to Operator
|
* @brief Timestamp equal to Operator
|
||||||
@@ -233,7 +168,7 @@ extern "C" {
|
|||||||
* @return This method returns true if @a _lhs is equal to @a _rhs and
|
* @return This method returns true if @a _lhs is equal to @a _rhs and
|
||||||
* false otherwise.
|
* false otherwise.
|
||||||
*/
|
*/
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_STRUCT_SPEC)
|
#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
|
||||||
#define _Timestamp_Equal_to( _lhs, _rhs ) \
|
#define _Timestamp_Equal_to( _lhs, _rhs ) \
|
||||||
_Timespec_Equal_to( _lhs, _rhs )
|
_Timespec_Equal_to( _lhs, _rhs )
|
||||||
#else
|
#else
|
||||||
@@ -252,7 +187,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* @return This method returns the number of seconds @a time increased by.
|
* @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 ) \
|
#define _Timestamp_Add_to( _time, _add ) \
|
||||||
_Timespec_Add_to( _time, _add )
|
_Timespec_Add_to( _time, _add )
|
||||||
#else
|
#else
|
||||||
@@ -277,7 +212,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* @return This method returns the number of seconds @a time increased by.
|
* @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 ) \
|
#define _Timestamp_Add_to_at_tick( _time, _add ) \
|
||||||
_Timespec_Add_to( _time, _add )
|
_Timespec_Add_to( _time, _add )
|
||||||
#else
|
#else
|
||||||
@@ -295,7 +230,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* @return This method returns the number of ticks computed.
|
* @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 ) \
|
#define _Timestamp_To_ticks( _time ) \
|
||||||
_Timespec_To_ticks( _time )
|
_Timespec_To_ticks( _time )
|
||||||
#else
|
#else
|
||||||
@@ -312,7 +247,7 @@ extern "C" {
|
|||||||
* @param[in] _time points to the timestamp format time result
|
* @param[in] _time points to the timestamp format time result
|
||||||
* @param[in] _ticks points to the number of ticks to be filled in
|
* @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 ) \
|
#define _Timestamp_From_ticks( _ticks, _time ) \
|
||||||
_Timespec_From_ticks( _ticks, _time )
|
_Timespec_From_ticks( _ticks, _time )
|
||||||
#else
|
#else
|
||||||
@@ -333,7 +268,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* @return This method fills in @a _result.
|
* @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 ) \
|
#define _Timestamp_Subtract( _start, _end, _result ) \
|
||||||
_Timespec_Subtract( _start, _end, _result )
|
_Timespec_Subtract( _start, _end, _result )
|
||||||
#else
|
#else
|
||||||
@@ -354,7 +289,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* @return This method fills in @a result.
|
* @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 ) \
|
#define _Timestamp_Divide_by_integer( _time, _iterations, _result ) \
|
||||||
_Timespec_Divide_by_integer(_time, _iterations, _result )
|
_Timespec_Divide_by_integer(_time, _iterations, _result )
|
||||||
#else
|
#else
|
||||||
@@ -375,7 +310,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* @return This method fills in @a result.
|
* @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 ) \
|
#define _Timestamp_Divide( _lhs, _rhs, _ival_percentage, _fval_percentage ) \
|
||||||
_Timespec_Divide( _lhs, _rhs, _ival_percentage, _fval_percentage )
|
_Timespec_Divide( _lhs, _rhs, _ival_percentage, _fval_percentage )
|
||||||
#else
|
#else
|
||||||
@@ -392,7 +327,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* @return The seconds portion of @a _time.
|
* @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 ) \
|
#define _Timestamp_Get_seconds( _time ) \
|
||||||
_Timespec_Get_seconds( _time )
|
_Timespec_Get_seconds( _time )
|
||||||
#else
|
#else
|
||||||
@@ -409,7 +344,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* @return The nanoseconds portion of @a _time.
|
* @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 ) \
|
#define _Timestamp_Get_nanoseconds( _time ) \
|
||||||
_Timespec_Get_nanoseconds( _time )
|
_Timespec_Get_nanoseconds( _time )
|
||||||
#else
|
#else
|
||||||
@@ -425,7 +360,7 @@ extern "C" {
|
|||||||
* @param[in] _timestamp points to the timestamp
|
* @param[in] _timestamp points to the timestamp
|
||||||
* @param[in] _timespec points to the timespec
|
* @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 */
|
/* in this case we know they are the same type so use simple assignment */
|
||||||
#define _Timestamp_To_timespec( _timestamp, _timespec ) \
|
#define _Timestamp_To_timespec( _timestamp, _timespec ) \
|
||||||
*(_timespec) = *(_timestamp)
|
*(_timespec) = *(_timestamp)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ extern "C" {
|
|||||||
/*
|
/*
|
||||||
* Verify something is defined.
|
* 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."
|
#error "SuperCore Timestamp64 implementation included but not defined."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -53,6 +53,18 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
typedef int64_t Timestamp64_Control;
|
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
|
* @brief Set Timestamp to Seconds Nanosecond
|
||||||
*
|
*
|
||||||
@@ -63,12 +75,9 @@ typedef int64_t Timestamp64_Control;
|
|||||||
* @param[in] _seconds is the seconds portion of the timestamp
|
* @param[in] _seconds is the seconds portion of the timestamp
|
||||||
* @param[in] _nanoseconds is the nanoseconds 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 ) \
|
#define _Timestamp64_Set( _time, _seconds, _nanoseconds ) \
|
||||||
do { \
|
_Timestamp64_implementation_Set( _time, _seconds, _nanoseconds )
|
||||||
*(_time) = ((int64_t)_seconds * 1000000000); \
|
|
||||||
*(_time) += (int64_t)(_nanoseconds); \
|
|
||||||
} while (0)
|
|
||||||
#else
|
#else
|
||||||
void _Timestamp64_Set(
|
void _Timestamp64_Set(
|
||||||
Timestamp64_Control *_time,
|
Timestamp64_Control *_time,
|
||||||
@@ -77,6 +86,13 @@ typedef int64_t Timestamp64_Control;
|
|||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static inline void _Timestamp64_implementation_Set_to_zero(
|
||||||
|
Timestamp64_Control *_time
|
||||||
|
)
|
||||||
|
{
|
||||||
|
*_time = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Zero Timestamp
|
* @brief Zero Timestamp
|
||||||
*
|
*
|
||||||
@@ -85,9 +101,9 @@ typedef int64_t Timestamp64_Control;
|
|||||||
*
|
*
|
||||||
* @param[in] _time points to the timestamp instance to zero.
|
* @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 ) \
|
#define _Timestamp64_Set_to_zero( _time ) \
|
||||||
*(_time) = 0
|
_Timestamp64_implementation_Set_to_zero( _time )
|
||||||
#else
|
#else
|
||||||
void _Timestamp64_Set_to_zero(
|
void _Timestamp64_Set_to_zero(
|
||||||
Timestamp64_Control *_time
|
Timestamp64_Control *_time
|
||||||
@@ -107,6 +123,14 @@ typedef int64_t Timestamp64_Control;
|
|||||||
#define _Timestamp64_Is_valid( _time ) \
|
#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
|
* @brief Timestamp Less Than Operator
|
||||||
*
|
*
|
||||||
@@ -118,36 +142,26 @@ typedef int64_t Timestamp64_Control;
|
|||||||
* @return This method returns true if @a _lhs is less than the @a _rhs and
|
* @return This method returns true if @a _lhs is less than the @a _rhs and
|
||||||
* false otherwise.
|
* false otherwise.
|
||||||
*/
|
*/
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
|
#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
|
||||||
#define _Timestamp64_Less_than( _lhs, _rhs ) \
|
#define _Timestamp64_Less_than( _lhs, _rhs ) \
|
||||||
(*(_lhs) < *(_rhs))
|
_Timestamp64_implementation_Less_than( _lhs, _rhs )
|
||||||
#else
|
#else
|
||||||
bool _Timestamp64_Less_than(
|
bool _Timestamp64_Less_than(
|
||||||
Timestamp64_Control *_lhs,
|
const Timestamp64_Control *_lhs,
|
||||||
Timestamp64_Control *_rhs
|
const Timestamp64_Control *_rhs
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
static inline bool _Timestamp64_implementation_Equal_to(
|
||||||
* @brief Timestamp Greater Than Operator
|
const Timestamp64_Control *_lhs,
|
||||||
*
|
const Timestamp64_Control *_rhs
|
||||||
* This method is the greater than operator for timestamps.
|
)
|
||||||
*
|
{
|
||||||
* @param[in] _lhs points to the left hand side timestamp
|
return *_lhs == *_rhs;
|
||||||
* @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 ) \
|
#define _Timestamp64_Greater_than( _lhs, _rhs ) \
|
||||||
(*(_lhs) > *(_rhs))
|
_Timestamp64_Less_than( _rhs, _lhs )
|
||||||
#else
|
|
||||||
bool _Timestamp64_Greater_than(
|
|
||||||
Timestamp64_Control *_lhs,
|
|
||||||
Timestamp64_Control *_rhs
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Timestamp equal to Operator
|
* @brief Timestamp equal to Operator
|
||||||
@@ -160,16 +174,24 @@ typedef int64_t Timestamp64_Control;
|
|||||||
* @return This method returns true if @a _lhs is equal to @a _rhs and
|
* @return This method returns true if @a _lhs is equal to @a _rhs and
|
||||||
* false otherwise.
|
* false otherwise.
|
||||||
*/
|
*/
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
|
#if CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
|
||||||
#define _Timestamp64_Equal_to( _lhs, _rhs ) \
|
#define _Timestamp64_Equal_to( _lhs, _rhs ) \
|
||||||
(*(_lhs) == *(_rhs))
|
_Timestamp64_implementation_Equal_to( _lhs, _rhs )
|
||||||
#else
|
#else
|
||||||
bool _Timestamp64_Equal_to(
|
bool _Timestamp64_Equal_to(
|
||||||
Timestamp64_Control *_lhs,
|
const Timestamp64_Control *_lhs,
|
||||||
Timestamp64_Control *_rhs
|
const Timestamp64_Control *_rhs
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static inline void _Timestamp64_implementation_Add_to(
|
||||||
|
Timestamp64_Control *_time,
|
||||||
|
const Timestamp64_Control *_add
|
||||||
|
)
|
||||||
|
{
|
||||||
|
*_time += *_add;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add to a Timestamp
|
* @brief Add to a Timestamp
|
||||||
*
|
*
|
||||||
@@ -181,13 +203,13 @@ typedef int64_t Timestamp64_Control;
|
|||||||
*
|
*
|
||||||
* @return This method returns the number of seconds @a time increased by.
|
* @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 ) \
|
#define _Timestamp64_Add_to( _time, _add ) \
|
||||||
*(_time) += *(_add)
|
_Timestamp64_implementation_Add_to( _time, _add )
|
||||||
#else
|
#else
|
||||||
void _Timestamp64_Add_to(
|
void _Timestamp64_Add_to(
|
||||||
Timestamp64_Control *_time,
|
Timestamp64_Control *_time,
|
||||||
Timestamp64_Control *_add
|
const Timestamp64_Control *_add
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -210,12 +232,12 @@ typedef int64_t Timestamp64_Control;
|
|||||||
*/
|
*/
|
||||||
static inline uint32_t _Timestamp64_Add_to_at_tick(
|
static inline uint32_t _Timestamp64_Add_to_at_tick(
|
||||||
Timestamp64_Control *_time,
|
Timestamp64_Control *_time,
|
||||||
Timestamp64_Control *_add
|
const Timestamp64_Control *_add
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Timestamp64_Control start = *_time / 1000000000;
|
Timestamp64_Control _start = *_time / 1000000000L;
|
||||||
*_time += *_add;
|
*_time += *_add;
|
||||||
if ( ((*_time) / 1000000000) != start ) {
|
if ( ((*_time) / 1000000000L) != _start ) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -242,13 +264,22 @@ uint32_t _Timestamp64_To_ticks(
|
|||||||
* timestamp format @a _time.
|
* timestamp format @a _time.
|
||||||
*
|
*
|
||||||
* @param[in] _time points to the timestamp format time result
|
* @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(
|
void _Timestamp64_From_ticks(
|
||||||
uint32_t _ticks,
|
uint32_t _ticks,
|
||||||
Timestamp64_Control *_time
|
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
|
* @brief Subtract Two Timestamp
|
||||||
*
|
*
|
||||||
@@ -257,24 +288,29 @@ void _Timestamp64_From_ticks(
|
|||||||
*
|
*
|
||||||
* @param[in] _start points to the starting time
|
* @param[in] _start points to the starting time
|
||||||
* @param[in] _end points to the ending 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.
|
* 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 ) \
|
#define _Timestamp64_Subtract( _start, _end, _result ) \
|
||||||
do { \
|
_Timestamp64_implementation_Subtract( _start, _end, _result )
|
||||||
*(_result) = *(_end) - *(_start); \
|
|
||||||
} while (0)
|
|
||||||
#else
|
#else
|
||||||
void _Timestamp64_Subtract(
|
void _Timestamp64_Subtract(
|
||||||
Timestamp64_Control *_start,
|
const Timestamp64_Control *_start,
|
||||||
Timestamp64_Control *_end,
|
const Timestamp64_Control *_end,
|
||||||
Timestamp64_Control *_result
|
Timestamp64_Control *_result
|
||||||
);
|
);
|
||||||
#endif
|
#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
|
* @brief Divide Timestamp By Integer
|
||||||
*
|
*
|
||||||
@@ -284,18 +320,14 @@ void _Timestamp64_From_ticks(
|
|||||||
*
|
*
|
||||||
* @param[in] _time points to the total
|
* @param[in] _time points to the total
|
||||||
* @param[in] _iterations is the number of iterations
|
* @param[in] _iterations is the number of iterations
|
||||||
* @param[in] _result points to the average time.
|
* @param[out] _result points to the average 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_Divide_by_integer( _time, _iterations, _result ) \
|
#define _Timestamp64_Divide_by_integer( _time, _iterations, _result ) \
|
||||||
do { \
|
_Timestamp64_implementation_Divide_by_integer( _time, _iterations, _result )
|
||||||
*(_result) = *(_time) / (_iterations); \
|
|
||||||
} while (0)
|
|
||||||
#else
|
#else
|
||||||
void _Timestamp64_Divide_by_integer(
|
void _Timestamp64_Divide_by_integer(
|
||||||
Timestamp64_Control *_time,
|
const Timestamp64_Control *_time,
|
||||||
uint32_t _iterations,
|
uint32_t _iterations,
|
||||||
Timestamp64_Control *_result
|
Timestamp64_Control *_result
|
||||||
);
|
);
|
||||||
@@ -309,10 +341,8 @@ void _Timestamp64_From_ticks(
|
|||||||
*
|
*
|
||||||
* @param[in] _lhs points to the left hand number
|
* @param[in] _lhs points to the left hand number
|
||||||
* @param[in] _rhs points to the right hand number
|
* @param[in] _rhs points to the right hand number
|
||||||
* @param[in] _ival_percentage points to the integer portion of the average
|
* @param[out] _ival_percentage points to the integer portion of the average
|
||||||
* @param[in] _fval_percentage points to the thousandths of percentage
|
* @param[out] _fval_percentage points to the thousandths of percentage
|
||||||
*
|
|
||||||
* @return This method fills in @a result.
|
|
||||||
*/
|
*/
|
||||||
void _Timestamp64_Divide(
|
void _Timestamp64_Divide(
|
||||||
const Timestamp64_Control *_lhs,
|
const Timestamp64_Control *_lhs,
|
||||||
@@ -321,6 +351,13 @@ void _Timestamp64_Divide(
|
|||||||
uint32_t *_fval_percentage
|
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
|
* @brief Get Seconds Portion of Timestamp
|
||||||
*
|
*
|
||||||
@@ -330,15 +367,22 @@ void _Timestamp64_Divide(
|
|||||||
*
|
*
|
||||||
* @return The seconds portion of @a _time.
|
* @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 ) \
|
#define _Timestamp64_Get_seconds( _time ) \
|
||||||
(*(_time) / 1000000000)
|
_Timestamp64_implementation_Get_seconds( _time )
|
||||||
#else
|
#else
|
||||||
uint32_t _Timestamp64_Get_seconds(
|
uint32_t _Timestamp64_Get_seconds(
|
||||||
Timestamp64_Control *_time
|
const Timestamp64_Control *_time
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static inline uint32_t _Timestamp64_implementation_Get_nanoseconds(
|
||||||
|
const Timestamp64_Control *_time
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return (uint32_t) (*_time % 1000000000L);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get Nanoseconds Portion of Timestamp
|
* @brief Get Nanoseconds Portion of Timestamp
|
||||||
*
|
*
|
||||||
@@ -348,32 +392,38 @@ void _Timestamp64_Divide(
|
|||||||
*
|
*
|
||||||
* @return The nanoseconds portion of @a _time.
|
* @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 ) \
|
#define _Timestamp64_Get_nanoseconds( _time ) \
|
||||||
(*(_time) % 1000000000)
|
_Timestamp64_implementation_Get_nanoseconds( _time )
|
||||||
#else
|
#else
|
||||||
uint32_t _Timestamp64_Get_nanoseconds(
|
uint32_t _Timestamp64_Get_nanoseconds(
|
||||||
Timestamp64_Control *_time
|
const Timestamp64_Control *_time
|
||||||
);
|
);
|
||||||
#endif
|
#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
|
* @brief Convert Timestamp to struct timespec
|
||||||
*
|
*
|
||||||
* This method returns the seconds portion of the specified timestamp
|
* This method returns the seconds portion of the specified timestamp
|
||||||
*
|
*
|
||||||
* @param[in] _timestamp points to the 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 ) \
|
#define _Timestamp64_To_timespec( _timestamp, _timespec ) \
|
||||||
do { \
|
_Timestamp64_implementation_To_timespec( _timestamp, _timespec )
|
||||||
(_timespec)->tv_sec = *(_timestamp) / 1000000000; \
|
|
||||||
(_timespec)->tv_nsec = *(_timestamp) % 1000000000; \
|
|
||||||
} while (0)
|
|
||||||
#else
|
#else
|
||||||
void _Timestamp64_To_timespec(
|
void _Timestamp64_To_timespec(
|
||||||
Timestamp64_Control *_timestamp,
|
const Timestamp64_Control *_timestamp,
|
||||||
struct timespec *_timespec
|
struct timespec *_timespec
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file score/src/timespecgreaterthan.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* COPYRIGHT (c) 1989-2007.
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <rtems/system.h>
|
|
||||||
#include <rtems/score/timespec.h>
|
|
||||||
#include <rtems/score/tod.h>
|
|
||||||
|
|
||||||
bool _Timespec_Greater_than(
|
|
||||||
const struct timespec *lhs,
|
|
||||||
const struct timespec *rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if ( lhs->tv_sec > rhs->tv_sec )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if ( lhs->tv_sec < rhs->tv_sec )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* ASSERT: lhs->tv_sec == rhs->tv_sec */
|
|
||||||
if ( lhs->tv_nsec > rhs->tv_nsec )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
@@ -17,18 +17,14 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <rtems/system.h>
|
|
||||||
#include <rtems/score/timestamp.h>
|
#include <rtems/score/timestamp.h>
|
||||||
|
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
|
#if CPU_TIMESTAMP_USE_INT64 == TRUE
|
||||||
!defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
|
|
||||||
void _Timestamp64_Add_to(
|
void _Timestamp64_Add_to(
|
||||||
Timestamp64_Control *_time,
|
Timestamp64_Control *_time,
|
||||||
Timestamp64_Control *_add
|
const Timestamp64_Control *_add
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
*_time += *_add;
|
_Timestamp64_implementation_Add_to( _time, _add );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,12 +17,10 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <rtems/system.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <rtems/score/timestamp.h>
|
#include <rtems/score/timestamp.h>
|
||||||
|
|
||||||
/* This method is never inlined. */
|
/* 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(
|
void _Timestamp64_Divide(
|
||||||
const Timestamp64_Control *_lhs,
|
const Timestamp64_Control *_lhs,
|
||||||
const Timestamp64_Control *_rhs,
|
const Timestamp64_Control *_rhs,
|
||||||
|
|||||||
@@ -17,19 +17,15 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <rtems/system.h>
|
|
||||||
#include <rtems/score/timestamp.h>
|
#include <rtems/score/timestamp.h>
|
||||||
|
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
|
#if CPU_TIMESTAMP_USE_INT64 == TRUE
|
||||||
!defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
|
|
||||||
void _Timestamp64_Divide_by_integer(
|
void _Timestamp64_Divide_by_integer(
|
||||||
Timestamp64_Control *_time,
|
const Timestamp64_Control *_time,
|
||||||
uint32_t _iterations,
|
uint32_t _iterations,
|
||||||
Timestamp64_Control *_result
|
Timestamp64_Control *_result
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
*_result = *_time / _iterations;
|
_Timestamp64_implementation_Divide_by_integer( _time, _iterations, _result );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,18 +17,14 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <rtems/system.h>
|
|
||||||
#include <rtems/score/timestamp.h>
|
#include <rtems/score/timestamp.h>
|
||||||
|
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
|
#if CPU_TIMESTAMP_USE_INT64 == TRUE
|
||||||
!defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
|
|
||||||
bool _Timestamp64_Equal_to(
|
bool _Timestamp64_Equal_to(
|
||||||
Timestamp64_Control *_lhs,
|
const Timestamp64_Control *_lhs,
|
||||||
Timestamp64_Control *_rhs
|
const Timestamp64_Control *_rhs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return (*(_lhs) == *(_rhs));
|
_Timestamp64_implementation_Equal_to( _lhs, _rhs );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,17 +17,13 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <rtems/system.h>
|
|
||||||
#include <rtems/score/timestamp.h>
|
#include <rtems/score/timestamp.h>
|
||||||
|
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
|
#if CPU_TIMESTAMP_USE_INT64 == TRUE
|
||||||
!defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
|
|
||||||
uint32_t _Timestamp64_Get_nanoseconds(
|
uint32_t _Timestamp64_Get_nanoseconds(
|
||||||
Timestamp64_Control *_time
|
const Timestamp64_Control *_time
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return *(_time) % 1000000000;
|
_Timestamp64_implementation_Get_nanoseconds( _time );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,17 +17,13 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <rtems/system.h>
|
|
||||||
#include <rtems/score/timestamp.h>
|
#include <rtems/score/timestamp.h>
|
||||||
|
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
|
#if CPU_TIMESTAMP_USE_INT64 == TRUE
|
||||||
!defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
|
|
||||||
uint32_t _Timestamp64_Get_seconds(
|
uint32_t _Timestamp64_Get_seconds(
|
||||||
Timestamp64_Control *_time
|
const Timestamp64_Control *_time
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return *(_time) / 1000000000;
|
_Timestamp64_implementation_Get_seconds( _time );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file score/src/ts64greaterthan.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
|
||||||
#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)
|
|
||||||
bool _Timestamp64_Greater_than(
|
|
||||||
Timestamp64_Control *_lhs,
|
|
||||||
Timestamp64_Control *_rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return (*(_lhs) > *(_rhs));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -17,18 +17,14 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <rtems/system.h>
|
|
||||||
#include <rtems/score/timestamp.h>
|
#include <rtems/score/timestamp.h>
|
||||||
|
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
|
#if CPU_TIMESTAMP_USE_INT64 == TRUE
|
||||||
!defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
|
|
||||||
bool _Timestamp64_Less_than(
|
bool _Timestamp64_Less_than(
|
||||||
Timestamp64_Control *_lhs,
|
const Timestamp64_Control *_lhs,
|
||||||
Timestamp64_Control *_rhs
|
const Timestamp64_Control *_rhs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return (*(_lhs) < *(_rhs));
|
_Timestamp64_implementation_Less_than( _lhs, _rhs );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,23 +17,15 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <rtems/system.h>
|
|
||||||
#include <rtems/score/timestamp.h>
|
#include <rtems/score/timestamp.h>
|
||||||
|
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
|
#if CPU_TIMESTAMP_USE_INT64 == TRUE
|
||||||
!defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
|
|
||||||
void _Timestamp64_Set(
|
void _Timestamp64_Set(
|
||||||
Timestamp64_Control *_time,
|
Timestamp64_Control *_time,
|
||||||
long _seconds,
|
long _seconds,
|
||||||
long _nanoseconds
|
long _nanoseconds
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int64_t time;
|
_Timestamp64_implementation_Set( _time, _seconds, _nanoseconds );
|
||||||
|
|
||||||
time = (int64_t)_seconds * 1000000000;
|
|
||||||
time += (int64_t)_nanoseconds;
|
|
||||||
*_time = time;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,17 +17,13 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <rtems/system.h>
|
|
||||||
#include <rtems/score/timestamp.h>
|
#include <rtems/score/timestamp.h>
|
||||||
|
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
|
#if CPU_TIMESTAMP_USE_INT64 == TRUE
|
||||||
!defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
|
|
||||||
void _Timestamp64_Set_to_zero(
|
void _Timestamp64_Set_to_zero(
|
||||||
Timestamp64_Control *_time
|
Timestamp64_Control *_time
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
*_time = 0;
|
_Timestamp64_implementation_Set_to_zero( _time );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,19 +17,15 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <rtems/system.h>
|
|
||||||
#include <rtems/score/timestamp.h>
|
#include <rtems/score/timestamp.h>
|
||||||
|
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
|
#if CPU_TIMESTAMP_USE_INT64 == TRUE
|
||||||
!defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
|
|
||||||
void _Timestamp64_Subtract(
|
void _Timestamp64_Subtract(
|
||||||
Timestamp64_Control *_start,
|
const Timestamp64_Control *_start,
|
||||||
Timestamp64_Control *_end,
|
const Timestamp64_Control *_end,
|
||||||
Timestamp64_Control *_result
|
Timestamp64_Control *_result
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
*_result = *_end - *_start;
|
_Timestamp64_implementation_Subtract( _start, _end, _result );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,8 +24,7 @@
|
|||||||
#include <rtems/score/timestamp.h>
|
#include <rtems/score/timestamp.h>
|
||||||
#include <rtems/score/tod.h>
|
#include <rtems/score/tod.h>
|
||||||
|
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
|
#if CPU_TIMESTAMP_USE_INT64 == TRUE
|
||||||
!defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
|
|
||||||
uint32_t _Timestamp64_To_ticks(
|
uint32_t _Timestamp64_To_ticks(
|
||||||
const Timestamp64_Control *time
|
const Timestamp64_Control *time
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -17,19 +17,14 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <rtems/system.h>
|
|
||||||
#include <rtems/score/timestamp.h>
|
#include <rtems/score/timestamp.h>
|
||||||
|
|
||||||
#if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) && \
|
#if CPU_TIMESTAMP_USE_INT64 == TRUE
|
||||||
!defined(CPU_RTEMS_SCORE_TIMESTAMP_INT64_INLINE)
|
|
||||||
void _Timestamp64_To_timespec(
|
void _Timestamp64_To_timespec(
|
||||||
Timestamp64_Control *_timestamp,
|
const Timestamp64_Control *_timestamp,
|
||||||
struct timespec *_timespec
|
struct timespec *_timespec
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_timespec->tv_sec = *_timestamp / 1000000000;
|
_Timestamp64_implementation_To_timespec( _timestamp, _timespec );
|
||||||
_timespec->tv_nsec = *_timestamp % 1000000000;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user