1 #ifndef SUNXI_HAL_SEM_H 2 #define SUNXI_HAL_SEM_H 3 4 #ifdef __cplusplus 5 extern "C" 6 { 7 #endif 8 #include <stddef.h> 9 #include <stdint.h> 10 11 #ifdef CONFIG_KERNEL_FREERTOS 12 #include <FreeRTOS.h> 13 #include <semphr.h> 14 typedef SemaphoreHandle_t hal_sem_t; 15 #else 16 #include <rtthread.h> 17 typedef rt_sem_t hal_sem_t; 18 #endif 19 20 hal_sem_t hal_sem_create(unsigned int cnt); 21 int hal_sem_delete(hal_sem_t sem); 22 int hal_sem_getvalue(hal_sem_t sem, int *val); 23 int hal_sem_post(hal_sem_t sem); 24 int hal_sem_timedwait(hal_sem_t sem, int ticks); 25 int hal_sem_trywait(hal_sem_t sem); 26 int hal_sem_wait(hal_sem_t sem); 27 int hal_sem_clear(hal_sem_t sem); 28 29 #ifdef __cplusplus 30 } 31 #endif 32 #endif 33