Microchip® Advanced Software Framework

btstack_run_loop_freertos.c File Reference
#include <stddef.h>
#include "btstack_linked_list.h"
#include "btstack_debug.h"
#include "btstack_run_loop_freertos.h"
#include "hal_time_ms.h"
#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"
#include "event_groups.h"

Data Structures

struct  function_call
 

Macros

#define __BTSTACK_FILE__   "btstack_run_loop_freertos.c"
 
#define ENABLE_LOG_DEBUG
 
#define EVENT_GROUP_FLAG_RUN_LOOP   1
 

Typedefs

typedef struct function_call function_call_t
 

Functions

static void btstack_run_loop_freertos_add_data_source (btstack_data_source_t *ds)
 
static void btstack_run_loop_freertos_add_timer (btstack_timer_source_t *ts)
 Add timer to run_loop (keep list sorted) More...
 
static void btstack_run_loop_freertos_disable_data_source_callbacks (btstack_data_source_t *ds, uint16_t callback_types)
 
static void btstack_run_loop_freertos_dump_timer (void)
 
static void btstack_run_loop_freertos_enable_data_source_callbacks (btstack_data_source_t *ds, uint16_t callback_types)
 
static void btstack_run_loop_freertos_execute (void)
 Execute run_loop. More...
 
void btstack_run_loop_freertos_execute_code_on_main_thread (void(*fn)(void *arg), void *arg)
 
const btstack_run_loop_tbtstack_run_loop_freertos_get_instance (void)
 Provide btstack_run_loop_posix instance for use with btstack_run_loop_init. More...
 
static uint32_t btstack_run_loop_freertos_get_time_ms (void)
 
static void btstack_run_loop_freertos_init (void)
 
static int btstack_run_loop_freertos_remove_data_source (btstack_data_source_t *ds)
 
static int btstack_run_loop_freertos_remove_timer (btstack_timer_source_t *ts)
 Remove timer from run loop. More...
 
static void btstack_run_loop_freertos_set_timer (btstack_timer_source_t *ts, uint32_t timeout_in_ms)
 
void btstack_run_loop_freertos_trigger (void)
 Triggers processing of data sources from thread context. More...
 

Variables

static EventGroupHandle_t btstack_run_loop_event_group
 
static const btstack_run_loop_t btstack_run_loop_freertos
 
static QueueHandle_t btstack_run_loop_queue
 
static btstack_linked_list_t data_sources
 
static btstack_linked_list_t timers
 

#define __BTSTACK_FILE__   "btstack_run_loop_freertos.c"
#define ENABLE_LOG_DEBUG
#define EVENT_GROUP_FLAG_RUN_LOOP   1

static void btstack_run_loop_freertos_add_data_source ( btstack_data_source_t ds)
static
static void btstack_run_loop_freertos_add_timer ( btstack_timer_source_t ts)
static

Add timer to run_loop (keep list sorted)

References btstack_timer_source::item, log_error, btstack_linked_item::next, and btstack_timer_source::timeout.

static void btstack_run_loop_freertos_disable_data_source_callbacks ( btstack_data_source_t ds,
uint16_t  callback_types 
)
static
static void btstack_run_loop_freertos_dump_timer ( void  )
static
static void btstack_run_loop_freertos_enable_data_source_callbacks ( btstack_data_source_t ds,
uint16_t  callback_types 
)
static
void btstack_run_loop_freertos_execute_code_on_main_thread ( void(*)(void *arg)  fn,
void *  arg 
)
const btstack_run_loop_t* btstack_run_loop_freertos_get_instance ( void  )

Provide btstack_run_loop_posix instance for use with btstack_run_loop_init.

Provide btstack_run_loop_freertos instance for use with btstack_run_loop_init.

References btstack_run_loop_freertos.

Referenced by bt_task(), and main().

static uint32_t btstack_run_loop_freertos_get_time_ms ( void  )
static
static void btstack_run_loop_freertos_init ( void  )
static
static int btstack_run_loop_freertos_remove_data_source ( btstack_data_source_t ds)
static
static int btstack_run_loop_freertos_remove_timer ( btstack_timer_source_t ts)
static

Remove timer from run loop.

References btstack_linked_list_remove().

Referenced by btstack_run_loop_freertos_execute().

static void btstack_run_loop_freertos_set_timer ( btstack_timer_source_t ts,
uint32_t  timeout_in_ms 
)
static
void btstack_run_loop_freertos_trigger ( void  )

Triggers processing of data sources from thread context.

Has to be called after enabling a poll data source to wake-pup run loop.

References btstack_run_loop_event_group, btstack_run_loop_task, eSetBits, EVENT_GROUP_FLAG_RUN_LOOP, xEventGroupSetBits(), and xTaskNotify.

Referenced by btstack_run_loop_freertos_execute_code_on_main_thread().

static const btstack_run_loop_t btstack_run_loop_freertos
static
Initial value:
= {
}
static void btstack_run_loop_freertos_init(void)
Definition: btstack_run_loop_freertos.c:248
static void btstack_run_loop_freertos_execute(void)
Execute run_loop.
Definition: btstack_run_loop_freertos.c:178
static void btstack_run_loop_freertos_set_timer(btstack_timer_source_t *ts, uint32_t timeout_in_ms)
Definition: btstack_run_loop_freertos.c:89
static void btstack_run_loop_freertos_dump_timer(void)
Definition: btstack_run_loop_freertos.c:120
static void btstack_run_loop_freertos_disable_data_source_callbacks(btstack_data_source_t *ds, uint16_t callback_types)
Definition: btstack_run_loop_freertos.c:244
static int btstack_run_loop_freertos_remove_data_source(btstack_data_source_t *ds)
Definition: btstack_run_loop_freertos.c:236
static uint32_t btstack_run_loop_freertos_get_time_ms(void)
Definition: btstack_run_loop_freertos.c:84
static void btstack_run_loop_freertos_add_timer(btstack_timer_source_t *ts)
Add timer to run_loop (keep list sorted)
Definition: btstack_run_loop_freertos.c:97
static void btstack_run_loop_freertos_add_data_source(btstack_data_source_t *ds)
Definition: btstack_run_loop_freertos.c:232
static void btstack_run_loop_freertos_enable_data_source_callbacks(btstack_data_source_t *ds, uint16_t callback_types)
Definition: btstack_run_loop_freertos.c:240
static int btstack_run_loop_freertos_remove_timer(btstack_timer_source_t *ts)
Remove timer from run loop.
Definition: btstack_run_loop_freertos.c:116

Referenced by btstack_run_loop_freertos_get_instance().

btstack_linked_list_t data_sources
static
btstack_linked_list_t timers
static