diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-01-22 17:23:49 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-01-22 17:23:49 -0500 |
commit | e0a05caf790c5493b83ff6a060175a24b3317258 (patch) | |
tree | 910921deaba42708f7b57bdfb15349f3394b95be /include | |
parent | bacbb6f22c19f3e3bd41401b0743eabb7f3f2e94 (diff) |
core: cleanup header
Diffstat (limited to 'include')
-rw-r--r-- | include/litmus.h | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/include/litmus.h b/include/litmus.h index 1bffd12..794db1a 100644 --- a/include/litmus.h +++ b/include/litmus.h | |||
@@ -3,12 +3,8 @@ | |||
3 | 3 | ||
4 | #include <sys/types.h> | 4 | #include <sys/types.h> |
5 | 5 | ||
6 | /* This flag is needed to start new RT tasks in STOPPED state */ | 6 | /* A real-time program. */ |
7 | /* Task is going to run in realtime mode */ | ||
8 | #define CLONE_REALTIME 0x10000000 | ||
9 | |||
10 | typedef int (*rt_fn_t)(void*); | 7 | typedef int (*rt_fn_t)(void*); |
11 | typedef int (*rt_setup_fn_t)(int pid, void* arg); | ||
12 | 8 | ||
13 | /* Litmus scheduling policies */ | 9 | /* Litmus scheduling policies */ |
14 | typedef enum { | 10 | typedef enum { |
@@ -59,6 +55,7 @@ int set_rt_task_param(pid_t pid, rt_param_t* param); | |||
59 | int get_rt_task_param(pid_t pid, rt_param_t* param); | 55 | int get_rt_task_param(pid_t pid, rt_param_t* param); |
60 | int prepare_rt_task(pid_t pid); | 56 | int prepare_rt_task(pid_t pid); |
61 | 57 | ||
58 | /* setup helper */ | ||
62 | int sporadic_task(unsigned long exec_cost, unsigned long period, | 59 | int sporadic_task(unsigned long exec_cost, unsigned long period, |
63 | int partition, task_class_t cls); | 60 | int partition, task_class_t cls); |
64 | 61 | ||
@@ -68,20 +65,19 @@ int sporadic_task(unsigned long exec_cost, unsigned long period, | |||
68 | sporadic_task(e, p, cpu, RT_CLASS_SOFT) | 65 | sporadic_task(e, p, cpu, RT_CLASS_SOFT) |
69 | 66 | ||
70 | 67 | ||
68 | /* deprecated */ | ||
71 | enum { | 69 | enum { |
72 | LITMUS_RESERVED_RANGE = 1024, | 70 | LITMUS_RESERVED_RANGE = 1024, |
73 | } SCHED_SETUP_CMD; | 71 | } SCHED_SETUP_CMD; |
74 | |||
75 | int scheduler_setup(int cmd, void* param); | 72 | int scheduler_setup(int cmd, void* param); |
76 | 73 | ||
77 | |||
78 | /* file descriptor attached shared objects support */ | 74 | /* file descriptor attached shared objects support */ |
79 | |||
80 | typedef enum { | 75 | typedef enum { |
81 | PI_SEM = 0, | 76 | PI_SEM = 0, |
82 | SRP_SEM = 1, | 77 | SRP_SEM = 1, |
83 | ICS_ID = 2, | 78 | ICS_ID = 2, |
84 | } obj_type_t; | 79 | } obj_type_t; |
80 | |||
85 | int od_openx(int fd, obj_type_t type, int obj_id, void* config); | 81 | int od_openx(int fd, obj_type_t type, int obj_id, void* config); |
86 | int od_close(int od); | 82 | int od_close(int od); |
87 | 83 | ||
@@ -102,7 +98,6 @@ int get_job_no(unsigned int* job_no); | |||
102 | int wait_for_job_release(unsigned int job_no); | 98 | int wait_for_job_release(unsigned int job_no); |
103 | int sleep_next_period(void); | 99 | int sleep_next_period(void); |
104 | 100 | ||
105 | |||
106 | /* interruptible critical section support */ | 101 | /* interruptible critical section support */ |
107 | #define MAX_ICS_NESTING 16 | 102 | #define MAX_ICS_NESTING 16 |
108 | #define ICS_STACK_EMPTY (-1) | 103 | #define ICS_STACK_EMPTY (-1) |
@@ -131,8 +126,6 @@ struct ics_cb { | |||
131 | int reg_ics_cb(struct ics_cb* ics_cb); | 126 | int reg_ics_cb(struct ics_cb* ics_cb); |
132 | int start_wcs(int od); | 127 | int start_wcs(int od); |
133 | 128 | ||
134 | |||
135 | |||
136 | /* library functions */ | 129 | /* library functions */ |
137 | void init_litmus(void); | 130 | void init_litmus(void); |
138 | /* exit is currently unused, but was needed for syscall | 131 | /* exit is currently unused, but was needed for syscall |
@@ -141,13 +134,10 @@ void init_litmus(void); | |||
141 | */ | 134 | */ |
142 | #define exit_litmus() {} | 135 | #define exit_litmus() {} |
143 | 136 | ||
144 | |||
145 | |||
146 | int create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, int period); | 137 | int create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, int period); |
147 | int __create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, | 138 | int __create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, |
148 | int period, task_class_t cls); | 139 | int period, task_class_t cls); |
149 | 140 | ||
150 | |||
151 | /* per-task modes */ | 141 | /* per-task modes */ |
152 | enum rt_task_mode_t { | 142 | enum rt_task_mode_t { |
153 | BACKGROUND_TASK = 0, | 143 | BACKGROUND_TASK = 0, |
@@ -155,19 +145,24 @@ enum rt_task_mode_t { | |||
155 | }; | 145 | }; |
156 | int task_mode(int target_mode); | 146 | int task_mode(int target_mode); |
157 | 147 | ||
158 | |||
159 | const char* get_scheduler_name(spolicy scheduler); | 148 | const char* get_scheduler_name(spolicy scheduler); |
160 | void show_rt_param(rt_param_t* tp); | 149 | void show_rt_param(rt_param_t* tp); |
161 | task_class_t str2class(const char* str); | 150 | task_class_t str2class(const char* str); |
162 | 151 | ||
152 | /* non-preemptive section support */ | ||
163 | void enter_np(void); | 153 | void enter_np(void); |
164 | void exit_np(void); | 154 | void exit_np(void); |
165 | 155 | ||
156 | /* Returns 1 if the task is still active. | ||
157 | * Use it for main job loop. | ||
158 | */ | ||
166 | int litmus_task_active(); | 159 | int litmus_task_active(); |
167 | 160 | ||
168 | 161 | ||
169 | /* low level operations, not intended for API use */ | 162 | /* low level operations, not intended for API use */ |
170 | int fork_rt(void); | 163 | |
164 | /* prepare a real-time task */ | ||
165 | typedef int (*rt_setup_fn_t)(int pid, void* arg); | ||
171 | int __launch_rt_task(rt_fn_t rt_prog, void *rt_arg, | 166 | int __launch_rt_task(rt_fn_t rt_prog, void *rt_arg, |
172 | rt_setup_fn_t setup, void* setup_arg); | 167 | rt_setup_fn_t setup, void* setup_arg); |
173 | 168 | ||