diff options
author | Petri Savolainen <petri.savolainen@linaro.org> | 2014-06-24 17:05:46 +0300 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2014-06-26 21:41:29 +0400 |
commit | 9b8a4bbc3b230857a0d782fa25acf74f6b4e967d (patch) | |
tree | f7529e4edcca143f2e2e45ae42fa69349bb6b5ac /platform/linux-generic/include/odp_timer_internal.h | |
parent | 335cc6f1163a772077739f18c4ba8d85d7fbfc4c (diff) |
Added timeout buffer type
Added 'timeout' and 'any' buffer types. Timer and buffer pool
modifications to use those.
Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Diffstat (limited to 'platform/linux-generic/include/odp_timer_internal.h')
-rw-r--r-- | platform/linux-generic/include/odp_timer_internal.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/platform/linux-generic/include/odp_timer_internal.h b/platform/linux-generic/include/odp_timer_internal.h new file mode 100644 index 000000000..f99a10e3f --- /dev/null +++ b/platform/linux-generic/include/odp_timer_internal.h @@ -0,0 +1,78 @@ +/* Copyright (c) 2013, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * ODP timer timeout descriptor - implementation internal + */ + +#ifndef ODP_TIMER_INTERNAL_H_ +#define ODP_TIMER_INTERNAL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <odp_std_types.h> +#include <odp_queue.h> +#include <odp_buffer.h> +#include <odp_buffer_internal.h> +#include <odp_buffer_pool_internal.h> +#include <odp_timer.h> + +struct timeout_t; + +typedef struct timeout_t { + struct timeout_t *next; + int timer_id; + int tick; + uint64_t tmo_tick; + odp_queue_t queue; + odp_buffer_t buf; + odp_buffer_t tmo_buf; +} timeout_t; + + +struct odp_timeout_hdr_t; + +/** + * Timeout notification header + */ +typedef struct odp_timeout_hdr_t { + odp_buffer_hdr_t buf_hdr; + + timeout_t meta; + + uint8_t payload[]; +} odp_timeout_hdr_t; + + + +ODP_ASSERT(sizeof(odp_timeout_hdr_t) == + ODP_OFFSETOF(odp_timeout_hdr_t, payload), + ODP_TIMEOUT_HDR_T__SIZE_ERR); + +ODP_ASSERT(sizeof(odp_timeout_hdr_t) % sizeof(uint64_t) == 0, + ODP_TIMEOUT_HDR_T__SIZE_ERR2); + + +/** + * Return timeout header + */ +static inline odp_timeout_hdr_t *odp_timeout_hdr(odp_timeout_t tmo) +{ + return (odp_timeout_hdr_t *)odp_buf_to_hdr((odp_buffer_t)tmo); +} + + + +#ifdef __cplusplus +} +#endif + +#endif |