84,7 → 84,9 |
|
/* flags */ |
#define EDFSTAR_FLAG_NORAISEEXC 2 |
#define EDFSTAR_FLAG_SPORADIC 1 |
|
|
/* the level redefinition for the Earliest Deadline First level */ |
typedef struct { |
level_des l; /* the standard level descriptor */ |
249,7 → 251,7 |
if (m->pclass != HARD_PCLASS) return -1; |
if (m->level != 0 && m->level != l) return -1; |
h = (HARD_TASK_MODEL *)m; |
if (!h->wcet || !h->mit || h->periodicity != PERIODIC) return -1; |
if (!h->wcet || !h->mit /* || h->periodicity != PERIODIC */) return -1; |
/* now we know that m is a valid model */ |
|
|
260,6 → 262,10 |
lev->period[p] = h->mit; |
|
lev->flag[p] = 0; |
|
if (h->periodicity == APERIODIC) |
lev->flag[p] |= EDFSTAR_FLAG_SPORADIC; |
|
lev->deadline_timer[p] = -1; |
lev->dline_miss[p] = 0; |
lev->wcet_miss[p] = 0; |
378,7 → 384,12 |
/* save activation (only if needed... */ |
if (proc_table[p].status != SLEEP) { |
/* a periodic task cannot be activated when it is already active */ |
kern_raise(XACTIVATION,p); |
/* but aperiodic task can be reactivate before */ |
if (lev->flag[p] & EDFSTAR_FLAG_SPORADIC) |
lev->nact[p]++; |
else |
kern_raise(XACTIVATION,p); |
|
return; |
} |
|
398,59 → 409,59 |
EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]); |
|
#ifdef EDFSTAR_DEBUG |
edfstar_printf("(E:ins)"); |
edfstar_printf("(E:ins)"); |
#endif |
|
/* Insert task in the correct position */ |
proc_table[p].status = EDFSTAR_READY; |
iq_timespec_insert(p,&lev->ready); |
/* Insert task in the correct position */ |
proc_table[p].status = EDFSTAR_READY; |
iq_timespec_insert(p,&lev->ready); |
|
/* and check for preemption! */ |
EDFSTAR_check_preemption(lev); |
/* and check for preemption! */ |
EDFSTAR_check_preemption(lev); |
} |
|
static void EDFSTAR_public_block(LEVEL l, PID p) |
{ |
EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]); |
EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]); |
|
#ifdef EDFSTAR_DEBUG |
edfstar_printf("(E:ext)"); |
edfstar_printf("(E:ext)"); |
#endif |
|
/* the task is blocked on a synchronization primitive. we have to |
remove it from the master module -and- from the local queue! */ |
iq_extract(p,&lev->ready); |
/* the task is blocked on a synchronization primitive. we have to |
remove it from the master module -and- from the local queue! */ |
iq_extract(p,&lev->ready); |
|
/* and finally, a preemption check! (it will also call guest_end) */ |
EDFSTAR_check_preemption(lev); |
/* and finally, a preemption check! (it will also call guest_end) */ |
EDFSTAR_check_preemption(lev); |
} |
|
static int EDFSTAR_public_message(LEVEL l, PID p, void *m) |
{ |
EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]); |
struct timespec temp; |
EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]); |
struct timespec temp; |
|
#ifdef EDFSTAR_DEBUG |
edfstar_printf("(E:ecy "); |
edfstar_printf("(E:ecy "); |
#endif |
|
switch ((long)(m)) { |
switch ((long)(m)) { |
|
/* Task EndCycle */ |
case (long)(NULL): |
/* Task EndCycle */ |
case (long)(NULL): |
|
/* we call guest_end directly here because the same task may |
be reinserted in the queue before calling the preemption check! */ |
level_table[ lev->scheduling_level ]-> |
private_extract(lev->scheduling_level,p); |
lev->activated = NIL; |
|
iq_extract(p,&lev->ready); |
|
/* we reset the capacity counters... */ |
proc_table[p].avail_time = proc_table[p].wcet; |
|
if (lev->nact[p] > 0) { |
/* we call guest_end directly here because the same task may |
be reinserted in the queue before calling the preemption check! */ |
level_table[ lev->scheduling_level ]-> |
private_extract(lev->scheduling_level,p); |
lev->activated = NIL; |
|
iq_extract(p,&lev->ready); |
|
/* we reset the capacity counters... */ |
proc_table[p].avail_time = proc_table[p].wcet; |
|
if (lev->nact[p] > 0) { |
|
#ifdef EDFSTAR_DEBUG |
edfstar_printf2("E%d",p); |
517,6 → 528,7 |
proc_table[p].status = FREE; |
|
iq_insertfirst(p,&freedesc); |
lev->activated=NIL; |
|
if (lev->deadline_timer[p] != -1) { |
kern_event_delete(lev->deadline_timer[p]); |