Software APIs
ibex.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 #include "sw/device/lib/crypto/drivers/ibex.h"
6 
10 #include "sw/device/lib/crypto/impl/status.h"
12 
14 #include "rv_core_ibex_regs.h"
15 
16 enum {
18 };
19 
20 status_t ibex_wait_rnd_valid(void) {
21  while (true) {
22  uint32_t reg = abs_mmio_read32(kBase + RV_CORE_IBEX_RND_STATUS_REG_OFFSET);
23  if (bitfield_bit32_read(reg, RV_CORE_IBEX_RND_STATUS_RND_DATA_VALID_BIT)) {
24  return OTCRYPTO_OK;
25  }
26  }
27 }
28 
29 status_t ibex_rnd_status_read(uint32_t *rnd_status) {
30  *rnd_status = abs_mmio_read32(kBase + RV_CORE_IBEX_RND_STATUS_REG_OFFSET);
31  return OTCRYPTO_OK;
32 }
33 
34 status_t ibex_rnd_data_read(uint32_t *rnd_data) {
35  *rnd_data = abs_mmio_read32(kBase + RV_CORE_IBEX_RND_DATA_REG_OFFSET);
36  return OTCRYPTO_OK;
37 }