aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/rt_launch.c13
-rw-r--r--include/litmus.h2
-rw-r--r--src/task.c5
3 files changed, 14 insertions, 6 deletions
diff --git a/bin/rt_launch.c b/bin/rt_launch.c
index 3863031..5c71d01 100644
--- a/bin/rt_launch.c
+++ b/bin/rt_launch.c
@@ -29,11 +29,12 @@ int launch(void *task_info_p) {
29} 29}
30 30
31void usage(char *error) { 31void usage(char *error) {
32 fprintf(stderr, "%s\nUsage: rt_launch [-w][-v][-p cpu][-c hrt | srt | be] wcet period program [arg1 arg2 ...]\n" 32 fprintf(stderr, "%s\nUsage: rt_launch [-w][-v][-p cpu][-c hrt | srt | be] [-m criticality] wcet period program [arg1 arg2 ...]\n"
33 "\t-w\tSynchronous release\n" 33 "\t-w\tSynchronous release\n"
34 "\t-v\tVerbose\n" 34 "\t-v\tVerbose\n"
35 "\t-p\tcpu (or initial cpu)\n" 35 "\t-p\tcpu (or initial cpu)\n"
36 "\t-c\tClass\n" 36 "\t-c\tClass\n"
37 "\t-m\tCriticality\n"
37 "\twcet, period in ms\n" 38 "\twcet, period in ms\n"
38 "\tprogram to be launched\n", 39 "\tprogram to be launched\n",
39 error); 40 error);
@@ -41,7 +42,7 @@ void usage(char *error) {
41} 42}
42 43
43 44
44#define OPTSTR "p:c:vw" 45#define OPTSTR "p:c:vwm:"
45 46
46int main(int argc, char** argv) 47int main(int argc, char** argv)
47{ 48{
@@ -51,6 +52,7 @@ int main(int argc, char** argv)
51 int migrate = 0; 52 int migrate = 0;
52 int cpu = 0; 53 int cpu = 0;
53 int opt; 54 int opt;
55 crit_level_t crit;
54 int verbose = 0; 56 int verbose = 0;
55 int wait = 0; 57 int wait = 0;
56 startup_info_t info; 58 startup_info_t info;
@@ -68,6 +70,11 @@ int main(int argc, char** argv)
68 cpu = atoi(optarg); 70 cpu = atoi(optarg);
69 migrate = 1; 71 migrate = 1;
70 break; 72 break;
73 case 'm':
74 crit = str2crit(optarg);
75 if (crit == -1)
76 usage("Unknown criticality level.");
77 break;
71 case 'c': 78 case 'c':
72 class = str2class(optarg); 79 class = str2class(optarg);
73 if (class == -1) 80 if (class == -1)
@@ -107,7 +114,7 @@ int main(int argc, char** argv)
107 if (ret < 0) 114 if (ret < 0)
108 bail_out("could not migrate to target partition"); 115 bail_out("could not migrate to target partition");
109 } 116 }
110 ret = __create_rt_task(launch, &info, cpu, wcet, period, class); 117 ret = __create_rt_task(launch, &info, cpu, crit, wcet, period, class);
111 118
112 119
113 if (ret < 0) 120 if (ret < 0)
diff --git a/include/litmus.h b/include/litmus.h
index c76f36e..632b9e1 100644
--- a/include/litmus.h
+++ b/include/litmus.h
@@ -84,7 +84,7 @@ typedef int (*rt_fn_t)(void*);
84 84
85/* These two functions configure the RT task to use enforced exe budgets */ 85/* These two functions configure the RT task to use enforced exe budgets */
86int create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, int period); 86int create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, int period);
87int __create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, 87int __create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, crit_level_t crit, int wcet,
88 int period, task_class_t cls); 88 int period, task_class_t cls);
89 89
90/* per-task modes */ 90/* per-task modes */
diff --git a/src/task.c b/src/task.c
index 4d237bd..11ee3cf 100644
--- a/src/task.c
+++ b/src/task.c
@@ -40,11 +40,12 @@ int __launch_rt_task(rt_fn_t rt_prog, void *rt_arg, rt_setup_fn_t setup,
40 return rt_task; 40 return rt_task;
41} 41}
42 42
43int __create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, int period, 43int __create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, crit_level_t crit, int wcet, int period,
44 task_class_t class) 44 task_class_t class)
45{ 45{
46 struct rt_task params; 46 struct rt_task params;
47 params.cpu = cpu; 47 params.cpu = cpu;
48 params.crit = crit;
48 params.period = period; 49 params.period = period;
49 params.exec_cost = wcet; 50 params.exec_cost = wcet;
50 params.cls = class; 51 params.cls = class;
@@ -57,7 +58,7 @@ int __create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, int period,
57} 58}
58 59
59int create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, int period) { 60int create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, int period) {
60 return __create_rt_task(rt_prog, arg, cpu, wcet, period, RT_CLASS_HARD); 61 return __create_rt_task(rt_prog, arg, cpu, CRIT_LEVEL_C, wcet, period, RT_CLASS_HARD);
61} 62}
62 63
63 64