mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-04 14:01:54 +00:00
This will be used to support ITE IT8380 chip which contains an Andes N801 core. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:23574 TEST=make BOARD=it8380dev Change-Id: I91f9380c51c7712aa6a6418223a11551ab0091ce Reviewed-on: https://chromium-review.googlesource.com/175480 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
/* Copyright (c) 2013 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.
|
|
*/
|
|
|
|
/* Atomic operations for Andes */
|
|
|
|
#ifndef __CROS_EC_ATOMIC_H
|
|
#define __CROS_EC_ATOMIC_H
|
|
|
|
#include "common.h"
|
|
#include "cpu.h"
|
|
|
|
static inline void atomic_clear(uint32_t *addr, uint32_t bits)
|
|
{
|
|
uint32_t psw = get_psw();
|
|
asm volatile ("setgie.d");
|
|
*addr &= ~bits;
|
|
set_psw(psw);
|
|
}
|
|
|
|
static inline void atomic_or(uint32_t *addr, uint32_t bits)
|
|
{
|
|
uint32_t psw = get_psw();
|
|
asm volatile ("setgie.d");
|
|
*addr |= bits;
|
|
set_psw(psw);
|
|
}
|
|
|
|
static inline void atomic_add(uint32_t *addr, uint32_t value)
|
|
{
|
|
uint32_t psw = get_psw();
|
|
asm volatile ("setgie.d");
|
|
*addr += value;
|
|
set_psw(psw);
|
|
}
|
|
|
|
static inline void atomic_sub(uint32_t *addr, uint32_t value)
|
|
{
|
|
uint32_t psw = get_psw();
|
|
asm volatile ("setgie.d");
|
|
*addr -= value;
|
|
set_psw(psw);
|
|
}
|
|
|
|
static inline uint32_t atomic_read_clear(uint32_t *addr)
|
|
{
|
|
uint32_t val;
|
|
uint32_t psw = get_psw();
|
|
asm volatile ("setgie.d");
|
|
val = *addr;
|
|
*addr = 0;
|
|
set_psw(psw);
|
|
return val;
|
|
}
|
|
#endif /* __CROS_EC_ATOMIC_H */
|