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