17d5f5399SMatthias Ringwald /*
27d5f5399SMatthias Ringwald * Copyright (C) 2017 BlueKitchen GmbH
37d5f5399SMatthias Ringwald *
47d5f5399SMatthias Ringwald * Redistribution and use in source and binary forms, with or without
57d5f5399SMatthias Ringwald * modification, are permitted provided that the following conditions
67d5f5399SMatthias Ringwald * are met:
77d5f5399SMatthias Ringwald *
87d5f5399SMatthias Ringwald * 1. Redistributions of source code must retain the above copyright
97d5f5399SMatthias Ringwald * notice, this list of conditions and the following disclaimer.
107d5f5399SMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright
117d5f5399SMatthias Ringwald * notice, this list of conditions and the following disclaimer in the
127d5f5399SMatthias Ringwald * documentation and/or other materials provided with the distribution.
137d5f5399SMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of
147d5f5399SMatthias Ringwald * contributors may be used to endorse or promote products derived
157d5f5399SMatthias Ringwald * from this software without specific prior written permission.
167d5f5399SMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for
177d5f5399SMatthias Ringwald * personal benefit and not for any commercial purpose or for
187d5f5399SMatthias Ringwald * monetary gain.
197d5f5399SMatthias Ringwald *
207d5f5399SMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
217d5f5399SMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
227d5f5399SMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
232fca4dadSMilanka Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
242fca4dadSMilanka Ringwald * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
257d5f5399SMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
267d5f5399SMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
277d5f5399SMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
287d5f5399SMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
297d5f5399SMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
307d5f5399SMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
317d5f5399SMatthias Ringwald * SUCH DAMAGE.
327d5f5399SMatthias Ringwald *
337d5f5399SMatthias Ringwald * Please inquire about commercial licensing options at
347d5f5399SMatthias Ringwald * [email protected]
357d5f5399SMatthias Ringwald *
367d5f5399SMatthias Ringwald */
377d5f5399SMatthias Ringwald
387d5f5399SMatthias Ringwald /*
397d5f5399SMatthias Ringwald * btstack_run_loop_freertos.c
407d5f5399SMatthias Ringwald *
417d5f5399SMatthias Ringwald * Run loop on dedicated thread on FreeRTOS
42828fd804SMatthias Ringwald * The run loop is triggered from other task/ISRs either via Event Groups
43828fd804SMatthias Ringwald * or Task Notifications if HAVE_FREERTOS_TASK_NOTIFICATIONS is defined
447d5f5399SMatthias Ringwald */
457d5f5399SMatthias Ringwald
46e501bae0SMatthias Ringwald #define BTSTACK_FILE__ "btstack_run_loop_freertos.c"
470c2f4953SMatthias Ringwald
487d5f5399SMatthias Ringwald #include <stddef.h> // NULL
497d5f5399SMatthias Ringwald
509155bf8cSMatthias Ringwald #include "btstack_run_loop_freertos.h"
519155bf8cSMatthias Ringwald
527d5f5399SMatthias Ringwald #include "btstack_linked_list.h"
537d5f5399SMatthias Ringwald #include "btstack_debug.h"
549155bf8cSMatthias Ringwald #include "btstack_util.h"
556d23ba05SMatthias Ringwald #include "hal_time_ms.h"
567d5f5399SMatthias Ringwald
576d23ba05SMatthias Ringwald // some SDKs, e.g. esp-idf, place FreeRTOS headers into an 'freertos' folder to avoid name collisions (e.g. list.h, queue.h, ..)
586d23ba05SMatthias Ringwald // wih this flag, the headers are properly found
597d5f5399SMatthias Ringwald
606d23ba05SMatthias Ringwald #ifdef HAVE_FREERTOS_INCLUDE_PREFIX
617d5f5399SMatthias Ringwald #include "freertos/FreeRTOS.h"
627d5f5399SMatthias Ringwald #include "freertos/task.h"
637d5f5399SMatthias Ringwald #include "freertos/queue.h"
647d5f5399SMatthias Ringwald #include "freertos/event_groups.h"
65d08c604fSMatthias Ringwald #include "freertos/semphr.h"
666d23ba05SMatthias Ringwald #else
676d23ba05SMatthias Ringwald #include "FreeRTOS.h"
686d23ba05SMatthias Ringwald #include "task.h"
696d23ba05SMatthias Ringwald #include "queue.h"
706d23ba05SMatthias Ringwald #include "event_groups.h"
71c51a1d5aSMatthias Ringwald #include "semphr.h"
726d23ba05SMatthias Ringwald #endif
737d5f5399SMatthias Ringwald
747d5f5399SMatthias Ringwald typedef struct function_call {
757d5f5399SMatthias Ringwald void (*fn)(void * arg);
767d5f5399SMatthias Ringwald void * arg;
777d5f5399SMatthias Ringwald } function_call_t;
787d5f5399SMatthias Ringwald
790c9cde95SMatthias Ringwald // pick allocation style, prefer static
800c9cde95SMatthias Ringwald #if( configSUPPORT_STATIC_ALLOCATION == 1 )
810c9cde95SMatthias Ringwald #define USE_STATIC_ALLOC
820c9cde95SMatthias Ringwald #elif( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
830c9cde95SMatthias Ringwald // ok, nothing to do
840c9cde95SMatthias Ringwald #else
850c9cde95SMatthias Ringwald #error "Either configSUPPORT_STATIC_ALLOCATION or configSUPPORT_DYNAMIC_ALLOCATION in FreeRTOSConfig.h must be 1"
860c9cde95SMatthias Ringwald #endif
870c9cde95SMatthias Ringwald
880c9cde95SMatthias Ringwald // queue to receive events: up to 2 calls from transport, rest for app
890c9cde95SMatthias Ringwald #define RUN_LOOP_QUEUE_LENGTH 20
900c9cde95SMatthias Ringwald #define RUN_LOOP_QUEUE_ITEM_SIZE sizeof(function_call_t)
910c9cde95SMatthias Ringwald
920c9cde95SMatthias Ringwald #ifdef USE_STATIC_ALLOC
930c9cde95SMatthias Ringwald static StaticQueue_t btstack_run_loop_queue_object;
940c9cde95SMatthias Ringwald static uint8_t btstack_run_loop_queue_storage[ RUN_LOOP_QUEUE_LENGTH * RUN_LOOP_QUEUE_ITEM_SIZE ];
95c51a1d5aSMatthias Ringwald static StaticSemaphore_t btstack_run_loop_callback_mutex_object;
960c9cde95SMatthias Ringwald #endif
970c9cde95SMatthias Ringwald
987d5f5399SMatthias Ringwald static QueueHandle_t btstack_run_loop_queue;
99828fd804SMatthias Ringwald static TaskHandle_t btstack_run_loop_task;
100c51a1d5aSMatthias Ringwald static SemaphoreHandle_t btstack_run_loop_callbacks_mutex;
101f51d404eSMatthias Ringwald
102f51d404eSMatthias Ringwald #ifndef HAVE_FREERTOS_TASK_NOTIFICATIONS
1037d5f5399SMatthias Ringwald static EventGroupHandle_t btstack_run_loop_event_group;
104828fd804SMatthias Ringwald #endif
1057d5f5399SMatthias Ringwald
1067d5f5399SMatthias Ringwald // bit 0 event group reserved to wakeup run loop
1077d5f5399SMatthias Ringwald #define EVENT_GROUP_FLAG_RUN_LOOP 1
1087d5f5399SMatthias Ringwald
1097d5f5399SMatthias Ringwald // the run loop
1109dc32eb4SMatthias Ringwald static bool run_loop_exit_requested;
1117d5f5399SMatthias Ringwald
btstack_run_loop_freertos_get_time_ms(void)1127d5f5399SMatthias Ringwald static uint32_t btstack_run_loop_freertos_get_time_ms(void){
1137d5f5399SMatthias Ringwald return hal_time_ms();
1147d5f5399SMatthias Ringwald }
1157d5f5399SMatthias Ringwald
1167d5f5399SMatthias Ringwald // set timer
btstack_run_loop_freertos_set_timer(btstack_timer_source_t * ts,uint32_t timeout_in_ms)1177d5f5399SMatthias Ringwald static void btstack_run_loop_freertos_set_timer(btstack_timer_source_t *ts, uint32_t timeout_in_ms){
1187d5f5399SMatthias Ringwald ts->timeout = btstack_run_loop_freertos_get_time_ms() + timeout_in_ms + 1;
1197d5f5399SMatthias Ringwald }
1207d5f5399SMatthias Ringwald
btstack_run_loop_freertos_trigger_from_thread(void)121c51a1d5aSMatthias Ringwald static void btstack_run_loop_freertos_trigger_from_thread(void){
122828fd804SMatthias Ringwald #ifdef HAVE_FREERTOS_TASK_NOTIFICATIONS
123828fd804SMatthias Ringwald xTaskNotify(btstack_run_loop_task, EVENT_GROUP_FLAG_RUN_LOOP, eSetBits);
124828fd804SMatthias Ringwald #else
1257d5f5399SMatthias Ringwald xEventGroupSetBits(btstack_run_loop_event_group, EVENT_GROUP_FLAG_RUN_LOOP);
126828fd804SMatthias Ringwald #endif
1277d5f5399SMatthias Ringwald }
1287d5f5399SMatthias Ringwald
129d145c914SMatthias Ringwald #if defined(HAVE_FREERTOS_TASK_NOTIFICATIONS) || (INCLUDE_xEventGroupSetBitFromISR == 1)
btstack_run_loop_freertos_poll_data_sources_from_irq(void)1304fd33db7SMatthias Ringwald static void btstack_run_loop_freertos_poll_data_sources_from_irq(void){
131d145c914SMatthias Ringwald BaseType_t xHigherPriorityTaskWoken;
132d145c914SMatthias Ringwald #ifdef HAVE_FREERTOS_TASK_NOTIFICATIONS
133d145c914SMatthias Ringwald xTaskNotifyFromISR(btstack_run_loop_task, EVENT_GROUP_FLAG_RUN_LOOP, eSetBits, &xHigherPriorityTaskWoken);
134d145c914SMatthias Ringwald if (xHigherPriorityTaskWoken) {
135d145c914SMatthias Ringwald #ifdef ESP_PLATFORM
136d145c914SMatthias Ringwald portYIELD_FROM_ISR();
137d145c914SMatthias Ringwald #else
138d145c914SMatthias Ringwald portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
139d145c914SMatthias Ringwald #endif
140d145c914SMatthias Ringwald }
141d145c914SMatthias Ringwald #else
142d145c914SMatthias Ringwald xEventGroupSetBitsFromISR(btstack_run_loop_event_group, EVENT_GROUP_FLAG_RUN_LOOP, &xHigherPriorityTaskWoken);
143d145c914SMatthias Ringwald #endif
144d145c914SMatthias Ringwald }
1457d5f5399SMatthias Ringwald #endif
1467d5f5399SMatthias Ringwald
btstack_run_loop_freertos_trigger_exit_internal(void)14738b6e836SMatthias Ringwald static void btstack_run_loop_freertos_trigger_exit_internal(void){
1489dc32eb4SMatthias Ringwald run_loop_exit_requested = true;
1499dc32eb4SMatthias Ringwald }
1509dc32eb4SMatthias Ringwald
1517d5f5399SMatthias Ringwald /**
1527d5f5399SMatthias Ringwald * Execute run_loop
1537d5f5399SMatthias Ringwald */
btstack_run_loop_freertos_execute(void)1544a76e901SMatthias Ringwald static void btstack_run_loop_freertos_execute(void) {
1557d5f5399SMatthias Ringwald log_debug("RL: execute");
1567d5f5399SMatthias Ringwald
1579dc32eb4SMatthias Ringwald run_loop_exit_requested = false;
1589dc32eb4SMatthias Ringwald
159ff3cc4a5SMatthias Ringwald while (true) {
1607d5f5399SMatthias Ringwald
1617d5f5399SMatthias Ringwald // process data sources
162cd5f23a3SMatthias Ringwald btstack_run_loop_base_poll_data_sources();
1637d5f5399SMatthias Ringwald
164c51a1d5aSMatthias Ringwald // execute callbacks - protect list with mutex
165c51a1d5aSMatthias Ringwald while (1){
166c51a1d5aSMatthias Ringwald xSemaphoreTake(btstack_run_loop_callbacks_mutex, portMAX_DELAY);
167c51a1d5aSMatthias Ringwald btstack_context_callback_registration_t * callback_registration = (btstack_context_callback_registration_t *) btstack_linked_list_pop(&btstack_run_loop_base_callbacks);
168c51a1d5aSMatthias Ringwald xSemaphoreGive(btstack_run_loop_callbacks_mutex);
169c51a1d5aSMatthias Ringwald if (callback_registration == NULL){
170c51a1d5aSMatthias Ringwald break;
171c51a1d5aSMatthias Ringwald }
172c51a1d5aSMatthias Ringwald (*callback_registration->callback)(callback_registration->context);
173c51a1d5aSMatthias Ringwald }
174c51a1d5aSMatthias Ringwald
175c51a1d5aSMatthias Ringwald // process registered function calls on run loop thread (deprecated)
176ff3cc4a5SMatthias Ringwald while (true){
1777d5f5399SMatthias Ringwald function_call_t message = { NULL, NULL };
1787d5f5399SMatthias Ringwald BaseType_t res = xQueueReceive( btstack_run_loop_queue, &message, 0);
1797d5f5399SMatthias Ringwald if (res == pdFALSE) break;
1807d5f5399SMatthias Ringwald if (message.fn){
1817d5f5399SMatthias Ringwald message.fn(message.arg);
1827d5f5399SMatthias Ringwald }
1837d5f5399SMatthias Ringwald }
1847d5f5399SMatthias Ringwald
185cd5f23a3SMatthias Ringwald // process timers
1867d5f5399SMatthias Ringwald uint32_t now = btstack_run_loop_freertos_get_time_ms();
187cd5f23a3SMatthias Ringwald btstack_run_loop_base_process_timers(now);
1887d5f5399SMatthias Ringwald
189c51a1d5aSMatthias Ringwald // exit triggered by btstack_run_loop_trigger_exit (main thread or other thread)
1909dc32eb4SMatthias Ringwald if (run_loop_exit_requested) break;
1919dc32eb4SMatthias Ringwald
192828fd804SMatthias Ringwald // wait for timeout or event group/task notification
193cd5f23a3SMatthias Ringwald int32_t timeout_next_timer_ms = btstack_run_loop_base_get_time_until_timeout(now);
194cd5f23a3SMatthias Ringwald
195cd5f23a3SMatthias Ringwald uint32_t timeout_ms = portMAX_DELAY;
196cd5f23a3SMatthias Ringwald if (timeout_next_timer_ms >= 0){
197cd5f23a3SMatthias Ringwald timeout_ms = (uint32_t) timeout_next_timer_ms;
198cd5f23a3SMatthias Ringwald }
199cd5f23a3SMatthias Ringwald
2007d5f5399SMatthias Ringwald log_debug("RL: wait with timeout %u", (int) timeout_ms);
201828fd804SMatthias Ringwald #ifdef HAVE_FREERTOS_TASK_NOTIFICATIONS
202828fd804SMatthias Ringwald xTaskNotifyWait(pdFALSE, 0xffffffff, NULL, pdMS_TO_TICKS(timeout_ms));
203828fd804SMatthias Ringwald #else
2047d5f5399SMatthias Ringwald xEventGroupWaitBits(btstack_run_loop_event_group, EVENT_GROUP_FLAG_RUN_LOOP, 1, 0, pdMS_TO_TICKS(timeout_ms));
205828fd804SMatthias Ringwald #endif
2067d5f5399SMatthias Ringwald }
2077d5f5399SMatthias Ringwald }
2087d5f5399SMatthias Ringwald
btstack_run_loop_freertos_execute_on_main_thread(btstack_context_callback_registration_t * callback_registration)209c51a1d5aSMatthias Ringwald static void btstack_run_loop_freertos_execute_on_main_thread(btstack_context_callback_registration_t * callback_registration){
210c51a1d5aSMatthias Ringwald // protect list with mutex
211c51a1d5aSMatthias Ringwald xSemaphoreTake(btstack_run_loop_callbacks_mutex, portMAX_DELAY);
212c51a1d5aSMatthias Ringwald btstack_run_loop_base_add_callback(callback_registration);
213c51a1d5aSMatthias Ringwald xSemaphoreGive(btstack_run_loop_callbacks_mutex);
214c51a1d5aSMatthias Ringwald btstack_run_loop_freertos_trigger_from_thread();
215c51a1d5aSMatthias Ringwald }
216c51a1d5aSMatthias Ringwald
btstack_run_loop_freertos_init(void)2177d5f5399SMatthias Ringwald static void btstack_run_loop_freertos_init(void){
218cd5f23a3SMatthias Ringwald btstack_run_loop_base_init();
2197d5f5399SMatthias Ringwald
2200c9cde95SMatthias Ringwald #ifdef USE_STATIC_ALLOC
2210c9cde95SMatthias Ringwald btstack_run_loop_queue = xQueueCreateStatic(RUN_LOOP_QUEUE_LENGTH, RUN_LOOP_QUEUE_ITEM_SIZE, btstack_run_loop_queue_storage, &btstack_run_loop_queue_object);
222d08c604fSMatthias Ringwald btstack_run_loop_callbacks_mutex = xSemaphoreCreateMutexStatic(&btstack_run_loop_callback_mutex_object);
2230c9cde95SMatthias Ringwald #else
2240c9cde95SMatthias Ringwald btstack_run_loop_queue = xQueueCreate(RUN_LOOP_QUEUE_LENGTH, RUN_LOOP_QUEUE_ITEM_SIZE);
225c51a1d5aSMatthias Ringwald btstack_run_loop_callbacks_mutex = xSemaphoreCreateMutex();
2260c9cde95SMatthias Ringwald #endif
2277d5f5399SMatthias Ringwald
228828fd804SMatthias Ringwald #ifndef HAVE_FREERTOS_TASK_NOTIFICATIONS
2297d5f5399SMatthias Ringwald // event group to wake run loop
2307d5f5399SMatthias Ringwald btstack_run_loop_event_group = xEventGroupCreate();
231828fd804SMatthias Ringwald #endif
2327d5f5399SMatthias Ringwald
233f51d404eSMatthias Ringwald // task to handle to optimize 'run on main thread'
234a6f770a0SMatthias Ringwald btstack_run_loop_task = xTaskGetCurrentTaskHandle();
235a6f770a0SMatthias Ringwald
236f51d404eSMatthias Ringwald log_info("run loop init, task %p, queue item size %u", btstack_run_loop_task, (int) sizeof(function_call_t));
2377d5f5399SMatthias Ringwald }
2387d5f5399SMatthias Ringwald
2397d5f5399SMatthias Ringwald /**
2407d5f5399SMatthias Ringwald * @brief Provide btstack_run_loop_posix instance for use with btstack_run_loop_init
2417d5f5399SMatthias Ringwald */
2427d5f5399SMatthias Ringwald
2437d5f5399SMatthias Ringwald static const btstack_run_loop_t btstack_run_loop_freertos = {
2447d5f5399SMatthias Ringwald &btstack_run_loop_freertos_init,
245cd5f23a3SMatthias Ringwald &btstack_run_loop_base_add_data_source,
246cd5f23a3SMatthias Ringwald &btstack_run_loop_base_remove_data_source,
247cd5f23a3SMatthias Ringwald &btstack_run_loop_base_enable_data_source_callbacks,
248cd5f23a3SMatthias Ringwald &btstack_run_loop_base_disable_data_source_callbacks,
2497d5f5399SMatthias Ringwald &btstack_run_loop_freertos_set_timer,
250cd5f23a3SMatthias Ringwald &btstack_run_loop_base_add_timer,
251cd5f23a3SMatthias Ringwald &btstack_run_loop_base_remove_timer,
2527d5f5399SMatthias Ringwald &btstack_run_loop_freertos_execute,
253cd5f23a3SMatthias Ringwald &btstack_run_loop_base_dump_timer,
2547d5f5399SMatthias Ringwald &btstack_run_loop_freertos_get_time_ms,
2554fd33db7SMatthias Ringwald #if defined(HAVE_FREERTOS_TASK_NOTIFICATIONS) || (INCLUDE_xEventGroupSetBitFromISR == 1)
2564fd33db7SMatthias Ringwald &btstack_run_loop_freertos_poll_data_sources_from_irq,
2574fd33db7SMatthias Ringwald #else
2584fd33db7SMatthias Ringwald NULL,
2594fd33db7SMatthias Ringwald #endif
260c51a1d5aSMatthias Ringwald btstack_run_loop_freertos_execute_on_main_thread,
26138b6e836SMatthias Ringwald &btstack_run_loop_freertos_trigger_exit_internal,
2627d5f5399SMatthias Ringwald };
2633c4cc642SMatthias Ringwald
btstack_run_loop_freertos_get_instance(void)2643c4cc642SMatthias Ringwald const btstack_run_loop_t * btstack_run_loop_freertos_get_instance(void){
2653c4cc642SMatthias Ringwald return &btstack_run_loop_freertos;
2663c4cc642SMatthias Ringwald }
267c51a1d5aSMatthias Ringwald
268c51a1d5aSMatthias Ringwald
269c51a1d5aSMatthias Ringwald // @deprecated functions
270c51a1d5aSMatthias Ringwald
271c51a1d5aSMatthias Ringwald // schedules execution from regular thread
btstack_run_loop_freertos_trigger(void)272c51a1d5aSMatthias Ringwald void btstack_run_loop_freertos_trigger(void){
273c51a1d5aSMatthias Ringwald btstack_run_loop_freertos_trigger_from_thread();
274c51a1d5aSMatthias Ringwald }
275c51a1d5aSMatthias Ringwald
btstack_run_loop_freertos_execute_code_on_main_thread(void (* fn)(void * arg),void * arg)276c51a1d5aSMatthias Ringwald void btstack_run_loop_freertos_execute_code_on_main_thread(void (*fn)(void *arg), void * arg){
277c51a1d5aSMatthias Ringwald // directly call function if already on btstack task
278c51a1d5aSMatthias Ringwald if (xTaskGetCurrentTaskHandle() == btstack_run_loop_task){
279c51a1d5aSMatthias Ringwald (*fn)(arg);
280c51a1d5aSMatthias Ringwald return;
281c51a1d5aSMatthias Ringwald }
282c51a1d5aSMatthias Ringwald
283c51a1d5aSMatthias Ringwald function_call_t message;
284c51a1d5aSMatthias Ringwald message.fn = fn;
285c51a1d5aSMatthias Ringwald message.arg = arg;
286c51a1d5aSMatthias Ringwald BaseType_t res = xQueueSendToBack(btstack_run_loop_queue, &message, 0); // portMAX_DELAY);
287c51a1d5aSMatthias Ringwald if (res != pdTRUE){
288c51a1d5aSMatthias Ringwald log_error("Failed to post fn %p", fn);
289c51a1d5aSMatthias Ringwald }
290c51a1d5aSMatthias Ringwald btstack_run_loop_freertos_trigger();
291c51a1d5aSMatthias Ringwald }
292c51a1d5aSMatthias Ringwald
btstack_run_loop_freertos_trigger_exit(void)293c51a1d5aSMatthias Ringwald void btstack_run_loop_freertos_trigger_exit(void){
294c51a1d5aSMatthias Ringwald btstack_run_loop_freertos_trigger_exit_internal();
295c51a1d5aSMatthias Ringwald }
296c51a1d5aSMatthias Ringwald
297c51a1d5aSMatthias Ringwald #if defined(HAVE_FREERTOS_TASK_NOTIFICATIONS) || (INCLUDE_xEventGroupSetBitFromISR == 1)
btstack_run_loop_freertos_trigger_from_isr(void)298c51a1d5aSMatthias Ringwald void btstack_run_loop_freertos_trigger_from_isr(void){
299*1544bae6SMatthias Ringwald btstack_run_loop_freertos_poll_data_sources_from_irq();
300c51a1d5aSMatthias Ringwald }
301c51a1d5aSMatthias Ringwald #endif
302