diff mbox

[v2,2/2] linux-generic: timer: add missing odp_time*_to_u64() functions

Message ID 1462374164-29676-2-git-send-email-matias.elo@nokia.com
State Superseded
Headers show

Commit Message

Elo, Matias (Nokia - FI/Espoo) May 4, 2016, 3:02 p.m. UTC
Add missing odp_timer_pool_to_u64(), odp_timer_to_u64(), and
odp_timeout_to_u64() functions. Use the functions in timer
validation tests.

Signed-off-by: Matias Elo <matias.elo@nokia.com>
---
V2:
+ Use _odp_pri() helper (Maxim)
+ Use strong typing

 platform/linux-generic/odp_timer.c | 15 +++++++++++++++
 test/validation/timer/timer.c      |  3 +++
 2 files changed, 18 insertions(+)

Comments

Maxim Uvarov May 11, 2016, 4:12 p.m. UTC | #1
patch splitting is also wrong, patch 1 did not build w/o patch 2

Maxim

On 05/04/16 18:02, Matias Elo wrote:
> Add missing odp_timer_pool_to_u64(), odp_timer_to_u64(), and
> odp_timeout_to_u64() functions. Use the functions in timer
> validation tests.
>
> Signed-off-by: Matias Elo <matias.elo@nokia.com>
> ---
> V2:
> + Use _odp_pri() helper (Maxim)
> + Use strong typing
>
>   platform/linux-generic/odp_timer.c | 15 +++++++++++++++
>   test/validation/timer/timer.c      |  3 +++
>   2 files changed, 18 insertions(+)
>
> diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
> index 9e21f3a..6b84309 100644
> --- a/platform/linux-generic/odp_timer.c
> +++ b/platform/linux-generic/odp_timer.c
> @@ -829,6 +829,11 @@ int odp_timer_pool_info(odp_timer_pool_t tpid,
>   	return 0;
>   }
>   
> +uint64_t odp_timer_pool_to_u64(odp_timer_pool_t tpid)
> +{
> +	return _odp_pri(tpid);
> +}
> +
>   odp_timer_t odp_timer_alloc(odp_timer_pool_t tpid,
>   			    odp_queue_t queue,
>   			    void *user_ptr)
> @@ -902,6 +907,11 @@ int odp_timer_cancel(odp_timer_t hdl, odp_event_t *tmo_ev)
>   	}
>   }
>   
> +uint64_t odp_timer_to_u64(odp_timer_t hdl)
> +{
> +	return _odp_pri(hdl);
> +}
> +
>   odp_timeout_t odp_timeout_from_event(odp_event_t ev)
>   {
>   	/* This check not mandated by the API specification */
> @@ -915,6 +925,11 @@ odp_event_t odp_timeout_to_event(odp_timeout_t tmo)
>   	return (odp_event_t)tmo;
>   }
>   
> +uint64_t odp_timeout_to_u64(odp_timeout_t tmo)
> +{
> +	return _odp_pri(tmo);
> +}
> +
>   int odp_timeout_fresh(odp_timeout_t tmo)
>   {
>   	const odp_timeout_hdr_t *hdr = timeout_hdr(tmo);
> diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c
> index 1032adc..6b484cd 100644
> --- a/test/validation/timer/timer.c
> +++ b/test/validation/timer/timer.c
> @@ -168,6 +168,7 @@ void timer_test_odp_timer_cancel(void)
>   	tim = odp_timer_alloc(tp, queue, USER_PTR);
>   	if (tim == ODP_TIMER_INVALID)
>   		CU_FAIL_FATAL("Failed to allocate timer");
> +	LOG_DBG("Timer handle: %" PRIu64 "\n", odp_timer_to_u64(tim));
>   
>   	ev = odp_timeout_to_event(odp_timeout_alloc(pool));
>   	if (ev == ODP_EVENT_INVALID)
> @@ -189,6 +190,7 @@ void timer_test_odp_timer_cancel(void)
>   	tmo = odp_timeout_from_event(ev);
>   	if (tmo == ODP_TIMEOUT_INVALID)
>   		CU_FAIL_FATAL("Cancel did not return timeout");
> +	LOG_DBG("Timeout handle: %" PRIu64 "\n", odp_timeout_to_u64(tmo));
>   
>   	if (odp_timeout_timer(tmo) != tim)
>   		CU_FAIL("Cancel invalid tmo.timer");
> @@ -501,6 +503,7 @@ void timer_test_odp_timer_all(void)
>   	CU_ASSERT(tpinfo.param.max_tmo == MAX);
>   	CU_ASSERT(strcmp(tpinfo.name, NAME) == 0);
>   
> +	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,
>   		odp_timer_ns_to_tick(tp, 1000000ULL * RANGE_MS));
Elo, Matias (Nokia - FI/Espoo) May 12, 2016, 8:18 a.m. UTC | #2
Thanks, I'll fix this and the patch 1 right away.

-Matias

> -----Original Message-----

> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of EXT Maxim

> Uvarov

> Sent: Wednesday, May 11, 2016 7:12 PM

> To: lng-odp@lists.linaro.org

> Subject: Re: [lng-odp] [PATCH v2 2/2] linux-generic: timer: add missing

> odp_time*_to_u64() functions

> 

> patch splitting is also wrong, patch 1 did not build w/o patch 2

> 

> Maxim

> 

> On 05/04/16 18:02, Matias Elo wrote:

> > Add missing odp_timer_pool_to_u64(), odp_timer_to_u64(), and

> > odp_timeout_to_u64() functions. Use the functions in timer

> > validation tests.

> >

> > Signed-off-by: Matias Elo <matias.elo@nokia.com>

> > ---

> > V2:

> > + Use _odp_pri() helper (Maxim)

> > + Use strong typing

> >

> >   platform/linux-generic/odp_timer.c | 15 +++++++++++++++

> >   test/validation/timer/timer.c      |  3 +++

> >   2 files changed, 18 insertions(+)

> >

> > diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-

> generic/odp_timer.c

> > index 9e21f3a..6b84309 100644

> > --- a/platform/linux-generic/odp_timer.c

> > +++ b/platform/linux-generic/odp_timer.c

> > @@ -829,6 +829,11 @@ int odp_timer_pool_info(odp_timer_pool_t tpid,

> >   	return 0;

> >   }

> >

> > +uint64_t odp_timer_pool_to_u64(odp_timer_pool_t tpid)

> > +{

> > +	return _odp_pri(tpid);

> > +}

> > +

> >   odp_timer_t odp_timer_alloc(odp_timer_pool_t tpid,

> >   			    odp_queue_t queue,

> >   			    void *user_ptr)

> > @@ -902,6 +907,11 @@ int odp_timer_cancel(odp_timer_t hdl, odp_event_t

> *tmo_ev)

> >   	}

> >   }

> >

> > +uint64_t odp_timer_to_u64(odp_timer_t hdl)

> > +{

> > +	return _odp_pri(hdl);

> > +}

> > +

> >   odp_timeout_t odp_timeout_from_event(odp_event_t ev)

> >   {

> >   	/* This check not mandated by the API specification */

> > @@ -915,6 +925,11 @@ odp_event_t odp_timeout_to_event(odp_timeout_t

> tmo)

> >   	return (odp_event_t)tmo;

> >   }

> >

> > +uint64_t odp_timeout_to_u64(odp_timeout_t tmo)

> > +{

> > +	return _odp_pri(tmo);

> > +}

> > +

> >   int odp_timeout_fresh(odp_timeout_t tmo)

