This is an automated email from the ASF dual-hosted git repository.
jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new 588d391 hw/mcu/da1469x: Allow to release GPIO pin in ISR
588d391 is described below
commit 588d391c49309d92387b36b1e6f724d81fcfe525
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Fri Dec 11 16:44:48 2020 +0100
hw/mcu/da1469x: Allow to release GPIO pin in ISR
When GPIO pin is configured as input with interrupt it seems
reasonable to be able to release this interrupt during
GPIO interrupt handler without need to go through threaded code.
To achieve this WKUP_CLEAR_PX() must be called with correct pin
number. If interrupt handler released currently handled GPIO
interrupt handler pin in hal_gpio_irqs is no longer valid.
Now local copy of pin number is used when WKUP_CLEAR_PX is called
to make sure releasing GPIO IRQ is safe.
---
hw/mcu/dialog/da1469x/src/hal_gpio.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/hw/mcu/dialog/da1469x/src/hal_gpio.c
b/hw/mcu/dialog/da1469x/src/hal_gpio.c
index b483768..06ab25b 100644
--- a/hw/mcu/dialog/da1469x/src/hal_gpio.c
+++ b/hw/mcu/dialog/da1469x/src/hal_gpio.c
@@ -292,6 +292,7 @@ hal_gpio_irq_handler(void)
struct hal_gpio_irq *irq;
uint32_t stat;
int i;
+ int pin;
*WKUP_RESET_IRQ_REG_ADDR = 1;
NVIC_ClearPendingIRQ(KEY_WKUP_GPIO_IRQn);
@@ -299,6 +300,8 @@ hal_gpio_irq_handler(void)
for (i = 0; i < HAL_GPIO_MAX_IRQ; i++) {
irq = &hal_gpio_irqs[i];
+ pin = irq->pin;
+
/* Read latched status value from relevant GPIO port */
stat = WKUP_STAT(irq->pin);
@@ -306,7 +309,7 @@ hal_gpio_irq_handler(void)
irq->func(irq->arg);
}
- WKUP_CLEAR_PX(irq->pin);
+ WKUP_CLEAR_PX(pin);
}
}