aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp_timer_internal.h
blob: 2ff36ce0d9402d6d44041e4e0aa9ae187ac604a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* 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 buf_data[];
} odp_timeout_hdr_t;

typedef struct odp_timeout_hdr_stride {
	uint8_t pad[ODP_CACHE_LINE_SIZE_ROUNDUP(sizeof(odp_timeout_hdr_t))];
} odp_timeout_hdr_stride;


/**
 * Return timeout header
 */
static inline odp_timeout_hdr_t *odp_timeout_hdr(odp_timeout_t tmo)
{
	odp_buffer_hdr_t *buf_hdr = odp_buf_to_hdr((odp_buffer_t)tmo);
	return (odp_timeout_hdr_t *)(uintptr_t)buf_hdr;
}



#ifdef __cplusplus
}
#endif

#endif