blob: d0587aaf370b82ede7bd34d6f0362e32d8b72ee7 (
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
32
33
|
#ifndef __MVF_SEMA4__
#define __MVF_SEMA4__
#define MVF_SHMEM_SEMAPHORE_NUMBER (1)
#define MVF_PRINTF_SEMAPHORE_NUMBER (2)
#define MVF_I2C_SEMAPHORE_NUMBER (3)
#define MVF_RESERVED1_SEMAPHORE_NUMBER (4)
#define MVF_RESERVED2_SEMAPHORE_NUMBER (5)
#ifdef __KERNEL__
#include <linux/sched.h>
typedef struct mvf_sema4_handle_struct {
int gate_num;
wait_queue_head_t wait_queue;
// stats
u32 attempts;
u32 interrupts;
u32 failures;
struct timeval request_time;
u64 total_latency_us;
u32 worst_latency_us;
} MVF_SEMA4;
int mvf_sema4_assign(int gate_num, MVF_SEMA4** sema4_p);
int mvf_sema4_deassign(MVF_SEMA4 *sema4);
int mvf_sema4_lock(MVF_SEMA4 *sema4, unsigned int timeout_us, bool use_interrupts);
int mvf_sema4_unlock(MVF_SEMA4 *sema4);
int mvf_sema4_test(MVF_SEMA4 *sema4);
#endif /* __KERNEL__ */
#endif /* __MVF_SEMA4__ */
|