forked from espressif/esp-idf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/ble_mesh_multi_adv_instance_support' into 'master'
Feature/ble mesh multi adv instance support Closes BLERP-1282 See merge request espressif/esp-idf!35208
- Loading branch information
Showing
22 changed files
with
2,135 additions
and
899 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef _BLE_MESH_QUEUE_H_ | ||
#define _BLE_MESH_QUEUE_H_ | ||
|
||
#include "mesh/kernel.h" | ||
#include "mesh/slist.h" | ||
#include "mesh/atomic.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef struct { | ||
QueueHandle_t handle; | ||
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC | ||
StaticQueue_t *buffer; | ||
uint8_t *storage; | ||
#endif | ||
} bt_mesh_queue_t; | ||
|
||
int bt_mesh_queue_init(bt_mesh_queue_t *queue, uint8_t queue_size, uint8_t item_size); | ||
int bt_mesh_queue_deinit(bt_mesh_queue_t *queue); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* _BLE_MESH_QUEUE_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include "mesh/common.h" | ||
#include "mesh/queue.h" | ||
|
||
int bt_mesh_queue_init(bt_mesh_queue_t *queue, uint8_t queue_size, uint8_t item_size) | ||
{ | ||
__ASSERT(queue && queue_size && item_size, "Invalid queue init parameters"); | ||
|
||
#if !CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC | ||
queue->handle = xQueueCreate(queue_size, item_size); | ||
__ASSERT(queue->handle, "Failed to create queue"); | ||
#else /* !CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC */ | ||
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL | ||
queue->buffer = heap_caps_calloc_prefer(1, sizeof(StaticQueue_t), 2, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT); | ||
#elif CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_IRAM_8BIT | ||
queue->buffer = heap_caps_calloc_prefer(1, sizeof(StaticQueue_t), 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT); | ||
#endif | ||
__ASSERT(queue->buffer, "Failed to create queue buffer"); | ||
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL | ||
queue->storage = heap_caps_calloc_prefer(1, (queue_size * item_size), 2, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT); | ||
#elif CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_IRAM_8BIT | ||
queue->storage = heap_caps_calloc_prefer(1, (queue_size * item_size), 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT); | ||
#endif | ||
__ASSERT(queue->storage, "Failed to create queue storage"); | ||
queue->handle = xQueueCreateStatic(queue_size, item_size, (uint8_t*)queue->storage, queue->buffer); | ||
__ASSERT(queue->handle, "Failed to create static queue"); | ||
#endif /* !CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC */ | ||
return 0; | ||
} | ||
|
||
int bt_mesh_queue_deinit(bt_mesh_queue_t *queue) | ||
{ | ||
__ASSERT(queue, "Invalid queue init parameters"); | ||
vQueueDelete(queue->handle); | ||
queue->handle = NULL; | ||
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC | ||
heap_caps_free(queue->buffer); | ||
queue->buffer = NULL; | ||
heap_caps_free(queue->storage); | ||
queue->storage = NULL; | ||
#endif | ||
return 0; | ||
} |
Oops, something went wrong.