aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp/api/plat/queue_inlines.h
blob: c557b4ba35206b90db2dfd0f687567b1d281a5e5 (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
/* Copyright (c) 2018, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */

#ifndef ODP_PLAT_QUEUE_INLINES_H_
#define ODP_PLAT_QUEUE_INLINES_H_

#include <odp/api/plat/queue_inline_types.h>

/** @cond _ODP_HIDE_FROM_DOXYGEN_ */

extern _odp_queue_inline_offset_t _odp_queue_inline_offset;
extern const _odp_queue_api_fn_t *_odp_queue_api;

#ifndef _ODP_NO_INLINE
	/* Inline functions by default */
	#define _ODP_INLINE static inline
	#define odp_queue_context   __odp_queue_context
	#define odp_queue_enq       __odp_queue_enq
	#define odp_queue_enq_multi __odp_queue_enq_multi
	#define odp_queue_deq       __odp_queue_deq
	#define odp_queue_deq_multi __odp_queue_deq_multi
#else
	#define _ODP_INLINE
#endif

_ODP_INLINE void *odp_queue_context(odp_queue_t handle)
{
	void *context;
	void *qentry = (void *)handle;

	context = _odp_qentry_field(qentry, void *, context);

	return context;
}

_ODP_INLINE int odp_queue_enq(odp_queue_t queue, odp_event_t ev)
{
	return _odp_queue_api->queue_enq(queue, ev);
}

_ODP_INLINE int odp_queue_enq_multi(odp_queue_t queue,
				    const odp_event_t events[], int num)
{
	return _odp_queue_api->queue_enq_multi(queue, events, num);
}

_ODP_INLINE odp_event_t odp_queue_deq(odp_queue_t queue)
{
	return _odp_queue_api->queue_deq(queue);
}

_ODP_INLINE int odp_queue_deq_multi(odp_queue_t queue,
				    odp_event_t events[], int num)
{
	return _odp_queue_api->queue_deq_multi(queue, events, num);
}

/** @endcond */

#endif