2019-06-02 03:14:06 +08:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
2018-04-04 23:37:43 +08:00
|
|
|
*
|
2019-06-02 03:14:06 +08:00
|
|
|
* Copyright(c) 2018 Intel Corporation. All rights reserved.
|
2018-04-04 23:37:43 +08:00
|
|
|
*
|
|
|
|
* Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
|
|
|
|
*/
|
|
|
|
|
2019-07-10 20:23:41 +08:00
|
|
|
#ifndef __SOF_ATOMIC_H__
|
|
|
|
#define __SOF_ATOMIC_H__
|
2018-04-04 23:37:43 +08:00
|
|
|
|
|
|
|
#include <arch/atomic.h>
|
2019-07-15 17:27:29 +08:00
|
|
|
#include <stdint.h>
|
2018-04-04 23:37:43 +08:00
|
|
|
|
|
|
|
static inline void atomic_init(atomic_t *a, int32_t value)
|
|
|
|
{
|
|
|
|
arch_atomic_init(a, value);
|
|
|
|
}
|
|
|
|
|
2018-06-04 19:03:43 +08:00
|
|
|
static inline int32_t atomic_read(const atomic_t *a)
|
|
|
|
{
|
|
|
|
return arch_atomic_read(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void atomic_set(atomic_t *a, int32_t value)
|
|
|
|
{
|
|
|
|
arch_atomic_set(a, value);
|
|
|
|
}
|
|
|
|
|
2018-09-05 15:47:56 +08:00
|
|
|
static inline int32_t atomic_add(atomic_t *a, int32_t value)
|
2018-04-04 23:37:43 +08:00
|
|
|
{
|
2018-09-05 15:47:56 +08:00
|
|
|
return arch_atomic_add(a, value);
|
2018-04-04 23:37:43 +08:00
|
|
|
}
|
|
|
|
|
2018-09-05 15:47:56 +08:00
|
|
|
static inline int32_t atomic_sub(atomic_t *a, int32_t value)
|
2018-04-04 23:37:43 +08:00
|
|
|
{
|
2018-09-05 15:47:56 +08:00
|
|
|
return arch_atomic_sub(a, value);
|
2018-04-04 23:37:43 +08:00
|
|
|
}
|
|
|
|
|
2019-07-10 20:23:41 +08:00
|
|
|
#endif /* __SOF_ATOMIC_H__ */
|