mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-10 06:40:23 +00:00
freertos: use xQueueCreateStatic instead of xQueueCreate if available
This commit is contained in:
parent
8291be9586
commit
0c9cde9532
@ -76,6 +76,24 @@ typedef struct function_call {
|
||||
|
||||
static const btstack_run_loop_t btstack_run_loop_freertos;
|
||||
|
||||
// pick allocation style, prefer static
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
#define USE_STATIC_ALLOC
|
||||
#elif( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
// ok, nothing to do
|
||||
#else
|
||||
#error "Either configSUPPORT_STATIC_ALLOCATION or configSUPPORT_DYNAMIC_ALLOCATION in FreeRTOSConfig.h must be 1"
|
||||
#endif
|
||||
|
||||
// queue to receive events: up to 2 calls from transport, rest for app
|
||||
#define RUN_LOOP_QUEUE_LENGTH 20
|
||||
#define RUN_LOOP_QUEUE_ITEM_SIZE sizeof(function_call_t)
|
||||
|
||||
#ifdef USE_STATIC_ALLOC
|
||||
static StaticQueue_t btstack_run_loop_queue_object;
|
||||
static uint8_t btstack_run_loop_queue_storage[ RUN_LOOP_QUEUE_LENGTH * RUN_LOOP_QUEUE_ITEM_SIZE ];
|
||||
#endif
|
||||
|
||||
static QueueHandle_t btstack_run_loop_queue;
|
||||
static TaskHandle_t btstack_run_loop_task;
|
||||
|
||||
@ -266,8 +284,11 @@ static void btstack_run_loop_freertos_disable_data_source_callbacks(btstack_data
|
||||
static void btstack_run_loop_freertos_init(void){
|
||||
timers = NULL;
|
||||
|
||||
// queue to receive events: up to 2 calls from transport, up to 3 for app
|
||||
btstack_run_loop_queue = xQueueCreate(20, sizeof(function_call_t));
|
||||
#ifdef USE_STATIC_ALLOC
|
||||
btstack_run_loop_queue = xQueueCreateStatic(RUN_LOOP_QUEUE_LENGTH, RUN_LOOP_QUEUE_ITEM_SIZE, btstack_run_loop_queue_storage, &btstack_run_loop_queue_object);
|
||||
#else
|
||||
btstack_run_loop_queue = xQueueCreate(RUN_LOOP_QUEUE_LENGTH, RUN_LOOP_QUEUE_ITEM_SIZE);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FREERTOS_TASK_NOTIFICATIONS
|
||||
// event group to wake run loop
|
||||
|
Loading…
x
Reference in New Issue
Block a user