14 #include "entropy_src_regs.h"
19 if (entropy_src == NULL) {
30 if (entropy_src == NULL) {
37 alert_idx = ENTROPY_SRC_ALERT_TEST_RECOV_ALERT_BIT;
40 alert_idx = ENTROPY_SRC_ALERT_TEST_FATAL_ALERT_BIT;
47 mmio_region_write32(entropy_src->
base_addr,
48 (ptrdiff_t)ENTROPY_SRC_ALERT_TEST_REG_OFFSET,
61 *index_out = ENTROPY_SRC_INTR_COMMON_ES_ENTROPY_VALID_BIT;
64 *index_out = ENTROPY_SRC_INTR_COMMON_ES_HEALTH_TEST_FAILED_BIT;
67 *index_out = ENTROPY_SRC_INTR_COMMON_ES_OBSERVE_FIFO_READY_BIT;
70 *index_out = ENTROPY_SRC_INTR_COMMON_ES_FATAL_ERR_BIT;
90 if (entropy_src == NULL || type == NULL ||
95 *type = irq_types[irq];
104 if (entropy_src == NULL || snapshot == NULL) {
108 *snapshot = mmio_region_read32(entropy_src->
base_addr,
109 (ptrdiff_t)ENTROPY_SRC_INTR_STATE_REG_OFFSET);
118 if (entropy_src == NULL) {
122 mmio_region_write32(entropy_src->
base_addr,
123 (ptrdiff_t)ENTROPY_SRC_INTR_STATE_REG_OFFSET, snapshot);
132 if (entropy_src == NULL || is_pending == NULL) {
137 if (!entropy_src_get_irq_bit_index(irq, &index)) {
141 uint32_t intr_state_reg = mmio_region_read32(
142 entropy_src->
base_addr, (ptrdiff_t)ENTROPY_SRC_INTR_STATE_REG_OFFSET);
152 if (entropy_src == NULL) {
157 mmio_region_write32(entropy_src->
base_addr,
158 (ptrdiff_t)ENTROPY_SRC_INTR_STATE_REG_OFFSET, UINT32_MAX);
166 if (entropy_src == NULL) {
171 if (!entropy_src_get_irq_bit_index(irq, &index)) {
177 mmio_region_write32(entropy_src->
base_addr,
178 (ptrdiff_t)ENTROPY_SRC_INTR_STATE_REG_OFFSET,
188 if (entropy_src == NULL) {
193 if (!entropy_src_get_irq_bit_index(irq, &index)) {
198 mmio_region_write32(entropy_src->
base_addr,
199 (ptrdiff_t)ENTROPY_SRC_INTR_TEST_REG_OFFSET,
209 if (entropy_src == NULL || state == NULL) {
214 if (!entropy_src_get_irq_bit_index(irq, &index)) {
218 uint32_t intr_enable_reg = mmio_region_read32(
219 entropy_src->
base_addr, (ptrdiff_t)ENTROPY_SRC_INTR_ENABLE_REG_OFFSET);
231 if (entropy_src == NULL) {
236 if (!entropy_src_get_irq_bit_index(irq, &index)) {
240 uint32_t intr_enable_reg = mmio_region_read32(
241 entropy_src->
base_addr, (ptrdiff_t)ENTROPY_SRC_INTR_ENABLE_REG_OFFSET);
245 mmio_region_write32(entropy_src->
base_addr,
246 (ptrdiff_t)ENTROPY_SRC_INTR_ENABLE_REG_OFFSET,
256 if (entropy_src == NULL) {
261 if (snapshot != NULL) {
262 *snapshot = mmio_region_read32(
263 entropy_src->
base_addr, (ptrdiff_t)ENTROPY_SRC_INTR_ENABLE_REG_OFFSET);
267 mmio_region_write32(entropy_src->
base_addr,
268 (ptrdiff_t)ENTROPY_SRC_INTR_ENABLE_REG_OFFSET, 0u);
277 if (entropy_src == NULL || snapshot == NULL) {
281 mmio_region_write32(entropy_src->
base_addr,
282 (ptrdiff_t)ENTROPY_SRC_INTR_ENABLE_REG_OFFSET, *snapshot);