diff options
author | Petri Savolainen <petri.savolainen@linaro.org> | 2015-01-26 15:05:50 +0200 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-01-27 15:34:30 +0300 |
commit | f046809340d8a47bb34ef86217842660c88cfd20 (patch) | |
tree | 940f85dee7a6a0a13df621f1c53246665593b5f6 /platform/linux-generic/include/api | |
parent | 3ef9ca82849803b0cbf643ada2dd0f1f2afad1b9 (diff) |
api: timer: Added timeout alloc and free
* Timeout is an event that has a dedicated pool type. Added
timeout_alloc, _free and _to_event functions to avoid
timeout <-> buffer conversions (which must not be done
anymore).
* Added timeout pool parameters (num). Pool was modified minimally
(re-uses still buf.xxx params).
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform/linux-generic/include/api')
-rw-r--r-- | platform/linux-generic/include/api/odp_pool.h | 5 | ||||
-rw-r--r-- | platform/linux-generic/include/api/odp_timer.h | 35 |
2 files changed, 39 insertions, 1 deletions
diff --git a/platform/linux-generic/include/api/odp_pool.h b/platform/linux-generic/include/api/odp_pool.h index 8a39fb3ee..174bb062e 100644 --- a/platform/linux-generic/include/api/odp_pool.h +++ b/platform/linux-generic/include/api/odp_pool.h @@ -57,9 +57,12 @@ typedef struct odp_pool_param_t { uint32_t seg_align; uint32_t num; } pkt; +*/ struct { + uint32_t __res1; /* Keep struct identical to buf, */ + uint32_t __res2; /* until pool implementation is fixed*/ + uint32_t num; /**< Number of timeouts in the pool */ } tmo; -*/ }; int type; /**< Pool type */ diff --git a/platform/linux-generic/include/api/odp_timer.h b/platform/linux-generic/include/api/odp_timer.h index 075263a93..b90473849 100644 --- a/platform/linux-generic/include/api/odp_timer.h +++ b/platform/linux-generic/include/api/odp_timer.h @@ -66,6 +66,11 @@ typedef void *odp_timeout_t; #define ODP_TIMER_INVALID ((uint32_t)~0U) /** + * Invalid timeout handle (platform dependent). + */ +#define ODP_TIMEOUT_INVALID NULL + +/** * Return values of timer set calls. */ typedef enum { @@ -310,6 +315,15 @@ int odp_timer_cancel(odp_timer_t tim, odp_event_t *tmo_ev); odp_timeout_t odp_timeout_from_event(odp_event_t ev); /** + * Convert timeout handle to event handle + * + * @param tmo Timeout handle + * + * @return Event handle + */ +odp_event_t odp_timeout_to_event(odp_timeout_t tmo); + +/** * Check for fresh timeout * If the corresponding timer has been reset or cancelled since this timeout * was enqueued, the timeout is stale (not fresh). @@ -358,6 +372,27 @@ uint64_t odp_timeout_tick(odp_timeout_t tmo); void *odp_timeout_user_ptr(odp_timeout_t tmo); /** + * Timeout alloc + * + * Allocates timeout from pool. Pool must be created with ODP_POOL_TIMEOUT type. + * + * @param pool Pool handle + * + * @return Timeout handle + * @retval ODP_TIMEOUT_INVALID Timeout could not be allocated + */ +odp_timeout_t odp_timeout_alloc(odp_pool_t pool); + +/** + * Timeout free + * + * Frees the timeout back to the pool it was allocated from. + * + * @param tmo Timeout handle + */ +void odp_timeout_free(odp_timeout_t tmo); + +/** * @} */ |