On 3 February 2015 at 18:04, Bill Fischofer <bill.fischo...@linaro.org> wrote: > We should consider making these strong types to be consistent with the rest > of the ODP types. In linux-generic to do that you'd just change the current > uint32_t typedefs to: I agree. I'll post a patch as soon as the strong typing patches have been merged. You could consider it a bug that the timer types are not included there/
> > typedef odp_handle_t odp_timer_t; > typedef odp_handle_t odp_timeout_t; > > If there is a need to display odp_timer_t and odp_timeout_t handles then the > odp_timer_to_u64() and odp_timeout_to_u64() conversion functions should be > added. I would recommend deferring those APIs until ODP v1.1 as it's not > used and the need is not urgent. Making these strong will probably require > a bit of tweaking in the implementation to make use of _odp_typeval() as > needed. See the other types as models. > > Note that odp_timer_pool_t is already strongly typed with the above > definition and needs no change, but it too should have an > odp_timer_pool_to_u64() converter function for completeness. > > Bill > > On Mon, Feb 2, 2015 at 12:52 PM, Ola Liljedahl <ola.liljed...@linaro.org> > wrote: >> >> Move the platform specific definitions for timer pool, timer and timeout >> to >> the platform's include/odp/plat/timer_types.h file. >> >> Signed-off-by: Ola Liljedahl <ola.liljed...@linaro.org> >> --- >> (This document/code contribution attached is provided under the terms of >> agreement LES-LTM-21309) >> >> include/odp/api/timer.h | 32 +++++++-------- >> .../linux-generic/include/odp/plat/timer_types.h | 48 >> ++++++++++++++++++++++ >> platform/linux-generic/include/odp/timer.h | 1 + >> 3 files changed, 64 insertions(+), 17 deletions(-) >> create mode 100644 platform/linux-generic/include/odp/plat/timer_types.h >> >> diff --git a/include/odp/api/timer.h b/include/odp/api/timer.h >> index 1b813da..b5435c3 100644 >> --- a/include/odp/api/timer.h >> +++ b/include/odp/api/timer.h >> @@ -22,17 +22,15 @@ extern "C" { >> * @{ >> */ >> >> -struct odp_timer_pool_s; /**< Forward declaration */ >> - >> /** >> -* ODP timer pool handle (platform dependent) >> -*/ >> -typedef struct odp_timer_pool_s *odp_timer_pool_t; >> + * @typedef odp_timer_pool_t >> + * ODP timer pool handle >> + */ >> >> /** >> - * Invalid timer pool handle (platform dependent). >> + * @def ODP_TIMER_POOL_INVALID >> + * Invalid timer pool handle >> */ >> -#define ODP_TIMER_POOL_INVALID NULL >> >> /** >> * Clock sources for timers in timer pool. >> @@ -46,24 +44,24 @@ typedef enum { >> } odp_timer_clk_src_t; >> >> /** >> -* ODP timer handle (platform dependent). >> -*/ >> -typedef uint32_t odp_timer_t; >> + * @typedef odp_timer_t >> + * ODP timer handle >> + */ >> >> /** >> -* ODP timeout handle (platform dependent). >> -*/ >> -typedef void *odp_timeout_t; >> + * @def ODP_TIMER_INVALID >> + * Invalid timer handle >> + */ >> >> /** >> - * Invalid timer handle (platform dependent). >> + * @typedef odp_timeout_t >> + * ODP timeout handle >> */ >> -#define ODP_TIMER_INVALID ((uint32_t)~0U) >> >> /** >> - * Invalid timeout handle (platform dependent). >> + * @def ODP_TIMEOUT_INVALID >> + * Invalid timeout handle >> */ >> -#define ODP_TIMEOUT_INVALID NULL >> >> /** >> * Return values of timer set calls. >> diff --git a/platform/linux-generic/include/odp/plat/timer_types.h >> b/platform/linux-generic/include/odp/plat/timer_types.h >> new file mode 100644 >> index 0000000..c21a667 >> --- /dev/null >> +++ b/platform/linux-generic/include/odp/plat/timer_types.h >> @@ -0,0 +1,48 @@ >> +/* Copyright (c) 2013, Linaro Limited >> + * All rights reserved. >> + * >> + * SPDX-License-Identifier: BSD-3-Clause >> + */ >> + >> + >> +/** >> + * @file >> + * >> + * ODP timer service >> + */ >> + >> +#ifndef ODP_TIMER_TYPES_H_ >> +#define ODP_TIMER_TYPES_H_ >> + >> +#ifdef __cplusplus >> +extern "C" { >> +#endif >> + >> +/** @addtogroup odp_packet ODP TIMER >> + * Operations on a timer. >> + * @{ >> + **/ >> + >> +struct odp_timer_pool_s; /**< Forward declaration */ >> + >> +typedef struct odp_timer_pool_s *odp_timer_pool_t; >> + >> +#define ODP_TIMER_POOL_INVALID NULL >> + >> +typedef uint32_t odp_timer_t; >> + >> +#define ODP_TIMER_INVALID ((uint32_t)~0U) >> + >> +typedef void *odp_timeout_t; >> + >> +#define ODP_TIMEOUT_INVALID NULL >> + >> +/** >> + * @} >> + */ >> + >> +#ifdef __cplusplus >> +} >> +#endif >> + >> +#endif >> diff --git a/platform/linux-generic/include/odp/timer.h >> b/platform/linux-generic/include/odp/timer.h >> index df071f2..eb9a3a2 100644 >> --- a/platform/linux-generic/include/odp/timer.h >> +++ b/platform/linux-generic/include/odp/timer.h >> @@ -22,6 +22,7 @@ extern "C" { >> #include <odp/plat/buffer_types.h> >> #include <odp/plat/pool_types.h> >> #include <odp/plat/queue_types.h> >> +#include <odp/plat/timer_types.h> >> >> /** @ingroup odp_timer >> * @{ >> -- >> 1.9.1 >> >> >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org >> http://lists.linaro.org/mailman/listinfo/lng-odp > > _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp