mesh_mutex.h 1018 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef _BLE_MESH_MUTEX_H_
  7. #define _BLE_MESH_MUTEX_H_
  8. #include "mesh_kernel.h"
  9. #include "mesh_slist.h"
  10. #include "mesh_atomic.h"
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. typedef struct {
  15. SemaphoreHandle_t mutex;
  16. #if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC
  17. StaticQueue_t *buffer;
  18. #endif
  19. } bt_mesh_mutex_t;
  20. void bt_mesh_mutex_create(bt_mesh_mutex_t *mutex);
  21. void bt_mesh_mutex_free(bt_mesh_mutex_t *mutex);
  22. void bt_mesh_mutex_lock(bt_mesh_mutex_t *mutex);
  23. void bt_mesh_mutex_unlock(bt_mesh_mutex_t *mutex);
  24. void bt_mesh_alarm_lock(void);
  25. void bt_mesh_alarm_unlock(void);
  26. void bt_mesh_list_lock(void);
  27. void bt_mesh_list_unlock(void);
  28. void bt_mesh_buf_lock(void);
  29. void bt_mesh_buf_unlock(void);
  30. void bt_mesh_atomic_lock(void);
  31. void bt_mesh_atomic_unlock(void);
  32. void bt_mesh_mutex_init(void);
  33. void bt_mesh_mutex_deinit(void);
  34. #ifdef __cplusplus
  35. }
  36. #endif
  37. #endif /* _BLE_MESH_MUTEX_H_ */