summaryrefslogtreecommitdiff
path: root/bsp/allwinner/libraries/sunxi-hal/include/osal/hal_mutex.h
blob: 5b69982c7a5b066a14cf5987244d609e020a24cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef SUNXI_HAL_MUTEX_H
#define SUNXI_HAL_MUTEX_H

#ifdef __cplusplus
extern "C"
{
#endif

#ifdef CONFIG_KERNEL_FREERTOS
#include <FreeRTOS.h>
#include <semphr.h>
typedef SemaphoreHandle_t hal_mutex_t;
#else
#include <rtthread.h>
typedef rt_mutex_t hal_mutex_t;
#endif
#include <stdint.h>
#include <stddef.h>

hal_mutex_t hal_mutex_create(void);
int hal_mutex_delete(hal_mutex_t mutex);
int hal_mutex_lock(hal_mutex_t  mutex);
int hal_mutex_unlock(hal_mutex_t  mutex);
int hal_mutex_trylock(hal_mutex_t  mutex);
int hal_mutex_timedwait(hal_mutex_t mutex, int ticks);

#ifdef __cplusplus
}
#endif

#endif