diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-07-28 14:45:42 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-07-28 14:54:51 +0200 |
commit | 21789a2117f7485000e0d88c3f76a6b9d507bb5a (patch) | |
tree | f14a8eee3d9c10fd673c43f55f7a50d9b5b58b05 /cpukit/score | |
parent | m68k: Include proper header file (diff) | |
download | rtems-21789a2117f7485000e0d88c3f76a6b9d507bb5a.tar.bz2 |
score: Rename _POSIX_Absolute_timeout_to_ticks()
Rename _POSIX_Absolute_timeout_to_ticks() to
_TOD_Absolute_timeout_to_ticks() and move it to the score directory.
Delete empty <rtems/posix/time.h>.
Diffstat (limited to '')
-rw-r--r-- | cpukit/score/Makefile.am | 1 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/todimpl.h | 39 | ||||
-rw-r--r-- | cpukit/score/src/coretodabsolutetimeout.c (renamed from cpukit/posix/src/posixtimespecabsolutetimeout.c) | 23 |
3 files changed, 46 insertions, 17 deletions
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am index 3e612d4cf8..950004d66c 100644 --- a/cpukit/score/Makefile.am +++ b/cpukit/score/Makefile.am @@ -324,6 +324,7 @@ libscore_a_SOURCES += src/coretod.c src/coretodset.c \ src/coretodtickle.c \ src/coretodtickspersec.c \ src/coretodadjust.c +libscore_a_SOURCES += src/coretodabsolutetimeout.c ## WATCHDOG_C_FILES libscore_a_SOURCES += src/watchdog.c src/watchdogadjust.c \ diff --git a/cpukit/score/include/rtems/score/todimpl.h b/cpukit/score/include/rtems/score/todimpl.h index 56c176d920..a94b140d92 100644 --- a/cpukit/score/include/rtems/score/todimpl.h +++ b/cpukit/score/include/rtems/score/todimpl.h @@ -21,6 +21,7 @@ #include <rtems/score/tod.h> #include <rtems/score/timestamp.h> #include <rtems/score/timecounterimpl.h> +#include <rtems/score/watchdog.h> #include <sys/time.h> #include <time.h> @@ -339,6 +340,44 @@ RTEMS_INLINE_ROUTINE bool _TOD_Is_set( void ) return _TOD.is_set; } +/** + * @brief Absolute timeout conversion results. + * + * This enumeration defines the possible results of converting + * an absolute time used for timeouts to POSIX blocking calls to + * a number of ticks for example. + */ +typedef enum { + /** The timeout is invalid. */ + TOD_ABSOLUTE_TIMEOUT_INVALID, + /** The timeout represents a time that is in the past. */ + TOD_ABSOLUTE_TIMEOUT_IS_IN_PAST, + /** The timeout represents a time that is equal to the current time. */ + TOD_ABSOLUTE_TIMEOUT_IS_NOW, + /** The timeout represents a time that is in the future. */ + TOD_ABSOLUTE_TIMEOUT_IS_IN_FUTURE, +} TOD_Absolute_timeout_conversion_results; + +/** + * @brief Convert absolute timeout to ticks. + * + * This method takes an absolute time being used as a timeout + * to a blocking directive, validates it and returns the number + * of corresponding clock ticks for use by the SuperCore. + * + * @param[in] abstime is a pointer to the timeout + * @param[out] ticks_out will contain the number of ticks + * + * @return This method returns the number of ticks in @a ticks_out + * and a status value indicating whether the absolute time + * is valid, in the past, equal to the current time or in + * the future as it should be. + */ +TOD_Absolute_timeout_conversion_results _TOD_Absolute_timeout_to_ticks( + const struct timespec *abstime, + Watchdog_Interval *ticks_out +); + /**@}*/ #ifdef __cplusplus diff --git a/cpukit/posix/src/posixtimespecabsolutetimeout.c b/cpukit/score/src/coretodabsolutetimeout.c index f3029861d1..6c9ffc22d5 100644 --- a/cpukit/posix/src/posixtimespecabsolutetimeout.c +++ b/cpukit/score/src/coretodabsolutetimeout.c @@ -2,7 +2,7 @@ * @file * * @brief Convert Absolute Timeout to Ticks - * @ingroup POSIX_TIMETYPES Time Types + * @ingroup ScoreTOD */ /* @@ -18,23 +18,12 @@ #include "config.h" #endif -#include <stdarg.h> - -#include <errno.h> -#include <fcntl.h> -#include <pthread.h> -#include <semaphore.h> -#include <limits.h> - -#include <rtems/posix/semaphoreimpl.h> -#include <rtems/posix/time.h> #include <rtems/score/todimpl.h> -#include <rtems/seterr.h> /* * The abstime is a walltime. We turn it into an interval. */ -POSIX_Absolute_timeout_conversion_results_t _POSIX_Absolute_timeout_to_ticks( +TOD_Absolute_timeout_conversion_results _TOD_Absolute_timeout_to_ticks( const struct timespec *abstime, Watchdog_Interval *ticks_out ) @@ -52,7 +41,7 @@ POSIX_Absolute_timeout_conversion_results_t _POSIX_Absolute_timeout_to_ticks( * Is the absolute time even valid? */ if ( !_Timespec_Is_valid(abstime) ) - return POSIX_ABSOLUTE_TIMEOUT_INVALID; + return TOD_ABSOLUTE_TIMEOUT_INVALID; /* * Is the absolute time in the past? @@ -60,7 +49,7 @@ POSIX_Absolute_timeout_conversion_results_t _POSIX_Absolute_timeout_to_ticks( _TOD_Get_as_timespec( ¤t_time ); if ( _Timespec_Less_than( abstime, ¤t_time ) ) - return POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST; + return TOD_ABSOLUTE_TIMEOUT_IS_IN_PAST; /* * How long until the requested absolute time? @@ -77,12 +66,12 @@ POSIX_Absolute_timeout_conversion_results_t _POSIX_Absolute_timeout_to_ticks( * we better wear shades. */ if ( !*ticks_out ) - return POSIX_ABSOLUTE_TIMEOUT_IS_NOW; + return TOD_ABSOLUTE_TIMEOUT_IS_NOW; /* * This is the case we were expecting and it took this long to * get here. */ - return POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE; + return TOD_ABSOLUTE_TIMEOUT_IS_IN_FUTURE; } |