aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp_timer_internal.h
diff options
context:
space:
mode:
authorOla Liljedahl <ola.liljedahl@linaro.org>2015-04-24 16:10:35 +0200
committerMaxim Uvarov <maxim.uvarov@linaro.org>2015-07-20 14:04:00 +0300
commitf834609c554c933e6398252817baf59016074447 (patch)
tree4e00dee70ace0e1a363972fd2fb144d2381f1777 /platform/linux-generic/include/odp_timer_internal.h
parentc9fca2c405b58421b83e362f49d848a2a6c589f0 (diff)
linux-generic: timer: use plain buffers for timeouts
Use plain buffers for timeouts. Store the timeout header in the buffer data area. This simplifies re-use on other platforms where the event header cannot be arbitrarily defined. Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform/linux-generic/include/odp_timer_internal.h')
-rw-r--r--platform/linux-generic/include/odp_timer_internal.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/platform/linux-generic/include/odp_timer_internal.h b/platform/linux-generic/include/odp_timer_internal.h
index 90af62cc8..a631bd098 100644
--- a/platform/linux-generic/include/odp_timer_internal.h
+++ b/platform/linux-generic/include/odp_timer_internal.h
@@ -16,36 +16,45 @@
#include <odp/align.h>
#include <odp/debug.h>
+#include <odp_debug_internal.h>
#include <odp_buffer_internal.h>
#include <odp_pool_internal.h>
#include <odp/timer.h>
/**
* Internal Timeout header
+ * For compatibility with buffers, we use the buffer_hdr here and nothing else
*/
typedef struct {
/* common buffer header */
odp_buffer_hdr_t buf_hdr;
+} odp_timeout_fakehdr_t;
+/* The real timeout header is in a separate struct in a separate location */
+typedef struct {
/* Requested expiration time */
uint64_t expiration;
/* User ptr inherited from parent timer */
void *user_ptr;
+ /* Handle of buffer we are located in */
+ odp_buffer_t buf;
/* Parent timer */
odp_timer_t timer;
} odp_timeout_hdr_t;
typedef struct odp_timeout_hdr_stride {
- uint8_t pad[ODP_CACHE_LINE_SIZE_ROUNDUP(sizeof(odp_timeout_hdr_t))];
+ uint8_t pad[ODP_CACHE_LINE_SIZE_ROUNDUP(sizeof(odp_timeout_fakehdr_t))];
} odp_timeout_hdr_stride;
/**
* Return the timeout header
*/
-static inline odp_timeout_hdr_t *odp_timeout_hdr(odp_buffer_t buf)
+static inline odp_timeout_hdr_t *odp_timeout_hdr_from_buf(odp_buffer_t buf)
{
- return (odp_timeout_hdr_t *)odp_buf_to_hdr(buf);
+ /* The real timeout header is stored in the buffer data */
+ ODP_ASSERT(odp_buffer_size(buf) == sizeof(odp_timeout_hdr_t));
+ return (odp_timeout_hdr_t *)odp_buffer_addr(buf);
}
#endif