blob: 73a3d476ab2d4be018a04ee14bca0b5fb6963330 (
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
|
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2023 ARM Limited
*/
#ifndef ODP_API_ABI_WAIT_UNTIL_H_
#define ODP_API_ABI_WAIT_UNTIL_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <odp/autoheader_external.h>
#ifdef _ODP_WFE_LOCKS
#include <stdint.h>
#include <odp/api/atomic.h>
static inline void
_odp_wait_until_equal_acq_u32(odp_atomic_u32_t *addr, uint32_t expected)
{
uint32_t value;
uint32_t *var = &addr->v;
__asm__ volatile("sevl" : : : "memory");
do {
__asm__ volatile("wfe" : : : "memory");
__asm__ volatile("ldaxr %w0, [%1]"
: "=&r" (value)
: "r" (var)
: "memory");
} while (expected != value);
}
#else /* !_ODP_WFE_LOCKS*/
/* Use generic implementation */
#include <odp/api/abi/wait_until_generic.h>
#endif
#ifdef __cplusplus
}
#endif
#endif
|