Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 211 → Rev 212

/shark/trunk/kernel/modules/cbs.c
20,11 → 20,11
 
/**
------------
CVS : $Id: cbs.c,v 1.5 2003-05-05 07:31:43 pj Exp $
CVS : $Id: cbs.c,v 1.6 2003-07-23 09:59:11 giacomo Exp $
 
File: $File$
Revision: $Revision: 1.5 $
Last update: $Date: 2003-05-05 07:31:43 $
Revision: $Revision: 1.6 $
Last update: $Date: 2003-07-23 09:59:11 $
------------
 
This file contains the aperiodic server CBS (Total Bandwidth Server)
80,6 → 80,7
/*+ task flags +*/
#define CBS_SAVE_ARRIVALS 1
#define CBS_APERIODIC 2
#define CBS_SLEEP 4
 
/*+ the level redefinition for the Total Bandwidth Server level +*/
typedef struct {
145,7 → 146,7
/* if (TIMESPEC_A_LT_B(&lev->cbs_dline[p], acttime) )
kern_printf("$");
else
kern_printf("(Ûdline%d.%d act%d.%d wcet%d per%d avail%dÛ)",
kern_printf("(Ûdline%d.%d act%d.%d wcet%d per%d avail%dÛ)",
lev->cbs_dline[p].tv_sec,lev->cbs_dline[p].tv_nsec/1000,
acttime->tv_sec, acttime->tv_nsec/1000,
proc_table[p].wcet, lev->period[p], proc_table[p].avail_time);
210,6 → 211,13
if (p==5) cbs_counter++;
#endif
 
if (lev->flag[p] & CBS_SLEEP && proc_table[p].status == CBS_IDLE) {
proc_table[p].status = SLEEP;
proc_table[p].avail_time = proc_table[p].wcet;
NULL_TIMESPEC(&lev->cbs_dline[p]);
return;
}
 
if (proc_table[p].status == CBS_IDLE) {
/* the task has finished the current activation and must be
reactivated */
400,6 → 408,11
CBS_level_des *lev = (CBS_level_des *)(level_table[l]);
struct timespec t;
 
if (lev->flag[p] & CBS_SLEEP) {
lev->flag[p] &= ~CBS_SLEEP;
if (proc_table[p].status != SLEEP) return;
}
 
/* save activation (only if needed... */
if (proc_table[p].status != SLEEP) {
if (lev->flag[p] & CBS_SAVE_ARRIVALS)
456,29 → 469,43
{
CBS_level_des *lev = (CBS_level_des *)(level_table[l]);
 
/* check if the wcet is finished... */
CBS_avail_time_check(lev, p);
switch((long)(m)) {
 
if (lev->nact[p]) {
/* continue!!!! */
lev->nact[p]--;
level_table[ lev->scheduling_level ]->
private_epilogue(lev->scheduling_level,p);
}
else {
level_table[ lev->scheduling_level ]->
private_extract(lev->scheduling_level,p);
case (long)(NULL):
 
if (lev->flag[p] & CBS_APERIODIC)
proc_table[p].status = SLEEP;
else /* the task is soft_periodic */
proc_table[p].status = CBS_IDLE;
/* check if the wcet is finished... */
CBS_avail_time_check(lev, p);
 
if (lev->nact[p]) {
/* continue!!!! */
lev->nact[p]--;
level_table[ lev->scheduling_level ]->
private_epilogue(lev->scheduling_level,p);
} else {
level_table[ lev->scheduling_level ]->
private_extract(lev->scheduling_level,p);
 
if (lev->flag[p] & CBS_APERIODIC)
proc_table[p].status = SLEEP;
else /* the task is soft_periodic */
proc_table[p].status = CBS_IDLE;
}
 
jet_update_endcycle(); /* Update the Jet data... */
trc_logevent(TRC_ENDCYCLE,&exec_shadow); /* tracer stuff */
 
break;
 
case 1:
 
lev->flag[p] |= CBS_SLEEP;
 
break;
 
}
 
jet_update_endcycle(); /* Update the Jet data... */
trc_logevent(TRC_ENDCYCLE,&exec_shadow); /* tracer stuff */
return 0;
 
return 0;
}
 
static void CBS_public_end(LEVEL l, PID p)