Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1123 → Rev 1143

/demos/tags/rel_0_5/base/ego.c
18,11 → 18,11
 
/**
------------
CVS : $Id: ego.c,v 1.1.1.1 2002-09-02 09:37:41 pj Exp $
CVS : $Id: ego.c,v 1.3 2003-01-07 17:10:15 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-09-02 09:37:41 $
Revision: $Revision: 1.3 $
Last update: $Date: 2003-01-07 17:10:15 $
------------
**/
 
111,32 → 111,6
 
/****************************************************************/
 
/* This is the exception handler. It is called when an exception
is raised.
It exits from the graphical mode, then it prints a message and
shutdown the kernel using sys_abort()
*/
 
void demo_exc_handler(int signo, siginfo_t *info, void *extra)
{
struct timespec t;
 
grx_close();
 
/* Default action for an kern exception is */
kern_cli();
ll_gettime(TIME_EXACT, &t),
kern_printf("\nS.Ha.R.K. Exception raised!!!"
"\nTime (s:ns) :%ld:%ld"
"\nException number:%d (numbers in include/bits/errno.h)"
"\nPID :%d\n",
t.tv_sec, t.tv_nsec, info->si_value.sival_int,
info->si_task);
sys_abort(1);
}
 
/******************************************************************/
 
/* This function is called when Alt-X is pressed.
It simply shutdown the system using sys_end.
Note that the byebye() function is called only if we exit from
166,7 → 140,7
void byebye(void *arg)
{
grx_close();
kern_printf("Bye Bye!\n");
cprintf("Bye Bye!\n");
}
 
/****************************** MAIN ******************************/
176,21 → 150,9
PID pid1, pid2, pid3;
KEY_EVT emerg;
HARD_TASK_MODEL m1, m2, m3;
struct sigaction action;
 
/* Init the standard S.Ha.R.K. exception handler */
action.sa_flags = SA_SIGINFO; /* Set the signal action */
action.sa_sigaction = demo_exc_handler;
action.sa_handler = 0;
sigfillset(&action.sa_mask); /* we block all the other signals... */
 
if (sigaction(SIGHEXC, &action, NULL) == -1) { /* set the signal */
perror("Error initializing signals...");
sys_end();
}
 
/* Set the closing function */
sys_atrunlevel(byebye, NULL, RUNLEVEL_BEFORE_EXIT|NO_AT_ABORT);
sys_atrunlevel(byebye, NULL, RUNLEVEL_BEFORE_EXIT);
 
/* Initializes the semaphore */
sem_init(&mutex,0,1);
201,10 → 163,9
}
 
if (grx_open(640, 480, 8) < 0) {
kern_printf("GRX Err\n");
cprintf("GRX Err\n");
sys_abort(1);
}
kern_printf("Video card ok!\n");
 
/* set the keyboard handler to exit correctly */
emerg.ascii = 'x';