OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [libl4/] [include/] [l4lib/] [mutex.h] - Blame information for rev 7

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
 
2
/*
3
 * User space locking
4
 *
5
 * Copyright (C) 2009 Bahadir Bilgehan Balban
6
 */
7
 
8
#ifndef __L4_MUTEX_H__
9
#define __L4_MUTEX_H__
10
 
11
 
12
#if !defined(__ASSEMBLY__)
13
 
14
#include <l4/api/mutex.h>
15
 
16
struct l4_mutex {
17
        int lock;
18
} __attribute__((aligned(sizeof(int))));
19
 
20
 
21
void l4_mutex_init(struct l4_mutex *m);
22
int l4_mutex_lock(struct l4_mutex *m);
23
int l4_mutex_unlock(struct l4_mutex *m);
24
 
25
#endif
26
 
27
/* Mutex return value - don't mix up with mutes state */
28
#define L4_MUTEX_CONTENDED      -1
29
#define L4_MUTEX_SUCCESS        0
30
 
31
/*
32
 * Mutex states:
33
 * Unlocked = -1, locked = 0, anything above 0 tells
34
 * number of contended threads
35
 */
36
#define L4_MUTEX_LOCKED                 0
37
#define L4_MUTEX_UNLOCKED               -1
38
#define L4_MUTEX(m)     \
39
        struct l4_mutex m = { L4_MUTEX_UNLOCKED }
40
 
41
 
42
#endif /* __L4_MUTEX_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.