arch/xtensa/src/esp32/esp32_gpio.c: Change the logic of setting the ENA

bits so that the call to up_cpu_index is only performed when SMP is
enabled.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2020-10-02 12:54:02 +01:00 committed by Alan Carvalho de Assis
parent 80ce7800a9
commit 844f39fc67

View file

@ -354,7 +354,9 @@ void esp32_gpioirqenable(int irq, gpio_intrtype_t intrtype)
{
uintptr_t regaddr;
uint32_t regval;
#ifdef CONFIG_SMP
int cpu;
#endif
int pin;
DEBUGASSERT(irq <= ESP32_FIRST_GPIOIRQ && irq <= ESP32_LAST_GPIOIRQ);
@ -380,19 +382,21 @@ void esp32_gpioirqenable(int irq, gpio_intrtype_t intrtype)
* Bit 5: SDIO's extent interrupt enable.
*/
#ifdef CONFIG_SMP
cpu = up_cpu_index();
if (cpu == 0)
{
/* PRO_CPU */
regval |= ((1 << 2) << GPIO_PIN_INT_ENA_S);
}
else
if (cpu != 0)
{
/* APP_CPU */
regval |= ((1 << 0) << GPIO_PIN_INT_ENA_S);
}
else
#endif
{
/* PRO_CPU */
regval |= ((1 << 2) << GPIO_PIN_INT_ENA_S);
}
regval |= (intrtype << GPIO_PIN_INT_TYPE_S);
putreg32(regval, regaddr);