Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1670 | pj | 1 | #ifndef __HLP_H__ |
2 | #define __HLP_H__ |
||
3 | |||
4 | #include <kernel/model.h> |
||
5 | #include <kernel/descr.h> |
||
6 | #include "ll/sys/cdefs.h" |
||
7 | |||
8 | __BEGIN_DECLS |
||
9 | |||
10 | #define HLP_RCLASS 0x0600 |
||
11 | #define HLP2_RCLASS 0x0700 |
||
12 | |||
13 | /* ----------------------------------------------------------------------- |
||
14 | HLP_RES_MODEL: Stack Resource Policy resource model |
||
15 | ----------------------------------------------------------------------- */ |
||
16 | |||
17 | typedef struct { |
||
18 | RES_MODEL r; |
||
19 | DWORD preempt; /* the preemption level of a task */ |
||
20 | } HLP_RES_MODEL; |
||
21 | |||
22 | #define HLP_res_default_model(res, pre) \ |
||
23 | res_default_model((res).r, HLP_RCLASS); \ |
||
24 | (res).preempt = (pre) |
||
25 | #define HLP_res_def_level(res,l) res_def_level(res,l) |
||
26 | |||
27 | |||
28 | |||
29 | |||
30 | /* ----------------------------------------------------------------------- |
||
31 | HLP_mutexattr_t: Higher Locker Priority Mutex Attribute |
||
32 | ----------------------------------------------------------------------- */ |
||
33 | #define HLP_MCLASS 0x0700 |
||
34 | |||
35 | #define HLP_MUTEXATTR_INITIALIZER {HLP_MCLASS} |
||
36 | #define HLP_mutexattr_default(a) mutexattr_default(a, HLP_MCLASS) |
||
37 | |||
38 | |||
39 | RLEVEL HLP_register_module(void); |
||
40 | |||
41 | extern __inline__ RES_MODEL *HLP_usemutex(mutex_t *m) { |
||
42 | return (RES_MODEL *)m->opt; |
||
43 | }; |
||
44 | |||
45 | |||
46 | #define XHLP_INVALID_LOCK 12 |
||
47 | |||
48 | |||
49 | typedef mutexattr_t HLP_mutexattr_t; |
||
50 | |||
51 | #define HLP_MUTEXATTR_INITIALIZER {HLP_MCLASS} |
||
52 | #define HLP_mutexattr_default(a) mutexattr_default(a, HLP_MCLASS) |
||
53 | |||
54 | |||
55 | typedef struct HLP_mutexstruct_t HLP_mutex_t; |
||
56 | typedef struct HLP_taskliststruct_t HLP_tasklist_t; |
||
57 | |||
58 | /* this is the structure normally pointed by the opt field in the |
||
59 | mutex_t structure */ |
||
60 | struct HLP_mutexstruct_t { |
||
61 | RES_MODEL r; /*+ This little trick make possible the use of |
||
62 | HLP_usemutex +*/ |
||
63 | |||
64 | PID owner; /* process that owns the mutex, else nil */ |
||
65 | |||
66 | HLP_tasklist_t *tasklist; /* process list that can use(locking or not) |
||
67 | the mutex, ordered by preemption |
||
68 | level */ |
||
69 | |||
70 | struct HLP_mutexstruct_t *next; /* next mutex of the list */ |
||
71 | |||
72 | }; |
||
73 | |||
74 | struct HLP_taskliststruct_t { |
||
75 | |||
76 | PID pid; |
||
77 | |||
78 | DWORD preempt; /* preemption level */ |
||
79 | |||
80 | HLP_mutex_t *mutexlist; /* list of mutexes */ |
||
81 | |||
82 | HLP_tasklist_t *next; /* next task handled by HLP */ |
||
83 | HLP_tasklist_t *prev; /* prev task handled by HLP */ |
||
84 | |||
85 | }; |
||
86 | |||
87 | /* The HLP resource level descriptor */ |
||
88 | typedef struct { |
||
89 | mutex_resource_des m; /*+ the mutex interface +*/ |
||
90 | |||
91 | HLP_mutex_t *mutexlist; /*+ an unordered list of all created HLP |
||
92 | mutexes +*/ |
||
93 | |||
94 | HLP_tasklist_t *tasklist; /*+ An ordered list by preemption level |
||
95 | of all task handled by HLP +*/ |
||
96 | |||
97 | } HLP_mutex_resource_des; |
||
98 | |||
99 | __END_DECLS |
||
100 | #endif |