| // Copyright 2022 Google LLC. |
| // Copyright lowRISC contributors. |
| // Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| // SPDX-License-Identifier: Apache-2.0 |
| |
| #include "sw/device/lib/dif/dif_ml_top.h" |
| |
| #include <stddef.h> |
| |
| #include "sw/device/lib/base/bitfield.h" |
| #include "sw/device/lib/base/macros.h" |
| #include "sw/device/lib/dif/dif_base.h" |
| |
| #include "ml_top_regs.h" // Generated. |
| |
| dif_result_t dif_ml_top_reset_ctrl_en(const dif_ml_top_t *ml_top) { |
| if (ml_top == NULL) { |
| return kDifBadArg; |
| } |
| |
| mmio_region_write32( |
| ml_top->base_addr, ML_TOP_CTRL_REG_OFFSET, ML_TOP_CTRL_REG_RESVAL); |
| return kDifOk; |
| } |
| |
| dif_result_t dif_ml_top_read_ctrl_en(const dif_ml_top_t *ml_top, uint32_t *result) { |
| if (ml_top == NULL) { |
| return kDifBadArg; |
| } |
| |
| *result = mmio_region_read32(ml_top->base_addr, ML_TOP_CTRL_REG_OFFSET); |
| return kDifOk; |
| } |
| |
| dif_result_t dif_ml_top_reset_intr_en(const dif_ml_top_t *ml_top) { |
| if (ml_top == NULL) { |
| return kDifBadArg; |
| } |
| |
| mmio_region_write32( |
| ml_top->base_addr, ML_TOP_INTR_ENABLE_REG_OFFSET, ML_TOP_INTR_ENABLE_REG_RESVAL); |
| return kDifOk; |
| } |
| |
| dif_result_t dif_ml_top_read_intr_en(const dif_ml_top_t *ml_top, uint32_t *result) { |
| if (ml_top == NULL) { |
| return kDifBadArg; |
| } |
| |
| *result = mmio_region_read32(ml_top->base_addr, ML_TOP_INTR_ENABLE_REG_OFFSET); |
| return kDifOk; |
| } |