Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1449 → Rev 1448

/demos/trunk/pse51/pinit.c
18,11 → 18,11
 
/**
------------
CVS : $Id: pinit.c,v 1.3 2004-05-23 09:05:50 giacomo Exp $
CVS : $Id: pinit.c,v 1.2 2003-10-07 09:30:18 giacomo Exp $
 
File: $File$
Revision: $Revision: 1.3 $
Last update: $Date: 2004-05-23 09:05:50 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-10-07 09:30:18 $
------------
 
This is a minimal initialization file for the PSE51 profile.
62,11 → 62,14
#include "modules/sem.h"
#include "modules/hartport.h"
 
#include "drivers/keyb.h"
 
#include "pthread.h"
#include "time.h"
 
 
/*+ sysyem tick in us +*/
#define TICK 0
#define TICK 1000
 
/*+ RR tick in us +*/
#define RRTICK 10000
95,9 → 98,28
TASK __init__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
NRT_TASK_MODEL m; // the scheduling model for the Keyboard
 
KEYB_PARMS k = BASE_KEYB;
keyb_def_task(k, &m);
nrt_task_default_model(m);
nrt_task_def_arg(m,arg);
nrt_task_def_usemath(m);
nrt_task_def_ctrl_jet(m);
nrt_task_def_save_arrivals(m);
nrt_task_def_unjoinable(m);
nrt_task_def_weight(m, sched_get_priority_max(SCHED_RR));
nrt_task_def_policy(m,SCHED_RR);
nrt_task_def_inherit(m,PTHREAD_EXPLICIT_SCHED);
nrt_task_def_nokill(m);
nrt_task_def_system(m);
 
HARTPORT_init();
 
if (KEYB_init(&k) < 0)
kern_printf("Error during Keyboard Initialization!!!");
 
__call_main__(mb);
 
return (void *)0;
/demos/trunk/pse51/ptest1.c
18,11 → 18,11
 
/**
------------
CVS : $Id: ptest1.c,v 1.2 2004-05-23 09:05:50 giacomo Exp $
CVS : $Id: ptest1.c,v 1.1.1.1 2002-09-02 09:37:47 pj Exp $
 
File: $File$
Revision: $Revision: 1.2 $
Last update: $Date: 2004-05-23 09:05:50 $
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-09-02 09:37:47 $
------------
 
Posix test 1:
159,6 → 159,12
return 0;
}
 
void fine(KEY_EVT *e)
{
sys_end();
}
 
 
int main(int argc, char **argv)
{
int err;
166,7 → 172,14
pthread_t j1, j2, j3, j4;
union sigval value;
 
KEY_EVT emerg;
//keyb_set_map(itaMap);
emerg.ascii = 'x';
emerg.scan = KEY_X;
emerg.flag = ALTL_BIT;
keyb_hook(emerg,fine);
 
 
/* main blocks signals for all the tasks */
sigfillset(&mask);
pthread_sigmask(SIG_BLOCK, &mask, NULL);
/demos/trunk/pse51/ptest2.c
18,11 → 18,11
 
