Menu Toggle
v2.0.0
stdatomic.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2024 Raspberry Pi (Trading) Ltd.
3
* Copyright (c) 2024 Stephen Street (
[email protected]
).
4
*
5
* SPDX-License-Identifier: BSD-3-Clause
6
*/
7
8
#ifndef __STDATOMIC_H
9
#define __STDATOMIC_H
10
11
#ifdef __cplusplus
12
extern
"C"
{
13
#endif
14
29
#include <stdint.h>
30
#include_next <stdatomic.h>
31
32
// needed for PICO_C_COMPILER_IS_GNU
33
#include "
pico.h
"
34
35
#if PICO_RP2040 && PICO_C_COMPILER_IS_GNU
36
// on GNU without exclusive instructions these don't get routed thru _1 functions for some reason
37
#undef atomic_flag_test_and_set
38
#undef atomic_flag_test_and_set_explicit
39
40
extern
_Bool __atomic_test_and_set_c(
volatile
void
*mem,
int
model);
41
42
#define atomic_flag_test_and_set(PTR) __atomic_test_and_set_c((PTR), __ATOMIC_SEQ_CST)
43
#define atomic_flag_test_and_set_explicit(PTR, MO) __atomic_test_and_set_c((PTR), (MO))
44
#endif
45
46
#ifdef __cplusplus
47
}
48
#endif
49
#endif
pico.h