Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 236 → Rev 237

/shark/trunk/ports/first/modules/cbsstar.c
154,14 → 154,12
 
}
}
if (b->flags == CBSSTAR_NOACTIVE) {
kern_gettime(&b->dline);
ADDUSEC2TIMESPEC(b->T, &b->dline);
 
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
169,8 → 167,7
}
 
static void CBSSTAR_activation(CBSSTAR_level_des *lev,
PID p,
struct timespec *acttime)
PID p)
{
JOB_TASK_MODEL job;
struct budget_struct *b = &lev->b[lev->tb[p]];
177,18 → 174,13
/* 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;
 
220,16 → 212,7
 
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);
}
}
 
 
334,12 → 317,14
 
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 */
struct timespec t;
kern_gettime(&t);
CBSSTAR_activation(lev,p,&t);
CBSSTAR_activation(lev,p);
} 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
347,6 → 332,11
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
368,7 → 358,8
/* 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);
381,11 → 372,10
else if (lev->b[lev->tb[p]].flags) {
/* if so, insert the new task into the master module */
PID n;
struct timespec t;
 
n = iq_getfirst(&lev->b[lev->tb[p]].tasks);
CBSSTAR_activation(lev,n);
kern_gettime(&t);
n = iq_getfirst(&lev->b[lev->tb[p]].tasks);
CBSSTAR_activation(lev,n,&t); // it modifies b[lev->tb[p]].current
}
else
lev->b[lev->tb[p]].current=NIL;