hal_mutex.h 606 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef SUNXI_HAL_MUTEX_H
  2. #define SUNXI_HAL_MUTEX_H
  3. #ifdef __cplusplus
  4. extern "C"
  5. {
  6. #endif
  7. #ifdef CONFIG_KERNEL_FREERTOS
  8. #include <FreeRTOS.h>
  9. #include <semphr.h>
  10. typedef SemaphoreHandle_t hal_mutex_t;
  11. #else
  12. #include <rtthread.h>
  13. typedef rt_mutex_t hal_mutex_t;
  14. #endif
  15. #include <stdint.h>
  16. #include <stddef.h>
  17. hal_mutex_t hal_mutex_create(void);
  18. int hal_mutex_delete(hal_mutex_t mutex);
  19. int hal_mutex_lock(hal_mutex_t mutex);
  20. int hal_mutex_unlock(hal_mutex_t mutex);
  21. int hal_mutex_trylock(hal_mutex_t mutex);
  22. int hal_mutex_timedwait(hal_mutex_t mutex, int ticks);
  23. #ifdef __cplusplus
  24. }
  25. #endif
  26. #endif