/**
------------
CVS : $Id: ptest2.c,v 1.2 2004-05-23 09:05:51 giacomo Exp $
CVS : $Id: ptest2.c,v 1.1.1.1 2002-09-02 09:37:47 pj Exp $
 
File: $File$
Revision: $Revision: 1.2 $
Last update: $Date: 2004-05-23 09:05:51 $
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-09-02 09:37:47 $
------------
 
Posix test 2:
105,11 → 105,25
return 0;
}
 
void fine(KEY_EVT *e)
{
sys_end();
}
 
 
int main(int argc, char **argv)
{
int err;
pthread_t j1, j2;
 
KEY_EVT emerg;
//keyb_set_map(itaMap);
emerg.ascii = 'x';
emerg.scan = KEY_X;
emerg.flag = ALTL_BIT;
keyb_hook(emerg,fine);
 
 
cprintf("main: creating prova_key\n");
pthread_key_create(&prova_key, destr_key);
 
/demos/trunk/pse51/ptest3.c
18,11 → 18,11
 
/**
------------
CVS : $Id: ptest3.c,v 1.2 2004-05-23 09:05:51 giacomo Exp $
CVS : $Id: ptest3.c,v 1.1.1.1 2002-09-02 09:37:47 pj Exp $
 
File: $File$
Revision: $Revision: 1.2 $
Last update: $Date: 2004-05-23 09:05:51 $
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-09-02 09:37:47 $
------------
 
Posix test 3:
88,6 → 88,11
sys_gettime(NULL));
}
 
void fine(KEY_EVT *e)
{
sys_end();
}
 
void task_timer(union sigval value)
{
cprintf("task_timer: value = %d, time = %ldusec\n",
104,6 → 109,13
pthread_attr_t task_attr;
struct sched_param task_param;
 
KEY_EVT emerg;
//keyb_set_map(itaMap);
emerg.ascii = 'x';
emerg.scan = KEY_X;
emerg.flag = ALTL_BIT;
keyb_hook(emerg,fine);
 
sig_act.sa_sigaction = (void *) signal_handler;
sig_act.sa_flags = SA_SIGINFO;
sigemptyset(&sig_act.sa_mask);
209,6 → 221,8
//kern_deliver_pending_signals();
}
 
 
 
cprintf("main: ending...\n");
 
return 0;
/demos/trunk/pse51/ptest4.c
18,11 → 18,11
 
/**
------------
CVS : $Id: ptest4.c,v 1.2 2004-05-23 09:05:51 giacomo Exp $
CVS : $Id: ptest4.c,v 1.1.1.1 2002-09-02 09:37:47 pj Exp $
 
File: $File$
Revision: $Revision: 1.2 $
Last update: $Date: 2004-05-23 09:05:51 $
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-09-02 09:37:47 $
------------
 
Posix test 4:
98,7 → 98,12
cprintf("SIGNAL HANDLER: pid=%d\n",exec_shadow);
}
 
void fine(KEY_EVT *e)
{
sys_end();
}
 
 
int main(int argc, char **argv)
{
int err;
105,6 → 110,13
pthread_t j1, j2, j3;
struct sigaction sig_act;
 
KEY_EVT emerg;
//keyb_set_map(itaMap);
emerg.ascii = 'x';
emerg.scan = KEY_X;
emerg.flag = ALTL_BIT;
keyb_hook(emerg,fine);
 
sig_act.sa_sigaction = (void *) signal_handler;
sig_act.sa_flags = SA_SIGINFO;
sigemptyset(&sig_act.sa_mask);
/demos/trunk/pse51/ptest5.c
18,11 → 18,11
 
/**
------------
CVS : $Id: ptest5.c,v 1.2 2004-05-23 09:05:51 giacomo Exp $
CVS : $Id: ptest5.c,v 1.1.1.1 2002-09-02 09:37:47 pj Exp $
 
File: $File$
Revision: $Revision: 1.2 $
Last update: $Date: 2004-05-23 09:05:51 $
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-09-02 09:37:47 $
------------
 
Posix test 5:
61,16 → 61,32
#include <unistd.h>
 
#include <kernel/kern.h>
#include <drivers/keyb.h>
 
 
 
void signal_handler(int signo, siginfo_t *info, void *extra)
{
cprintf("SIGNAL HANDLER: pid=%d\n",exec_shadow);
}
 
void fine(KEY_EVT *e)
{
sys_end();
}
 
 
int main(int argc, char **argv)
{
struct sigaction sig_act;
 
KEY_EVT emerg;
//keyb_set_map(itaMap);
emerg.ascii = 'x';
emerg.scan = KEY_X;
emerg.flag = ALTL_BIT;
keyb_hook(emerg,fine);
 
sig_act.sa_sigaction = (void *) signal_handler;
sig_act.sa_flags = SA_SIGINFO;
sigemptyset(&sig_act.sa_mask);
/demos/trunk/pse51/ptest6.c
18,11 → 18,11
 
/**
------------
CVS : $Id: ptest6.c,v 1.2 2004-05-23 09:05:51 giacomo Exp $
CVS : $Id: ptest6.c,v 1.1.1.1 2002-09-02 09:37:47 pj Exp $
 
File: $File$
Revision: $Revision: 1.2 $
Last update: $Date: 2004-05-23 09:05:51 $
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-09-02 09:37:47 $
------------
 
Posix test 6:
86,6 → 86,7
#include <mqueue.h>
 
#include <kernel/kern.h>
#include <drivers/keyb.h>
 
struct sigevent ev25, evtask;
pthread_attr_t task_attr;
231,6 → 232,11
sys_gettime(NULL));
}
 
void fine(KEY_EVT *e)
{
sys_end();
}
 
int main(int argc, char **argv)
{
// int err;
237,6 → 243,13
struct sigaction sig_act;
struct mq_attr attr;
 
KEY_EVT emerg;
//keyb_set_map(itaMap);
emerg.ascii = 'x';
emerg.scan = KEY_X;
emerg.flag = ALTL_BIT;
keyb_hook(emerg,fine);
 
sig_act.sa_sigaction = (void *) signal_handler;
sig_act.sa_flags = SA_SIGINFO;
sigemptyset(&sig_act.sa_mask);