20,11 → 20,11 |
|
/** |
------------ |
CVS : $Id: cbs.c,v 1.4 2003-01-07 17:07:50 pj Exp $ |
CVS : $Id: cbs.c,v 1.5 2003-05-05 07:31:43 pj Exp $ |
|
File: $File$ |
Revision: $Revision: 1.4 $ |
Last update: $Date: 2003-01-07 17:07:50 $ |
Revision: $Revision: 1.5 $ |
Last update: $Date: 2003-05-05 07:31:43 $ |
------------ |
|
This file contains the aperiodic server CBS (Total Bandwidth Server) |
259,17 → 259,12 |
{ |
CBS_level_des *lev = (CBS_level_des *)(level_table[l]); |
|
if (lev->flags & CBS_FAILED_GUARANTEE) { |
*freebandwidth = 0; |
return 0; |
if (*freebandwidth >= lev->U) { |
*freebandwidth -= lev->U; |
return 1; |
} |
else |
if (*freebandwidth >= lev->U) { |
*freebandwidth -= lev->U; |
return 1; |
} |
else |
return 0; |
return 0; |
} |
|
static int CBS_public_create(LEVEL l, PID p, TASK_MODEL *m) |
284,6 → 279,17 |
|
soft = (SOFT_TASK_MODEL *)m; |
|
if (lev->flags & CBS_ENABLE_GUARANTEE) { |
bandwidth_t b; |
b = (MAX_BANDWIDTH / soft->period) * soft->met; |
|
/* really update lev->U, checking an overflow... */ |
if (MAX_BANDWIDTH - lev->U > b) |
lev->U += b; |
else |
return -1; |
} |
|
/* Enable wcet check */ |
proc_table[p].avail_time = soft->met; |
proc_table[p].wcet = soft->met; |
301,21 → 307,6 |
if (soft->arrivals == SAVE_ARRIVALS) |
lev->flag[p] |= CBS_SAVE_ARRIVALS; |
|
/* update the bandwidth... */ |
if (lev->flags & CBS_ENABLE_GUARANTEE) { |
bandwidth_t b; |
b = (MAX_BANDWIDTH / soft->period) * soft->met; |
|
/* really update lev->U, checking an overflow... */ |
if (MAX_BANDWIDTH - lev->U > b) |
lev->U += b; |
else |
/* The task can NOT be guaranteed (U>MAX_BANDWIDTH)... |
(see EDF.c) */ |
lev->flags |= CBS_FAILED_GUARANTEE; |
} |
|
|
return 0; /* OK, also if the task cannot be guaranteed... */ |
} |
|
322,15 → 313,13 |
static void CBS_public_detach(LEVEL l, PID p) |
{ |
/* the CBS level doesn't introduce any dinamic allocated new field. |
we have only to reset the NO_GUARANTEE FIELD and decrement the allocated |
bandwidth */ |
we have only to decrement the allocated bandwidth */ |
|
CBS_level_des *lev = (CBS_level_des *)(level_table[l]); |
|
if (lev->flags & CBS_FAILED_GUARANTEE) |
lev->flags &= ~CBS_FAILED_GUARANTEE; |
else |
if (lev->flags & CBS_ENABLE_GUARANTEE) { |
lev->U -= (MAX_BANDWIDTH / lev->period[p]) * proc_table[p].wcet; |
} |
} |
|
static int CBS_public_eligible(LEVEL l, PID p) |
566,7 → 555,7 |
|
lev->scheduling_level = master; |
|
lev->flags = flags & 0x01; |
lev->flags = flags; |
|
return l; |
} |