Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1393 → Rev 1392

/demos/trunk/base/aster6.c
34,7 → 34,7
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* CVS : $Id: aster6.c,v 1.5 2004-04-21 14:55:05 giacomo Exp $
* CVS : $Id: aster6.c,v 1.4 2004-04-17 11:36:12 giacomo Exp $
 
this is a part of the classic Hartik demo Aster.
 
47,6 → 47,8
#include "modules/edf.h"
#include "modules/cbs.h"
 
#include <drivers/shark_linuxc26.h>
#include <drivers/shark_input26.h>
#include <drivers/shark_keyb26.h>
 
int num_aster = 0;
85,6 → 87,60
#define ASTER_WCET 2000 /* 200*/
#endif
 
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;
276,8 → 332,8
while(1) {
mutex_lock(&m1);
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(3));
printf_xy(62,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(0));
printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(2));
 
mutex_unlock(&m1);
 
289,8 → 345,8
}
mutex_lock(&m1);
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(3));
printf_xy(62,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(0));
printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(2));
mutex_unlock(&m1);
task_endcycle();
}
321,7 → 377,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 == 3)
if (proc_table[p].task_level == 2)
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]);
337,9 → 393,7
 
void fine(KEY_EVT *e)
{
 
sys_end();
 
task_activate(shutdown_task_PID);
}
 
int main(int argc, char **argv)
352,6 → 406,10
// int i;
struct timespec fineprg;
 
set_shutdown_task();
 
device_drivers_init();
 
#ifdef PIMUTEX
PI_mutexattr_t a;
#endif
400,7 → 458,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;
}
 
409,7 → 467,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;
}
 
417,7 → 475,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;
}
 
437,7 → 495,7
 
mutex_init(&m1, &a);
 
fineprg.tv_sec = 20;
fineprg.tv_sec = 1800;
fineprg.tv_nsec = 0;
kern_event_post(&fineprg,(void (*)(void *))fine,NULL);
group_activate(1);