Zephyr API Documentation 4.0.99
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#include <zephyr/sys/util.h>
11
12#define reg_read(reg) \
13 ({ \
14 register unsigned long __rv; \
15 __asm__ volatile("mv %0, " STRINGIFY(reg) : "=r"(__rv)); \
16 __rv; \
17 })
18
19#define reg_write(reg, val) ({ __asm__("mv " STRINGIFY(reg) ", %0" : : "r"(val)); })
20
21#endif /* ZEPHYR_INCLUDE_ZEPHYR_ARCH_RISCV_REG_H_ */
Misc utilities.