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 <[email protected]>
---
 include/odp/api/spec/timer.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

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.
-- 
1.9.1

Reply via email to