1,8 → 1,9 |
#include <kernel/kern.h> |
#include "func.h" |
|
extern int cal_cycles; |
extern struct timespec zero_time; |
extern struct loader_task *loader_task_list; |
|
|
/* Delay Calibration */ |
int calibrate_cycle() |
{ |
24,7 → 25,7 |
} |
|
void *get_task_model(struct loader_task *current) { |
if (current->local_scheduler == LOADER_POSIX_SCHEDULER) { |
if (current->local_scheduler == PAR_POSIX) { |
static NRT_TASK_MODEL nrt; |
|
nrt_task_default_model(nrt); |
36,7 → 37,7 |
|
} |
|
if (current->local_scheduler == LOADER_EDF_SCHEDULER) { |
if (current->local_scheduler == PAR_EDF) { |
static HARD_TASK_MODEL ht; |
|
hard_task_default_model(ht); |
48,7 → 49,7 |
} |
|
|
if (current->local_scheduler == LOADER_RM_SCHEDULER) { |
if (current->local_scheduler == PAR_RM) { |
static HARD_TASK_MODEL ht; |
|
hard_task_default_model(ht); |
71,13 → 72,48 |
|
} |
|
void set_next_activation(struct timespec *next) { |
int calibration_func() { |
return kern_gettime(NULL); |
|
} |
|
void start_simulation() { |
|
int i, total_task; |
struct loader_task *l; |
struct timespec end_time; |
ADDTIMESPEC(&zero_time,next,&end_time); |
kern_event_post(&end_time,(void *)((void *)(task_activate(exec_shadow))),NULL); |
|
total_task = sizeof(loader_task_list)/sizeof(struct loader_task); |
i = 0; |
|
while (i<total_task) { |
if (l->act_number>0) { |
ADDTIMESPEC(&zero_time, &l->act[0], &end_time); |
l->act_current++; |
kern_event_post(&end_time,loader_task_activate,&l); |
i++; |
l=&loader_task_list[i]; |
} |
|
} |
|
} |
|
int calibration_func() { |
return kern_gettime(NULL); |
|
void loader_task_activate(struct loader_task *l) { |
|
struct timespec actual_time,end_time; |
|
kern_gettime(&actual_time); |
group_activate(l->group); |
|
if (l->act_number > l->act_current) { |
|
ADDTIMESPEC(&actual_time, &l->act[l->act_current], &end_time); |
|
l->act_current++; |
kern_event_post(&end_time,loader_task_activate,&l); |
|
} |
|
} |