Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1108 → Rev 1100

/demos/trunk/cash/cash.c
20,11 → 20,11
 
/**
------------
CVS : $Id: cash.c,v 1.3 2002-11-11 07:56:31 pj Exp $
CVS : $Id: cash.c,v 1.2 2002-10-28 08:14:39 pj Exp $
 
File: $File$
Revision: $Revision: 1.3 $
Last update: $Date: 2002-11-11 07:56:31 $
Revision: $Revision: 1.2 $
Last update: $Date: 2002-10-28 08:14:39 $
------------
 
This file contains the aperiodic server CBS (Total Bandwidth Server)
78,6 → 78,7
/*+ Status used in the level +*/
#define CBSGHD_IDLE APER_STATUS_BASE /*+ waiting the activation +*/
#define CBSGHD_ZOMBIE APER_STATUS_BASE+1 /*+ waiting the period end +*/
#define CBSGHD_DELAY APER_STATUS_BASE+2 /*+ waiting the delay end +*/
 
/* structure of an element of the capacity queue */
struct cap_queue {
287,6 → 288,7
switch (status) {
case CBSGHD_IDLE : return "CBSGHD_Idle";
case CBSGHD_ZOMBIE : return "CBSGHD_Zombie";
case CBSGHD_DELAY : return "CBSGHD_Delay";
default : return "CBSGHD_Unknown";
}
}
496,7 → 498,7
 
/* we finally put the task in the FREE status */
proc_table[p].status = FREE;
iq_insertfirst(p,&freedesc);
q_insertfirst(p,&freedesc);
 
/* and free the allocated bandwidth */
lev->U -= (MAX_BANDWIDTH/lev->period[p]) * lev->cnormal[p];
653,6 → 655,14
return 0; /* if the task p is chosen, it is always eligible */
}
 
#ifdef __TEST1__
extern int testactive;
extern struct timespec s_stime[];
extern TIME s_curr[];
extern TIME s_PID[];
extern int useds;
#endif
 
static void CBSGHD_task_dispatch(LEVEL l, PID p, int nostop)
{
CBSGHD_level_des *lev = (CBSGHD_level_des *)(level_table[l]);
659,6 → 669,15
level_table[ lev->scheduling_level ]->
guest_dispatch(lev->scheduling_level,p,nostop);
 
#ifdef __TEST1__
if (testactive)
{
TIMESPEC_ASSIGN(&s_stime[useds], &schedule_time);
s_curr[useds] = proc_table[p].avail_time;
s_PID[useds] = p;
useds++;
}
#endif
}
 
static void CBSGHD_task_epilogue(LEVEL l, PID p)
816,6 → 835,13
kern_raise(XINVALID_TASK,p);
}
 
static void CBSGHD_task_delay(LEVEL l, PID p, TIME usdelay)
{
printk("CBSGHD_task_delay\n");
kern_raise(XINVALID_TASK,p);
}
 
 
static int CBSGHD_guest_create(LEVEL l, PID p, TASK_MODEL *m)
{ kern_raise(XINVALID_GUEST,exec_shadow); return 0; }
 
846,7 → 872,12
static void CBSGHD_guest_sleep(LEVEL l, PID p)
{ kern_raise(XINVALID_GUEST,exec_shadow); }
 
static void CBSGHD_guest_delay(LEVEL l, PID p,DWORD tickdelay)
{ kern_raise(XINVALID_GUEST,exec_shadow); }
 
 
 
 
/* Registration functions */
 
/*+ Registration function:
898,6 → 929,7
lev->l.task_endcycle = CBSGHD_task_endcycle;
lev->l.task_end = CBSGHD_task_end;
lev->l.task_sleep = CBSGHD_task_sleep;
lev->l.task_delay = CBSGHD_task_delay;
 
lev->l.guest_create = CBSGHD_guest_create;
lev->l.guest_detach = CBSGHD_guest_detach;
909,6 → 941,7
lev->l.guest_endcycle = CBSGHD_guest_endcycle;
lev->l.guest_end = CBSGHD_guest_end;
lev->l.guest_sleep = CBSGHD_guest_sleep;
lev->l.guest_delay = CBSGHD_guest_delay;
 
/* fill the CBSGHD descriptor part */
for (i=0; i<MAX_PROC; i++) {