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

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [include/] [l4/] [generic/] [cap-types.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Types of capabilities and their operations
3
 *
4
 * Copyright (C) 2009 Bahadir Balban
5
 */
6
#ifndef __CAP_TYPES_H__
7
#define __CAP_TYPES_H__
8
 
9
/*
10
 * Capability types
11
 */
12
#define CAP_TYPE_MASK           0x0000FFFF
13
#define CAP_TYPE_TCTRL          (1 << 0)
14
#define CAP_TYPE_EXREGS         (1 << 1)
15
#define CAP_TYPE_MAP_PHYSMEM    (1 << 2)
16
#define CAP_TYPE_MAP_VIRTMEM    (1 << 3)
17
#define CAP_TYPE_IPC            (1 << 4)
18
#define CAP_TYPE_IRQCTRL        (1 << 5)
19
#define CAP_TYPE_UMUTEX         (1 << 6)
20
#define CAP_TYPE_QUANTITY       (1 << 7)
21
#define CAP_TYPE_CAP            (1 << 8)
22
#define cap_type(c)     ((c)->type & CAP_TYPE_MASK)
23
 
24
/*
25
 * Resource types
26
 */
27
#define CAP_RTYPE_MASK          0xFFFF0000
28
#define CAP_RTYPE_THREAD        (1 << 16)
29
#define CAP_RTYPE_SPACE         (1 << 17)
30
#define CAP_RTYPE_CONTAINER     (1 << 18)
31
#define CAP_RTYPE_CPUPOOL       (1 << 19)
32
#define CAP_RTYPE_THREADPOOL    (1 << 20)
33
#define CAP_RTYPE_SPACEPOOL     (1 << 21)
34
#define CAP_RTYPE_MUTEXPOOL     (1 << 22)
35
#define CAP_RTYPE_MAPPOOL       (1 << 23) /* For pmd spending */
36
#define CAP_RTYPE_CAPPOOL       (1 << 24) /* For new cap generation */
37
 
38
#define cap_rtype(c)    ((c)->type & CAP_RTYPE_MASK)
39
#define cap_set_rtype(c, rtype)                 \
40
        {(c)->type &= ~CAP_RTYPE_MASK;          \
41
         (c)->type |= CAP_RTYPE_MASK & rtype;}
42
 
43
/*
44
 * User-defined device-types
45
 * (Kept in the user field)
46
 */
47
#define CAP_DEVTYPE_TIMER               1
48
#define CAP_DEVTYPE_UART                2
49
#define CAP_DEVTYPE_KEYBOARD            3
50
#define CAP_DEVTYPE_MOUSE               4
51
#define CAP_DEVTYPE_CLCD                5
52
#define CAP_DEVTYPE_OTHER               0xF
53
#define CAP_DEVTYPE_MASK                0xFFFF
54
#define CAP_DEVNUM_MASK                 0xFFFF0000
55
#define CAP_DEVNUM_SHIFT                16
56
 
57
#define cap_is_devmem(c)                ((c)->attr)
58
#define cap_set_devtype(c, devtype)                     \
59
        {(c)->attr &= ~CAP_DEVTYPE_MASK;                \
60
         (c)->attr |= CAP_DEVTYPE_MASK & devtype;}
61
#define cap_set_devnum(c, devnum)                       \
62
        {(c)->attr &= ~CAP_DEVNUM_MASK;         \
63
         (c)->attr |= CAP_DEVNUM_MASK & (devnum << CAP_DEVNUM_SHIFT);}
64
#define cap_devnum(c)                                   \
65
        (((c)->attr & CAP_DEVNUM_MASK) >> CAP_DEVNUM_SHIFT)
66
#define cap_devtype(c)          ((c)->attr & CAP_DEVTYPE_MASK)
67
 
68
/*
69
 * Access permissions
70
 */
71
 
72
/* Generic permissions */
73
#define CAP_CHANGEABLE          (1 << 28)       /* Can modify contents */
74
#define CAP_TRANSFERABLE        (1 << 29)       /* Can grant or share it */
75
#define CAP_REPLICABLE          (1 << 30)       /* Can create copies */
76
#define CAP_GENERIC_MASK        0xF0000000
77
#define CAP_IMMUTABLE                   0
78
#define cap_generic_perms(c)    \
79
        ((c)->access & CAP_GENERIC_MASK)
80
 
81
/* Thread control capability */
82
#define CAP_TCTRL_CREATE        (1 << 0)
83
#define CAP_TCTRL_DESTROY       (1 << 1)
84
#define CAP_TCTRL_RUN           (1 << 2)
85
#define CAP_TCTRL_SUSPEND       (1 << 3)
86
#define CAP_TCTRL_RECYCLE       (1 << 4)
87
#define CAP_TCTRL_WAIT          (1 << 5)
88
 
89
/* Exchange registers capability */
90
#define CAP_EXREGS_RW_PAGER     (1 << 0)
91
#define CAP_EXREGS_RW_UTCB      (1 << 1)
92
#define CAP_EXREGS_RW_SP        (1 << 2)
93
#define CAP_EXREGS_RW_PC        (1 << 3)
94
#define CAP_EXREGS_RW_REGS      (1 << 4) /* Other regular regs */
95
#define CAP_EXREGS_RW_CPU       (1 << 5)
96
#define CAP_EXREGS_RW_CPUTIME   (1 << 6)
97
 
98
/* Map capability */
99
#define CAP_MAP_READ            (1 << 0)
100
#define CAP_MAP_WRITE           (1 << 1)
101
#define CAP_MAP_EXEC            (1 << 2)
102
#define CAP_MAP_CACHED          (1 << 3)
103
#define CAP_MAP_UNCACHED        (1 << 4)
104
#define CAP_MAP_UNMAP           (1 << 5)
105
#define CAP_MAP_UTCB            (1 << 6)
106
 
107
/* Cache operations, applicable to (virtual) memory regions */
108
#define CAP_CACHE_INVALIDATE            (1 << 7)
109
#define CAP_CACHE_CLEAN                 (1 << 8)
110
 
111
/*
112
 * IRQ Control capability
113
 */
114
#define CAP_IRQCTRL_WAIT        (1 << 8)
115
 
116
/*
117
 * This is a common one and it applies to both
118
 * CAP_TYPE_IRQCTRL and CAP_TYPE_MAP_PHYSMEM
119
 */
120
#define CAP_IRQCTRL_REGISTER    (1 << 7)
121
 
122
 
123
 
124
/* Ipc capability */
125
#define CAP_IPC_SEND            (1 << 0)
126
#define CAP_IPC_RECV            (1 << 1)
127
#define CAP_IPC_SHORT           (1 << 2)
128
#define CAP_IPC_FULL            (1 << 3)
129
#define CAP_IPC_EXTENDED        (1 << 4)
130
#define CAP_IPC_ASYNC           (1 << 5)
131
 
132
/* Userspace mutex capability */
133
#define CAP_UMUTEX_LOCK         (1 << 0)
134
#define CAP_UMUTEX_UNLOCK       (1 << 1)
135
 
136
/* Capability control capability */
137
#define CAP_CAP_GRANT           (1 << 0)
138
#define CAP_CAP_READ            (1 << 1)
139
#define CAP_CAP_SHARE           (1 << 2)
140
#define CAP_CAP_REPLICATE       (1 << 3)
141
#define CAP_CAP_SPLIT           (1 << 4)
142
#define CAP_CAP_DEDUCE          (1 << 5)
143
#define CAP_CAP_DESTROY         (1 << 6)
144
#define CAP_CAP_MODIFY          (CAP_CAP_DEDUCE | CAP_CAP_SPLIT \
145
                                 | CAP_CAP_DESTROY)
146
 
147
 
148
#endif /* __CAP_TYPES_H__ */

powered by: WebSVN 2.1.0

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