From 297a0e053d9fad04c0d8aa8b72c817dcddacb3e4 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Tue, 24 Oct 2017 15:03:11 +0200 Subject: [PATCH] freertos: use portYIELD_FROM_ISR without arguments on esp32 and allow to compile of btstack_uart_block_freertos --- platform/freertos/btstack_run_loop_freertos.c | 4 ++++ platform/freertos/btstack_uart_block_freertos.c | 9 ++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/platform/freertos/btstack_run_loop_freertos.c b/platform/freertos/btstack_run_loop_freertos.c index d88f636b8..2ea5f7b2e 100644 --- a/platform/freertos/btstack_run_loop_freertos.c +++ b/platform/freertos/btstack_run_loop_freertos.c @@ -152,7 +152,11 @@ void btstack_run_loop_freertos_trigger_from_isr(void){ #ifdef HAVE_FREERTOS_TASK_NOTIFICATIONS xTaskNotifyFromISR(btstack_run_loop_task, EVENT_GROUP_FLAG_RUN_LOOP, eSetBits, &xHigherPriorityTaskWoken); if (xHigherPriorityTaskWoken) { +#ifdef ESP_PLATFORM + portYIELD_FROM_ISR(); +#else portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); +#endif } #else xEventGroupSetBitsFromISR(btstack_run_loop_event_group, EVENT_GROUP_FLAG_RUN_LOOP, &xHigherPriorityTaskWoken); diff --git a/platform/freertos/btstack_uart_block_freertos.c b/platform/freertos/btstack_uart_block_freertos.c index 6400c886c..53041446d 100644 --- a/platform/freertos/btstack_uart_block_freertos.c +++ b/platform/freertos/btstack_uart_block_freertos.c @@ -50,12 +50,10 @@ #include "btstack_run_loop_freertos.h" #include "hal_uart_dma.h" -// hack to avoid error for ESP32 -#ifndef ESP_PLATFORM - #if (INCLUDE_xEventGroupSetBitFromISR != 1) && !defined(HAVE_FREERTOS_TASK_NOTIFICATIONS) #error "The BTstack HAL UART Run Loop integration (btstack_uart_block_freertos) needs to trigger Run Loop iterations from ISR context," \ -"but 'INCLUDE_xEventGroupSetBitFromISR' is not enabled in your FreeRTOS configuration. Please enable INCLUDE_xEventGroupSetBitFromISR." +"but neither 'INCLUDE_xEventGroupSetBitFromISR' is enabled in your FreeRTOS configuration nor HAVE_FREERTOS_TASK_NOTIFICATIONS is enabled in " \ +"btstack_config.h. Please enable INCLUDE_xEventGroupSetBitFromISR or HAVE_FREERTOS_TASK_NOTIFICATIONS." #endif // uart config @@ -169,6 +167,3 @@ static const btstack_uart_block_t btstack_uart_block_freertos = { const btstack_uart_block_t * btstack_uart_block_freertos_instance(void){ return &btstack_uart_block_freertos; } - -// end of hack to avoid error for ESP32 -#endif // ESP_PLATFORM