Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1085 → Rev 1143

/demos/tags/rel_0_5/static/static.c
18,11 → 18,11
 
/**
------------
CVS : $Id: static.c,v 1.1.1.1 2002-09-02 09:37:48 pj Exp $
CVS : $Id: static.c,v 1.4 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.4 $
Last update: $Date: 2003-01-07 17:10:18 $
------------
**/
 
68,7 → 68,7
typedef struct {
level_des l; /*+ the standard level descriptor +*/
 
QUEUE mytable;
IQUEUE mytable;
 
PID currenttask;
 
87,7 → 87,7
lev->currenttask = p;
event_need_reschedule();
 
STATIC_printf("(o p%d t%d)", p, (int)proc_table[p].timespec_priority.tv_sec);
// STATIC_printf("(o p%d t%d)", p, (int)proc_table[p].timespec_priority.tv_sec);
}
 
static void STATIC_activateall(STATIC_level_des *lev)
97,15 → 97,15
 
STATIC_printf("(A ");
 
for (my_table_index = (PID)lev->mytable;
for (my_table_index = iq_query_first(&lev->mytable);
my_table_index != NIL;
my_table_index = proc_table[my_table_index].next) {
ADDTIMESPEC(&lev->ref,&proc_table[my_table_index].timespec_priority,&x);
my_table_index = iq_query_next(my_table_index, &lev->mytable)) {
ADDTIMESPEC(&lev->ref,iq_query_timespec(my_table_index, &lev->mytable),&x);
kern_event_post(&x, STATIC_offset_activate,(void *)my_table_index);
 
STATIC_printf("|p%d t%d ",
my_table_index,
(int)proc_table[my_table_index].timespec_priority.tv_sec);
(int)iq_query_timespec(my_table_index, &lev->mytable)->tv_sec);
}
 
STATIC_printf(")");
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(XUNVALID_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,110 → 147,66
 
STATIC_TASK_MODEL *h = (STATIC_TASK_MODEL *)m;
 
proc_table[p].timespec_priority.tv_sec = h->offset.tv_sec;
proc_table[p].timespec_priority.tv_nsec = h->offset.tv_nsec;
q_timespec_insert(p,&lev->mytable);
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);
 
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]);
 
lev->currenttask = NIL;
 
q_extract(p,&lev->mytable);
iq_extract(p,&lev->mytable);
 
/* we finally put the task in the ready queue */
proc_table[p].status = FREE;
q_insertfirst(p,&freedesc);
iq_insertfirst(p,&freedesc);
}
 
static void STATIC_task_sleep(LEVEL l, PID p)
{ kern_raise(XUNVALID_TASK,exec_shadow); }
 
static void STATIC_task_delay(LEVEL l, PID p, TIME usdelay)
{ kern_raise(XUNVALID_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(XUNVALID_GUEST,exec_shadow); return 0; }
 
static void STATIC_guest_detach(LEVEL l, PID p)
{ kern_raise(XUNVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_dispatch(LEVEL l, PID p, int nostop)
{ kern_raise(XUNVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_epilogue(LEVEL l, PID p)
{ kern_raise(XUNVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_activate(LEVEL l, PID p)
{ kern_raise(XUNVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_insert(LEVEL l, PID p)
{ kern_raise(XUNVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_extract(LEVEL l, PID p)
{ kern_raise(XUNVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_endcycle(LEVEL l, PID p)
{ kern_raise(XUNVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_end(LEVEL l, PID p)
{ kern_raise(XUNVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_sleep(LEVEL l, PID p)
{ kern_raise(XUNVALID_GUEST,exec_shadow); }
 
static void STATIC_guest_delay(LEVEL l, PID p, TIME usdelay)
{ kern_raise(XUNVALID_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 */
282,62 → 214,32
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.task_delay = STATIC_task_delay;
 
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;
lev->l.guest_delay = STATIC_guest_delay;
 
/* fill the STATIC descriptor part */
 
lev->mytable = NIL;
iq_init(&lev->mytable, &freedesc, 0);
lev->currenttask = NIL;
 
NULL_TIMESPEC(&lev->hp);
NULL_TIMESPEC(&lev->ref);
 
return l;
}
 
void STATIC_start(LEVEL l, struct timespec *h, struct timespec *o)
346,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/tags/rel_0_5/static/test1st.c
16,11 → 16,11
 
/**
------------
CVS : $Id: test1st.c,v 1.1.1.1 2002-09-02 09:37:48 pj Exp $
CVS : $Id: test1st.c,v 1.2 2002-11-11 07:55:13 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: 2002-11-11 07:55:13 $
------------
 
 
78,7 → 78,7
 
STATIC_TASK_MODEL m;
 
struct timespec my_time, h, o, fineprg;
struct timespec my_time, h, o;
 
my_time.tv_nsec=0;
 
/demos/tags/rel_0_5/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);