diff mbox series

[API-NEXT,PATCHv3,1/4] api: timer: add odp_timer_capability() api

Message ID 1486458181-31808-1-git-send-email-kevin.wang@linaro.org
State Superseded
Headers show
Series [API-NEXT,PATCHv3,1/4] api: timer: add odp_timer_capability() api | expand

Commit Message

Kevin Wang Feb. 7, 2017, 9:03 a.m. UTC
Currently, user needs to decide the timer resolution before creating
a timer pool. But sometimes it will cause timer overrun as the system
can't support such high resolution.
So a new API is required to expose the timer capability to the user.

Signed-off-by: Kevin Wang <kevin.wang@linaro.org>

---
 include/odp/api/spec/timer.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

-- 
1.9.1
diff mbox series

Patch

diff --git a/include/odp/api/spec/timer.h b/include/odp/api/spec/timer.h
index 75f9db9..e8d85b7 100644
--- a/include/odp/api/spec/timer.h
+++ b/include/odp/api/spec/timer.h
@@ -108,6 +108,27 @@  typedef struct {
 } odp_timer_pool_param_t;
 
 /**
+ * Timer capability
+ */
+typedef struct {
+	uint64_t res_ns; /**< Timeout resolution in nanoseconds */
+} odp_timer_capability_t;
+
+/**
+ * Query Timer interface capabilities
+ *
+ * Outputs Timer interface capabilities on success.
+ *
+ * @param clk_src Clock source for timers
+ * @param[out] capa   Pointer to capability structure for output
+ *
+ * @retval 0 on success
+ * @retval <0 on failure
+ */
+int odp_timer_capability(odp_timer_clk_src_t clk_src,
+			 odp_timer_capability_t *capa);
+
+/**
  * Create a timer pool
  *
  * The use of pool name is optional. Unique names are not required.