ardix/arch/at91sam3x8e/atomic.c

35 lines
802 B
C
Raw Normal View History

/* See the end of this file for copyright, license, and warranty information. */
2020-11-29 20:23:27 +01:00
#include <ardix/atomic.h>
2020-12-08 12:55:23 +01:00
#include <ardix/atom.h>
2020-12-08 12:55:23 +01:00
static ATOM_DEFINE(atomic_context);
2020-11-30 02:26:17 +01:00
void atomic_enter(void)
{
2020-12-08 12:55:23 +01:00
atom_get(&atomic_context);
}
2020-11-29 20:23:27 +01:00
void atomic_leave(void)
2020-11-29 20:23:27 +01:00
{
2020-12-08 12:55:23 +01:00
atom_put(&atomic_context);
2020-11-29 20:23:27 +01:00
}
int is_atomic_context(void)
2020-11-29 20:23:27 +01:00
{
2020-12-08 12:55:23 +01:00
return atom_count(&atomic_context);
2020-11-29 20:23:27 +01:00
}
/*
* This file is part of Ardix.
* Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>.
2020-11-29 20:23:27 +01:00
*
* Ardix is non-violent software: you may only use, redistribute,
* and/or modify it under the terms of the CNPLv6+ as found in
* the LICENSE file in the source code root directory or at
* <https://git.pixie.town/thufie/CNPL>.
2020-11-29 20:23:27 +01:00
*
* Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
* permitted by applicable law. See the CNPLv6+ for details.
2020-11-29 20:23:27 +01:00
*/