1 /* Copyright 2018 SiFive, Inc */
2 /* SPDX-License-Identifier: Apache-2.0 */
4 #include <metal/machine/platform.h>
6 #ifdef METAL_SIFIVE_FE310_G000_PRCI
8 #include <metal/drivers/sifive_fe310-g000_prci.h>
9 #include <metal/machine.h>
11 long __metal_driver_sifive_fe310_g000_prci_get_reg(const struct __metal_driver_sifive_fe310_g000_prci *prci, long offset) {
12 unsigned long base = __metal_driver_sifive_fe310_g000_prci_base();
13 return __METAL_ACCESS_ONCE((__metal_io_u32 *)(base + offset));
16 long __metal_driver_sifive_fe310_g000_prci_set_reg(const struct __metal_driver_sifive_fe310_g000_prci *prci, long offset, long value) {
17 unsigned long base = __metal_driver_sifive_fe310_g000_prci_base();
18 return __METAL_ACCESS_ONCE((__metal_io_u32 *)(base + offset)) = value;
21 __METAL_DEFINE_VTABLE(__metal_driver_vtable_sifive_fe310_g000_prci) = {
22 .get_reg = __metal_driver_sifive_fe310_g000_prci_get_reg,
23 .set_reg = __metal_driver_sifive_fe310_g000_prci_set_reg,
26 #endif /* METAL_SIFIVE_FE310_G000_PRCI */