Software APIs
dif_rv_core_ibex_autogen.c
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 // THIS FILE HAS BEEN GENERATED, DO NOT EDIT MANUALLY. COMMAND:
6 // util/make_new_dif.py --mode=regen --only=autogen
7 
9 
10 #include <stdint.h>
11 
13 
14 #include "rv_core_ibex_regs.h" // Generated.
15 
18  dif_rv_core_ibex_t *rv_core_ibex) {
19  if (rv_core_ibex == NULL) {
20  return kDifBadArg;
21  }
22 
23  rv_core_ibex->base_addr = base_addr;
24 
25  return kDifOk;
26 }
27 
29  const dif_rv_core_ibex_t *rv_core_ibex, dif_rv_core_ibex_alert_t alert) {
30  if (rv_core_ibex == NULL) {
31  return kDifBadArg;
32  }
33 
34  bitfield_bit32_index_t alert_idx;
35  switch (alert) {
37  alert_idx = RV_CORE_IBEX_ALERT_TEST_FATAL_SW_ERR_BIT;
38  break;
40  alert_idx = RV_CORE_IBEX_ALERT_TEST_RECOV_SW_ERR_BIT;
41  break;
43  alert_idx = RV_CORE_IBEX_ALERT_TEST_FATAL_HW_ERR_BIT;
44  break;
46  alert_idx = RV_CORE_IBEX_ALERT_TEST_RECOV_HW_ERR_BIT;
47  break;
48  default:
49  return kDifBadArg;
50  }
51 
52  uint32_t alert_test_reg = bitfield_bit32_write(0, alert_idx, true);
53  mmio_region_write32(rv_core_ibex->base_addr,
54  (ptrdiff_t)RV_CORE_IBEX_ALERT_TEST_REG_OFFSET,
55  alert_test_reg);
56 
57  return kDifOk;
58 }