Message ID | 1486521424-11172-2-git-send-email-kevin.wang@linaro.org |
---|---|
State | New |
Headers | show |
Series | a new API to support timer capability | expand |
For this patch series: Reviewed-and-tested-by: Yi He <yi.he@linaro.org> On 8 February 2017 at 10:37, 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 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(+) > > 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 > >
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.
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