Software APIs
dif_rom_ctrl_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 "rom_ctrl_regs.h" // Generated.
15 
18  dif_rom_ctrl_t *rom_ctrl) {
19  if (rom_ctrl == NULL) {
20  return kDifBadArg;
21  }
22 
23  rom_ctrl->base_addr = base_addr;
24 
25  return kDifOk;
26 }
27 
29  dif_rom_ctrl_alert_t alert) {
30  if (rom_ctrl == NULL) {
31  return kDifBadArg;
32  }
33 
34  bitfield_bit32_index_t alert_idx;
35  switch (alert) {
37  alert_idx = ROM_CTRL_ALERT_TEST_FATAL_BIT;
38  break;
39  default:
40  return kDifBadArg;
41  }
42 
43  uint32_t alert_test_reg = bitfield_bit32_write(0, alert_idx, true);
44  mmio_region_write32(rom_ctrl->base_addr,
45  (ptrdiff_t)ROM_CTRL_ALERT_TEST_REG_OFFSET,
46  alert_test_reg);
47 
48  return kDifOk;
49 }