14 #include "sensor_ctrl_regs.h"
19 if (sensor_ctrl == NULL) {
30 if (sensor_ctrl == NULL) {
37 alert_idx = SENSOR_CTRL_ALERT_TEST_RECOV_ALERT_BIT;
40 alert_idx = SENSOR_CTRL_ALERT_TEST_FATAL_ALERT_BIT;
47 mmio_region_write32(sensor_ctrl->
base_addr,
48 (ptrdiff_t)SENSOR_CTRL_ALERT_TEST_REG_OFFSET,
61 *index_out = SENSOR_CTRL_INTR_COMMON_IO_STATUS_CHANGE_BIT;
64 *index_out = SENSOR_CTRL_INTR_COMMON_INIT_STATUS_CHANGE_BIT;
82 if (sensor_ctrl == NULL || type == NULL ||
87 *type = irq_types[irq];
96 if (sensor_ctrl == NULL || snapshot == NULL) {
100 *snapshot = mmio_region_read32(sensor_ctrl->
base_addr,
101 (ptrdiff_t)SENSOR_CTRL_INTR_STATE_REG_OFFSET);
110 if (sensor_ctrl == NULL) {
114 mmio_region_write32(sensor_ctrl->
base_addr,
115 (ptrdiff_t)SENSOR_CTRL_INTR_STATE_REG_OFFSET, snapshot);
124 if (sensor_ctrl == NULL || is_pending == NULL) {
129 if (!sensor_ctrl_get_irq_bit_index(irq, &index)) {
133 uint32_t intr_state_reg = mmio_region_read32(
134 sensor_ctrl->
base_addr, (ptrdiff_t)SENSOR_CTRL_INTR_STATE_REG_OFFSET);
144 if (sensor_ctrl == NULL) {
149 mmio_region_write32(sensor_ctrl->
base_addr,
150 (ptrdiff_t)SENSOR_CTRL_INTR_STATE_REG_OFFSET, UINT32_MAX);
158 if (sensor_ctrl == NULL) {
163 if (!sensor_ctrl_get_irq_bit_index(irq, &index)) {
169 mmio_region_write32(sensor_ctrl->
base_addr,
170 (ptrdiff_t)SENSOR_CTRL_INTR_STATE_REG_OFFSET,
180 if (sensor_ctrl == NULL) {
185 if (!sensor_ctrl_get_irq_bit_index(irq, &index)) {
190 mmio_region_write32(sensor_ctrl->
base_addr,
191 (ptrdiff_t)SENSOR_CTRL_INTR_TEST_REG_OFFSET,
201 if (sensor_ctrl == NULL || state == NULL) {
206 if (!sensor_ctrl_get_irq_bit_index(irq, &index)) {
210 uint32_t intr_enable_reg = mmio_region_read32(
211 sensor_ctrl->
base_addr, (ptrdiff_t)SENSOR_CTRL_INTR_ENABLE_REG_OFFSET);
223 if (sensor_ctrl == NULL) {
228 if (!sensor_ctrl_get_irq_bit_index(irq, &index)) {
232 uint32_t intr_enable_reg = mmio_region_read32(
233 sensor_ctrl->
base_addr, (ptrdiff_t)SENSOR_CTRL_INTR_ENABLE_REG_OFFSET);
237 mmio_region_write32(sensor_ctrl->
base_addr,
238 (ptrdiff_t)SENSOR_CTRL_INTR_ENABLE_REG_OFFSET,
248 if (sensor_ctrl == NULL) {
253 if (snapshot != NULL) {
254 *snapshot = mmio_region_read32(
255 sensor_ctrl->
base_addr, (ptrdiff_t)SENSOR_CTRL_INTR_ENABLE_REG_OFFSET);
259 mmio_region_write32(sensor_ctrl->
base_addr,
260 (ptrdiff_t)SENSOR_CTRL_INTR_ENABLE_REG_OFFSET, 0u);
269 if (sensor_ctrl == NULL || snapshot == NULL) {
273 mmio_region_write32(sensor_ctrl->
base_addr,
274 (ptrdiff_t)SENSOR_CTRL_INTR_ENABLE_REG_OFFSET, *snapshot);