Subversion Repositories shark

Compare Revisions

Regard whitespace Rev 1614 → Rev 1613

/demos/tags/rel_1_5_3/newtrace/utils/test.pwc
File deleted
/demos/tags/rel_1_5_3/newtrace/utils/extract.c
File deleted
/demos/tags/rel_1_5_3/newtrace/utils/example_results
File deleted
/demos/tags/rel_1_5_3/newtrace/utils/list.c
File deleted
/demos/tags/rel_1_5_3/newtrace/utils/pwcet_gen.c
File deleted
/demos/tags/rel_1_5_3/newtrace/utils/README
File deleted
/demos/tags/rel_1_5_3/newtrace/utils/makefile
File deleted
/demos/tags/rel_1_5_3/newtrace/utils/test
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/newtrace/utils/udpdump.c
File deleted
/demos/tags/rel_1_5_3/newtrace/initfile/initfile.c
File deleted
/demos/tags/rel_1_5_3/newtrace/udp/udptrace.c
File deleted
/demos/tags/rel_1_5_3/newtrace/udp/makefile
File deleted
/demos/tags/rel_1_5_3/newtrace/udp/initfile.c
File deleted
/demos/tags/rel_1_5_3/newtrace/nosave/nosave.c
File deleted
/demos/tags/rel_1_5_3/newtrace/nosave/makefile
File deleted
/demos/tags/rel_1_5_3/newtrace/nosave/initfile.c
File deleted
/demos/tags/rel_1_5_3/newtrace/readme
File deleted
/demos/tags/rel_1_5_3/newtrace/makefile
File deleted
/demos/tags/rel_1_5_3/newtrace/instr/initfile.c
File deleted
/demos/tags/rel_1_5_3/newtrace/instr/bezier_i.c
File deleted
/demos/tags/rel_1_5_3/newtrace/instr/makefile
File deleted
/demos/tags/rel_1_5_3/newtrace/instr/instr.c
File deleted
/demos/tags/rel_1_5_3/newtrace/instr/bezier.c
File deleted
/demos/tags/rel_1_5_3/base/initgraph.c
File deleted
/demos/tags/rel_1_5_3/base/fly.c
File deleted
/demos/tags/rel_1_5_3/base/time.c
File deleted
/demos/tags/rel_1_5_3/base/intsem.c
File deleted
/demos/tags/rel_1_5_3/base/initfile.c
File deleted
/demos/tags/rel_1_5_3/base/pcdemo.c
File deleted
/demos/tags/rel_1_5_3/base/iaster1.c
File deleted
/demos/tags/rel_1_5_3/base/srpdemo.c
File deleted
/demos/tags/rel_1_5_3/base/iaster3.c
File deleted
/demos/tags/rel_1_5_3/base/ego.c
File deleted
/demos/tags/rel_1_5_3/base/iaster4.c
File deleted
/demos/tags/rel_1_5_3/base/preempt.c
File deleted
/demos/tags/rel_1_5_3/base/readme
File deleted
/demos/tags/rel_1_5_3/base/iaster6.c
File deleted
/demos/tags/rel_1_5_3/base/pidemo.c
File deleted
/demos/tags/rel_1_5_3/base/iaster7.c
File deleted
/demos/tags/rel_1_5_3/base/aster.c
File deleted
/demos/tags/rel_1_5_3/base/iaster8.c
File deleted
/demos/tags/rel_1_5_3/base/pcidemo.c
File deleted
/demos/tags/rel_1_5_3/base/sig.c
File deleted
/demos/tags/rel_1_5_3/base/condtest.c
File deleted
/demos/tags/rel_1_5_3/base/ipcidemo.c
File deleted
/demos/tags/rel_1_5_3/base/semdemo.c
File deleted
/demos/tags/rel_1_5_3/base/makefile
File deleted
/demos/tags/rel_1_5_3/base/cabs.dat
File deleted
/demos/tags/rel_1_5_3/base/aster1.c
File deleted
/demos/tags/rel_1_5_3/base/jointest.c
File deleted
/demos/tags/rel_1_5_3/base/aster2.c
File deleted
/demos/tags/rel_1_5_3/base/aster3.c
File deleted
/demos/tags/rel_1_5_3/base/mdemo.c
File deleted
/demos/tags/rel_1_5_3/base/aster4.c
File deleted
/demos/tags/rel_1_5_3/base/isemdemo.c
File deleted
/demos/tags/rel_1_5_3/base/aster5.c
File deleted
/demos/tags/rel_1_5_3/base/hello.c
File deleted
/demos/tags/rel_1_5_3/base/aster6.c
File deleted
/demos/tags/rel_1_5_3/base/aster7.c
File deleted
/demos/tags/rel_1_5_3/base/aster8.c
File deleted
/demos/tags/rel_1_5_3/base/cabs.c
File deleted
/demos/tags/rel_1_5_3/base/imdemo.c
File deleted
/demos/tags/rel_1_5_3/base/ihello.c
File deleted
/demos/tags/rel_1_5_3/helloworld/makefile
File deleted
/demos/tags/rel_1_5_3/helloworld/initfile.c
File deleted
/demos/tags/rel_1_5_3/helloworld/hello.c
File deleted
/demos/tags/rel_1_5_3/readme.txt
File deleted
/demos/tags/rel_1_5_3/shutdown/readme.txt
File deleted
/demos/tags/rel_1_5_3/shutdown/shutdown.c
File deleted
/demos/tags/rel_1_5_3/shutdown/ishut.c
File deleted
/demos/tags/rel_1_5_3/shutdown/makefile
File deleted
/demos/tags/rel_1_5_3/advtimer/makefile
File deleted
/demos/tags/rel_1_5_3/advtimer/initfile.c
File deleted
/demos/tags/rel_1_5_3/advtimer/readme.txt
File deleted
/demos/tags/rel_1_5_3/advtimer/advtimer.c
File deleted
/demos/tags/rel_1_5_3/tftptest/makefile
File deleted
/demos/tags/rel_1_5_3/tftptest/tftptest.c
File deleted
/demos/tags/rel_1_5_3/tftptest/initfile.c
File deleted
/demos/tags/rel_1_5_3/makefile
File deleted
/demos/tags/rel_1_5_3/dosfs/makefile
File deleted
/demos/tags/rel_1_5_3/dosfs/dosfs.c
File deleted
/demos/tags/rel_1_5_3/dosfs/myfile.txt
File deleted
/demos/tags/rel_1_5_3/dosfs/initfile.c
File deleted
/demos/tags/rel_1_5_3/dosfs/readme.txt
File deleted
/demos/tags/rel_1_5_3/orbit/orbit.c
File deleted
/demos/tags/rel_1_5_3/orbit/initfile.c
File deleted
/demos/tags/rel_1_5_3/orbit/orbit.dat
File deleted
/demos/tags/rel_1_5_3/orbit/makefile
File deleted
/demos/tags/rel_1_5_3/bttvdemo/initfile.c
File deleted
/demos/tags/rel_1_5_3/bttvdemo/readme.txt
File deleted
/demos/tags/rel_1_5_3/bttvdemo/makefile
File deleted
/demos/tags/rel_1_5_3/bttvdemo/bttv.c
File deleted
/demos/tags/rel_1_5_3/bca/esplo.c
File deleted
/demos/tags/rel_1_5_3/bca/bca.c
File deleted
/demos/tags/rel_1_5_3/bca/bca.h
File deleted
/demos/tags/rel_1_5_3/bca/aereo.c
File deleted
/demos/tags/rel_1_5_3/bca/dummy.c
File deleted
/demos/tags/rel_1_5_3/bca/makefile
File deleted
/demos/tags/rel_1_5_3/bca/fab_lib/fab_tool.h
File deleted
/demos/tags/rel_1_5_3/bca/fab_lib/fab_grx.h
File deleted
/demos/tags/rel_1_5_3/bca/fab_lib/fab_show.h
File deleted
/demos/tags/rel_1_5_3/bca/fab_lib/fab_msg.h
File deleted
/demos/tags/rel_1_5_3/bca/fab_lib/fab_grx.sys
File deleted
/demos/tags/rel_1_5_3/bca/scenario.c
File deleted
/demos/tags/rel_1_5_3/bca/initfile.c
File deleted
/demos/tags/rel_1_5_3/bca/missile.c
File deleted
/demos/tags/rel_1_5_3/bca/bca_lib.c
File deleted
/demos/tags/rel_1_5_3/bca/readme
File deleted
/demos/tags/rel_1_5_3/bca/bca_raw/esplo5.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/bca/bca_raw/missile2.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/bca/bca_raw/sfondo.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/bca/bca_raw/aereo1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/bca/bca_raw/cannon.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/bca/bca_raw/aereo2.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/bca/bca_raw/aereo1_h.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/bca/bca_raw/cannon_h.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/bca/bca_raw/esplo1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/bca/bca_raw/aereo2_h.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/bca/bca_raw/esplo2.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/bca/bca_raw/esplo3.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/bca/bca_raw/bca.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/bca/bca_raw/esplo4.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/bca/bca_raw/missile1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/bca/fab_lib.c
File deleted
/demos/tags/rel_1_5_3/bca/control.c
File deleted
/demos/tags/rel_1_5_3/bca/cannone.c
File deleted
/demos/tags/rel_1_5_3/astro/rock.c
File deleted
/demos/tags/rel_1_5_3/astro/asteroid.h
File deleted
/demos/tags/rel_1_5_3/astro/initfile.c
File deleted
/demos/tags/rel_1_5_3/astro/astro.c
File deleted
/demos/tags/rel_1_5_3/astro/asteroid.c
File deleted
/demos/tags/rel_1_5_3/astro/stat.c
File deleted
/demos/tags/rel_1_5_3/astro/makefile
File deleted
/demos/tags/rel_1_5_3/network/initfile.c
File deleted
/demos/tags/rel_1_5_3/network/net.c
File deleted
/demos/tags/rel_1_5_3/network/talk.c
File deleted
/demos/tags/rel_1_5_3/network/makefile
File deleted
/demos/tags/rel_1_5_3/mesademo/initfile.c
File deleted
/demos/tags/rel_1_5_3/mesademo/mesademo.c
File deleted
/demos/tags/rel_1_5_3/mesademo/readme.txt
File deleted
/demos/tags/rel_1_5_3/mesademo/makefile
File deleted
/demos/tags/rel_1_5_3/pse51/ptest1.c
File deleted
/demos/tags/rel_1_5_3/pse51/ptest2.c
File deleted
/demos/tags/rel_1_5_3/pse51/ptest3.c
File deleted
/demos/tags/rel_1_5_3/pse51/pinit.c
File deleted
/demos/tags/rel_1_5_3/pse51/ptest4.c
File deleted
/demos/tags/rel_1_5_3/pse51/ptest5.c
File deleted
/demos/tags/rel_1_5_3/pse51/ptest6.c
File deleted
/demos/tags/rel_1_5_3/pse51/makefile
File deleted
/demos/tags/rel_1_5_3/pci6025e/test_ppi.c
File deleted
/demos/tags/rel_1_5_3/pci6025e/test_bec.c
File deleted
/demos/tags/rel_1_5_3/pci6025e/test_dio.c
File deleted
/demos/tags/rel_1_5_3/pci6025e/readme
File deleted
/demos/tags/rel_1_5_3/pci6025e/makefile
File deleted
/demos/tags/rel_1_5_3/pci6025e/test_bms.c
File deleted
/demos/tags/rel_1_5_3/pci6025e/wave.c
File deleted
/demos/tags/rel_1_5_3/pci6025e/initfile.c
File deleted
/demos/tags/rel_1_5_3/pci6025e/test_mes.c
File deleted
/demos/tags/rel_1_5_3/pci6025e/test_ec.c
File deleted
/demos/tags/rel_1_5_3/pci6025e/test_dac.c
File deleted
/demos/tags/rel_1_5_3/mix/readme
File deleted
\ No newline at end of file
/demos/tags/rel_1_5_3/mix/makefile
File deleted
/demos/tags/rel_1_5_3/mix/mix.c
File deleted
/demos/tags/rel_1_5_3/mix/mix.dat
File deleted
/demos/tags/rel_1_5_3/mix/initfile.c
File deleted
/demos/tags/rel_1_5_3/servo/initfile.c
File deleted
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: demos/tags/rel_1_5_3/servo/README
===================================================================
--- demos/tags/rel_1_5_3/servo/README (revision 1614)
+++ demos/tags/rel_1_5_3/servo/README (nonexistent)
@@ -1,2 +0,0 @@
-TODO
-
Index: demos/tags/rel_1_5_3/servo/makefile
===================================================================
--- demos/tags/rel_1_5_3/servo/makefile (revision 1614)
+++ demos/tags/rel_1_5_3/servo/makefile (nonexistent)
@@ -1,15 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = load
-
-include $(BASE)/config/example.mk
-
-load:
- make -f $(SUBMAKE) APP=load INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__LINUXC26__ __INPUT__ __SERVO__"
/demos/tags/rel_1_5_3/servo/makefile
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: demos/tags/rel_1_5_3/servo/load.c
===================================================================
--- demos/tags/rel_1_5_3/servo/load.c (revision 1614)
+++ demos/tags/rel_1_5_3/servo/load.c (nonexistent)
@@ -1,76 +0,0 @@
-/*
- * Project: S.Ha.R.K
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://hartik.sssup.it
- */
-
-/*
- * 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 "drivers/shark_keyb26.h"
-#include "unistd.h"
-
-#include "servo.h"
-
-#define N_SEND 10000
-
-int main () {
-
- int res, i = 0, k;
-
- srand(sys_gettime(NULL));
-
- cprintf("(Open Com2)");
- res = servo_open(COM2, 19200);
- cprintf("(Res = %d)",res);
-
- cprintf("(Servo Turn On 0)");
- res = servo_turn_on(COM2, 0);
- cprintf("(Res = %d)",res);
-
- while(i < N_SEND) {
-
- cprintf("(Cycle = %d)",i);
-
- k = rand() % 180 - 90;
-
- cprintf("(Set Servo 0 %d)",k);
- res = servo_set_angle_sec(COM2, 0, ANGLE2SEC(k,0,0));
- cprintf("(Res = %d)",res);
-
- udelay(100000);
-
- i++;
-
- }
-
- servo_close(COM2);
-
- exit(0);
-
- return 0;
-
-}
-
Index: demos/tags/rel_1_5_3/input/initspk.c
===================================================================
--- demos/tags/rel_1_5_3/input/initspk.c (revision 1614)
+++ demos/tags/rel_1_5_3/input/initspk.c (nonexistent)
@@ -1,156 +0,0 @@
-/*
- * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- * Gerardo Lamastra <gerardo@sssup.it>
- *
- * Authors :
- * Mauro Marinoni <mauro.marinoni@unipv.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.it>
- * (see authors.txt for full list of hartik's authors)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://hartik.sssup.it
- */
-
-/*
- * 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 "edf/edf/edf.h"
-#include "cbs/cbs/cbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-#include "intdrive/intdrive/intdrive.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_spk26.h>
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#define INTDRIVE_FLAG 0
-
-PID shutdown_task_PID = 1;
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- return TICK;
-}
-
-int device_drivers_close() {
-
- KEYB26_close();
- SPEAK26_close();
- INPUT26_close();
-
- return 0;
-}
-
-int device_drivers_init() {
-
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
- INPUT26_init();
-
- /*keyb_def_map(kparms, KEYMAP_IT);*/
- keyb_def_ctrlC(kparms, NULL);
- KEYB26_init(&kparms);
-
- SPEAK26_init();
- return 0;
-}
-
-TASK shutdown_task_body(void *arg) {
-
- device_drivers_close();
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
- return NULL;
-}
-
-void set_shutdown_task() {
-
- NRT_TASK_MODEL nrt;
-
- nrt_task_default_model(nrt);
- nrt_task_def_system(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");
- exit(1);
- }
-
-}
-
-#define SHUTDOWN_TIMEOUT_SEC 3
-
-void call_shutdown_task(void *arg) {
- struct timespec t;
-
- sys_gettime(&t);
- t.tv_sec += SHUTDOWN_TIMEOUT_SEC;
-
- /* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */
- kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0);
-
- task_activate(shutdown_task_PID);
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
Index: demos/tags/rel_1_5_3/input/joy.c
===================================================================
--- demos/tags/rel_1_5_3/input/joy.c (revision 1614)
+++ demos/tags/rel_1_5_3/input/joy.c (nonexistent)
@@ -1,76 +0,0 @@
-
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * Authors : Mauro Marinoni <mauro.marinoni@unipv.it>
- * (see authors.txt for full list of hartik's authors)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * 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 <kernel/func.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <drivers/shark_joy26.h>
-
-TASK my_getjoy(void *arg) {
-
- int a0, a1, a2, a3, btn;
-
- while (1) {
- joy_getstatus(&a0, &a1, &a2, &a3, &btn);
- cprintf("(%6d %6d) %2x\n", a0, a1, btn);
- task_endcycle();
- if (btn == 0xF)
- exit(1);
- }
-}
-
-int main(int argc, char **argv)
-{
- SOFT_TASK_MODEL mp;
- PID pid;
-
- if (!JOY26_installed()) {
- cprintf("No Joystick found.");
- exit(1);
- }
- soft_task_default_model(mp);
- soft_task_def_level(mp,2);
- soft_task_def_ctrl_jet(mp);
- soft_task_def_met(mp,700);
- soft_task_def_period(mp,10000);
- soft_task_def_usemath(mp);
- pid = task_create("Joy_Print", my_getjoy, &mp, NULL);
- if (pid == NIL) {
- sys_shutdown_message("Could not create task <Joy_Print>\n");
- exit(1);
- } else
- task_activate(pid);
-
- return 0;
-}
/demos/tags/rel_1_5_3/input/joy.c
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: demos/tags/rel_1_5_3/input/speak.c
===================================================================
--- demos/tags/rel_1_5_3/input/speak.c (revision 1614)
+++ demos/tags/rel_1_5_3/input/speak.c (nonexistent)
@@ -1,208 +0,0 @@
-
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * Authors : Mauro Marinoni <mauro.marinoni@unipv.it>
- * (see authors.txt for full list of hartik's authors)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * 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 <kernel/func.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_spk26.h>
-
-void my_sysclose(KEY_EVT *e)
-{
- speaker_sound(0, 0);
-
- kern_printf("S.Ha.R.K. closed.\n\n");
- exit(0);
-}
-
-void no_note(KEY_EVT *e){
- speaker_sound(0, 0);
-}
-
-void my_note(KEY_EVT *e){
-
- switch (e->scan) {
- case KEY_Q:
- speaker_sound(262, 0);
- break;
- case KEY_W:
- speaker_sound(277, 0);
- break;
- case KEY_E:
- speaker_sound(294, 0);
- break;
- case KEY_R:
- speaker_sound(311, 0);
- break;
- case KEY_T:
- speaker_sound(330, 0);
- break;
- case KEY_Y:
- speaker_sound(349, 0);
- break;
- case KEY_U:
- speaker_sound(370, 0);
- break;
- case KEY_I:
- speaker_sound(392, 0);
- break;
- case KEY_O:
- speaker_sound(415, 0);
- break;
- case KEY_P:
- speaker_sound(440, 0);
- break;
- case KEY_BRL:
- speaker_sound(466, 0);
- break;
- case KEY_BRR:
- speaker_sound(494, 0);
- break;
- }
-}
-
-int main(int argc, char **argv)
-{
- KEY_EVT ev;
-
- ev.ascii = 'c';
- ev.scan = KEY_C;
- ev.status = KEY_PRESSED;
- ev.flag = CNTL_BIT;
- keyb_hook(ev, my_sysclose, FALSE);
- ev.flag = CNTR_BIT;
- keyb_hook(ev, my_sysclose, FALSE);
-
- speaker_sound(440, 400);
- while ( (sys_gettime(NULL)/1000) < 1000);
-
- ev.ascii = 'q';
- ev.scan = KEY_Q;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'w';
- ev.scan = KEY_W;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'e';
- ev.scan = KEY_E;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'r';
- ev.scan = KEY_R;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 't';
- ev.scan = KEY_T;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'y';
- ev.scan = KEY_Y;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'u';
- ev.scan = KEY_U;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'i';
- ev.scan = KEY_I;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'o';
- ev.scan = KEY_O;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'p';
- ev.scan = KEY_P;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = '[';
- ev.scan = KEY_BRL;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = ']';
- ev.scan = KEY_BRR;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- while(1);
- return 0;
-}
Index: demos/tags/rel_1_5_3/input/initfile.c
===================================================================
--- demos/tags/rel_1_5_3/input/initfile.c (revision 1614)
+++ demos/tags/rel_1_5_3/input/initfile.c (nonexistent)
@@ -1,217 +0,0 @@
-/*
- * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- * Gerardo Lamastra <gerardo@sssup.it>
- *
- * Authors :
- * Mauro Marinoni <mauro.marinoni@unipv.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.it>
- * (see authors.txt for full list of hartik's authors)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://hartik.sssup.it
- */
-
-/*
- * Copyright (C) 2000 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "hardcbs/hardcbs/hardcbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_pci26.h>
-
-#include <drivers/shark_input26.h>
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_mouse26.h>
-#include <drivers/shark_spk26.h>
-#include <drivers/shark_joy26.h>
-
-#include <drivers/shark_fb26.h>
-
-#define FRAME_BUFFER_DEVICE 0
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#define INTDRIVE_FLAG 0
-
-void call_shutdown_task(void *arg);
-int device_drivers_init();
-int device_drivers_close();
-void set_shutdown_task();
-TASK shutdown_task_body(void *arg);
-
-PID shutdown_task_PID = -1;
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- HCBS_register_level(HCBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
- CABS_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- /* Create the shutdown task. It will be activated at RUNLEVEL SHUTDOWN */
- set_shutdown_task();
-
- /* Init the drivers */
- device_drivers_init();
-
- /* Set the shutdown task activation */
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-void set_shutdown_task()
-{
-/* WARNING: the shutdown task is a background thread. It cannot execute if the system is overloaded */
- NRT_TASK_MODEL nrt;
-
- nrt_task_default_model(nrt);
- nrt_task_def_system(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");
- exit(1);
- }
-}
-
-int device_drivers_init()
-{
- int res;
- KEYB_PARMS kparms = BASE_KEYB;
- MOUSE_PARMS mparms = BASE_MOUSE;
-
- LINUXC26_register_module(TRUE);
-
- PCI26_init();
-
- INPUT26_init();
-
- /* keyb_def_map(kparms, KEYMAP_IT);*/
- keyb_def_ctrlC(kparms, NULL);
- KEYB26_init(&kparms);
-
- mouse_def_threshold(mparms, 5);
- mouse_def_xmin(mparms, 0);
- mouse_def_ymin(mparms, 0);
- mouse_def_xmax(mparms, 639);
- mouse_def_ymax(mparms, 479);
- MOUSE26_init(&mparms);
-
- SPEAK26_init();
-
- JOY26_init();
-
- FB26_init();
- res = FB26_open(FRAME_BUFFER_DEVICE);
- if (res) {
- cprintf("Error: Cannot open graphical mode\n");
- MOUSE26_close();
- SPEAK26_close();
- JOY26_close();
- KEYB26_close();
- INPUT26_close();
- exit(1);
- }
-
- FB26_use_grx(FRAME_BUFFER_DEVICE);
- FB26_setmode(FRAME_BUFFER_DEVICE,"640x480-16");
-
- return 0;
-}
-
-int device_drivers_close() {
-
- mouse_grxcursor(DISABLE, 0);
-
- FB26_close(FRAME_BUFFER_DEVICE);
-
- MOUSE26_close();
- SPEAK26_close();
- JOY26_close();
- KEYB26_close();
- INPUT26_close();
-
- return 0;
-}
-
-#define SHUTDOWN_TIMEOUT_SEC 3
-
-void call_shutdown_task(void *arg)
-{
- struct timespec t;
-
- sys_gettime(&t);
- t.tv_sec += SHUTDOWN_TIMEOUT_SEC;
-
- /* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */
- kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0);
-
- task_activate(shutdown_task_PID);
-}
-
-TASK shutdown_task_body(void *arg)
-{
- device_drivers_close();
-
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
-
- return NULL;
-}
Index: demos/tags/rel_1_5_3/input/initjoy.c
===================================================================
--- demos/tags/rel_1_5_3/input/initjoy.c (revision 1614)
+++ demos/tags/rel_1_5_3/input/initjoy.c (nonexistent)
@@ -1,149 +0,0 @@
-/*
- * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- * Gerardo Lamastra <gerardo@sssup.it>
- *
- * Authors:
- * Mauro Marinoni <mauro.marinoni@unipv.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.it>
- * (see authors.txt for full list of hartik's authors)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://hartik.sssup.it
- */
-
-/*
- * 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 "edf/edf/edf.h"
-#include "cbs/cbs/cbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-#include "intdrive/intdrive/intdrive.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_joy26.h>
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#define INTDRIVE_FLAG 0
-
-PID shutdown_task_PID = 1;
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- return TICK;
-}
-
-int device_drivers_close() {
-
- JOY26_close();
- INPUT26_close();
-
- return 0;
-}
-
-int device_drivers_init() {
-
- LINUXC26_register_module(TRUE);
- INPUT26_init();
-
- JOY26_init();
-
- return 0;
-
-}
-
-TASK shutdown_task_body(void *arg) {
-
- device_drivers_close();
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
- return NULL;
-}
-
-void set_shutdown_task() {
-
- NRT_TASK_MODEL nrt;
-
- nrt_task_default_model(nrt);
- nrt_task_def_system(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");
- exit(1);
- }
-
-}
-
-#define SHUTDOWN_TIMEOUT_SEC 3
-
-void call_shutdown_task(void *arg) {
- struct timespec t;
-
- sys_gettime(&t);
- t.tv_sec += SHUTDOWN_TIMEOUT_SEC;
-
- /* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */
- kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0);
-
- task_activate(shutdown_task_PID);
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
/demos/tags/rel_1_5_3/input/initjoy.c
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: demos/tags/rel_1_5_3/input/key.c
===================================================================
--- demos/tags/rel_1_5_3/input/key.c (revision 1614)
+++ demos/tags/rel_1_5_3/input/key.c (nonexistent)
@@ -1,135 +0,0 @@
-
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * Authors : Mauro Marinoni <mauro.marinoni@unipv.it>
- * (see authors.txt for full list of hartik's authors)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * 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 <kernel/func.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <drivers/shark_keyb26.h>
-
-//#define SHOW_EVT
-
-void my_sysclose(KEY_EVT *e)
-{
- kern_printf("S.Ha.R.K. closed.\n\n");
- exit(0);
-}
-
-TASK my_get(void *arg) {
-#ifdef SHOW_EVT
- int status;
- KEY_EVT ev;
-#else
- BYTE ch;
-#endif
-
- while (1) {
-#ifdef SHOW_EVT
- status = keyb_getcode(&ev, NON_BLOCK);
- if (status == TRUE)
- cprintf("[%c %d %d %d]\n", ev.ascii, ev.scan, ev.status, ev.flag);
-#else
- ch = keyb_getch(NON_BLOCK);
- if (ch)
- cprintf("%c", ch);
-#endif
- task_endcycle();
- }
-}
-
-void my_pause(KEY_EVT *e){
-
- TIME t;
-
- cprintf("Start Pause.\n");
- keyb_disable();
- cprintf("Keyboard Disabled.\n");
- t = sys_gettime(NULL);
- while ( ( (sys_gettime(NULL) -t) / 1000) < 5000);
- keyb_enable();
- cprintf("Keyboard Enabled.\n");
-}
-
-void my_test(KEY_EVT *e){
- cprintf("<test>\n");
-}
-
-void my_arrow(KEY_EVT *e){
- cprintf("<arrow>\n");
-}
-
-int main(int argc, char **argv)
-{
- SOFT_TASK_MODEL mp;
- PID pid;
-
- KEY_EVT ev;
-
- ev.ascii = 'p';
- ev.scan = KEY_P;
- ev.status = KEY_PRESSED;
- ev.flag = CNTR_BIT;
- keyb_hook(ev, my_pause, FALSE);
-
- set_keyevt(&ev, 'a', KEY_A, 0, KEY_PRESSED|KEY_REPEATED);
- keyb_hook(ev, my_test, FALSE);
-
- set_keyevt(&ev, 0, EXT_UP, 0, KEY_PRESSED);
- keyb_hook(ev, my_arrow, FALSE);
-
- set_keyevt(&ev, 'b', KEY_B, CNTL_BIT, KEY_PRESSED);
- keyb_hook(ev, my_test, TRUE);
-
- ev.ascii = 'c';
- ev.scan = KEY_C;
- ev.status = KEY_PRESSED;
- ev.flag = CNTR_BIT;
- keyb_hook(ev, my_sysclose, FALSE);
- ev.flag = CNTL_BIT;
- keyb_hook(ev, my_sysclose, FALSE);
-
- soft_task_default_model(mp);
- soft_task_def_level(mp,2);
- soft_task_def_ctrl_jet(mp);
- soft_task_def_met(mp,700);
- soft_task_def_period(mp,1000);
- soft_task_def_usemath(mp);
- pid = task_create("Keyb_Print", my_get, &mp, NULL);
- if (pid == NIL) {
- perror("Could not create task <Keyb_Print>");
- exit(1);
- } else
- task_activate(pid);
-
- return 0;
-}
Index: demos/tags/rel_1_5_3/input/mouse.c
===================================================================
--- demos/tags/rel_1_5_3/input/mouse.c (revision 1614)
+++ demos/tags/rel_1_5_3/input/mouse.c (nonexistent)
@@ -1,95 +0,0 @@
-
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * Authors : Mauro Marinoni <mauro.marinoni@unipv.it>
- * (see authors.txt for full list of hartik's authors)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * 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 <kernel/func.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <drivers/shark_mouse26.h>
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_spk26.h>
-
-void my_sysclose(KEY_EVT *e)
-{
- mouse_txtcursor(DISABLE);
-
- exit(0);
-}
-
-TASK my_putxy(void *arg) {
-
- int x, y, z;
- unsigned long btn;
-
- clear();
-
- while (1) {
- mouse_getposition(&x, &y, &z, &btn);
- place(10, 10);
- cprintf("X: %2d - Y: %2d - Z: %3d - Btn: %4d\n", x, y, z, (int)btn);
-
- task_endcycle();
- }
-}
-
-int main(int argc, char **argv)
-{
- SOFT_TASK_MODEL mp;
- PID pid;
- KEY_EVT ev;
-
- ev.ascii = 'c';
- ev.scan = KEY_C;
- ev.status = KEY_PRESSED;
- ev.flag = CNTL_BIT;
- keyb_hook(ev, my_sysclose, FALSE);
- ev.flag = CNTR_BIT;
- keyb_hook(ev, my_sysclose, FALSE);
-
- mouse_txtcursor(ENABLE);
-
- soft_task_default_model(mp);
- soft_task_def_level(mp,2);
- soft_task_def_ctrl_jet(mp);
- soft_task_def_met(mp,700);
- soft_task_def_period(mp,1000);
- soft_task_def_usemath(mp);
- pid = task_create("Mouse_Print", my_putxy, &mp, NULL);
- if (pid == NIL) {
- sys_shutdown_message("Could not create task <Mouse_Print>\n");
- my_sysclose(NULL);
- } else
- task_activate(pid);
-
- return 0;
-}
/demos/tags/rel_1_5_3/input/mouse.c
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: demos/tags/rel_1_5_3/input/initkey.c
===================================================================
--- demos/tags/rel_1_5_3/input/initkey.c (revision 1614)
+++ demos/tags/rel_1_5_3/input/initkey.c (nonexistent)
@@ -1,154 +0,0 @@
-/*
- * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- * Gerardo Lamastra <gerardo@sssup.it>
- *
- * Authors :
- * Mauro Marinoni <mauro.marinoni@unipv.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.it>
- * (see authors.txt for full list of hartik's authors)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://hartik.sssup.it
- */
-
-/*
- * 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 "edf/edf/edf.h"
-#include "cbs/cbs/cbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-#include "intdrive/intdrive/intdrive.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_keyb26.h>
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#define INTDRIVE_FLAG 0
-
-void call_shutdown_task(void *arg);
-int device_drivers_init();
-int device_drivers_close();
-void set_shutdown_task();
-TASK shutdown_task_body(void *arg);
-
-PID shutdown_task_PID = 1;
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- return TICK;
-}
-
-int device_drivers_close() {
-
- KEYB26_close();
- INPUT26_close();
-
- return 0;
-
-}
-
-int device_drivers_init() {
-
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
- INPUT26_init();
-
- /*keyb_def_map(kparms, KEYMAP_IT);*/
- keyb_def_ctrlC(kparms, NULL);
- KEYB26_init(&kparms);
-
- return 0;
-}
-
-TASK shutdown_task_body(void *arg) {
-
- device_drivers_close();
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
- return NULL;
-}
-
-#define SHUTDOWN_TIMEOUT_SEC 3
-
-void set_shutdown_task() {
-
- NRT_TASK_MODEL nrt;
-
- nrt_task_default_model(nrt);
- nrt_task_def_system(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");
- exit(1);
- }
-
-}
-
-void call_shutdown_task(void *arg) {
-
- struct timespec t;
-
- sys_gettime(&t);
- t.tv_sec += SHUTDOWN_TIMEOUT_SEC;
-
- /* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */
- kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0);
-
- task_activate(shutdown_task_PID);
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
Index: demos/tags/rel_1_5_3/input/makefile
===================================================================
--- demos/tags/rel_1_5_3/input/makefile (revision 1614)
+++ demos/tags/rel_1_5_3/input/makefile (nonexistent)
@@ -1,28 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= input speak key mouse joy
-
-include $(BASE)/config/example.mk
-
-input:
- make -f $(SUBMAKE) APP=input INIT= OTHEROBJS="initfile.o" SHARKOPT="__INPUT__ __LINUXC26__ __PCI__ __FB__"
-
-speak:
- make -f $(SUBMAKE) APP=speak INIT= OTHEROBJS="initspk.o" SHARKOPT="__INPUT__ __LINUXC26__ __PCI__"
-
-key:
- make -f $(SUBMAKE) APP=key INIT= OTHEROBJS="initkey.o" SHARKOPT="__INPUT__ __LINUXC26__ __PCI__"
-
-mouse:
- make -f $(SUBMAKE) APP=mouse INIT= OTHEROBJS="initcur.o" SHARKOPT="__INPUT__ __LINUXC26__ __PCI__"
-
-joy:
- make -f $(SUBMAKE) APP=joy INIT= OTHEROBJS="initjoy.o" SHARKOPT="__INPUT__ __LINUXC26__ __PCI__"
-
Index: demos/tags/rel_1_5_3/input/initcur.c
===================================================================
--- demos/tags/rel_1_5_3/input/initcur.c (revision 1614)
+++ demos/tags/rel_1_5_3/input/initcur.c (nonexistent)
@@ -1,164 +0,0 @@
-/*
- * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- * Gerardo Lamastra <gerardo@sssup.it>
- *
- * Authors :
- * Mauro Marinoni <mauro.marinoni@unipv.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.it>
- * (see authors.txt for full list of hartik's authors)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://hartik.sssup.it
- */
-
-/*
- * 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 "edf/edf/edf.h"
-#include "cbs/cbs/cbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-#include "intdrive/intdrive/intdrive.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_mouse26.h>
-#include <drivers/shark_keyb26.h>
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#define INTDRIVE_FLAG 0
-
-void call_shutdown_task(void *arg);
-int device_drivers_init();
-int device_drivers_close();
-void set_shutdown_task();
-TASK shutdown_task_body(void *arg);
-
-PID shutdown_task_PID = 1;
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- return TICK;
-}
-
-int device_drivers_close() {
-
- MOUSE26_close();
- KEYB26_close();
- INPUT26_close();
-
- return 0;
-}
-
-int device_drivers_init() {
-
- KEYB_PARMS kparms = BASE_KEYB;
- MOUSE_PARMS mparms = BASE_MOUSE;
-
- LINUXC26_register_module(TRUE);
- INPUT26_init();
-
- /*keyb_def_map(kparms, KEYMAP_IT);*/
- keyb_def_ctrlC(kparms, NULL);
- KEYB26_init(&kparms);
-
- MOUSE26_init(&mparms);
-
- return 0;
-
-}
-
-TASK shutdown_task_body(void *arg) {
-
- device_drivers_close();
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
- return NULL;
-}
-
-void set_shutdown_task() {
-
- NRT_TASK_MODEL nrt;
-
- nrt_task_default_model(nrt);
- nrt_task_def_system(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");
- exit(1);
- }
-
-}
-
-#define SHUTDOWN_TIMEOUT_SEC 3
-
-void call_shutdown_task(void *arg) {
- struct timespec t;
-
- sys_gettime(&t);
- t.tv_sec += SHUTDOWN_TIMEOUT_SEC;
-
- /* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */
- kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0);
-
- task_activate(shutdown_task_PID);
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
/demos/tags/rel_1_5_3/input/initcur.c
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: demos/tags/rel_1_5_3/input/input.c
===================================================================
--- demos/tags/rel_1_5_3/input/input.c (revision 1614)
+++ demos/tags/rel_1_5_3/input/input.c (nonexistent)
@@ -1,452 +0,0 @@
-
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * Authors : Mauro Marinoni <mauro.marinoni@unipv.it>
- * (see authors.txt for full list of hartik's authors)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * 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 <kernel/func.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <drivers/shark_fb26.h>
-
-#include <drivers/shark_mouse26.h>
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_spk26.h>
-#include <drivers/shark_joy26.h>
-
-#define RGB_BLACK rgb16( 0, 0, 0)
-#define RGB_GRAY rgb16(127,127,127)
-#define RGB_WHITE rgb16(255,255,255)
-#define RGB_RED rgb16(255, 0, 0)
-#define RGB_GREEN rgb16( 0,255, 0)
-#define RGB_BLUE rgb16( 0, 0,255)
-#define RGB_YELLOW rgb16(255,255, 0)
-#define RGB_MAGENTA rgb16(255, 0,255)
-#define RGB_CYAN rgb16( 0,255,255)
-#define RGB_D_RED rgb16(127, 0, 0)
-#define RGB_D_GREEN rgb16( 0,127, 0)
-#define RGB_D_BLUE rgb16( 0, 0,127)
-#define RGB_D_YELLOW rgb16(127,127, 0)
-#define RGB_D_MAGENTA rgb16(127, 0,127)
-#define RGB_D_CYAN rgb16( 0,127,127)
-
-void my_sysend(KEY_EVT *e)
-{
- exit(0);
-}
-
-void no_note(KEY_EVT *e)
-{
- speaker_sound(0, 0);
-}
-
-void my_note(KEY_EVT *e)
-{
- switch (e->scan) {
- case KEY_Q:
- speaker_sound(262, 0); /* DO */
- break;
- case KEY_W:
- speaker_sound(277, 0); /* DO# */
- break;
- case KEY_E:
- speaker_sound(294, 0); /* RE */
- break;
- case KEY_R:
- speaker_sound(311, 0); /* RE# */
- break;
- case KEY_T:
- speaker_sound(330, 0); /* MI */
- break;
- case KEY_Y:
- speaker_sound(349, 0); /* FA */
- break;
- case KEY_U:
- speaker_sound(370, 0); /* FA# */
- break;
- case KEY_I:
- speaker_sound(392, 0); /* SOL */
- break;
- case KEY_O:
- speaker_sound(415, 0); /* SOL# */
- break;
- case KEY_P:
- speaker_sound(440, 0); /* LA */
- break;
- case KEY_BRL:
- speaker_sound(466, 0); /* LA# */
- break;
- case KEY_BRR:
- speaker_sound(494, 0); /* SI */
- break;
- }
-}
-
-TASK my_getjoy(void *arg)
-{
- int a0, a1, a2, a3, btn;
- char st[20];
-
- while (1) {
- joy_getstatus(&a0, &a1, &a2, &a3, &btn);
-
- sprintf(st, "X Axis : %6d ", a0);
- grx_text(st, 100, 64, RGB_CYAN, RGB_BLACK);
- sprintf(st, "Y Axis : %6d ", a1);
- grx_text(st, 100, 114, RGB_CYAN, RGB_BLACK);
- sprintf(st, "Buttons: %2x ", btn);
- grx_text(st, 100, 164, RGB_CYAN, RGB_BLACK);
-
- task_endcycle();
- if (btn == 0xF)
- my_sysend(NULL);
- }
-}
-
-TASK my_getch(void *arg)
-{
-#define MYNCHAR 25
-
- BYTE ch;
- int i = 0;
- char st[20];
-
- while (1) {
- ch = keyb_getch(NON_BLOCK);
- if (ch) {
- if (ch == BACKSPACE) { //backspace
- i--;
- //ch = 0x20;
- }
- if (ch == ENTER) { //enter
- i = ((i / MYNCHAR) + 1) * MYNCHAR - 1;
- ch = 0x20;
- }
- sprintf(st, "%c", ch);
- grx_text(st, 340 + 10 * (i%MYNCHAR), 25 + 20 * (i/MYNCHAR), RGB_BLUE, RGB_BLACK);
-
- if (ch == BACKSPACE) //backspace
- i--;
- if (++i >= MYNCHAR * 9) {
- i = 0;
- grx_box(315, 15, 623, 223, RGB_BLACK);
- }
- }
-
- task_endcycle();
- }
-}
-
-void my_mouse(MOUSE_EVT *e)
-{
- char st[20];
- char pressed = 0;
-
- sprintf(st, "X Axis : %3d (%4d)", e->x, e->dx);
- grx_text(st, 100, 280, RGB_YELLOW, RGB_BLACK);
- sprintf(st, "Y Axis : %3d (%4d)", e->y, e->dy);
- grx_text(st, 100, 320, RGB_YELLOW, RGB_BLACK);
- sprintf(st, "Z Axis : %3d (%4d)", e->z, e->dz);
- grx_text(st, 100, 360, RGB_YELLOW, RGB_BLACK);
- sprintf(st, "Buttons: %6x ", (int)e->buttons);
- grx_text(st, 100, 400, RGB_YELLOW, RGB_BLACK);
-
- if ((e->x > 377) && (e->x < 401) && (e->y > 300) && (e->y < 360) && (e->buttons == MOUSE_LBUTTON)){
- if (!pressed) {
- speaker_sound(277, 0); /* DO# */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 407) && (e->x < 431) && (e->y > 300) && (e->y < 360) && (e->buttons == MOUSE_LBUTTON)){
- if (!pressed) {
- speaker_sound(311, 0); /* RE# */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 467) && (e->x < 491) && (e->y > 300) && (e->y < 360) && (e->buttons == MOUSE_LBUTTON)){
- if (!pressed) {
- speaker_sound(370, 0); /* FA# */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 497) && (e->x < 521) && (e->y > 300) && (e->y < 360) && (e->buttons == MOUSE_LBUTTON)){
- if (!pressed) {
- speaker_sound(415, 0); /* SOL# */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 527) && (e->x < 551) && (e->y > 300) && (e->y < 360) && (e->buttons == MOUSE_LBUTTON)){
- if (!pressed) {
- speaker_sound(466, 0); /* LA# */
- pressed = 1;
- }
- return;
- }
-
- if ((e->x > 360) && (e->x < 388) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)){
- if (!pressed) {
- speaker_sound(262, 0); /* DO */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 390) && (e->x < 418) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) {
- if (!pressed) {
- speaker_sound(294, 0); /* RE */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 420) && (e->x < 448) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) {
- if (!pressed) {
- speaker_sound(330, 0); /* MI */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 450) && (e->x < 478) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) {
- if (!pressed) {
- speaker_sound(349, 0); /* FA */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 480) && (e->x < 508) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) {
- if (!pressed) {
- speaker_sound(392, 0); /* SOL */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 510) && (e->x < 538) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) {
- if (!pressed) {
- speaker_sound(440, 0); /* LA */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 540) && (e->x < 568) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) {
- if (!pressed) {
- speaker_sound(494, 0); /* SI */
- pressed = 1;
- }
- return;
- }
-
- speaker_sound(0, 0);
- pressed = 0;
-}
-
-void graph_init(void)
-{
- grx_rect( 4, 4, 634, 474, RGB_WHITE);
- grx_rect( 14, 14, 304, 224, RGB_YELLOW);
- grx_rect(314, 14, 624, 224, RGB_RED);
- grx_rect( 14, 234, 304, 464, RGB_GREEN);
- grx_rect(314, 234, 624, 464, RGB_BLUE);
-
- /* Draw Teyboard */
- grx_box(360, 300, 388, 400, RGB_WHITE); /* DO */
- grx_box(390, 300, 418, 400, RGB_WHITE); /* RE */
- grx_box(420, 300, 448, 400, RGB_WHITE); /* MI */
- grx_box(450, 300, 478, 400, RGB_WHITE); /* FA */
- grx_box(480, 300, 508, 400, RGB_WHITE); /* SOL */
- grx_box(510, 300, 538, 400, RGB_WHITE); /* LA */
- grx_box(540, 300, 568, 400, RGB_WHITE); /* SI */
-
- grx_box(377, 301, 401, 360, RGB_BLACK); /* DO# */
- grx_box(407, 301, 431, 360, RGB_BLACK); /* RE# */
- grx_box(467, 301, 491, 360, RGB_BLACK); /* FA# */
- grx_box(497, 301, 521, 360, RGB_BLACK); /* SOL# */
- grx_box(527, 301, 551, 360, RGB_BLACK); /* LA# */
-}
-
-void start_sound(void)
-{
- KEY_EVT ev;
-
- speaker_sound(440, 400);
- while ( (sys_gettime(NULL)/1000) < 1000);
-
- ev.ascii = 'q';
- ev.scan = KEY_Q;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'w';
- ev.scan = KEY_W;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'e';
- ev.scan = KEY_E;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'r';
- ev.scan = KEY_R;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 't';
- ev.scan = KEY_T;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'y';
- ev.scan = KEY_Y;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'u';
- ev.scan = KEY_U;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'i';
- ev.scan = KEY_I;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'o';
- ev.scan = KEY_O;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'p';
- ev.scan = KEY_P;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = '[';
- ev.scan = KEY_BRL;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = ']';
- ev.scan = KEY_BRR;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-}
-
-int main(int argc, char **argv)
-{
- SOFT_TASK_MODEL mp;
- PID pid;
-
- KEY_EVT ev;
-
- ev.ascii = 'c';
- ev.scan = KEY_C;
- ev.status = KEY_PRESSED;
- ev.flag = CNTL_BIT;
- keyb_hook(ev, my_sysend, FALSE);
- ev.flag = CNTR_BIT;
- keyb_hook(ev, my_sysend, FALSE);
-
- graph_init();
-
- mouse_grxlimits(639, 479);
- mouse_setposition(319, 239, 0);
- mouse_hook(my_mouse);
- mouse_grxcursor(ENABLE, 2);
-
- soft_task_default_model(mp);
- soft_task_def_level(mp,2);
- soft_task_def_ctrl_jet(mp);
- soft_task_def_met(mp,700);
- soft_task_def_period(mp,10000);
- soft_task_def_usemath(mp);
- pid = task_create("Key_Print", my_getch, &mp, NULL);
- if (pid == NIL) {
- sys_shutdown_message("Could not create task <Key_Print>\n");
- exit(1);
- } else
- task_activate(pid);
-
- if (JOY26_installed()) {
- soft_task_default_model(mp);
- soft_task_def_level(mp,2);
- soft_task_def_ctrl_jet(mp);
- soft_task_def_met(mp,700);
- soft_task_def_period(mp,10000);
- soft_task_def_usemath(mp);
- pid = task_create("Joy_Print", my_getjoy, &mp, NULL);
- if (pid == NIL) {
- sys_shutdown_message("Could not create task <Joy_Print>\n");
- exit(1);
- } else
- task_activate(pid);
- }
-
- start_sound();
- return 0;
-}
Index: demos/tags/rel_1_5_3/dynademo/readme.txt
===================================================================
--- demos/tags/rel_1_5_3/dynademo/readme.txt (revision 1614)
+++ demos/tags/rel_1_5_3/dynademo/readme.txt (nonexistent)
@@ -1,83 +0,0 @@
----------------------------------------------
-Dynalink Demo.
----------------------------------------------
-This is the Dynalink for S.H.A.R.K demo.
-Source files are in /shark/projects/dynademo
-The SHARK kernel and the user application
-are compiled seperatly by;
-
-make_os.mk
-make_app.mk
-
-The resulting OS kernel file is a default
-SHARK mutliboot compliant ELF executable.
-The resluting user Application is an ELF object file.
-
-Also included is a small test data.bin file
-to illustrate the use of extra data module parsing through GRUB.
-
-The idea is to boot the SHARK kernel through GRUB,
-and parsing the User Application plus any needed
-data files as 'boot modules'.
-GRUB usage example:
-
-# For booting SHARK image from HD
-title S.H.A.R.K + Boot Modules from HD 0,0
-kernel (hd0,0)/boot/os mount root=/dev/hda1
-module (hd0,0)/boot/sh_app.bin
-module (hd0,0)/boot/data.bin
-
-This could be a possible solution to get by
-certain GPL restrictions since no GPL code
-resides in the user application.
-The user application is dynamicly linked
-after the kernel is loaded.
-
-Another advantage is that we have a simple
-way of loading data files without the need for
-an IDE-driver plus Filesystem.
-Good enough for a few embedded solutions.
-
--------------------------------------------------------------
-Dynalink code
--------------------------------------------------------------
-The Dynalinker is based on Luca Abenia's code
-as used in the FD32 project.
-Source files are in /shark/dynalink
-The Dynalink makefile produces libdynalink.a
-which is compiled into the kernel by adding SHARKOPT =" __DYNALINK__"
-
-Also not that I added a section to config.mk as
-you can see in the included config.mk
-
-# added for dynalink [lex]
-ifndef DYNALINK
-LINK_OPT = -Bstatic -Ttext $(MEM_START) -s -nostartfiles -nostdlib -L$(LIB_PATH) -L$(OSLIB_PATH)
-else
-LINK_OPT = -Bstatic
-endif
-
-Operation:
-The Dynalinker supports only ELF objects.
-Everything else is loaded and treated as Data objects.
-
-After the SHARK kernel is booted it will execute main()
-which sole purpose here is to process all parsed
-boot modules, link any valid ELF objects
-and put the results in a dynalink_module_list struct.
-This struct is then used to run the actual User Application
-and to hold info about possible data files in memory
-that the User Application can use.
-
-The dynalinker uses a syscall_table to export/import the symbols.
-(review dynalink.c)
-Not all SHARK/Library functions needs to be exported!
-This is of course just an example.
-
-
-/Lex Nahumury 5:41 19-7-06
-
-
-
-
-
Index: demos/tags/rel_1_5_3/dynademo/data.bin
===================================================================
--- demos/tags/rel_1_5_3/dynademo/data.bin (revision 1614)
+++ demos/tags/rel_1_5_3/dynademo/data.bin (nonexistent)
@@ -1,11 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-/////////////// User Application running /////////////////////////////
-
-Dynalink demo.
-
-An ELF object (which is running now) and a data file
-(which you read now) are parsed as 'boot modules'
-to the S.H.A.R.K kernel by GRUB.
-
-Press a key to continue with this lame application.....:)
-//////////////////////////////////////////////////////////////////////
\ No newline at end of file
Index: demos/tags/rel_1_5_3/dynademo/app.c
===================================================================
--- demos/tags/rel_1_5_3/dynademo/app.c (revision 1614)
+++ demos/tags/rel_1_5_3/dynademo/app.c (nonexistent)
@@ -1,188 +0,0 @@
-///////////////////////////////////////////////////
-// app.c -Lex Nahumury 2006
-//
-// This would be the Closed Source User Application part.
-// The ELF object itself contains no GPL code.
-// The references to GPL code are resolved
-// by the Dynamic Linker after the kernel has loaded.
-//
-//////////////////////////////////////////////////
-
-/*
-Usage example:
-
-# For booting SHARK image from HD
-title S.H.A.R.K + Boot Modules from HD 0,0
-kernel (hd0,0)/boot/os mount root=/dev/hda1
-module (hd0,0)/boot/sh_app.bin
-module (hd0,0)/boot/data.bin
-
-*/
-
-#include "kernel/kern.h"
-#include <kernel/func.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include "ll/i386/cons.h"
-
-#include <drivers/shark_keyb26.h>
-#include "../../ports/dynalink/dynalink.h"
-
-extern void call_shutdown_task(void *arg);
-extern DWORD get_tick();
-
-struct params
-{
- int task_nr;
- int row;
- int count;
- int cycles;
-};
-
-
-TASK periodic_task(void *arg)
-{
- int ani=0;
- char c[2];
- struct params* p = (struct params*)(arg);
- int row = p->row;
- char txt[4];
- p->count=0;
-
- while(p->count < p->cycles)
- {
- switch(ani)
- {
- case 0:
- ani=1; sprintf(c,"%s", "\\");
- break;
- case 1:
- ani=2; sprintf(c,"/");
- break;
- case 2:
- ani=0; sprintf(c,"-");
- break;
- }
- puts_xy(12,row,YELLOW, c );
-
- ++p->count;
- sprintf(txt,"%02d", p->count);
- puts_xy(8,row,YELLOW, txt);
-
- task_endcycle();
- }
-
- cprintf("Task #%d end.\n", p->task_nr);
- if(p->task_nr==4) call_shutdown_task(0);
- return 0;
-};
-
-
-// This is the main user application entry point.
-int main_module_entry(void* arg)
-{
- struct dynalink_module_list* dml = (struct dynalink_module_list*)arg;
-
- // make char pointer to text data module,..
- char* txt = (char*)(dml->dat[0].start);
-
- // ... and print out it's data content
- cprintf("%s", txt);
-
- keyb_getch(BLOCK);
- clear();
-
- SOFT_TASK_MODEL msoft;
- PID p1,p2,p3,p4;
-
- int yrow = 1;
- puts_xy(0,yrow, 7,"Task#1:[ ]");
- puts_xy(0,yrow+1,7,"Task#2:[ ]");
- puts_xy(0,yrow+2,7,"Task#3:[ ]");
- puts_xy(0,yrow+3,7,"Task#4:[ ]");
-
- place(0,7);
-
- // Init shared soft task model
- soft_task_default_model(msoft);
- soft_task_def_met(msoft,10000);
- soft_task_def_group(msoft, 1);
- soft_task_def_periodic(msoft);
- soft_task_def_level(msoft, 2);
-
- int cycles = 4;
-
- // init Task 1
- float task_periode = 1.0; // 1sec
- int tick = get_tick(); // 1000 usec = 1 ms
- int per = (int)( task_periode *1000.0 * tick);
- struct params pp1;
- pp1.task_nr = 1;
- pp1.row = yrow;
- pp1.cycles = cycles;
- soft_task_def_period(msoft, per); // set period
- soft_task_def_arg(msoft, (void*)(&pp1) ); // set arguments
- p1 = task_create("save", periodic_task, &msoft, NULL);
- if (p1 == NIL)
- {
- sys_shutdown_message("Can't create task1 ...\n");
- exit(1);
- }
-
- // init Task 2
- task_periode = task_periode*0.5; // twice as fast as task1
- tick = get_tick(); // 1000 usec = 1 ms
- per = (int)( task_periode *1000.0 * tick);
- struct params pp2;
- pp2.task_nr = 2;
- pp2.row = yrow+1;
- pp2.cycles = cycles*2;
- soft_task_def_period(msoft, per);
- soft_task_def_arg(msoft, (void*)(&pp2) );
- p2 = task_create("skip", periodic_task, &msoft, NULL);
- if (p2 == NIL)
- {
- sys_shutdown_message("Can't create task2...\n");
- exit(1);
- }
-
- // init Task 3
- task_periode = task_periode*0.5; // twice as fast as previous task
- tick = get_tick(); // 1000 usec = 1 ms
- per = (int)( task_periode *1000.0 * tick);
- struct params pp3;
- pp3.task_nr = 3;
- pp3.row = yrow+2;
- pp3.cycles = cycles*4;
- soft_task_def_period(msoft, per);
- soft_task_def_arg(msoft, (void*)(&pp3) );
- p3 = task_create("skip", periodic_task, &msoft, NULL);
- if(p3 == NIL)
- {
- sys_shutdown_message("Can't create task3...\n");
- exit(1);
- }
-
- // init Task 4
- task_periode = task_periode*0.5; // twice as fast as previous task
- tick = get_tick(); // 1000 usec = 1 ms
- per = (int)( task_periode *1000.0 * tick);
- struct params pp4;
- pp4.task_nr = 4;
- pp4.row = yrow+3;
- pp4.cycles = cycles*8;
- soft_task_def_period(msoft, per);
- soft_task_def_arg(msoft, (void*)(&pp4) );
- p4 = task_create("skip", periodic_task, &msoft, NULL);
- if(p4 == NIL)
- {
- sys_shutdown_message("Can't create task4...\n");
- exit(1);
- }
-
- group_activate(1);
-
- return 0;
-};
Index: demos/tags/rel_1_5_3/dynademo/os.c
===================================================================
--- demos/tags/rel_1_5_3/dynademo/os.c (revision 1614)
+++ demos/tags/rel_1_5_3/dynademo/os.c (nonexistent)
@@ -1,201 +0,0 @@
-//////////////////////////////////////////////////////////////
-// os.c -Lex Nahumury 2006
-//
-// This is the OpenSource SHARK OS/kernel part.
-// It will dynamicly link the main application ELF object
-// through 'Dynalink'.
-//
-//////////////////////////////////////////////////////////////
-#include "kernel/kern.h"
-#include <kernel/func.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include "ll/i386/cons.h"
-
-#include "edf/edf/edf.h"
-#include "cbs/cbs/cbs.h"
-#include "hardcbs/hardcbs/hardcbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-#include "intdrive/intdrive/intdrive.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_pci26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_keyb26.h>
-
-// DYNALINK
-#include <dynalink.h>
-
-// some shark pci forward declaration stuff
-extern int pci20to26_find_class(unsigned int class_code, int index, BYTE *bus, BYTE *dev);
-extern int pci20to26_read_config_byte(unsigned int bus, unsigned int dev, int where, BYTE *val);
-extern int pci20to26_read_config_word(unsigned int bus, unsigned int dev, int where, WORD *val);
-extern int pci20to26_read_config_dword(unsigned int bus, unsigned int dev, int where, DWORD *val);
-extern int pci20to26_write_config_byte(unsigned int bus, unsigned int dev, int where, BYTE val);
-extern int pci20to26_write_config_word(unsigned int bus, unsigned int dev, int where, WORD val);
-extern int pci20to26_write_config_dword(unsigned int bus, unsigned int dev, int where, DWORD val);
-
-
-#define TICK 1000 // 1ms
-#define RRTICK 100000 // 100ms
-
-/*+ IntDrive Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#define INTDRIVE_FLAG 0
-
-#define NSEC_PER_SEC (1000000000L)
-#define SHUTDOWN_TIMEOUT_SEC 0.5 // seconds
-
-// prototypes
-void call_shutdown_task(void *arg);
-int device_drivers_init();
-int device_drivers_close();
-void set_shutdown_task();
-TASK shutdown_task_body(void *arg);
-
-// user application function pointer prototype
-int (*main_app_entry)(void* arg);
-
-
-// vars
-static struct multiboot_info *mb = 0;
-static struct dynalink_module_list dml;
-PID shutdown_task_PID = -1;
-
-
-// user app calls this to retrieve tick
-DWORD get_tick()
-{
- return TICK;
-};
-
-TASK shutdown_task_body(void *arg)
-{
- device_drivers_close();
- sys_shutdown_message("-- OS Closed --\n");
- return NULL;
-};
-
-void set_shutdown_task()
-{
- NRT_TASK_MODEL nrt;
- nrt_task_default_model(nrt);
- nrt_task_def_system(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");
- exit(1);
- }
-};
-
-
-void call_shutdown_task(void *arg)
-{
- struct timespec t;
- sys_gettime(&t);
- t.tv_nsec += NSEC_PER_SEC * SHUTDOWN_TIMEOUT_SEC;
- kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0);
- task_activate(shutdown_task_PID);
-};
-
-
-TIME __kernel_register_levels__(void *arg)
-{
- mb = (struct multiboot_info *)arg;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
- CABS_register_module();
-
- return TICK;
-};
-
-TASK __init__(void *arg)
-{
- mb = (struct multiboot_info *)arg;
-
- //HARTPORT_init();
- set_shutdown_task();
- device_drivers_init();
-
- sys_atrunlevel( call_shutdown_task,
- NULL,
- RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-};
-
-
-int main(int argc, char **argv)
-{
- // Any modules passed to kernel by GRUB?
- if(!mb->mods_count)
- {
- printk("No modules passed at all! Bye..\n");
- exit(1);
- }
-
- // Process the modules through 'dynalink'
- dynalink_modules(mb, &dml, "_module_entry");
- if(dml.num_apps == 0)
- {
- printk("No Application modules found! Bye..\n");
- exit(1);
- }
-
- // Run first found user application function
- // and pass the dynalink_module_list..
- DWORD dynadr = dml.app[0].dyn_entry;
- if(dynadr)
- {
- main_app_entry = (void*)dynadr;
- main_app_entry(&dml);
- }
- else
- {
- printk("No Application modules found! Bye..\n");
- exit(1);
- }
-return 0;
-};
-
-
-int device_drivers_init()
-{
- LINUXC26_register_module(TRUE);
- //PCI26_init();
- INPUT26_init();
-
- KEYB_PARMS kparms = BASE_KEYB;
- keyb_def_ctrlC(kparms, NULL);
- KEYB26_init(&kparms);
-
- return 0;
-};
-
-int device_drivers_close()
-{
- KEYB26_close();
- INPUT26_close();
- return 0;
-};
-
-
Index: demos/tags/rel_1_5_3/dynademo/make_app.mk
===================================================================
--- demos/tags/rel_1_5_3/dynademo/make_app.mk (revision 1614)
+++ demos/tags/rel_1_5_3/dynademo/make_app.mk (nonexistent)
@@ -1,35 +0,0 @@
-# This will make one single object file from multiple sources [Lex.N]
-
-DYNALINK=1
-ifndef BASE
-BASE=../..
-endif
-
-include $(BASE)/config/config.mk
-
-OTHERINCL += -I$(BASE)/drivers/linuxc26/include -I./include -I.
-OTHERINCL += -I$(BASE)/drivers/pci/include
-OTHERINCL += -I$(BASE)/drivers/input/include
-
-# add all sources here..
-OBJS = app.o
-
-all: sh_app.o
- $(MV) sh_app.o sh_app.bin
-
-
-clean :
- $(RM) *.o
-
-sh_app.o: $(OBJS)
- $(LD) $(LINK_OPT) $(OBJS) -r -s -o sh_app.o
-
-
-# Common rules
-%.o : %.c
- $(REDIR) $(CC) $(C_OPT) $(C_OUTPUT) -c $<
-%.s : %.c
- $(REDIR) $(CC) $(C_OPT) $(C_OUTPUT) -S $<
-%.o : %.s
- $(CC) $(ASM_OPT) -c $<
-
Index: demos/tags/rel_1_5_3/dynademo/make_os.mk
===================================================================
--- demos/tags/rel_1_5_3/dynademo/make_os.mk (revision 1614)
+++ demos/tags/rel_1_5_3/dynademo/make_os.mk (nonexistent)
@@ -1,19 +0,0 @@
-#
-
-ifndef BASE
-BASE=../..
-endif
-
-PROGS = os
-
-include $(BASE)/config/config.mk
-include $(BASE)/config/example.mk
-
-$(PROGS):
- make -f $(SUBMAKE) APP=$(PROGS) \
- INIT= \
- OTHEROBJS= \
- OTHERINCL= \
- SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __DYNALINK__"
-
-
Index: demos/tags/rel_1_5_3/cpufreq/initfile.c
===================================================================
--- demos/tags/rel_1_5_3/cpufreq/initfile.c (revision 1614)
+++ demos/tags/rel_1_5_3/cpufreq/initfile.c (nonexistent)
@@ -1,186 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Giacomo Guidi <giacomo@gandalf.sssup.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.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
- */
-
-/*
- * 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "hardcbs/hardcbs/hardcbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.h"
-
-#include "drivers/shark_linuxc26.h"
-#include "drivers/shark_input26.h"
-#include "drivers/shark_keyb26.h"
-
-#include <drivers/shark_cpu26.h>
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-/*+ IntDrive Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#define INTDRIVE_FLAG 0
-
-void call_shutdown_task(void *arg);
-int device_drivers_init();
-int device_drivers_close();
-void set_shutdown_task();
-TASK shutdown_task_body(void *arg);
-
-PID shutdown_task_PID = -1;
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- HCBS_register_level(HCBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- /* Create the shutdown task. It will be activated at RUNLEVEL
- SHUTDOWN */
- set_shutdown_task();
-
- /* Init the drivers */
- device_drivers_init();
-
- /* Set the shutdown task activation */
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- //sys_set_reboot(EXIT_MODE_HALT);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-void set_shutdown_task() {
-
- /* WARNING: the shutdown task is a background thread. It cannot execute
- if the system is overloaded */
- NRT_TASK_MODEL nrt;
-
- nrt_task_default_model(nrt);
- nrt_task_def_system(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");
- exit(1);
- }
-
-}
-
-int device_drivers_init() {
-
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- CPU26_init();
-
- CPU26_DVS_init();
-
- INPUT26_init();
-
- keyb_def_ctrlC(kparms, NULL);
-
- KEYB26_init(&kparms);
-
- return 0;
-
-}
-
-int device_drivers_close() {
-
- //CPU26_DVS_close();
-
- KEYB26_close();
-
- INPUT26_close();
-
- return 0;
-
-}
-
-#define SHUTDOWN_TIMEOUT_SEC 3
-
-void call_shutdown_task(void *arg)
-{
- struct timespec t;
-
- sys_gettime(&t);
- t.tv_sec += SHUTDOWN_TIMEOUT_SEC;
-
- /* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */
- kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0);
-
- task_activate(shutdown_task_PID);
-}
-
-TASK shutdown_task_body(void *arg) {
-
- device_drivers_close();
-
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
-
- return NULL;
-
-}
-
Index: demos/tags/rel_1_5_3/cpufreq/cpufreq.c
===================================================================
--- demos/tags/rel_1_5_3/cpufreq/cpufreq.c (revision 1614)
+++ demos/tags/rel_1_5_3/cpufreq/cpufreq.c (nonexistent)
@@ -1,75 +0,0 @@
-
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * Authors : Mauro Marinoni
- * Giacomo Guidi <giacomo@gandalf.sssup.it>
- * (see authors.txt for full list of hartik's authors)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * 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 <drivers/shark_keyb26.h>
-#include <drivers/shark_cpu26.h>
-
-void endfunc(KEY_EVT *e)
-{
- exit(0);
-}
-
-int main(int argc, char **argv)
-{
- int val, num;
- char buf[1000];
-
- CPU26_showinfo();
-
- val = CPU26_get_min_frequency();
- cprintf("Min freq: %d\n", val);
-
- val = CPU26_get_max_frequency();
- cprintf("Max freq: %d\n", val);
-
- val = CPU26_get_cur_frequency();
- cprintf("Current freq: %d\n", val);
-
- num = CPU26_show_frequencies(buf);
- if (num>0)
- cprintf("Allowed frequencys: %s\n", buf);
- num = CPU26_get_frequencies(cpu26_freqs);
-
- if (num>0) {
- CPU26_set_frequency(cpu26_freqs[0], DVS_RELATION_L);
- val = CPU26_get_cur_frequency();
- cprintf("Actual freq: %d\n", val);
- }
-
- endfunc(NULL);
-
- return 0;
-}
/demos/tags/rel_1_5_3/cpufreq/cpufreq.c
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: demos/tags/rel_1_5_3/cpufreq/makefile
===================================================================
--- demos/tags/rel_1_5_3/cpufreq/makefile (revision 1614)
+++ demos/tags/rel_1_5_3/cpufreq/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= cpufreq
-
-include $(BASE)/config/example.mk
-
-cpufreq:
- make -f $(SUBMAKE) APP=cpufreq INIT= OTHEROBJS="initfile.o" SHARKOPT="__INPUT__ __CPU__ __LINUXC26__ __PCI__"
-
Index: demos/tags/rel_1_5_3/mesatex/mesatex.c
===================================================================
--- demos/tags/rel_1_5_3/mesatex/mesatex.c (revision 1614)
+++ demos/tags/rel_1_5_3/mesatex/mesatex.c (nonexistent)
@@ -1,391 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Giacomo Guidi <giacomo@gandalf.sssup.it>
- *
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * 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 <GL/osmesa.h>
-#include <GL/glut.h>
-
-#include <math.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <kernel/log.h>
-#include <kernel/kern.h>
-
-#include <drivers/shark_fb26.h>
-#include <drivers/shark_keyb26.h>
-
-#ifndef M_PI
-#define M_PI 3.14159265
-#endif
-
-#define WIDTH 640
-#define HEIGHT 430
-#define BYTES_PP 2 //BytesPerPixel
-
-OSMesaContext ctx;
-
-static GLuint TexObj[2];
-static GLfloat Angle = 0.0f;
-static GLboolean UseObj = GL_FALSE;
-
-extern void *video_memory;
-
-#if defined(GL_VERSION_1_1) || defined(GL_VERSION_1_2)
-# define TEXTURE_OBJECT 1
-#elif defined(GL_EXT_texture_object)
-# define TEXTURE_OBJECT 1
-# define glBindTexture(A,B) glBindTextureEXT(A,B)
-# define glGenTextures(A,B) glGenTexturesEXT(A,B)
-# define glDeleteTextures(A,B) glDeleteTexturesEXT(A,B)
-#endif
-
-unsigned char *rgb_565_buf = NULL; //RGB 16 bpp Buffer
-unsigned char *video_buf = NULL; //Video Buffer
-
-unsigned long int RGB565MEM = WIDTH * HEIGHT * BYTES_PP; // Total video mem
-
-unsigned long int PERIOD_REFRESH = 30000;
-unsigned long int PERIOD_DISEGNA = 30000;
-
-unsigned long int WCET_REFRESH, WCET_DISEGNA;
-
-TASK refesh(void);
-TASK disegna(void);
-
-PID refresh_PID, disegna_PID;
-
-static void draw( void )
-{
- glDepthFunc(GL_EQUAL);
- /* glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );*/
- glClear( GL_COLOR_BUFFER_BIT );
-
- glColor3f( 1.0, 1.0, 1.0 );
-
- /* draw first polygon */
- glPushMatrix();
- glTranslatef( -1.0, 0.0, 0.0 );
- glRotatef( Angle, 0.0, 0.0, 1.0 );
- if (UseObj) {
-#ifdef TEXTURE_OBJECT
- glBindTexture( GL_TEXTURE_2D, TexObj[0] );
-#endif
- }
- else {
- glCallList( TexObj[0] );
- }
- glBegin( GL_POLYGON );
- glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 );
- glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 );
- glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 );
- glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 );
- glEnd();
- glPopMatrix();
-
- /* draw second polygon */
- glPushMatrix();
- glTranslatef( 1.0, 0.0, 0.0 );
- glRotatef( Angle-90.0, 0.0, 1.0, 0.0 );
- if (UseObj) {
-#ifdef TEXTURE_OBJECT
- glBindTexture( GL_TEXTURE_2D, TexObj[1] );
-#endif
- }
- else {
- glCallList( TexObj[1] );
- }
- glBegin( GL_POLYGON );
- glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 );
- glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 );
- glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 );
- glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 );
- glEnd();
- glPopMatrix();
-
-}
-
-static void gl_init()
-{
-
- static int twidth=8, theight=8;
- static GLubyte tex1[] = {
- 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0 };
-
- static GLubyte tex2[] = {
- 0, 0, 0, 2, 2, 2, 0, 0,
- 0, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 0, 2, 0, 0, 0, 0,
- 0, 0, 0, 0, 2, 0, 0, 0,
- 0, 0, 0, 0, 0, 2, 0, 0,
- 0, 0, 0, 0, 0, 2, 0, 0,
- 0, 0, 2, 2, 2, 0, 0, 0 };
-
- GLubyte tex[64][3];
- GLint i, j;
-
- //Create the OSMesa Context
- ctx = OSMesaCreateContext(OSMESA_RGB_565, NULL);
-
- //Make Current Context
- OSMesaMakeCurrent(ctx, rgb_565_buf, GL_UNSIGNED_SHORT_5_6_5, WIDTH, HEIGHT);
-
- UseObj = GL_TRUE;
-
- glDisable( GL_DITHER );
-
- /* Setup texturing */
- glEnable( GL_TEXTURE_2D );
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
- glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST );
-
- /* generate texture object IDs */
- if (UseObj) {
-#ifdef TEXTURE_OBJECT
- glGenTextures( 2, TexObj );
-#endif
- }
- else {
- TexObj[0] = glGenLists(2);
- TexObj[1] = TexObj[0]+1;
- }
-
- /* setup first texture object */
- if (UseObj) {
-#ifdef TEXTURE_OBJECT
- glBindTexture( GL_TEXTURE_2D, TexObj[0] );
- assert(glIsTexture(TexObj[0]));
-#endif
- }
- else {
- glNewList( TexObj[0], GL_COMPILE );
- }
- /* red on white */
- for (i=0;i<theight;i++) {
- for (j=0;j<twidth;j++) {
- int p = i*twidth+j;
- if (tex1[(theight-i-1)*twidth+j]) {
- tex[p][0] = 255; tex[p][1] = 0; tex[p][2] = 0;
- }
- else {
- tex[p][0] = 255; tex[p][1] = 255; tex[p][2] = 255;
- }
- }
- }
-
- glTexImage2D( GL_TEXTURE_2D, 0, 3, twidth, theight, 0,
- GL_RGB, GL_UNSIGNED_BYTE, tex );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- if (!UseObj) {
- glEndList();
- }
- /* end of texture object */
-
- /* setup second texture object */
- if (UseObj) {
-#ifdef TEXTURE_OBJECT
- glBindTexture( GL_TEXTURE_2D, TexObj[1] );
- assert(glIsTexture(TexObj[1]));
-#endif
- assert(!glIsTexture(TexObj[1] + 999));
- }
- else {
- glNewList( TexObj[1], GL_COMPILE );
- }
- /* green on blue */
- for (i=0;i<theight;i++) {
- for (j=0;j<twidth;j++) {
- int p = i*twidth+j;
- if (tex2[(theight-i-1)*twidth+j]) {
- tex[p][0] = 0; tex[p][1] = 255; tex[p][2] = 0;
- }
- else {
- tex[p][0] = 0; tex[p][1] = 0; tex[p][2] = 255;
- }
- }
- }
- glTexImage2D( GL_TEXTURE_2D, 0, 3, twidth, theight, 0,
- GL_RGB, GL_UNSIGNED_BYTE, tex );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- if (!UseObj) {
- glEndList();
- }
- /* end texture object */
-
- glViewport(0, 0, (GLint)WIDTH, (GLint)HEIGHT);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- /* glOrtho( -3.0, 3.0, -3.0, 3.0, -10.0, 10.0 );*/
- glFrustum( -2.0, 2.0, 2.0, -2.0, 6.0, 20.0 );
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -8.0 );
-
-}
-
-void program_end(void *arg)
-{
-
- OSMesaDestroyContext(ctx);
- free(rgb_565_buf);
-
- exit(0);
-
-}
-
-void program_key_end(KEY_EVT *k)
-{
-
- exit(0);
-
-}
-
-TASK refresh(void)
-{
-
- while(1) {
-
- memcpy((video_buf+40*WIDTH*2), rgb_565_buf, RGB565MEM);
- task_endcycle();
-
- }
-
- exit(0);
-
-}
-
-
-TASK disegna(void)
-{
-
- char text[100];
- TIME disegna_TIME, refresh_TIME;
-
- while(1) {
-
- jet_gettable(refresh_PID, &refresh_TIME, 1);
- jet_gettable(disegna_PID, &disegna_TIME, 1);
-
- Angle += 2.0;
-
- draw();
-
- sprintf(text,"Hard Task Refresh PER:%6d us EX:%6d us",(int)PERIOD_REFRESH,(int)refresh_TIME);
- grx_text(text,10,5,rgb16(0,0,255),0);
- sprintf(text,"Hard Task Draw PER:%6d us EX:%6d us",(int)PERIOD_DISEGNA,(int)disegna_TIME);
- grx_text(text,10,15,rgb16(0,0,255),0);
-
- task_endcycle();
-
- }
-
- exit(0);
-
-}
-
-int main (int argc, char *argv[])
-{
-
- HARD_TASK_MODEL ht_refresh, ht_disegna;
-
- clear();
-
- WCET_REFRESH =((long int) PERIOD_REFRESH * (0.45));
- WCET_DISEGNA =((long int) PERIOD_DISEGNA * (0.45));
-
- hard_task_default_model(ht_refresh);
- hard_task_def_wcet(ht_refresh,WCET_REFRESH);
- hard_task_def_mit(ht_refresh,PERIOD_REFRESH);
- hard_task_def_usemath(ht_refresh);
- hard_task_def_group(ht_refresh,1);
- hard_task_def_ctrl_jet(ht_refresh);
-
- refresh_PID = task_create("refresh", refresh, &ht_refresh, NULL);
- if (refresh_PID == -1) {
- exit(4);
- }
-
- hard_task_default_model(ht_disegna);
- hard_task_def_mit(ht_disegna,PERIOD_DISEGNA);
- hard_task_def_wcet(ht_disegna,WCET_DISEGNA);
- hard_task_def_group(ht_disegna,1);
- hard_task_def_ctrl_jet(ht_disegna);
- hard_task_def_usemath(ht_disegna);
- hard_task_def_stack(ht_disegna,30000);
-
- disegna_PID = task_create("disegna", disegna, &ht_disegna, NULL);
- if (disegna_PID == -1) {
- exit(4);
- }
-
- {
- KEY_EVT k;
- k.flag = CNTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k, program_key_end, FALSE);
-
- k.flag = CNTR_BIT;
- k.status = KEY_PRESSED;
- keyb_hook(k, program_key_end, FALSE);
- }
-
- rgb_565_buf = malloc(RGB565MEM);
-
- gl_init();
-
- video_buf = (unsigned char *)video_memory;
- //video_buf = (unsigned char *)malloc(640*480*2);
-
- memset(rgb_565_buf, 0, RGB565MEM);
-
- group_activate(1);
-
- return 0;
-
-}
Index: demos/tags/rel_1_5_3/mesatex/readme.txt
===================================================================
--- demos/tags/rel_1_5_3/mesatex/readme.txt (revision 1614)
+++ demos/tags/rel_1_5_3/mesatex/readme.txt (nonexistent)
@@ -1,44 +0,0 @@
---------------------------------------
-MESA Demo (tex)
-
-by
-
-Giacomo Guidi <giacomo@gandalf.sssup.it>
-
-Last update 17/03/2003
---------------------------------------
-
-This is a simple test demo for the MESA (5.0)
-libraries, the low level graphic drivers is
-the SVGA (from the SVGAlib)
-
-See drivers/svga/readme for supported cards
-
---------------------------------------
-
-The demo is composed by:
-
-MAKEFILE The makefile used to compile the application
-README.TXT This file
-INITFILE.C The init file
-MESATEX.C The MESA Demo
-
---------------------------------------
-
-- To specify your card change the line
-
-#define CARD <driver name>
-
-- The demo calls the grx and off-screen Mesa functions.
-The resolution must be 16 bitsperpixel (64K colors) and
-the graphic access mode must be linear.
-
-- There are two buffers
-
- The video buffer (video_buf)
- The virtual buffer (rgb_565_buf)
-
- copy_videomem_16to16 links these buffers
-
-
-
Index: demos/tags/rel_1_5_3/mesatex/makefile
===================================================================
--- demos/tags/rel_1_5_3/mesatex/makefile (revision 1614)
+++ demos/tags/rel_1_5_3/mesatex/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = mesatex
-
-include $(BASE)/config/example.mk
-
-mesatex:
- make -f $(SUBMAKE) APP=mesatex INIT= OTHEROBJS="initfile.o" SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__ __OSMESA__"
-
Index: demos/tags/rel_1_5_3/mesatex/initfile.c
===================================================================
--- demos/tags/rel_1_5_3/mesatex/initfile.c (revision 1614)
+++ demos/tags/rel_1_5_3/mesatex/initfile.c (nonexistent)
@@ -1,202 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Giacomo Guidi <giacomo@gandalf.sssup.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.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
- */
-
-/*
- *
- * 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "hardcbs/hardcbs/hardcbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_pci26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_fb26.h>
-
-#define FRAME_BUFFER_DEVICE 0
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#define INTDRIVE_FLAG 0
-
-void call_shutdown_task(void *arg);
-int device_drivers_init();
-int device_drivers_close();
-void set_shutdown_task();
-TASK shutdown_task_body(void *arg);
-
-PID shutdown_task_PID = -1;
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- HCBS_register_level(HCBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- /* Create the shutdown task. It will be activated at RUNLEVEL
- SHUTDOWN */
- set_shutdown_task();
-
- /* Init the drivers */
- device_drivers_init();
-
- /* Set the shutdown task activation */
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-void set_shutdown_task() {
-
- /* WARNING: the shutdown task is a background thread. It cannot execute
- if the system is overloaded */
- NRT_TASK_MODEL nrt;
-
- nrt_task_default_model(nrt);
- nrt_task_def_system(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");
- exit(1);
- }
-
-}
-
-int device_drivers_init() {
-
- int res;
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- PCI26_init();
-
- INPUT26_init();
-
- keyb_def_ctrlC(kparms, NULL);
-
- KEYB26_init(&kparms);
-
- FB26_init();
-
- res = FB26_open(FRAME_BUFFER_DEVICE);
- if (res) {
- cprintf("Error: Cannot open graphical mode\n");
- KEYB26_close();
- INPUT26_close();
- exit(1);
- }
-
- 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;
-
-}
-
-#define SHUTDOWN_TIMEOUT_SEC 3
-
-void call_shutdown_task(void *arg)
-{
- struct timespec t;
-
- sys_gettime(&t);
- t.tv_sec += SHUTDOWN_TIMEOUT_SEC;
-
- /* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */
- kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0);
-
- task_activate(shutdown_task_PID);
-}
-
-TASK shutdown_task_body(void *arg) {
-
- device_drivers_close();
-
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
-
- return NULL;
-
-}
-
-
Index: demos/tags/rel_1_5_3/jumpball/demo.h
===================================================================
--- demos/tags/rel_1_5_3/jumpball/demo.h (revision 1614)
+++ demos/tags/rel_1_5_3/jumpball/demo.h (nonexistent)
@@ -1,190 +0,0 @@
-/*
- * 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: demo.h,v 1.8 2006-06-27 09:27:15 tullio Exp $
-
- File: $File$
- Revision: $Revision: 1.8 $
- Last update: $Date: 2006-06-27 09:27:15 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 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 <ll/ll.h>
-#include <kernel/types.h>
-#include <kernel/descr.h>
-#include <math.h>
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_pci26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_fb26.h>
-
-#define FRAME_BUFFER_DEVICE 0
-
-/* Subparts */
-#define JET_ON
-#define BALL_ON
-
-
-/* CPU Speed Selection
- --------------------------------------------------------------------
- 1700 - Pentium 4 1.7 GHz
- 1300 - Centrino 1.3 GHz
- 400 - Pentium 2 400 MHz
- 133 - Pentium 1 133 MHz
-*/
-#define CPU 400
-
-/*
- *
- * WCET, Periods and Models
- *
- */
-
-#if CPU==133
-#define WCET_JETCTRL 10000
-#define WCET_JETDUMMY 300
-#define WCET_JETSLIDE 2000
-#define WCET_BALL 250
-#define WCET_HARD_BALL 1000
-#define BALL_DELAY 10000
-#endif
-
-#if CPU==400
-#define WCET_JETCTRL 7500
-#define WCET_JETDUMMY 400
-#define WCET_JETSLIDE 2100
-#define WCET_BALL 250
-#define WCET_HARD_BALL 480
-#define BALL_DELAY 10000
-#endif
-
-#if CPU==1300
-#define WCET_JETCTRL 4500
-#define WCET_JETDUMMY 200
-#define WCET_JETSLIDE 1300
-#define WCET_BALL 250
-#define WCET_HARD_BALL 650
-#define BALL_DELAY 100000
-#endif
-
-#if CPU==1700
-#define WCET_JETCTRL 4500
-#define WCET_JETDUMMY 100
-#define WCET_JETSLIDE 1300
-#define WCET_BALL 250
-#define WCET_HARD_BALL 410
-#define BALL_DELAY 100000
-#endif
-
-#define PERIOD_JETCTRL 100000
-#define PERIOD_JETDUMMY 100000
-#define PERIOD_JETSLIDE 100000
-#define PERIOD_BALL 10000
-
-/*
- *
- * Global Stuffs
- *
- */
-
-extern PID shutdown_task_PID;
-
-/* graphic mutex... */
-extern mutex_t mutex;
-
-/* useful colors... */
-extern int white;
-extern int black;
-extern int red;
-extern int gray;
-
-void init_jetcontrol();
-void init_ball(void);
-void scenario_jetcontrol();
-void scenario_ball();
-char *itoa(int n, char *s);
-int myrand(int x);
-
-/*
- *
- * JETCONTROL stuffs
- *
- */
-
-#define JET_NTASK 35
-#define JET_Y_NAME 170
-
-/*
- *
- * ATTENTION: the following PID MUST match
- * with the one assigned by Shark to the
- * Dummy task during dummy module creation.
- *
- */
-#define DUMMY_PID 2
-
-#define JET_DUMMY_WIDTH 210
-#define JET_DUMMY_HEIGHT 80
-
-/* the point (x, y) is the top left corner */
-#define JET_DUMMY_X 428
-#define JET_DUMMY_Y 65
-
-#define JET_SLIDE_WIDTH 50
-#define JET_SLIDE_X 576
-
-/*
- *
- * BALL stuffs
- *
- */
-
-// x and y corners are specified whithout consider a border of 3 pixels
-#define BALL_Y 450 /* position of the floor */
-#define BALL_HEIGHT 385 /* initial height of the ball */
-#define BALL_XMIN 10 /* min position X of the ball */
-#define BALL_XMAX 370 /* max position X of the ball */
-#define BALL_VELX 5. /* horizontal ball velocity */
-#define BALL_VYMIN 11. /* min ground speed */
-#define BALL_MAX_P 60 /* max number of balls */
-
-#define BALL_GROUP 2 /* task group of the balls */
Index: demos/tags/rel_1_5_3/jumpball/readme.txt
===================================================================
--- demos/tags/rel_1_5_3/jumpball/readme.txt (revision 1614)
+++ demos/tags/rel_1_5_3/jumpball/readme.txt (nonexistent)
@@ -1,94 +0,0 @@
-----------------------------------
-Jumping Balls demo
-
-by
-
-Paolo Gai 1999-2001 - pj@sssup.it
-
-----------------------------------
-
-This demo was created to show some S.Ha.R.K. functionalities in the course
-of Informatica Industriale , University of Pavia, Italy.
-
-The demo is composed by an application (derived by the template application
-distributed on the web site) and two init files.
-
-The demo is composed by:
-
-MAKEFILE The makefile used to compile the application;
- demo is the rule to compile the application with a CBS scheduler
- demo2 is the rule to compile the application with a RR scheduler
-README.TXT This file
-DEMO.H Some constants used into the demo
-ECP.C, ERN.C, RRP.C, RRN.C Various initfiles
-INITFIL2.C The EDF initfile
-INITFILE.C A makefile that cover either EDF+CBS and RR
-BALL.C The Jumping balls part of the demo
-DEMO.C The main() function and some other utility function
-JETCTRL.C The JET part of the demo
-
-The demo works as follows:
-- It works at 640x480 16 bit colors
-- on the left, there is the jumping ball arena, on the rigth there is the
- statistics about the tasks into the system.
-
-- the tasks are guaranteed using CBS and EDF. The wcet and mean execution
- time on my portable after a few minutes are (us):
-
- JetCtrl 7400 max 7500 CBS met
- JetDummy 135 max 200 CBS met
- JetSlide 2100 max 2100 CBS met
- Balls 276 max 380 EDF wcet for hard ball,100 CBS met for soft ones
-
- The system should go overloaded with 40 soft balls.
-
-- The idea is the following:
- - first, an edf guaranteed ball is created.
- - then, create a set of soft ball using space. since their met is < than the
- real met, they posticipate the deadlines.
- - if they are killed, they remain for some seconds in the zombie state
- - if a set of soft ball arde created (i.e., 10), and after a while all the
- others are created, the bandwidth is fully used, and the task posticipate
- their deadlines. the first set of tasks stops jumping when the bandwidth
- is full utilized by the newest balls until all the tasks have similar
- deadlines.
- - Note on the left the slides that represents the relative ratio
- between the tasks.
- - Note that in overload conditions the EDF task is still guaranteed
- - Note that PI is used with EDF, also if no theory says that it is good:
- - S.Ha.R.K. allows that, it is the user that have to choose if that is
- a non-sense
- - PI is independent from the implemnentation of the scheduling modules
- - if the second init file is used, RR is used instead of EDF+CBS.
- - In overload condition RR perform differently from EDF+CBS, giving to
- each task an equal fraction of bandwidth
-
- - note also:
- - the redefinition of the standard exception handler
- - the redefinition of the keys and the initialization of the keyboard
- - the myend exit function
- - the main() that terminates
- - the two parts (ball and jet) can be excluded using a #define
-
-If You have any question, please contact the author...
-
-Update (2003/12/19):
-Just some more notes...
-I usually show the four demos in the following order:
-
-(first of all, tune the demo depending on how fast your notebook is; see demo.h)
-
-ECP - EDF with CBS and PI... the white EDF ball still work also in overload; CBS balls just slow down but they still get their guaranteed bandwidth
-
-RRP - Round Robin with Priority inheritance ... the EDF ball is at the same level of the others, all slow down...
-
-RRN - 2 levels of Round Robin, without Priority inheritance ... when
-there is overload, the white ball works ok, but the other have an impredicible
-behavior (they execute many instances in one RR period)
-
-ERN - EDF, RR, no priority inheritance - the white ball misses his deadline
-just when there is an overload (all the other balls are queued on the same
-semaphore, so the blocking time increase, and when there is overload the EDF
-task misses also if it has not consumed his bandwidth). Note that it happens
-also if the EDF task consume just a few microseconds... Real time does not
-means "fast" :-)
Index: demos/tags/rel_1_5_3/jumpball/ball.c
===================================================================
--- demos/tags/rel_1_5_3/jumpball/ball.c (revision 1614)
+++ demos/tags/rel_1_5_3/jumpball/ball.c (nonexistent)
@@ -1,246 +0,0 @@
-/*
- * 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: ball.c,v 1.8 2005-05-10 17:21:17 mauro Exp $
-
- File: $File$
- Revision: $Revision: 1.8 $
- Last update: $Date: 2005-05-10 17:21:17 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 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
- *
- */
-
-/*--------------------------------------------------------------*/
-/* SIMULATION OF JUMPING BALLS */
-/*--------------------------------------------------------------*/
-
-#include "demo.h"
-#include <kernel/func.h>
-#include <stdlib.h>
-
-#define R 8 /* dimension of a ball */
-#define G 9.8 /* acceleration of gravity */
-
-static int ballexit = 0;
-static int npc = 0; /* number of tasks created */
-
-/*--------------------------------------------------------------*/
-/* Delay function for jumping balls */
-/*--------------------------------------------------------------*/
-
-void my_delay(void)
-{
- int xxx;
- for (xxx=0; xxx<BALL_DELAY; xxx++);
-}
-
-/*--------------------------------------------------------------*/
-/* Periodic task for ball simulation */
-/*--------------------------------------------------------------*/
-
-TASK palla(int i)
-{
-int x, y; /* coordinate grafiche pallina */
-int ox, oy; /* vecchia posizione pallina */
-int x0, y0; /* posizione iniziale X pallina */
-float vx, vy; /* velocitÂ… della pallina */
-float vy0; /* velocita' pallina al primo rimbalzo */
-float ty, tx; /* variabile temporale */
-float dt; /* incremento temporale */
-
- y = oy = y0 = BALL_HEIGHT;
- x = ox = x0 = BALL_XMIN;
-
- vy0= sqrt(2. * G * (float)BALL_HEIGHT);
- vy = 0;
- vx = BALL_VELX + myrand(9);
- tx = 0;
- ty = 0;
- dt = ((float)PERIOD_BALL)/100000;
-
- while (1) {
- y = y0 + vy*ty - .5*G*ty*ty;
- x = x0 + vx * tx;
-
- if (y < 0) {
- y = 0;
-
- if (vy == 0.0)
- vy = vy0;
- else if (vy < BALL_VYMIN)
- vy = vy0 * (1.0 - myrand(50)/100.0);
- else
- vy = 0.9 * vy;
-
- ty = 0.0;
- y0 = 0;
- }
-
- if (x > BALL_XMAX) {
- tx = 0.0;
- x0 = BALL_XMAX;
- vx = -vx;
- x = x0 + vx * tx;
- }
-
- if (x < BALL_XMIN) {
- tx = 0.0;
- x0 = BALL_XMIN;
- vx = -vx;
- x = x0 + vx * tx;
- }
-
- mutex_lock(&mutex);
- grx_disc(ox, oy, R, 0);
- ox = x;
- oy = BALL_Y - y;
- mutex_unlock(&mutex);
-
- if (ballexit && i!=0xFFFF) {
- npc--;
- return 0;
- }
-
- mutex_lock(&mutex);
- grx_disc(ox, oy, R, i);
- mutex_unlock(&mutex);
-
- my_delay();
-
- ty += dt;
- tx += dt;
- task_endcycle();
- }
-}
-
-void killball(KEY_EVT *k)
-{
- ballexit = 1;
-}
-
-void ballfun(KEY_EVT *k)
-{
- SOFT_TASK_MODEL mp;
- int r,g,b;
- PID pid;
- char palla_str[]="palla ";
-
- if (npc == BALL_MAX_P) return;
-
- ballexit = 0;
-
- r = 64 + myrand(190);
- g = 64 + myrand(190);
- b = 64 + myrand(190);
-
- itoa(npc,palla_str+5);
-
- soft_task_default_model(mp);
- soft_task_def_level(mp,2);
- soft_task_def_ctrl_jet(mp);
- soft_task_def_arg(mp, (void *)rgb16(r,g,b));
- soft_task_def_group(mp, BALL_GROUP);
- soft_task_def_met(mp, WCET_BALL);
- soft_task_def_period(mp,PERIOD_BALL);
- soft_task_def_usemath(mp);
- pid = task_create(palla_str, palla, &mp, NULL);
-
- if (pid != NIL) {
- task_activate(pid);
- npc++;
- }
-}
-
-void hardball()
-{
- HARD_TASK_MODEL mp;
- int r,g,b;
- PID pid;
-
- r = 255;
- g = 255;
- b = 255;
-
- 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, 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) {
- sys_shutdown_message("Could not create task <pallaEDF>");
- exit(1);
- }
- else
- task_activate(pid);
-}
-
-
-/*--------------------------------------------------------------*/
-/* MAIN process */
-/*--------------------------------------------------------------*/
-
-void scenario_ball()
-{
- grx_text("Noise", 0, 45 /*BALL_Y-BALL_HEIGHT-15*/, rgb16(0,0,255), black);
- grx_line(0,55,383,55,red);
- grx_rect(BALL_XMIN-R-1, BALL_Y-BALL_HEIGHT-R-1,
- BALL_XMAX+R+1, BALL_Y+R+1, rgb16(0,200,0));
-}
-
-void init_ball(void)
-{
- KEY_EVT k;
-
- hardball();
-
- k.flag = 0;
- k.scan = KEY_SPC;
- k.ascii = ' ';
- k.status = KEY_PRESSED;
- keyb_hook(k,ballfun,FALSE);
-
- k.flag = 0;
- k.scan = KEY_BKS;
- k.ascii = 0;
- k.status = KEY_PRESSED;
- keyb_hook(k,killball,FALSE);
-}
-
-/*--------------------------------------------------------------*/
Index: demos/tags/rel_1_5_3/jumpball/makefile
===================================================================
--- demos/tags/rel_1_5_3/jumpball/makefile (revision 1614)
+++ demos/tags/rel_1_5_3/jumpball/makefile (nonexistent)
@@ -1,24 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= ecp ern rrp rrn
-
-include $(BASE)/config/example.mk
-
-ecp:
- make -f $(SUBMAKE) APP=ecp INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__"
-
-ern:
- make -f $(SUBMAKE) APP=ern INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__"
-
-rrp:
- make -f $(SUBMAKE) APP=rrp INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__"
-
-rrn:
- make -f $(SUBMAKE) APP=rrn INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__"
Index: demos/tags/rel_1_5_3/jumpball/rrn.c
===================================================================
--- demos/tags/rel_1_5_3/jumpball/rrn.c (revision 1614)
+++ demos/tags/rel_1_5_3/jumpball/rrn.c (nonexistent)
@@ -1,218 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.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.9 2006-03-09 14:17:03 tullio Exp $
-
- File: $File$
- Revision: $Revision: 1.9 $
- Last update: $Date: 2006-03-09 14:17:03 $
- ------------
-**/
-
-/*
- * 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "rr/rr/rr.h"
-#include "rrsoft/rrsoft/rrsoft.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.h"
-
-#include "nop/nop/nop.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_pci26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_fb26.h>
-
-#define FRAME_BUFFER_DEVICE 0
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#define INTDRIVE_FLAG 0
-
-void call_shutdown_task(void *arg);
-int device_drivers_init();
-int device_drivers_close();
-void set_shutdown_task();
-TASK shutdown_task_body(void *arg);
-
-PID shutdown_task_PID = -1;
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- 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();
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-void set_shutdown_task() {
-
- NRT_TASK_MODEL nrt;
-
- nrt_task_default_model(nrt);
- nrt_task_def_system(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");
- exit(1);
- }
-
-}
-
-int device_drivers_init() {
-
- int res;
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- PCI26_init();
-
- INPUT26_init();
-
- keyb_def_ctrlC(kparms, NULL);
-
- KEYB26_init(&kparms);
-
- FB26_init();
-
- res = FB26_open(FRAME_BUFFER_DEVICE);
- if (res) {
- cprintf("Error: Cannot open graphical mode\n");
- KEYB26_close();
- INPUT26_close();
- exit(1);
- }
-
- 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;
-
-}
-
-#define SHUTDOWN_TIMEOUT_SEC 3
-
-void call_shutdown_task(void *arg)
-{
- struct timespec t;
-
- sys_gettime(&t);
- t.tv_sec += SHUTDOWN_TIMEOUT_SEC;
-
- /* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */
- kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0);
-
- task_activate(shutdown_task_PID);
-}
-
-TASK shutdown_task_body(void *arg) {
-
- device_drivers_close();
-
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
-
- return NULL;
-
-}
-
-void app_mutex_init(mutex_t *m)
-{
- NOP_mutexattr_t attr;
-
- NOP_mutexattr_default(attr);
-
- mutex_init(m, &attr);
-}
-
Index: demos/tags/rel_1_5_3/jumpball/rrp.c
===================================================================
--- demos/tags/rel_1_5_3/jumpball/rrp.c (revision 1614)
+++ demos/tags/rel_1_5_3/jumpball/rrp.c (nonexistent)
@@ -1,218 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.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.9 2006-03-09 14:17:03 tullio Exp $
-
- File: $File$
- Revision: $Revision: 1.9 $
- Last update: $Date: 2006-03-09 14:17:03 $
- ------------
-**/
-
-/*
- * 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "rr/rr/rr.h"
-#include "rrsoft/rrsoft/rrsoft.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.h"
-
-#include "pi/pi/pi.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_pci26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_fb26.h>
-
-#define FRAME_BUFFER_DEVICE 0
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#define INTDRIVE_FLAG 0
-
-void call_shutdown_task(void *arg);
-int device_drivers_init();
-int device_drivers_close();
-void set_shutdown_task();
-TASK shutdown_task_body(void *arg);
-
-PID shutdown_task_PID = -1;
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- 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();
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-void set_shutdown_task() {
-
- NRT_TASK_MODEL nrt;
-
- nrt_task_default_model(nrt);
- nrt_task_def_system(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");
- exit(1);
- }
-
-}
-
-int device_drivers_init() {
-
- int res;
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- PCI26_init();
-
- INPUT26_init();
-
- keyb_def_ctrlC(kparms, NULL);
-
- KEYB26_init(&kparms);
-
- FB26_init();
-
- res = FB26_open(FRAME_BUFFER_DEVICE);
- if (res) {
- cprintf("Error: Cannot open graphical mode\n");
- KEYB26_close();
- INPUT26_close();
- exit(1);
- }
-
- 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;
-
-}
-
-#define SHUTDOWN_TIMEOUT_SEC 3
-
-void call_shutdown_task(void *arg)
-{
- struct timespec t;
-
- sys_gettime(&t);
- t.tv_sec += SHUTDOWN_TIMEOUT_SEC;
-
- /* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */
- kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0);
-
- task_activate(shutdown_task_PID);
-}
-
-TASK shutdown_task_body(void *arg) {
-
- device_drivers_close();
-
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
-
- return NULL;
-
-}
-
-void app_mutex_init(mutex_t *m)
-{
- PI_mutexattr_t attr;
-
- PI_mutexattr_default(attr);
-
- mutex_init(m, &attr);
-}
-
Index: demos/tags/rel_1_5_3/jumpball/demo.c
===================================================================
--- demos/tags/rel_1_5_3/jumpball/demo.c (revision 1614)
+++ demos/tags/rel_1_5_3/jumpball/demo.c (nonexistent)
@@ -1,198 +0,0 @@
-/*
- * 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: demo.c,v 1.8 2005-01-08 14:35:17 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.8 $
- Last update: $Date: 2005-01-08 14:35:17 $
- ------------
-**/
-
-/*
- * 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
- * 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 "demo.h"
-#include <kernel/func.h>
-#include <string.h>
-#include <stdlib.h>
-
-/* useful colors... */
-int white;
-int black;
-int red;
-int gray;
-
-void app_mutex_init(mutex_t *m);
-
-static void version( void )
-{
- 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" );
-}
-
-int myrand(int x)
-{
- return rand()%x;
-}
-
-void reverse(char s[])
-{
- int c, i, j;
-
- for (i = 0, j = strlen(s)-1; i<j; i++, j--)
- {
- c = s[i];
- s[i] = s[j];
- s[j] = c;
- }
-}
-
-char * itoa(int n, char *s)
-{
- int i, sign;
-
- if ((sign = n) < 0)
- n = -n;
-
- i = 0;
-
- do
- {
- s[i++] = n % 10 + '0';
- } while ((n /= 10) > 0);
-
- if (sign < 0)
- s[i++] = '-';
-
- s[i] = 0;
-
- reverse(s);
-
- return s;
-}
-
-
-void scenario()
-{
- 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 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 );
-
-
- #ifdef JET_ON
- scenario_jetcontrol();
- #endif
-
- #ifdef BALL_ON
- scenario_ball();
- #endif
-}
-
-void endfun(KEY_EVT *k)
-{
- exit(0);
-}
-
-void zerofun(KEY_EVT *k)
-{
- int i;
- for (i=0; i<MAX_PROC; i++) jet_delstat(i);
-}
-
-int main(int argc, char **argv)
-{
-
- KEY_EVT k;
-
- version();
-
- srand(4);
-
- k.flag = CNTR_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k,endfun,FALSE);
- k.flag = CNTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k,endfun,FALSE);
- k.flag = ALTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k,zerofun,FALSE);
- k.flag = 0;
- k.scan = KEY_ENT;
- k.ascii = 13;
- k.status = KEY_PRESSED;
- keyb_hook(k,endfun,FALSE);
-
- /* init the graphic mutex */
- app_mutex_init(&mutex);
-
- /* useful colors ... */
- white = rgb16(255,255,255);
- black = rgb16(0,0,0);
- red = rgb16(255,0,0);
- gray = rgb16(128,128,128);
-
- scenario();
-
- #ifdef JET_ON
- init_jetcontrol();
- #endif
-
- #ifdef BALL_ON
- init_ball();
- #endif
-
- group_activate(1);
-
- return 0;
-}
-
-
Index: demos/tags/rel_1_5_3/jumpball/ern.c
===================================================================
--- demos/tags/rel_1_5_3/jumpball/ern.c (revision 1614)
+++ demos/tags/rel_1_5_3/jumpball/ern.c (nonexistent)
@@ -1,220 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.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.10 2006-07-05 08:27:27 tullio Exp $
-
- File: $File$
- Revision: $Revision: 1.10 $
- Last update: $Date: 2006-07-05 08:27:27 $
- ------------
-**/
-
-/*
- * 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "rr/rr/rr.h"
-#include "rrsoft/rrsoft/rrsoft.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.h"
-
-#include "nop/nop/nop.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_pci26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_fb26.h>
-
-#define FRAME_BUFFER_DEVICE 0
-
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#define INTDRIVE_FLAG 0
-
-void call_shutdown_task(void *arg);
-int device_drivers_init();
-int device_drivers_close();
-void set_shutdown_task();
-TASK shutdown_task_body(void *arg);
-
-PID shutdown_task_PID = -1;
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = 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();
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-void set_shutdown_task() {
-
- NRT_TASK_MODEL nrt;
-
- nrt_task_default_model(nrt);
- nrt_task_def_system(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");
- exit(1);
- }
-
-}
-
-int device_drivers_init() {
-
- int res;
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- PCI26_init();
-
- INPUT26_init();
-
- keyb_def_ctrlC(kparms, NULL);
-
- KEYB26_init(&kparms);
-
- FB26_init();
-
- res = FB26_open(FRAME_BUFFER_DEVICE);
- if (res) {
- cprintf("Error: Cannot open graphical mode\n");
- KEYB26_close();
- INPUT26_close();
- exit(1);
- }
-
- 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;
-
-}
-
-#define SHUTDOWN_TIMEOUT_SEC 3
-
-void call_shutdown_task(void *arg)
-{
- struct timespec t;
-
- sys_gettime(&t);
- t.tv_sec += SHUTDOWN_TIMEOUT_SEC;
-
- /* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */
- kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0);
-
- task_activate(shutdown_task_PID);
-}
-
-TASK shutdown_task_body(void *arg) {
-
- device_drivers_close();
-
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
-
- return NULL;
-
-}
-
-void app_mutex_init(mutex_t *m)
-{
- NOP_mutexattr_t attr;
-
- NOP_mutexattr_default(attr);
-
- mutex_init(m, &attr);
-}
-
Index: demos/tags/rel_1_5_3/jumpball/ecp.c
===================================================================
--- demos/tags/rel_1_5_3/jumpball/ecp.c (revision 1614)
+++ demos/tags/rel_1_5_3/jumpball/ecp.c (nonexistent)
@@ -1,216 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.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.9 2006-03-09 14:17:03 tullio Exp $
-
- File: $File$
- Revision: $Revision: 1.9 $
- Last update: $Date: 2006-03-09 14:17:03 $
- ------------
-**/
-
-/*
- * 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "cbs/cbs/cbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.h"
-
-#include "pi/pi/pi.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_pci26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_fb26.h>
-
-#define FRAME_BUFFER_DEVICE 0
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#define INTDRIVE_FLAG 0
-
-void call_shutdown_task(void *arg);
-int device_drivers_init();
-int device_drivers_close();
-void set_shutdown_task();
-TASK shutdown_task_body(void *arg);
-
-PID shutdown_task_PID = -1;
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, EDF_level);
- 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();
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-void set_shutdown_task() {
-
- NRT_TASK_MODEL nrt;
-
- nrt_task_default_model(nrt);
- nrt_task_def_system(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");
- exit(1);
- }
-
-}
-
-int device_drivers_init() {
-
- int res;
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- PCI26_init();
-
- INPUT26_init();
-
- keyb_def_ctrlC(kparms, NULL);
-
- KEYB26_init(&kparms);
-
- FB26_init();
-
- res = FB26_open(FRAME_BUFFER_DEVICE);
- if (res) {
- cprintf("Error: Cannot open graphical mode\n");
- KEYB26_close();
- INPUT26_close();
- exit(1);
- }
-
- 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;
-
-}
-
-#define SHUTDOWN_TIMEOUT_SEC 3
-
-void call_shutdown_task(void *arg)
-{
- struct timespec t;
-
- sys_gettime(&t);
- t.tv_sec += SHUTDOWN_TIMEOUT_SEC;
-
- /* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */
- kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0);
-
- task_activate(shutdown_task_PID);
-}
-
-TASK shutdown_task_body(void *arg) {
-
- device_drivers_close();
-
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
-
- return NULL;
-
-}
-
-void app_mutex_init(mutex_t *m)
-{
- PI_mutexattr_t attr;
-
- PI_mutexattr_default(attr);
-
- mutex_init(m, &attr);
-}
Index: demos/tags/rel_1_5_3/jumpball/jetctrl.c
===================================================================
--- demos/tags/rel_1_5_3/jumpball/jetctrl.c (revision 1614)
+++ demos/tags/rel_1_5_3/jumpball/jetctrl.c (nonexistent)
@@ -1,236 +0,0 @@
-/*
- * 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: jetctrl.c,v 1.5 2005-01-08 14:35:17 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.5 $
- Last update: $Date: 2005-01-08 14:35:17 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 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
- *
- */
-
-
-// JetControl
-
-#include "demo.h"
-#include "kernel/func.h"
-
-TASK jetdummy_task(void *arg)
-{
- TIME now_dummy, last_dummy, diff_dummy, slice;
- struct timespec now, last, diff;
- int x = 0;
- int height;
-
- NULL_TIMESPEC(&last);
- last_dummy = 0;
- for (;;) {
- task_nopreempt();
- jet_getstat(DUMMY_PID, NULL, NULL, NULL, &now_dummy);
- sys_gettime(&now);
- task_preempt();
-
- SUBTIMESPEC(&now, &last, &diff);
- slice = diff.tv_sec * 1000000 + diff.tv_nsec/1000;
- diff_dummy = now_dummy - last_dummy;
-
- height = (int)(JET_DUMMY_HEIGHT*((float)diff_dummy)/((float)slice));
-
- TIMESPEC_ASSIGN(&last, &now);
- last_dummy = now_dummy;
-
- grx_line(JET_DUMMY_X+x,JET_DUMMY_Y,
- JET_DUMMY_X+x,JET_DUMMY_Y+height ,black);
- grx_line(JET_DUMMY_X+x,JET_DUMMY_Y+height,
- JET_DUMMY_X+x,JET_DUMMY_Y+JET_DUMMY_HEIGHT,white);
- grx_line(JET_DUMMY_X+(x+1)%JET_DUMMY_WIDTH,JET_DUMMY_Y,
- JET_DUMMY_X+(x+1)%JET_DUMMY_WIDTH,JET_DUMMY_Y+JET_DUMMY_HEIGHT,255);
-
- x = (x+1)%JET_DUMMY_WIDTH;
-
- task_endcycle();
- }
-}
-
-
-TASK jetctrl_task(void *arg)
-{
- char st[50];
- TIME sum, max;
- int n;
-
- PID i;
- int printed = 0;
-
- for (;;) {
- for (i=2, printed=0; i<MAX_PROC && printed<JET_NTASK; i++) {
- if (jet_getstat(i, &sum, &max, &n, NULL) != -1) {
- if (!n) n=1;
- sprintf(st, "%6d %6d %10s", (int)sum/n, (int)max, proc_table[i].name);
- grx_text(st, 384, JET_Y_NAME+16+printed*8, gray, black);
- printed++;
- }
- }
- while (printed<JET_NTASK) {
- grx_text(" ",
- 384, JET_Y_NAME+16+printed*8, gray, black);
- printed++;
- }
- task_endcycle();
- }
-}
-
-TASK jetslide_task(void *arg)
-{
- TIME sum, curr, max;
-
- TIME total[JET_NTASK];
- int slides[JET_NTASK];
-
- PID i;
- int printed = 0;
-
- for (;;) {
- // Fill the total array in a nonpreemptive section
- task_nopreempt();
- for (i=2, printed=0; i<MAX_PROC && printed<JET_NTASK; i++) {
- if (jet_getstat(i, &sum, NULL, NULL, &curr) != -1) {
- total[printed] = sum+curr;
- printed++;
- }
- }
- task_preempt();
-
- while (printed < JET_NTASK)
- total[printed++] = 0;
-
- // Compute the Max elapsed time
- max = 0;
- for (i=0; i<JET_NTASK; i++)
- if (total[i] > max) max = total[i];
- if (!max) max = 1;
-
- // Compute the slides width
- for (i=0; i<JET_NTASK; i++)
- slides[i] = (int)( (((float)total[i])/max) * JET_SLIDE_WIDTH);
-
- // print the data
- for (i=0; i<JET_NTASK; i++) {
- grx_box(JET_SLIDE_X, JET_Y_NAME+16+i*8,
- JET_SLIDE_X+slides[i], JET_Y_NAME+23+i*8, gray);
- grx_box(JET_SLIDE_X+slides[i], JET_Y_NAME+16+i*8,
- JET_SLIDE_X+JET_SLIDE_WIDTH, JET_Y_NAME+23+i*8, black);
- }
-
- while (i<JET_NTASK) {
- grx_box(JET_SLIDE_X, JET_Y_NAME+16+i*8,
- JET_SLIDE_X+JET_SLIDE_WIDTH, JET_Y_NAME+20+i*8, black);
- i++;
- }
- task_endcycle();
- }
-}
-
-
-void scenario_jetcontrol(void)
-{
- grx_text("System load" , 384, 45, rgb16(0,0,255), black);
- grx_line(384,55,639,55,red);
-
- grx_text(" Mean Max Name Slide", 384, JET_Y_NAME, gray, black);
- grx_line(384,JET_Y_NAME+10,639,JET_Y_NAME+10,gray);
-
- grx_rect(JET_DUMMY_X-1, JET_DUMMY_Y-1,
- JET_DUMMY_X+JET_DUMMY_WIDTH, JET_DUMMY_Y+JET_DUMMY_HEIGHT+1, gray);
-
- grx_text("100%", JET_DUMMY_X-40, JET_DUMMY_Y, gray, black);
- grx_text(" 0%", JET_DUMMY_X-40, JET_DUMMY_Y+JET_DUMMY_HEIGHT-8, gray, black);
-
- grx_line(JET_DUMMY_X-1, JET_DUMMY_Y, JET_DUMMY_X-5, JET_DUMMY_Y, gray);
- grx_line(JET_DUMMY_X-1, JET_DUMMY_Y+JET_DUMMY_HEIGHT, JET_DUMMY_X-5, JET_DUMMY_Y+JET_DUMMY_HEIGHT, gray);
-}
-
-void init_jetcontrol(void)
-{
- SOFT_TASK_MODEL m3, m4, m5;
-
- PID p3, p4, p5;
-
- soft_task_default_model(m3);
- soft_task_def_level(m3,2);
- soft_task_def_period(m3, PERIOD_JETCTRL);
- soft_task_def_met(m3, WCET_JETCTRL);
- soft_task_def_ctrl_jet(m3);
- soft_task_def_group(m3, 1);
- p3 = task_create("jctrl", jetctrl_task, &m3, NULL);
- if (p3 == -1) {
- sys_shutdown_message("Could not create task <jetctrl> errno=%d",
- errno);
- exit(1);
- }
-
- soft_task_default_model(m4);
- soft_task_def_level(m4,2);
- soft_task_def_period(m4, PERIOD_JETDUMMY);
- soft_task_def_met(m4, WCET_JETDUMMY);
- soft_task_def_group(m4, 1);
- soft_task_def_usemath(m4);
- soft_task_def_ctrl_jet(m4);
- p4 = task_create("jdmy", jetdummy_task, &m4, NULL);
- if (p4 == -1) {
- sys_shutdown_message("Could not create task <jetdummy> errno=%d",
- errno);
- exit(1);
- }
-
- soft_task_default_model(m5);
- soft_task_def_level(m5,2);
- soft_task_def_period(m5, PERIOD_JETSLIDE);
- soft_task_def_met(m5, WCET_JETSLIDE);
- soft_task_def_group(m5, 1);
- soft_task_def_usemath(m5);
- soft_task_def_ctrl_jet(m5);
- p5 = task_create("jsli", jetslide_task, &m5, NULL);
- if (p5 == -1) {
- sys_shutdown_message("Could not create task <jetslide> errno=%d",
- errno);
- exit(1);
- }
-}
-