Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1122 → Rev 1123

/demos/trunk/static/static.c
18,11 → 18,11
 
/**
------------
CVS : $Id: static.c,v 1.3 2002-11-11 07:55:13 pj Exp $
CVS : $Id: static.c,v 1.4 2003-01-07 17:10:18 pj Exp $
 
File: $File$
Revision: $Revision: 1.3 $
Last update: $Date: 2002-11-11 07:55:13 $
Revision: $Revision: 1.4 $
Last update: $Date: 2003-01-07 17:10:18 $
------------
**/
 
130,26 → 130,8
}
 
 
static int STATIC_level_accept_task_model(LEVEL l, TASK_MODEL *m)
{
if (m->pclass == STATIC_PCLASS || m->pclass == (STATIC_PCLASS | l))
return 0;
 
return -1;
}
 
static int STATIC_level_accept_guest_model(LEVEL l, TASK_MODEL *m)
{
return -1;
}
 
 
 
static void STATIC_level_status(LEVEL l)
{ kern_raise(XINVALID_TASK,exec_shadow); }
 
/* The scheduler only gets the first task in the queue */
static PID STATIC_level_scheduler(LEVEL l)
static PID STATIC_public_scheduler(LEVEL l)
{
STATIC_level_des *lev = (STATIC_level_des *)(level_table[l]);
 
156,14 → 138,8
return lev->currenttask;
}
 
/* The on-line guarantee is enabled only if the appropriate flag is set... */
static int STATIC_level_guarantee(LEVEL l, bandwidth_t *freebandwidth)
static int STATIC_public_create(LEVEL l, PID p, TASK_MODEL *m)
{
return 1;
}
 
static int STATIC_task_create(LEVEL l, PID p, TASK_MODEL *m)
{
STATIC_level_des *lev = (STATIC_level_des *)(level_table[l]);
 
/* if the STATIC_task_create is called, then the pclass must be a
171,6 → 147,9
 
STATIC_TASK_MODEL *h = (STATIC_TASK_MODEL *)m;
 
if (m->pclass != STATIC_PCLASS) return -1;
if (m->level != 0 && m->level != l) return -1;
iq_query_timespec(p, &lev->mytable)->tv_sec = h->offset.tv_sec;
iq_query_timespec(p, &lev->mytable)->tv_nsec = h->offset.tv_nsec;
iq_timespec_insert(p,&lev->mytable);
178,43 → 157,39
return 0; /* OK, also if the task cannot be guaranteed... */
}
 
static void STATIC_task_detach(LEVEL l, PID p)
static void STATIC_public_dispatch(LEVEL l, PID p, int nostop)
{
}
 
static int STATIC_task_eligible(LEVEL l, PID p)
static void STATIC_public_epilogue(LEVEL l, PID p)
{
return 0; /* if the task p is chosen, it is always eligible */
}
 
static void STATIC_task_dispatch(LEVEL l, PID p, int nostop)
static void STATIC_public_activate(LEVEL l, PID p)
{
}
 
static void STATIC_task_epilogue(LEVEL l, PID p)
static void STATIC_public_unblock(LEVEL l, PID p)
{
}
 
static void STATIC_task_activate(LEVEL l, PID p)
static void STATIC_public_block(LEVEL l, PID p)
{
}
 
static void STATIC_task_insert(LEVEL l, PID p)
static int STATIC_public_message(LEVEL l, PID p, void *m)
{
}
STATIC_level_des *lev = (STATIC_level_des *)(level_table[l]);
 
static void STATIC_task_extract(LEVEL l, PID p)
{
}
lev->currenttask = NIL;
 
static void STATIC_task_endcycle(LEVEL l, PID p)
{
STATIC_level_des *lev = (STATIC_level_des *)(level_table[l]);
jet_update_endcycle(); /* Update the Jet data... */
trc_logevent(TRC_ENDCYCLE,&exec_shadow); /* tracer stuff */
 
lev->currenttask = NIL;
return 0;
}
 
static void STATIC_task_end(LEVEL l, PID p)
static void STATIC_public_end(LEVEL l, PID p)
{
STATIC_level_des *lev = (STATIC_level_des *)(level_table[l]);
 
227,48 → 202,11
iq_insertfirst(p,&freedesc);
}
 
static void STATIC_task_sleep(LEVEL l, PID p)
{ kern_raise(XINVALID_TASK,exec_shadow); }
 
/* Guest Functions
These functions manages a JOB_TASK_MODEL, that is used to put
a guest task in the STATIC ready queue. */
 
static int STATIC_guest_create(LEVEL l, PID p, TASK_MODEL *m)
{ kern_raise(XINVALID_GUEST,exec_shadow); return 0; }
 
