Zephyr Project API  3.1.0
A Scalable Open Source RTOS
arch_inlines.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Cadence Design Systems, Inc.
3 * Copyright (c) 2019 Stephanos Ioannidis <root@stephanos.io>
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef ZEPHYR_INCLUDE_ARCH_XTENSA_ARCH_INLINES_H_
9#define ZEPHYR_INCLUDE_ARCH_XTENSA_ARCH_INLINES_H_
10
11#ifndef _ASMLANGUAGE
12
14#include <zsr.h>
15
16#define RSR(sr) \
17 ({uint32_t v; \
18 __asm__ volatile ("rsr." sr " %0" : "=a"(v)); \
19 v; })
20
21#define WSR(sr, v) \
22 do { \
23 __asm__ volatile ("wsr." sr " %0" : : "r"(v)); \
24 } while (false)
25
26static ALWAYS_INLINE _cpu_t *arch_curr_cpu(void)
27{
28 _cpu_t *cpu;
29
30 cpu = (_cpu_t *)RSR(ZSR_CPU_STR);
31
32 return cpu;
33}
34
35#endif /* !_ASMLANGUAGE */
36
37#endif /* ZEPHYR_INCLUDE_ARCH_XTENSA_ARCH_INLINES_H_ */
#define ALWAYS_INLINE
Definition: common.h:124
#define RSR(sr)
Definition: arch_inlines.h:16
static ALWAYS_INLINE _cpu_t * arch_curr_cpu(void)
Definition: arch_inlines.h:26