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

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [include/] [l4/] [api/] [mutex.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
#ifndef __MUTEX_CONTROL_H__
2
#define __MUTEX_CONTROL_H__
3
 
4
/* Request ids for mutex_control syscall */
5
 
6
#if defined (__KERNEL__)
7
#define MUTEX_CONTROL_LOCK              L4_MUTEX_LOCK
8
#define MUTEX_CONTROL_UNLOCK            L4_MUTEX_UNLOCK
9
 
10
#define MUTEX_CONTROL_OPMASK            L4_MUTEX_OPMASK
11
 
12
#define mutex_operation(x)      ((x) & MUTEX_CONTROL_OPMASK)
13
#define mutex_contenders(x)     ((x) & ~MUTEX_CONTROL_OPMASK)
14
 
15
#include <l4/lib/wait.h>
16
#include <l4/lib/list.h>
17
#include <l4/lib/mutex.h>
18
 
19
/*
20
 * Contender threashold is the total number of contenders
21
 * who are expected to sleep on the mutex, and will be waited
22
 * for a wakeup.
23
 */
24
struct mutex_queue {
25
        int contenders;
26
        unsigned long physical;
27
        struct link list;
28
        struct waitqueue_head wqh_contenders;
29
        struct waitqueue_head wqh_holders;
30
};
31
 
32
/*
33
 * Mutex queue head keeps the list of all userspace mutexes.
34
 *
35
 * Here, mutex_control_mutex is a single lock for:
36
 * (1) Mutex_queue create/deletion
37
 * (2) List add/removal.
38
 * (3) Wait synchronization:
39
 *     - Both waitqueue spinlocks need to be acquired for
40
 *       rendezvous inspection to occur atomically. Currently
41
 *       it's not done since we rely on this mutex for that.
42
 */
43
struct mutex_queue_head {
44
        struct link list;
45
        struct mutex mutex_control_mutex;
46
        int count;
47
};
48
 
49
void init_mutex_queue_head(struct mutex_queue_head *mqhead);
50
 
51
#endif
52
 
53
#define L4_MUTEX_OPMASK         0xF0000000
54
#define L4_MUTEX_LOCK           0x10000000
55
#define L4_MUTEX_UNLOCK         0x20000000
56
 
57
#endif /* __MUTEX_CONTROL_H__*/

powered by: WebSVN 2.1.0

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