static void STATIC_guest_detach(LEVEL l, PID p)
{ kern_raise(XINVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_dispatch(LEVEL l, PID p, int nostop)
{ kern_raise(XINVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_epilogue(LEVEL l, PID p)
{ kern_raise(XINVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_activate(LEVEL l, PID p)
{ kern_raise(XINVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_insert(LEVEL l, PID p)
{ kern_raise(XINVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_extract(LEVEL l, PID p)
{ kern_raise(XINVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_endcycle(LEVEL l, PID p)
{ kern_raise(XINVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_end(LEVEL l, PID p)
{ kern_raise(XINVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_sleep(LEVEL l, PID p)
{ kern_raise(XINVALID_GUEST,exec_shadow); }
 
/* Registration functions */
 
/*+ Registration function:
int flags the init flags ... see STATIC.h +*/
void STATIC_register_level()
LEVEL STATIC_register_level()
{
LEVEL l; /* the level that we register */
STATIC_level_des *lev; /* for readableness only */
276,53 → 214,23
printk("STATIC_register_level\n");
 
/* request an entry in the level_table */
l = level_alloc_descriptor();
l = level_alloc_descriptor(sizeof(STATIC_level_des));
 
printk(" alloco descrittore %d %d\n",l,(int)sizeof(STATIC_level_des));
lev = (STATIC_level_des *)level_table[l];
 
/* alloc the space needed for the STATIC_level_des */
lev = (STATIC_level_des *)kern_alloc(sizeof(STATIC_level_des));
 
printk(" lev=%d\n",(int)lev);
 
/* update the level_table with the new entry */
level_table[l] = (level_des *)lev;
 
/* fill the standard descriptor */
strncpy(lev->l.level_name, STATIC_LEVELNAME, MAX_LEVELNAME);
lev->l.level_code = STATIC_LEVEL_CODE;
lev->l.level_version = STATIC_LEVEL_VERSION;
lev->l.public_scheduler = STATIC_public_scheduler;
lev->l.public_create = STATIC_public_create;
lev->l.public_end = STATIC_public_end;
lev->l.public_dispatch = STATIC_public_dispatch;
lev->l.public_epilogue = STATIC_public_epilogue;
lev->l.public_activate = STATIC_public_activate;
lev->l.public_unblock = STATIC_public_unblock;
lev->l.public_block = STATIC_public_block;
lev->l.public_message = STATIC_public_message;
 
lev->l.level_accept_task_model = STATIC_level_accept_task_model;
lev->l.level_accept_guest_model = STATIC_level_accept_guest_model;
lev->l.level_status = STATIC_level_status;
lev->l.level_scheduler = STATIC_level_scheduler;
 
lev->l.level_guarantee = NULL;
 
lev->l.task_create = STATIC_task_create;
lev->l.task_detach = STATIC_task_detach;
lev->l.task_eligible = STATIC_task_eligible;
lev->l.task_dispatch = STATIC_task_dispatch;
lev->l.task_epilogue = STATIC_task_epilogue;
lev->l.task_activate = STATIC_task_activate;
lev->l.task_insert = STATIC_task_insert;
lev->l.task_extract = STATIC_task_extract;
lev->l.task_endcycle = STATIC_task_endcycle;
lev->l.task_end = STATIC_task_end;
lev->l.task_sleep = STATIC_task_sleep;
 
lev->l.guest_create = STATIC_guest_create;
lev->l.guest_detach = STATIC_guest_detach;
lev->l.guest_dispatch = STATIC_guest_dispatch;
lev->l.guest_epilogue = STATIC_guest_epilogue;
lev->l.guest_activate = STATIC_guest_activate;
lev->l.guest_insert = STATIC_guest_insert;
lev->l.guest_extract = STATIC_guest_extract;
lev->l.guest_endcycle = STATIC_guest_endcycle;
lev->l.guest_end = STATIC_guest_end;
lev->l.guest_sleep = STATIC_guest_sleep;
 
/* fill the STATIC descriptor part */
 
iq_init(&lev->mytable, &freedesc, 0);
330,6 → 238,8
 
NULL_TIMESPEC(&lev->hp);
NULL_TIMESPEC(&lev->ref);
 
return l;
}
 
void STATIC_start(LEVEL l, struct timespec *h, struct timespec *o)
338,7 → 248,7
struct timespec x;
 
kern_cli();
ll_gettime(TIME_EXACT, &x);
kern_gettime(&x);
lev->hp = *h;
 
ADDTIMESPEC(&x,o,&lev->ref);
/demos/trunk/static/static.h
20,11 → 20,11
 
/**
------------
CVS : $Id: static.h,v 1.1.1.1 2002-09-02 09:37:48 pj Exp $
CVS : $Id: static.h,v 1.2 2003-01-07 17:10:18 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-09-02 09:37:48 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:10:18 $
------------
 
Static scheduler demo (FIRST Project Hand-off)
58,7 → 58,6
#include <kernel/config.h>
#include <sys/types.h>
#include <kernel/types.h>
#include <modules/codes.h>
 
 
 
81,10 → 80,6
#define STATIC_LEVEL_VERSION 1
 
 
/* -----------------------------------------------------------------------
ELASTIC_HARD_TASK_MODEL: elastic hard Tasks
----------------------------------------------------------------------- */
 
typedef struct {
TASK_MODEL t;
114,7 → 109,7
/*+ Registration function:
int flags Options to be used in this level instance...
+*/
void STATIC_register_level(void);
LEVEL STATIC_register_level(void);
 
void STATIC_start(LEVEL l, struct timespec *h, struct timespec *o);