Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1388 → Rev 1387

/demos/trunk/base/aster5.c
34,7 → 34,7
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* CVS : $Id: aster5.c,v 1.4 2004-04-19 14:48:04 giacomo Exp $
* CVS : $Id: aster5.c,v 1.3 2004-04-17 11:36:12 giacomo Exp $
 
this is a part of the classic Hartik demo Aster.
 
55,6 → 55,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;
94,6 → 96,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;
294,7 → 350,7
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,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(0));
printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(2));
 
mutex_unlock(&m1);
306,7 → 362,7
}
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,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(0));
printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(2));
mutex_unlock(&m1);
task_endcycle();
355,7 → 411,7
 
void fine(KEY_EVT *e)
{
sys_end();
task_activate(shutdown_task_PID);
}
 
int main(int argc, char **argv)
368,6 → 424,10
// int i;
struct timespec fineprg;
 
set_shutdown_task();
 
device_drivers_init();
 
#ifdef PIMUTEX
PI_mutexattr_t a;
#endif
417,7 → 477,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;
}
 
426,7 → 486,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;
}
 
434,7 → 494,7
p3 = task_create("JetControl",jetcontrol,&m_soft,NULL);
if (p2 == -1) {
sys_shutdown_message("test7.c(main): Could not create task <JetControl> ...");
sys_end();
task_activate(shutdown_task_PID);
return 0;
}
/*