14 #include "csrng_regs.h"
36 alert_idx = CSRNG_ALERT_TEST_RECOV_ALERT_BIT;
39 alert_idx = CSRNG_ALERT_TEST_FATAL_ALERT_BIT;
46 mmio_region_write32(csrng->
base_addr, (ptrdiff_t)CSRNG_ALERT_TEST_REG_OFFSET,
59 *index_out = CSRNG_INTR_COMMON_CS_CMD_REQ_DONE_BIT;
62 *index_out = CSRNG_INTR_COMMON_CS_ENTROPY_REQ_BIT;
65 *index_out = CSRNG_INTR_COMMON_CS_HW_INST_EXC_BIT;
68 *index_out = CSRNG_INTR_COMMON_CS_FATAL_ERR_BIT;
91 *type = irq_types[irq];
99 if (csrng == NULL || snapshot == NULL) {
103 *snapshot = mmio_region_read32(csrng->
base_addr,
104 (ptrdiff_t)CSRNG_INTR_STATE_REG_OFFSET);
116 mmio_region_write32(csrng->
base_addr, (ptrdiff_t)CSRNG_INTR_STATE_REG_OFFSET,
125 if (csrng == NULL || is_pending == NULL) {
130 if (!csrng_get_irq_bit_index(irq, &index)) {
134 uint32_t intr_state_reg = mmio_region_read32(
135 csrng->
base_addr, (ptrdiff_t)CSRNG_INTR_STATE_REG_OFFSET);
149 mmio_region_write32(csrng->
base_addr, (ptrdiff_t)CSRNG_INTR_STATE_REG_OFFSET,
163 if (!csrng_get_irq_bit_index(irq, &index)) {
169 mmio_region_write32(csrng->
base_addr, (ptrdiff_t)CSRNG_INTR_STATE_REG_OFFSET,
183 if (!csrng_get_irq_bit_index(irq, &index)) {
188 mmio_region_write32(csrng->
base_addr, (ptrdiff_t)CSRNG_INTR_TEST_REG_OFFSET,
198 if (csrng == NULL || state == NULL) {
203 if (!csrng_get_irq_bit_index(irq, &index)) {
207 uint32_t intr_enable_reg = mmio_region_read32(
208 csrng->
base_addr, (ptrdiff_t)CSRNG_INTR_ENABLE_REG_OFFSET);
225 if (!csrng_get_irq_bit_index(irq, &index)) {
229 uint32_t intr_enable_reg = mmio_region_read32(
230 csrng->
base_addr, (ptrdiff_t)CSRNG_INTR_ENABLE_REG_OFFSET);
234 mmio_region_write32(csrng->
base_addr, (ptrdiff_t)CSRNG_INTR_ENABLE_REG_OFFSET,
248 if (snapshot != NULL) {
249 *snapshot = mmio_region_read32(csrng->
base_addr,
250 (ptrdiff_t)CSRNG_INTR_ENABLE_REG_OFFSET);
254 mmio_region_write32(csrng->
base_addr, (ptrdiff_t)CSRNG_INTR_ENABLE_REG_OFFSET,
263 if (csrng == NULL || snapshot == NULL) {
267 mmio_region_write32(csrng->
base_addr, (ptrdiff_t)CSRNG_INTR_ENABLE_REG_OFFSET,