Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1657 → Rev 1656

/unsupported/tags/rel_0_5/fsdemo/gphoto.ok
File deleted
/unsupported/tags/rel_0_5/fsdemo/oldmakefile
File deleted
/unsupported/tags/rel_0_5/fsdemo/gload.h
File deleted
/unsupported/tags/rel_0_5/fsdemo/makefile
File deleted
/unsupported/tags/rel_0_5/fsdemo/gphoto.c
File deleted
/unsupported/tags/rel_0_5/fsdemo/gclock.c
File deleted
/unsupported/tags/rel_0_5/fsdemo/initfile.c
File deleted
/unsupported/tags/rel_0_5/fsdemo/xread.c
File deleted
/unsupported/tags/rel_0_5/fsdemo/gphoto.h
File deleted
/unsupported/tags/rel_0_5/fsdemo/gclock.h
File deleted
/unsupported/tags/rel_0_5/fsdemo/mutex.h
File deleted
/unsupported/tags/rel_0_5/fsdemo/xread.h
File deleted
/unsupported/tags/rel_0_5/fsdemo/config.h
File deleted
/unsupported/tags/rel_0_5/fsdemo/readme
File deleted
/unsupported/tags/rel_0_5/fsdemo/gvideo.c
File deleted
/unsupported/tags/rel_0_5/fsdemo/gbuffer.c
File deleted
/unsupported/tags/rel_0_5/fsdemo/gvideo.h
File deleted
/unsupported/tags/rel_0_5/fsdemo/mplay.c
File deleted
/unsupported/tags/rel_0_5/fsdemo/gbuffer.h
File deleted
/unsupported/tags/rel_0_5/fsdemo/gload.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/fs/initfs.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/fs/makefile
File deleted
/unsupported/tags/rel_0_5/oldexamples/fs/common.h
File deleted
/unsupported/tags/rel_0_5/oldexamples/fs/test0.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/fs/tree1.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/fs/test1.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/fs/test2.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/fs/tree2.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/fs/hello.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/fs/testu.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/fs/testw0.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/fs/testw1.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/fs/common.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/mpeg/common.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/mpeg/mpg123.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/mpeg/initfs.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/mpeg/makefile
File deleted
/unsupported/tags/rel_0_5/oldexamples/mpeg/mplay.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/mpeg/mplay2.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/makefile
File deleted
/unsupported/tags/rel_0_5/oldexamples/stdio/initfs.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/stdio/makefile
File deleted
/unsupported/tags/rel_0_5/oldexamples/stdio/test0.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/stdio/test1.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/stdio/test2.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/stdio/test3.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/stdio/test4.c
File deleted
/unsupported/tags/rel_0_5/oldexamples/stdio/common.c
File deleted
/unsupported/tags/rel_0_5/makefile
File deleted
/unsupported/tags/rel_0_5/soccer/calc2.h
File deleted
/unsupported/tags/rel_0_5/soccer/position.h
File deleted
/unsupported/tags/rel_0_5/soccer/images.h
File deleted
/unsupported/tags/rel_0_5/soccer/readme
File deleted
/unsupported/tags/rel_0_5/soccer/makefile
File deleted
/unsupported/tags/rel_0_5/soccer/iniziali.h
File deleted
/unsupported/tags/rel_0_5/soccer/soccer.c
File deleted
/unsupported/tags/rel_0_5/soccer/initfile.c
File deleted
/unsupported/tags/rel_0_5/soccer/calc.h
File deleted
/unsupported/tags/rel_0_5/soccer/stadio.h
File deleted
/unsupported/tags/rel_0_5/thdemo/jetctrl.c
File deleted
/unsupported/tags/rel_0_5/thdemo/camera.c
File deleted
/unsupported/tags/rel_0_5/thdemo/demo.h
File deleted
/unsupported/tags/rel_0_5/thdemo/readme.txt
File deleted
/unsupported/tags/rel_0_5/thdemo/camera2.c
File deleted
/unsupported/tags/rel_0_5/thdemo/ball.c
File deleted
/unsupported/tags/rel_0_5/thdemo/camera4.c
File deleted
/unsupported/tags/rel_0_5/thdemo/ball2.c
File deleted
/unsupported/tags/rel_0_5/thdemo/makefile
File deleted
/unsupported/tags/rel_0_5/thdemo/fft.c
File deleted
/unsupported/tags/rel_0_5/thdemo/initfile.c
File deleted
/unsupported/tags/rel_0_5/thdemo/demo.c
File deleted
/unsupported/tags/rel_0_5/thdemo/fftplay.c
File deleted
/unsupported/tags/rel_0_5/tracer/udp/readme
File deleted
/unsupported/tags/rel_0_5/tracer/udp/makefile
File deleted
/unsupported/tags/rel_0_5/tracer/udp/initfile.c
File deleted
/unsupported/tags/rel_0_5/tracer/udp/udptrace.c
File deleted
/unsupported/tags/rel_0_5/tracer/small/test0.c
File deleted
/unsupported/tags/rel_0_5/tracer/small/treec1.c
File deleted
/unsupported/tags/rel_0_5/tracer/small/hello.c
File deleted
/unsupported/tags/rel_0_5/tracer/small/treec2.c
File deleted
/unsupported/tags/rel_0_5/tracer/small/hello1.c
File deleted
/unsupported/tags/rel_0_5/tracer/small/hello2.c
File deleted
/unsupported/tags/rel_0_5/tracer/small/treef1.c
File deleted
/unsupported/tags/rel_0_5/tracer/small/common.c
File deleted
/unsupported/tags/rel_0_5/tracer/small/simple.c
File deleted
/unsupported/tags/rel_0_5/tracer/small/readme
File deleted
/unsupported/tags/rel_0_5/tracer/small/initfs.c
File deleted
/unsupported/tags/rel_0_5/tracer/small/makefile
File deleted
/unsupported/tags/rel_0_5/tracer/small/common.h
File deleted
/unsupported/tags/rel_0_5/tracer/readme
File deleted
/unsupported/tags/rel_0_5/tracer/makefile
File deleted
/unsupported/tags/rel_0_5/tracer/utils/distr.c
File deleted
/unsupported/tags/rel_0_5/tracer/utils/road.c
File deleted
/unsupported/tags/rel_0_5/tracer/utils/types.h
File deleted
/unsupported/tags/rel_0_5/tracer/utils/tdump.c
File deleted
/unsupported/tags/rel_0_5/tracer/utils/readme
File deleted
/unsupported/tags/rel_0_5/tracer/utils/makefile
File deleted
/unsupported/tags/rel_0_5/tracer/utils/util.c
File deleted
/unsupported/tags/rel_0_5/tracer/utils/udpdump.c
File deleted
/unsupported/tags/rel_0_5/tracer/utils/jdump.c
File deleted
/unsupported/tags/rel_0_5/tracer/utils/util.h
File deleted
/unsupported/tags/rel_0_5/tracer/utils/sa.c
File deleted
/unsupported/tags/rel_0_5/tracer/utils/wait.c
File deleted
/unsupported/tags/rel_0_5/tracer/dfixed/dfixed.c
File deleted
/unsupported/tags/rel_0_5/tracer/dfixed/initfile.c
File deleted
/unsupported/tags/rel_0_5/tracer/dfixed/readme
File deleted
/unsupported/tags/rel_0_5/tracer/dfixed/makefile
File deleted
/unsupported/tags/rel_0_5/oscilloscopio/adc.c
File deleted
/unsupported/tags/rel_0_5/oscilloscopio/initosc.c
File deleted
/unsupported/tags/rel_0_5/oscilloscopio/readme.txt
File deleted
/unsupported/tags/rel_0_5/oscilloscopio/adc.h
File deleted
/unsupported/tags/rel_0_5/oscilloscopio/makefile
File deleted
/unsupported/tags/rel_0_5/oscilloscopio/osc.c
File deleted
/unsupported/tags/rel_0_5/rtdac4/rtdac4.c
File deleted
/unsupported/tags/rel_0_5/rtdac4/initfile.c
File deleted
/unsupported/tags/rel_0_5/rtdac4/rtdac4.h
File deleted
/unsupported/tags/rel_0_5/rtdac4/makefile
File deleted
/unsupported/tags/rel_0_5/rtdac4/test.c
File deleted
/unsupported/tags/rel_0_5/simcity/draw.c
File deleted
/unsupported/tags/rel_0_5/simcity/keyboard.c
File deleted
/unsupported/tags/rel_0_5/simcity/include/draw.h
File deleted
/unsupported/tags/rel_0_5/simcity/include/simcity.h
File deleted
/unsupported/tags/rel_0_5/simcity/include/proc.h
File deleted
/unsupported/tags/rel_0_5/simcity/include/states.h
File deleted
/unsupported/tags/rel_0_5/simcity/include/car.h
File deleted
/unsupported/tags/rel_0_5/simcity/include/keyfunct.h
File deleted
/unsupported/tags/rel_0_5/simcity/include/constant.h
File deleted
/unsupported/tags/rel_0_5/simcity/include/misc.h
File deleted
/unsupported/tags/rel_0_5/simcity/proc.c
File deleted
/unsupported/tags/rel_0_5/simcity/initfile.c
File deleted
/unsupported/tags/rel_0_5/simcity/sem/red_l.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sem/yellow_l.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sem/red_r.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sem/green_l.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sem/yellow_r.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sem/red_d.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sem/red_u.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sem/yellow_d.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sem/yellow_u.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sem/green_r.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sem/green_d.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sem/green_u.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/car.c
File deleted
/unsupported/tags/rel_0_5/simcity/reading.c
File deleted
/unsupported/tags/rel_0_5/simcity/simcity.c
File deleted
/unsupported/tags/rel_0_5/simcity/tasks.c
File deleted
/unsupported/tags/rel_0_5/simcity/sprite/sp_0.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sprite/sp_1.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sprite/sp_2.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sprite/sp_3.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sprite/sp_4.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sprite/sp_5.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sprite/sp_6.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/sprite/sp_7.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/keyfunct.c
File deleted
/unsupported/tags/rel_0_5/simcity/img/car_000n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/Bb0.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/bb1.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_210n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_120n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_030n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_300n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/street.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_240n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_015n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_150n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_060n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_105n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_330n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_045n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/old_sk.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_180n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_090n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_270n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_135n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_225n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_315n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_075n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_165n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_255n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_345n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/old.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_195n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/img/car_285n.raw
File deleted
\ No newline at end of file
/unsupported/tags/rel_0_5/simcity/misc.c
File deleted
/unsupported/tags/rel_0_5/simcity/sem.raw
File deleted
/unsupported/tags/rel_0_5/simcity/makefile
File deleted
/unsupported/tags/rel_0_5/biliardo/demo.h
File deleted
/unsupported/tags/rel_0_5/biliardo/palla.c
File deleted
/unsupported/tags/rel_0_5/biliardo/biliardo.h
File deleted
/unsupported/tags/rel_0_5/biliardo/makefile
File deleted
/unsupported/tags/rel_0_5/biliardo/posizion.h
File deleted
/unsupported/tags/rel_0_5/biliardo/initfil1.c
File deleted
/unsupported/tags/rel_0_5/biliardo/biliardo.c
File deleted
/unsupported/tags/rel_0_5/biliardo/jetctrl.c
File deleted
/unsupported/tags/rel_0_5/static/static.h
File deleted
/unsupported/tags/rel_0_5/static/readme
File deleted
/unsupported/tags/rel_0_5/static/makefile
File deleted
/unsupported/tags/rel_0_5/static/initfile.c
File deleted
/unsupported/tags/rel_0_5/static/static.c
File deleted
/unsupported/tags/rel_0_5/static/test1st.c
File deleted
/unsupported/tags/rel_0_5/parport/initfile.c
File deleted
/unsupported/tags/rel_0_5/parport/ppdemo.c
File deleted
/unsupported/tags/rel_0_5/parport/readme.txt
File deleted
/unsupported/tags/rel_0_5/parport/makefile
File deleted
/unsupported/tags/rel_0_5/gps/gps.c
File deleted
/unsupported/tags/rel_0_5/gps/nmea_parse.c
File deleted
/unsupported/tags/rel_0_5/gps/makefile
File deleted
/unsupported/tags/rel_0_5/gps/initfile.c
File deleted
/unsupported/tags/rel_0_5/gps/nmea.h
File deleted
/unsupported/tags/rel_0_5/lights/makefile
File deleted
/unsupported/tags/rel_0_5/lights/simlight.c
File deleted
/unsupported/tags/rel_0_5/lights/blaster.h
File deleted
/unsupported/tags/rel_0_5/lights/initfile.c
File deleted
/unsupported/tags/rel_0_5/lights/param.dat
File deleted
/unsupported/tags/rel_0_5/lights/readme.txt
File deleted
/unsupported/tags/rel_0_5/perf/readme
File deleted
/unsupported/tags/rel_0_5/perf/makefile
File deleted
/unsupported/tags/rel_0_5/perf/perf1.c
File deleted
/unsupported/tags/rel_0_5/perf/perf2.c
File deleted
/unsupported/tags/rel_0_5/perf/perf3.c
File deleted
/unsupported/tags/rel_0_5/perf/perf4.c
File deleted
/unsupported/tags/rel_0_5/perf/initfile.c
File deleted
/unsupported/tags/rel_0_5/telesco/makefile
File deleted
/unsupported/tags/rel_0_5/telesco/moon.h
File deleted
/unsupported/tags/rel_0_5/telesco/initfile.c
File deleted
/unsupported/tags/rel_0_5/telesco/tel.c
File deleted
/unsupported/tags/rel_0_5/telesco/dati.cnf
File deleted
/unsupported/tags/rel_0_5/autostr/makefile
File deleted
/unsupported/tags/rel_0_5/autostr/autostr.c
File deleted
/unsupported/tags/rel_0_5/autostr/initfile.c
File deleted
/unsupported/tags/rel_0_5/joy/joy_test.c
File deleted
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: tags/rel_0_5/joy/joy_grx.c
===================================================================
--- tags/rel_0_5/joy/joy_grx.c (revision 1657)
+++ tags/rel_0_5/joy/joy_grx.c (nonexistent)
@@ -1,177 +0,0 @@
-
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * Authors : Paolo Gai <pj@hartik.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
- */
-
-/*
- * 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 <kernel/func.h>
-#include <stdlib.h>
-#include <drivers/keyb.h>
-#include <drivers/glib.h>
-#include <semaphore.h>
-#include "modules/sem.h"
-#include "modules/hartport.h"
-
-#include <math.h>
-
-#include "joy.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)
-
-sem_t mx_mat, mx_grf; /* mutex semaphores */
-PID pid;
-JOY_BOUND jb;
-
-
-TASK write()
-{
- int x = 319, y = 239;
- float dx, dy;
- JOY_STATE jsa;
-
- clear();
-
- dx = 640 / (jb.x_max - jb.x_min);
- dy = 480 / (jb.y_max - jb.y_min);
-
- while (1) {
- sem_wait(&mx_grf);
- grx_circle(10 + x, 10 + y, 9, RGB_BLACK);
- sem_post(&mx_grf);
-
- get_joystick_A(&jsa);
-
- x = (jsa.x - jb.x_min) * dx;
- y = (jsa.y - jb.y_min) * dy;
-
- sem_wait(&mx_grf);
- if (jsa.b1==1)
- grx_circle(10 + dx * x, 10 + dy * y, 9, RGB_RED);
- else
- grx_circle(10 + dx * x, 10 + dy * y, 9, RGB_YELLOW);
- sem_post(&mx_grf);
-
- task_endcycle();
- }
- return 0;
-}
-
-void endfun(KEY_EVT *k)
-{
- cprintf("Ctrl-Brk pressed! Ending...\n");
- sys_end();
-}
-
-void my_close(void *arg)
-{
- int i;
- TIME tmp;
-
- grx_close();
- kern_printf("Taskset Execution Time\n\n");
- for (i=3; i<MAX_PROC; i++){
- if (!jet_getstat(i, NULL, &tmp, NULL, NULL))
- kern_printf("Task Name : %s - Max Time : %d\n", proc_table[i].name, (int)tmp);
- }
-}
-
-void init_graph() {
- grx_box( 0, 0,639,479,RGB_BLACK);
-}
-
-int main(int argc, char **argv)
-{
- SOFT_TASK_MODEL ms;
- KEY_EVT k;
- TIME seme;
- int modenum;
-
- k.flag = CNTR_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- keyb_hook(k,endfun);
-
- k.flag = CNTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- keyb_hook(k,endfun);
-
- sem_init(&mx_mat,0,1);
- sem_init(&mx_grf,0,1);
-
- seme = sys_gettime(NULL);
- srand(seme);
-
- sys_atrunlevel(my_close, NULL, RUNLEVEL_BEFORE_EXIT);
-
- if (get_joystick_bound_A(&jb)) {
- perror("Could not find Joystick.");
- sys_end();
- }
-
- grx_init();
- modenum = grx_getmode(640, 480, 16);
- grx_setmode(modenum);
- init_graph();
-
- soft_task_default_model(ms);
- soft_task_def_level(ms,1);
- soft_task_def_ctrl_jet(ms);
- soft_task_def_met(ms,100);
- soft_task_def_period(ms,10000);
- soft_task_def_usemath(ms);
- pid = task_create("Write", write, &ms, NULL);
- if (pid == NIL) {
- grx_close();
- perror("Could not create task <Write>");
- sys_end();
- } else {
- task_activate(pid);
- }
-
- return 0;
-}
/tags/rel_0_5/joy/joy_grx.c
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: tags/rel_0_5/joy/initfile.c
===================================================================
--- tags/rel_0_5/joy/initfile.c (revision 1657)
+++ tags/rel_0_5/joy/initfile.c (nonexistent)
@@ -1,84 +0,0 @@
-/*
- * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- * Gerardo Lamastra <gerardo@sssup.it>
- *
- * Authors : Paolo Gai <pj@hartik.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://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 <kernel/func.h>
-#include <stdlib.h>
-#include <drivers/keyb.h>
-#include <semaphore.h>
-#include "modules/sem.h"
-#include "modules/hartport.h"
-
-#include "modules/edf.h"
-#include "modules/cbs.h"
-#include "modules/rr.h"
-#include "modules/dummy.h"
-
-/*+ sysyem tick in us +*/
-#define TICK 0 //300
-
-/*+ RR tick in us +*/
-#define RRTICK 300
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, 0);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- KEYB_PARMS kparms = BASE_KEYB;
-
- HARTPORT_init();
-
- //keyb_set_map(itaMap);
- keyb_def_ctrlC(kparms, NULL);
- KEYB_init(&kparms);
-
- __call_main__(mb);
-
- return (void *)0;
-}
/tags/rel_0_5/joy/initfile.c
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: tags/rel_0_5/joy/README
===================================================================
--- tags/rel_0_5/joy/README (revision 1657)
+++ tags/rel_0_5/joy/README (nonexistent)
@@ -1,2 +0,0 @@
-TODO
-
Index: tags/rel_0_5/joy/makefile
===================================================================
--- tags/rel_0_5/joy/makefile (revision 1657)
+++ tags/rel_0_5/joy/makefile (nonexistent)
@@ -1,18 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= joy_hex joy_test joy_grx
-
-include $(BASE)/config/example.mk
-
-joy_grx:
- make -f $(SUBMAKE) APP=joy_grx INIT= OTHEROBJS="initfile.o" SHARKOPT="__OLDCHAR__ __GRX__ __JOY__"
-
-joy_test:
- make -f $(SUBMAKE) APP=joy_test INIT= OTHEROBJS="initfile.o" SHARKOPT="__OLDCHAR__ __JOY__"
/tags/rel_0_5/joy/makefile
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: tags/rel_0_5/robots/initfile.c
===================================================================
--- tags/rel_0_5/robots/initfile.c (revision 1657)
+++ tags/rel_0_5/robots/initfile.c (nonexistent)
@@ -1,104 +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: initfile.c,v 1.1.1.1 2004-05-24 18:03:41 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:41 $
- ------------
-**/
-
-/*
- * Copyright (C) 2001 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include "kernel/kern.h"
-#include "modules/edf.h"
-#include "modules/cbs.h"
-#include "modules/rr.h"
-#include "modules/dummy.h"
-
-#include "modules/sem.h"
-#include "modules/hartport.h"
-#include "modules/cabs.h"
-#include "drivers/keyb.h"
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-void read_cfgfile(int);
-
-int argc;
-char *argv[100];
-
-void read_cfg_file(int argc, char **argv);
-
-int main(int argc, char **argv);
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- EDF_register_level(0);
- CBS_register_level(0, 0);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- __compute_args__(mb, &argc, argv);
-
- read_cfg_file(argc, argv);
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- KEYB_PARMS kparms = BASE_KEYB;
-
- HARTPORT_init();
-
- keyb_def_ctrlC(kparms, NULL);
- KEYB_init(&kparms);
-
- return (void *)main(argc,argv);
-}
Index: tags/rel_0_5/robots/lab1m.txt
===================================================================
--- tags/rel_0_5/robots/lab1m.txt (revision 1657)
+++ tags/rel_0_5/robots/lab1m.txt (nonexistent)
@@ -1,9 +0,0 @@
-1
-540 380 15 270
-380 300 400 5
-430 060 460 400 0
-350 100 430 130 0
-000 100 300 130 0
-150 200 430 230 0
-120 300 150 400 0
-
Index: tags/rel_0_5/robots/mouse2.c
===================================================================
--- tags/rel_0_5/robots/mouse2.c (revision 1657)
+++ tags/rel_0_5/robots/mouse2.c (nonexistent)
@@ -1,933 +0,0 @@
-/*--------------------------------------------------------------*/
-/* Title: Mouse */
-/* Autor: João Capucho */
-/* Date: 9/12/2000 */
-/* Description: */
-/* Simulation of small automats based on the */
-/* "micro-rato" conteste */
-/*--------------------------------------------------------------*/
-
-/*
- * Copyright (C) 2001 João Capucho
- *
- * 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
- *
- */
-
-
-// Includes
-#include <ll/i386/x-dos.h>
-#include <kernel/kern.h>
-#include <drivers/glib.h>
-#include <drivers/keyb.h>
-#include <math.h>
-#include <stdlib.h>
-#include <limits.h>
-
-#define sqr(x) (x*x)
-
-// Error Types
-#define OK 0
-#define MEMORY_ERROR -1
-#define ILEGAL_PARAMETER -2
-
-// Types of sensors and motors
-#define NONE 0
-#define OBSTACLE 1
-#define BEACON 2
-#define GROUND 3
-#define STEP 4
-
-// Maze limits
-#define LAB_XMIN 40
-#define LAB_XMAX 600
-#define LAB_YMIN 40
-#define LAB_YMAX 440
-
-#define MOTOR_RIGHT 1
-#define MOTOR_LEFT 0
-
-#define BACKCOLOR 0 // Background color
-#define OUTCOLOR 14 // Color of the outside walls
-#define FINISHCOLOR 7 // Finishin area color
-#define NONBLOCKCOLOR 14 // Non block boxs
-#define BLOCKCOLOR 13 // Block boxs
-
-#define BOX_BLOCK 1 // The box blocks the beacon
-#define BOX_NON_BLOCK 2 // The box doesn´t block the beacon
-
-#define MAX_MOUSES 5 // Maximum of mouses in the Maze
-#define MAX_BOXS 100 // Maximum of boxs in the Maze
-#define MAX_SENSORS 20 // Maximum of sensors in each mouse
-#define SENSOR_MIN_GROUND 0 // Minimum value of a ground sensor
-#define SENSOR_MAX_GROUND 255 // Maximum value of a ground sensor
-#define SENSOR_MIN_OBSTACLE 77 // Minimum value of a obstacle sensor
-#define SENSOR_MAX_OBSTACLE 128 // Maximum value of a obstacle sensor
-#define SENSOR_MIN_BEACON 77 // Minimum value of a beacon sensor
-#define SENSOR_MAX_BEACON 128 // Maximum value of a beacon sensor
-#define BEACON_INTENSITY 400 // Maximun intensity of the beacon
-
-#define MOUSE_PERIOD 20000 // Period
-#define CALC_PERIOD 2000 // Period
-#define REFEREE_PERIOD 1000 // Period of the referee
-#define REDRAW_MOUSE_PERIOD 25000 // Period for redraw mouse
-#define REDRAW_MAZE_PERIOD 100000 // Period for redraw maze
-#define MOUSEGROUP 511
-
-struct SENSOR
-{
- int Type; // Tipe of sensor ( None - Obstacle - Beacon - Ground)
- int Radius; // Distance from de center of the mouse
- int Pos_Angle; // Angle between the sensor and the front of the mouse
- int Dir; // Angle between the direction of the sensores and the front of the mouse
- int Angle; // Half angle of visual field (between (Dir-Angle) and (Dir+Angle))
- int Intensity; // Sensativity of the sensor
- float Value; // Last value readed
-};
-
-struct MOTOR
-{
- int Radius; // Distance from de center of the mouse
- int V; // Current velocity
- float Old_V; // Previews velocity
-};
-
-struct MOUSE
-{
- float X, Y; // Current position of the center
- float Old_X, Old_Y; // Previous position of the center
- int Radius; // Size of the mouse ( every mouse is considered round )
- float Dir; // Points to the front
- float Old_Dir; // Previous front
- int NSensors; // Number of sensors in the mouse
- struct SENSOR Sensors[MAX_SENSORS]; // Pointer to the structer that contains the information of the sensors
- struct MOTOR Motors[2]; // Pointer to the structer that contains the information of the motors
- WORD NColision; // Total of colisions
- WORD PColision; // Auxiliar for colisions
- char Flag; // Initialization flag
-};
-
-
-
-struct BOX // Structer that represents the obstacles
-{ //in this case all the obstacles are boxs
- int Type; // Type of the obstatcle
- int X1, Y1, X2, Y2; // position of the box
-};
-
-struct SBEACON // Beacon information
-{
- int Intensity; // Intensity of the beacon
- int X, Y; // position of the beacon
-};
-
-struct MAZE
-{
- int X1, Y1, X2, Y2; // limites of the maze
- int NBoxs; // Number of objstacles in the maze
- struct BOX Boxs[MAX_BOXS]; // Information about all thr obstacles
- struct SBEACON Beacon; // Beacon data
- int Radius; // Size of the finishing area
-};
-
-int Seno[360+90]; // Sine table
-int Tang[180]; // Tangente table
-int NMouses=0;
-struct MOUSE Mouse[MAX_MOUSES]; // Global variable that represents all the mouses
-struct MAZE Maze; // Global variable that represents the maze
-
-// Init_Maze - Initialize the Maze
-// Beacon_X - Coordinate X of the beacon
-// Beacon_Y - Coordinate Y of the beacon
-// Intensity - Intensity of the beacon
-// NBoxs - Number of boxs in the maze
-// Return: OK - Sucess
-
-int Init_Maze(int Beacon_X, int Beacon_Y, int Intensity, int NBoxs)
-{
- int i;
- Maze.X1=LAB_XMIN;
- Maze.Y1=LAB_YMIN;
- Maze.X2=LAB_XMAX;
- Maze.Y2=LAB_YMAX;
- Maze.Beacon.X=Beacon_X+LAB_XMIN;
- Maze.Beacon.Y=Beacon_Y+LAB_YMIN;
- if (Intensity<BEACON_INTENSITY)
- Maze.Beacon.Intensity=Intensity;
- else
- Maze.Beacon.Intensity=BEACON_INTENSITY;
- if (NBoxs<MAX_BOXS)
- Maze.NBoxs=NBoxs;
- else
- Maze.NBoxs=MAX_BOXS;
- Maze.Radius=50;
- for(i=0; i < Maze.NBoxs; i++)
- Maze.Boxs[i].Type=NONE;
- return OK;
-}
-
-// Init_Box - Initialize data of the NBox obstacle
-// NBox - Identifier of the obstacle
-// X1 - Coordinate X
-// Y1 - Coordinate Y
-// X2 - Coordinate X
-// Y2 - Coordinate Y
-// Type - Type of the obstacle
-// Return: OK - Sucess
-
-int Init_Box(int NBox, int X1, int Y1, int X2, int Y2, int Type)
-{
- Maze.Boxs[NBox].Type=Type;
- if (X1<X2)
- {
- Maze.Boxs[NBox].X1=X1+LAB_XMIN;
- Maze.Boxs[NBox].X2=X2+LAB_XMIN;
- }
- else
- {
- Maze.Boxs[NBox].X1=X2+LAB_XMIN;
- Maze.Boxs[NBox].X2=X1+LAB_XMIN;
- }
- if (Y1<Y2)
- {
- Maze.Boxs[NBox].Y1=Y1+LAB_YMIN;
- Maze.Boxs[NBox].Y2=Y2+LAB_YMIN;
- }
- else
- {
- Maze.Boxs[NBox].Y1=Y2+LAB_YMIN;
- Maze.Boxs[NBox].Y2=Y1+LAB_YMIN;
- }
- return OK;
-}
-
-// Draw_Maze - Draws the outline of the maze and the obstacles
-// Return: OK - Sucess
-int Draw_Maze(void)
-{
- int i;
- grx_rect( Maze.X1, Maze.Y1, Maze.X2, Maze.Y2, OUTCOLOR);
- grx_rect( Maze.X1-1, Maze.Y1+1, Maze.X2+1, Maze.Y2+1, OUTCOLOR);
- grx_rect( Maze.X1-2, Maze.Y1+2, Maze.X2+2, Maze.Y2+2, OUTCOLOR);
- grx_circle(Maze.Beacon.X, Maze.Beacon.Y, Maze.Radius, FINISHCOLOR);
- grx_disc(Maze.Beacon.X, Maze.Beacon.Y, 10, 7);
- for (i=0; i<Maze.NBoxs; i++)
- {
- if (Maze.Boxs[i].Type==BOX_NON_BLOCK)
- grx_box(Maze.Boxs[i].X1, Maze.Boxs[i].Y1,
- Maze.Boxs[i].X2, Maze.Boxs[i].Y2, NONBLOCKCOLOR);
- if (Maze.Boxs[i].Type==BOX_BLOCK)
- grx_box(Maze.Boxs[i].X1, Maze.Boxs[i].Y1,
- Maze.Boxs[i].X2, Maze.Boxs[i].Y2, BLOCKCOLOR);
- }
- return OK;
-}
-
-int Init_Motor(int NMouse, int Motor, int Radius)
-{
- if ((NMouse<0) || (NMouse>=MAX_MOUSES))
- return ILEGAL_PARAMETER;
- if ((Motor<0) || (Motor>=2))
- return ILEGAL_PARAMETER;
- Mouse[NMouse].Motors[Motor].Radius=Radius;
- Mouse[NMouse].Motors[Motor].V=0;
- Mouse[NMouse].Motors[Motor].Old_V=0.0;
- return OK;
-}
-
-// Init_Mouse - inicialize the parameters of each mouse
-// NMouse - Identifier of the mouse
-// X - Coordinate X of the center
-// Y - Coordinate Y of the center
-// Radius - Radius of the mouse (size)
-// Dir - Angle of direction in witch i will start
-// NSensors - Number of sensors in the mouse (all types)
-//
-// Return: OK - Sucess
-// ILEGAL_PARAMETER - If NMouse negative of greater than maximum number of mouses
-// Note: All the types of sensors and motors are initialize to NONE
-
-int Init_Mouse(int NMouse, int X, int Y, int Radius, int Dir, int NSensors)
-{
- int i;
- if ((NMouse<0) || (NMouse>=MAX_MOUSES))
- return ILEGAL_PARAMETER;
- if ((NSensors<0) || (NSensors>MAX_SENSORS))
- return ILEGAL_PARAMETER;
- Mouse[NMouse].X=(float)X+LAB_XMIN;
- Mouse[NMouse].Y=(float)Y+LAB_YMIN;
- Mouse[NMouse].Radius=Radius;
- Mouse[NMouse].Dir=Dir;
- Mouse[NMouse].Old_Dir=Mouse[NMouse].Dir;
- Mouse[NMouse].NSensors=NSensors;
- Mouse[NMouse].Old_X=Mouse[NMouse].X;
- Mouse[NMouse].Old_Y=Mouse[NMouse].Y;
- Mouse[NMouse].NColision=0;
- Mouse[NMouse].PColision=0;
- for(i=0; i < Mouse[NMouse].NSensors; i++)
- Mouse[NMouse].Sensors[i].Type=NONE;
-
- Init_Motor(NMouse, MOTOR_LEFT, 10);
- Init_Motor(NMouse, MOTOR_RIGHT, -10);
-
- return OK;
-}
-
-// Init_Sensor - Initializes the sensor information
-// NMouse - Identifier of the mouse
-// Sensor - Identifier of the sensor to be used
-// Type - Type of sensor ( Ground, obstacle or beacon sensor )
-// Radius and Pos_Angle - Polar coordinates to determen the sensor position
-// Dir - Diretion of the sensor ( angle between the front and the sensor )
-// Angle - Half of the visual range
-// Intensity - Maximun distance of detect
-int Init_Sensor(int NMouse, int Sensor, int Type, int Radius,
- int Pos_Angle, int Dir, int Angle, int Intensity)
-{
- if ((NMouse<0) || (NMouse>=MAX_MOUSES))
- return ILEGAL_PARAMETER;
- if ((Sensor<0) || (Sensor>=Mouse[NMouse].NSensors))
- return ILEGAL_PARAMETER;
- Mouse[NMouse].Sensors[Sensor].Type=Type;
- Mouse[NMouse].Sensors[Sensor].Radius=Radius;
- Mouse[NMouse].Sensors[Sensor].Pos_Angle=Pos_Angle;
- Mouse[NMouse].Sensors[Sensor].Dir=Dir;
- Mouse[NMouse].Sensors[Sensor].Angle=Angle;
- Mouse[NMouse].Sensors[Sensor].Intensity=Intensity;
- if (Type == GROUND)
- Mouse[NMouse].Sensors[Sensor].Value=(float)SENSOR_MIN_GROUND;
- if (Type == OBSTACLE)
- Mouse[NMouse].Sensors[Sensor].Value=(float)SENSOR_MIN_OBSTACLE;
- if (Type == BEACON)
- Mouse[NMouse].Sensors[Sensor].Value=(float)SENSOR_MIN_BEACON;
- return OK;
-}
-
-int Set_Motor_Vel(int NMouse, int NMotor, int Vel)
-{
- if ((NMouse<0) || (NMouse>=MAX_MOUSES))
- return ILEGAL_PARAMETER;
- if ((NMotor<0) || (NMotor>2))
- return ILEGAL_PARAMETER;
- Mouse[NMouse].Motors[NMotor].V=Vel;
- return OK;
-}
-
-int Read_Sensor(int NMouse, int NSensor)
-{
- int X, Y, Dir, cr, sr, AuxX, AuxY;
- int Count, AuxCount, AngCount, AuxAngCount, RetColor, Intensity;
- float Auxf;
-
- /* Inicial verifications */
- if ((NMouse<0) || (NMouse>=MAX_MOUSES))
- return ILEGAL_PARAMETER;
- if ((NSensor<0) || (NSensor>Mouse[NMouse].NSensors))
- return ILEGAL_PARAMETER;
-
- /* If Sensor Not define exit */
- if ( Mouse[NMouse].Sensors[NSensor].Type == NONE )
- return OK;
-
- /* Calculate de position of the sensor and is direction */
- Dir=(int)Mouse[NMouse].Old_Dir+Mouse[NMouse].Sensors[NSensor].Dir;
- if (Dir >= 360)
- Dir -= 360;
- if (Dir < 0)
- Dir += 360;
- X= Mouse[NMouse].Old_X*65536.0+((Mouse[NMouse].Sensors[NSensor].Radius*Seno[Dir+90]));
- Y= Mouse[NMouse].Old_Y*65536.0+((Mouse[NMouse].Sensors[NSensor].Radius*Seno[Dir]));
-
- /* if the Sensor type is OBSTACLE */
- if ( Mouse[NMouse].Sensors[NSensor].Type == OBSTACLE )
- {
- Intensity=Mouse[NMouse].Sensors[NSensor].Intensity;
- AuxCount=Intensity;
- /* Scan all the visual field */
- for (AngCount=(-Mouse[NMouse].Sensors[NSensor].Angle);
- AngCount<=Mouse[NMouse].Sensors[NSensor].Angle;
- AngCount++)
- {
- AuxAngCount=Dir+AngCount;
- if (AuxAngCount >= 360)
- AuxAngCount -= 360;
- if (AuxAngCount < 0)
- AuxAngCount += 360;
- sr=Seno[AuxAngCount];
- cr=Seno[AuxAngCount+90];
- Count=Mouse[NMouse].Radius-Mouse[NMouse].Sensors[NSensor].Radius+2;
- AuxX = X+cr*Count;
- AuxY = Y+sr*Count;
- for (; Count<=AuxCount; Count++)
- {
- AuxX += cr;
- AuxY += sr;
- RetColor = grx_getpixel(AuxX >> 16, AuxY >> 16);
- if ((RetColor != BACKCOLOR)&&(RetColor != FINISHCOLOR))
- AuxCount=Count;
- }
- }
- Count=Mouse[NMouse].Sensors[NSensor].Intensity;
- Count*=Count;
- AuxCount*=AuxCount;
- Count = SENSOR_MAX_OBSTACLE-((SENSOR_MAX_OBSTACLE-SENSOR_MIN_OBSTACLE)
- *AuxCount)/Count;
- Mouse[NMouse].Sensors[NSensor].Value=
- (0.5*Mouse[NMouse].Sensors[NSensor].Value+0.5*(float)Count);
- }
- if ( Mouse[NMouse].Sensors[NSensor].Type == GROUND )
- {
- Mouse[NMouse].Sensors[NSensor].Value=(float)SENSOR_MIN_GROUND;
- AuxX=abs((X>>16)-Maze.Beacon.X);
- AuxY=abs((Y>>16)-Maze.Beacon.Y);
- if ((AuxX>50) || (AuxY>50))
- return OK;
- if ((AuxX*AuxX+AuxY*AuxY)<Maze.Radius*Maze.Radius)
- Mouse[NMouse].Sensors[NSensor].Value=(float)SENSOR_MAX_GROUND;
- }
-
- if ( Mouse[NMouse].Sensors[NSensor].Type == BEACON )
- {
- AuxX=(X>>16)-Maze.Beacon.X;
- AuxY=(Y>>16)-Maze.Beacon.Y;
- AngCount=0;
- if (AuxX!=0)
- {
- AuxAngCount=(AuxY<<16)/AuxX;
- if (AuxAngCount<0)
- AngCount=90;
- for (Count=AngCount;Count<AngCount+90;Count++)
- {
- if ((Tang[Count]<=AuxAngCount) && (Tang[Count+1]>AuxAngCount))
- break;
- }
- }
- else
- Count=90;
- if (AuxY<0)
- Count+=180;
- AuxAngCount=abs(180-abs(Dir-Count));
- Count=SENSOR_MIN_BEACON;
- if (AuxAngCount<Mouse[NMouse].Sensors[NSensor].Angle)
- {
- Count=AuxX*AuxX+AuxY*AuxY;
- AuxCount=(int)((float)Maze.Beacon.Intensity*(1.0+(0.4*(float)AuxAngCount)/(float)Mouse[NMouse].Sensors[NSensor].Angle));
- AuxCount*=AuxCount;
- if (Count<AuxCount)
- Count = SENSOR_MAX_OBSTACLE-((SENSOR_MAX_OBSTACLE-SENSOR_MIN_OBSTACLE)*Count)/AuxCount;
- else
- Count=SENSOR_MIN_BEACON;
- }
- Auxf=0.5*((float)Count);
- Auxf+=0.5*((float)Mouse[NMouse].Sensors[NSensor].Value);
- Mouse[NMouse].Sensors[NSensor].Value=Auxf;
- }
- return OK;
-}
-
-int GetSensor(int NMouse, int NSensor)
-{
- if ((NMouse<0) || (NMouse>=MAX_MOUSES))
- return ILEGAL_PARAMETER;
- if ((NSensor<0) || (NSensor>Mouse[NMouse].NSensors))
- return ILEGAL_PARAMETER;
- return (int)Mouse[NMouse].Sensors[NSensor].Value;
-}
-
-int Draw_Mouse(int NMouse, int Flag)
-{
- int Color;
- if (!Flag)
- Color=BACKCOLOR;
- else
- {
- Mouse[NMouse].Old_X=Mouse[NMouse].X;
- Mouse[NMouse].Old_Y=Mouse[NMouse].Y;
- Mouse[NMouse].Old_Dir=Mouse[NMouse].Dir;
- Color=2;
- }
- grx_circle(Mouse[NMouse].Old_X, Mouse[NMouse].Old_Y, Mouse[NMouse].Radius, Color);
- grx_line(Mouse[NMouse].Old_X, Mouse[NMouse].Old_Y,
- Mouse[NMouse].Old_X+((Mouse[NMouse].Radius*Seno[(int)Mouse[NMouse].Old_Dir+90]) >> 16),
- Mouse[NMouse].Old_Y+((Mouse[NMouse].Radius*Seno[(int)Mouse[NMouse].Old_Dir]) >> 16), Color);
- return OK;
-}
-
-TASK Redraw_Mouse_Task(int NMouse)
-{
- char str[40];
- TIME dwTicks;
- while(1)
- {
- dwTicks=sys_gettime(NULL);
- Draw_Mouse(NMouse, FALSE);
- Draw_Mouse(NMouse, TRUE);
- sprintf(str,"Colision: %4d", (int)Mouse[NMouse].NColision);
- grx_text(str, NMouse*150, 21, 7, 0);
- sprintf(str,"Motor: %4d Sensor 0: %4d Sensor 1: %4d Sensor 2: %4d Sensor 3: %4d",
- (int)Mouse[NMouse].Motors[0].Old_V+(int)Mouse[NMouse].Motors[1].Old_V,
- (int)Mouse[NMouse].Sensors[0].Value, (int)Mouse[NMouse].Sensors[1].Value,
- (int)Mouse[NMouse].Sensors[2].Value, (int)Mouse[NMouse].Sensors[3].Value);
- if (NMouse==0)
- grx_text(str, 1, 1, 7, 0);
- sprintf(str,"Sensor 4: %4d Sensor 5: %4d Ticks: %4d",
- (int)Mouse[NMouse].Sensors[4].Value, (int)Mouse[NMouse].Sensors[5].Value,
- (int)(sys_gettime(NULL)-dwTicks)/1000);
- if (NMouse==0)
- grx_text(str, 1, 11, 7, 0);
- task_endcycle();
- }
-}
-
-TASK Redraw_Maze_Task(void)
-{
- while(1)
- {
- Draw_Maze();
- task_endcycle();
- }
-}
-
-TASK Referee(void)
-{
- int Counter, Box_Min_X, Box_Max_X ,Box_Min_Y, Box_Max_Y;
- int deltaX, deltaY, Radius;
- int Colision;
- int NMouse;
-
- while(1)
- {
- for(NMouse=0;NMouse<NMouses;NMouse++)
- {
- Colision=0;
- Radius=Mouse[NMouse].Radius;
- if(Mouse[NMouse].Y<(Maze.Y1+Radius))
- Colision++;
- if(Mouse[NMouse].Y>(Maze.Y2-Radius))
- Colision++;
- if(Mouse[NMouse].X<(Maze.X1+Radius))
- Colision++;
- if(Mouse[NMouse].X>(Maze.X2-Radius))
- Colision++;
- for(Counter=0; Counter<Maze.NBoxs; Counter++)
- {
- Box_Min_X=Maze.Boxs[Counter].X1-1;
- Box_Max_X=Maze.Boxs[Counter].X2+1;
- Box_Min_Y=Maze.Boxs[Counter].Y1-1;
- Box_Max_Y=Maze.Boxs[Counter].Y2+1;
- Radius=Mouse[NMouse].Radius;
- if(Mouse[NMouse].Y<(Box_Min_Y-Radius))
- continue;
- if(Mouse[NMouse].Y>(Box_Max_Y+Radius))
- continue;
- if(Mouse[NMouse].X<(Box_Min_X-Radius))
- continue;
- if(Mouse[NMouse].X>(Box_Max_X+Radius))
- continue;
- if((Mouse[NMouse].X>=Box_Min_X) && (Mouse[NMouse].X<=Box_Max_X))
- if((Mouse[NMouse].Y>=(Box_Min_Y-Radius))
- && (Mouse[NMouse].Y<=(Box_Max_Y+Radius)))
- Colision++;
- if((Mouse[NMouse].Y>=Box_Min_Y) && (Mouse[NMouse].Y<=Box_Max_Y))
- if((Mouse[NMouse].X>=(Box_Min_X-Radius))
- && (Mouse[NMouse].X<=(Box_Max_X+Radius)))
- Colision++;
- Radius=sqr(Radius);
- deltaX=sqr(Mouse[NMouse].X-Box_Min_X);
- deltaY=sqr(Mouse[NMouse].Y-Box_Min_Y);
- if(deltaX+deltaY<=Radius)
- Colision++;
- deltaY=sqr(Mouse[NMouse].Y-Box_Max_Y);
- if(deltaX+deltaY<=Radius)
- Colision++;
- deltaX=sqr(Mouse[NMouse].X-Box_Max_X);
- deltaY=sqr(Mouse[NMouse].Y-Box_Min_Y);
- if(deltaX+deltaY<=Radius)
- Colision++;
- deltaY=sqr(Mouse[NMouse].Y-Box_Max_Y);
- if(deltaX+deltaY<=Radius)
- Colision++;
- }
- if (Mouse[NMouse].PColision && !Colision)
- Mouse[NMouse].NColision++;
-
- Mouse[NMouse].PColision=Colision;
- }
- task_endcycle();
- }
- return (void *)0;
-}
-
-TASK Calculate_Position(int NMouse)
-{
- float w, v, dt;
- int b;
- while(1)
- {
- b=(Mouse[NMouse].Motors[MOTOR_LEFT].Radius-
- Mouse[NMouse].Motors[MOTOR_RIGHT].Radius);
- if (b<0)
- b=-b;
- w=(Mouse[NMouse].Motors[MOTOR_LEFT].Old_V-
- Mouse[NMouse].Motors[MOTOR_RIGHT].Old_V);
- w/=(float)b;
- v=(Mouse[NMouse].Motors[MOTOR_LEFT].Old_V+
- Mouse[NMouse].Motors[MOTOR_RIGHT].Old_V);
- v/=2.0;
- dt=CALC_PERIOD/1000000.0;
- Mouse[NMouse].Dir += (180.0*w/PI)*dt;
- if (Mouse[NMouse].Dir >= 360)
- Mouse[NMouse].Dir -= 360;
- if (Mouse[NMouse].Dir < 0)
- Mouse[NMouse].Dir += 360;
- v *= dt/65536.0;
- b=(float)Seno[(int)Mouse[NMouse].Dir+90];
- Mouse[NMouse].X += v*b;
- b=(float)Seno[(int)Mouse[NMouse].Dir];
- Mouse[NMouse].Y += v*b;
- Mouse[NMouse].Motors[0].Old_V=
- (0.8187*Mouse[NMouse].Motors[0].Old_V+
- 0.1813*(float)Mouse[NMouse].Motors[0].V);
- Mouse[NMouse].Motors[1].Old_V=
- (0.8187*Mouse[NMouse].Motors[1].Old_V+
- 0.1813*(float)Mouse[NMouse].Motors[1].V);
- task_endcycle();
- }
-}
-
-#define SENSOR_LEFT 0
-#define SENSOR_FRONT 1
-#define SENSOR_RIGTH 2
-#define SENSOR_GROUND 3
-#define SENSOR_B_LEFT 4
-#define SENSOR_B_RIGHT 5
-#define MAX_SPEED 50
-#define DIST_DIR GetSensor(NMouse, SENSOR_RIGTH)
-#define DIST_ESQ GetSensor(NMouse, SENSOR_LEFT)
-#define DIST_FRENTE GetSensor(NMouse, SENSOR_FRONT)
-#define FAROL_ESQ GetSensor(NMouse, SENSOR_B_LEFT)
-#define FAROL_DIR GetSensor(NMouse, SENSOR_B_RIGHT)
-#define FAROL_LIM_INF SENSOR_MIN_BEACON+5
-
-#define DIST0 88 //Distancia minima optima
-#define DIST1 DIST0 + 5 // 60%
-#define DIST2 DIST1 + 10 // PARADO
-#define DIST3 DIST2 + 10 // TRAS
-
-#define DISTMAX 120
-#define NENHUM 0
-#define ESQUERDA 1
-#define DIREITA 2
-#define contorno ContornoArr[NMouse]
-
-TASK MouseTask(int NMouse)
-{
- int i;
- //char str[100];
- unsigned char flag;
- static unsigned char ContornoArr[MAX_MOUSES];
- signed char modulo;
-
- Init_Sensor(NMouse, SENSOR_LEFT, OBSTACLE, 14, -45, -45, 25, 15); // Left
- Init_Sensor(NMouse, SENSOR_FRONT, OBSTACLE, 14, 0, 0, 25, 15); // Center
- Init_Sensor(NMouse, SENSOR_RIGTH, OBSTACLE, 14, 45, 45, 25, 15); // Rigth
- Init_Sensor(NMouse, SENSOR_GROUND, GROUND, 10, 180, 180, 0, 20); // Ground
- Init_Sensor(NMouse, SENSOR_B_LEFT, BEACON, 4, -45, -25, 30, 0); // Left
- Init_Sensor(NMouse, SENSOR_B_RIGHT, BEACON, 4, 45, 25, 30, 0); // Rigth
- contorno = NENHUM;
- Mouse[NMouse].Flag=1;
-
- while(1)
- {
- for(i=0; i<8; i++)
- Read_Sensor(NMouse, i);
- Set_Motor_Vel(NMouse, MOTOR_RIGHT, MAX_SPEED);
- Set_Motor_Vel(NMouse, MOTOR_LEFT, MAX_SPEED);
-
- flag = ((DIST_DIR>DIST3) && contorno==ESQUERDA) ||
- ((DIST_ESQ>DIST3) && contorno==DIREITA);
-
- if ( (DIST_FRENTE>DISTMAX) || flag) {
- Set_Motor_Vel(NMouse, MOTOR_RIGHT, MAX_SPEED/2);
- Set_Motor_Vel(NMouse, MOTOR_LEFT, MAX_SPEED/2);
- if (contorno == ESQUERDA)
- Set_Motor_Vel(NMouse, MOTOR_RIGHT, -MAX_SPEED/2);
- else
- Set_Motor_Vel(NMouse, MOTOR_LEFT, -MAX_SPEED/2);
- }
- else {
-
- // ---------------- Contorno da Esquerda ---------------
- if (contorno!=DIREITA){
- if (DIST_ESQ>DIST1) { // Sensor da esquerda
- contorno = ESQUERDA;
- if (DIST_ESQ>DIST3) {
- Set_Motor_Vel(NMouse, MOTOR_RIGHT, -MAX_SPEED/2);
- Set_Motor_Vel(NMouse, MOTOR_LEFT, MAX_SPEED/2);
- }
- else
- if (DIST_ESQ>DIST2)
- Set_Motor_Vel(NMouse, MOTOR_RIGHT, 10);
- else
- Set_Motor_Vel(NMouse, MOTOR_RIGHT, MAX_SPEED*3/4);
- }
- else
- if (contorno== ESQUERDA) {
- if(DIST_ESQ<DIST0)
- Set_Motor_Vel(NMouse, MOTOR_LEFT, MAX_SPEED*3/10);
- }
- }
-
- // ---------------- Contorno da Direita ---------------
- if (contorno!=ESQUERDA){
- if (DIST_DIR>DIST1) { // Sensor da direita
- contorno = DIREITA;
- if (DIST_DIR>DIST3) {
- Set_Motor_Vel(NMouse, MOTOR_RIGHT, MAX_SPEED/2);
- Set_Motor_Vel(NMouse, MOTOR_LEFT, -MAX_SPEED/2);
- }
- else
- if (DIST_DIR>DIST2)
- Set_Motor_Vel(NMouse, MOTOR_LEFT, 10);
- else
- Set_Motor_Vel(NMouse, MOTOR_LEFT, MAX_SPEED*3/4);
- }
- else
- if (contorno== DIREITA) {
- if (DIST_DIR<DIST0)
- Set_Motor_Vel(NMouse, MOTOR_RIGHT, MAX_SPEED*3/10);
- }
- }
-
- // --------------- Desempancar contornos com o farol ------------
-
- if ((contorno == ESQUERDA && FAROL_DIR > FAROL_ESQ && FAROL_DIR > FAROL_LIM_INF) ||
- (contorno == DIREITA && FAROL_ESQ > FAROL_DIR && FAROL_ESQ > FAROL_LIM_INF) )
- contorno = NENHUM;
-
-
-
- if (contorno == NENHUM)
- {
- modulo = FAROL_DIR - FAROL_ESQ;
- if (modulo < 0 )
- modulo = - modulo;
-
- // Se nao estiver na direçao certa, ajustar
- if (modulo > 10) {
- if (FAROL_DIR > FAROL_ESQ)
- Set_Motor_Vel(NMouse, MOTOR_RIGHT, 0);
- else
- Set_Motor_Vel(NMouse, MOTOR_LEFT, 0);
- }
- else //velocidade controlada
- if (modulo > 2) {
- if (FAROL_DIR > FAROL_ESQ)
- Set_Motor_Vel(NMouse, MOTOR_RIGHT, MAX_SPEED*6/10);
- else
- Set_Motor_Vel(NMouse, MOTOR_LEFT, MAX_SPEED*6/10);
- }
- }
- }
- if (GetSensor(NMouse, SENSOR_GROUND)==SENSOR_MAX_GROUND)
- {
- Set_Motor_Vel(NMouse, MOTOR_RIGHT, 0);
- Set_Motor_Vel(NMouse, MOTOR_LEFT, 0);
- }
-
- task_endcycle();
- }
- return (void *)0;
-}
-
-void my_end(void *arg)
-{
- grx_close();
-}
-
-/* --------------------------------- Main program -----------------------------*/
-
-int main(int argc, char *argv[])
-{
- int i;
- char c;
- int pid;
-
- HARD_TASK_MODEL mp;
- SOFT_TASK_MODEL ms;
-
- // char StrAux[15];
-
- for (i=0; i<NMouses; i++)
- Mouse[i].Flag=0;
- for (i=0; i<(360+90); i++) // Inicializar a tabela de senos
- Seno[i]=(int)(65536.0*sin((float)i/180.0*PI));
-
- for (i=0; i<180; i++) // Inicializar a tabela de tangente
- if (i!=90)
- Tang[i]=(int)(((float)Seno[i]/(float)Seno[i+90])*65536.0);
- else
- Tang[i]=INT_MAX;
-
- // Definir fun‡Æo de saida
- sys_atrunlevel(my_end, (void *)NULL, RUNLEVEL_BEFORE_EXIT);
-
- hard_task_default_model(mp);
- hard_task_def_usemath(mp);
- hard_task_def_group(mp, MOUSEGROUP);
- hard_task_def_wcet(mp, 1); // wcet ignored by the configuration file!
-
- soft_task_default_model(ms);
- soft_task_def_group(ms, MOUSEGROUP);
- soft_task_def_met(ms, 1000);
-
- for (i=0;i<NMouses;i++)
- {
- hard_task_def_arg(mp, (void *)i);
- soft_task_def_arg(ms, (void *)i);
-
- hard_task_def_mit(mp, MOUSE_PERIOD);
- pid = task_create("Mouse", MouseTask, &mp, NULL);
- if (pid == NIL)
- {
- perror("Creating Mouse:");
- sys_end();
- }
-
- hard_task_def_mit(mp, CALC_PERIOD);
- pid = task_create("Calc", Calculate_Position, &mp, NULL);
- if (pid == NIL)
- {
- perror("Creating Calc:");
- sys_end();
- }
-
- soft_task_def_period(ms, REDRAW_MOUSE_PERIOD);
- pid = task_create("Redraw_Mouse", Redraw_Mouse_Task, &ms, NULL);
- if (pid == NIL)
- {
- perror("Creating Redraw_Moude:");
- sys_end();
- }
- }
-
- hard_task_def_mit(mp, REFEREE_PERIOD);
- pid = task_create("Referee1", Referee, &mp, NULL);
-
- hard_task_def_mit(mp, REDRAW_MAZE_PERIOD);
- pid = task_create("Redraw_Maze", Redraw_Maze_Task, &mp, NULL);
-
- grx_open(640,480,8);
- group_activate(MOUSEGROUP);
- do
- {
- c = keyb_getch(BLOCK);
- } while (c != ESC);
-
- task_nopreempt();
- sys_end();
- return 0;
-}
-
-/* the buffer b is scannedc to search for numbers
- at the first non-number the function stops */
-void geti(char *b, int *pos, int *res)
-{
- // skip first chars
- while (!isdigit(b[*pos]))
- (*pos)++;
-
-
- // read the numbers
- *res = 0;
- do {
- *res = (*res * 10) + b[*pos] - '0';
- (*pos)++;
- } while (isdigit(b[*pos]));
-}
-
-void read_cfg_file(int argc, char **argv)
-{
- int i, err, Temp1, Temp2, Temp3, Temp4, Temp5;
- DOS_FILE *fp;
- char myfilebuf[1000];
- int myfilebuf_length;
-
- int pos = 0;
-
- if (argc==2) {
- fp = DOS_fopen(argv[1],"r");
-
- if (fp) {
- /* read up to 1000 chars */
- myfilebuf_length = DOS_fread(&myfilebuf,1,1000,fp);
-
- /* check for errors */
- err = DOS_error();
-
- cprintf("Read %d bytes...\n", myfilebuf_length);
-
- if (err) {
- cprintf("Error %d reading file...Using default values\n", err);
- }
- else
- {
- geti(myfilebuf, &pos, &NMouses); // Number of Mouses
- for (i=0;i<NMouses;i++) {
- geti(myfilebuf, &pos, &Temp1); // Mouse X coordinate
- geti(myfilebuf, &pos, &Temp2); // Mouse Y coordinate
- geti(myfilebuf, &pos, &Temp3); // Mouse radius
- geti(myfilebuf, &pos, &Temp4); // Mouse orientation
- Init_Mouse(i, Temp1, Temp2, Temp3, Temp4, 6);
- }
- geti(myfilebuf, &pos, &Temp1); // Beacon X coordinate
- geti(myfilebuf, &pos, &Temp2); // Beacon Y coordinate
- geti(myfilebuf, &pos, &Temp3); // Beacon intensity
- geti(myfilebuf, &pos, &i); // Number of boxs
- Init_Maze(Temp1, Temp2, Temp3, i);
- for(; i>0; i--) {
- geti(myfilebuf, &pos, &Temp1); // Box X1 Coordinate
- geti(myfilebuf, &pos, &Temp2); // Box Y1 Coordinate
- geti(myfilebuf, &pos, &Temp3); // Box X2 Coordinate
- geti(myfilebuf, &pos, &Temp4); // Box Y2 Coordinate
- geti(myfilebuf, &pos, &Temp5); // Type of Box
- if (Temp5)
- Init_Box(i-1, Temp1, Temp2, Temp3, Temp4, BOX_BLOCK);
- else
- Init_Box(i-1, Temp1, Temp2, Temp3, Temp4, BOX_NON_BLOCK);
- }
- DOS_fclose(fp);
- return;
- }
- }
- else {
- /* error!! */
- err = DOS_error();
- /* note that if you call DOS_error() here, it return 0!!! */
- cprintf("Error %d opening myfile.txt...Using default values\n", err);
- }
-
- // Default value if no file is passed
- NMouses=2;
- Init_Maze(500, 350, 400, 1);
- Init_Box(0, 200, 200, 300, 250, BOX_NON_BLOCK);
- Init_Mouse(0, 100, 100, 15, 45, 6);
- Init_Mouse(1, 100, 150, 15, 90, 6);
- }
- else {
- cprintf("Wrong number of arguments...\n");
- l1_exit(0);
- }
-}
Index: tags/rel_0_5/robots/lab.txt
===================================================================
--- tags/rel_0_5/robots/lab.txt (revision 1657)
+++ tags/rel_0_5/robots/lab.txt (nonexistent)
@@ -1,10 +0,0 @@
-2
-530 380 15 270
-480 380 15 270
-380 300 400 5
-430 060 460 400 0
-350 100 430 130 0
-000 100 300 130 0
-150 200 430 230 0
-120 300 150 400 0
-
Index: tags/rel_0_5/robots/readme
===================================================================
--- tags/rel_0_5/robots/readme (revision 1657)
+++ tags/rel_0_5/robots/readme (nonexistent)
@@ -1,9 +0,0 @@
-Robots demo
------------
-
-This demo has been developed in the University of Alveiro, Portugal.
-
-See the included PDF files for more informations.
-
-Paolo
-pj@sssup.it
Index: tags/rel_0_5/robots/makefile
===================================================================
--- tags/rel_0_5/robots/makefile (revision 1657)
+++ tags/rel_0_5/robots/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = mouse2
-
-include $(BASE)/config/example.mk
-
-mouse2:
- make -f $(SUBMAKE) APP=mouse2 INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
-
Index: tags/rel_0_5/robots/lab3.txt
===================================================================
--- tags/rel_0_5/robots/lab3.txt (revision 1657)
+++ tags/rel_0_5/robots/lab3.txt (nonexistent)
@@ -1,11 +0,0 @@
-3
-540 380 15 270
-510 380 15 270
-480 380 15 270
-380 300 400 5
-430 060 460 400 0
-350 100 430 130 0
-000 100 300 130 0
-150 200 430 230 0
-120 300 150 400 0
-
Index: tags/rel_0_5/auto/edfact.c
===================================================================
--- tags/rel_0_5/auto/edfact.c (revision 1657)
+++ tags/rel_0_5/auto/edfact.c (nonexistent)
@@ -1,565 +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: edfact.c,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-**/
-
-/*
- * Copyright (C) 2001 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 "edfact.h"
-#include <ll/stdio.h>
-#include <ll/string.h>
-#include <kernel/model.h>
-#include <kernel/descr.h>
-#include <kernel/var.h>
-#include <kernel/func.h>
-
-//#define edfact_printf kern_printf
-#define edfact_printf printk
-
-/*+ Status used in the level +*/
-#define EDFACT_READY MODULE_STATUS_BASE /*+ - Ready status +*/
-#define EDFACT_IDLE MODULE_STATUS_BASE+4 /*+ to wait the deadline +*/
-
-/*+ flags +*/
-#define EDFACT_FLAG_NORAISEEXC 2
-
-/*+ the level redefinition for the Earliest Deadline First level +*/
-typedef struct {
- level_des l; /*+ the standard level descriptor +*/
-
- TIME period[MAX_PROC]; /*+ The task periods; the deadlines are
- stored in the priority field +*/
- int deadline_timer[MAX_PROC];
- /*+ The task deadline timers +*/
-
- struct timespec deadline_timespec[MAX_PROC];
-
- int dline_miss[MAX_PROC]; /*+ Deadline miss counter +*/
- int wcet_miss[MAX_PROC]; /*+ Wcet miss counter +*/
-
- int nact[MAX_PROC]; /*+ Wcet miss counter +*/
-
- int flag[MAX_PROC];
- /*+ used to manage the JOB_TASK_MODEL and the
- periodicity +*/
-
- IQUEUE ready; /*+ the ready queue +*/
-
- int flags; /*+ the init flags... +*/
-
- bandwidth_t U; /*+ the used bandwidth +*/
-
-} EDFACT_level_des;
-
-
-static void EDFACT_timer_deadline(void *par);
-
-static void EDFACT_internal_activate(EDFACT_level_des *lev, PID p,
- struct timespec *t)
-{
- struct timespec *temp;
-
- temp = iq_query_timespec(p, &lev->ready);
-
- TIMESPEC_ASSIGN(temp,t);
- ADDUSEC2TIMESPEC(lev->period[p], temp);
-
- TIMESPEC_ASSIGN(&lev->deadline_timespec[p],
- temp);
-
- /* Insert task in the correct position */
- proc_table[p].status = EDFACT_READY;
- iq_timespec_insert(p,&lev->ready);
-
- /* needed because when there is a wcet miss I disable CONTROL_CAP */
- proc_table[p].control |= CONTROL_CAP;
-}
-
-static void EDFACT_timer_deadline(void *par)
-{
- PID p = (PID) par;
- EDFACT_level_des *lev;
-
- lev = (EDFACT_level_des *)level_table[proc_table[p].task_level];
-
- switch (proc_table[p].status) {
- case EDFACT_IDLE:
- edfact_printf("I%d",p);
-
- EDFACT_internal_activate(lev,p, &lev->deadline_timespec[p]);
-
- event_need_reschedule();
- break;
-
- default:
- edfact_printf("D%d",p);
- /* else, a deadline miss occurred!!! */
- lev->dline_miss[p]++;
-
- /* the task is into another state */
- lev->nact[p]++;
-
- /* Set the deadline timer */
- ADDUSEC2TIMESPEC(lev->period[p], &lev->deadline_timespec[p]);
- }
-
- /* Set the deadline timer */
- lev->deadline_timer[p] = kern_event_post(&lev->deadline_timespec[p],
- EDFACT_timer_deadline,
- (void *)p);
-
-}
-
-static void EDFACT_timer_guest_deadline(void *par)
-{
- PID p = (PID) par;
-
- edfact_printf("AAARRRGGGHHH!!!");
- kern_raise(XDEADLINE_MISS,p);
-}
-
-
-/* The scheduler only gets the first task in the queue */
-static PID EDFACT_public_scheduler(LEVEL l)
-{
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- return iq_query_first(&lev->ready);
-}
-
-/* The on-line guarantee is enabled only if the appropriate flag is set... */
-static int EDFACT_public_guarantee(LEVEL l, bandwidth_t *freebandwidth)
-{
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- if (lev->flags & EDFACT_FAILED_GUARANTEE) {
- *freebandwidth = 0;
- return 0;
- }
- else
- if (*freebandwidth >= lev->U) {
- *freebandwidth -= lev->U;
- return 1;
- }
- else
- return 0;
-
-}
-
-static int EDFACT_public_create(LEVEL l, PID p, TASK_MODEL *m)
-{
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- HARD_TASK_MODEL *h;
-
- if (m->pclass != HARD_PCLASS) return -1;
- if (m->level != 0 && m->level != l) return -1;
- h = (HARD_TASK_MODEL *)m;
- if (!h->wcet || !h->mit || h->periodicity != PERIODIC) return -1;
- /* now we know that m is a valid model */
-
- lev->period[p] = h->mit;
-
- lev->flag[p] = 0;
- lev->deadline_timer[p] = -1;
- lev->dline_miss[p] = 0;
- lev->wcet_miss[p] = 0;
- lev->nact[p] = 0;
-
- /* Enable wcet check */
- proc_table[p].avail_time = h->wcet;
- proc_table[p].wcet = h->wcet;
- proc_table[p].control |= CONTROL_CAP;
-
- /* update the bandwidth... */
- if (lev->flags & EDFACT_ENABLE_GUARANTEE) {
- bandwidth_t b;
- b = (MAX_BANDWIDTH / h->mit) * h->wcet;
-
- /* really update lev->U, checking an overflow... */
- if (MAX_BANDWIDTH - lev->U > b)
- lev->U += b;
- else
- /* The task can NOT be guaranteed (U>MAX_BANDWIDTH)...
- in this case, we don't raise an exception... in fact, after the
- EDFACT_task_create the task_create will call level_guarantee that return
- -1... return -1 in EDFACT_task_create isn't correct, because:
- . generally, the guarantee must be done when also the resources
- are registered
- . returning -1 will cause the task_create to return with an errno
- ETASK_CREATE instead of ENO_GUARANTEE!!!
-
- Why I use the flag??? because if the lev->U overflows, if i.e. I set
- it to MAX_BANDWIDTH, I lose the correct allocated bandwidth...
- */
- lev->flags |= EDFACT_FAILED_GUARANTEE;
- }
-
- return 0; /* OK, also if the task cannot be guaranteed... */
-}
-
-static void EDFACT_public_detach(LEVEL l, PID p)
-{
- /* the EDFACT level doesn't introduce any dinamic allocated new field.
- we have only to reset the NO_GUARANTEE FIELD and decrement the allocated
- bandwidth */
-
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- if (lev->flags & EDFACT_FAILED_GUARANTEE)
- lev->flags &= ~EDFACT_FAILED_GUARANTEE;
- else
- lev->U -= (MAX_BANDWIDTH / lev->period[p]) * proc_table[p].wcet;
-}
-
-static void EDFACT_public_dispatch(LEVEL l, PID p, int nostop)
-{
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- /* the task state is set EXE by the scheduler()
- we extract the task from the ready queue
- NB: we can't assume that p is the first task in the queue!!! */
- iq_extract(p, &lev->ready);
-}
-
-static void EDFACT_public_epilogue(LEVEL l, PID p)
-{
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- /* check if the wcet is finished... */
- if (proc_table[p].avail_time <= 0 && proc_table[p].control&CONTROL_CAP) {
- /* wcet finished: disable wcet event and count wcet miss */
- edfact_printf("W%d",p);
- proc_table[p].control &= ~CONTROL_CAP;
- lev->wcet_miss[p]++;
- }
-
- /* the task it returns into the ready queue... */
- iq_timespec_insert(p,&lev->ready);
- proc_table[p].status = EDFACT_READY;
-}
-
-static void EDFACT_public_activate(LEVEL l, PID p)
-{
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
- struct timespec t;
-
- /* Test if we are trying to activate a non sleeping task */
- /* save activation (only if needed... */
- if (proc_table[p].status != SLEEP) {
- /* a periodic task cannot be activated when it is already active */
- kern_raise(XACTIVATION,p);
- return;
- }
-
- kern_gettime(&t);
- EDFACT_internal_activate(lev,p, &t);
-
- /* Set the deadline timer */
- lev->deadline_timer[p] = kern_event_post(&lev->deadline_timespec[p],
- EDFACT_timer_deadline,
- (void *)p);
-
-}
-
-static void EDFACT_public_unblock(LEVEL l, PID p)
-{
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- /* Insert task in the coEDFect position */
- proc_table[p].status = EDFACT_READY;
- iq_timespec_insert(p,&lev->ready);
-}
-
-static void EDFACT_public_block(LEVEL l, PID p)
-{
-}
-
-static int EDFACT_public_message(LEVEL l, PID p, void *m)
-{
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
- struct timespec t;
-
- /* we reset the capacity counters... */
- proc_table[p].avail_time = proc_table[p].wcet;
-
- if (lev->nact[p] > 0) {
- edfact_printf("E%d",p);
-
- /* Pending activation: reactivate the thread!!! */
- lev->nact[p]--;
-
- /* see also EDFACT_timer_deadline */
- kern_gettime(&t);
- EDFACT_internal_activate(lev,p, &t);
-
- /* check if the deadline has already expired */
- if (TIMESPEC_A_LT_B(iq_query_timespec(p, &lev->ready), &schedule_time)) {
- /* count the deadline miss */
- lev->dline_miss[p]++;
- kern_event_delete(lev->deadline_timer[p]);
- }
-
- }
- else {
- edfact_printf("e%d",p);
-
- /* the task has terminated his job before it consume the wcet. All OK! */
- proc_table[p].status = EDFACT_IDLE;
-
- /* when the deadline timer fire, it recognize the situation and set
- correctly all the stuffs (like reactivation, etc... ) */
- }
-
- jet_update_endcycle(); /* Update the Jet data... */
-
- return 0;
-}
-
-static void EDFACT_public_end(LEVEL l, PID p)
-{
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- edfact_printf("Û%d",p);
-
- /* we finally put the task in the ready queue */
- proc_table[p].status = FREE;
- iq_insertfirst(p,&freedesc);
- /* and free the allocated bandwidth */
- lev->U -= (MAX_BANDWIDTH/lev->period[p]) * proc_table[p].wcet;
-
- if (lev->deadline_timer[p] != -1) {
- edfact_printf("²%d",p);
- kern_event_delete(lev->deadline_timer[p]);
- }
-}
-
-
-/* Guest Functions
- These functions manages a JOB_TASK_MODEL, that is used to put
- a guest task in the EDFACT ready queue. */
-
-static void EDFACT_private_insert(LEVEL l, PID p, TASK_MODEL *m)
-{
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- JOB_TASK_MODEL *job;
-
- if (m->pclass != JOB_PCLASS || (m->level != 0 && m->level != l) ) {
- kern_raise(XINVALID_TASK, p);
- return;
- }
-
- job = (JOB_TASK_MODEL *)m;
-
- TIMESPEC_ASSIGN(iq_query_timespec(p, &lev->ready), &job->deadline);
-
- lev->deadline_timer[p] = -1;
- lev->dline_miss[p] = 0;
- lev->wcet_miss[p] = 0;
- lev->nact[p] = 0;
-
- if (job->noraiseexc)
- lev->flag[p] = EDFACT_FLAG_NORAISEEXC;
- else {
- lev->flag[p] = 0;
- lev->deadline_timer[p] = kern_event_post(iq_query_timespec(p, &lev->ready),
- EDFACT_timer_guest_deadline,
- (void *)p);
- }
-
- lev->period[p] = job->period;
-
- /* Insert task in the correct position */
- iq_timespec_insert(p,&lev->ready);
- proc_table[p].status = EDFACT_READY;
-
- /* there is no bandwidth guarantee at this level, it is performed
- by the level that inserts guest tasks... */
-}
-
-static void EDFACT_private_dispatch(LEVEL l, PID p, int nostop)
-{
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- /* the task state is set to EXE by the scheduler()
- we extract the task from the ready queue
- NB: we can't assume that p is the first task in the queue!!! */
- iq_extract(p, &lev->ready);
-}
-
-static void EDFACT_private_epilogue(LEVEL l, PID p)
-{
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- /* the task has been preempted. it returns into the ready queue... */
- iq_timespec_insert(p,&lev->ready);
- proc_table[p].status = EDFACT_READY;
-}
-
-static void EDFACT_private_extract(LEVEL l, PID p)
-{
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- //kern_printf("EDFACT_guest_end: dline timer %d\n",lev->deadline_timer[p]);
- if (proc_table[p].status == EDFACT_READY)
- {
- iq_extract(p, &lev->ready);
- //kern_printf("(g_end rdy extr)");
- }
-
- /* we remove the deadline timer, because the slice is finished */
- if (lev->deadline_timer[p] != NIL) {
-// kern_printf("EDFACT_guest_end: dline timer %d\n",lev->deadline_timer[p]);
- kern_event_delete(lev->deadline_timer[p]);
- lev->deadline_timer[p] = NIL;
- }
-
-}
-
-/* Registration functions */
-
-/*+ Registration function:
- int flags the init flags ... see EDFACT.h +*/
-LEVEL EDFACT_register_level(int flags)
-{
- LEVEL l; /* the level that we register */
- EDFACT_level_des *lev; /* for readableness only */
- PID i; /* a counter */
-
- printk("EDFACT_register_level\n");
-
- /* request an entry in the level_table */
- l = level_alloc_descriptor(sizeof(EDFACT_level_des));
-
- lev = (EDFACT_level_des *)level_table[l];
-
- printk(" lev=%d\n",(int)lev);
-
- /* fill the standard descriptor */
- lev->l.private_insert = EDFACT_private_insert;
- lev->l.private_extract = EDFACT_private_extract;
- lev->l.private_dispatch = EDFACT_private_dispatch;
- lev->l.private_epilogue = EDFACT_private_epilogue;
-
- lev->l.public_scheduler = EDFACT_public_scheduler;
- if (flags & EDFACT_ENABLE_GUARANTEE)
- lev->l.public_guarantee = EDFACT_public_guarantee;
- else
- lev->l.public_guarantee = NULL;
- lev->l.public_create = EDFACT_public_create;
- lev->l.public_detach = EDFACT_public_detach;
- lev->l.public_end = EDFACT_public_end;
- lev->l.public_dispatch = EDFACT_public_dispatch;
- lev->l.public_epilogue = EDFACT_public_epilogue;
- lev->l.public_activate = EDFACT_public_activate;
- lev->l.public_unblock = EDFACT_public_unblock;
- lev->l.public_block = EDFACT_public_block;
- lev->l.public_message = EDFACT_public_message;
-
- /* fill the EDFACT descriptor part */
- for(i=0; i<MAX_PROC; i++) {
- lev->period[i] = 0;
- lev->deadline_timer[i] = -1;
- lev->flag[i] = 0;
- lev->dline_miss[i] = 0;
- lev->wcet_miss[i] = 0;
- lev->nact[i] = 0;
- }
-
- iq_init(&lev->ready,&freedesc, 0);
- lev->flags = flags & 0x07;
- lev->U = 0;
-
- return l;
-}
-
-bandwidth_t EDFACT_usedbandwidth(LEVEL l)
-{
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- return lev->U;
-}
-
-int EDFACT_get_dline_miss(PID p)
-{
- LEVEL l = proc_table[p].task_level;
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- return lev->dline_miss[p];
-}
-
-int EDFACT_get_wcet_miss(PID p)
-{
- LEVEL l = proc_table[p].task_level;
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- return lev->wcet_miss[p];
-}
-
-int EDFACT_get_nact(PID p)
-{
- LEVEL l = proc_table[p].task_level;
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- return lev->nact[p];
-}
-
-int EDFACT_reset_dline_miss(PID p)
-{
- LEVEL l = proc_table[p].task_level;
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- lev->dline_miss[p] = 0;
- return 0;
-}
-
-int EDFACT_reset_wcet_miss(PID p)
-{
- LEVEL l = proc_table[p].task_level;
- EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]);
-
- lev->wcet_miss[p] = 0;
- return 0;
-}
-
Index: tags/rel_0_5/auto/tracks.c
===================================================================
--- tags/rel_0_5/auto/tracks.c (revision 1657)
+++ tags/rel_0_5/auto/tracks.c (nonexistent)
@@ -1,111 +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>
- * Massimiliano Giorgi <massy@gandalf.sssup.it>
- * Luca Abeni <luca@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: tracks.c,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 Marco Dallera and Marco Fiocca
- *
- * 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
- *
- */
-
-/*
- * AUTO
- *
- * Another Unuseful Track simulatOr
- *
- * Authors: Marco Dallera
- * Marco Fiocca
- *
- */
-
-/* -------------- */
-/* Track loader */
-/* -------------- */
-
-#include "include/auto.h"
-#include "include/const.h"
-
-track track_list[TRACK_NUMBER];
-
-int track_init()
-{
- track demo1;
- track demo2;
- track brazil;
- track monaco;
-
- strcpy(demo1.name, "demo1.raw");
- demo1.pole_pos.x = 150;
- demo1.pole_pos.y = 35;
- demo1.pole_orient = 0.0;
- demo1.lap = CLOCK;
- demo1.selected = 0;
-
- strcpy(demo2.name, "demo2.raw");
- demo2.pole_pos.x = 150;
- demo2.pole_pos.y = 30;
- demo2.pole_orient = 0.0;
- demo2.lap = CLOCK;
- demo2.selected = 0;
-
- strcpy(brazil.name, "brazil.raw");
- brazil.pole_pos.x = 140;
- brazil.pole_pos.y = 185;
- brazil.pole_orient = 225.0;
- brazil.lap = ANTICLOCK;
- brazil.selected = 0;
-
- strcpy(monaco.name, "monaco.raw");
- monaco.pole_pos.x = 35;
- monaco.pole_pos.y = 315;
- monaco.pole_orient = 85.0;
- monaco.lap = CLOCK;
- monaco.selected = 0;
-
- track_list[0] = demo1;
- track_list[1] = demo2;
- track_list[2] = brazil;
- track_list[3] = monaco;
-
- return 0;
-}
Index: tags/rel_0_5/auto/keyb.c
===================================================================
--- tags/rel_0_5/auto/keyb.c (revision 1657)
+++ tags/rel_0_5/auto/keyb.c (nonexistent)
@@ -1,105 +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>
- * Massimiliano Giorgi <massy@gandalf.sssup.it>
- * Luca Abeni <luca@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: keyb.c,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 Marco Dallera and Marco Fiocca
- *
- * 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
- *
- */
-
-/*
- * AUTO
- *
- * Another Unuseful Track simulatOr
- *
- * Authors: Marco Dallera
- * Marco Fiocca
- *
- */
-
-/* ------------------ */
-/* Keyboard handler */
-/* ------------------ */
-
-#include "include/auto.h"
-#include "include/const.h"
-
-
-void keyb_handler() {
- KEY_EVT k;
- keyb_set_map(itaMap);
-
- /* Exit keys: ENTER */
- k.flag = 0;
- k.scan = KEY_ENT;
- k.ascii = 13;
- keyb_hook(k, endfun);
-
- /* Creates a new HARD car */
- k.flag = 0;
- k.scan = KEY_H;
- k.ascii = 'h';
- keyb_hook(k, hard_car_create);
-
- /* Creates a new SOFT car */
- k.flag = 0;
- k.scan = KEY_S;
- k.ascii = 's';
- keyb_hook(k, soft_car_create);
-}
-
-
-void endfun(KEY_EVT *k)
-{
- grx_close();
- cprintf("Ctrl-Brk pressed! Ending...\n");
- sys_end();
-}
-
-
-void my_close(void *arg)
-{
- kern_printf("my_close\n");
-}
-
Index: tags/rel_0_5/auto/edfact.h
===================================================================
--- tags/rel_0_5/auto/edfact.h (revision 1657)
+++ tags/rel_0_5/auto/edfact.h (nonexistent)
@@ -1,152 +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>
- * Massimiliano Giorgi <massy@gandalf.sssup.it>
- * Luca Abeni <luca@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: edfact.h,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-
- This file contains the server EDFACT (EDF with pending activations)
-
- Title:
- EDFACT
-
- Task Models Accepted:
- HARD_TASK_MODEL - Hard Tasks (only Periodic)
- wcet field and mit field must be != 0. They are used to set the wcet
- and period of the tasks.
- periodicity field can be only PERIODIC
- drel field is ignored
-
- Guest Models Accepted:
- JOB_TASK_MODEL - a single guest task activation
- Identified by an absolute deadline and a period.
- period field is ignored
-
- Description:
- This module schedule his tasks following the classic EDF scheme.
- The task guarantee is based on the factor utilization approach.
- The tasks scheduled are only periodic.
- All the task are put in a queue and the scheduling is based on the
- deadline value.
- NO GUARANTEE is performed on guest tasks. The guarantee must be performed
- by the level that inserts guest tasks in the EDF level.
- If a task miss a deadline a counter is incremented.
- If a task exausts the wcet a counter is incremented
- No ZOMBIE support!!!!!!
-
- Exceptions raised:
- XUNVALID_GUEST XUNVALID_TASK
- some primitives are not implemented:
- task_sleep, task_delay, guest_endcycle, guest_sleep, guest_delay
-
- XACTIVATION
- If a task is actiated through task_activate or guest_activate more than
- one time
-
- Restrictions & special features:
- - This level doesn't manage the main task.
- - At init time we have to specify:
- . guarantee check
- (when all task are created the system will check that the task_set
- will not use more than the available bandwidth)
- - A function to return the used bandwidth of the level is provided.
- - Functions to return and reset the nact, wcet and dline miss counters
-
-**/
-
-/*
- * Copyright (C) 2001 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
- *
- */
-
-
-#ifndef __EDFACT_H__
-#define __EDFACT_H__
-
-#include <ll/ll.h>
-#include <kernel/config.h>
-#include <sys/types.h>
-#include <kernel/types.h>
-
-
-
-
-
-
-
-
-/*+ flags... +*/
-#define EDFACT_ENABLE_GUARANTEE 1 /*+ Task Guarantee enabled +*/
-#define EDFACT_ENABLE_ALL 1
-
-#define EDFACT_FAILED_GUARANTEE 8 /*+ used in the module, unsettabl
- in EDF_register_level... +*/
-
-
-
-
-
-#define ELASTIC_HARD_PCLASS 0x0600
-
-#define EDFACT_LEVELNAME "EDFACT base"
-#define EDFACT_LEVEL_CODE 166
-#define EDFACT_LEVEL_VERSION 1
-
-
-/*+ Registration function:
- int flags Options to be used in this level instance...
-
- returns the level number at which the module has been registered.
-+*/
-LEVEL EDFACT_register_level(int flags);
-
-/*+ Returns the used bandwidth of a level +*/
-bandwidth_t EDFACT_usedbandwidth(LEVEL l);
-
-/*+ returns respectively the number of dline, wcet or nact; -1 if error +*/
-int EDFACT_get_dline_miss(PID p);
-int EDFACT_get_wcet_miss(PID p);
-int EDFACT_get_nact(PID p);
-
-/*+ resets respectively the number of dline, wcet miss; -1 if error +*/
-int EDFACT_reset_dline_miss(PID p);
-int EDFACT_reset_wcet_miss(PID p);
-
-#endif
-
Index: tags/rel_0_5/auto/info.c
===================================================================
--- tags/rel_0_5/auto/info.c (revision 1657)
+++ tags/rel_0_5/auto/info.c (nonexistent)
@@ -1,154 +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>
- * Massimiliano Giorgi <massy@gandalf.sssup.it>
- * Luca Abeni <luca@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: info.c,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 Marco Dallera and Marco Fiocca
- *
- * 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
- *
- */
-
-/*
- * AUTO
- *
- * Another Unuseful Track simulatOr
- *
- * Authors: Marco Dallera
- * Marco Fiocca
- *
- */
-
-/* ------------------- */
-/* Information panel */
-/* ------------------- */
-
-#include "include/auto.h"
-#include "include/const.h"
-#include "include/utils.h"
-
-extern sem_t grx_mutex;
-
-/* ------------------------------------------------------------------ */
-
-void bar_display(point p1, int width, int height, int border, float var, float max, int color, char *name)
-{
- int background = BLACK;
- int amp = 0;
- point p2;
-
- p2.x = p1.x + width;
- p2.y = p1.y + height;
-
- sem_wait(&grx_mutex);
-
- grx_text(name, p1.x, p1.y + height + 3, color, background);
- grx_rect(p1.x - 1, p1.y - 1, p2.x + 1, p2.y + 1, border);
-
- grx_box(p1.x, p1.y, p2.x, p2.y, BLACK);
- amp = abs(round( var * (float)(p2.x - p1.x) / max ));
- grx_box(p1.x, p1.y, p1.x + amp, p2.y, color);
-
- sem_post(&grx_mutex);
-}
-
-/* ------------------------------------------------------------------ */
-
-void bidir_bar_display(point p1, int width, int height, int border, float var, float max, int color, char *name)
-{
- int background = BLACK;
- int amp = 0;
- point p2;
-
- p2.x = p1.x + width;
- p2.y = p1.y + height;
-
- sem_wait(&grx_mutex);
-
- grx_text(name, p1.x, p1.y + height + 3, color, background);
- grx_rect(p1.x - 1, p1.y - 1, p2.x + 1, p2.y + 1, border);
-
- grx_box(p1.x, p1.y, p2.x, p2.y, BLACK);
- amp = round( var * (float)((p2.x - p1.x)/2) / max );
- if (amp >= 0)
- grx_box((p1.x+p2.x)/2, p1.y, ((p1.x+p2.x)/2)+amp, p2.y, color);
- else
- grx_box((p1.x+p2.x)/2+amp, p1.y, ((p1.x+p2.x)/2), p2.y, color);
- grx_line((p1.x+p2.x)/2, p1.y-2, (p1.x+p2.x)/2, p2.y+2, border);
-
- sem_post(&grx_mutex);
-}
-
-/* ------------------------------------------------------------------ */
-
-void cmd_display()
-{
- point p1;
-
- p1.x = TRACK_X1;
- p1.y = TRACK_Y2+3;
-
- sem_wait(&grx_mutex);
- grx_rect(p1.x, p1.y, p1.x+CMD_WIDTH, p1.y+CMD_HEIGHT, BLUE);
- grx_rect(p1.x+1, p1.y+1, p1.x+CMD_WIDTH-1, p1.y+CMD_HEIGHT-1, CYAN);
- grx_rect(p1.x+2, p1.y+2, p1.x+CMD_WIDTH-2, p1.y+CMD_HEIGHT-2, LIGHTBLUE);
- grx_text("## Another Unuseful Track simulatOr ##",
- p1.x+8, p1.y+8, YELLOW, BLACK);
- grx_text("## -------------------------------- ##",
- p1.x+8, p1.y+16, YELLOW, BLACK);
- grx_text("Marco Dallera", p1.x+8, p1.y+24, GREEN, BLACK);
- grx_text("marchicchio@libero.it", p1.x+120, p1.y+24, GREEN, BLACK);
- grx_text("Marco Fiocca", p1.x+8, p1.y+32, GREEN, BLACK);
- grx_text("marqinho@tiscalinet.it", p1.x+120, p1.y+32, GREEN, BLACK);
-
- grx_text("Command keys ", p1.x+8, p1.y+48, LIGHTBLUE, BLACK);
- grx_text("------------------------", p1.x+8, p1.y+56, LIGHTBLUE, BLACK);
- grx_text("h create a HARD car", p1.x+8, p1.y+64, CYAN, BLACK);
- grx_text("s create a SOFT car", p1.x+8, p1.y+72, CYAN, BLACK);
- grx_text("ENTER exit to DOS", p1.x+8, p1.y+80, CYAN, BLACK);
-
- sem_post(&grx_mutex);
-
-}
-
-/* ------------------------------------------------------------------ */
-
Index: tags/rel_0_5/auto/makefile
===================================================================
--- tags/rel_0_5/auto/makefile (revision 1657)
+++ tags/rel_0_5/auto/makefile (nonexistent)
@@ -1,22 +0,0 @@
-#
-# Auto Makefile
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= auto auto2 auto3
-
-include $(BASE)/config/example.mk
-
-auto:
- make -f $(SUBMAKE) APP=auto INIT= OTHEROBJS="initfil1.o sensor.o control.o keyb.o info.o utils.o tracks.o jetctrl.o" SHARKOPT="__OLDCHAR__ __GRX__"
-
-auto2:
- make -f $(SUBMAKE) APP=auto INIT= OTHEROBJS="initfil2.o sensor.o control.o keyb.o info.o utils.o tracks.o jetctrl.o" SHARKOPT="__OLDCHAR__ __GRX__"
-
-auto3:
- make -f $(SUBMAKE) APP=auto INIT= OTHEROBJS="initfil3.o sensor.o control.o keyb.o info.o utils.o tracks.o edfact.o jetctrl.o" SHARKOPT="__OLDCHAR__ __GRX__"
-
Index: tags/rel_0_5/auto/utils.c
===================================================================
--- tags/rel_0_5/auto/utils.c (revision 1657)
+++ tags/rel_0_5/auto/utils.c (nonexistent)
@@ -1,131 +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>
- * Massimiliano Giorgi <massy@gandalf.sssup.it>
- * Luca Abeni <luca@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: utils.c,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 Marco Dallera and Marco Fiocca
- *
- * 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
- *
- */
-
-/*
- * AUTO
- *
- * Another Unuseful Track simulatOr
- *
- * Authors: Marco Dallera
- * Marco Fiocca
- *
- */
-
-#include "include/auto.h"
-#include "include/utils.h"
-#include <string.h>
-#include <stdlib.h>
-
-float rand_01()
-{
- return (((float)(rand()%20) / 100.0) + 0.8);
-}
-
-int rand_color()
-{
- return (rand()%16);
-}
-
-int round(float value)
-{
- return ((int)(value + 0.5));
-}
-
-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;
-}
-
-time int2time(int t)
-{
- time ts;
-
- ts.dec = t % 10;
- ts.sec = (t/10) % 60;
- ts.min = (int)(t / 600);
-
- return ts;
-}
-
-
-
-
-
-
-
-
-
-
-
Index: tags/rel_0_5/auto/include/auto.h
===================================================================
--- tags/rel_0_5/auto/include/auto.h (revision 1657)
+++ tags/rel_0_5/auto/include/auto.h (nonexistent)
@@ -1,188 +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>
- * Massimiliano Giorgi <massy@gandalf.sssup.it>
- * Luca Abeni <luca@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: auto.h,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 Marco Dallera and Marco Fiocca
- *
- * 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
- *
- */
-
-/*
- * AUTO
- *
- * Another Unuseful Track simulatOr
- *
- * Authors: Marco Dallera
- * Marco Fiocca
- *
- */
-
-/* ------------------- */
-/* Useful structures */
-/* ------------------- */
-
-#ifndef __CAR_H_
-
-#define __CAR_H_
-
-#include <modules/cabs.h>
-#include <kernel/func.h>
-#include <kernel/model.h>
-#include <kernel/types.h>
-#include <drivers/keyb.h>
-#include <drivers/glib.h>
-#include <semaphore.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "const.h"
-
-#define degree_to_rad(a) ((M_PI/180.0)*(a))
-#define rad_to_degree(a) ((180.0/M_PI)*(a))
-
-typedef struct {
- int x;
- int y;
-} point;
-
-typedef struct {
- float x,y;
-} point_f;
-
-typedef struct {
- float mod;
- float phase;
-} vector;
-
-typedef struct {
- point_f pos;
- float orient;
-} car_status;
-
-typedef struct {
- int left_border;
- int right_border;
- int distance;
- float curve;
- point opps_list[MAX_CAR_NUMBER];
- int opps_number;
- int collision;
- int flag;
-} road_info;
-
-typedef struct {
- int left,center,right;
-} road_strip;
-
-typedef struct {
- PID sensor_pid,control_pid;
- int number;
- char driver[MAX_DRIVER_NAME_LENGTH];
- float max_speed, min_acc, max_acc;
- float rage;
- CAB road_status_cab;
- CAB car_status_cab;
- int color;
-} car_params;
-
-typedef struct {
- char name[MAX_TRACK_NAME_LENGTH]; // il nome del file
- point pole_pos; // la posizione di partenza
- float pole_orient; // la direzione di partenza
- int lap; // il senso di marcia: CLOCK, ANTICLOCK
- int selected; // it's a flag marking the actually selected track
-} track;
-
-typedef struct {
- int min;
- int sec;
- int dec;
-} time;
-
-extern car_params cars[MAX_CAR_NUMBER];
-extern char track_img[TRACK_WIDTH*TRACK_HEIGHT];
-extern track track_list[TRACK_NUMBER];
-
-/* ---------------------------------------- */
-/* Functions definition */
-/* ---------------------------------------- */
-
-/* CABs R/W functions */
-int set_car_status(car_status, CAB); // sends the new status according to the control law
-car_status get_car_status(CAB); // reads car status from a CAB
-int set_road_info(road_info, CAB); // sends the new road informations
-road_info get_road_info(CAB); // reads road status values from a CAB
-
-/* Keyboard functions */
-void keyb_handler();
-void endfun(KEY_EVT *);
-void my_close(void *);
-
-/* Display functions */
-void bar_display(point p1, int width, int height, int border, float var, float max, int color, char *name);
-void bidir_bar_display(point p1, int width, int height, int border, float var, float max, int color, char *name);
-void cmd_display();
-
-/* Closing function */
-void byebye();
-void error_msg();
-
-/* Tasks */
-TASK sensor(); // Camera car task
-TASK control(); // Car controller task
-TASK manual(); // Manual driving task
-TASK actuator(); // Graphic drawing task
-TASK info(); // Car informations display task
-
-/* Tasks management */
-void hard_car_create();
-void soft_car_create();
-void killcar();
-
-/* Tracks management */
-int track_init();
-
-#endif
-
Index: tags/rel_0_5/auto/include/utils.h
===================================================================
--- tags/rel_0_5/auto/include/utils.h (revision 1657)
+++ tags/rel_0_5/auto/include/utils.h (nonexistent)
@@ -1,76 +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>
- * Massimiliano Giorgi <massy@gandalf.sssup.it>
- * Luca Abeni <luca@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: utils.h,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 Marco Dallera and Marco Fiocca
- *
- * 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
- *
- */
-
-/*
- * AUTO
- *
- * Another Unuseful Track simulatOr
- *
- * Authors: Marco Dallera
- * Marco Fiocca
- *
- */
-
-/* ------------------ */
-/* Useful functions */
-/* ------------------ */
-
-#ifndef __UTILS_H_
-
-#define __UTILS_H_
-
-float rand_01();
-int rand_color();
-int round(float value);
-char * itoa(int n, char *s);
-void reverse(char s[]);
-time int2time(int t);
-
-#endif
Index: tags/rel_0_5/auto/include/const.h
===================================================================
--- tags/rel_0_5/auto/include/const.h (revision 1657)
+++ tags/rel_0_5/auto/include/const.h (nonexistent)
@@ -1,141 +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>
- * Massimiliano Giorgi <massy@gandalf.sssup.it>
- * Luca Abeni <luca@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: const.h,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 Marco Dallera and Marco Fiocca
- *
- * 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
- *
- */
-
-/*
- * AUTO
- *
- * Another Unuseful Track simulatOr
- *
- * Authors: Marco Dallera
- * Marco Fiocca
- *
- */
-
-/* ------------------ */
-/* Useful constants */
-/* ------------------ */
-
-#ifndef __CONST_H_
-
-#define __CONST_H_
-
-/* Screen dimensions */
-#define SCREEN_WIDTH 800
-#define SCREEN_HEIGHT 600
-#define SCREEN_BIT_COLORS 8
-
-/* Visible area */
-#define TEL_WIDTH 50
-#define TEL_HEIGHT 50
-
-/* Car dimensions */
-#define CAR_WIDTH 12
-#define CAR_HEIGHT 12
-#define CAR_W 8
-#define CAR_H 10
-
-/* Track dimensions */
-#define TRACK_WIDTH 500
-#define TRACK_HEIGHT 500
-
-/* Track position */
-#define TRACK_X1 0
-#define TRACK_Y1 0
-#define TRACK_X2 TRACK_X1+TRACK_WIDTH-1
-#define TRACK_Y2 TRACK_Y1+TRACK_HEIGHT-1
-
-/* Max number of car on track */
-#define MAX_CAR_NUMBER 10
-#define DRIVERS_NUMBER 20
-#define MAX_DRIVER_NAME_LENGTH 20
-#define MAX_TRACK_NAME_LENGTH 20
-#define TRACK_NUMBER 4
-
-/* Lap direction */
-#define CLOCK 0
-#define ANTICLOCK 1
-
-/* Information display coords */
-#define CMD_WIDTH TRACK_WIDTH
-#define CMD_HEIGHT (SCREEN_HEIGHT-TRACK_HEIGHT-3)
-
-/* Car position limits */
-#define MIN_CAR_X (TRACK_X1 + CAR_WIDTH/2 + 4)
-#define MIN_CAR_Y (TRACK_Y1 + CAR_HEIGHT/2 + 4)
-#define MAX_CAR_X (TRACK_X2 - CAR_WIDTH/2 - 4)
-#define MAX_CAR_Y (TRACK_Y2 - CAR_HEIGHT/2 - 4)
-
-/* Road constants */
-#define LEFT_ONLY 10
-#define RIGHT_ONLY 11
-#define ROAD_OK 12
-#define NO_ROAD 13
-
-/* Collision constants */
-#define COLLISION_LEFT 20
-#define COLLISION_RIGHT 21
-#define COLLISION_BACK 22
-#define NO_COLL 0
-
-/* CAB constants */
-#define ROAD_MSG_DIM sizeof(road_info)
-#define ROAD_MSG_READER 4
-
-#define CAR_MSG_DIM sizeof(car_status)
-#define CAR_MSG_READER 5
-
-/* Tasks parameters */
-#define SENSOR_WCET 3000
-#define SENSOR_PERIOD 40000
-#define CONTROL_WCET 1000
-#define CONTROL_PERIOD 40000
-
-#endif
-
Index: tags/rel_0_5/auto/tracks/brazil.raw
===================================================================
--- tags/rel_0_5/auto/tracks/brazil.raw (revision 1657)
+++ tags/rel_0_5/auto/tracks/brazil.raw (nonexistent)
@@ -1,2 +0,0 @@
- -!"#
\ No newline at end of file
Index: tags/rel_0_5/auto/tracks/demo1.raw
===================================================================
--- tags/rel_0_5/auto/tracks/demo1.raw (revision 1657)
+++ tags/rel_0_5/auto/tracks/demo1.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/tracks/demo2.raw
===================================================================
--- tags/rel_0_5/auto/tracks/demo2.raw (revision 1657)
+++ tags/rel_0_5/auto/tracks/demo2.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/tracks/monaco.raw
===================================================================
--- tags/rel_0_5/auto/tracks/monaco.raw (revision 1657)
+++ tags/rel_0_5/auto/tracks/monaco.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/jetctrl.c
===================================================================
--- tags/rel_0_5/auto/jetctrl.c (revision 1657)
+++ tags/rel_0_5/auto/jetctrl.c (nonexistent)
@@ -1,155 +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.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-**/
-
-/*
- * 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
- *
- */
-
-/*
- * this file is directly derived from the demos/jumpball/jetctrl.c .
- * I just added this controls to check when the system will become overloaded
- */
-
-#define WCET_JETDUMMY 200
-#define PERIOD_JETDUMMY 100000
-#define DUMMY_PID 1
-
-#define JET_DUMMY_WIDTH (CMD_WIDTH-370)
-#define JET_DUMMY_HEIGHT (CMD_HEIGHT-40)
-
-/* the point (x, y) is the top left corner */
-#define JET_DUMMY_X (TRACK_X1+360)
-#define JET_DUMMY_Y (TRACK_Y2+32)
-
-// JetControl
-
-#include "semaphore.h"
-#include "include/const.h"
-#include "kernel/func.h"
-#include "drivers/glib.h"
-
-extern sem_t grx_mutex;
-
-/* useful colors... */
-int white;
-int black;
-extern int red;
-extern int lightgray;
-
-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;
-
- sem_wait(&grx_mutex);
- 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);
- sem_post(&grx_mutex);
-
- x = (x+1)%JET_DUMMY_WIDTH;
-
- task_endcycle();
- }
-}
-
-void init_jetcontrol(void)
-{
- SOFT_TASK_MODEL m4;
-
- PID p4;
-
- /* useful colors ... */
- white = WHITE;
- black = BLACK;
-
- /* scenario */
- sem_wait(&grx_mutex);
- grx_text("System load",
- JET_DUMMY_X+8, JET_DUMMY_Y-10, lightgray, black);
- grx_rect(JET_DUMMY_X-1, JET_DUMMY_Y-1,
- JET_DUMMY_X+JET_DUMMY_WIDTH, JET_DUMMY_Y+JET_DUMMY_HEIGHT+1, lightgray);
-
- grx_text("100%", JET_DUMMY_X-40, JET_DUMMY_Y, lightgray, black);
- grx_text(" 0%", JET_DUMMY_X-40, JET_DUMMY_Y+JET_DUMMY_HEIGHT-8, lightgray, black);
-
- grx_line(JET_DUMMY_X-1, JET_DUMMY_Y, JET_DUMMY_X-5, JET_DUMMY_Y, lightgray);
- grx_line(JET_DUMMY_X-1, JET_DUMMY_Y+JET_DUMMY_HEIGHT, JET_DUMMY_X-5, JET_DUMMY_Y+JET_DUMMY_HEIGHT, lightgray);
- sem_post(&grx_mutex);
-
- /* jetdummy task */
- soft_task_default_model(m4);
- soft_task_def_period(m4, PERIOD_JETDUMMY);
- soft_task_def_met(m4, WCET_JETDUMMY);
- soft_task_def_usemath(m4);
- p4 = task_create("jdmy", jetdummy_task, &m4, NULL);
- if (p4 == -1) {
- grx_close();
- perror("Could not create task <jetdummy>");
- sys_end();
- }
- task_activate(p4);
-}
-
Index: tags/rel_0_5/auto/cars/car10.raw
===================================================================
--- tags/rel_0_5/auto/cars/car10.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car10.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/fumo.raw
===================================================================
--- tags/rel_0_5/auto/cars/fumo.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/fumo.raw (nonexistent)
@@ -1 +0,0 @@
-!!!!!!!!!!!!!!!!!!!!!!
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/car11.raw
===================================================================
--- tags/rel_0_5/auto/cars/car11.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car11.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/car12.raw
===================================================================
--- tags/rel_0_5/auto/cars/car12.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car12.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/car13.raw
===================================================================
--- tags/rel_0_5/auto/cars/car13.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car13.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/car14.raw
===================================================================
--- tags/rel_0_5/auto/cars/car14.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car14.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/car15.raw
===================================================================
--- tags/rel_0_5/auto/cars/car15.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car15.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/car0.raw
===================================================================
--- tags/rel_0_5/auto/cars/car0.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car0.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/car1.raw
===================================================================
--- tags/rel_0_5/auto/cars/car1.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car1.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/car2.raw
===================================================================
--- tags/rel_0_5/auto/cars/car2.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car2.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/car3.raw
===================================================================
--- tags/rel_0_5/auto/cars/car3.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car3.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/car4.raw
===================================================================
--- tags/rel_0_5/auto/cars/car4.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car4.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/car5.raw
===================================================================
--- tags/rel_0_5/auto/cars/car5.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car5.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/car6.raw
===================================================================
--- tags/rel_0_5/auto/cars/car6.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car6.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/car7.raw
===================================================================
--- tags/rel_0_5/auto/cars/car7.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car7.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/boom.raw
===================================================================
--- tags/rel_0_5/auto/cars/boom.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/boom.raw (nonexistent)
@@ -1 +0,0 @@
-      
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/car8.raw
===================================================================
--- tags/rel_0_5/auto/cars/car8.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car8.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/cars/car9.raw
===================================================================
--- tags/rel_0_5/auto/cars/car9.raw (revision 1657)
+++ tags/rel_0_5/auto/cars/car9.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: tags/rel_0_5/auto/auto.c
===================================================================
--- tags/rel_0_5/auto/auto.c (revision 1657)
+++ tags/rel_0_5/auto/auto.c (nonexistent)
@@ -1,530 +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>
- * Massimiliano Giorgi <massy@gandalf.sssup.it>
- * Luca Abeni <luca@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: auto.c,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 Marco Dallera and Marco Fiocca
- *
- * 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
- *
- */
-
-/*
- * AUTO
- *
- * Another Unuseful Track simulatOr
- *
- * Authors: Marco Dallera
- * Marco Fiocca
- *
- */
-
-#include "include/auto.h"
-#include "include/const.h"
-#include "include/utils.h"
-
-int car_number;
-car_params cars[MAX_CAR_NUMBER];
-char drivers[DRIVERS_NUMBER][MAX_DRIVER_NAME_LENGTH] = {
- "M.Schumacher",
- "D.Coulthard",
- "R.Schumacher",
- "M.Hakkinen",
- "R.Barrichello",
- "J.P.Montoya",
- "E.Irvine",
- "J.Trulli",
- "H.Frentzen",
- "J.Villeneuve",
- "J.Alesi",
- "G.Fisichella",
- "O.Panis",
- "O.Wurz",
- "J.Button",
- "P.P.Diniz",
- "P.De La Rosa",
- "T.Marques",
- "R.Zonta",
- "G.Mazzacane"
-};
-
-extern char sprite[18][CAR_WIDTH*CAR_HEIGHT];
-
-/* Semaphores */
-sem_t grx_mutex;
-
-/* Useful colors */
-int red = rgb16(255, 0, 0);
-int green = rgb16( 0, 255, 0);
-int blue = rgb16( 0, 0, 255);
-int lightgray = rgb16(192, 192, 192);
-
-/* JetCTRL Initialization */
-void init_jetcontrol(void);
-
-/* -------------------------------------------------------*/
-
-/* --------------------- */
-/* Handling car status */
-/* --------------------- */
-
-int set_car_status(car_status cs, CAB cab_id) {
- char *msg;
-
- msg = cab_reserve(cab_id);
- memcpy(msg, &cs, CAR_MSG_DIM);
- return(cab_putmes(cab_id, msg));
-}
-
-car_status get_car_status(CAB cab_id) {
- char *msg;
- car_status status;
-
- msg = cab_getmes(cab_id);
- memcpy(&status, msg, CAR_MSG_DIM);
- cab_unget(cab_id, msg);
-
- return (status);
-}
-
-/* ---------------------------- */
-/* Handling road informations */
-/* ---------------------------- */
-
-int set_road_info(road_info info, CAB road_status_cab) {
- char *msg;
-
- msg = cab_reserve(road_status_cab);
- memcpy(msg, &info, ROAD_MSG_DIM);
- return(cab_putmes(road_status_cab, msg));
-}
-
-road_info get_road_info(CAB road_status_cab) {
- char *msg;
- road_info info;
-
- msg = cab_getmes(road_status_cab);
- memcpy(&info, msg, ROAD_MSG_DIM);
- cab_unget(road_status_cab, msg);
-
- return (info);
-}
-
-/* -------------------------------------------------------*/
-
-/* Closing function */
-void byebye()
-{
- grx_close();
-
- // we need clear to reposition the cursor in the right place after
- // going back from the graphical mode.
- clear();
-
- kern_printf("Race is over!\n");
-}
-
-/* -------------------------------------------------------*/
-
-/* ------------------- */
-/* Hard car creation */
-/* ------------------- */
-
-void hard_car_create() {
- car_params cp;
- HARD_TASK_MODEL sensor_m, control_m;
- PID sensor_pid, control_pid;
- TIME seed; /* used to init the random seed */
- int drv_ind;
-
- if (car_number >= MAX_CAR_NUMBER) return;
-
- /* Randomize!!!! */
- seed = sys_gettime(NULL);
- srand(seed);
-
- /* CAB creation */
- cp.road_status_cab = cab_create("road_cab", ROAD_MSG_DIM, ROAD_MSG_READER);
- cp.car_status_cab = cab_create("car_cab", CAR_MSG_DIM, CAR_MSG_READER);
-
- /* Car parameters initialization */
- cp.max_speed = rand_01();
- cp.min_acc = cp.max_speed;
- cp.max_acc = cp.max_speed;
- cp.rage = cp.max_speed;
- cp.color = 3+car_number;
- cp.number = car_number;
- drv_ind = DRIVERS_NUMBER-1 - (int)(((cp.rage-0.8+0.005) * (float)DRIVERS_NUMBER) / 0.2);
-
- /* Sets driver's name without duplications */
- strcpy(cp.driver, drivers[drv_ind]);
- while (!strcmp(cp.driver,"***"))
- strcpy(cp.driver, drivers[++drv_ind%DRIVERS_NUMBER]);
- strcpy(drivers[drv_ind],"***");
-
- cars[car_number] = cp;
-
- /* ------------ */
- /* Task Calls */
- /* ------------ */
-
- /* sensor task creation */
- hard_task_default_model(sensor_m);
-
- hard_task_def_arg(sensor_m, (void *)car_number);
- hard_task_def_wcet(sensor_m, SENSOR_WCET);
- hard_task_def_mit(sensor_m, SENSOR_PERIOD);
- hard_task_def_usemath(sensor_m);
- sensor_pid = task_create("camera", sensor, &sensor_m, NULL);
- if(sensor_pid == -1)
- sys_end();
-
- /* control task creation */
- hard_task_default_model(control_m);
- hard_task_def_arg(control_m, (void *)car_number);
- hard_task_def_wcet(control_m, CONTROL_WCET);
- hard_task_def_mit(control_m, CONTROL_PERIOD);
- hard_task_def_usemath(control_m);
- control_pid = task_create("controller", control, &control_m, NULL);
- if(control_pid == -1)
- sys_end();
-
- cars[car_number].sensor_pid = sensor_pid;
- cars[car_number].control_pid = control_pid;
- car_number++; // increases cars number
-
- task_activate(sensor_pid);
- task_activate(control_pid);
-}
-
-/* -------------------------------------------------------*/
-
-/* ------------------- */
-/* Soft car creation */
-/* ------------------- */
-
-void soft_car_create() {
- car_params cp;
- SOFT_TASK_MODEL sensor_m, control_m;
- PID sensor_pid, control_pid;
- TIME seed; /* used to init the random seed */
- int drv_ind;
-
- if (car_number >= MAX_CAR_NUMBER) return;
-
- /* Randomize!!!! */
- seed = sys_gettime(NULL);
- srand(seed);
-
- /* CAB creation */
- cp.road_status_cab = cab_create("road_cab", ROAD_MSG_DIM, ROAD_MSG_READER);
- cp.car_status_cab = cab_create("car_cab", CAR_MSG_DIM, CAR_MSG_READER);
-
- /* Car parameters initialization */
- cp.max_speed = rand_01();
- cp.min_acc = cp.max_speed;
- cp.max_acc = cp.max_speed;
- cp.rage = cp.max_speed;
- cp.color = 8+car_number;
- cp.number = car_number;
- drv_ind = DRIVERS_NUMBER-1 - (int)(((cp.rage-0.8+0.005) * (float)DRIVERS_NUMBER) / 0.2);
-
- /* Sets driver's name without duplications */
- strcpy(cp.driver, drivers[drv_ind]);
- while (!strcmp(cp.driver,"***"))
- strcpy(cp.driver, drivers[++drv_ind%DRIVERS_NUMBER]);
- strcpy(drivers[drv_ind],"***");
- cars[car_number] = cp;
-
- /* ------------ */
- /* Task Calls */
- /* ------------ */
-
- /* sensor task creation */
- soft_task_default_model(sensor_m);
-
- soft_task_def_arg(sensor_m, (void *)car_number);
- soft_task_def_met(sensor_m, SENSOR_WCET);
- soft_task_def_period(sensor_m, SENSOR_PERIOD);
- soft_task_def_usemath(sensor_m);
- sensor_pid = task_create("camera", sensor, &sensor_m, NULL);
- if(sensor_pid == -1)
- sys_end();
-
- /* control task creation */
- soft_task_default_model(control_m);
- soft_task_def_arg(control_m, (void *)car_number);
- soft_task_def_met(control_m, CONTROL_WCET);
- soft_task_def_period(control_m, CONTROL_PERIOD);
- soft_task_def_usemath(control_m);
- control_pid = task_create("controller", control, &control_m, NULL);
- if(control_pid == -1)
- sys_end();
-
- cars[car_number].sensor_pid = sensor_pid;
- cars[car_number].control_pid = control_pid;
- car_number++; // increases cars number
-
- task_activate(sensor_pid);
- task_activate(control_pid);
-}
-
-/* -------------------------------------------------------*/
-
-/* ------------------- */
-/* The main function */
-/* ------------------- */
-
-int main(int argc, char **argv) {
- TIME seed; /* used to init the random seed */
-
- if (MAX_CAB < 30) {
- cprintf("The application needs at least 30 CABS.\n"
- "Please set the MAX_CAB #define to 30 or more...\n"
- "...(see include/modules/cabs.h)\n");
- sys_end();
- }
-
- /* Set the closing function */
- sys_atrunlevel(byebye, NULL, RUNLEVEL_BEFORE_EXIT);
-
- /* Keyboard handling */
- keyb_handler();
- kern_printf("KEYBOARD initialized...\n");
-
- /* Graphics mutex */
- sem_init(&grx_mutex, 0, 1);
-
- /* Graphics init */
- grx_init();
- grx_open(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BIT_COLORS);
-
- /* Track drawing */
- sem_wait(&grx_mutex);
- grx_setcolor(46,0,0,0);
- grx_setcolor(43,255,255,255);
- grx_setcolor(26,255,74,33);
- grx_setcolor(27,255,255,255);
- grx_setcolor(1,8,8,8);
- grx_setcolor(3,255,0,0);
- grx_setcolor(28,255,50,0);
- grx_setcolor(29,255,90,0);
- grx_setcolor(30,255,130,0);
- grx_setcolor(31,255,170,0);
- grx_setcolor(32,255,210,0);
- grx_setcolor(33,48,48,48);
-
- grx_putimage(TRACK_X1, TRACK_Y1, TRACK_X2, TRACK_Y2, track_img);
- sem_post(&grx_mutex);
-
- /* Command and info display */
- cmd_display();
-
- /* JetCTRL Initialization */
- init_jetcontrol();
-
- /* Randomize!!!! */
- seed = sys_gettime(NULL);
- srand(seed);
-
- car_number = 0;
-
- /* ------------ */
- /* Task Calls */
- /* ------------ */
-
- hard_car_create();
-
- return 0;
-}
-
-/* -------------------------------------------------------*/
-
-void read_track(int i)
-{
- DOS_FILE *f; // DOS file descriptor
- int file_length;
- int index;
- char filename[100];
- int err; // Error code
-
- /* Init track_list */
- track_init();
-
- /* Set the selected track from track_list */
- if (i < TRACK_NUMBER)
- index = i;
- else
- index = 0;
- cprintf("Selected index = %d\n", index);
-
- strcpy(filename, strcat("tracks/", track_list[index].name));
- cprintf("File to open = %s\n", filename);
- track_list[index].selected = 1;
-
- /* open the DOS file for reading (you can specify only "r" or "w") */
- f = DOS_fopen(filename,"r");
-
- /* check for open errors */
- if (!f) {
- err = DOS_error(); // error!!
-
- /* note that if you call DOS_error() here, it return 0!!! */
- cprintf("Error %d opening %s...\n", err, filename);
- file_length = 0;
- byebye();
- return;
- }
-
- /* read track file */
- file_length = DOS_fread(&track_img, 1, TRACK_WIDTH*TRACK_HEIGHT, f);
-
- /* check for errors */
- err = DOS_error();
-
- cprintf("Read %d bytes from %s...\n", file_length, filename);
-
- if (err) {
- cprintf("Error %d reading %s...\n", err, filename);
- file_length = 0;
- /* there is not return because I want to close the file! */
- }
-
- /* Close the file */
- cprintf("Closing file %s...\n", filename);
- DOS_fclose(f);
- cprintf("File %s closed successfully!\n", filename);
-
-}
-
-/* -------------------------------------------------------*/
-
-void read_sprites()
-{
- /* DOS file descriptor */
- DOS_FILE *f;
- int myfilebuf_length,i;
- char filename[100];
-
- /* Error code */
- int err;
- i=0;
-
- for ( i=0; i < 16; i++) {
- sprintf(filename,"cars/car%d.raw",i);
- f = DOS_fopen(filename,"r");
-
- // check for open errors
- if (!f) {
- // error!!
- err = DOS_error();
-
- // note that if you call DOS_error() here, it return 0!!!
- cprintf("Error %d opening %s...\n", err, filename);
- myfilebuf_length = 0;
- return;
- }
-
- // read from file
- myfilebuf_length = DOS_fread(&sprite[i][0],1,CAR_WIDTH*CAR_HEIGHT,f);
-
- // check for errors
- err = DOS_error();
-
- cprintf("Read %d bytes from %s...\n", myfilebuf_length, filename);
-
- if (err) {
- cprintf("Error %d reading %s...\n", err, filename);
- myfilebuf_length = 0;
- // there is not return because I want to close the file!
- }
-
- // Close the file
- DOS_fclose(f);
- }
-
- f = DOS_fopen("cars/boom.raw","r");
- if (!f) {
- err = DOS_error();
-
- cprintf("Error %d opening boom.raw...\n", err);
- myfilebuf_length = 0;
- return;
- }
-
- myfilebuf_length = DOS_fread(&sprite[16][0],1,CAR_WIDTH*CAR_HEIGHT,f);
-
- err = DOS_error();
-
- cprintf("Read %d bytes from boom.raw...\n", myfilebuf_length);
-
- if (err) {
- cprintf("Error %d reading boom.raw...\n", err);
- myfilebuf_length = 0;
- }
-
- DOS_fclose(f);
-
- f = DOS_fopen("cars/fumo.raw","r");
- if (!f) {
- err = DOS_error();
-
- cprintf("Error %d opening fumo.raw...\n", err);
- myfilebuf_length = 0;
- return;
- }
-
- myfilebuf_length = DOS_fread(&sprite[17][0],1,CAR_WIDTH*CAR_HEIGHT,f);
-
- err = DOS_error();
-
- cprintf("Read %d bytes from fumo.raw...\n", myfilebuf_length);
-
- if (err) {
- cprintf("Error %d reading fumo.raw...\n", err);
- myfilebuf_length = 0;
- }
-
- DOS_fclose(f);
-
-}
-
Index: tags/rel_0_5/auto/sensor.c
===================================================================
--- tags/rel_0_5/auto/sensor.c (revision 1657)
+++ tags/rel_0_5/auto/sensor.c (nonexistent)
@@ -1,650 +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>
- * Massimiliano Giorgi <massy@gandalf.sssup.it>
- * Luca Abeni <luca@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: sensor.c,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 Marco Dallera and Marco Fiocca
- *
- * 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
- *
- */
-
-/*
- * AUTO
- *
- * Another Unuseful Track simulatOr
- *
- * Authors: Marco Dallera
- * Marco Fiocca
- *
- */
-
-/* ------------ */
-/* Camera car */
-/* ------------ */
-
-#include "include/auto.h"
-#include "include/const.h"
-#include "include/utils.h"
-#include <drivers/glib.h>
-
-#define RADIUS 1
-#define TOLL_FACTOR 4.0
-#define MIN_DIFF 3
-#define ROAD_COLOR 27
-#define OFFROAD_COLOR 0
-#define DEBUG_COLOR GREEN
-#define OUT_OF_TRACK 230
-#define STRIP_DEFAULT TEL_WIDTH+1
-
-extern sem_t grx_mutex;
-extern car_params cars[MAX_CAR_NUMBER];
-
-void scanline(point_f *buffer, float x1, float y1, float x2, float y2, int factor);
-void get_camera_car(BYTE *buffer, car_status status);
-int find_track(BYTE *image, road_info *info);
-int find_opps(BYTE *image, road_info *info);
-void find_collision(BYTE *image, road_info *info, car_status status);
-
-/* ----------------------------------------------------------------- */
-
-TASK sensor(int index) {
- car_status actual_car_status; // the actual car state
- road_info actual_road_info; // the actual road informations
- BYTE image[TEL_WIDTH*TEL_HEIGHT]; // buffer contenente la visione della telecamera ruotata
-
- point sq1, sq2;
- point im1, im2;
-
- CAB road_status_cab = cars[index].road_status_cab;
- CAB car_status_cab = cars[index].car_status_cab;
-
- // Draws display squares
- sq1.x = TRACK_X1 + TRACK_WIDTH + TEL_HEIGHT;
- sq1.y = TEL_HEIGHT*index + 1 + index;
- sq2.x = sq1.x + TEL_WIDTH + 1;
- sq2.y = sq1.y + TEL_HEIGHT + 1;
-
- // Sets viewer coords
- im1.x = sq1.x + 1;
- im1.y = sq1.y + 1;
- im2.x = im1.x + TEL_WIDTH - 1;
- im2.y = im1.y + TEL_HEIGHT - 1;
-
- // Inizializza il cab della strada
- actual_road_info.left_border = TEL_WIDTH/2;
- actual_road_info.right_border = TEL_WIDTH/2;
- actual_road_info.distance = TEL_HEIGHT;
- actual_road_info.curve = 0.0;
- actual_road_info.opps_number = 0;
- actual_road_info.flag = ROAD_OK;
- actual_road_info.collision = NO_COLL;
- set_road_info(actual_road_info, road_status_cab);
-
- task_endcycle();
-
- while(1) {
- /* reads car informations */
- actual_car_status = get_car_status(car_status_cab);
-
- /* implementazione riconoscimento strada (sti cazzi!!!) */
- get_camera_car(image, actual_car_status);
- find_track(image, &actual_road_info);
- find_opps(image, &actual_road_info);
- find_collision(image, &actual_road_info, actual_car_status);
-
- sem_wait(&grx_mutex);
- grx_rect(sq1.x, sq1.y, sq2.x, sq2.y, cars[index].color);
- grx_putimage(im1.x, im1.y, im2.x, im2.y, image);
- sem_post(&grx_mutex);
-
- /* sends informations to control task */
- set_road_info(actual_road_info, road_status_cab);
- task_endcycle();
- }
-
-}
-
-/* ----------------------------------------------------------------- */
-
-void find_collision(BYTE *image, road_info *info, car_status status)
-{
- point_f lt,rt,lb,rb,ct;
- /* the lines used to scan the quadrilate */
- point_f height_line[CAR_HEIGHT];
- int i;
- BYTE pix;
-
- info->collision = NO_COLL;
-
- ct.x = status.pos.x + (float)(CAR_HEIGHT/2 + 1) * cos(degree_to_rad(status.orient));
- ct.y = status.pos.y - (float)(CAR_WIDTH/2 + 1) * sin(degree_to_rad(status.orient));
-
- lb.x = ct.x - (float)(CAR_WIDTH/2.0) * cos(degree_to_rad(90-status.orient));
- rb.x = ct.x + (float)(CAR_WIDTH/2.0) * cos(degree_to_rad(90-status.orient));
- lt.x = lb.x - (float)(CAR_HEIGHT) * cos(degree_to_rad(status.orient));
- rt.x = rb.x - (float)(CAR_HEIGHT) * cos(degree_to_rad(status.orient));
-
- lb.y = ct.y - (float)(CAR_WIDTH/2.0) * sin(degree_to_rad(90-status.orient));
- rb.y = ct.y + (float)(CAR_WIDTH/2.0) * sin(degree_to_rad(90-status.orient));
- lt.y = lb.y + (float)(CAR_HEIGHT) * sin(degree_to_rad(status.orient));
- rt.y = rb.y + (float)(CAR_HEIGHT) * sin(degree_to_rad(status.orient));
-
- sem_wait(&grx_mutex);
- scanline(height_line,rb.x,rb.y,rt.x,rt.y,CAR_HEIGHT);
- for (i=0; i < CAR_HEIGHT; i++) {
- pix = grx_getpixel(round(height_line[i].x),round(height_line[i].y));
- if (pix != OFFROAD_COLOR && pix != ROAD_COLOR)
- info->collision = COLLISION_RIGHT;
- }
- scanline(height_line,lb.x,lb.y,lt.x,lt.y,CAR_HEIGHT);
- for (i=0; i < CAR_HEIGHT; i++) {
- pix = grx_getpixel(round(height_line[i].x),round(height_line[i].y));
- if (pix != OFFROAD_COLOR && pix != ROAD_COLOR)
- info->collision = COLLISION_LEFT;
- }
- sem_post(&grx_mutex);
-
-}
-
-/* ----------------------------------------------------------------- */
-
-/* Puts in a buffer the image viewed from the camera according to the car status */
-void get_camera_car(BYTE *buffer, car_status status) {
- /*
- * lt ------ rt
- * | |
- * | |
- * lb --ct-- rb
- */
- point_f lt,rt,lb,rb,ct;
- /* the lines used to scan the quadrilate */
- point_f width_line[TEL_WIDTH];
- point_f height_line[TEL_HEIGHT];
- int i,j;
- int tmpx,tmpy,tx,ty;
- float x,y;
- BYTE *row;
-
- ct.x = status.pos.x + (float)(CAR_WIDTH/2 + 1) * cos(degree_to_rad(status.orient));
- ct.y = status.pos.y - (float)(CAR_WIDTH/2 + 1) * sin(degree_to_rad(status.orient));
-
- /* for now the visual starts from the center of the car */
- lb.x = ct.x - (float)(TEL_WIDTH/2.0) * cos(degree_to_rad(90-status.orient));
- rb.x = ct.x + (float)(TEL_WIDTH/2.0) * cos(degree_to_rad(90-status.orient));
- lt.x = lb.x + (float)(TEL_HEIGHT) * cos(degree_to_rad(status.orient));
- rt.x = rb.x + (float)(TEL_HEIGHT) * cos(degree_to_rad(status.orient));
-
- lb.y = ct.y - (float)(TEL_WIDTH/2.0) * sin(degree_to_rad(90-status.orient));
- rb.y = ct.y + (float)(TEL_WIDTH/2.0) * sin(degree_to_rad(90-status.orient));
- lt.y = lb.y - (float)(TEL_HEIGHT) * sin(degree_to_rad(status.orient));
- rt.y = rb.y - (float)(TEL_HEIGHT) * sin(degree_to_rad(status.orient));
-
- /* scan only 2 sense thanks to parallelism */
- /* ^ <-(height)
- * ! lt
- * ! |
- * ! |
- * ! lb ------ rb )
- * 0 -------------> <-(width
- */
- /* the width_line coordinates are relative, so in the for cycle
- they are summarized to absolute height_line values */
- scanline(width_line,0,0,rb.x - lb.x,rb.y - lb.y,TEL_WIDTH);
- scanline(height_line,lb.x,lb.y,lt.x,lt.y,TEL_HEIGHT);
-
- /* First fill row TEL_HEIGHT-1 of image and so on until row 0 */
- sem_wait(&grx_mutex);
- for (i=0; i < TEL_HEIGHT; i++) {
- x = height_line[i].x;
- y = height_line[i].y;
- row = &buffer[TEL_WIDTH * (TEL_HEIGHT-1-i)];
- for (j=0; j < TEL_WIDTH; j++) {
- tmpx = round(x + width_line[j].x);
- tmpy = round(y + width_line[j].y);
-
- // Test rispetto ai bordi
- if (tmpx >= 0 && tmpx < SCREEN_WIDTH && tmpy >= 0 && tmpy < SCREEN_HEIGHT) {
- tx = tmpx - TRACK_X1-1;
- ty = tmpy - TRACK_Y1-1;
- if (tx >= 0 && tx < TRACK_WIDTH && ty >= 0 && ty < TRACK_HEIGHT)
- row[j] = grx_getpixel(tmpx,tmpy);
- else
- row[j] = OUT_OF_TRACK;
- } else {
- row[j] = OUT_OF_TRACK;
- }
- }
- }
- sem_post(&grx_mutex);
-}
-
-/* ----------------------------------------------------------------- */
-
-void scanline(point_f *buffer, float x1, float y1, float x2, float y2, int factor) {
- int i;
- float x,y;
- float xstep,ystep;
-
- xstep = (x2 - x1) / factor;
- ystep = (y2 - y1) / factor;
-
- // Start scan at <x1, y1>
- x = x1;
- y = y1;
-
- for (i = 0; i < factor; i++) {
- buffer[i].x = x;
- buffer[i].y = y;
- x += xstep;
- y += ystep;
- }
-}
-
-/* ----------------------------------------------------------------- */
-
-/*
- * Approssima la curva quando non è più possibile farlo con la scansione
- * orizzontale
- * - image
- * - index l'indice da cui cominciare la ricerca della curva
- * - distance la distanza dalla curva
- */
-float approx_curve(BYTE *image, int index, int distance, int d_center, road_strip *strips) {
- BYTE *p,tmp;
- int i,j,k,ctrl=0;
- point ms_center,ct;
-
- // Decide se la curva e' verso sinistra o verso destra
- p = &image[(TEL_HEIGHT - index - 1) * TEL_WIDTH];
-
- ms_center.x = strips[index-1].left;
- for (i = 0; i < min(3,strips[index-1].left); i++) {
- // La curva è a destra
- tmp = *(p + round(ms_center.x) - i);
- if (tmp != ROAD_COLOR) {
- ms_center.x = strips[index-1].right;
- break;
- }
- }
-
- p += round(ms_center.x);
- // Scandisce la colonna fino alla fine della strada
- for (i = index; i < TEL_HEIGHT; i++, p -= TEL_WIDTH) {
- if (*p != ROAD_COLOR) break;
- }
-
- // Imposta il nuovo max_scost empirico
- ms_center.y = (i-1 + index) / 2;
-
- // i-1 è l'indice dell'ultima riga bianca
- p = &image[(TEL_HEIGHT - (i-1) - 1) * TEL_WIDTH + round(ms_center.x)];
- // scandisce da destra a sinistra
- if (round(ms_center.x) > 0) {
- for (j = 0; j < (round(ms_center.x) - strips[index-1].left); j++, p--) {
- if (*p != ROAD_COLOR) break;
- // scandisce dall'alto in basso finchè non trova nero
- for (k = i-1; k > index; k--) {
- tmp = *(p + (i-1-k)*TEL_WIDTH);
- if (tmp != ROAD_COLOR) {
- ms_center.y = (k + index) / 2;
- ctrl = 1;
- break;
- }
- }
- if (ctrl) break;
- }
- ct.x = ms_center.x - j/2;
- ct.y = ms_center.y;
- } else {
- // scandisce da sinistra a destra
- for (j = 0; j < (strips[index-1].right - round(ms_center.x)); j++, p++) {
- if (*p != ROAD_COLOR) break;
- // scandisce dall'alto in basso finchè non trova nero
- for (k = i-1; k > index; k--) {
- tmp = *(p + (i-1-k)*TEL_WIDTH);
- if (tmp != ROAD_COLOR) {
- ms_center.y = (k + index) / 2;
- ctrl = 1;
- break;
- }
- }
- if (ctrl) break;
- }
- ct.x = ms_center.x + j/2;
- ct.y = ms_center.y;
- }
-
- return rad_to_degree(atan2((double)(ct.y - distance),(double)(ct.x - d_center)));
-}
-
-/* ----------------------------------------------------------------- */
-
-int find_distance(road_strip *strips, int max_scost, int rett_tol) {
- int i, distance;
- int center_car = TEL_WIDTH/2;
-
- // La distanza non puo' essere maggiore del max_scost
- distance = max_scost;
-
- for (i=1; i < max_scost; i++) {
- // Calcola la distanza dalla curva
- if (abs(strips[i].center - center_car) > rett_tol) {
- distance = i;
- break;
- }
- }
- return distance;
-}
-
-/* ----------------------------------------------------------------- */
-
-/* Scandisce la linea row e inserisce nella strip index le informazioni.
- * Ritorna 1 se trova entrambi i bordi, altrimenti 0
- */
-int scan_strip(BYTE *row, int index, road_strip *strips) {
- // Tiene conto della posizione dei bordi precedenti per trattare
- // meglio il caso di curve molto strette, dove possono esistere
- // 2 bordi destri o sinistri
-
- // Per evitare problemi nei casi in cui siano possibili 2
- // bordi destri o sinistri
- int lfound = 0;
- int rfound = 0;
- int center_car = TEL_WIDTH/2;
- int i;
-
- // Parte dal secondo pixel e finisce al penultimo
- for(i=1; i < (TEL_WIDTH-1); i++) {
- // Se trova la strada controlla se si tratta di bordo
- // destro o sinistro
- if (row[i] == ROAD_COLOR) {
- // bordo sinistro
- if (row[i - 1] != ROAD_COLOR) {
- // Se ho già trovato questo tipo di bordo cerco
- // quello + plausibile ...
- if (lfound) {
- // Test sulla striscia precedente
- if (index > 0) {
- if (abs(i - strips[index-1].left) <
- abs(strips[index].left - strips[index-1].left))
- strips[index].left = i;
- } else {
- // Test sul centro della macchina
- if (abs(i - center_car) < abs(strips[0].left - center_car))
- strips[index].left = i;
- }
- lfound++;
- } else {
- // ... altrimenti lo inizializzo
- strips[index].left = i;
- lfound = 1;
- }
- // bordo destro
- } else if ((row[i + 1] != ROAD_COLOR) && lfound) {
- // Se ho già trovato questo tipo di bordo cerco
- // quello + plausibile ...
- if (rfound) {
- // Test sulla striscia precedente
- if (index > 0) {
- if (abs(i - strips[index-1].right) <
- abs(strips[index].right - strips[index-1].right))
- strips[index].right = i;
- } else {
- // Test sul centro della macchina
- if (abs(i - center_car) < abs(strips[0].right - center_car))
- strips[index].right = i;
- }
- rfound++;
- } else {
- // ... altrimenti lo inizializzo
- strips[index].right = i;
- rfound = 1;
- }
- }
- }
- }
-
- // Calcola il centro della strada se trova i bordi
- if (lfound && rfound)
- strips[index].center = (strips[index].left + strips[index].right) / 2;
-
- return (lfound && rfound);
-}
-
-/* ----------------------------------------------------------------- */
-
-void where_am_i(BYTE *row, road_strip strip, road_info *info) {
- int i;
- int lfound = 0;
- int rfound = 0;
- int car_center = TEL_WIDTH/2;
-
- for(i=1; i < (TEL_WIDTH-1); i++) {
- // Se trova la strada controlla se si tratta di bordo
- // destro o sinistro
- if (row[i] == ROAD_COLOR) {
- // bordo sinistro
- if (row[i - 1] != ROAD_COLOR) {
- strip.left = i;
- lfound = 1;
- break;
- } else if (row[i + 1] != ROAD_COLOR) {
- strip.right = i;
- rfound = 1;
- break;
- }
- }
- }
-
- if (lfound && rfound) {
- info->flag = ROAD_OK;
- }
- else if (lfound && !rfound) info->flag = LEFT_ONLY;
- else if (!lfound && rfound) info->flag = RIGHT_ONLY;
- else {
- if (row[car_center] == OFFROAD_COLOR) info->flag = NO_ROAD;
- else info->flag = ROAD_OK;
- }
- info->left_border = car_center - strip.left;
- info->right_border = strip.right - car_center;
-}
-
-/* ----------------------------------------------------------------- */
-
-/* Analizza l'immagine vista dalla telecamera inserendo le informazioni
- * necessarie in info, ovvero la distanza dai bordi destro e sinistro,
- * la distanza dalla prossima curva e il suo angolo di curvatura.
- * Per il momento ritorna -1 se non riesce a trovare entrambi i bordi della
- * strada; in futuro gestiremo anche questa situazione.
- */
-int find_track(BYTE *image, road_info *info) {
- // vettore contenente le informazioni su ogni striscia
- road_strip strips[TEL_HEIGHT];
- BYTE *row;
- int car_center = TEL_WIDTH/2;
- int max_scost=0;
- int once_scost=0;
- int j, rett_tol=0;
-
- info->flag = ROAD_OK;
-
- strips[0].left = STRIP_DEFAULT;
- strips[0].right = STRIP_DEFAULT;
- /* Tratta in modo personalizzato il primo tratto di strada per
- inizializzare alcune variabili e per capire situazioni particolari */
- row = &image[(TEL_HEIGHT - 1)*TEL_WIDTH];
- // Se trova i bordi ...
- if (scan_strip(row,0,strips)) {
- // ... calcola i bordi della strada e ...
- info->left_border = car_center - strips[0].left;
- info->right_border = strips[0].right - car_center;
- // ... inizializza la tolleranza per il rettilineo.
- rett_tol = (strips[0].right - strips[0].left) / TOLL_FACTOR;
- } else {
- // Se non trova il bordo ...
- // Mi sono perso, cercami la strada
- where_am_i(row,strips[0],info);
- return 1;
- }
-
- /* Ora controlla le altre strisce della strada */
-
- for(j=1; j < TEL_HEIGHT ; j++) {
- row = &image[(TEL_HEIGHT - j - 1)*TEL_WIDTH];
- // Se trova i bordi ...
- if (scan_strip(row, j, strips)) {
- // ... aggiorna l'indice di max scostamento.
- if (abs(strips[j].center - car_center) >
- abs(strips[max_scost].center - car_center)
- && abs(strips[j].center - car_center) > rett_tol) {
-
- max_scost = j;
- once_scost=1; // ha trovato almeno un max scost
- }
- } else {
- // Se max_scost non è mai stato settato, prendo il max
- if (!once_scost) {
- max_scost = j-1;
- once_scost = 1;
- }
-
- // se la distanza e il max_scost sono troppo vicini approssima la curva
- info->distance = find_distance(strips, max_scost, rett_tol);
- if ((max_scost - info->distance) < MIN_DIFF) {
- info->curve = approx_curve(image, j, info->distance,
- strips[info->distance].center,strips) - 90.0;
- return 1;
- }
- break;
- }
- }
-
- // Se max_scost non è mai stato settato, prendo il max
- if (!once_scost) max_scost = TEL_HEIGHT-1;
- max_scost = min(max_scost,TEL_HEIGHT-1);
-
- info->distance = find_distance(strips,max_scost,rett_tol);
-
- // calcola l'angolo di curvatura solo se il conto e' attendibile
- if ((info->distance < (TEL_HEIGHT*0.9)) &&
- ((max_scost - info->distance) >= MIN_DIFF))
- info->curve = rad_to_degree(atan2((double)(max_scost - info->distance),
- (double)(strips[max_scost].center - strips[info->distance].center)));
- else {
- // se i conti sono empirici, si guarda la posizione dei due centri
- if (strips[max_scost].center > strips[info->distance].center)
- info->curve = 88.0;
- else if (strips[max_scost].center < strips[info->distance].center)
- info->curve = 92.0;
- else
- info->curve = 90.0;
- }
- info->curve -= 90.0;
- return 0;
-}
-
-/* ----------------------------------------------------------------- */
-
-int find_opps(BYTE *image, road_info *info)
-{
- int i, j;
- int l_limit, r_limit; // the opposite empiric limits
- BYTE *row;
- int car_center = TEL_WIDTH/2;
- int opps_number = 0;
-
- // by default it needs to scan the entire row
- l_limit = TEL_WIDTH - 1;
- r_limit = 0;
-
- // Scans one row at a time
- for(j=1; j<TEL_HEIGHT; j++) {
- row = &image[(TEL_HEIGHT - j - 1) * TEL_WIDTH];
-
- // if some of the previous row has been identified as a car...
- if (opps_number > 0 &&
- j < (info->opps_list[opps_number - 1].y + CAR_HEIGHT + 1)) {
- // excludes CAR_HEIGHT lines from the bottom if the car
- l_limit = (car_center + info->opps_list[opps_number - 1].x) - CAR_WIDTH;
- r_limit = (car_center + info->opps_list[opps_number - 1].x) + CAR_WIDTH;
- }
- else {
- // it needs to scan the entire row
- l_limit = TEL_WIDTH - 1;
- r_limit = 0;
- }
-
- // Scans the current row
- for (i=0; i<TEL_WIDTH; i++) {
- if( (i < l_limit || i > r_limit) &&
- row[i] != ROAD_COLOR && row[i] != OFFROAD_COLOR &&
- row[i] != DEBUG_COLOR && row[i] != OUT_OF_TRACK) {
- // there is an opponent car!!
- // stores its position
- info->opps_list[opps_number].x = i - car_center; // left -, right +
- info->opps_list[opps_number].y = j;
-
- // increases number of opposites car in the sensor view range
- opps_number++;
- }
- }
- }
-
- info->opps_number = opps_number;
-
- return 0;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: tags/rel_0_5/auto/readme
===================================================================
--- tags/rel_0_5/auto/readme (revision 1657)
+++ tags/rel_0_5/auto/readme (nonexistent)
@@ -1,51 +0,0 @@
-AUTO - Another Unuseful Track simulatOr
----------------------------------------
-
-by Marco Dallera and Marco Fiocca, 2001
-
----------------------------------------
-
-This project was done as a Lab assignment during the course of
-"Informatica Industriale" at the University of Pavia, Italy.
-
-It simulates a race between cars under a set of 4 tracks.
-
-The authors provided also some pages that describes the application
-(auto.ps, in italian, on the website).
-
-To run the application, just compile it and call "x auto th" where tn is
-the track number (0 to 4).
-
-Since the control algorithm is quite complex, you need a quite powerful
-machine. If you get an exception 8 (WCET violation), you need a faster PC.
-You can anyway run the application making "auto2", that uses RR instead of
-EDF or CBS, or "auto3", that uses the EDFACT Module (you need yo copy
-the edfact.c and edfact.h files in the application directory to do that).
-
-To be run, the application needs to be compiled with the
-#define MAX_CAB set to a number greater than 20 (see include/modules/cabs.h).
-
-The control algorithm of the cars is not yet perfect, and if you look to
-the race for a long time, sometimes some cars go in the wrong direction.
-If you find a better algorithm, send me a patch :-)
-
-The code you can find in this directory is the original code of the
-students except for the MAX_CAB test into main(), and for the idle time
-monitor (that I took from the jumpball example) that can be useful to know
-when the system is overloaded. For example, on my PC there is idle time until
-the system has 9 cars. The tenth make the PC overloaded until one of them
-crashes :-).
-
-Finally note that the WCET and PERIODS specified by the authors are not so
-correct, and with this setting you can run 8 cars maximum before crashing the
-system.
-
-Have a nice race...
-
-Paolo
-pj@sssup.it
-
-PS: Sometimes on my portable the demo crashes. I wonder why!... If someone
-finds why, please tell me, I will patch it...
-
-
Index: tags/rel_0_5/auto/initfil1.c
===================================================================
--- tags/rel_0_5/auto/initfil1.c (revision 1657)
+++ tags/rel_0_5/auto/initfil1.c (nonexistent)
@@ -1,108 +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: initfil1.c,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-**/
-
-/*
- * 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 "modules/edf.h"
-#include "modules/cbs.h"
-#include "modules/rr.h"
-#include "modules/dummy.h"
-
-#include "modules/sem.h"
-#include "modules/hartport.h"
-#include "modules/cabs.h"
-#include "drivers/keyb.h"
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-void read_track(int);
-void read_sprites();
-
-int argc;
-char *argv[100];
-
-int main(int argc, char **argv);
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, 0);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- __compute_args__(mb, &argc, argv);
-
- if (argc == 2)
- read_track(strtoi(argv[1], 10, NULL));
- else
- read_track(2);
-
- read_sprites();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- KEYB_PARMS kparms = BASE_KEYB;
-
- HARTPORT_init();
-
- keyb_def_ctrlC(kparms, NULL);
- KEYB_init(&kparms);
-
- return (void *)main(argc,argv);
-}
Index: tags/rel_0_5/auto/initfil2.c
===================================================================
--- tags/rel_0_5/auto/initfil2.c (revision 1657)
+++ tags/rel_0_5/auto/initfil2.c (nonexistent)
@@ -1,108 +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: initfil2.c,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-**/
-
-/*
- * 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 "modules/rr.h"
-#include "modules/rrsoft.h"
-#include "modules/dummy.h"
-#include "modules/sem.h"
-#include "modules/hartport.h"
-#include "modules/cabs.h"
-#include "drivers/keyb.h"
-
-/*+ sysyem tick in us +*/
-#define TICK 1000
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-void read_track(int);
-void read_sprites();
-
-int argc;
-char *argv[100];
-int main(int argc, char **argv);
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD|RRSOFT_ONLY_SOFT);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- __compute_args__(mb, &argc, argv);
-
- if (argc == 2)
- read_track(strtoi(argv[1], 10, NULL));
- else
- read_track(0);
-
- read_sprites();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- KEYB_PARMS kparms = BASE_KEYB;
-
- HARTPORT_init();
-
- keyb_def_ctrlC(kparms, NULL);
- KEYB_init(&kparms);
-
- return (void *)main(argc,argv);
-}
-
-
-
-
Index: tags/rel_0_5/auto/control.c
===================================================================
--- tags/rel_0_5/auto/control.c (revision 1657)
+++ tags/rel_0_5/auto/control.c (nonexistent)
@@ -1,701 +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>
- * Massimiliano Giorgi <massy@gandalf.sssup.it>
- * Luca Abeni <luca@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: control.c,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 Marco Dallera and Marco Fiocca
- *
- * 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
- *
- */
-
-/*
- * AUTO
- *
- * Another Unuseful Track simulatOr
- *
- * Authors: Marco Dallera
- * Marco Fiocca
- *
- */
-
-/* ------------- */
-/* Car control */
-/* ------------- */
-
-#include "include/auto.h"
-#include "include/const.h"
-#include "include/utils.h"
-
-#define TURN_QUANTUM 2
-#define KM 18.0 // pixel
-#define HOUR 3600.0 // seconds
-#define KPH (KM/HOUR) // 0.005 pixel/second
-#define HIGHWAY_LIMIT 6
-#define MAZE_LIMIT 45
-#define CURVE_LIMIT 25 // il limite della curva per cui imposta la traiettoria
-#define BORDER_LIMIT ((1.0 / params.rage) * 2.0)
-#define STEERING_LIMIT 3 // limite di sterzata
-
-/* Road state */
-#define HIGHWAY 1
-#define MIXED 2
-#define MAZE 3
-#define CENTER 10
-#define TOO_LEFT 11
-#define TOO_RIGHT 12
-
-/* Opponents relationship */
-#define ATTACK 20
-#define DEFENSE 21
-#define SUPERATTACK 22
-
-/* Car parameters */
-#define MAX_SPEED (300 * KPH)
-#define MIN_SPEED (10 * KPH)
-#define MIN_ACC (-0.1)
-#define MAX_ACC (0.02)
-
-extern sem_t grx_mutex;
-
-char track_img[TRACK_WIDTH*TRACK_HEIGHT];
-char sprite[18][CAR_WIDTH*CAR_HEIGHT];
-
-/* Display functions */
-void put_transimage(int x1, int y1, int x2, int y2, BYTE *img,int car_color, int color);
-void draw_car(point_f old_pos, car_status cs, int car_color, int fumo);
-void put_trackbox(int x1, int y1, int x2, int y2);
-void show_display(int, int, float, float, float, float);
-void car_crash(PID sp, PID cp, point_f old_pos, int free);
-
-/* ------------------------------------------------------------------ */
-
-TASK control(int index) {
- int i = 0; // general purpose counter
- car_status old_car_status; // the previous car state
- car_status actual_car_status; // the actual car state
- road_info actual_road_info; // the actual road informations
- int road_state; // the state of the road: HIGHWAY, MIXED; MAZE
- int car_align; // the car alignment with respect to road limits
- int opps_state; // the relationship with other cars
- float old_speed = 0; // the previous car speed value
- float actual_speed = 0; // the actual car speed value
- float old_acc = 0; // the previous acceleration value
- float acc = 0; // the new acceleration
- point polepos;
-
- // Variabili che dipendono dal tipo di macchina
- float max_speed; // maximum car speed
- float min_acc; // minimum acceleration
- float max_acc; // maximum acceleration
-
- int killed = 0; // flag for killed cars
- int crashed = 0; // flag for crashed cars
-
- /* Timing variables */
- float t = 0;
- float dt = (float)CONTROL_PERIOD/100000.0; // time quantum
- time ts = int2time(t);
- float crash_t = 0;
- time crash_ts = int2time(crash_t);
- float bestlap = 999999999.9;
- time bestlap_s = int2time(bestlap);
- int bestlap_done = 0;
- int laps = 0;
-
- /* Display vars */
- point spd_p, acc_p, time_p, drv_p;
- char *txt;
-
- /* Car data */
- car_params params; // car data structure
-
- /* ----------------------------------------------------- */
-
- txt = (char *)malloc(15*sizeof(char));
-
- params = cars[index];
-
- max_speed = params.max_speed * MAX_SPEED; // maximum car speed
- min_acc = params.min_acc * MIN_ACC; // minimum acceleration
- max_acc = params.max_acc * MAX_ACC; // maximum acceleration
-
- /* Get track data */
- while (track_list[i].selected == 0)
- i++;
-
- /* Same pole for all */
- polepos.x = track_list[i].pole_pos.x;
- polepos.y = track_list[i].pole_pos.y;
- actual_car_status.pos.x = polepos.x;
- actual_car_status.pos.y = polepos.y;
- actual_car_status.orient = track_list[i].pole_orient;
- set_car_status(actual_car_status, params.car_status_cab);
-
- /* Initialize old values */
- old_car_status = actual_car_status;
- old_acc = acc;
- old_speed = actual_speed;
-
- /* POWER IS NOTHING WITHOUT CONTROL */
- while(1) {
-
- if (crashed) {
- crash_t += dt;
- crash_ts = int2time(crash_t);
- if (crash_ts.sec > 2) {
- car_crash(params.sensor_pid,params.control_pid,
- old_car_status.pos, 1);
- killed=1;
- }
- }
-
- else {
-
- /* Reads road informations */
- actual_road_info = get_road_info(params.road_status_cab);
-
- /* Defines the state of the road */
- if (fabs(actual_road_info.curve) < HIGHWAY_LIMIT ||
- actual_road_info.distance > 0.9*TEL_HEIGHT) {
- road_state = HIGHWAY;
- } else if (fabs(actual_road_info.curve) > MAZE_LIMIT ||
- actual_road_info.distance < 0.1*TEL_HEIGHT) {
- road_state = MAZE;
- } else {
- road_state = MIXED;
- }
-
- /* Defines the car position whitin road borders */
- if (actual_road_info.left_border < BORDER_LIMIT)
- car_align = TOO_LEFT;
- else if (actual_road_info.right_border < BORDER_LIMIT)
- car_align = TOO_RIGHT;
- else car_align = CENTER;
-
- /* Sets the power percentage */
- switch (road_state)
- {
- case HIGHWAY:
- acc = max_acc; // tarella!!!!
- break;
- case MIXED:
- actual_speed = params.rage * (((float)actual_road_info.distance/(float)TEL_HEIGHT) /
- (fabs(actual_road_info.curve)/90.0)) * max_speed;
- acc = (actual_speed - old_speed) / dt;
- break;
- case MAZE:
- actual_speed = params.rage * (1.0 - (fabs(actual_road_info.curve)/90.0)) * max_speed;
- acc = (actual_speed - old_speed) / dt;
- break;
- default:
- acc = 0.0;
- }
-
- /* Can't go off road */
- /* When car is near a border, it steers to come in */
- switch (car_align)
- {
- case TOO_LEFT:
- actual_car_status.orient -= TURN_QUANTUM;
- break;
- case TOO_RIGHT:
- actual_car_status.orient += TURN_QUANTUM;
- break;
- }
-
- if (road_state != HIGHWAY) {
- // C'e' una curva vicina.
- // Se la curva e' a destra si tiene vicino al bordo di sinistra
- // per impostare la traiettoria migliore e viceversa
- if (actual_road_info.curve < 0 && actual_road_info.left_border > BORDER_LIMIT
- && fabs(actual_road_info.curve) > CURVE_LIMIT)
- actual_car_status.orient += TURN_QUANTUM;
- else if (actual_road_info.curve > 0 && actual_road_info.right_border > BORDER_LIMIT
- && fabs(actual_road_info.curve) > CURVE_LIMIT)
- actual_car_status.orient -= TURN_QUANTUM;
-
- // Fa la curva dolcemente
- if (actual_road_info.distance < ((1.0/params.rage) * (TEL_HEIGHT * 0.25))) {
- actual_car_status.orient += actual_road_info.curve * (params.rage/8.0);
- //actual_car_status.orient += actual_road_info.curve / 4.0;
- }
- }
-
- /* Defines the state of interactions with other cars */
- if (actual_road_info.opps_number > 0)
- {
- if (road_state == HIGHWAY && actual_road_info.opps_list[0].y > (TEL_HEIGHT/3.0))
- opps_state = ATTACK;
- else if (road_state == MAZE && actual_road_info.opps_list[0].y < (TEL_HEIGHT/3.0))
- opps_state = DEFENSE;
- else if (actual_road_info.opps_list[0].y < (TEL_HEIGHT/6.0) &&
- actual_road_info.opps_list[0].x != 0 &&
- (abs(actual_road_info.opps_list[0].x) < CAR_W/2)) {
- // Defends and steers to avoid opponents
- opps_state = DEFENSE;
- acc *= -((TEL_HEIGHT/6.0) / (actual_road_info.opps_list[0].y));
- actual_car_status.orient -= ((actual_road_info.opps_list[0].x) /
- abs(actual_road_info.opps_list[0].x)) * TURN_QUANTUM/2;
- }
- else if (actual_road_info.opps_list[0].y < (TEL_HEIGHT/3.0) &&
- actual_road_info.opps_list[0].x != 0 &&
- abs(actual_road_info.opps_list[0].x) < CAR_W/2) {
- // Attacks and steers to override the opponent
- opps_state = ATTACK;
- actual_car_status.orient -= ((actual_road_info.opps_list[0].x) /
- abs(actual_road_info.opps_list[0].x)) * TURN_QUANTUM;
- }
- else
- opps_state = DEFENSE;
-
- // Response to opponents positions
- if (opps_state == ATTACK)
- acc = max_acc;
- else if (opps_state == DEFENSE)
- acc *= 0.5;
- }
-
-
- /* Checking car position: road/offroad */
- if (actual_road_info.left_border * actual_road_info.right_border < 0)
- acc = 0.5 * min_acc;
-
- if (actual_road_info.flag != ROAD_OK) {
- switch (actual_road_info.flag) {
- case LEFT_ONLY:
- if (actual_road_info.left_border < 0)
- actual_car_status.orient -= TURN_QUANTUM;
- acc = 0.5 * max_acc;
- break;
- case RIGHT_ONLY:
- if (actual_road_info.right_border < 0)
- actual_car_status.orient += TURN_QUANTUM;
- acc = 0.5 * max_acc;
- break;
- case NO_ROAD:
- crashed = 1;
- car_crash(params.sensor_pid,params.control_pid,
- old_car_status.pos, 0);
- break;
- }
- }
-
- /* Checking collisions... */
- if (actual_road_info.collision != NO_COLL) {
- switch(actual_road_info.collision) {
- case COLLISION_LEFT:
- actual_car_status.orient -= TURN_QUANTUM;
- acc *= (0.5 * params.rage);
- break;
- case COLLISION_RIGHT:
- actual_car_status.orient += TURN_QUANTUM;
- acc *= (0.5 * params.rage);
- break;
- }
- }
-
- /* Checking acceleration range... */
- acc = max(min(max_acc,acc),min_acc);
- actual_speed = old_speed + acc*dt;
-
- /* Checking speed range... */
- actual_speed = min(max(actual_speed,MIN_SPEED),max_speed);
-
- /* Checking steering angle ... */
- if (fabs(actual_car_status.orient - old_car_status.orient) >
- STEERING_LIMIT) {
- if ((actual_car_status.orient - old_car_status.orient) > 0)
- actual_car_status.orient = old_car_status.orient + STEERING_LIMIT;
- else
- actual_car_status.orient = old_car_status.orient - STEERING_LIMIT;
- }
-
- /* Setting new car position... */
- actual_car_status.pos.x += actual_speed * cos(degree_to_rad(actual_car_status.orient));
- actual_car_status.pos.y -= actual_speed * sin(degree_to_rad(actual_car_status.orient));
-
- /* Checking track limits... */
- if (actual_car_status.pos.x < MIN_CAR_X)
- actual_car_status.pos.x = MIN_CAR_X;
- if (actual_car_status.pos.x > MAX_CAR_X)
- actual_car_status.pos.x = MAX_CAR_X;
- if (actual_car_status.pos.y < MIN_CAR_Y)
- actual_car_status.pos.y = MIN_CAR_Y;
- if (actual_car_status.pos.y > MAX_CAR_Y)
- actual_car_status.pos.y = MAX_CAR_Y;
-
- /* Sends new status to car_status_cab */
- set_car_status(actual_car_status, params.car_status_cab);
-
- if (!crashed) {
- /* Updates car */
- if (acc == min_acc)
- draw_car(old_car_status.pos,actual_car_status, params.color, 1);
- else
- draw_car(old_car_status.pos,actual_car_status, params.color, 0);
- }
-
- /* Sets display points */
- spd_p.x = TRACK_X1 + TRACK_WIDTH + TEL_HEIGHT + TEL_WIDTH + 9;
- spd_p.y = TEL_HEIGHT*index + 1 + index + 1;
- bar_display(spd_p, 70, 4, GREEN, actual_speed, max_speed, LIGHTGRAY, "Spd");
-
- acc_p.x = spd_p.x;
- acc_p.y = spd_p.y + 24;
- bidir_bar_display(acc_p, 70, 4, GREEN, acc, max(fabs(min_acc), max_acc), LIGHTGRAY, "Acc");
-
- sem_wait(&grx_mutex);
-
- /* Displays driver's name */
- drv_p.x = spd_p.x + 80;
- drv_p.y = spd_p.y;
- grx_text(params.driver, drv_p.x, drv_p.y, params.color, BLACK);
-
- /* Displays timer */
- time_p.x = spd_p.x + 80;
- time_p.y = spd_p.y + 8;
- if( (!bestlap_done) || (bestlap_done && t > 50))
- {
- /* Mins */
- txt = itoa(ts.min, txt);
- grx_text(txt, time_p.x, time_p.y, WHITE, BLACK);
- grx_text(":", time_p.x + 8, time_p.y, WHITE, BLACK);
- /* Secs */
- txt = itoa(ts.sec, txt);
- if (ts.sec < 10) {
- grx_text("0", time_p.x+16, time_p.y, WHITE, BLACK);
- grx_text(txt, time_p.x+24, time_p.y, WHITE, BLACK);
- }
- else
- grx_text(txt, time_p.x+16, time_p.y, WHITE, BLACK);
- /* Decs */
- grx_text(":", time_p.x+32, time_p.y, WHITE, BLACK);
- txt = itoa(ts.dec, txt);
- grx_text(txt, time_p.x+40, time_p.y, WHITE, BLACK);
- }
-
- /* Displays the best lap */
- if(bestlap_done == 1)
- {
- time_p.x = spd_p.x + 80;
- time_p.y = spd_p.y + 16;
- /* Mins */
- txt = itoa(bestlap_s.min, txt);
- grx_text(txt, time_p.x, time_p.y, YELLOW, BLACK);
- grx_text(":", time_p.x + 8, time_p.y, YELLOW, BLACK);
- /* Secs */
- txt = itoa(bestlap_s.sec, txt);
- if (bestlap_s.sec < 10) {
- grx_text("0", time_p.x+16, time_p.y, YELLOW, BLACK);
- grx_text(txt, time_p.x+24, time_p.y, YELLOW, BLACK);
- }
- else
- grx_text(txt, time_p.x+16, time_p.y, YELLOW, BLACK);
- /* Decs */
- grx_text(":", time_p.x+32, time_p.y, YELLOW, BLACK);
- txt = itoa(bestlap_s.dec, txt);
- grx_text(txt, time_p.x+40, time_p.y, YELLOW, BLACK);
- }
-
- /* Displays lap number */
- time_p.x = spd_p.x + 80;
- time_p.y = spd_p.y + 24;
- grx_text("Lap ", time_p.x, time_p.y, LIGHTGRAY, BLACK);
- txt = itoa(laps, txt);
- grx_text(txt, time_p.x+32, time_p.y, LIGHTGRAY, BLACK);
-
- sem_post(&grx_mutex);
-
- /* Control the best lap */
- t += dt;
- ts = int2time(t);
-
- /* Finish line */
- if ((track_list[i].lap == CLOCK &&
- (actual_car_status.pos.x >= polepos.x) && (old_car_status.pos.x < polepos.x)
- && (actual_car_status.pos.y > polepos.y-20) && (actual_car_status.pos.y < polepos.y+20)) ||
- (track_list[i].lap == ANTICLOCK &&
- (actual_car_status.pos.x <= polepos.x) && (old_car_status.pos.x > polepos.x)
- && (actual_car_status.pos.y > polepos.y-20) && (actual_car_status.pos.y < polepos.y+20))) {
- laps++; // increases lap number
-
- bestlap = min(bestlap,t);
- bestlap_s = int2time(bestlap);
- bestlap_done = 1;
- t = 0;
- ts = int2time(t);
- }
-
- /* Updates old values */
- old_car_status = actual_car_status;
- old_acc = acc;
- old_speed = actual_speed;
-
- } // end crashed
-
- task_endcycle();
-
- // Esce se e' morto
- if (killed) return 0;
- }
-}
-
-/* ------------------------------------------------------------------ */
-
-void car_crash(PID sp, PID cp, point_f old_pos, int free)
-{
- point p1, p2;
- p1.x = round(old_pos.x) - CAR_WIDTH/2 - 1;
- p1.y = round(old_pos.y) - CAR_HEIGHT/2 - 1;
- p2.x = p1.x + CAR_WIDTH + 1;
- p2.y = p1.y + CAR_HEIGHT + 1;
-
- sem_wait(&grx_mutex);
- /* Find the track box to redraw */
- put_trackbox(p1.x,p1.y,p2.x,p2.y);
-
- if (free == 0) {
- // Draw the explosion
- put_transimage(p1.x+1,p1.y+1,p2.x-1,p2.y-1,&sprite[16][0],0,0);
- }
- else if (free == 1) {
- // Delete the explosion
- put_trackbox(p1.x,p1.y,p2.x,p2.y);
- task_kill(sp);
- task_kill(cp);
- }
- sem_post(&grx_mutex);
-}
-
-/* ------------------------------------------------------------------ */
-
-void draw_car(point_f old_pos, car_status cs, int car_color, int fumo)
-{
- int index;
- point p1, p2;
- p1.x = round(old_pos.x) - CAR_WIDTH/2 - 1;
- p1.y = round(old_pos.y) - CAR_HEIGHT/2 - 1;
- p2.x = p1.x + CAR_WIDTH + 1;
- p2.y = p1.y + CAR_HEIGHT + 1;
-
- sem_wait(&grx_mutex);
- /* Find the track box to redraw */
- put_trackbox(p1.x,p1.y,p2.x,p2.y);
-
-
- p1.x = round(cs.pos.x) + (CAR_WIDTH/2 * cos(degree_to_rad(cs.orient)));
- p1.y = round(cs.pos.y) - (CAR_HEIGHT/2 * sin(degree_to_rad(cs.orient)));
- p2.x = round(cs.pos.x) - (CAR_WIDTH/2 * cos(degree_to_rad(cs.orient)));
- p2.y = round(cs.pos.y) + (CAR_HEIGHT/2 * sin(degree_to_rad(cs.orient)));
-
- index = ((((int)cs.orient%360)+360)%360);
- index = (int)(index + 11.25)%360;
- index /= 22.5;
-
- put_transimage(round(cs.pos.x) - CAR_WIDTH/2 + 1,round(cs.pos.y) - CAR_HEIGHT/2 + 1,
- round(cs.pos.x) + CAR_WIDTH/2 ,round(cs.pos.y) + CAR_HEIGHT/2,
- &sprite[index][0], car_color, 0);
- if (fumo)
- put_transimage(round(cs.pos.x) - CAR_WIDTH/2 + 1,round(cs.pos.y) - CAR_HEIGHT/2 + 1,
- round(cs.pos.x) + CAR_WIDTH/2 ,round(cs.pos.y) + CAR_HEIGHT/2,
- &sprite[17][0], car_color, 0);
- sem_post(&grx_mutex);
-}
-
-/* ------------------------------------------------------------------ */
-
-/* Copy a box of track_image to screen */
-void put_trackbox(int x1, int y1, int x2, int y2)
-{
- int y;
- int tx1,ty1,tx2,ty2;
- BYTE *addr;
-
- tx1 = x1-TRACK_X1+1;
- ty1 = y1-TRACK_Y1;
- tx2 = x2-TRACK_X1+1;
- ty2 = y2-TRACK_Y1;
-
- if (tx1 < 0) tx1 = 0;
- if (ty1 < 0) ty1 = 0;
- if (tx2 > TRACK_WIDTH-1) tx2 = TRACK_WIDTH-1;
- if (ty2 > TRACK_HEIGHT-1) ty2 = TRACK_HEIGHT-1;
-
- tx1 = max(tx1,0);
- ty1 = max(ty1,0);
- tx2 = min(tx2,TRACK_WIDTH-1);
- ty2 = min(ty2,TRACK_HEIGHT-1);
-
- addr = &track_img[0] + tx1 + TRACK_WIDTH * ty1;
-
- x1 = max(0,x1);
- y1 = max(0,y1);
-
- for (y = y1; y <= y2; y++) {
- grx_putimage(x1+1, y, x2, y, addr);
- addr += TRACK_WIDTH;
- }
-}
-
-/* ------------------------------------------------------------------ */
-
-void put_transimage(int x1, int y1, int x2, int y2, BYTE *img, int car_color,
- int color)
-{
- int x,y;
- BYTE *addr;
- addr = img;
-
-
- for (y = y1; y < y2; y++) {
- for ( x = x1; x < x2; x++, addr++) {
- if (*addr != color) {
- if (*addr == 26)
- grx_plot(x,y,car_color);
- else
- grx_plot(x,y,*addr);
-
- }
- }
- addr++;
- }
-}
-
-/* ------------------------------------------------------------------ */
-
-void show_display(int rs, int ca, float speed, float max_speed,
- float acc, float max_acc)
-{
- point hw, mx, mz; // three road states
- point tl, ct, tr; // three car alignments
- point sp1, sp2; // speed display coordinates
- point ap1, ap2; // acceleration display coordinates
- int s_amp = 0;
- int a_amp = 0;
-
- /* Leds coordinates */
- hw.x = 10;
- hw.y = SCREEN_HEIGHT-50;
- mx.x = 25;
- mx.y = SCREEN_HEIGHT-50;
- mz.x = 40;
- mz.y = SCREEN_HEIGHT-50;
- tl.x = 10;
- tl.y = SCREEN_HEIGHT-35;
- ct.x = 25;
- ct.y = SCREEN_HEIGHT-35;
- tr.x = 40;
- tr.y = SCREEN_HEIGHT-35;
- sp1.x = 10;
- sp1.y = SCREEN_HEIGHT-75;
- sp2.x = 110;
- sp2.y = SCREEN_HEIGHT-65;
- ap1.x = 10;
- ap1.y = SCREEN_HEIGHT-90;
- ap2.x = 110;
- ap2.y = SCREEN_HEIGHT-80;
-
- sem_wait(&grx_mutex);
-
- /* Writes out controller titles */
- grx_text("Road", mz.x+15, mz.y, YELLOW, BLACK);
- grx_text("Curve", tr.x+15, tr.y, YELLOW, BLACK);
- switch (rs)
- {
- case HIGHWAY:
- grx_box(hw.x, hw.y, hw.x+10, hw.y+10, GREEN);
- grx_box(mx.x, mx.y, mx.x+10, mx.y+10, BLACK);
- grx_box(mz.x, mz.y, mz.x+10, mz.y+10, BLACK);
- break;
- case MIXED:
- grx_box(hw.x, hw.y, hw.x+10, hw.y+10, BLACK);
- grx_box(mx.x, mx.y, mx.x+10, mx.y+10, YELLOW);
- grx_box(mz.x, mz.y, mz.x+10, mz.y+10, BLACK);
- break;
- case MAZE:
- grx_box(hw.x, hw.y, hw.x+10, hw.y+10, BLACK);
- grx_box(mx.x, mx.y, mx.x+10, mx.y+10, BLACK);
- grx_box(mz.x, mz.y, mz.x+10, mz.y+10, RED);
- break;
- }
-
- switch (ca)
- {
- case TOO_LEFT:
- grx_box(tl.x, tl.y, tl.x+10, tl.y+10, RED);
- grx_box(ct.x, ct.y, ct.x+10, ct.y+10, BLACK);
- grx_box(tr.x, tr.y, tr.x+10, tr.y+10, BLACK);
- break;
- case TOO_RIGHT:
- grx_box(tl.x, tl.y, tl.x+10, tl.y+10, BLACK);
- grx_box(ct.x, ct.y, ct.x+10, ct.y+10, BLACK);
- grx_box(tr.x, tr.y, tr.x+10, tr.y+10, BLUE);
- break;
- default:
- grx_box(tl.x, tl.y, tl.x+10, tl.y+10, BLACK);
- grx_box(ct.x, ct.y, ct.x+10, ct.y+10, WHITE);
- grx_box(tr.x, tr.y, tr.x+10, tr.y+10, BLACK);
- }
-
- /* Draws speed display */
- grx_text("Speed", sp1.x+120, sp1.y, YELLOW, BLACK);
- grx_rect(sp1.x-1, sp1.y-1, sp2.x+1, sp2.y+1, GREEN);
- /* Updates speed display */
- grx_box(sp1.x, sp1.y, sp2.x, sp2.y, BLACK);
- s_amp = round( (speed * (float)(sp2.x-sp1.x)) / max_speed );
- grx_box(sp1.x, sp1.y, sp1.x+s_amp, sp2.y, LIGHTGRAY);
-
- /* Draws acceleration display */
- grx_text("Acceleration", ap1.x+120, ap1.y, YELLOW, BLACK);
- grx_rect(ap1.x-1, ap1.y-1, ap2.x+1, ap2.y+1, GREEN);
- /* Updates acceleration display */
- grx_box(ap1.x, ap1.y, ap2.x, ap2.y, BLACK);
- a_amp = round( (float)acc * (float)((ap2.x-ap1.x)/2) / (float)max_acc );
- if (a_amp >= 0)
- grx_box((ap1.x+ap2.x)/2, ap1.y, ((ap1.x+ap2.x)/2)+a_amp, ap2.y, LIGHTGRAY);
- else
- grx_box((ap1.x+ap2.x)/2+a_amp, ap1.y, ((ap1.x+ap2.x)/2), ap2.y, LIGHTGRAY);
- grx_line((ap1.x+ap2.x)/2, ap1.y-2, (ap1.x+ap2.x)/2, ap2.y+2, WHITE);
- sem_post(&grx_mutex);
-}
-
Index: tags/rel_0_5/auto/initfil3.c
===================================================================
--- tags/rel_0_5/auto/initfil3.c (revision 1657)
+++ tags/rel_0_5/auto/initfil3.c (nonexistent)
@@ -1,107 +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: initfil3.c,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:39 $
- ------------
-**/
-
-/*
- * 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 "edfact.h"
-#include "modules/cbs.h"
-#include "modules/rr.h"
-#include "modules/dummy.h"
-
-#include "modules/sem.h"
-#include "modules/hartport.h"
-#include "modules/cabs.h"
-#include "drivers/keyb.h"
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-void read_track(int);
-void read_sprites();
-
-int argc;
-char *argv[100];
-int main(int argc, char **argv);
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- EDFACT_register_level(0);
- CBS_register_level(0, 0);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- __compute_args__(mb, &argc, argv);
-
- if (argc == 2)
- read_track(strtoi(argv[1], 10, NULL));
- else
- read_track(2);
-
- read_sprites();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- KEYB_PARMS kparms = BASE_KEYB;
-
- HARTPORT_init();
-
- keyb_def_ctrlC(kparms, NULL);
- KEYB_init(&kparms);
-
- return (void *) main(argc,argv);
-}
Index: tags/rel_0_5/eli/initfile.c
===================================================================
--- tags/rel_0_5/eli/initfile.c (revision 1657)
+++ tags/rel_0_5/eli/initfile.c (nonexistent)
@@ -1,100 +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: initfile.c,v 1.1.1.1 2004-05-24 18:03:47 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:47 $
- ------------
-
- This file is similar to the configuration of Hartik 3.3.1
-
-**/
-
-/*
- * 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 "modules/edf.h"
-#include "modules/cbs.h"
-#include "modules/rr.h"
-#include "modules/dummy.h"
-
-#include "modules/sem.h"
-#include "modules/hartport.h"
-#include "modules/cabs.h"
-
-#include "drivers/keyb.h"
-
-
-/*+ sysyem tick in us +*/
-#define TICK 1000
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- EDF_register_level(0);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- CBS_register_level(CBS_ENABLE_ALL, 0);
- 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();
-
- KEYB_init(NULL);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
Index: tags/rel_0_5/eli/eli.c
===================================================================
--- tags/rel_0_5/eli/eli.c (revision 1657)
+++ tags/rel_0_5/eli/eli.c (nonexistent)
@@ -1,787 +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: eli.c,v 1.1.1.1 2004-05-24 18:03:47 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:47 $
- ------------
-
- This file is similar to the configuration of Hartik 3.3.1
-
-**/
-
-/*
- * Copyright (C) 2000 Paolo Gai and ALLEN-DESTRO
- *
- * 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 "eli.h"
-
-#include <time.h>
-
-//########################################
-// Definizione variabili globali
-//########################################
-char tastiera;
-long double Forza_x,Forza_y,Velocita_x,Velocita_y,Acc_x,Acc_y,Pos_x,Pos_y;
-long double Pos_pe_y[5];
-long double Pos_pe_x[5];
-long double T1=0;
-long double r;
-int n_peso=0;
-int peso_agganciato[5]={0,0,0,0,0};
-int pre_peso[5]={0,0,0,0,0};
-int libero_peso[5]={0,0,0,0,0};
-PID pid_peso[5];
-PID pid_ruspa[5];
-int x_r=200;
-int n_ruspa=5;
-int indietro;
-int eli_occ=0;
-int kill_p;
-
-//PID pid_r0,pid_r1,pid_r2,pid_r3,pid_r4;
-PID pid_kill_p,pid_pulisci_p,pid_kill_e,pid_pulisci_e;
-
-
-// Definizione del semaforo per l'utilizzo della modalita' grafica
-sem_t mutex;
-sem_t pu;
-
-
-
-
-//#######################################################################
-//############### DEFINIZIONE TASK ######################################
-//#######################################################################
-
-TASK kill_task(int i)
-{ int x,y,dim;
- while (1)
- {
-
- if(i==1)
- {
- x=Pos_pe_x[kill_p];
- y=Pos_pe_y[kill_p];
- dim=25;
- }
- else
- {
- x=Pos_x;
- y=Pos_y;
- dim=35;
- }
-
- PULISCI(x,y,dim);
- ESPLOSIONE(x,y);
-
- sem_wait(&pu);
-
- if(i==1) task_activate(pid_pulisci_p);
- else task_activate(pid_pulisci_e);
-
- task_endcycle();
-
- }
-
-
-}
-
-TASK pulisci(int i)
-{
- int x,y,dim;
- struct timespec delay;
-
- delay.tv_sec=0;
- delay.tv_nsec=3000000;
-
- while (1)
- {
-
- if(i==1)
- {
- x=Pos_pe_x[kill_p];
- y=Pos_pe_y[kill_p];
- dim=25;
- }
- else
- {
- x=Pos_x;
- y=Pos_y;
- dim=35;
- }
-
-
- nanosleep(&delay, NULL);
- PULISCI(x,y,dim);
-
- sem_post(&pu);
-
- task_endcycle();
- }
-}
-
-
-
-
-TASK elicottero(int i)
-{ long double x_old,x_new,y_old,y_new;
- TIME us_old,us_new;
- long double delta_T;
- long double Fx,Fy,Ax,Ay,Vx,Vy,m_el;
- int Destra_old,Destra_new;
- // int uccidi,colore;
- // int prova;
-
- m_el=1;
- Vx=0;Vy=0;
- Ax=0;Ay=0;
- Fx=0;Fy=0-m_el*G; // Fy=0;
- x_old=150;
- y_old=150;
- Destra_old=1;
- Destra_new=1;
-
- us_old=sys_gettime(NULL);
-
- while (1)
- {
-
- // prova=2;
-
-
- us_new=sys_gettime(NULL);
- delta_T=(us_new-us_old)/100000;
- // if(delta_T<0.9) prova=1;
- // if(delta_T<0) prova=4;
- // if(delta_T>1.1) prova=3;
-
-
- delta_T=1;
- Ax=(Fx-(r*Vx))/m_el;
- Ay=(Fy-(r*Vy)+m_el*G+T1)/m_el;
- x_new=x_old+Vx*delta_T+0.5*Ax*delta_T*delta_T;
- y_new=y_old+Vy*delta_T+0.5*Ay*delta_T*delta_T;
-
- // if(prova==1) {x_new=300; y_new=150;}
- // if(prova==3) {x_new=150; y_new=300;}
- // if(prova==2) {x_new=300; y_new=300;}
- // if(prova==4) {x_new=400; y_new=400;}
-
- Vx=Vx+Ax*delta_T;
- Vy=Vy+Ay*delta_T;
- if ((Vx>0)|| ((Vx==0) && (Destra_old==1))) Destra_new=1;
- else Destra_new=0;
-
- if ( ((y_new>=(Y0max-DIM_EL/2-2)) || ( (y_old<=400-DIM_EL/2-2) && (y_new>=400-DIM_EL/2-2) && (x_new>=X0min+151) && (x_new<=X0min+280) )) )
- {
- if ((x_new>=X0min+151) && (x_new<=X0min+280)) y_new=400-DIM_EL/2-2;
- else y_new=Y0max-DIM_EL/2-2;
- Vy=0;
- Vx=0;
- x_new=x_old;
- Ay=0;
- Ax=0;
- }
-
-
-
-
- sem_wait(&mutex);
-
- /*
- uccidi=0;
-
- colore=grx_getpixel(x_new-2*DIM_EL,y_new-DIM_EL);
- if ( (colore!=COL_SFONDO) && (colore!=YELLOW) && (colore!=RED)) uccidi=1;
- colore=grx_getpixel(x_new+2*DIM_EL,y_new-DIM_EL);
- if ( (colore!=COL_SFONDO) && (colore!=YELLOW) && (colore!=RED)) uccidi=1;
- colore=grx_getpixel(x_new-2*DIM_EL,y_new+DIM_EL/2);
- if ( (colore!=COL_SFONDO) && (colore!=YELLOW) && (colore!=RED)) uccidi=1;
- colore=grx_getpixel(x_new+2*DIM_EL,y_new+DIM_EL/2);
- if ( (colore!=COL_SFONDO) && (colore!=YELLOW) && (colore!=RED)) uccidi=1;
- colore=grx_getpixel(x_new,y_new);
- if ( (colore!=COL_SFONDO) && (colore!=YELLOW) && (colore!=RED)) uccidi=1;
- */
-
- if ((x_old>100) && (y_old>100) && (x_old<X0max) )
- {
- if (Destra_old==0) {ELICOTTERO_S(x_old,y_old,DIM_EL,COL_SFONDO,COL_SFONDO);}
- else {ELICOTTERO_D(x_old,y_old,DIM_EL,COL_SFONDO,COL_SFONDO);}
- }
-
- if ((x_new>100) && (y_new>100) && (x_new<X0max) )
- {
- /*
- if ( uccidi==1)
- {
- // grx_box(10,10,100,100,RED);
- // task_activate(pid_kill_e);
- // sem_post(&mutex);
- // eli_occ=0;
- sem_post(&mutex);
- task_abort();
- }
- */
-
-
- if (Destra_new==0) {ELICOTTERO_S(x_new,y_new,DIM_EL,COL_EL,COL_SFONDO);}
- else {ELICOTTERO_D(x_new,y_new,DIM_EL,COL_EL,COL_SFONDO);}
- }
- sem_post(&mutex);
-
- if (tastiera=='c') Fx=Fx+0.25;
- if (tastiera=='z') Fx=Fx-0.25;
- if (tastiera=='x') Fy=Fy+0.25;
- if (tastiera=='s') Fy=Fy-0.25;
-
- if (Fx>2) Fx=2;
- if (Fx<-2) Fx=-2;
- if (Fy>0) Fy=0;
- if (Fy<-17.5) Fy=-17.5;
-
- Forza_x=Fx;
- Forza_y=Fy;
- Acc_x=Ax;
- Acc_y=Ay;
- Velocita_x=Vx;
- Velocita_y=Vy;
- Pos_x=x_new;
- Pos_y=y_new;
-
-
- if ( (tastiera=='z') || (tastiera=='x') || (tastiera=='c') || (tastiera=='s') )
- tastiera='q';
-
-
- us_old=us_new;
- x_old=x_new;
- y_old=y_new;
- Destra_old=Destra_new;
-
- task_endcycle();
- }
-}
-
-
-
-TASK peso(int i)
-{
- long double delta_T;
- long double Ay,Vy;
- long double x_new,x_old,y_old,y_new;
- int scelta=0;
- int rit,colore,uccidi;
- double m_peso[5]={0.5,0.4,0.3,0.1,0.6};
- int delta_y1,delta_y2;
-
-
- // PID pid;
- // MODEL m = BASE_MODEL;
-
- Vy=0;
- Ay=0;
-
- x_old=700-DIM_PESO-1;
- y_old=Y0max-DIM_PESO*2-1;
- delta_T=1;
- x_new=700-DIM_PESO-1;
-
- libero_peso[i]=0;
-
- while (1 )
- {
- uccidi=0;
-
- if (scelta==0 )
- {
-
- y_new=y_old;
- if (x_new+DIM_PESO==x_r-1) x_new=x_new-1;
- else x_new=x_new;
- if (indietro==1) {scelta=1; libero_peso[i]=1;}
- }
-
- if (scelta==1 )
- {
- y_new=y_old;
- x_new=x_old;
- if (peso_agganciato[i]==1) scelta=2;
- }
- if (scelta==2)
- {
- eli_occ=1;
- Ay=(m_peso[i]*G-(r*Vy)-T1)/m_peso[i];
- if(peso_agganciato[i]==1) x_new=Pos_x;
- else x_new=x_old;
- y_new=y_old+Vy*delta_T+0.5*Ay*delta_T*delta_T;
- Vy=Vy+Ay*delta_T;
-
- delta_y1=Y0max-y_new;
- delta_y2=400-y_new;
-
- if ( (y_new>=(Y0max-2*DIM_PESO-1)) || ( (y_old<400-2*DIM_PESO-1) && (y_new>=400-2*DIM_PESO-1) && (x_new>=X0min+151-DIM_PESO) && (x_new<=X0min+280+DIM_PESO) ) )
- {
- if ((x_new>=X0min+151-DIM_PESO) && (x_new<=X0min+280+DIM_PESO))
- {
- if (delta_y2<6) uccidi=1;
- y_new=400-2*DIM_PESO-2;
- }
- else {
- if (delta_y1<6) uccidi=1;
- y_new=Y0max-2*DIM_PESO-2;
- }
- Vy=0;
- if(peso_agganciato[i]==0) {scelta=3; rit=0;}
- }
- }
- if (scelta==3)
- {
- x_new=x_new;
- y_new=y_new;
- eli_occ=0;
- if (y_new==400-2*DIM_PESO-2) rit++;
-
-
-
- if (rit==100) {
- peso_agganciato[i]=0;
- pre_peso[i]=0;
- sem_wait(&mutex);
- PESO(x_old,y_old,DIM_PESO,COL_SFONDO);
- sem_post(&mutex);
-
- return NULL;
- }
-
- if(peso_agganciato[i]==1) scelta=2;
- }
-
- sem_wait(&mutex);
-
-
- colore=grx_getpixel(x_new-DIM_PESO,y_new);
- if ( (colore!=COL_SFONDO) && (colore!=DELTA_COL+i*2) && (colore!=RED)) uccidi=1;
-
- colore=grx_getpixel(x_new+DIM_PESO,y_new);
- if ( (colore!=COL_SFONDO) && (colore!=DELTA_COL+i*2) && (colore!=RED)) uccidi=1;
-
- colore=grx_getpixel(x_new-DIM_PESO,y_new+2*DIM_PESO);
- if ( (colore!=COL_SFONDO) && (colore!=DELTA_COL+i*2) && (colore!=RED)) uccidi=1;
-
- colore=grx_getpixel(x_new+DIM_PESO,y_new+2*DIM_PESO);
- if ( (colore!=COL_SFONDO) && (colore!=DELTA_COL+i*2) && (colore!=RED)) uccidi=1;
-
- colore=grx_getpixel(x_new,y_new+DIM_PESO);
- if ( (colore!=COL_SFONDO) && (colore!=DELTA_COL+i*2) && (colore!=RED)) uccidi=1;
-
-
-
- if ((x_old>100) && (y_old>100) && (x_old<X0max) )
- {
- PESO(x_old,y_old,DIM_PESO,COL_SFONDO);
- }
-
- y_old=y_new;
- x_old=x_new;
- Pos_pe_y[i]=y_new;
- Pos_pe_x[i]=x_new;
-
-
- if ((x_new>100) && (y_new>100) && (x_new<X0max) )
- {
- if ( uccidi==1)
- {
- kill_p=i;
- task_activate(pid_kill_p);
- sem_post(&mutex);
- eli_occ=0;
- pre_peso[i]=0;
- peso_agganciato[i]=0;
- return NULL;
- }
-
- PESO(x_new,y_new,DIM_PESO,DELTA_COL+i*2);
- }
- sem_post(&mutex);
-
-
- task_endcycle();
- }
-
-
-}
-
-TASK ruspa(int i)
-{
- int x,y,ii;
- int end_peso[5]={370,420,470,520,570};
-
- PID pid;
- HARD_TASK_MODEL m_hard;
-
- pre_peso[i]=1;
-
- hard_task_default_model(m_hard);
- hard_task_def_wcet(m_hard,1); // wcet ignored!!!
- hard_task_def_mit(m_hard,PER_DISEGNA);
- hard_task_def_usemath(m_hard);
- hard_task_def_arg(m_hard,(void *)i);
- pid=task_create("peso2",peso,&m_hard,NULL);
- pid_peso[i]=pid;
- task_activate(pid_peso[i]);
-
-
- x=720;
- y=Y0max;
-
- indietro=0;
- while (x!=end_peso[i]+DIM_PESO)
- {
- sem_wait(&mutex);
- RUSPA_S(x+1,y,COL_SFONDO,COL_SFONDO);
- RUSPA_S(x,y,YELLOW-1,LIGHTBLUE);
- sem_post(&mutex);
- x_r=x;
- x--;
- task_endcycle();
- }
- sem_wait(&mutex);
- RUSPA_S(x+1,y,COL_SFONDO,COL_SFONDO);
- sem_post(&mutex);
- indietro=1;
- while (x!=730 )
- {
- sem_wait(&mutex);
- RUSPA_D(x-1+40,y,COL_SFONDO,COL_SFONDO);
- RUSPA_D(x+40,y,YELLOW-1,LIGHTBLUE);
- sem_post(&mutex);
- x++;
- task_endcycle();
- }
-
- ii=i+1;
-
- while(ii>4)
- {
- n_ruspa=5;
- if(pre_peso[4]==0){
- ii=4;
- if(pre_peso[3]==0){
- ii=3;
- if(pre_peso[2]==0){
- ii=2;
- if(pre_peso[1]==0){
- ii=1;
- if(pre_peso[0]==0){
- ii=0;
- }
- }
- }
- }
- }
- task_endcycle();
-
- }
-
- hard_task_def_arg(m_hard,(void *)ii);
- pid_ruspa[ii]=task_create("ruspa",ruspa,&m_hard,NULL);
- task_activate(pid_ruspa[ii]);
- n_ruspa=ii;
-
- return NULL;
-}
-
-
-
-
-TASK molla(int i)
-{
- double k=0.05;
- double x,x_old,y1_old,y2_old;
- double T1_old; //,T2_old;
-
- x_old=Pos_x;
- y1_old=Pos_y;
- y2_old=Pos_pe_y[n_peso];
-
- while (1)
- {
-
- sem_wait(&mutex);
- if ((x_old>100-DIM_EL) && (y1_old>100-DIM_EL) && (x_old<X0max) )
- {
- MOLLA(x_old,y1_old+DIM_EL,y2_old,COL_SFONDO)
- }
- else if( (y2_old>100) && (x_old<X0max) && (x_old>100) )
- {
- MOLLA(x_old,X0min+100,y2_old,COL_SFONDO)
- }
-
- x_old=Pos_x;
- y1_old=Pos_y;
-
- if(peso_agganciato[n_peso]==0) y2_old=y1_old+20;
- else y2_old=Pos_pe_y[n_peso];
-
- if ((x_old>100) && (y1_old>100-DIM_EL) && (x_old<X0max) )
- {
- MOLLA(x_old,y1_old+DIM_EL,y2_old,RED)
- }
- else if( (y2_old>100) && (x_old<X0max) && (x_old>100))
- {
- MOLLA(x_old,X0min+100,y2_old,RED)
- }
- sem_post(&mutex);
-
- x=y2_old-y1_old;
- x=x-20;
- T1=x*k;
- T1_old=T1;
-
- task_endcycle();
-
- }
-}
-
-TASK seleziona(int i)
-{ int w,deltax,deltay,disegna;
-
- eli_occ=0;
- disegna=0;
-
- while (1)
- {
- disegna=0;
- for (w=0;w<5;w++)
- {
- deltax=Pos_pe_x[w]-Pos_x;
- deltay=Pos_pe_y[w]-Pos_y-DIM_PESO-20+DIM_EL;
- if ( (pre_peso[w]==1) && (eli_occ==0) && (deltax<4) && (deltax>-4) && (deltay<3) && (deltay>-3) )
- {
- disegna=1;
- if ( (tastiera=='p') && (libero_peso[w]==1) )
- {
- eli_occ=1;
- peso_agganciato[w]=1;
- n_peso=w;
-
- }
- }
- }
-
- if(disegna==1)
- {
- sem_wait(&mutex);
- grx_box(X0max-90,Y0min+5,X0max-5,Y0min+95,RED);
- // grx_text("Ok", X0max-40, Y0min+50, COL_TESTO, RED);
- sem_post(&mutex);
- } else
- {
- sem_wait(&mutex);
- grx_box(X0max-95,Y0min+5,X0max-5,Y0min+95,COL_SFONDO);
- sem_post(&mutex);
- }
-
- if(eli_occ==1)
- {
- sem_wait(&mutex);
- grx_box(X0max-90-100,Y0min+5,X0max-5-100,Y0min+95,GREEN);
- // grx_text("Go", X0max-35-100, Y0min+50, COL_TESTO, GREEN);
- sem_post(&mutex);
- } else
- {
- sem_wait(&mutex);
- grx_box(X0max-90-100,Y0min+5,X0max-5-100,Y0min+95,COL_SFONDO);
- sem_post(&mutex);
- }
-
-
- if (tastiera=='l') peso_agganciato[n_peso]=0;
-
- task_endcycle();
-
- }
-}
-
-
-//###############################################################
-// ##
-// Funzione di uscita dal programma ##
-// ##
-//################################################################
-void my_end(KEY_EVT* e)
-{
- //####################################
- // Sezione esecutiva della funzione ##
- //####################################
-
- grx_close();
- cprintf("Ctrl-brk pressed!\n");
- sys_end();
-} // Fine della funzionemy_end
-
-//################################################################
-// ##
-// Funzione di uscita dal programma ##
-// ##
-//################################################################
-void end()
-{
- //####################################
- // Sezione esecutiva della funzione ##
- //####################################
-
- grx_close();
-} // Fine della funzione my_end
-
-
-
-//##############################################################
-// ##
-// Main ##
-// ##
-//##############################################################
-int main()
-{
- //########################################
- // Sezione dichiarativa delle variabili ##
- //########################################
- // Identficativi di task generici
- PID pid0, pid1, pid3, pid5; //, pid2,pid4,pid6;
-
- HARD_TASK_MODEL m_hard;
- NRT_TASK_MODEL m_nrt;
-
- // Ascoltatore di eventi
- KEY_EVT emerg;
- // Contatori
- int j;
-
-
- //####################################
- // Sezione esecutiva del main ##
- //####################################
-
- // Inizializzazione dei parametri hartik
- sem_init(&mutex,0,1);
- sem_init(&pu,0,1);
-
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTL_BIT;
- keyb_hook(emerg, my_end);
- sys_atrunlevel(end, NULL, RUNLEVEL_BEFORE_EXIT);
-
- if (grx_open(800, 600, 8) < 0)
- {
- cprintf("GRX Err\n");
- sys_abort(300);
- }
- cprintf("scheda ok\n");
-
- r=0.1;
-
- /* Disposizione degli elementi grafici statici */
- sem_wait(&mutex);
- draw_static();
- sem_post(&mutex);
-
- // Attivazione dei task
- hard_task_default_model(m_hard);
- hard_task_def_wcet(m_hard,1); // wcet ignored!!!
- hard_task_def_usemath(m_hard);
-
- hard_task_def_mit(m_hard,PER_DISEGNA);
- pid0=task_create("elicottero",elicottero,&m_hard,NULL);
- task_activate(pid0);
-
- hard_task_def_mit(m_hard,PER_DISEGNA);
- pid1=task_create("indicometro",disegna_stato,&m_hard,NULL);
- task_activate(pid1);
-
- hard_task_def_mit(m_hard,PER_MOLLA);
- pid3=task_create("molla",molla,&m_hard,NULL);
- task_activate(pid3);
-
- hard_task_def_mit(m_hard,PER_DISEGNA);
- pid5=task_create("seleziona",seleziona,&m_hard,NULL);
- task_activate(pid5);
-
-
- hard_task_def_mit(m_hard,PER_DISEGNA);
- hard_task_def_arg(m_hard,0);
- pid_ruspa[0]=task_create("ruspa",ruspa,&m_hard,NULL);
- task_activate(pid_ruspa[0]);
- n_ruspa=0;
-
- nrt_task_default_model(m_nrt);
- nrt_task_def_usemath(m_nrt);
- nrt_task_def_arg(m_nrt,0);
- pid_kill_e = task_create("kill_task",kill_task, &m_nrt, NULL);
- pid_pulisci_e = task_create("pulisci",pulisci, &m_nrt, NULL);
-
- nrt_task_def_arg(m_nrt,(void *)1);
- pid_kill_p = task_create("kill_task",kill_task, &m_nrt, NULL);
- pid_pulisci_p = task_create("pulisci",pulisci, &m_nrt, NULL);
-
-
-
-
- do {
- tastiera = keyb_getch(BLOCK);
-
- } while(tastiera!=ESC);
-
- task_kill(pid5);
- task_kill(pid3);
- task_kill(pid1);
- task_kill(pid0);
-
- task_kill(pid_kill_p);
- task_kill(pid_kill_e);
-
- if (n_ruspa!=5) task_kill(pid_ruspa[n_ruspa]);
- for(j=0;j<5;j++) { if (pre_peso[j]==1) task_kill(pid_peso[j]); }
-
- grx_close();
- sys_end();
-
- return 0;
-} // Fine del main
-
-/***************************<Fine del file>*******************************/
Index: tags/rel_0_5/eli/makefile
===================================================================
--- tags/rel_0_5/eli/makefile (revision 1657)
+++ tags/rel_0_5/eli/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= eli
-
-include $(BASE)/config/example.mk
-
-eli:
- make -f $(SUBMAKE) APP=eli INIT= OTHEROBJS="initfile.o draw.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
-
Index: tags/rel_0_5/eli/draw.c
===================================================================
--- tags/rel_0_5/eli/draw.c (revision 1657)
+++ tags/rel_0_5/eli/draw.c (nonexistent)
@@ -1,519 +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: draw.c,v 1.1.1.1 2004-05-24 18:03:47 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:47 $
- ------------
-
- This file is similar to the configuration of Hartik 3.3.1
-
-**/
-
-/*
- * Copyright (C) 2000 Paolo Gai and ALLEN-DESTRO
- *
- * 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 "eli.h"
-
-void draw_static()
-{
- int i;
- /************************************/
- /* Sezione esecutiva della funzione */
- /************************************/
-
- grx_rect(X0min,Y0min,X0max,Y0max,COL_CORNICE);
- // grx_rect(X0min+100,Y0min+100,X0max,Y0max,COL_CORNICE);
- grx_line(X0min,Y0min+100,X0min+100,Y0min+100,COL_CORNICE);
- // grx_line(X0min,Y0min+350,X0min+100,Y0min+350,COL_CORNICE);
-
- grx_line(X0min+25,Y0min+100,X0min+25,Y0max,COL_CORNICE);
- grx_line(X0min+50,Y0min+100,X0min+50,Y0max,COL_CORNICE);
- grx_line(X0min+75,Y0min+100,X0min+75,Y0max,COL_CORNICE);
-
- grx_line(X0min,Y0min+100+127,X0min+25,Y0min+100+127,LIGHTBLUE);
- grx_line(X0min+50,Y0min+100+127,X0min+100,Y0min+100+127,LIGHTBLUE);
- grx_line(X0min+50,Y0min+100+127+250,X0min+100,Y0min+100+127+250,LIGHTBLUE);
-
-
- grx_box(X0min+101+50,400,X0min+230+50,Y0max-1,BROWN);
- for(i=1;i<6;i++){
- grx_box(X0min+101+50+38,400+35*i-10,X0min+101+50+48,400+35*i,CYAN);
- grx_box(X0min+101+50+81,400+35*i-10,X0min+101+50+91,400+35*i,CYAN);
- }
- grx_box(X0min+101+50+60,Y0max-30,X0min+101+50+70,Y0max-1,GREEN);
-
-
- grx_box(700,520,X0max-1,Y0max-1,CYAN);
-
-
-
- grx_text("Fx", X0min+5, Y0min+90, COL_TESTO, COL_SFONDO);
- grx_text("Fy", X0min+30, Y0min+90, COL_TESTO, COL_SFONDO);
- grx_text("Ax", X0min+55, Y0min+90, COL_TESTO, COL_SFONDO);
- grx_text("Ay", X0min+80, Y0min+90, COL_TESTO, COL_SFONDO);
- // grx_text("M", X0min+10, Y0min+351, COL_TESTO, COL_SFONDO);
- // grx_text("P", X0min+35, Y0min+351, COL_TESTO, COL_SFONDO);
- grx_text("Vx", X0min+55, Y0min+351, COL_TESTO, COL_SFONDO);
- grx_text("Vy", X0min+80, Y0min+351, COL_TESTO, COL_SFONDO);
-
- grx_text("S : Su", X0min+110, Y0min+15, COL_TESTO, COL_SFONDO);
- grx_text("Z : Sinistra", X0min+110, Y0min+25, COL_TESTO, COL_SFONDO);
- grx_text("X : Giu", X0min+110, Y0min+35, COL_TESTO, COL_SFONDO);
- grx_text("C : Destra", X0min+110, Y0min+45, COL_TESTO, COL_SFONDO);
- grx_text("P : aggancia Peso", X0min+110, Y0min+55, COL_TESTO, COL_SFONDO);
- grx_text("L : Libera peso", X0min+110, Y0min+65, COL_TESTO, COL_SFONDO);
- grx_text("Esc : Usita Programma", X0min+110, Y0min+75, COL_TESTO, COL_SFONDO);
-
-
-} // Fine della funzione draw_static
-
-TASK disegna_stato(int i)
-{ //double j;
-
- while (1)
- {
-
- sem_wait(&mutex);
-
- grx_rect(X0min+100,Y0min+100,X0max,Y0max,COL_CORNICE);
-
- grx_box(700,565,770,Y0max-1,LIGHTCYAN);
-
- grx_box(X0min+101+50,400,X0min+230+50,420,BROWN);
-
-
- //####################### FORZA X #############################
- if ( 0.25<=Forza_x) grx_box(7,Y0min+210,26,Y0min+220,GREEN);
- else grx_box(7,Y0min+210,26,Y0min+220,COL_SFONDO);
- if ( 0.5<=Forza_x) grx_box(7,Y0min+195,26,Y0min+205,GREEN);
- else grx_box(7,Y0min+195,26,Y0min+205,COL_SFONDO);
- if ( 0.75<=Forza_x) grx_box(7,Y0min+180,26,Y0min+190,GREEN);
- else grx_box(7,Y0min+180,26,Y0min+190,COL_SFONDO);
- if ( 1<=Forza_x) grx_box(7,Y0min+165,26,Y0min+175,GREEN);
- else grx_box(7,Y0min+165,26,Y0min+175,COL_SFONDO);
- if ( 1.25<=Forza_x) grx_box(7,Y0min+150,26,Y0min+160,GREEN);
- else grx_box(7,Y0min+150,26,Y0min+160,COL_SFONDO);
- if ( 1.50<=Forza_x) grx_box(7,Y0min+135,26,Y0min+145,YELLOW);
- else grx_box(7,Y0min+135,26,Y0min+145,COL_SFONDO);
- if ( 1.75<=Forza_x) grx_box(7,Y0min+120,26,Y0min+130,RED);
- else grx_box(7,Y0min+120,26,Y0min+130,COL_SFONDO);
- if ( 2<=Forza_x) grx_box(7,Y0min+105,26,Y0min+115,RED);
- else grx_box(7,Y0min+105,26,Y0min+115,COL_SFONDO);
- //########### ------
- if (-0.25>=Forza_x) grx_box(7,Y0min+230,26,Y0min+240,GREEN);
- else grx_box(7,Y0min+230,26,Y0min+240,COL_SFONDO);
- if ( -0.5>=Forza_x) grx_box(7,Y0min+245,26,Y0min+255,GREEN);
- else grx_box(7,Y0min+245,26,Y0min+255,COL_SFONDO);
- if ( -0.75>=Forza_x) grx_box(7,Y0min+260,26,Y0min+270,GREEN);
- else grx_box(7,Y0min+260,26,Y0min+270,COL_SFONDO);
- if ( -1>=Forza_x) grx_box(7,Y0min+275,26,Y0min+285,GREEN);
- else grx_box(7,Y0min+275,26,Y0min+285,COL_SFONDO);
- if ( -1.25>=Forza_x) grx_box(7,Y0min+290,26,Y0min+300,GREEN);
- else grx_box(7,Y0min+290,26,Y0min+300,COL_SFONDO);
- if ( -1.50>=Forza_x) grx_box(7,Y0min+305,26,Y0min+315,YELLOW);
- else grx_box(7,Y0min+305,26,Y0min+315,COL_SFONDO);
- if ( -1.75>=Forza_x) grx_box(7,Y0min+320,26,Y0min+330,RED);
- else grx_box(7,Y0min+320,26,Y0min+330,COL_SFONDO);
- if ( -2>=Forza_x) grx_box(7,Y0min+335,26,Y0min+345,RED);
- else grx_box(7,Y0min+335,26,Y0min+345,COL_SFONDO);
- //####################### FORZA Y #############################
- if ( -0.5>=Forza_y) grx_box(32,Y0min+340,51,Y0min+345,GREEN);
- else grx_box(32,Y0min+340,51,Y0min+345,COL_SFONDO);
- if ( -1>=Forza_y) grx_box(32,Y0min+333,51,Y0min+338,GREEN);
- else grx_box(32,Y0min+333,51,Y0min+338,COL_SFONDO);
- if ( -1.5>=Forza_y) grx_box(32,Y0min+326,51,Y0min+331,GREEN);
- else grx_box(32,Y0min+326,51,Y0min+331,COL_SFONDO);
- if ( -2>=Forza_y) grx_box(32,Y0min+319,51,Y0min+324,GREEN);
- else grx_box(32,Y0min+319,51,Y0min+324,COL_SFONDO);
- if ( -2.5>=Forza_y) grx_box(32,Y0min+312,51,Y0min+317,GREEN);
- else grx_box(32,Y0min+312,51,Y0min+317,COL_SFONDO);
- if ( -3>=Forza_y) grx_box(32,Y0min+305,51,Y0min+310,GREEN);
- else grx_box(32,Y0min+305,51,Y0min+310,COL_SFONDO);
- if ( -3.5>=Forza_y) grx_box(32,Y0min+298,51,Y0min+303,GREEN);
- else grx_box(32,Y0min+298,51,Y0min+303,COL_SFONDO);
- if ( -4>=Forza_y) grx_box(32,Y0min+291,51,Y0min+296,GREEN);
- else grx_box(32,Y0min+291,51,Y0min+296,COL_SFONDO);
- if ( -4.5>=Forza_y) grx_box(32,Y0min+284,51,Y0min+289,GREEN);
- else grx_box(32,Y0min+284,51,Y0min+289,COL_SFONDO);
- if ( -5>=Forza_y) grx_box(32,Y0min+277,51,Y0min+282,GREEN);
- else grx_box(32,Y0min+277,51,Y0min+282,COL_SFONDO);
- if ( -5.5>=Forza_y) grx_box(32,Y0min+270,51,Y0min+275,GREEN);
- else grx_box(32,Y0min+270,51,Y0min+275,COL_SFONDO);
- if ( -6>=Forza_y) grx_box(32,Y0min+263,51,Y0min+268,GREEN);
- else grx_box(32,Y0min+263,51,Y0min+268,COL_SFONDO);
- if ( -6.5>=Forza_y) grx_box(32,Y0min+256,51,Y0min+261,GREEN);
- else grx_box(32,Y0min+256,51,Y0min+261,COL_SFONDO);
- if ( -7>=Forza_y) grx_box(32,Y0min+249,51,Y0min+254,GREEN);
- else grx_box(32,Y0min+249,51,Y0min+254,COL_SFONDO);
- if ( -7.5>=Forza_y) grx_box(32,Y0min+242,51,Y0min+247,GREEN);
- else grx_box(32,Y0min+242,51,Y0min+247,COL_SFONDO);
- if ( -8>=Forza_y) grx_box(32,Y0min+235,51,Y0min+240,GREEN);
- else grx_box(32,Y0min+235,51,Y0min+240,COL_SFONDO);
- if ( -8.5>=Forza_y) grx_box(32,Y0min+228,51,Y0min+233,GREEN);
- else grx_box(32,Y0min+228,51,Y0min+233,COL_SFONDO);
- if ( -9>=Forza_y) grx_box(32,Y0min+221,51,Y0min+226,GREEN);
- else grx_box(32,Y0min+221,51,Y0min+226,COL_SFONDO);
- if ( -9.5>=Forza_y) grx_box(32,Y0min+214,51,Y0min+219,GREEN);
- else grx_box(32,Y0min+214,51,Y0min+219,COL_SFONDO);
- if ( -10>=Forza_y) grx_box(32,Y0min+207,51,Y0min+212,GREEN);
- else grx_box(32,Y0min+207,51,Y0min+212,COL_SFONDO);
- if ( -10.5>=Forza_y) grx_box(32,Y0min+200,51,Y0min+205,GREEN);
- else grx_box(32,Y0min+200,51,Y0min+205,COL_SFONDO);
- if ( -11>=Forza_y) grx_box(32,Y0min+193,51,Y0min+198,GREEN);
- else grx_box(32,Y0min+193,51,Y0min+198,COL_SFONDO);
- if ( -11.5>=Forza_y) grx_box(32,Y0min+186,51,Y0min+191,GREEN);
- else grx_box(32,Y0min+186,51,Y0min+191,COL_SFONDO);
- if ( -12>=Forza_y) grx_box(32,Y0min+179,51,Y0min+184,GREEN);
- else grx_box(32,Y0min+179,51,Y0min+184,COL_SFONDO);
- if ( -12.5>=Forza_y) grx_box(32,Y0min+172,51,Y0min+177,GREEN);
- else grx_box(32,Y0min+172,51,Y0min+177,COL_SFONDO);
- if ( -13>=Forza_y) grx_box(32,Y0min+165,51,Y0min+170,GREEN);
- else grx_box(32,Y0min+165,51,Y0min+170,COL_SFONDO);
- if ( -13.5>=Forza_y) grx_box(32,Y0min+158,51,Y0min+163,GREEN);
- else grx_box(32,Y0min+158,51,Y0min+163,COL_SFONDO);
- if ( -14>=Forza_y) grx_box(32,Y0min+151,51,Y0min+156,GREEN);
- else grx_box(32,Y0min+151,51,Y0min+156,COL_SFONDO);
- if ( -14.5>=Forza_y) grx_box(32,Y0min+144,51,Y0min+149,GREEN);
- else grx_box(32,Y0min+144,51,Y0min+149,COL_SFONDO);
- if ( -15>=Forza_y) grx_box(32,Y0min+137,51,Y0min+142,YELLOW);
- else grx_box(32,Y0min+137,51,Y0min+142,COL_SFONDO);
- if ( -15.5>=Forza_y) grx_box(32,Y0min+130,51,Y0min+135,YELLOW);
- else grx_box(32,Y0min+130,51,Y0min+135,COL_SFONDO);
- if ( -16>=Forza_y) grx_box(32,Y0min+123,51,Y0min+128,RED);
- else grx_box(32,Y0min+123,51,Y0min+128,COL_SFONDO);
- if ( -16.5>=Forza_y) grx_box(32,Y0min+116,51,Y0min+121,RED);
- else grx_box(32,Y0min+116,51,Y0min+121,COL_SFONDO);
- if ( -17>=Forza_y) grx_box(32,Y0min+109,51,Y0min+114,RED);
- else grx_box(32,Y0min+109,51,Y0min+114,COL_SFONDO);
- if ( -17.5>=Forza_y) grx_box(32,Y0min+102,51,Y0min+107,RED);
- else grx_box(32,Y0min+102,51,Y0min+107,COL_SFONDO);
-
- //####################### ACCELERAZIONE X #############################
- if ( -2.125>=Acc_x)grx_box(56,Y0min+340,75,Y0min+345,RED);
- else grx_box(55,Y0min+340,75,Y0min+345,COL_SFONDO);
- if ( -2>=Acc_x) grx_box(56,Y0min+333,75,Y0min+338,RED);
- else grx_box(56,Y0min+333,75,Y0min+338,COL_SFONDO);
- if ( -1.875>=Acc_x)grx_box(56,Y0min+326,75,Y0min+331,RED);
- else grx_box(56,Y0min+326,75,Y0min+331,COL_SFONDO);
- if ( -1.750>=Acc_x) grx_box(56,Y0min+319,75,Y0min+324,YELLOW);
- else grx_box(56,Y0min+319,75,Y0min+324,COL_SFONDO);
- if ( -1.625>=Acc_x)grx_box(56,Y0min+312,75,Y0min+317,YELLOW);
- else grx_box(56,Y0min+312,75,Y0min+317,COL_SFONDO);
- if ( -1.5>=Acc_x) grx_box(56,Y0min+305,75,Y0min+310,GREEN);
- else grx_box(56,Y0min+305,75,Y0min+310,COL_SFONDO);
- if ( -1.375>=Acc_x)grx_box(56,Y0min+298,75,Y0min+303,GREEN);
- else grx_box(56,Y0min+298,75,Y0min+303,COL_SFONDO);
- if ( -1.250>=Acc_x) grx_box(56,Y0min+291,75,Y0min+296,GREEN);
- else grx_box(56,Y0min+291,75,Y0min+296,COL_SFONDO);
- if ( -1.125>=Acc_x)grx_box(56,Y0min+284,75,Y0min+289,GREEN);
- else grx_box(56,Y0min+284,75,Y0min+289,COL_SFONDO);
- if ( -1>=Acc_x) grx_box(56,Y0min+277,75,Y0min+282,GREEN);
- else grx_box(56,Y0min+277,75,Y0min+282,COL_SFONDO);
- if ( -0.875>=Acc_x)grx_box(56,Y0min+270,75,Y0min+275,GREEN);
- else grx_box(56,Y0min+270,75,Y0min+275,COL_SFONDO);
- if ( -0.750>=Acc_x) grx_box(56,Y0min+263,75,Y0min+268,GREEN);
- else grx_box(56,Y0min+263,75,Y0min+268,COL_SFONDO);
- if ( -0.625>=Acc_x)grx_box(56,Y0min+256,75,Y0min+261,GREEN);
- else grx_box(56,Y0min+256,75,Y0min+261,COL_SFONDO);
- if ( -0.5>=Acc_x) grx_box(56,Y0min+249,75,Y0min+254,GREEN);
- else grx_box(56,Y0min+249,75,Y0min+254,COL_SFONDO);
- if ( -0.375>=Acc_x)grx_box(56,Y0min+242,75,Y0min+247,GREEN);
- else grx_box(56,Y0min+242,75,Y0min+247,COL_SFONDO);
- if ( -0.250>=Acc_x) grx_box(56,Y0min+235,75,Y0min+240,GREEN);
- else grx_box(56,Y0min+235,75,Y0min+240,COL_SFONDO);
- if ( -0.125>=Acc_x)grx_box(56,Y0min+228,75,Y0min+233,GREEN);
- else grx_box(56,Y0min+228,75,Y0min+233,COL_SFONDO);
- //############# ------
- if ( 0.125<=Acc_x) grx_box(56,Y0min+221,75,Y0min+226,GREEN);
- else grx_box(56,Y0min+221,75,Y0min+226,COL_SFONDO);
- if ( 0.250<=Acc_x)grx_box(56,Y0min+214,75,Y0min+219,GREEN);
- else grx_box(56,Y0min+214,75,Y0min+219,COL_SFONDO);
- if ( 0.375<=Acc_x) grx_box(56,Y0min+207,75,Y0min+212,GREEN);
- else grx_box(56,Y0min+207,75,Y0min+212,COL_SFONDO);
- if (0.5<=Acc_x)grx_box(56,Y0min+200,75,Y0min+205,GREEN);
- else grx_box(56,Y0min+200,75,Y0min+205,COL_SFONDO);
- if ( 0.625<=Acc_x) grx_box(56,Y0min+193,75,Y0min+198,GREEN);
- else grx_box(56,Y0min+193,75,Y0min+198,COL_SFONDO);
- if (0.750<=Acc_x)grx_box(56,Y0min+186,75,Y0min+191,GREEN);
- else grx_box(56,Y0min+186,75,Y0min+191,COL_SFONDO);
- if (0.875<=Acc_x) grx_box(56,Y0min+179,75,Y0min+184,GREEN);
- else grx_box(56,Y0min+179,75,Y0min+184,COL_SFONDO);
- if (1<=Acc_x)grx_box(56,Y0min+172,75,Y0min+177,GREEN);
- else grx_box(56,Y0min+172,75,Y0min+177,COL_SFONDO);
- if (1.125<=Acc_x) grx_box(56,Y0min+165,75,Y0min+170,GREEN);
- else grx_box(56,Y0min+165,75,Y0min+170,COL_SFONDO);
- if (1.250<=Acc_x)grx_box(56,Y0min+158,75,Y0min+163,GREEN);
- else grx_box(56,Y0min+158,75,Y0min+163,COL_SFONDO);
- if (1.375<=Acc_x) grx_box(56,Y0min+151,75,Y0min+156,GREEN);
- else grx_box(56,Y0min+151,75,Y0min+156,COL_SFONDO);
- if (1.5<=Acc_x)grx_box(56,Y0min+144,75,Y0min+149,GREEN);
- else grx_box(56,Y0min+144,75,Y0min+149,COL_SFONDO);
- if (1.625<=Acc_x) grx_box(56,Y0min+137,75,Y0min+142,YELLOW);
- else grx_box(56,Y0min+137,75,Y0min+142,COL_SFONDO);
- if (1.750<=Acc_x)grx_box(56,Y0min+130,75,Y0min+135,YELLOW);
- else grx_box(56,Y0min+130,75,Y0min+135,COL_SFONDO);
- if (1.875<=Acc_x) grx_box(56,Y0min+123,75,Y0min+128,RED);
- else grx_box(56,Y0min+123,75,Y0min+128,COL_SFONDO);
- if (2<=Acc_x)grx_box(56,Y0min+116,75,Y0min+121,RED);
- else grx_box(56,Y0min+116,75,Y0min+121,COL_SFONDO);
- if (2.125<=Acc_x) grx_box(56,Y0min+109,75,Y0min+114,RED);
- else grx_box(56,Y0min+109,75,Y0min+114,COL_SFONDO);
- //####################### ACCELERAZIONE Y #############################
- if ( 2.5<=Acc_y) { grx_box(81,Y0min+340,100,Y0min+345,RED);
- grx_box(81+5,Y0min+340+1,100-5,Y0min+345-1,BLUE);
- }
- else grx_box(81,Y0min+340,100,Y0min+345,COL_SFONDO);
- if ( 2.200<=Acc_y) grx_box(81,Y0min+333,100,Y0min+338,RED);
- else grx_box(81,Y0min+333,100,Y0min+338,COL_SFONDO);
- if ( 1.950<=Acc_y) grx_box(81,Y0min+326,100,Y0min+331,RED);
- else grx_box(81,Y0min+326,100,Y0min+331,COL_SFONDO);
- if ( 1.750<=Acc_y) grx_box(81,Y0min+319,100,Y0min+324,YELLOW);
- else grx_box(81,Y0min+319,100,Y0min+324,COL_SFONDO);
- if ( 1.625<=Acc_y) grx_box(81,Y0min+312,100,Y0min+317,YELLOW);
- else grx_box(81,Y0min+312,100,Y0min+317,COL_SFONDO);
- if ( 1.5<=Acc_y) grx_box(81,Y0min+305,100,Y0min+310,GREEN);
- else grx_box(81,Y0min+305,100,Y0min+310,COL_SFONDO);
- if ( 1.375<=Acc_y) grx_box(81,Y0min+298,100,Y0min+303,GREEN);
- else grx_box(81,Y0min+298,100,Y0min+303,COL_SFONDO);
- if ( 1.250<=Acc_y) grx_box(81,Y0min+291,100,Y0min+296,GREEN);
- else grx_box(81,Y0min+291,100,Y0min+296,COL_SFONDO);
- if ( 1.125<=Acc_y) grx_box(81,Y0min+284,100,Y0min+289,GREEN);
- else grx_box(81,Y0min+284,100,Y0min+289,COL_SFONDO);
- if ( 1<=Acc_y) grx_box(81,Y0min+277,100,Y0min+282,GREEN);
- else grx_box(81,Y0min+277,100,Y0min+282,COL_SFONDO);
- if ( 0.875<=Acc_y) grx_box(81,Y0min+270,100,Y0min+275,GREEN);
- else grx_box(81,Y0min+270,100,Y0min+275,COL_SFONDO);
- if ( 0.750<=Acc_y) grx_box(81,Y0min+263,100,Y0min+268,GREEN);
- else grx_box(81,Y0min+263,100,Y0min+268,COL_SFONDO);
- if ( 0.625<=Acc_y) grx_box(81,Y0min+256,100,Y0min+261,GREEN);
- else grx_box(81,Y0min+256,100,Y0min+261,COL_SFONDO);
- if ( 0.5<=Acc_y) grx_box(81,Y0min+249,100,Y0min+254,GREEN);
- else grx_box(81,Y0min+249,100,Y0min+254,COL_SFONDO);
- if ( 0.375<=Acc_y) grx_box(81,Y0min+242,100,Y0min+247,GREEN);
- else grx_box(81,Y0min+242,100,Y0min+247,COL_SFONDO);
- if ( 0.25<=Acc_y) grx_box(81,Y0min+235,100,Y0min+240,GREEN);
- else grx_box(81,Y0min+235,100,Y0min+240,COL_SFONDO);
- if ( 0.125<=Acc_y) grx_box(81,Y0min+228,100,Y0min+233,GREEN);
- else grx_box(81,Y0min+228,100,Y0min+233,COL_SFONDO);
- //############# ------
- if ( -0.125>=Acc_y) grx_box(81,Y0min+221,100,Y0min+226,GREEN);
- else grx_box(81,Y0min+221,100,Y0min+226,COL_SFONDO);
- if ( -0.250>=Acc_y) grx_box(81,Y0min+214,100,Y0min+219,GREEN);
- else grx_box(81,Y0min+214,100,Y0min+219,COL_SFONDO);
- if ( -0.375>=Acc_y) grx_box(81,Y0min+207,100,Y0min+212,GREEN);
- else grx_box(81,Y0min+207,100,Y0min+212,COL_SFONDO);
- if (-0.5>=Acc_y) grx_box(81,Y0min+200,100,Y0min+205,GREEN);
- else grx_box(81,Y0min+200,100,Y0min+205,COL_SFONDO);
- if ( -0.625>=Acc_y) grx_box(81,Y0min+193,100,Y0min+198,GREEN);
- else grx_box(81,Y0min+193,100,Y0min+198,COL_SFONDO);
- if (-0.750>=Acc_y) grx_box(81,Y0min+186,100,Y0min+191,GREEN);
- else grx_box(81,Y0min+186,100,Y0min+191,COL_SFONDO);
- if (-0.875>=Acc_y) grx_box(81,Y0min+179,100,Y0min+184,GREEN);
- else grx_box(81,Y0min+179,100,Y0min+184,COL_SFONDO);
- if (-1>=Acc_y) grx_box(81,Y0min+172,100,Y0min+177,GREEN);
- else grx_box(81,Y0min+172,100,Y0min+177,COL_SFONDO);
- if (-1.125>=Acc_y) grx_box(81,Y0min+165,100,Y0min+170,YELLOW);
- else grx_box(81,Y0min+165,100,Y0min+170,COL_SFONDO);
- if (-1.250>=Acc_y) grx_box(81,Y0min+158,100,Y0min+163,YELLOW);
- else grx_box(81,Y0min+158,100,Y0min+163,COL_SFONDO);
- if (-1.375>=Acc_y) grx_box(81,Y0min+151,100,Y0min+156,YELLOW);
- else grx_box(81,Y0min+151,100,Y0min+156,COL_SFONDO);
- if (-1.5>=Acc_y) grx_box(81,Y0min+144,100,Y0min+149,YELLOW);
- else grx_box(81,Y0min+144,100,Y0min+149,COL_SFONDO);
- if (-1.625>=Acc_y) grx_box(81,Y0min+137,100,Y0min+142,RED);
- else grx_box(81,Y0min+137,100,Y0min+142,COL_SFONDO);
- if (-1.750>=Acc_y) grx_box(81,Y0min+130,100,Y0min+135,RED);
- else grx_box(81,Y0min+130,100,Y0min+135,COL_SFONDO);
- if (-1.875>=Acc_y) grx_box(81,Y0min+123,100,Y0min+128,RED);
- else grx_box(81,Y0min+123,100,Y0min+128,COL_SFONDO);
- if (-2>=Acc_y) grx_box(81,Y0min+116,100,Y0min+121,RED);
- else grx_box(81,Y0min+116,100,Y0min+121,COL_SFONDO);
- if (-2.3>=Acc_y) grx_box(81,Y0min+109,100,Y0min+114,RED);
- else grx_box(81,Y0min+109,100,Y0min+114,COL_SFONDO);
- //####################### VELOCITA X #############################
- //if ( -21.25>=Velocita_x)grx_box(56,Y0min+340+250,75,Y0min+345+250,RED);
- //else grx_box(55,Y0min+340+250,75,Y0min+345+250,COL_SFONDO);
- if ( -20>=Velocita_x) grx_box(56,Y0min+333+250,75,Y0min+338+250,RED);
- else grx_box(56,Y0min+333+250,75,Y0min+338+250,COL_SFONDO);
- if ( -18.75>=Velocita_x)grx_box(56,Y0min+326+250,75,Y0min+331+250,RED);
- else grx_box(56,Y0min+326+250,75,Y0min+331+250,COL_SFONDO);
- if ( -17.50>=Velocita_x)grx_box(56,Y0min+319+250,75,Y0min+324+250,YELLOW);
- else grx_box(56,Y0min+319+250,75,Y0min+324+250,COL_SFONDO);
- if ( -16.25>=Velocita_x)grx_box(56,Y0min+312+250,75,Y0min+317+250,YELLOW);
- else grx_box(56,Y0min+312+250,75,Y0min+317+250,COL_SFONDO);
- if ( -15>=Velocita_x) grx_box(56,Y0min+305+250,75,Y0min+310+250,GREEN);
- else grx_box(56,Y0min+305+250,75,Y0min+310+250,COL_SFONDO);
- if ( -13.75>=Velocita_x)grx_box(56,Y0min+298+250,75,Y0min+303+250,GREEN);
- else grx_box(56,Y0min+298+250,75,Y0min+303+250,COL_SFONDO);
- if ( -12.50>=Velocita_x)grx_box(56,Y0min+291+250,75,Y0min+296+250,GREEN);
- else grx_box(56,Y0min+291+250,75,Y0min+296+250,COL_SFONDO);
- if ( -11.25>=Velocita_x)grx_box(56,Y0min+284+250,75,Y0min+289+250,GREEN);
- else grx_box(56,Y0min+284+250,75,Y0min+289+250,COL_SFONDO);
- if ( -10>=Velocita_x) grx_box(56,Y0min+277+250,75,Y0min+282+250,GREEN);
- else grx_box(56,Y0min+277+250,75,Y0min+282+250,COL_SFONDO);
- if ( -8.75>=Velocita_x)grx_box(56,Y0min+270+250,75,Y0min+275+250,GREEN);
- else grx_box(56,Y0min+270+250,75,Y0min+275+250,COL_SFONDO);
- if ( -7.50>=Velocita_x)grx_box(56,Y0min+263+250,75,Y0min+268+250,GREEN);
- else grx_box(56,Y0min+263+250,75,Y0min+268+250,COL_SFONDO);
- if ( -6.25>=Velocita_x)grx_box(56,Y0min+256+250,75,Y0min+261+250,GREEN);
- else grx_box(56,Y0min+256+250,75,Y0min+261+250,COL_SFONDO);
- if ( -5>=Velocita_x) grx_box(56,Y0min+249+250,75,Y0min+254+250,GREEN);
- else grx_box(56,Y0min+249+250,75,Y0min+254+250,COL_SFONDO);
- if ( -3.75>=Velocita_x)grx_box(56,Y0min+242+250,75,Y0min+247+250,GREEN);
- else grx_box(56,Y0min+242+250,75,Y0min+247+250,COL_SFONDO);
- if ( -2.50>=Velocita_x)grx_box(56,Y0min+235+250,75,Y0min+240+250,GREEN);
- else grx_box(56,Y0min+235+250,75,Y0min+240+250,COL_SFONDO);
- if ( -1.25>=Velocita_x)grx_box(56,Y0min+228+250,75,Y0min+233+250,GREEN);
- else grx_box(56,Y0min+228+250,75,Y0min+233+250,COL_SFONDO);
- //############# ------
- if ( 1.25<=Velocita_x) grx_box(56,Y0min+221+250,75,Y0min+226+250,GREEN);
- else grx_box(56,Y0min+221+250,75,Y0min+226+250,COL_SFONDO);
- if ( 2.50<=Velocita_x) grx_box(56,Y0min+214+250,75,Y0min+219+250,GREEN);
- else grx_box(56,Y0min+214+250,75,Y0min+219+250,COL_SFONDO);
- if ( 3.75<=Velocita_x) grx_box(56,Y0min+207+250,75,Y0min+212+250,GREEN);
- else grx_box(56,Y0min+207+250,75,Y0min+212+250,COL_SFONDO);
- if (5<=Velocita_x) grx_box(56,Y0min+200+250,75,Y0min+205+250,GREEN);
- else grx_box(56,Y0min+200+250,75,Y0min+205+250,COL_SFONDO);
- if ( 6.25<=Velocita_x) grx_box(56,Y0min+193+250,75,Y0min+198+250,GREEN);
- else grx_box(56,Y0min+193+250,75,Y0min+198+250,COL_SFONDO);
- if (7.50<=Velocita_x) grx_box(56,Y0min+186+250,75,Y0min+191+250,GREEN);
- else grx_box(56,Y0min+186+250,75,Y0min+191+250,COL_SFONDO);
- if (8.75<=Velocita_x) grx_box(56,Y0min+179+250,75,Y0min+184+250,GREEN);
- else grx_box(56,Y0min+179+250,75,Y0min+184+250,COL_SFONDO);
- if (10<=Velocita_x) grx_box(56,Y0min+172+250,75,Y0min+177+250,GREEN);
- else grx_box(56,Y0min+172+250,75,Y0min+177+250,COL_SFONDO);
- if (11.25<=Velocita_x) grx_box(56,Y0min+165+250,75,Y0min+170+250,GREEN);
- else grx_box(56,Y0min+165+250,75,Y0min+170+250,COL_SFONDO);
- if (12.50<=Velocita_x) grx_box(56,Y0min+158+250,75,Y0min+163+250,GREEN);
- else grx_box(56,Y0min+158+250,75,Y0min+163+250,COL_SFONDO);
- if (13.75<=Velocita_x) grx_box(56,Y0min+151+250,75,Y0min+156+250,GREEN);
- else grx_box(56,Y0min+151+250,75,Y0min+156+250,COL_SFONDO);
- if (15<=Velocita_x) grx_box(56,Y0min+144+250,75,Y0min+149+250,GREEN);
- else grx_box(56,Y0min+144+250,75,Y0min+149+250,COL_SFONDO);
- if (16.25<=Velocita_x) grx_box(56,Y0min+137+250,75,Y0min+142+250,YELLOW);
- else grx_box(56,Y0min+137+250,75,Y0min+142+250,COL_SFONDO);
- if (17.50<=Velocita_x) grx_box(56,Y0min+130+250,75,Y0min+135+250,YELLOW);
- else grx_box(56,Y0min+130+250,75,Y0min+135+250,COL_SFONDO);
- if (18.75<=Velocita_x) grx_box(56,Y0min+123+250,75,Y0min+128+250,RED);
- else grx_box(56,Y0min+123+250,75,Y0min+128+250,COL_SFONDO);
- if (20<=Velocita_x) grx_box(56,Y0min+116+250,75,Y0min+121+250,RED);
- else grx_box(56,Y0min+116+250,75,Y0min+121+250,COL_SFONDO);
- if (21.25<=Velocita_x) grx_box(56,Y0min+109+250,75,Y0min+114+250,RED);
- else grx_box(56,Y0min+109+250,75,Y0min+114+250,COL_SFONDO);
-
- //####################### VELOCITA Y #############################
- // if ( 160<=Velocita_y)grx_box(81,Y0min+340+250,100,Y0min+345+250,RED);
- // else grx_box(81,Y0min+340+250,100,Y0min+345+250,COL_SFONDO);
- if ( 40<=Velocita_y) grx_box(81,Y0min+333+250,100,Y0min+338+250,RED);
- else grx_box(81,Y0min+333+250,100,Y0min+338+250,COL_SFONDO);
- if ( 37.5<=Velocita_y)grx_box(81,Y0min+326+250,100,Y0min+331+250,RED);
- else grx_box(81,Y0min+326+250,100,Y0min+331+250,COL_SFONDO);
- if ( 35<=Velocita_y)grx_box(81,Y0min+319+250,100,Y0min+324+250,YELLOW);
- else grx_box(81,Y0min+319+250,100,Y0min+324+250,COL_SFONDO);
- if ( 32.5<=Velocita_y)grx_box(81,Y0min+312+250,100,Y0min+317+250,YELLOW);
- else grx_box(81,Y0min+312+250,100,Y0min+317+250,COL_SFONDO);
- if ( 30<=Velocita_y) grx_box(81,Y0min+305+250,100,Y0min+310+250,GREEN);
- else grx_box(81,Y0min+305+250,100,Y0min+310+250,COL_SFONDO);
- if ( 27.5<=Velocita_y)grx_box(81,Y0min+298+250,100,Y0min+303+250,GREEN);
- else grx_box(81,Y0min+298+250,100,Y0min+303+250,COL_SFONDO);
- if ( 25<=Velocita_y)grx_box(81,Y0min+291+250,100,Y0min+296+250,GREEN);
- else grx_box(81,Y0min+291+250,100,Y0min+296+250,COL_SFONDO);
- if ( 22.5<=Velocita_y)grx_box(81,Y0min+284+250,100,Y0min+289+250,GREEN);
- else grx_box(81,Y0min+284+250,100,Y0min+289+250,COL_SFONDO);
- if ( 20<=Velocita_y) grx_box(81,Y0min+277+250,100,Y0min+282+250,GREEN);
- else grx_box(81,Y0min+277+250,100,Y0min+282+250,COL_SFONDO);
- if ( 17.5<=Velocita_y) grx_box(81,Y0min+270+250,100,Y0min+275+250,GREEN);
- else grx_box(81,Y0min+270+250,100,Y0min+275+250,COL_SFONDO);
- if ( 15<=Velocita_y) grx_box(81,Y0min+263+250,100,Y0min+268+250,GREEN);
- else grx_box(81,Y0min+263+250,100,Y0min+268+250,COL_SFONDO);
- if ( 12.5<=Velocita_y) grx_box(81,Y0min+256+250,100,Y0min+261+250,GREEN);
- else grx_box(81,Y0min+256+250,100,Y0min+261+250,COL_SFONDO);
- if ( 10<=Velocita_y) grx_box(81,Y0min+249+250,100,Y0min+254+250,GREEN);
- else grx_box(81,Y0min+249+250,100,Y0min+254+250,COL_SFONDO);
- if ( 7.5<=Velocita_y) grx_box(81,Y0min+242+250,100,Y0min+247+250,GREEN);
- else grx_box(81,Y0min+242+250,100,Y0min+247+250,COL_SFONDO);
- if ( 5<=Velocita_y) grx_box(81,Y0min+235+250,100,Y0min+240+250,GREEN);
- else grx_box(81,Y0min+235+250,100,Y0min+240+250,COL_SFONDO);
- if ( 2.5<=Velocita_y) grx_box(81,Y0min+228+250,100,Y0min+233+250,GREEN);
- else grx_box(81,Y0min+228+250,100,Y0min+233+250,COL_SFONDO);
- //############# ------
- if (-2.5>=Velocita_y) grx_box(81,Y0min+221+250,100,Y0min+226+250,GREEN);
- else grx_box(81,Y0min+221+250,100,Y0min+226+250,COL_SFONDO);
- if (-5>=Velocita_y) grx_box(81,Y0min+214+250,100,Y0min+219+250,GREEN);
- else grx_box(81,Y0min+214+250,100,Y0min+219+250,COL_SFONDO);
- if (-7.5>=Velocita_y) grx_box(81,Y0min+207+250,100,Y0min+212+250,GREEN);
- else grx_box(81,Y0min+207+250,100,Y0min+212+250,COL_SFONDO);
- if (-10>=Velocita_y) grx_box(81,Y0min+200+250,100,Y0min+205+250,GREEN);
- else grx_box(81,Y0min+200+250,100,Y0min+205+250,COL_SFONDO);
- if (-12.5>=Velocita_y) grx_box(81,Y0min+193+250,100,Y0min+198+250,GREEN);
- else grx_box(81,Y0min+193+250,100,Y0min+198+250,COL_SFONDO);
- if (-15>=Velocita_y) grx_box(81,Y0min+186+250,100,Y0min+191+250,GREEN);
- else grx_box(81,Y0min+186+250,100,Y0min+191+250,COL_SFONDO);
- if (-17.5>=Velocita_y) grx_box(81,Y0min+179+250,100,Y0min+184+250,GREEN);
- else grx_box(81,Y0min+179+250,100,Y0min+184+250,COL_SFONDO);
- if (-20>=Velocita_y) grx_box(81,Y0min+172+250,100,Y0min+177+250,GREEN);
- else grx_box(81,Y0min+172+250,100,Y0min+177+250,COL_SFONDO);
- if (-22.5>=Velocita_y) grx_box(81,Y0min+165+250,100,Y0min+170+250,GREEN);
- else grx_box(81,Y0min+165+250,100,Y0min+170+250,COL_SFONDO);
- if (-25>=Velocita_y) grx_box(81,Y0min+158+250,100,Y0min+163+250,GREEN);
- else grx_box(81,Y0min+158+250,100,Y0min+163+250,COL_SFONDO);
- if (-27.5>=Velocita_y) grx_box(81,Y0min+151+250,100,Y0min+156+250,GREEN);
- else grx_box(81,Y0min+151+250,100,Y0min+156+250,COL_SFONDO);
- if (-30>=Velocita_y) grx_box(81,Y0min+144+250,100,Y0min+149+250,GREEN);
- else grx_box(81,Y0min+144+250,100,Y0min+149+250,COL_SFONDO);
- if (-32.5>=Velocita_y) grx_box(81,Y0min+137+250,100,Y0min+142+250,YELLOW);
- else grx_box(81,Y0min+137+250,100,Y0min+142+250,COL_SFONDO);
- if (-35>=Velocita_y) grx_box(81,Y0min+130+250,100,Y0min+135+250,YELLOW);
- else grx_box(81,Y0min+130+250,100,Y0min+135+250,COL_SFONDO);
- if (-37.5>=Velocita_y) grx_box(81,Y0min+123+250,100,Y0min+128+250,RED);
- else grx_box(81,Y0min+123+250,100,Y0min+128+250,COL_SFONDO);
- if (-40>=Velocita_y) grx_box(81,Y0min+116+250,100,Y0min+121+250,RED);
- else grx_box(81,Y0min+116+250,100,Y0min+121+250,COL_SFONDO);
- if (-42.5>=Velocita_y) grx_box(81,Y0min+109+250,100,Y0min+114+250,RED);
- else grx_box(81,Y0min+109+250,100,Y0min+114+250,COL_SFONDO);
-
-
- sem_post(&mutex);
-
-
- task_endcycle();
- }
-}
-
-
Index: tags/rel_0_5/eli/eli.h
===================================================================
--- tags/rel_0_5/eli/eli.h (revision 1657)
+++ tags/rel_0_5/eli/eli.h (nonexistent)
@@ -1,173 +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: eli.h,v 1.1.1.1 2004-05-24 18:03:47 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:47 $
- ------------
-
- This file is similar to the configuration of Hartik 3.3.1
-
-**/
-
-/*
- * Copyright (C) 2000 ALLEN-DESTRO and 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
- *
- */
-
-
-/***************************************/
-/* Corso di Informatica Industriale */
-/* Libreria con le funzioni di disegno */
-/* Creata da ALLEN-DESTRO */
-/***************************************/
-
-//########################################
-// Librerie standard del linguaggio C
-//#######################################
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-//########################################
-// Librerie Hartik
-//########################################
-#include <kernel/kern.h>
-#include <drivers/glib.h>
-#include <drivers/keyb.h>
-#include <ll/i386/cons.h>
-#include <semaphore.h>
-
-//########################################
-// Definizione delle costanti del programma
-//########################################
-
-#define PER_DISEGNA 100000
-#define PER_MOLLA 100000
-#define PER_KILL 200000
-#define G 10
-#define DIM_EL 12
-#define DIM_PESO 10
-#define COL_EL YELLOW
-
-
-#define X0min 4 // Ascissa minima della finestra grafica
-#define Y0min 4 // Ordinata minima della finestra grafica
-#define X0max 796 // Ascissa massima della finestra grafica
-#define Y0max 596 // Ordinata massima della finestra grafica
-#define TERRA 400 // Ordinata della pista di atteraggio
-#define COL_SFONDO 0 // Colore di sfondo della finestra grafica
-#define COL_TESTO 7 // Colore del testo della finestra grafica
-#define COL_CORNICE RED // Colore cornici della finestra grafica
-#define DELTA_COL 32
-
-
-// Valore di pigreco
-#define PIGRECO 3.14159
-
-#define ELICOTTERO_S(x,y,dim,col,sfo) grx_disc(x,y,dim,col); \
- grx_box(x-dim,y,x+dim,y+dim,sfo); \
- grx_line(x-dim*2,y-dim,x+dim*2,y-dim,col); \
- grx_box(x-dim,y,x+(dim*2),y+(dim/3),col); \
- grx_line(x-dim,y+dim/2,x+2*dim,y+dim/2,col); \
- grx_circle(x+dim*2,y,dim/2,col); \
- grx_box(x-dim/10,y,x+dim/10,y+dim/2,col)
-
-#define ELICOTTERO_D(x,y,dim,col,sfo) grx_disc(x,y,dim,col); \
- grx_box(x-dim,y,x+dim,y+dim,sfo); \
- grx_line(x-dim*2,y-dim,x+dim*2,y-dim,col); \
- grx_box(x-(dim*2),y,x+dim,y+(dim/3),col); \
- grx_line(x-2*dim,y+dim/2,x+dim,y+dim/2,col); \
- grx_circle(x-dim*2,y,dim/2,col); \
- grx_box(x-dim/10,y,x+dim/10,y+dim/2,col)
-
-#define PESO(x,y,dim,col) grx_box(x-dim,y,x+dim,y+2*dim,col)
-
-#define MOLLA(x,y1,y2,col) { \
- int w; \
- for (w=y1;w<y2;w=w+2) grx_line(x-3,w,x+3,w,col); \
- }
-
-#define RUSPA_S(x,y,col,colvet) grx_box(x,y-20,x+2,y,col); \
- grx_line(x,y-10,x+5,y-10,col); \
- grx_box(x+5,y-30,x+20,y-5,col); \
- grx_box(x+5,y-10,x+40,y-5,col); \
- grx_disc(x+10,y-5,5,col); \
- grx_disc(x+30,y-5,5,col); \
- grx_box(x+5,y-25,x+12,y-15,colvet)
-
-#define RUSPA_D(x,y,col,colvet) grx_box(x-2,y-20,x,y,col); \
- grx_line(x-5,y-10,x,y-10,col); \
- grx_box(x-20,y-30,x-5,y-5,col); \
- grx_box(x-40,y-10,x-5,y-5,col); \
- grx_disc(x-10,y-5,5,col); \
- grx_disc(x-30,y-5,5,col); \
- grx_box(x-12,y-25,x-5,y-15,colvet)
-
-#define ESPLOSIONE(x,y) grx_box(x-2,y-2,x+1,y+1,RED+1); \
- grx_box(x-5,y-5,x-4,y-3,RED+1); \
- grx_box(x-6,y-2,x-4,y,RED+1); \
- grx_box(x+3,y+4,x+4,y+7,RED+1); \
- grx_box(x+5,y-6,x+8,y-4,RED+1); \
- grx_box(x-10,y+10,x-8,y+8,RED+1); \
- grx_box(x-1,y-10,x+1,y-8,RED+1); \
- grx_box(x-13,y-1,x-10,y+1,RED+1); \
- grx_box(x+8,y-7,x+10,y-5,RED+1); \
- grx_box(x,y+6,x-1,y+8,RED+1); \
- grx_box(x-DIM_PESO-1,y-1,x-DIM_PESO+1,y+1,RED+1); \
- grx_box(x-DIM_PESO-1,y+2*DIM_PESO-1,x-DIM_PESO+1,y+2*DIM_PESO+1,RED+1); \
- grx_box(x+DIM_PESO-1,y-1,x+DIM_PESO+1,y+1,RED+1); \
- grx_box(x+DIM_PESO-1,y+2*DIM_PESO-1,x+DIM_PESO+1,y+2*DIM_PESO+1,RED+1); \
- grx_box(x-1,y+DIM_PESO-1,x+1,y+DIM_PESO+1,RED+1); \
- grx_box(x+4,y+DIM_PESO-1,x+6,y+DIM_PESO+1,RED+1); \
-
-//#define PULISCI(x,y) grx_box(x-14,y-11,x+DIM_PESO+2,y+2*DIM_PESO+2,COL_SFONDO)
-#define PULISCI(x,y,d) grx_disc(x,y,d,COL_SFONDO)
-
-/*********************************************************************/
-/* */
-/* Funzione per disegnare gli elementi statici */
-/* */
-/*********************************************************************/
-extern char tastiera;
-extern long double Forza_x,Forza_y,Velocita_x,Velocita_y,Acc_x,Acc_y,Massa;
-// Definizione del semaforo per l'utilizzo della modalità grafica
-extern sem_t mutex;
-
-TASK disegna_stato(int i);
-
-
-
Index: tags/rel_0_5/kalm3d/makefile
===================================================================
--- tags/rel_0_5/kalm3d/makefile (revision 1657)
+++ tags/rel_0_5/kalm3d/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = kalm3d
-
-include $(BASE)/config/example.mk
-
-kalm3d:
- make -f $(SUBMAKE) APP=kalm3d INIT= OTHEROBJS="initfile.o carrello.o" SHARKOPT="__OSMESA__ __PCLAB__ __OLDCHAR__ __GRX__"
-
Index: tags/rel_0_5/kalm3d/carrello.c
===================================================================
--- tags/rel_0_5/kalm3d/carrello.c (revision 1657)
+++ tags/rel_0_5/kalm3d/carrello.c (nonexistent)
@@ -1,198 +0,0 @@
-#include <math.h>
-
-#include <modules/hartport.h>
-#include <kernel/kern.h>
-#include <kernel/func.h>
-#include <ll/i386/x-dos.h>
-
-#include "drivers/pclab.h"
-
-#include "const.h"
-
-float vmax = 0.0, vmin = 0.0, vmaxth = 0.0, vminth = 0.0;
-
-int da_motor(float v)
-{
-
- da_conv( 2.5 , 2 );
- da_conv( v + 2.5 , 1 );
-
- return(0);
-
-}
-
-float v2x(float v)
-{
- float x;
-
- x= LUNGH * (v-(vmax+vmin)/2 ) / (vmax-vmin);
-
- return x;
-
-}
-
-float v2theta(float v)
-{
- float theta;
-
- theta=2.0*(THETAMAX/FCA) * (v-(vmaxth+vminth)/2 ) / (vmaxth-vminth);
-
- return theta;
-
-}
-
-float bass1(float u)
-{
- float y;
- static float oldy=0;
-
- y=(oldy + prm.WCUT * DEADSECX(PERIOD_CARRELLO) *u)/(1+ prm.WCUT * DEADSECX(PERIOD_CARRELLO));
- oldy=y;
-
- return y;
-
-}
-
-float bass2(float u)
-{
- float y;
- static float oldy=0;
-
- y=(oldy + prm.WCUT1 * DEADSECX(PERIOD_CARRELLO) *u)/(1+ prm.WCUT1 * DEADSECX(PERIOD_CARRELLO));
- oldy=y;
-
- return y;
-
-}
-
-float bass3(float u)
-{
- float y;
- static float oldy=0;
-
- y=(oldy + prm.WCUT * DEADSECTH(PERIOD_CARRELLO) *u)/(1+ prm.WCUT * DEADSECTH(PERIOD_CARRELLO));
- oldy=y;
-
- return y;
-
-}
-
-float bass4(float u)
-{
- float y;
- static float oldy=0;
-
- y=(oldy + prm.WCUT1 * DEADSECTH(PERIOD_CARRELLO) *u)/(1+ prm.WCUT1 * DEADSECTH(PERIOD_CARRELLO));
- oldy=y;
-
- return y;
-
-}
-
-float dx(float u)
-{
- static float oldu=0;
- float y;
-
- y=(u-oldu)/DEADSECX(PERIOD_CARRELLO);
- oldu=u;
-
- return y;
-
-}
-
-float dth(float u)
-{
- static float oldu=0;
- float y;
-
- y=(u-oldu)/DEADSECTH(PERIOD_CARRELLO);
- oldu=u;
-
- return y;
-
-}
-
-TASK carrello(void)
-{
- float y[2]={0,0}, yp[2]={0,0};
- PORT px, pth;
-
- float th_input = 0.0,arr_th_input[AVR],th_eff,av_th_input;
- float x_input = 0.0,arr_x_input[AVR],x_eff,av_x_input;
-
- int flag_th=1,flag_x=1,index_th=0,index_x=0;
-
- int i;
- float offset,vout,vout_total;
-
- px = port_create("porta1",sizeof(float),1,STICK,WRITE);
- pth = port_create("porta2",sizeof(float),1,STICK,WRITE);
-
- while (1) {
-
- task_nopreempt();
- th_input=ad_conv(10);
- task_preempt();
-
- if(flag_th==1) {
- for(i=0; i<AVR;++i) arr_th_input[i] = th_input;
- flag_th=0;
- }
- av_th_input=0;
- for(i=0;i<AVR;++i) av_th_input += arr_th_input[i];
- av_th_input /= AVR ;
-
- if(fabs(th_input-av_th_input)>=prm.NOISE) th_input=av_th_input;
-
- arr_th_input[index_th]=th_input;
- index_th = (index_th+1) % AVR ;
-
- th_eff = v2theta(th_input);
- y[1] = bass3(th_eff);
- yp[1] = bass4(dth(y[1]));
-
- task_nopreempt();
- x_input=ad_conv(11);
- task_preempt();
-
- if(flag_x==1) {
- for(i=0; i<AVR;++i) arr_x_input[i] = x_input;
- flag_x=0;
- }
- av_x_input=0;
- for(i=0;i<AVR;++i) av_x_input += arr_x_input[i];
- av_x_input /= AVR;
- if(fabs(x_input-av_x_input)>=prm.NOISE) x_input = av_x_input;
-
- arr_x_input[index_x] = x_input;
- index_x = (index_x+1) % AVR ;
-
- x_eff = v2x(x_input);
- y[0] = bass1(x_eff);
- yp[0] = bass2(dx(y[0]));
-
- vout = prm.COST * (prm.GUAD[0] * (y[0]-v2x((vmax+vmin)/2)) + prm.GUAD[1] * th_eff\
- + prm.GUAD[2] * yp[0] + prm.GUAD[3] * yp[1]);
-
- if(vout >= 0) offset=prm.OFFSVAL;
- else offset=-prm.OFFSVAL;
-
- vout_total = vout + offset;
-
- if(vout_total >= VDANG ) vout_total = VDANG ;
- if(vout_total <= -VDANG ) vout_total = -VDANG ;
-
- da_motor(vout_total);
-
- port_send(px, &y[0], NON_BLOCK);
- port_send(pth, &y[1], NON_BLOCK);
-
- task_endcycle();
-
- }
-
- port_delete(px);
- port_delete(pth);
-
-} /* FINE DEL TASK CARRELLO */
Index: tags/rel_0_5/kalm3d/initfile.c
===================================================================
--- tags/rel_0_5/kalm3d/initfile.c (revision 1657)
+++ tags/rel_0_5/kalm3d/initfile.c (nonexistent)
@@ -1,120 +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: initfile.c,v 1.1.1.1 2004-05-24 18:03:47 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:47 $
- ------------
-
- System initialization file
-
- This file contains the 2 functions needed to initialize the system.
-
- These functions register the following levels:
-
- an EDF (Earliest Deadline First) level
- a RR (Round Robin) level
- a CBS (Costant Bandwidth Server) level
- a Dummy level
-
- It can accept these task models:
-
- HARD_TASK_MODEL (wcet+mit) at level 0
- SOFT_TASK_MODEL (met, period) at level 1
- NRT_TASK_MODEL at level 2
-
- This file is similar to the configuration of kernel/init/hartik3.c
-
- TICK is set to 0 (one-shot timer is used)
-*/
-
-/*
- * 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 "modules/edf.h"
-#include "modules/cbs.h"
-#include "modules/rr.h"
-#include "modules/dummy.h"
-
-#include "modules/sem.h"
-#include "modules/hartport.h"
-#include "modules/cabs.h"
-
-#include "drivers/keyb.h"
-
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, 0);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- KEYB_PARMS kparms = BASE_KEYB;
-
- HARTPORT_init();
-
- keyb_def_ctrlC(kparms, NULL);
- keyb_def_map(kparms,itaMap);
- KEYB_init(&kparms);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
Index: tags/rel_0_5/kalm3d/readme.txt
===================================================================
--- tags/rel_0_5/kalm3d/readme.txt (revision 1657)
+++ tags/rel_0_5/kalm3d/readme.txt (nonexistent)
@@ -1,51 +0,0 @@
---------------------------------------
-Inverted Pendulum Demo with Mesa
-
-by
-
-Giacomo Guidi <giacomo@gandalf.sssup.it>
-
-Last update 17/03/2003
---------------------------------------
-
-This is the old Inverted Pendulum control
-demo rewrited usigng the Mesa support
-
-The demo needs a PCL812 card present and
-the inv.pendulum hardware
-
-The graphic cards actually supported are:
-
-GEFORCE TNT TNT2 - driver name NV3
-RAGE128 RADEON - driver name R128
-SAVAGE VIRGE - driver neme SAVAGE
-
---------------------------------------
-
-The demo is composed by:
-
-MAKEFILE The makefile used to compile the application
-README.TXT This file
-INITFILE.C The init file
-KALM3D.C The Inv.Pendulum Demo
-CARRELLO.C The control task
-
---------------------------------------
-
-- 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: tags/rel_0_5/kalm3d/const.h
===================================================================
--- tags/rel_0_5/kalm3d/const.h (revision 1657)
+++ tags/rel_0_5/kalm3d/const.h (nonexistent)
@@ -1,36 +0,0 @@
-#ifndef __CONST__
-#define __CONST__
-
-extern unsigned long int PERIOD_CARRELLO;
-extern unsigned long int PERIOD_DISEGNA;
-
-#define DEADSECX(x) (x * 1.0e-6 )
-#define DEADSECTH(x) (x * 1.0e-6 )
-
-#define PARAM {{ 1. , 300 , 0.79 , 23 },0.70 ,2.5 ,20.,20., 0.1, 1 , 1, 0.}
-
-#define LUNGH 35.0
-#define THETAMAX 45.0
-#define FCA 57.29578
-#define AVR 10
-#define VDANG 2.4
-#define NMAX 300
-#define SEC_ID 7.0
-#define MAXRUN_ID 9 //16
-
-struct Parametri{
- float GUAD[4];
- float COST;
- float NOISE;
- float WCUT;
- float WCUT1;
- float OFFSVAL;
- int DEADLINE;
- int SCAN;
- float XTRASL;
-};
-
-extern struct Parametri prm;
-extern float vmax, vmin, vmaxth, vminth;
-
-#endif
Index: tags/rel_0_5/kalm3d/kalm3d.c
===================================================================
--- tags/rel_0_5/kalm3d/kalm3d.c (revision 1657)
+++ tags/rel_0_5/kalm3d/kalm3d.c (nonexistent)
@@ -1,441 +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
- */
-
-#include <ll/i386/defs.h>
-
-#include <drivers/glib.h>
-#include <drivers/pclab.h>
-
-#include <math.h>
-#include <stdlib.h>
-#include <kernel/log.h>
-#include <GL/osmesa.h>
-#include <GL/glut.h>
-
-#include <modules/hartport.h>
-#include <kernel/kern.h>
-#include <kernel/func.h>
-#include <ll/i386/x-dos.h>
-#include <drivers/keyb.h>
-
-#include "const.h"
-
-#define WIDTH 640
-#define HEIGHT 480
-#define BYTES_PP 2
-
-unsigned long int PERIOD_CARRELLO = 10000;
-unsigned long int PERIOD_DISEGNA = 80000;
-struct Parametri prm=PARAM;
-
-unsigned long int WCET_CARRELLO, WCET_DISEGNA;
-
-TASK carrello(void *);
-
-PID carrello_PID, disegna_PID;
-
-unsigned char *buffers = NULL;
-unsigned char *vbuf = NULL;
-OSMesaContext ctx;
-
-static GLfloat view_rotx = 170.0, view_roty = -200.0, view_rotz = 0.0;
-static GLfloat angle;
-
-GLUquadricObj *quadratic;
-
-static GLfloat SUP_W = 110.0;
-static GLfloat SUP_P = 30.0;
-
-extern void da_motor(float v);
-
-#ifndef M_PI
-#define M_PI 3.14159265
-#endif
-
-void program_end(void)
-{
-
- da_motor(0.0);
-
- OSMesaDestroyContext(ctx);
- free(buffers);
-
- grx_close();
-
- sys_end();
-
-}
-
-void program_key_end(KEY_EVT *k)
-{
-
- sys_end();
-
-}
-
-static void draw_box(GLfloat p1x, GLfloat p1y ,GLfloat p1z, GLfloat p2x, GLfloat p2y, GLfloat p2z) {
-
- glBegin(GL_QUADS);
-
- // Front Face
- glVertex3f(p1x, p1y, p1z);
- glVertex3f(p2x, p1y, p1z);
- glVertex3f(p2x, p2y, p1z);
- glVertex3f(p1x, p2y, p1z);
-
- // Back Face
- glVertex3f(p1x, p1y, p2z);
- glVertex3f(p1x, p2y, p2z);
- glVertex3f(p2x, p2y, p2z);
- glVertex3f(p2x, p1y, p2z);
-
- // Top Face
- glVertex3f(p1x, p2y, p2z);
- glVertex3f(p1x, p2y, p1z);
- glVertex3f(p2x, p2y, p1z);
- glVertex3f(p2x, p2y, p2z);
-
- // Bottom Face
- glVertex3f(p1x, p1y, p2z);
- glVertex3f(p2x, p1y, p2z);
- glVertex3f(p2x, p1y, p1z);
- glVertex3f(p1x, p1y, p1z);
-
- // Right face
- glVertex3f(p2x, p1y, p2z);
- glVertex3f(p2x, p2y, p2z);
- glVertex3f(p2x, p2y, p1z);
- glVertex3f(p2x, p1y, p1z);
-
- // Left Face
- glVertex3f(p1x, p1y, p2z);
- glVertex3f(p1x, p1y, p1z);
- glVertex3f(p1x, p2y, p1z);
- glVertex3f(p1x, p2y, p2z);
-
- glEnd();
-
-}
-
-static void draw_carrello(GLfloat x_scene, GLfloat angle_scene) {
-
- static GLfloat gl_white[3] = {1.0f, 1.0f, 1.0f};
- static GLfloat gl_dark_gray[3] = {0.3f, 0.3f, 0.3f};
- static GLfloat gl_gray[3] = {0.7f, 0.7f, 0.7f};
-
- glPushMatrix();
-
- glColor3fv(gl_dark_gray);
-
- glShadeModel(GL_FLAT);
-
- glTranslatef(x_scene, 0.0f, 0.0f);
-
- draw_box(-6.0f, -6.0f, 9.0f, 6.0f, -2.0f, -9.0f);
- draw_box(-6.0f, -2.0f, 9.0f, 6.0f, -1.0f, 4.0f);
-
- glColor3fv(gl_white);
-
- draw_box(-8.0f, -2.0f, -3.0f, 8.0f, -1.0f, -10.0f);
-
- glColor3fv(gl_dark_gray);
-
- draw_box(-5.0f, 1.0f, 8.0f, 5.0f, 9.0f, 6.0f);
- draw_box(-5.0f,1.0f,-6.0f,5.0f,9.0f,-8.0f);
- draw_box(-5.0f,-1.0f,8.0f,5.0f,1.0f,-8.0f);
-
- glShadeModel(GL_SMOOTH);
-
- glColor3fv(gl_white);
-
- glTranslatef(0.0f, 4.5f, -6.0f);
- gluCylinder(quadratic, 2.2f, 2.2f, 12.0f, 16, 16);
-
- glColor3fv(gl_gray);
-
- glTranslatef(0.0f, 0.0f, 6.0f);
- glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
- glRotatef(angle_scene, 0.0f, 1.0f, 0.0f);
- gluCylinder(quadratic, 1.3f, 1.3f, 160.0f, 16, 16);
- glRotatef(-angle_scene, 0.0f, 1.0f, 0.0f);
- glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
-
- glTranslatef(-4.0f, -2.5f, -6.0f);
- gluCylinder(quadratic, 0.5f, 0.5f, 12.0f, 16, 16);
-
- glTranslatef(8.0f, 0.0f, 0.0f);
- gluCylinder(quadratic, 0.5f, 0.5f, 12.0f, 16, 16);
-
- glPopMatrix();
-
-}
-
-static void draw_support() {
-
- static GLfloat gl_dark_gray[3] = {0.3f, 0.3f, 0.3f};
- static GLfloat gl_gray[3] = {0.7f, 0.7f, 0.7f};
-
- glPushMatrix();
-
- glColor3fv(gl_gray);
-
- glShadeModel(GL_FLAT);
-
- draw_box(-SUP_W/2, -0.1f, SUP_P/2, SUP_W/2, 0.1f, -SUP_P/2);
-
- glColor3fv(gl_dark_gray);
-
- draw_box(-SUP_W/2-3.0f, -0.1f, SUP_P/2, -SUP_W/2, 14.0f, -SUP_P/2-0.2f);
- draw_box(SUP_W/2, -0.1f, SUP_P/2, SUP_W/2+3.0f, 14.0f, -SUP_P/2-0.2f);
-
- glShadeModel(GL_SMOOTH);
-
- glColor3fv(gl_gray);
-
- glTranslatef(-SUP_W/2, 6.0f, 0.0f);
- glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
- gluCylinder(quadratic, 1.5f, 1.5f, SUP_W, 16, 16);
-
- glPopMatrix();
-
-}
-
-static void draw(GLfloat prm_x, GLfloat prm_th)
-{
-
- prm_x = -prm_x / LUNGH * (SUP_W-20.0f);
- prm_th = -prm_th * FCA;
-
- glPushMatrix();
-
- glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
- glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
- glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glRotatef(angle, 0.0f, 1.0f, 0.0f);
-
- draw_support();
- glTranslatef(0.0f, 10.0f, -4.0f);
- draw_carrello(prm_x,prm_th);
-
- glPopMatrix();
-
- glFinish();
-
-}
-
-static void init_gl()
-{
-
- static GLfloat pos0[4] = {40.0f, -70.0f, 180.0f, 1.0f};
-
- glClearColor(0.8f, 0.8f, 0.8f, 1.0f);
-
- glLightfv(GL_LIGHT0, GL_POSITION, pos0);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_CULL_FACE);
-
- glViewport(0, 0, (GLint) WIDTH, (GLint) HEIGHT);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(45.0f,(GLfloat)WIDTH/(GLfloat)HEIGHT,0.1f,250.0f);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0f, 30.0f, -120.0f);
-
- glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
-
- quadratic=gluNewQuadric();
-
- glEnable(GL_AUTO_NORMAL);
- glEnable(GL_COLOR_MATERIAL);
- glEnable(GL_NORMALIZE);
- glDepthFunc(GL_LEQUAL);
-
-}
-
-TASK disegna(void)
-{
-
- PORT pr_x, pr_th;
- float prm_x, prm_th;
-
- char text[100];
- TIME disegna_TIME, carrello_TIME;
-
- pr_x = port_connect("porta1",sizeof(float),STICK,READ);
- pr_th = port_connect("porta2",sizeof(float),STICK,READ);
-
- //vbuf = malloc(WIDTH * HEIGHT * 2); //Debug line
-
- while(1) {
-
- port_receive(pr_x, &prm_x, BLOCK);
- port_receive(pr_th, &prm_th, BLOCK);
-
- angle += 0.2;
-
- draw(prm_x,prm_th);
-
- jet_gettable(carrello_PID, &carrello_TIME, 1);
- jet_gettable(disegna_PID, &disegna_TIME, 1);
-
- sprintf(text,"Hard Task Control PER:%6d us EX:%6d us",(int)PERIOD_CARRELLO,(int)carrello_TIME);
- grx_text(text,10,5,rgb16(0,0,255),rgb16(255,255,255));
- 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),rgb16(255,255,255));
-
- memcpy(buffers,vbuf,WIDTH*HEIGHT*BYTES_PP);
-
- task_endcycle();
-
- }
-
- port_disconnect(pr_x);
- port_disconnect(pr_th);
-
- sys_end();
-
-}
-
-static void screen()
-{
- extern DWORD flbaddr;
-
- /* graphic card Initialization */
- if (grx_init() < 1) {
- sys_abort(1);
- }
-
- if (grx_open(640, 480, 16) < 0) {
- cprintf("GRX Err\n");
- sys_abort(1);
- }
-
- vbuf = (unsigned char *)flbaddr;
-
-}
-
-void waitenter() {
-
- KEY_EVT k;
- char esc = FALSE;
-
- while(!esc) {
- keyb_getcode(&k,BLOCK);
- if (k.ascii == 13) esc = TRUE;
- }
-
-}
-
-
-void init_motor(void)
-{
-
- da_motor(0.0);
-
- cprintf("Calibrazione pendolo inverso...\n");
-
- cprintf("Carr a sx e premi enter\n");
- waitenter();
- vmin=ad_conv(11);
-
- cprintf("Carr a dx e premi enter\n");
- waitenter();
- vmax=ad_conv(11);
-
- cprintf("Asta a sx e premi enter\n");
- waitenter();
- vminth=ad_conv(10);
-
- cprintf("Asta a dx e premi enter\n");
- waitenter();
- vmaxth=ad_conv(10);
-
- cprintf("Vxmax:%f Vxmin:%f Vthmax:%f Vthmin:%f\n",vmax,vmin,vmaxth,vminth);
- waitenter();
-
-}
-
-int main (int argc, char *argv[])
-{
- HARD_TASK_MODEL ht_carrello, ht_disegna;
-
- WCET_CARRELLO =((long int) PERIOD_CARRELLO * (0.05));
- WCET_DISEGNA =((long int) PERIOD_DISEGNA * (0.875));
-
- clear();
-
- sys_atrunlevel((void *) program_end,NULL, RUNLEVEL_BEFORE_EXIT);
-
- hard_task_default_model(ht_carrello);
- hard_task_def_wcet(ht_carrello,WCET_CARRELLO);
- hard_task_def_mit(ht_carrello,PERIOD_CARRELLO);
- hard_task_def_usemath(ht_carrello);
- hard_task_def_group(ht_carrello,1);
- hard_task_def_ctrl_jet(ht_carrello);
-
- carrello_PID = task_create("carrello", carrello, &ht_carrello, NULL);
- if (carrello_PID == -1) {
- sys_end();
- 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,60000);
-
- disegna_PID = task_create("disegna", disegna, &ht_disegna, NULL);
- if (disegna_PID == -1) {
- sys_end();
- exit(4);
- }
-
- {
- KEY_EVT k;
- k.flag = ALTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- keyb_hook(k,program_key_end);
- }
-
- init_motor();
-
- screen();
-
- ctx = OSMesaCreateContext(OSMESA_RGB_565, NULL );
-
- buffers = malloc(WIDTH*HEIGHT*BYTES_PP);
-
- OSMesaMakeCurrent(ctx, buffers, GL_UNSIGNED_SHORT_5_6_5, WIDTH, HEIGHT);
-
- init_gl();
-
- group_activate(1);
-
- return 0;
-
-}
Index: tags/rel_0_5/base_cpp/hello.cpp
===================================================================
--- tags/rel_0_5/base_cpp/hello.cpp (revision 1657)
+++ tags/rel_0_5/base_cpp/hello.cpp (nonexistent)
@@ -1,72 +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
- */
-
-/*
- * 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
- */
-
-/*
- CVS : $Id: hello.cpp,v 1.1.1.1 2004-05-24 18:03:47 giacomo Exp $
-
- hello.c:
-
- This test is a simple hello world function.
-
-*/
-
-#include "kernel/kern.h"
-
-class myHello {
- int i;
-public:
-
- myHello(int anumber)
- {
- i = anumber;
- }
-
- void myprint(void)
- {
- cprintf("myHello objecy prints %d.", i);
- }
-};
-
-int main(int argc, char **argv)
-{
- cprintf("Hello, world!\n");
-
- myHello h(1234);
-
- h.myprint();
-
- return 0;
-}
Index: tags/rel_0_5/base_cpp/readme
===================================================================
--- tags/rel_0_5/base_cpp/readme (revision 1657)
+++ tags/rel_0_5/base_cpp/readme (nonexistent)
@@ -1,8 +0,0 @@
-This directory contains a few C++ demos:
-
-- hello.cpp - this is a simple hello world written in C++, similar to that in demos/base
-
-
-Initialization files:
-
-- ihello.c - same as in demos/base
Index: tags/rel_0_5/base_cpp/ihello.c
===================================================================
--- tags/rel_0_5/base_cpp/ihello.c (revision 1657)
+++ tags/rel_0_5/base_cpp/ihello.c (nonexistent)
@@ -1,95 +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: ihello.c,v 1.1.1.1 2004-05-24 18:03:47 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2004-05-24 18:03:47 $
- ------------
-
- The simplest initialization file
-
- The tick is set to TICK ms.
-
- This file contains the 2 functions needed to initialize the system.
-
- These functions register the following levels:
-
- a RR (Round Robin) level
- a Dummy level
-
- It can accept these task models:
-
- NRT_TASK_MODEL at level 0
-
-**/
-
-/*
- * 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 "modules/rr.h"
-#include "modules/dummy.h"
-
-
-/*+ sysyem tick in us +*/
-#define TICK 300
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
Index: tags/rel_0_5/base_cpp/makefile
===================================================================
--- tags/rel_0_5/base_cpp/makefile (revision 1657)
+++ tags/rel_0_5/base_cpp/makefile (nonexistent)
@@ -1,13 +0,0 @@
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = hello
-
-include $(BASE)/config/example.mk
-
-
-# Text applications
-hello:
- make -f $(SUBMAKE) APP=hello INIT= OTHEROBJS="ihello.o" OTHERINCL=