platform_mutex.h 683 B

123456789101112131415161718192021222324
  1. /*
  2. * @Author: jiejie
  3. * @Github: https://github.com/jiejieTop
  4. * @Date: 2019-12-15 18:31:33
  5. * @LastEditTime: 2020-04-27 17:04:46
  6. * @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
  7. */
  8. #ifndef _PLATFORM_MUTEX_H_
  9. #define _PLATFORM_MUTEX_H_
  10. #include "FreeRTOS.h"
  11. #include "semphr.h"
  12. typedef struct platform_mutex {
  13. SemaphoreHandle_t mutex;
  14. } platform_mutex_t;
  15. int platform_mutex_init(platform_mutex_t* m);
  16. int platform_mutex_lock(platform_mutex_t* m);
  17. int platform_mutex_trylock(platform_mutex_t* m);
  18. int platform_mutex_unlock(platform_mutex_t* m);
  19. int platform_mutex_destroy(platform_mutex_t* m);
  20. #endif