Software APIs
dif_rstmgr_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 "rstmgr_regs.h" // Generated.
15 
18  if (rstmgr == NULL) {
19  return kDifBadArg;
20  }
21 
22  rstmgr->base_addr = base_addr;
23 
24  return kDifOk;
25 }
26 
28  dif_rstmgr_alert_t alert) {
29  if (rstmgr == NULL) {
30  return kDifBadArg;
31  }
32 
33  bitfield_bit32_index_t alert_idx;
34  switch (alert) {
36  alert_idx = RSTMGR_ALERT_TEST_FATAL_FAULT_BIT;
37  break;
39  alert_idx = RSTMGR_ALERT_TEST_FATAL_CNSTY_FAULT_BIT;
40  break;
41  default:
42  return kDifBadArg;
43  }
44 
45  uint32_t alert_test_reg = bitfield_bit32_write(0, alert_idx, true);
46  mmio_region_write32(rstmgr->base_addr,
47  (ptrdiff_t)RSTMGR_ALERT_TEST_REG_OFFSET, alert_test_reg);
48 
49  return kDifOk;
50 }