mutex.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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_r_mutex_create(bt_mesh_mutex_t *mutex);
  25. void bt_mesh_r_mutex_free(bt_mesh_mutex_t *mutex);
  26. void bt_mesh_r_mutex_lock(bt_mesh_mutex_t *mutex);
  27. void bt_mesh_r_mutex_unlock(bt_mesh_mutex_t *mutex);
  28. void bt_mesh_alarm_lock(void);
  29. void bt_mesh_alarm_unlock(void);
  30. void bt_mesh_list_lock(void);
  31. void bt_mesh_list_unlock(void);
  32. void bt_mesh_buf_lock(void);
  33. void bt_mesh_buf_unlock(void);
  34. void bt_mesh_atomic_lock(void);
  35. void bt_mesh_atomic_unlock(void);
  36. void bt_mesh_mutex_init(void);
  37. void bt_mesh_mutex_deinit(void);
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #endif /* _BLE_MESH_MUTEX_H_ */