mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
esp_system: fix incorrect critical section usage in usb_console
spinlock_acquire does not disable interrupts, whereas portENTER_CRITICAL does. Closes IDF-2049
This commit is contained in:
@@ -62,7 +62,7 @@ static esp_usb_console_cb_t s_tx_cb;
|
|||||||
static void *s_cb_arg;
|
static void *s_cb_arg;
|
||||||
|
|
||||||
#ifdef CONFIG_ESP_CONSOLE_USB_CDC_SUPPORT_ETS_PRINTF
|
#ifdef CONFIG_ESP_CONSOLE_USB_CDC_SUPPORT_ETS_PRINTF
|
||||||
static spinlock_t s_write_lock = SPINLOCK_INITIALIZER;
|
static portMUX_TYPE s_write_lock = portMUX_INITIALIZER_UNLOCKED;
|
||||||
void esp_usb_console_write_char(char c);
|
void esp_usb_console_write_char(char c);
|
||||||
#define ISR_FLAG ESP_INTR_FLAG_IRAM
|
#define ISR_FLAG ESP_INTR_FLAG_IRAM
|
||||||
#else
|
#else
|
||||||
@@ -407,11 +407,11 @@ void esp_usb_console_write_char(char c)
|
|||||||
}
|
}
|
||||||
static inline void write_lock_acquire(void)
|
static inline void write_lock_acquire(void)
|
||||||
{
|
{
|
||||||
spinlock_acquire(&s_write_lock, SPINLOCK_WAIT_FOREVER);
|
portENTER_CRITICAL_SAFE(&s_write_lock);
|
||||||
}
|
}
|
||||||
static inline void write_lock_release(void)
|
static inline void write_lock_release(void)
|
||||||
{
|
{
|
||||||
spinlock_release(&s_write_lock);
|
portEXIT_CRITICAL_SAFE(&s_write_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // CONFIG_ESP_CONSOLE_USB_CDC_SUPPORT_ETS_PRINTF
|
#else // CONFIG_ESP_CONSOLE_USB_CDC_SUPPORT_ETS_PRINTF
|
||||||
|
Reference in New Issue
Block a user