18,11 → 18,11 |
|
/** |
------------ |
CVS : $Id: fly.c,v 1.4 2004-04-17 11:36:13 giacomo Exp $ |
CVS : $Id: fly.c,v 1.5 2004-04-18 19:46:29 giacomo Exp $ |
|
File: $File$ |
Revision: $Revision: 1.4 $ |
Last update: $Date: 2004-04-17 11:36:13 $ |
Revision: $Revision: 1.5 $ |
Last update: $Date: 2004-04-18 19:46:29 $ |
------------ |
**/ |
|
53,11 → 53,8 |
#include <stdlib.h> |
#include <math.h> |
|
#include <drivers/shark_linuxc26.h> |
#include <drivers/shark_pci26.h> |
#include <drivers/shark_keyb26.h> |
#include <drivers/shark_fb26.h> |
#include <drivers/shark_input26.h> |
#include <drivers/shark_keyb26.h> |
|
#define FRAME_BUFFER_DEVICE 0 |
|
79,72 → 76,6 |
int fly_wcet = 1000; /* task wcet */ |
PID pid; |
|
PID shutdown_task_PID = -1; |
|
int device_drivers_init() { |
|
KEYB_PARMS kparms = BASE_KEYB; |
|
LINUXC26_register_module(); |
|
PCI26_init(); |
|
keyb_def_ctrlC(kparms, NULL); |
|
INPUT26_init(); |
|
KEYB26_init(&kparms); |
|
FB26_init(); |
|
FB26_open(FRAME_BUFFER_DEVICE); |
|
FB26_use_grx(FRAME_BUFFER_DEVICE); |
|
FB26_setmode(FRAME_BUFFER_DEVICE,"640x480-16"); |
|
return 0; |
|
} |
|
int device_drivers_close() { |
|
FB26_close(FRAME_BUFFER_DEVICE); |
|
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(); |
} |
|
} |
|
/*--------------------------------------------------------------*/ |
|
void draw_fly(int x, int y, int c) |
220,10 → 151,6 |
int i = 0; /* number of tasks created */ |
TIME seme; /* used to init the random seed */ |
|
set_shutdown_task(); |
|
device_drivers_init(); |
|
/* The scenario */ |
grx_rect(XMIN-D-1, YMIN-D-1, XMAX+D+1, YMAX+D+1, 14); |
grx_text("Simulation of Random Flies", XMIN, YMENU+10, 13, 0); |
249,7 → 176,7 |
pid = task_create("fly", fly, &m, NULL); |
if (pid == NIL) { |
sys_shutdown_message("Could not create task <fly>"); |
task_activate(shutdown_task_PID); |
sys_end(); |
return 0; |
} |
task_activate(pid); |
259,7 → 186,7 |
|
} while (c != ESC); |
|
task_activate(shutdown_task_PID); |
sys_end(); |
|
return 0; |
|