Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1145 → Rev 1158

/demos/trunk/jumpball/initfil1.c
File deleted
/demos/trunk/jumpball/initfil2.c
File deleted
/demos/trunk/jumpball/initfile.c
File deleted
/demos/trunk/jumpball/rrn.c
0,0 → 1,109
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* (see the web pages for full authors list)
*
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
*
* http://www.sssup.it
* http://retis.sssup.it
* http://shark.sssup.it
*/
 
/**
------------
CVS : $Id: rrn.c,v 1.1 2003-05-01 19:43:17 pj Exp $
 
File: $File$
Revision: $Revision: 1.1 $
Last update: $Date: 2003-05-01 19:43:17 $
------------
**/
 
/*
* Copyright (C) 2003 Paolo Gai
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
 
#include "kernel/kern.h"
#include "modules/edf.h"
#include "modules/rr.h"
#include "modules/rrsoft.h"
#include "modules/dummy.h"
 
#include "modules/sem.h"
#include "modules/hartport.h"
#include "modules/cabs.h"
#include "modules/nop.h"
 
#include "drivers/keyb.h"
 
 
/*+ sysyem tick in us +*/
#define TICK 0
 
/*+ RR tick in us +*/
//#define RRTICK 10000
#define RRTICK 2000
 
TIME __kernel_register_levels__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
 
RR_register_level(RRTICK, RR_MAIN_NO, mb); // this module remains empty!!!
RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD|RRSOFT_ONLY_SOFT);
 
RR_register_level(RRTICK, RR_MAIN_YES, mb);
dummy_register_level();
 
 
SEM_register_module();
 
CABS_register_module();
 
NOP_register_module();
 
return TICK;
}
 
TASK __init__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
 
HARTPORT_init();
 
KEYB_init(NULL);
 
__call_main__(mb);
 
return (void *)0;
}
 
void app_mutex_init(mutex_t *m)
{
NOP_mutexattr_t attr;
 
NOP_mutexattr_default(attr);
 
mutex_init(m, &attr);
}
/demos/trunk/jumpball/rrp.c
0,0 → 1,107
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* (see the web pages for full authors list)
*
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
*
* http://www.sssup.it
* http://retis.sssup.it
* http://shark.sssup.it
*/
 
/**
------------
CVS : $Id: rrp.c,v 1.1 2003-05-01 19:43:17 pj Exp $
 
File: $File$
Revision: $Revision: 1.1 $
Last update: $Date: 2003-05-01 19:43:17 $
------------
**/
 
/*
* Copyright (C) 2003 Paolo Gai
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
 
#include "kernel/kern.h"
#include "modules/edf.h"
#include "modules/rr.h"
#include "modules/rrsoft.h"
#include "modules/dummy.h"
 
#include "modules/sem.h"
#include "modules/hartport.h"
#include "modules/cabs.h"
#include "modules/pi.h"
 
#include "drivers/keyb.h"
 
 
/*+ sysyem tick in us +*/
#define TICK 0
 
/*+ RR tick in us +*/
//#define RRTICK 10000
#define RRTICK 2000
 
TIME __kernel_register_levels__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
 
RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD);
RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_SOFT);
 
RR_register_level(RRTICK, RR_MAIN_YES, mb);
dummy_register_level();
 
 
SEM_register_module();
CABS_register_module();
PI_register_module();
 
return TICK;
}
 
TASK __init__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
 
HARTPORT_init();
 
KEYB_init(NULL);
 
__call_main__(mb);
 
return (void *)0;
}
 
void app_mutex_init(mutex_t *m)
{
PI_mutexattr_t attr;
 
PI_mutexattr_default(attr);
 
mutex_init(m, &attr);
}
/demos/trunk/jumpball/demo.c
18,16 → 18,16
 
