diff options
Diffstat (limited to 'src/litmus.c')
-rw-r--r-- | src/litmus.c | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/src/litmus.c b/src/litmus.c index bb08e87..96ecebc 100644 --- a/src/litmus.c +++ b/src/litmus.c | |||
@@ -10,6 +10,40 @@ | |||
10 | #include "litmus.h" | 10 | #include "litmus.h" |
11 | #include "internal.h" | 11 | #include "internal.h" |
12 | 12 | ||
13 | #define LP(name) {name ## _SEM, #name} | ||
14 | |||
15 | static struct { | ||
16 | int id; | ||
17 | const char* name; | ||
18 | } protocol[] = { | ||
19 | LP(FMLP), | ||
20 | LP(SRP) | ||
21 | }; | ||
22 | |||
23 | #define NUM_PROTOS (sizeof(protocol)/sizeof(protocol[0])) | ||
24 | |||
25 | int lock_protocol_for_name(const char* name) | ||
26 | { | ||
27 | int i; | ||
28 | |||
29 | for (i = 0; i < NUM_PROTOS; i++) | ||
30 | if (strcmp(name, protocol[i].name) == 0) | ||
31 | return protocol[i].id; | ||
32 | |||
33 | return -1; | ||
34 | } | ||
35 | |||
36 | const char* name_for_lock_protocol(int id) | ||
37 | { | ||
38 | int i; | ||
39 | |||
40 | for (i = 0; i < NUM_PROTOS; i++) | ||
41 | if (protocol[i].id == id) | ||
42 | return protocol[i].name; | ||
43 | |||
44 | return "<UNKNOWN>"; | ||
45 | } | ||
46 | |||
13 | void show_rt_param(struct rt_task* tp) | 47 | void show_rt_param(struct rt_task* tp) |
14 | { | 48 | { |
15 | printf("rt params:\n\t" | 49 | printf("rt params:\n\t" |
@@ -42,15 +76,16 @@ int be_migrate_to(int target_cpu) | |||
42 | } | 76 | } |
43 | 77 | ||
44 | int sporadic_task(lt_t e, lt_t p, lt_t phase, int split, | 78 | int sporadic_task(lt_t e, lt_t p, lt_t phase, int split, |
45 | int cpu, task_class_t cls, | 79 | int cpu, unsigned int priority, task_class_t cls, |
46 | budget_policy_t budget_policy, int set_cpu_set) | 80 | budget_policy_t budget_policy, int set_cpu_set) |
47 | { | 81 | { |
48 | return sporadic_task_ns(e * NS_PER_MS, p * NS_PER_MS, phase * NS_PER_MS, | 82 | return sporadic_task_ns(e * NS_PER_MS, p * NS_PER_MS, phase * NS_PER_MS, |
49 | split, cpu, cls, budget_policy, set_cpu_set); | 83 | split, cpu, priority, cls, budget_policy, |
84 | set_cpu_set); | ||
50 | } | 85 | } |
51 | 86 | ||
52 | int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, int split, | 87 | int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, int split, |
53 | int cpu, task_class_t cls, | 88 | int cpu, unsigned int priority, task_class_t cls, |
54 | budget_policy_t budget_policy, int set_cpu_set) | 89 | budget_policy_t budget_policy, int set_cpu_set) |
55 | { | 90 | { |
56 | struct rt_task param; | 91 | struct rt_task param; |
@@ -65,6 +100,7 @@ int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, int split, | |||
65 | param.period = p; | 100 | param.period = p; |
66 | param.split = split; | 101 | param.split = split; |
67 | param.cpu = cpu; | 102 | param.cpu = cpu; |
103 | param.priority = priority; | ||
68 | param.cls = cls; | 104 | param.cls = cls; |
69 | param.phase = phase; | 105 | param.phase = phase; |
70 | param.budget_policy = budget_policy; | 106 | param.budget_policy = budget_policy; |