blob: c51f4355e5345ea85d549c27825cd9b680de7e7a (
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
|
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2024 Nokia
*/
#ifndef ODP_DEFAULT_WAIT_UNTIL_H_
#define ODP_DEFAULT_WAIT_UNTIL_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <odp/api/plat/cpu_inlines.h>
#include <stdint.h>
/**
* The _odp_wait_until_eq_*() functions defined in this header are intended to
* be used only with the scalable scheduler and queue implementations. Even
* though these functions use standard non-atomic parameter types, the
* parameters must only be operated using atomic operations. If new functions
* are added to this file, they should use _odp_wait_until_equal_*() prefix and
* atomic parameter types.
*/
static inline void _odp_wait_until_eq_u32(uint32_t *val, uint32_t expected)
{
while (__atomic_load_n(val, __ATOMIC_RELAXED) != expected)
odp_cpu_pause();
}
static inline void _odp_wait_until_eq_bitset(bitset_t *val, bitset_t expected)
{
while (__atomic_load_n(val, __ATOMIC_RELAXED) != expected)
odp_cpu_pause();
}
static inline void _odp_wait_until_eq_acq_u8(uint8_t *val, uint8_t expected)
{
while (__atomic_load_n(val, __ATOMIC_ACQUIRE) != expected)
odp_cpu_pause();
}
static inline void _odp_wait_until_eq_acq_u32(uint32_t *val, uint32_t expected)
{
while (__atomic_load_n(val, __ATOMIC_ACQUIRE) != expected)
odp_cpu_pause();
}
#ifdef __cplusplus
}
#endif
#endif
|