/**
------------
CVS : $Id: demo.c,v 1.3 2003-01-07 17:10:17 pj Exp $
CVS : $Id: demo.c,v 1.4 2003-05-01 19:43:16 pj Exp $
 
File: $File$
Revision: $Revision: 1.3 $
Last update: $Date: 2003-01-07 17:10:17 $
Revision: $Revision: 1.4 $
Last update: $Date: 2003-05-01 19:43:16 $
------------
**/
 
/*
* Copyright (C) 2000 Paolo Gai
* Copyright (C) 2000-2003 Paolo Gai
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
65,11 → 65,11
 
static void version( void )
{
cprintf( "S.Ha.R.K. Pavia Demo 1.0\n" );
cprintf( "------------------------\n" );
cprintf( "S.Ha.R.K. Jumpball Demo 1.0\n" );
cprintf( "---------------------------\n" );
cprintf( "by Paolo Gai 1999-2001\n" );
cprintf( " <pj@sssup.it>\n" );
cprintf( "------------------------\n" );
cprintf( "---------------------------\n" );
}
 
int myrand(int x)
116,12 → 116,12
 
void scenario()
{
grx_text("S.Ha.R.K. Pavia Demo 1.0", 0, 0, rgb16(0,255,0), black );
grx_text("by Paolo Gai 1999-2001" , 0, 8, rgb16(0,255,0), black );
grx_text(" pj@sssup.it" , 0,16, rgb16(0,255,0), black );
grx_text("S.Ha.R.K. Jumpball Demo 1.0", 0, 0, rgb16(0,255,0), black );
grx_text(" by Paolo Gai 1999-2001" , 0, 8, rgb16(0,255,0), black );
grx_text(" pj@sssup.it" , 0,16, rgb16(0,255,0), black );
 
grx_text("Ctrl-C, Ctrr-C, Enter: exit" ,320, 0, gray, black );
grx_text("Alt-C : void stat." ,320, 8, gray, black );
grx_text("Alt-C : void statistics" ,320, 8, gray, black );
grx_text("Space : create noise ball",320,16, gray, black );
grx_text("Backspace : kill noise balls" ,320,24, gray, black );
 
135,28 → 135,9
#endif
}
 
 
void demo_exc_handler(int signo, siginfo_t *info, void *extra)
void my_close(void *arg)
{
struct timespec t;
 
grx_close();
 
/* Default action for an kern exception is */
kern_cli();
kern_gettime(&t),
kern_printf("\nS.Ha.R.K. Exception raised!!!"
"\nTime (s:ns) :%ld:%ld"
"\nException number:%d"
"\nPID :%d\n",
t.tv_sec, t.tv_nsec, info->si_value.sival_int,
info->si_task);
sys_end();
}
 
void my_close(void *arg)
{
grx_close();
kern_printf("my_close\n");
}
 
163,8 → 144,8
 
void endfun(KEY_EVT *k)
{
cprintf("Ctrl-Brk pressed! Ending...\n");
sys_end();
cprintf("Ending...\n");
sys_end();
}
 
void zerofun(KEY_EVT *k)
173,21 → 154,6
for (i=0; i<MAX_PROC; i++) jet_delstat(i);
}
 
void printeventqueue(void *arg)
{
struct event *p;
extern struct event *firstevent;
 
kern_cli();
grx_close();
kern_cli();
for (p = firstevent; p != NULL; p = p->next) {
kern_printf("par:%d time:%ld.%ld p:%d handler:%d\n",
(int)p->par, p->time.tv_sec, p->time.tv_nsec/1000, (int)p, (int)p->handler);
}
kern_sti();
}
 
