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

/**
 * @file
 *
 * ODP synchronisation inlines
 */

#ifndef ODP_PLAT_SYNC_INLINE_H_
#define ODP_PLAT_SYNC_INLINE_H_

#ifdef __cplusplus
extern "C" {
#endif

/** @cond _ODP_HIDE_FROM_DOXYGEN_ */

#ifndef _ODP_NO_INLINE
	/* Inline functions by default */
	#define _ODP_INLINE static inline
	#define odp_mb_release __odp_mb_release
	#define odp_mb_acquire __odp_mb_acquire
	#define odp_mb_full __odp_mb_full
#else
	#define _ODP_INLINE
#endif

_ODP_INLINE void odp_mb_release(void)
{
	__atomic_thread_fence(__ATOMIC_RELEASE);
}

_ODP_INLINE void odp_mb_acquire(void)
{
	__atomic_thread_fence(__ATOMIC_ACQUIRE);
}

_ODP_INLINE void odp_mb_full(void)
{
	__atomic_thread_fence(__ATOMIC_SEQ_CST);
}

/** @endcond */

#ifdef __cplusplus
}
#endif

#endif