Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 672 → Rev 673

/shark/trunk/kernel/modules/elastic.c
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... */
 
}
/shark/trunk/include/kernel/model.h
21,11 → 21,11
 
/**
------------
CVS : $Id: model.h,v 1.8 2004-05-25 10:12:59 giacomo Exp $
CVS : $Id: model.h,v 1.9 2004-05-25 10:54:01 giacomo Exp $
 
File: $File$
Revision: $Revision: 1.8 $
Last update: $Date: 2004-05-25 10:12:59 $
Revision: $Revision: 1.9 $
Last update: $Date: 2004-05-25 10:54:01 $
------------
 
This file contains the definitions of the task and resource models.
541,7 → 541,7
#define elastic_task_def_period(m,Tmin,Tmax) (m).Tmin = (Tmin),\
(m).Tmax = (Tmax)
#define elastic_task_def_wcet(m,wcet) (m).wcet = (wcet)
#define elastic_task_def_const(m,kelastic,beta) (m).kelastic = (kelastic), \
#define elastic_task_def_param(m,kelastic,beta) (m).kelastic = (kelastic), \
(m).beta = (beta)
#define elastic_task_def_save_arrivals(m) (m).arrivals = SAVE_ARRIVALS
#define elastic_task_def_skip_arrivals(m) (m).arrivals = SKIP_ARRIVALS