summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/counter.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-11-30 13:57:04 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-03 09:45:37 +0100
commitb9ffb62467daaf4b8f99c05a8c7c84c2dcd3e37f (patch)
tree05e10da0295c2916a1358079c427eb95446a7916 /cpukit/include/rtems/counter.h
parent5 spelling errors for a Google Code-In task. (diff)
downloadrtems-b9ffb62467daaf4b8f99c05a8c7c84c2dcd3e37f.tar.bz2
Convert CPU counter ticks to/from sbintime_t
The sbintime_t is an efficient time format. Add the ability to convert CPU counter ticks to/from sbintime_t.
Diffstat (limited to 'cpukit/include/rtems/counter.h')
-rw-r--r--cpukit/include/rtems/counter.h36
1 files changed, 28 insertions, 8 deletions
diff --git a/cpukit/include/rtems/counter.h b/cpukit/include/rtems/counter.h
index e770c96eb0..f43b7f110f 100644
--- a/cpukit/include/rtems/counter.h
+++ b/cpukit/include/rtems/counter.h
@@ -72,9 +72,9 @@ static inline uint32_t rtems_counter_frequency( void )
}
/**
- * @brief Reads the current counter values.
+ * @brief Reads the current counter value.
*
- * @return The current counter values.
+ * @return The current counter value.
*/
static inline rtems_counter_ticks rtems_counter_read( void )
{
@@ -104,10 +104,10 @@ static inline rtems_counter_ticks rtems_counter_difference(
/**
* @brief Converts counter ticks into nanoseconds.
*
- * @param[in] ticks Some counter ticks.
+ * @param[in] ticks The counter ticks value to convert.
*
- * @return The nanoseconds corresponding to the counter ticks. The value is
- * rounded up.
+ * @return The nanoseconds value corresponding to the counter ticks. The value
+ * is rounded up.
*/
uint64_t rtems_counter_ticks_to_nanoseconds(
rtems_counter_ticks ticks
@@ -116,16 +116,36 @@ uint64_t rtems_counter_ticks_to_nanoseconds(
/**
* @brief Converts nanoseconds into counter ticks.
*
- * @param[in] nanoseconds Some nanoseconds.
+ * @param[in] nanoseconds The nanoseconds value to convert.
*
- * @return The counter ticks corresponding to the nanoseconds. The value is
- * rounded up.
+ * @return The counter ticks value corresponding to the nanoseconds value. The
+ * value is rounded up.
*/
rtems_counter_ticks rtems_counter_nanoseconds_to_ticks(
uint32_t nanoseconds
);
/**
+ * @brief Converts counter ticks into signed binary time (sbintime_t).
+ *
+ * @param[in] ticks The counter ticks value to convert.
+ *
+ * @return The signed binary time value corresponding to the counter ticks
+ * value. The value is rounded up.
+ */
+int64_t rtems_counter_ticks_to_sbintime( rtems_counter_ticks ticks );
+
+/**
+ * @brief Converts signed binary time (sbintime_t) into counter ticks.
+ *
+ * @param[in] sbt The signed binary time value to convert.
+ *
+ * @return The counter ticks value corresponding to the nanoseconds value. The
+ * value is rounded up.
+ */
+rtems_counter_ticks rtems_counter_sbintime_to_ticks( int64_t sbt );
+
+/**
* @brief Initializes the counter ticks to/from nanoseconds converter functions.
*
* This function must be used to initialize the