154,12 → 154,14 |
|
} |
} |
|
kern_gettime(&b->dline); |
ADDUSEC2TIMESPEC(b->T, &b->dline); |
|
if (b->flags == CBSSTAR_NOACTIVE) { |
kern_gettime(&b->dline); |
ADDUSEC2TIMESPEC(b->T, &b->dline); |
|
b->dline_timer=kern_event_post(&b->dline, CBSSTAR_deadline_timer_hardreservation, b); |
} |
|
|
#ifdef CBSSTAR_DEBUG |
cbsstar_printf(")"); |
#endif |
167,7 → 169,8 |
} |
|
static void CBSSTAR_activation(CBSSTAR_level_des *lev, |
PID p) |
PID p, |
struct timespec *acttime) |
{ |
JOB_TASK_MODEL job; |
struct budget_struct *b = &lev->b[lev->tb[p]]; |
174,13 → 177,18 |
/* we have to check if the deadline and the wcet are correct before |
activating a new task or an old task... */ |
|
/* check 1: if the deadline is before than the actual scheduling time */ |
if (TIMESPEC_A_LT_B(&b->dline, acttime)) { |
TIMESPEC_ASSIGN(&b->dline, acttime); |
ADDUSEC2TIMESPEC(b->T, &b->dline); |
} |
|
/* and the capacity */ |
if (b->flags == CBSSTAR_INIT) { |
b->avail = b->Q; |
b->flags = CBSSTAR_ACTIVE; |
} |
} |
|
|
/* record the current task inserted in the master module */ |
b->current = p; |
|
212,7 → 220,16 |
|
if (b->avail <= 0) b->flags = CBSSTAR_NOACTIVE; |
|
if (TIMESPEC_A_LT_B(&b->dline, &schedule_time)) { |
/* we modify the deadline ... */ |
TIMESPEC_ASSIGN(&b->dline, &schedule_time); |
ADDUSEC2TIMESPEC(b->T, &b->dline); |
} |
|
if (b->flags == CBSSTAR_NOACTIVE && b->dline_timer == NIL) { |
b->dline_timer=kern_event_post(&b->dline, CBSSTAR_deadline_timer_hardreservation, b); |
} |
|
} |
|
|
317,14 → 334,12 |
|
lev->tb[p] = budget->b; |
|
|
kern_gettime(&lev->b[budget->b].dline); |
ADDUSEC2TIMESPEC(lev->b[budget->b].T,&lev->b[budget->b].dline); |
|
if (lev->b[budget->b].current == NIL && lev->b[budget->b].flags ) { |
/* This is the first task in the budget, |
the task have to be inserted into the master module */ |
CBSSTAR_activation(lev,p); |
struct timespec t; |
kern_gettime(&t); |
CBSSTAR_activation(lev,p,&t); |
} else { |
/* The budget is not empty, another task is already into the |
master module, so the task is inserted at the end of the budget |
332,11 → 347,6 |
iq_insertlast(p,&lev->b[budget->b].tasks); |
} |
|
if (lev->b[budget->b].dline_timer == NIL) { |
lev->b[budget->b].dline_timer = kern_event_post(&lev->b[budget->b].dline, CBSSTAR_deadline_timer_hardreservation, &lev->b[budget->b]); |
} |
|
|
#ifdef CBSSTAR_DEBUG |
cbsstar_printf(")"); |
#endif |
358,8 → 368,7 |
/* remove the task from execution (or from the ready queue) */ |
if (lev->b[lev->tb[p]].current == p) { |
|
CBSSTAR_account_capacity(lev,p); |
|
CBSSTAR_account_capacity(lev,p); |
/* remove the task from the master module */ |
level_table[ lev->scheduling_level ]-> |
private_extract(lev->scheduling_level, p); |
372,10 → 381,11 |
else if (lev->b[lev->tb[p]].flags) { |
/* if so, insert the new task into the master module */ |
PID n; |
|
struct timespec t; |
|
kern_gettime(&t); |
n = iq_getfirst(&lev->b[lev->tb[p]].tasks); |
CBSSTAR_activation(lev,n); |
|
CBSSTAR_activation(lev,n,&t); // it modifies b[lev->tb[p]].current |
} |
else |
lev->b[lev->tb[p]].current=NIL; |