Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1388 → Rev 1387

/demos/trunk/base/aster4.c
34,7 → 34,7
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* CVS : $Id: aster4.c,v 1.3 2004-04-19 14:48:04 giacomo Exp $
* CVS : $Id: aster4.c,v 1.2 2004-04-17 11:36:12 giacomo Exp $
 
Test Number 13 (D):
 
105,6 → 105,60
 
PID aper_table[APER_MAX];
 
PID shutdown_task_PID = -1;
 
int device_drivers_init() {
KEYB_PARMS kparms = BASE_KEYB;
LINUXC26_register_module();
 
keyb_def_ctrlC(kparms, NULL);
INPUT26_init();
 
KEYB26_init(&kparms);
 
return 0;
}
 
int device_drivers_close() {
 
KEYB26_close();
 
INPUT26_close();
 
return 0;
 
}
 
TASK shutdown_task_body(void *arg) {
 
device_drivers_close();
 
sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
 
sys_end();
 
return NULL;
 
}
 
void set_shutdown_task() {
 
NRT_TASK_MODEL nrt;
 
nrt_task_default_model(nrt);
 
shutdown_task_PID = task_create("Shutdown Task",shutdown_task_body,&nrt,NULL);
if (shutdown_task_PID == NIL) {
sys_shutdown_message("Error: Cannot create shutdown task\n");
sys_end();
}
 
}
 
TASK asteroide(void)
{
int i;
256,8 → 310,8
 
while(1) {
printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
printf_xy(62,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(1));
printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(5));
printf_xy(62,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(0));
printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(4));
task_endcycle();
 
if (++s > 59) {
265,8 → 319,8
m++;
}
printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
printf_xy(62,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(1));
printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(5));
printf_xy(62,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(0));
printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(4));
task_endcycle();
}
}
294,7 → 348,7
for (j=0; j<5; j++) last[j] = 0;
jet_gettable(p, &last[0], 5);
kern_cli();
if (proc_table[p].task_level == 5)
if (proc_table[p].task_level == 4)
printf_xy(0,STAT_Y+i+1,WHITE,"%-3d ³ %-6d ³ %-6d ³ %-4d ³ %-7d ³ %-5d ³ %-5d ³ %-5d ³ %-5d ³ %-5d",
p, (int)sum/(nact==0 ? 1 : nact), (int)max, nact, (int)CBS_get_nact(4,p), (int)last[0], (int)last[1], (int)last[2], (int)last[3], (int)last[4]);
else
308,7 → 362,7
 
void endfun(KEY_EVT *k)
{
sys_end();
task_activate(shutdown_task_PID);
}
 
int main(int argc, char **argv)
321,6 → 375,10
SOFT_TASK_MODEL m_soft;
int i;
 
set_shutdown_task();
 
device_drivers_init();
 
k.flag = 0;
k.scan = KEY_ENT;
k.ascii = 13;
346,7 → 404,7
p1 = task_create("Aster",aster,&m,NULL);
if (p1 == -1) {
sys_shutdown_message("aster4.c(main): Could not create task <aster> ...");
sys_end();
task_activate(shutdown_task_PID);
return 0;
}
 
355,7 → 413,7
p2 = task_create("Clock",clock,&m,NULL);
if (p2 == -1) {
sys_shutdown_message("aster4.c(main): Could not create task <Clock> ...");
sys_end();
task_activate(shutdown_task_PID);
return 0;
}
 
362,7 → 420,7
p3 = task_create("JetControl",jetcontrol,&m_soft,NULL);
if (p3 == -1) {
sys_shutdown_message("aster4.c(main): Could not create task <JetControl> ...");
sys_end();
task_activate(shutdown_task_PID);
return 0;
}
 
373,12 → 431,12
soft_task_def_aperiodic(m_aper);
 
for (i=0; i<APER_MAX; i++) {
soft_task_def_level(m_aper, i/4 + 3);
soft_task_def_level(m_aper, i/4 + 2);
soft_task_def_arg(m_aper, (void *)(i/4 ? 'Û' : '±'));
aper_table[i] = task_create("aper",aper_asteroid,&m_aper,NULL);
if (aper_table[i] == -1) {
sys_shutdown_message("aster4.c(main): Could not create task <aper> ...");
sys_end();
task_activate(shutdown_task_PID);
return 0;
}
}