summaryrefslogtreecommitdiff
path: root/lib/bt/esp_ble_mesh/common/include
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2025-07-25 13:33:07 +1000
committerjacqueline <me@jacqueline.id.au>2025-07-25 13:33:07 +1000
commitc8e79a926620e48830778714cfe4b2ea2453fcaf (patch)
tree8c756e08e01b8e147cf72bec128026f46bd854c5 /lib/bt/esp_ble_mesh/common/include
parent237136f3e93cb6b5be24670d7520adb17cc0fa36 (diff)
downloadtangara-fw-c8e79a926620e48830778714cfe4b2ea2453fcaf.tar.gz
Update forked idf components
Diffstat (limited to 'lib/bt/esp_ble_mesh/common/include')
-rw-r--r--lib/bt/esp_ble_mesh/common/include/mesh/atomic.h27
-rw-r--r--lib/bt/esp_ble_mesh/common/include/mesh/mutex.h7
-rw-r--r--lib/bt/esp_ble_mesh/common/include/mesh/queue.h33
-rw-r--r--lib/bt/esp_ble_mesh/common/include/mesh/utils.h2
4 files changed, 67 insertions, 2 deletions
diff --git a/lib/bt/esp_ble_mesh/common/include/mesh/atomic.h b/lib/bt/esp_ble_mesh/common/include/mesh/atomic.h
index f7283436..b2849743 100644
--- a/lib/bt/esp_ble_mesh/common/include/mesh/atomic.h
+++ b/lib/bt/esp_ble_mesh/common/include/mesh/atomic.h
@@ -148,6 +148,33 @@ extern bt_mesh_atomic_val_t bt_mesh_atomic_and(bt_mesh_atomic_t *target, bt_mesh
#endif
/**
+ * @brief Atomic CAS operation.
+ *
+ * This compares the contents of @a *target
+ * with the contents of @a excepted. If equal,
+ * the operation is a read-modify-write operation
+ * that writes @a new_val into @a *target and return true.
+ * If they are not equal, the operation is a read
+ * and return false.
+ *
+ * @param target Address of atomic variable.
+ * @param excepted Value of excepted.
+ * @param new_val Write if target value is equal to expected one.
+ *
+ * @return
+ * - true: Target value updated.
+ * - false: Target value not updated.
+ */
+#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
+static inline bool bt_mesh_atomic_cas(bt_mesh_atomic_t *target, bt_mesh_atomic_val_t excepted, bt_mesh_atomic_val_t new_val)
+{
+ return __atomic_compare_exchange_n(target, &excepted, &new_val, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+}
+#else
+extern bool bt_mesh_atomic_cas(bt_mesh_atomic_t *target, bt_mesh_atomic_val_t excepted, bt_mesh_atomic_val_t new_val);
+#endif
+
+/**
* @cond INTERNAL_HIDDEN
*/
diff --git a/lib/bt/esp_ble_mesh/common/include/mesh/mutex.h b/lib/bt/esp_ble_mesh/common/include/mesh/mutex.h
index ee897500..0cc47eb0 100644
--- a/lib/bt/esp_ble_mesh/common/include/mesh/mutex.h
+++ b/lib/bt/esp_ble_mesh/common/include/mesh/mutex.h
@@ -1,5 +1,5 @@
/*
- * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ * SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -32,6 +32,11 @@ void bt_mesh_r_mutex_free(bt_mesh_mutex_t *mutex);
void bt_mesh_r_mutex_lock(bt_mesh_mutex_t *mutex);
void bt_mesh_r_mutex_unlock(bt_mesh_mutex_t *mutex);
+void bt_mesh_c_semaphore_create(bt_mesh_mutex_t *mutex, int max, int init);
+void bt_mesh_c_semaphore_free(bt_mesh_mutex_t *mutex);
+void bt_mesh_c_semaphore_give(bt_mesh_mutex_t *mutex);
+void bt_mesh_c_semaphore_take(bt_mesh_mutex_t *mutex, uint32_t timeout);
+
void bt_mesh_alarm_lock(void);
void bt_mesh_alarm_unlock(void);
diff --git a/lib/bt/esp_ble_mesh/common/include/mesh/queue.h b/lib/bt/esp_ble_mesh/common/include/mesh/queue.h
new file mode 100644
index 00000000..021c99ba
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/common/include/mesh/queue.h
@@ -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, uint16_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_ */
diff --git a/lib/bt/esp_ble_mesh/common/include/mesh/utils.h b/lib/bt/esp_ble_mesh/common/include/mesh/utils.h
index 98243483..967fed2e 100644
--- a/lib/bt/esp_ble_mesh/common/include/mesh/utils.h
+++ b/lib/bt/esp_ble_mesh/common/include/mesh/utils.h
@@ -200,7 +200,7 @@ extern "C" {
* { MY_PWM0 , MY_PWM1 }
*
* @param LEN The length of the sequence. Must be an integer literal less
- * than 255.
+ * than 255 (ref: utils_loops.h).
* @param F A macro function that accepts at least two arguments:
* <tt>F(i, ...)</tt>. @p F is called repeatedly in the expansion.
* Its first argument @p i is the index in the sequence, and