blob: 249b5d0bd9e9875d0448f495fc859be70bd22b2b (
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
|
/* Copyright 2020 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef __CROS_EC_ATOMIC_H
#define __CROS_EC_ATOMIC_H
#include <sys/atomic.h>
/*
* Below EC APIs are being deprecated and replaced with the Zephyr
* APIs. We already get the Zephyr APIs from sys/atomic.h. The
* definitions here are provided so we can shim-in modules using the
* deprecated APIs while the transition is under way.
*/
static inline void deprecated_atomic_clear(uint32_t volatile *addr,
uint32_t bits)
{
atomic_and((atomic_t *)addr, bits);
}
static inline void deprecated_atomic_or(uint32_t volatile *addr, uint32_t bits)
{
atomic_or((atomic_t *)addr, bits);
}
static inline void deprecated_atomic_add(uint32_t volatile *addr,
uint32_t value)
{
atomic_add((atomic_t *)addr, value);
}
static inline void deprecated_atomic_sub(uint32_t volatile *addr,
uint32_t value)
{
atomic_sub((atomic_t *)addr, value);
}
static inline uint32_t deprecated_atomic_read_clear(uint32_t volatile *addr)
{
return atomic_clear((atomic_t *)addr);
}
#endif /* __CROS_EC_ATOMIC_H */
|