int main(int argc, char **argv)
{
int modenum;
/demos/trunk/jumpball/ern.c
0,0 → 1,108
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* (see the web pages for full authors list)
*
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
*
* http://www.sssup.it
* http://retis.sssup.it
* http://shark.sssup.it
*/
 
/**
------------
CVS : $Id: ern.c,v 1.1 2003-05-01 19:43:16 pj Exp $
 
File: $File$
Revision: $Revision: 1.1 $
Last update: $Date: 2003-05-01 19:43:16 $
------------
**/
 
/*
* Copyright (C) 2003 Paolo Gai
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
 
#include "kernel/kern.h"
#include "modules/edf.h"
#include "modules/rr.h"
#include "modules/rrsoft.h"
#include "modules/dummy.h"
 
#include "modules/sem.h"
#include "modules/hartport.h"
#include "modules/cabs.h"
#include "modules/nop.h"
 
#include "drivers/keyb.h"
 
 
/*+ sysyem tick in us +*/
#define TICK 0
 
/*+ RR tick in us +*/
//#define RRTICK 10000
#define RRTICK 2000
 
TIME __kernel_register_levels__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
 
EDF_register_level(EDF_ENABLE_ALL);
RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD|RRSOFT_ONLY_SOFT);
RR_register_level(RRTICK, RR_MAIN_YES, mb);
dummy_register_level();
 
 
SEM_register_module();
 
CABS_register_module();
 
NOP_register_module();
 
return TICK;
}
 
TASK __init__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
 
HARTPORT_init();
 
KEYB_init(NULL);
 
__call_main__(mb);
 
return (void *)0;
}
 
void app_mutex_init(mutex_t *m)
{
NOP_mutexattr_t attr;
 
NOP_mutexattr_default(attr);
 
mutex_init(m, &attr);
}
/demos/trunk/jumpball/jetctrl.c
18,11 → 18,11
 
/**
------------
CVS : $Id: jetctrl.c,v 1.1.1.1 2002-09-02 09:37:41 pj Exp $
CVS : $Id: jetctrl.c,v 1.2 2003-05-01 19:43:17 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-09-02 09:37:41 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-05-01 19:43:17 $
------------
**/
 
208,8 → 208,8
soft_task_def_group(m3, 1);
p3 = task_create("jctrl", jetctrl_task, &m3, NULL);
if (p3 == -1) {
grx_close();
perror("Could not create task <jetctrl>");
sys_shutdown_message("Could not create task <jetctrl> errno=%d",
errno);
sys_end();
}
 
222,8 → 222,8
soft_task_def_ctrl_jet(m4);
p4 = task_create("jdmy", jetdummy_task, &m4, NULL);
if (p4 == -1) {
grx_close();
perror("Could not create task <jetdummy>");
sys_shutdown_message("Could not create task <jetdummy> errno=%d",
errno);
sys_end();
}
 
236,8 → 236,8
soft_task_def_ctrl_jet(m5);
p5 = task_create("jsli", jetslide_task, &m5, NULL);
if (p5 == -1) {
grx_close();
perror("Could not create task <jetslide>");
sys_shutdown_message("Could not create task <jetslide> errno=%d",
errno);
sys_end();
}
}
/demos/trunk/jumpball/ecp.c
0,0 → 1,106
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* (see the web pages for full authors list)
*
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
*
* http://www.sssup.it
* http://retis.sssup.it
* http://shark.sssup.it
*/
 
/**
------------
CVS : $Id: ecp.c,v 1.1 2003-05-01 19:43:16 pj Exp $
 
File: $File$
Revision: $Revision: 1.1 $
Last update: $Date: 2003-05-01 19:43:16 $
------------
**/
 
/*
* Copyright (C) 2003 Paolo Gai
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
 
#include "kernel/kern.h"
#include "modules/edf.h"
#include "modules/cbs.h"
#include "modules/rr.h"
#include "modules/dummy.h"
 
#include "modules/sem.h"
#include "modules/hartport.h"
#include "modules/cabs.h"
#include "modules/pi.h"
 
#include "drivers/keyb.h"
 
 
/*+ sysyem tick in us +*/
#define TICK 0
 
/*+ RR tick in us +*/
//#define RRTICK 10000
#define RRTICK 2000
 
TIME __kernel_register_levels__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
 
