45,7 → 45,9 |
|
#include <tracer.h> |
|
#define ELASTIC_EMPTY_SLOT 0 |
#define ELASTIC_EMPTY_SLOT 0 |
#define ELASTIC_PRESENT 1 |
#define ELASTIC_SAVE_ARRIVALS 2 |
|
typedef struct { |
|
56,6 → 58,8 |
|
TIME period; |
TIME wcet; |
|
bandwidth_t Up; |
|
int kelastic; |
int beta; |
81,6 → 85,18 |
|
} ELASTIC_level_des; |
|
static int ELASTIC_recompute() { |
|
return 0; |
|
} |
|
static int ELASTIC_check_guarantie() { |
|
return 0; |
|
} |
|
static void ELASTIC_activation(ELASTIC_level_des *lev, |
PID p, |
struct timespec *acttime) |
102,12 → 118,8 |
{ |
ELASTIC_level_des *lev = (ELASTIC_level_des *)(level_table[l]); |
|
if (*freebandwidth >= lev->U) { |
*freebandwidth -= lev->U; |
return 1; |
} |
else |
return 0; |
return 0; |
|
} |
|
static int ELASTIC_public_create(LEVEL l, PID p, TASK_MODEL *m) |
119,6 → 131,40 |
if (m->level != 0 && m->level != l) return -1; |
elastic = (ELASTIC_TASK_MODEL *)m; |
|
if (elastic->wcet == 0) return -1; |
if (elastic->Tmin > elastic->Tmax) return -1; |
if (elastic->Tmax == 0) return -1; |
|
lev->elist[p].flags |= ELASTIC_PRESENT; |
|
NULL_TIMESPEC(&(lev->elist[p].dline)); |
lev->elist[p].Tmin = elastic->Tmin; |
lev->elist[p].Tmax = elastic->Tmax; |
lev->elist[p].wcet = elastic->wcet; |
lev->elist[p].kelastic = elastic->kelastic; |
lev->elist[p].beta = elastic->beta; |
|
if (lev->flags & ELASTIC_ENABLE_GUARANTEE) |
if (ELASTIC_check_guarantie() != 0) { |
lev->elist[p].flags = ELASTIC_EMPTY_SLOT; |
return -1; |
} |
|
ELASTIC_recompute(); |
|
if (lev->elist[p].period == 0) { |
lev->elist[p].flags = ELASTIC_EMPTY_SLOT; |
return -1; |
} |
|
lev->elist[p].flags |= ELASTIC_PRESENT; |
|
proc_table[p].wcet = elastic->wcet; |
proc_table[p].control &= ~CONTROL_CAP; |
|
if (elastic->arrivals == SAVE_ARRIVALS) |
lev->elist[p].flags |= ELASTIC_SAVE_ARRIVALS; |
|
return 0; /* OK, also if the task cannot be guaranteed... */ |
|
} |