Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1393 → Rev 1392

/demos/trunk/base/aster8.c
34,7 → 34,7
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* CVS : $Id: aster8.c,v 1.4 2004-04-21 14:55:05 giacomo Exp $
* CVS : $Id: aster8.c,v 1.3 2004-04-17 11:36:13 giacomo Exp $
 
Test for Sporadic Server (ss):
 
53,12 → 53,14
#include "modules/cbs.h"
#include "modules/ss.h"
 
#include <drivers/shark_linuxc26.h>
#include <drivers/shark_input26.h>
#include <drivers/shark_keyb26.h>
 
int num_aster = 0;
#define EDF_LEV 1
#define CBS_LEV 2
#define SS_LEV 3
#define EDF_LEV 0
#define CBS_LEV 1
#define SS_LEV 2
 
#define ASTER_LIM 60
#define DISPLAY_MAX 8
97,7 → 99,60
#endif
 
PID p1,p2,p3,p4,p5;
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;
338,7 → 393,7
for (j=0; j<5; j++) last[j] = 0;
jet_gettable(p, &last[0], 5);
mutex_lock(&m1);
if (proc_table[p].task_level == 2)
if (proc_table[p].task_level == 1)
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(2,p), (int)last[0], (int)last[1], (int)last[2], (int)last[3], (int)last[4]);
// p, sum/(nact==0 ? 1 : nact), max, proc_table[p].avail_time, proc_table[p].status, proc_table[p].shadow, proc_table[p].timespec_priority.tv_sec,proc_table[p].timespec_priority.tv_nsec/1000 , CBS_get_nact(2,p), last[4]);
356,9 → 411,7
 
void fine(KEY_EVT *e)
{
 
sys_end();
 
task_activate(shutdown_task_PID);
}
 
void mydummyaper(void) {
389,6 → 442,10
SOFT_TASK_MODEL m_aper;
SOFT_TASK_MODEL m_soft;
 
set_shutdown_task();
 
device_drivers_init();
 
#ifdef PIMUTEX
PI_mutexattr_t a;
#endif
443,7 → 500,7
p1 = task_create("Aster",aster,&m,NULL);
if (p1 == -1) {
sys_shutdown_message("test7.c(main): Could not create task <aster> ...");
sys_end();
task_activate(shutdown_task_PID);
return 0;
}
 
452,7 → 509,7
p2 = task_create("Clock",clock,&m,NULL);
if (p2 == -1) {
sys_shutdown_message("test7.c(main): Could not create task <Clock> ...");
sys_end();
task_activate(shutdown_task_PID);
return 0;
}
 
459,7 → 516,7
p3 = task_create("JetControl",jetcontrol,&m_aper,NULL);
if (p3 == -1) {
sys_shutdown_message("test7.c(main): Could not create task <JetControl> ...");
sys_end();
task_activate(shutdown_task_PID);
return 0;
}
 
466,7 → 523,7
p4 = task_create("MyDummyAper",(void *(*)(void*))mydummyaper,&m_aper,NULL);
if (p4 == -1) {
sys_shutdown_message("Could not create task <MyDummyAper> ...");
sys_end();
task_activate(shutdown_task_PID);
return 0;
}
 
473,7 → 530,7
p5 = task_create("MyDummyNRT",(void *(*)(void*))mydummynrt,&m_nrt,NULL);
if (p5 == -1) {
sys_shutdown_message("Could not create task <MyDummyNRT> ...");
sys_end();
task_activate(shutdown_task_PID);
return 0;
}