Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1106 → Rev 1107

/demos/trunk/slsh/slsh.c
20,11 → 20,11
 
/**
------------
CVS : $Id: slsh.c,v 1.2 2002-10-28 08:14:18 pj Exp $
CVS : $Id: slsh.c,v 1.3 2002-11-11 07:54:33 pj Exp $
 
File: $File$
Revision: $Revision: 1.2 $
Last update: $Date: 2002-10-28 08:14:18 $
Revision: $Revision: 1.3 $
Last update: $Date: 2002-11-11 07:54:33 $
------------
 
This file contains the scheduling module for Slot-Shifting.
90,9 → 90,9
/* task lists */
SLSH_task tasks[MAX_PROC]; /* est and dl's for static and guaranteed task */
QUEUE idle_statics; /* finished static tasks */
IQUEUE idle_statics; /* finished static tasks */
QQUEUE unspecified; /* tasks with only a wcet */
IQUEUE unspecified; /* tasks with only a wcet */
/* the Intervals list */
SLSH_interval intervals[MAX_INTERVALS];
155,9 → 155,9
}
 
/* check if unspecified exists, return 0 if it exists, -1 otherwise */
static int SLSH_T(QQUEUE unspecified)
static int SLSH_T(IQUEUE *unspecified)
{
if(unspecified.first != NIL)
if(!iq_isempty(unspecified))
return 0;
else
return -1;
300,10 → 300,10
else if(SLSH_R(lev->tasks) > 0 && SLSH_sc(lev->intervals, lev->current) > 0)
{
/* If unspecified exist, execute it according to FIFO order */
if(SLSH_T(lev->unspecified) == 0)
if(SLSH_T(&lev->unspecified) == 0)
{
SLSH_decSc(lev->intervals, lev->current, 1); /* decrease sc by 1 */
return (PID)qq_getfirst(&lev->unspecified);
return iq_getfirst(&lev->unspecified);
}
else /* No unspecified, execute task from candidates (statics) */
{
494,7 → 494,7
u = (SOFT_TASK_MODEL *) m;
proc_table[p].avail_time = u->wcet;
proc_table[p].wcet = u->wcet;
qq_insertlast(p, &lev->unspecified); /* respect FIFO order */
iq_insertlast(p, &lev->unspecified); /* respect FIFO order */
break;
default: /* a task model not supported */
return -1;
543,7 → 543,7
{
lev->slot = 0;
while((pid = q_getfirst(&lev->idle_statics)) != NIL)
while((pid = iq_getfirst(&lev->idle_statics)) != NIL)
{
if(lev->tasks[pid].est <= lev->slot)
proc_table[pid].status = SLSH_READY;
569,7 → 569,7
NB: we can't assume that p is the first task in the queue!!! */
if(proc_table[pid].pclass == SOFT_PCLASS)
qq_extract(pid, &lev->unspecified);
iq_extract(pid, &lev->unspecified);
 
/* also start the timer for one slot length */
lev->slot_event = kern_event_post(&TIME2TIMESPEC(lev->slot_length, t),
591,7 → 591,7
else /* the end of a slot. the task returns into the ready queue... */
{
if(proc_table[pid].pclass == SOFT_PCLASS)
qq_insertfirst(pid,&lev->unspecified);
iq_insertfirst(pid,&lev->unspecified);
proc_table[pid].status = SLSH_READY;
}
620,7 → 620,7
/* insert unspecified tasks in QQUEUE and make it ready */
if(type == SOFT_PCLASS)
{
qq_insertlast(pid ,&lev->unspecified);
iq_insertlast(pid ,&lev->unspecified);
proc_table[pid].status = SLSH_READY;
}
}
634,7 → 634,7
proc_table[pid].status = SLSH_READY;
if(proc_table[pid].pclass == SOFT_PCLASS)
qq_insertfirst(pid ,&lev->unspecified);
iq_insertfirst(pid ,&lev->unspecified);
}
 
/* when a semaphore, mutex ... taskes a task from module */
665,7 → 665,7
if(proc_table[pid].pclass == SOFT_PCLASS)
{
if (proc_table[pid].status == SLSH_READY)
qq_extract(pid, &lev->unspecified);
iq_extract(pid, &lev->unspecified);
}
else if(proc_table[pid].pclass == HARD_PCLASS)
{
678,7 → 678,7
{
proc_table[pid].avail_time = proc_table[pid].wcet;
proc_table[pid].status = SLSH_IDLE;
q_insert(pid, &lev->idle_statics);
iq_priority_insert(pid, &lev->idle_statics);
}
proc_table[pid].status = FREE;
697,7 → 697,6
}
 
static void SLSH_task_delay(LEVEL l, PID p, TIME usdelay) { }
 
/** Guest Functions, slot shifing accepts no guests, so all generates exceptions **/
 
733,9 → 732,6
static void SLSH_guest_sleep(LEVEL l, PID p)
{ kern_raise(XINVALID_GUEST,exec_shadow); }
 
static void SLSH_guest_delay(LEVEL l, PID p, TIME usdelay)
{ kern_raise(XINVALID_GUEST,exec_shadow); }
 
/******* Registration functions *******/
 
/*+ Registration function: */
780,7 → 776,6
lev->l.task_endcycle = SLSH_task_endcycle;
lev->l.task_end = SLSH_task_end;
lev->l.task_sleep = SLSH_task_sleep;
lev->l.task_delay = SLSH_task_delay;
lev->l.guest_create = SLSH_guest_create;
lev->l.guest_detach = SLSH_guest_detach;
792,7 → 787,6
lev->l.guest_endcycle = SLSH_guest_endcycle;
lev->l.guest_end = SLSH_guest_end;
lev->l.guest_sleep = SLSH_guest_sleep;
lev->l.guest_delay = SLSH_guest_delay;
/* fill the SLSH descriptor part */
for(i = 0; i < MAX_PROC; i++)