20,11 → 20,11 |
|
/** |
------------ |
CVS : $Id: tbs.c,v 1.2 2002-10-28 07:55:55 pj Exp $ |
CVS : $Id: tbs.c,v 1.3 2002-11-11 08:32:07 pj Exp $ |
|
File: $File$ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2002-10-28 07:55:55 $ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2002-11-11 08:32:07 $ |
------------ |
|
This file contains the aperiodic server TBS (Total Bandwidth Server) |
84,7 → 84,7 |
struct timespec lastdline; /*+ the last deadline assigned to |
a TBS task +*/ |
|
QQUEUE wait; /*+ the wait queue of the TBS +*/ |
IQUEUE wait; /*+ the wait queue of the TBS +*/ |
PID activated; /*+ the task inserted in another queue +*/ |
|
int flags; /*+ the init flags... +*/ |
206,7 → 206,7 |
static void TBS_level_status(LEVEL l) |
{ |
TBS_level_des *lev = (TBS_level_des *)(level_table[l]); |
PID p = qq_queryfirst(&lev->wait); |
PID p = iq_query_first(&lev->wait); |
|
kern_printf("Wcet Check : %s\n", |
onoff(lev->flags & TBS_ENABLE_WCET_CHECK)); |
221,8 → 221,8 |
kern_printf("Activated: Pid: %2d Name: %10s Dl: %ld.%9ld nact: %d Stat: %s\n", |
lev->activated, |
proc_table[lev->activated].name, |
proc_table[lev->activated].timespec_priority.tv_sec, |
proc_table[lev->activated].timespec_priority.tv_nsec, |
iq_query_timespec(lev->activated, &lev->wait)->tv_sec, |
iq_query_timespec(lev->activated, &lev->wait)->tv_nsec, |
lev->nact[lev->activated], |
TBS_status_to_a(proc_table[lev->activated].status)); |
|
231,7 → 231,7 |
p, |
proc_table[p].name, |
TBS_status_to_a(proc_table[p].status)); |
p = proc_table[p].next; |
p = iq_query_next(p, &lev->wait); |
} |
} |
|
288,14 → 288,6 |
return 0; /* if the task p is chosen, it is always eligible */ |
} |
|
#ifdef __TEST1__ |
extern int testactive; |
extern struct timespec s_stime[]; |
extern TIME s_curr[]; |
extern TIME s_PID[]; |
extern int useds; |
#endif |
|
static void TBS_task_dispatch(LEVEL l, PID p, int nostop) |
{ |
TBS_level_des *lev = (TBS_level_des *)(level_table[l]); |
305,16 → 297,6 |
|
level_table[ lev->scheduling_level ]-> |
guest_dispatch(lev->scheduling_level,p,nostop); |
|
#ifdef __TEST1__ |
if (testactive) |
{ |
TIMESPEC_ASSIGN(&s_stime[useds], &schedule_time); |
s_curr[useds] = proc_table[p].avail_time; |
s_PID[useds] = p; |
useds++; |
} |
#endif |
} |
|
static void TBS_task_epilogue(LEVEL l, PID p) |
345,7 → 327,7 |
lev->lastdline.tv_sec, lev->lastdline.tv_nsec); |
#endif |
|
lev->activated = qq_getfirst(&lev->wait); |
lev->activated = iq_getfirst(&lev->wait); |
if (lev->activated != NIL) |
TBS_activation(lev); |
} |
372,7 → 354,7 |
} |
else { |
proc_table[p].status = TBS_WAIT; |
qq_insertlast(p, &lev->wait); |
iq_insertlast(p, &lev->wait); |
} |
} |
else if (lev->flag[p] & TBS_SAVE_ARRIVALS) |
417,12 → 399,12 |
// lev->nact[p] can be >0 only if the SAVE_ARRIVALS bit is set |
lev->nact[p]--; |
proc_table[p].status = TBS_WAIT; |
qq_insertlast(p, &lev->wait); |
iq_insertlast(p, &lev->wait); |
} |
else |
proc_table[p].status = SLEEP; |
|
lev->activated = qq_getfirst(&lev->wait); |
lev->activated = iq_getfirst(&lev->wait); |
if (lev->activated != NIL) |
TBS_activation(lev); |
|
438,9 → 420,9 |
TBS_bandwidth_reclaiming(lev,p); |
|
proc_table[p].status = FREE; |
q_insertfirst(p,&freedesc); |
iq_insertfirst(p,&freedesc); |
|
lev->activated = qq_getfirst(&lev->wait); |
lev->activated = iq_getfirst(&lev->wait); |
if (lev->activated != NIL) |
TBS_activation(lev); |
} |
465,21 → 447,12 |
|
lev->nact[p] = 0; |
|
lev->activated = qq_getfirst(&lev->wait); |
lev->activated = iq_getfirst(&lev->wait); |
if (lev->activated != NIL) |
TBS_activation(lev); |
|
} |
|
static void TBS_task_delay(LEVEL l, PID p, TIME usdelay) |
{ |
TBS_level_des *lev = (TBS_level_des *)(level_table[l]); |
|
level_table[ lev->scheduling_level ]-> |
guest_delay(lev->scheduling_level,p,usdelay); |
} |
|
|
static int TBS_guest_create(LEVEL l, PID p, TASK_MODEL *m) |
{ kern_raise(XINVALID_GUEST,exec_shadow); return 0; } |
|
510,12 → 483,9 |
static void TBS_guest_sleep(LEVEL l, PID p) |
{ kern_raise(XINVALID_GUEST,exec_shadow); } |
|
static void TBS_guest_delay(LEVEL l, PID p,DWORD tickdelay) |
{ kern_raise(XINVALID_GUEST,exec_shadow); } |
|
|
|
|
/* Registration functions */ |
|
/*+ Registration function: |
567,7 → 537,6 |
lev->l.task_endcycle = TBS_task_endcycle; |
lev->l.task_end = TBS_task_end; |
lev->l.task_sleep = TBS_task_sleep; |
lev->l.task_delay = TBS_task_delay; |
|
lev->l.guest_create = TBS_guest_create; |
lev->l.guest_detach = TBS_guest_detach; |
579,7 → 548,6 |
lev->l.guest_endcycle = TBS_guest_endcycle; |
lev->l.guest_end = TBS_guest_end; |
lev->l.guest_sleep = TBS_guest_sleep; |
lev->l.guest_delay = TBS_guest_delay; |
|
/* fill the TBS descriptor part */ |
|
590,7 → 558,7 |
|
NULL_TIMESPEC(&lev->lastdline); |
|
qq_init(&lev->wait); |
iq_init(&lev->wait, &freedesc, 0); |
lev->activated = NIL; |
|
lev->U = (MAX_BANDWIDTH / den) * num; |