Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1391 → Rev 1392

/demos/trunk/astro/asteroid.c
16,8 → 16,6
sem_t mx_mat, mx_grf, mx_pos, mx_vel, mx_xy, mx_rk, mx_rn; /* mutex semaphores */
sem_t mx_st_nrg, mx_st_scr, mx_st_kil, mx_st_liv; /* mutex semaphores */
 
PID shutdown_task_PID = -1;
 
double dist_xy(int x1, int y1, int x2, int y2)
{
double dst;
65,82 → 63,15
 
void end_func(KEY_EVT *k) {
 
task_activate(shutdown_task_PID);
 
}
 
int device_drivers_close() {
 
FB26_close(FRAME_BUFFER_DEVICE);
 
KEYB26_close();
INPUT26_close();
 
return 0;
 
}
 
int device_drivers_init() {
 
KEYB_PARMS kparms = BASE_KEYB;
LINUXC26_register_module();
 
PCI26_init();
 
INPUT26_init();
 
keyb_def_ctrlC(kparms, NULL);
 
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;
 
}
 
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();
}
 
}
 
int main(int argc, char **argv)
{
KEY_EVT k;
TIME seme;
 
set_shutdown_task();
 
device_drivers_init();
 
k.flag = CNTR_BIT;
k.scan = KEY_C;
k.ascii = 'c';