xref: /btstack/platform/freertos/btstack_run_loop_freertos.h (revision 2fca4dad957cd7b88f4657ed51e89c12615dda72)
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
23*2fca4dadSMilanka Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
24*2fca4dadSMilanka 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.h
407d5f5399SMatthias Ringwald  *
417d5f5399SMatthias Ringwald  * Functions relevant for BTstack WICED port
427d5f5399SMatthias Ringwald  */
437d5f5399SMatthias Ringwald 
4480e33422SMatthias Ringwald #ifndef BTSTACK_RUN_LOOP_FREERTOS_H
4580e33422SMatthias Ringwald #define BTSTACK_RUN_LOOP_FREERTOS_H
467d5f5399SMatthias Ringwald 
477d5f5399SMatthias Ringwald #include "btstack_config.h"
487d5f5399SMatthias Ringwald #include "btstack_run_loop.h"
497d5f5399SMatthias Ringwald 
507d5f5399SMatthias Ringwald #if defined __cplusplus
517d5f5399SMatthias Ringwald extern "C" {
527d5f5399SMatthias Ringwald #endif
537d5f5399SMatthias Ringwald 
547d5f5399SMatthias Ringwald /**
5538b6e836SMatthias Ringwald  * @brief Get btstack_run_loop_freertos instance for use with btstack_run_loop_init
567d5f5399SMatthias Ringwald  */
577d5f5399SMatthias Ringwald const btstack_run_loop_t * btstack_run_loop_freertos_get_instance(void);
587d5f5399SMatthias Ringwald 
5938b6e836SMatthias Ringwald /**
607d5f5399SMatthias Ringwald  * @brief Execute code on BTstack run loop. Can be used to control BTstack from a different thread
61c51a1d5aSMatthias Ringwald 
62c51a1d5aSMatthias Ringwald  * @deprecated Please use btstack_run_loop_execute_on_main_thread() instead
637d5f5399SMatthias Ringwald  */
647d5f5399SMatthias Ringwald void btstack_run_loop_freertos_execute_code_on_main_thread(void (*fn)(void *arg), void * arg);
657d5f5399SMatthias Ringwald 
667d5f5399SMatthias Ringwald /**
677d5f5399SMatthias Ringwald  * @brief Triggers processing of data sources from thread context.
687d5f5399SMatthias Ringwald  * Has to be called after enabling a poll data source to wake-pup run loop.
69c51a1d5aSMatthias Ringwald  *
70c51a1d5aSMatthias Ringwald  * @deprecated Please use btstack_run_loop_execute_on_main_thread() instead
717d5f5399SMatthias Ringwald  */
727d5f5399SMatthias Ringwald void btstack_run_loop_freertos_trigger(void);
737d5f5399SMatthias Ringwald 
747d5f5399SMatthias Ringwald /**
757d5f5399SMatthias Ringwald  * @brief Triggers processing of data sources from an ISR.
767d5f5399SMatthias Ringwald  * Has to be called after enabling a poll data source to wake-pup run loop.
7738b6e836SMatthias Ringwald  *
7838b6e836SMatthias Ringwald  * @deprecated Please call btstack_run_loop_poll_data_sources_from_irq() instead
797d5f5399SMatthias Ringwald  */
807d5f5399SMatthias Ringwald void btstack_run_loop_freertos_trigger_from_isr(void);
819dc32eb4SMatthias Ringwald 
829dc32eb4SMatthias Ringwald /**
839dc32eb4SMatthias Ringwald  * @brief Triggers exit of run loop from BTstack main thread, causes call to btstack_run_loop_execute to return
8438b6e836SMatthias Ringwald  *
8538b6e836SMatthias Ringwald  * @deprecated Please call btstack_run_loop_trigger_exit() instead
869dc32eb4SMatthias Ringwald  */
879dc32eb4SMatthias Ringwald void btstack_run_loop_freertos_trigger_exit(void);
887d5f5399SMatthias Ringwald 
897d5f5399SMatthias Ringwald /* API_END */
907d5f5399SMatthias Ringwald 
917d5f5399SMatthias Ringwald #if defined __cplusplus
927d5f5399SMatthias Ringwald }
937d5f5399SMatthias Ringwald #endif
947d5f5399SMatthias Ringwald 
9580e33422SMatthias Ringwald #endif // btstack_run_loop_WICED_H
96