EDF_register_level(EDF_ENABLE_ALL);
CBS_register_level(CBS_ENABLE_ALL, 0);
 
RR_register_level(RRTICK, RR_MAIN_YES, mb);
dummy_register_level();
 
SEM_register_module();
CABS_register_module();
PI_register_module();
 
return TICK;
}
 
TASK __init__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
 
HARTPORT_init();
 
KEYB_init(NULL);
 
__call_main__(mb);
 
return (void *)0;
}
 
void app_mutex_init(mutex_t *m)
{
PI_mutexattr_t attr;
 
PI_mutexattr_default(attr);
 
mutex_init(m, &attr);
}
/demos/trunk/jumpball/demo.h
18,11 → 18,11
 
/**
------------
CVS : $Id: demo.h,v 1.1.1.1 2002-09-02 09:37:41 pj Exp $
CVS : $Id: demo.h,v 1.2 2003-05-01 19:43:16 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-09-02 09:37:41 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-05-01 19:43:16 $
------------
**/
 
54,9 → 54,18
#include <drivers/keyb.h>
 
 
/* Subparts */
#define JET_ON
#define BALL_ON
 
 
/* CPU Speed Selection
--------------------------------------------------------------------
400 - Pentium 2 400 MHz
133 - Pentium 1 133 MHz
*/
#define CPU 133
 
/*
*
* WCET, Periods and Models
63,22 → 72,26
*
*/
 
#if CPU==133
#define WCET_JETCTRL 10000
#define WCET_JETDUMMY 300
#define WCET_JETSLIDE 2000
#define WCET_BALL 250
#define WCET_HARD_BALL 1000
#endif
 
/* define if you want NRT or SOFT... */
#define TASK_TYPE SOFT
//#define TASK_TYPE NRT
 
#if CPU==400
#define WCET_JETCTRL 7500
#define WCET_JETDUMMY 200
#define WCET_JETSLIDE 2100
#define WCET_BALL 100
#define WCET_HARD_BALL 380
#endif
 
 
#define PERIOD_JETCTRL 100000
#define PERIOD_JETDUMMY 100000
#define PERIOD_JETSLIDE 100000
 
 
#define WCET_BALL 100
 
#define PERIOD_BALL 10000
 
/*
/demos/trunk/jumpball/ball.c
18,11 → 18,11
 
/**
------------
CVS : $Id: ball.c,v 1.1.1.1 2002-09-02 09:37:41 pj Exp $
CVS : $Id: ball.c,v 1.2 2003-05-01 19:43:16 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-09-02 09:37:41 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-05-01 19:43:16 $
------------
**/
 
191,13 → 191,12
hard_task_default_model(mp);
hard_task_def_ctrl_jet(mp);
hard_task_def_arg(mp, (void *)rgb16(r,g,b));
hard_task_def_wcet(mp, 380);
hard_task_def_wcet(mp, WCET_HARD_BALL);
hard_task_def_mit(mp,PERIOD_BALL);
hard_task_def_usemath(mp);
pid = task_create("pallaEDF", palla, &mp, NULL);
if (pid == NIL) {
grx_close();
perror("Could not create task <pallaEDF>");
sys_shutdown_message("Could not create task <pallaEDF>");
sys_end();
}
else
/demos/trunk/jumpball/makefile
7,13 → 7,18
endif
include $(BASE)/config/config.mk
 
PROGS= demo
PROGS= ecp ern rrp rrn
 
include $(BASE)/config/example.mk
 
demo:
make -f $(SUBMAKE) APP=demo INIT= OTHEROBJS="initfil1.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
ecp:
make -f $(SUBMAKE) APP=ecp INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
 
demo2:
make -f $(SUBMAKE) APP=demo INIT= OTHEROBJS="initfil2.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
ern:
make -f $(SUBMAKE) APP=ern INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
 
rrp:
make -f $(SUBMAKE) APP=rrp INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
 
rrn:
make -f $(SUBMAKE) APP=rrn INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"