diff mbox series

[1/2] api: New API to support timer capacity

Message ID 1484811733-22802-1-git-send-email-kevin.wang@linaro.org
State New
Headers show
Series [1/2] api: New API to support timer capacity | expand

Commit Message

Kevin Wang Jan. 19, 2017, 7:42 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 capacity to the user.
---
 include/odp/api/spec/timer.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

-- 
1.9.1

Comments

Bill Fischofer Jan. 20, 2017, 1:04 a.m. UTC | #1
This looks good, however it should be against api-next. Use git
format-patch origin/api-next --subject-prefix="API-NEXT PATCH"

Also, part 2 should not have the same commit short log. Part 1 is
fine, though by convention ODP uses all lower case in short logs so it
should be "api: timer: add odp_timer_capability() api" or some such,
while part 2 should be "linux-generic: timer: implement
odp_timer_capability()"

I'd break out the validation/examples into a part 3 for ease of
review. User guide documentation updates would then be in a Part 4,
but since we don't have a lot to say about timers (yet) that may be a
separate patch.

On Thu, Jan 19, 2017 at 1:42 AM, Kevin Wang <kevin.wang@linaro.org> wrote:
> 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 capacity to the user.

> ---

>  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..78d9119 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

>
diff mbox series

Patch

diff --git a/include/odp/api/spec/timer.h b/include/odp/api/spec/timer.h
index 75f9db9..78d9119 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.