> >   {

> >   	const odp_timeout_hdr_t *hdr = timeout_hdr(tmo);

> > diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c

> > index 1032adc..6b484cd 100644

> > --- a/test/validation/timer/timer.c

> > +++ b/test/validation/timer/timer.c

> > @@ -168,6 +168,7 @@ void timer_test_odp_timer_cancel(void)

> >   	tim = odp_timer_alloc(tp, queue, USER_PTR);

> >   	if (tim == ODP_TIMER_INVALID)

> >   		CU_FAIL_FATAL("Failed to allocate timer");

> > +	LOG_DBG("Timer handle: %" PRIu64 "\n", odp_timer_to_u64(tim));

> >

> >   	ev = odp_timeout_to_event(odp_timeout_alloc(pool));

> >   	if (ev == ODP_EVENT_INVALID)

> > @@ -189,6 +190,7 @@ void timer_test_odp_timer_cancel(void)

> >   	tmo = odp_timeout_from_event(ev);

> >   	if (tmo == ODP_TIMEOUT_INVALID)

> >   		CU_FAIL_FATAL("Cancel did not return timeout");

> > +	LOG_DBG("Timeout handle: %" PRIu64 "\n",

> odp_timeout_to_u64(tmo));

> >

> >   	if (odp_timeout_timer(tmo) != tim)

> >   		CU_FAIL("Cancel invalid tmo.timer");

> > @@ -501,6 +503,7 @@ void timer_test_odp_timer_all(void)

> >   	CU_ASSERT(tpinfo.param.max_tmo == MAX);

> >   	CU_ASSERT(strcmp(tpinfo.name, NAME) == 0);

> >

> > +	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,

> >   		odp_timer_ns_to_tick(tp, 1000000ULL * RANGE_MS));

> 

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
index 9e21f3a..6b84309 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -829,6 +829,11 @@  int odp_timer_pool_info(odp_timer_pool_t tpid,
 	return 0;
 }
 
+uint64_t odp_timer_pool_to_u64(odp_timer_pool_t tpid)
+{
+	return _odp_pri(tpid);
+}
+
 odp_timer_t odp_timer_alloc(odp_timer_pool_t tpid,
 			    odp_queue_t queue,
 			    void *user_ptr)
@@ -902,6 +907,11 @@  int odp_timer_cancel(odp_timer_t hdl, odp_event_t *tmo_ev)
 	}
 }
 
+uint64_t odp_timer_to_u64(odp_timer_t hdl)
+{
+	return _odp_pri(hdl);
+}
+
 odp_timeout_t odp_timeout_from_event(odp_event_t ev)
 {
 	/* This check not mandated by the API specification */
@@ -915,6 +925,11 @@  odp_event_t odp_timeout_to_event(odp_timeout_t tmo)
 	return (odp_event_t)tmo;
 }
 
+uint64_t odp_timeout_to_u64(odp_timeout_t tmo)
+{
+	return _odp_pri(tmo);
+}
+
 int odp_timeout_fresh(odp_timeout_t tmo)
 {
 	const odp_timeout_hdr_t *hdr = timeout_hdr(tmo);
diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c
index 1032adc..6b484cd 100644
--- a/test/validation/timer/timer.c
+++ b/test/validation/timer/timer.c
@@ -168,6 +168,7 @@  void timer_test_odp_timer_cancel(void)
 	tim = odp_timer_alloc(tp, queue, USER_PTR);
 	if (tim == ODP_TIMER_INVALID)
 		CU_FAIL_FATAL("Failed to allocate timer");
+	LOG_DBG("Timer handle: %" PRIu64 "\n", odp_timer_to_u64(tim));
 
 	ev = odp_timeout_to_event(odp_timeout_alloc(pool));
 	if (ev == ODP_EVENT_INVALID)
@@ -189,6 +190,7 @@  void timer_test_odp_timer_cancel(void)
 	tmo = odp_timeout_from_event(ev);
 	if (tmo == ODP_TIMEOUT_INVALID)
 		CU_FAIL_FATAL("Cancel did not return timeout");
+	LOG_DBG("Timeout handle: %" PRIu64 "\n", odp_timeout_to_u64(tmo));
 
 	if (odp_timeout_timer(tmo) != tim)
 		CU_FAIL("Cancel invalid tmo.timer");
@@ -501,6 +503,7 @@  void timer_test_odp_timer_all(void)
 	CU_ASSERT(tpinfo.param.max_tmo == MAX);
 	CU_ASSERT(strcmp(tpinfo.name, NAME) == 0);
 
+	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,
 		odp_timer_ns_to_tick(tp, 1000000ULL * RANGE_MS));