We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d267402 commit de3a845Copy full SHA for de3a845
include/zephyr/arch/riscv/reg.h
@@ -0,0 +1,19 @@
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_ */
0 commit comments