drivers: flash: esp32xx: use K_NO_WAIT when in ISR
Avoid timeout when taking semaphores in ISR. This enables flash operations inside interrupted context such as exceptions, allowing operations like saving core dump to flash for instance. Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
This commit is contained in:
parent
eb028ccf55
commit
8acedc61d1
1 changed files with 3 additions and 1 deletions
|
@ -57,6 +57,8 @@
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
LOG_MODULE_REGISTER(flash_esp32, CONFIG_FLASH_LOG_LEVEL);
|
LOG_MODULE_REGISTER(flash_esp32, CONFIG_FLASH_LOG_LEVEL);
|
||||||
|
|
||||||
|
#define FLASH_SEM_TIMEOUT (k_is_in_isr() ? K_NO_WAIT : K_FOREVER)
|
||||||
|
|
||||||
struct flash_esp32_dev_config {
|
struct flash_esp32_dev_config {
|
||||||
spi_dev_t *controller;
|
spi_dev_t *controller;
|
||||||
};
|
};
|
||||||
|
@ -77,7 +79,7 @@ static inline void flash_esp32_sem_take(const struct device *dev)
|
||||||
{
|
{
|
||||||
struct flash_esp32_dev_data *data = dev->data;
|
struct flash_esp32_dev_data *data = dev->data;
|
||||||
|
|
||||||
k_sem_take(&data->sem, K_FOREVER);
|
k_sem_take(&data->sem, FLASH_SEM_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void flash_esp32_sem_give(const struct device *dev)
|
static inline void flash_esp32_sem_give(const struct device *dev)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue