Rev 1233 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
#include <func.h>
/* Delay Calibration */
int calibrate_cycle()
{
long long i;
struct timespec start,end,diff;
kern_cli();
kern_gettime(&start);
for (i=0;i<CALIBRATION_DELTA;i++) kern_gettime(NULL);
kern_gettime(&end);
kern_sti();
SUBTIMESPEC(&end,&start,&diff);
cal_cycles = TIMESPEC2USEC(&diff);
cprintf("Calibration usec/[%d cycles] = %d\n",CALIBRATION_DELTA,cal_cycles);
return 0;
}
void *get_task_model(task_loader *current) {
if (current->local_scheduler == LOADER_POSIX_SCHEDULER) {
static NRT_TASK_MODEL nrt;
nrt_task_default_model(nrt);
nrt_task_def_save_arrivals(nrt);
nrt_task_def_ctrl_jet(nrt);
nrt_task_def_usemath(nrt);
return &nrt;
}
if (current->local_scheduler == LOADER_EDF_SCHEDULER) {
static HARD_TASK_MODEL ht;
hard_task_default_model(ht);
hard_task_def_ctrl_jet(ht);
hard_task_def_mit(ht,TIMESPEC2USEC(¤t->deadline));
hard_task_def_wcet(ht,TIMESPEC2USEC(¤t->wcet));
hard_task_def_usemath(ht);
return &ht;
}
if (current->local_scheduler == LOADER_RM_SCHEDULER) {
static HARD_TASK_MODEL ht;
hard_task_default_model(ht);
hard_task_def_mit(ht,TIMESPEC2USEC(¤t->deadline));
hard_task_def_wcet(ht,TIMESPEC2USEC(¤t->wcet));
hard_task_def_ctrl_jet(ht);
hard_task_def_usemath(ht);
return &ht;
}
}
void set_simulation_time (struct timespec *total) {
struct timespec end_time;
kern_gettime(&zero_time);
loader_first_execution(start_loader_task);
ADDTIMESPEC(&zero_time,total,&end_time);
kern_event_post(&end_time,(void *)((void *)(sys_end)),NULL);
}
void set_next_activation(struct timespec *next) {
struct timespec end_time;
ADDTIMESPEC(&zero_time,next,&end_time);
kern_event_post(&end_time,(void *)((void *)(task_activate(exec_shadow))),NULL);
}