18,11 → 18,11 |
|
/** |
------------ |
CVS : $Id: edfact.c,v 1.1.1.1 2002-09-02 09:37:41 pj Exp $ |
CVS : $Id: edfact.c,v 1.3 2002-11-11 07:55:55 pj Exp $ |
|
File: $File$ |
Revision: $Revision: 1.1.1.1 $ |
Last update: $Date: 2002-09-02 09:37:41 $ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2002-11-11 07:55:55 $ |
------------ |
**/ |
|
84,7 → 84,7 |
/*+ used to manage the JOB_TASK_MODEL and the |
periodicity +*/ |
|
QUEUE ready; /*+ the ready queue +*/ |
IQUEUE ready; /*+ the ready queue +*/ |
|
int flags; /*+ the init flags... +*/ |
|
97,16 → 97,20 |
|
static void EDFACT_internal_activate(EDFACT_level_des *lev, PID p) |
{ |
TIMESPEC_ASSIGN(&proc_table[p].timespec_priority, |
struct timespec *temp; |
|
temp = iq_query_timespec(p, &lev->ready); |
|
TIMESPEC_ASSIGN(temp, |
&proc_table[p].request_time); |
ADDUSEC2TIMESPEC(lev->period[p], &proc_table[p].timespec_priority); |
ADDUSEC2TIMESPEC(lev->period[p], temp); |
|
TIMESPEC_ASSIGN(&lev->deadline_timespec[p], |
&proc_table[p].timespec_priority); |
temp); |
|
/* Insert task in the correct position */ |
proc_table[p].status = EDFACT_READY; |
q_timespec_insert(p,&lev->ready); |
iq_timespec_insert(p,&lev->ready); |
|
/* needed because when there is a wcet miss I disable CONTROL_CAP */ |
proc_table[p].control |= CONTROL_CAP; |
134,9 → 138,9 |
switch (proc_table[p].status) { |
case EDFACT_IDLE: |
edfact_printf("I%d",p); |
TIMESPEC_ASSIGN(&proc_table[p].request_time, |
&proc_table[p].timespec_priority); |
|
*iq_query_timespec(p, &lev->ready) = proc_table[p].request_time; |
|
EDFACT_internal_activate(lev,p); |
|
event_need_reschedule(); |
201,7 → 205,7 |
static void EDFACT_level_status(LEVEL l) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
PID p = lev->ready; |
PID p = iq_query_first(&lev->ready); |
|
kern_printf("On-line guarantee : %s\n", |
onoff(lev->flags & EDFACT_ENABLE_GUARANTEE)); |
217,10 → 221,10 |
proc_table[p].name, |
"Period ", |
lev->period[p], |
proc_table[p].timespec_priority.tv_sec, |
proc_table[p].timespec_priority.tv_nsec/1000, |
iq_query_timespec(p, &lev->ready)->tv_sec, |
iq_query_timespec(p, &lev->ready)->tv_nsec/1000, |
EDFACT_status_to_a(proc_table[p].status)); |
p = proc_table[p].next; |
p = iq_query_next(p, &lev->ready); |
} |
|
for (p=0; p<MAX_PROC; p++) |
231,8 → 235,8 |
proc_table[p].name, |
"Period ", |
lev->period[p], |
proc_table[p].timespec_priority.tv_sec, |
proc_table[p].timespec_priority.tv_nsec/1000, |
iq_query_timespec(p, &lev->ready)->tv_sec, |
iq_query_timespec(p, &lev->ready)->tv_nsec/1000, |
EDFACT_status_to_a(proc_table[p].status)); |
} |
|
251,7 → 255,7 |
kern_printf(") "); |
} |
*/ |
return (PID)lev->ready; |
return iq_query_first(&lev->ready); |
} |
|
/* The on-line guarantee is enabled only if the appropriate flag is set... */ |
348,7 → 352,7 |
/* the task state is set EXE by the scheduler() |
we extract the task from the ready queue |
NB: we can't assume that p is the first task in the queue!!! */ |
q_extract(p, &lev->ready); |
iq_extract(p, &lev->ready); |
} |
|
static void EDFACT_task_epilogue(LEVEL l, PID p) |
364,7 → 368,7 |
} |
|
/* the task it returns into the ready queue... */ |
q_timespec_insert(p,&lev->ready); |
iq_timespec_insert(p,&lev->ready); |
proc_table[p].status = EDFACT_READY; |
} |
|
397,7 → 401,7 |
|
/* Insert task in the coEDFect position */ |
proc_table[p].status = EDFACT_READY; |
q_timespec_insert(p,&lev->ready); |
iq_timespec_insert(p,&lev->ready); |
} |
|
static void EDFACT_task_extract(LEVEL l, PID p) |
424,7 → 428,7 |
EDFACT_internal_activate(lev,p); |
|
/* check if the deadline has already expired */ |
if (TIMESPEC_A_LT_B(&proc_table[p].timespec_priority, &schedule_time)) { |
if (TIMESPEC_A_LT_B(iq_query_timespec(p, &lev->ready), &schedule_time)) { |
/* count the deadline miss */ |
lev->dline_miss[p]++; |
event_delete(lev->deadline_timer[p]); |
450,7 → 454,7 |
|
/* we finally put the task in the ready queue */ |
proc_table[p].status = FREE; |
q_insertfirst(p,&freedesc); |
iq_insertfirst(p,&freedesc); |
/* and free the allocated bandwidth */ |
lev->U -= (MAX_BANDWIDTH/lev->period[p]) * proc_table[p].wcet; |
|
461,10 → 465,8 |
} |
|
static void EDFACT_task_sleep(LEVEL l, PID p) |
{ kern_raise(XUNVALID_TASK,exec_shadow); } |
{ kern_raise(XINVALID_TASK,exec_shadow); } |
|
static void EDFACT_task_delay(LEVEL l, PID p, TIME usdelay) |
{ kern_raise(XUNVALID_TASK,exec_shadow); } |
|
/* Guest Functions |
These functions manages a JOB_TASK_MODEL, that is used to put |
478,7 → 480,7 |
/* if the EDFACT_guest_create is called, then the pclass must be a |
valid pclass. */ |
|
TIMESPEC_ASSIGN(&proc_table[p].timespec_priority, &job->deadline); |
TIMESPEC_ASSIGN(iq_query_timespec(p, &lev->ready), &job->deadline); |
|
lev->deadline_timer[p] = -1; |
lev->dline_miss[p] = 0; |
512,7 → 514,7 |
/* the task state is set to EXE by the scheduler() |
we extract the task from the ready queue |
NB: we can't assume that p is the first task in the queue!!! */ |
q_extract(p, &lev->ready); |
iq_extract(p, &lev->ready); |
} |
|
static void EDFACT_guest_epilogue(LEVEL l, PID p) |
520,7 → 522,7 |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
|
/* the task has been preempted. it returns into the ready queue... */ |
q_timespec_insert(p,&lev->ready); |
iq_timespec_insert(p,&lev->ready); |
proc_table[p].status = EDFACT_READY; |
} |
|
529,12 → 531,12 |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
|
/* Insert task in the correct position */ |
q_timespec_insert(p,&lev->ready); |
iq_timespec_insert(p,&lev->ready); |
proc_table[p].status = EDFACT_READY; |
|
/* Set the deadline timer */ |
if (!(lev->flag[p] & EDFACT_FLAG_NORAISEEXC)) |
lev->deadline_timer[p] = kern_event_post(&proc_table[p].timespec_priority, |
lev->deadline_timer[p] = kern_event_post(iq_query_timespec(p, &lev->ready), |
EDFACT_timer_guest_deadline, |
(void *)p); |
|
545,7 → 547,7 |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
|
/* Insert task in the correct position */ |
q_timespec_insert(p,&lev->ready); |
iq_timespec_insert(p,&lev->ready); |
proc_table[p].status = EDFACT_READY; |
} |
|
554,7 → 556,7 |
} |
|
static void EDFACT_guest_endcycle(LEVEL l, PID p) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
{ kern_raise(XINVALID_GUEST,exec_shadow); } |
|
static void EDFACT_guest_end(LEVEL l, PID p) |
{ |
563,7 → 565,7 |
//kern_printf("EDFACT_guest_end: dline timer %d\n",lev->deadline_timer[p]); |
if (proc_table[p].status == EDFACT_READY) |
{ |
q_extract(p, &lev->ready); |
iq_extract(p, &lev->ready); |
//kern_printf("(g_end rdy extr)"); |
} |
|
577,11 → 579,8 |
} |
|
static void EDFACT_guest_sleep(LEVEL l, PID p) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
{ kern_raise(XINVALID_GUEST,exec_shadow); } |
|
static void EDFACT_guest_delay(LEVEL l, PID p, TIME usdelay) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
|
/* Registration functions */ |
|
/*+ Registration function: |
633,7 → 632,6 |
lev->l.task_endcycle = EDFACT_task_endcycle; |
lev->l.task_end = EDFACT_task_end; |
lev->l.task_sleep = EDFACT_task_sleep; |
lev->l.task_delay = EDFACT_task_delay; |
|
lev->l.guest_create = EDFACT_guest_create; |
lev->l.guest_detach = EDFACT_guest_detach; |
645,7 → 643,6 |
lev->l.guest_endcycle = EDFACT_guest_endcycle; |
lev->l.guest_end = EDFACT_guest_end; |
lev->l.guest_sleep = EDFACT_guest_sleep; |
lev->l.guest_delay = EDFACT_guest_delay; |
|
/* fill the EDFACT descriptor part */ |
for(i=0; i<MAX_PROC; i++) { |
657,7 → 654,7 |
lev->nact[i] = 0; |
} |
|
lev->ready = NIL; |
iq_init(&lev->ready,&freedesc, 0); |
lev->flags = flags & 0x07; |
lev->U = 0; |
} |