diff mbox

[RFC,API-NEXT,PATCHv2,1/4] api: timer: add odp_timer_pool_resolution()

Message ID 1480633409-24532-1-git-send-email-brian.brooks@linaro.org
State New
Headers show

Commit Message

Brian Brooks Dec. 1, 2016, 11:03 p.m. UTC
Signed-off-by: Brian Brooks <brian.brooks@linaro.org>

---
 include/odp/api/spec/timer.h                  | 9 +++++++++
 platform/linux-generic/odp_timer.c            | 5 +++++
 test/common_plat/validation/api/timer/timer.c | 2 ++
 3 files changed, 16 insertions(+)

-- 
2.7.4
diff mbox

Patch

diff --git a/include/odp/api/spec/timer.h b/include/odp/api/spec/timer.h
index 3f8fdd4..2e59ace 100644
--- a/include/odp/api/spec/timer.h
+++ b/include/odp/api/spec/timer.h
@@ -191,6 +191,15 @@  int odp_timer_pool_info(odp_timer_pool_t tpid,
 			odp_timer_pool_info_t *info);
 
 /**
+ * Get resolution from timer pool
+ *
+ * @param tpid Timer pool identifier
+ *
+ * @return Timeout resolution in nanoseconds
+ */
+uint64_t odp_timer_pool_resolution(odp_timer_pool_t tpid);
+
+/**
  * Allocate a timer
  *
  * Create a timer (allocating all necessary resources e.g. timeout event) from
diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
index ee4c4c0..2c14c93 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -837,6 +837,11 @@  int odp_timer_pool_info(odp_timer_pool_t tpid,
 	return 0;
 }
 
+uint64_t odp_timer_pool_resolution(odp_timer_pool_t tpid)
+{
+	return tpid->param.res_ns;
+}
+
 uint64_t odp_timer_pool_to_u64(odp_timer_pool_t tpid)
 {
 	return _odp_pri(tpid);
diff --git a/test/common_plat/validation/api/timer/timer.c b/test/common_plat/validation/api/timer/timer.c
index 0007639..0d0514a 100644
--- a/test/common_plat/validation/api/timer/timer.c
+++ b/test/common_plat/validation/api/timer/timer.c
@@ -529,6 +529,8 @@  void timer_test_odp_timer_all(void)
 	CU_ASSERT(tpinfo.param.max_tmo == MAX);
 	CU_ASSERT(strcmp(tpinfo.name, NAME) == 0);
 
+	CU_ASSERT(odp_timer_pool_resolution(tp) == RES);
+
 	LOG_DBG("Timer pool handle: %" PRIu64 "\n", odp_timer_pool_to_u64(tp));
 	LOG_DBG("#timers..: %u\n", NTIMERS);
 	LOG_DBG("Tmo range: %u ms (%" PRIu64 " ticks)\n", RANGE_MS,