summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2013-12-24 16:38:42 +1100
committerChris Johns <chrisj@rtems.org>2013-12-24 16:46:19 +1100
commit2d1bdc8f797db5ab6e3ba6945befaf73d9062798 (patch)
treee8a3eecc64c589a9d0495790e09092dc572f36cf /cpukit/score/include/rtems
parentmips/shared: added new doxygen (diff)
downloadrtems-2d1bdc8f797db5ab6e3ba6945befaf73d9062798.tar.bz2
cpukit/rtems: Add rtems_clock_get_uptime_nanoseconds to the RTEMS API.
Add Timestamp support in the score to return a timestamp in nanoseconds. Add a test. Update the RTEMS API documentation.
Diffstat (limited to 'cpukit/score/include/rtems')
-rw-r--r--cpukit/score/include/rtems/score/timespec.h15
-rw-r--r--cpukit/score/include/rtems/score/timestamp.h17
-rw-r--r--cpukit/score/include/rtems/score/timestamp64.h20
3 files changed, 52 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/timespec.h b/cpukit/score/include/rtems/score/timespec.h
index e72ccb2b72..8dd1853511 100644
--- a/cpukit/score/include/rtems/score/timespec.h
+++ b/cpukit/score/include/rtems/score/timespec.h
@@ -89,6 +89,21 @@ extern "C" {
((_time)->tv_nsec)
/**
+ * @brief Get the timestamp as nanoseconds.
+ *
+ * This method returns the timestamp as nanoseconds.
+ *
+ * @param[in] time points to the timestamp.
+ * @param[in] nanoseconds the nanoseconds since the last tick.
+ *
+ * @retval The time in nanoseconds.
+ */
+uint64_t _Timespec_Get_As_nanoseconds(
+ const struct timespec *time,
+ const uint32_t nanoseconds
+);
+
+/**
* @brief Check if timespec is valid.
*
* This method determines the validity of a timespec.
diff --git a/cpukit/score/include/rtems/score/timestamp.h b/cpukit/score/include/rtems/score/timestamp.h
index 638ae7bf52..b920e69d47 100644
--- a/cpukit/score/include/rtems/score/timestamp.h
+++ b/cpukit/score/include/rtems/score/timestamp.h
@@ -330,6 +330,23 @@ extern "C" {
#endif
/**
+ * @brief Get the timestamp as nanoseconds.
+ *
+ * This method returns the timestamp as nanoseconds.
+ *
+ * @param[in] _time points to the timestamp
+ *
+ * @retval The time in nanoseconds.
+ */
+#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE
+ #define _Timestamp_Get_As_nanoseconds( _timestamp, _nanoseconds ) \
+ _Timespec_Get_As_nanoseconds( _timestamp, _nanoseconds )
+#else
+ #define _Timestamp_Get_As_nanoseconds( _timestamp, _nanoseconds ) \
+ _Timestamp64_Get_As_nanoseconds( _timestamp, _nanoseconds )
+#endif
+
+/**
* @brief Convert timestamp to struct timespec.
*
* This method returns the seconds portion of the specified @a _timestamp.
diff --git a/cpukit/score/include/rtems/score/timestamp64.h b/cpukit/score/include/rtems/score/timestamp64.h
index 306ee35fee..bd37ec23e4 100644
--- a/cpukit/score/include/rtems/score/timestamp64.h
+++ b/cpukit/score/include/rtems/score/timestamp64.h
@@ -367,6 +367,26 @@ static inline uint32_t _Timestamp64_implementation_Get_nanoseconds(
);
#endif
+static inline uint64_t _Timestamp64_implementation_Get_As_nanoseconds(
+ const Timestamp64_Control *_time,
+ const uint32_t nanoseconds
+)
+{
+ return *_time + (uint64_t) nanoseconds;
+}
+
+/**
+ * @brief Get the 64-bit timestamp as nanoseconds.
+ *
+ * This method returns the 64-bit timestamp as it is already in nanoseconds.
+ *
+ * @param[in] _time points to the timestamp
+ *
+ * @retval The nanoseconds portion of @a _time.
+ */
+#define _Timestamp64_Get_As_nanoseconds( _time, _nanoseconds ) \
+ _Timestamp64_implementation_Get_As_nanoseconds( _time, _nanoseconds )
+
static inline void _Timestamp64_implementation_To_timespec(
const Timestamp64_Control *_timestamp,
struct timespec *_timespec