Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
reg.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Meta Platforms
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_ZEPHYR_ARCH_RISCV_REG_H_
8#define ZEPHYR_INCLUDE_ZEPHYR_ARCH_RISCV_REG_H_
9
10#define reg_read(reg) \
11 ({ \
12 register unsigned long __rv; \
13 __asm__ volatile("mv %0, " STRINGIFY(reg) : "=r"(__rv)); \
14 __rv; \
15 })
16
17#define reg_write(reg, val) ({ __asm__("mv " STRINGIFY(reg) ", %0" : : "r"(val)); })
18
19#endif /* ZEPHYR_INCLUDE_ZEPHYR_ARCH_RISCV_REG_H_ */