Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1198 → Rev 1197

/demos/tags/rel_1_2/oscilloscopio/osc.c
File deleted
/demos/tags/rel_1_2/oscilloscopio/adc.c
File deleted
/demos/tags/rel_1_2/oscilloscopio/initosc.c
File deleted
/demos/tags/rel_1_2/oscilloscopio/readme.txt
File deleted
/demos/tags/rel_1_2/oscilloscopio/adc.h
File deleted
/demos/tags/rel_1_2/oscilloscopio/makefile
File deleted
/demos/tags/rel_1_2/biliardo/makefile
File deleted
/demos/tags/rel_1_2/biliardo/posizion.h
File deleted
/demos/tags/rel_1_2/biliardo/initfil1.c
File deleted
/demos/tags/rel_1_2/biliardo/biliardo.c
File deleted
/demos/tags/rel_1_2/biliardo/jetctrl.c
File deleted
/demos/tags/rel_1_2/biliardo/demo.h
File deleted
/demos/tags/rel_1_2/biliardo/palla.c
File deleted
/demos/tags/rel_1_2/biliardo/biliardo.h
File deleted
/demos/tags/rel_1_2/edfact/edfact.h
File deleted
/demos/tags/rel_1_2/edfact/readme
File deleted
/demos/tags/rel_1_2/edfact/makefile
File deleted
/demos/tags/rel_1_2/edfact/initfile.c
File deleted
/demos/tags/rel_1_2/edfact/edfact.c
File deleted
/demos/tags/rel_1_2/edfact/testact.c
File deleted
/demos/tags/rel_1_2/parport/initfile.c
File deleted
/demos/tags/rel_1_2/parport/ppdemo.c
File deleted
/demos/tags/rel_1_2/parport/readme.txt
File deleted
/demos/tags/rel_1_2/parport/makefile
File deleted
/demos/tags/rel_1_2/static/initfile.c
File deleted
/demos/tags/rel_1_2/static/static.c
File deleted
/demos/tags/rel_1_2/static/test1st.c
File deleted
/demos/tags/rel_1_2/static/static.h
File deleted
/demos/tags/rel_1_2/static/readme
File deleted
/demos/tags/rel_1_2/static/makefile
File deleted
/demos/tags/rel_1_2/first/edfstar.c
File deleted
/demos/tags/rel_1_2/first/posixstar.c
File deleted
/demos/tags/rel_1_2/first/makefile
File deleted
/demos/tags/rel_1_2/first/iqueue.c
File deleted
/demos/tags/rel_1_2/first/edfstar.h
File deleted
/demos/tags/rel_1_2/first/test1.c
File deleted
/demos/tags/rel_1_2/first/test2.c
File deleted
/demos/tags/rel_1_2/first/cbsstar.c
File deleted
/demos/tags/rel_1_2/first/posixstar.h
File deleted
/demos/tags/rel_1_2/first/test3.c
File deleted
/demos/tags/rel_1_2/first/iqueue.h
File deleted
/demos/tags/rel_1_2/first/test4.c
File deleted
/demos/tags/rel_1_2/first/test5.c
File deleted
/demos/tags/rel_1_2/first/test6.c
File deleted
/demos/tags/rel_1_2/first/cbsstar.h
File deleted
/demos/tags/rel_1_2/first/test7.c
File deleted
/demos/tags/rel_1_2/first/rmstar.c
File deleted
/demos/tags/rel_1_2/first/testiq.c
File deleted
/demos/tags/rel_1_2/first/rmstar.h
File deleted
/demos/tags/rel_1_2/block/idetest0.c
File deleted
/demos/tags/rel_1_2/block/idetest1.c
File deleted
/demos/tags/rel_1_2/block/idetest2.c
File deleted
/demos/tags/rel_1_2/block/idelin.c
File deleted
/demos/tags/rel_1_2/block/idetest3.c
File deleted
/demos/tags/rel_1_2/block/idernd.c
File deleted
/demos/tags/rel_1_2/block/common.c
File deleted
/demos/tags/rel_1_2/block/readme
File deleted
/demos/tags/rel_1_2/block/initblk.c
File deleted
/demos/tags/rel_1_2/block/makefile
File deleted
/demos/tags/rel_1_2/block/common.h
File deleted
/demos/tags/rel_1_2/mesademo/makefile
File deleted
/demos/tags/rel_1_2/mesademo/initfile.c
File deleted
/demos/tags/rel_1_2/mesademo/mesademo.c
File deleted
/demos/tags/rel_1_2/mesademo/readme.txt
File deleted
/demos/tags/rel_1_2/lights/simlight.c
File deleted
/demos/tags/rel_1_2/lights/blaster.h
File deleted
/demos/tags/rel_1_2/lights/initfile.c
File deleted
/demos/tags/rel_1_2/lights/param.dat
File deleted
/demos/tags/rel_1_2/lights/readme.txt
File deleted
/demos/tags/rel_1_2/lights/makefile
File deleted
/demos/tags/rel_1_2/perf/initfile.c
File deleted
/demos/tags/rel_1_2/perf/readme
File deleted
/demos/tags/rel_1_2/perf/makefile
File deleted
/demos/tags/rel_1_2/perf/perf1.c
File deleted
/demos/tags/rel_1_2/perf/perf2.c
File deleted
/demos/tags/rel_1_2/perf/perf3.c
File deleted
/demos/tags/rel_1_2/perf/perf4.c
File deleted
/demos/tags/rel_1_2/pse51/makefile
File deleted
/demos/tags/rel_1_2/pse51/ptest1.c
File deleted
/demos/tags/rel_1_2/pse51/ptest2.c
File deleted
/demos/tags/rel_1_2/pse51/ptest3.c
File deleted
/demos/tags/rel_1_2/pse51/pinit.c
File deleted
/demos/tags/rel_1_2/pse51/ptest4.c
File deleted
/demos/tags/rel_1_2/pse51/ptest5.c
File deleted
/demos/tags/rel_1_2/pse51/ptest6.c
File deleted
/demos/tags/rel_1_2/pci6025e/test_dio.c
File deleted
/demos/tags/rel_1_2/pci6025e/readme
File deleted
/demos/tags/rel_1_2/pci6025e/makefile
File deleted
/demos/tags/rel_1_2/pci6025e/test_bms.c
File deleted
/demos/tags/rel_1_2/pci6025e/wave.c
File deleted
/demos/tags/rel_1_2/pci6025e/initfile.c
File deleted
/demos/tags/rel_1_2/pci6025e/test_mes.c
File deleted
/demos/tags/rel_1_2/pci6025e/test_ec.c
File deleted
/demos/tags/rel_1_2/pci6025e/test_dac.c
File deleted
/demos/tags/rel_1_2/pci6025e/test_ppi.c
File deleted
/demos/tags/rel_1_2/pci6025e/test_bec.c
File deleted
/demos/tags/rel_1_2/mix/mix.c
File deleted
/demos/tags/rel_1_2/mix/mix.dat
File deleted
/demos/tags/rel_1_2/mix/initfile.c
File deleted
/demos/tags/rel_1_2/mix/readme
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/mix/makefile
File deleted
/demos/tags/rel_1_2/cbs_ft/readme.txt
File deleted
/demos/tags/rel_1_2/cbs_ft/makefile
File deleted
/demos/tags/rel_1_2/cbs_ft/cbs_ft.c
File deleted
/demos/tags/rel_1_2/cbs_ft/initfile.c
File deleted
/demos/tags/rel_1_2/cbs_ft/cbs_ft.h
File deleted
/demos/tags/rel_1_2/cbs_ft/prova.c
File deleted
/demos/tags/rel_1_2/svgademo/readme.txt
File deleted
/demos/tags/rel_1_2/svgademo/makefile
File deleted
/demos/tags/rel_1_2/svgademo/initfile.c
File deleted
/demos/tags/rel_1_2/svgademo/svgademo.c
File deleted
/demos/tags/rel_1_2/jumpball/rrp.c
File deleted
/demos/tags/rel_1_2/jumpball/demo.c
File deleted
/demos/tags/rel_1_2/jumpball/ern.c
File deleted
/demos/tags/rel_1_2/jumpball/ecp.c
File deleted
/demos/tags/rel_1_2/jumpball/jetctrl.c
File deleted
/demos/tags/rel_1_2/jumpball/demo.h
File deleted
/demos/tags/rel_1_2/jumpball/readme.txt
File deleted
/demos/tags/rel_1_2/jumpball/ball.c
File deleted
/demos/tags/rel_1_2/jumpball/makefile
File deleted
/demos/tags/rel_1_2/jumpball/rrn.c
File deleted
/demos/tags/rel_1_2/slsh/slshinit.c
File deleted
/demos/tags/rel_1_2/slsh/slsh.h
File deleted
/demos/tags/rel_1_2/slsh/slshtest.c
File deleted
/demos/tags/rel_1_2/slsh/slsh.c
File deleted
/demos/tags/rel_1_2/slsh/readme.txt
File deleted
/demos/tags/rel_1_2/slsh/makefile
File deleted
/demos/tags/rel_1_2/eli/initfile.c
File deleted
/demos/tags/rel_1_2/eli/eli.c
File deleted
/demos/tags/rel_1_2/eli/makefile
File deleted
/demos/tags/rel_1_2/eli/draw.c
File deleted
/demos/tags/rel_1_2/eli/eli.h
File deleted
/demos/tags/rel_1_2/base/memtest.c
File deleted
/demos/tags/rel_1_2/base/sched.c
File deleted
/demos/tags/rel_1_2/base/fly.c
File deleted
/demos/tags/rel_1_2/base/time.c
File deleted
/demos/tags/rel_1_2/base/intsem.c
File deleted
/demos/tags/rel_1_2/base/isched.c
File deleted
/demos/tags/rel_1_2/base/initfile.c
File deleted
/demos/tags/rel_1_2/base/pcdemo.c
File deleted
/demos/tags/rel_1_2/base/iaster1.c
File deleted
/demos/tags/rel_1_2/base/srpdemo.c
File deleted
/demos/tags/rel_1_2/base/iaster3.c
File deleted
/demos/tags/rel_1_2/base/ego.c
File deleted
/demos/tags/rel_1_2/base/iaster4.c
File deleted
/demos/tags/rel_1_2/base/preempt.c
File deleted
/demos/tags/rel_1_2/base/readme
File deleted
/demos/tags/rel_1_2/base/iaster6.c
File deleted
/demos/tags/rel_1_2/base/pidemo.c
File deleted
/demos/tags/rel_1_2/base/iaster7.c
File deleted
/demos/tags/rel_1_2/base/aster.c
File deleted
/demos/tags/rel_1_2/base/iaster8.c
File deleted
/demos/tags/rel_1_2/base/pcidemo.c
File deleted
/demos/tags/rel_1_2/base/sig.c
File deleted
/demos/tags/rel_1_2/base/condtest.c
File deleted
/demos/tags/rel_1_2/base/keycode.c
File deleted
/demos/tags/rel_1_2/base/mousfind.c
File deleted
/demos/tags/rel_1_2/base/semdemo.c
File deleted
/demos/tags/rel_1_2/base/talk.c
File deleted
/demos/tags/rel_1_2/base/makefile
File deleted
/demos/tags/rel_1_2/base/cabs.dat
File deleted
/demos/tags/rel_1_2/base/aster1.c
File deleted
/demos/tags/rel_1_2/base/jointest.c
File deleted
/demos/tags/rel_1_2/base/aster2.c
File deleted
/demos/tags/rel_1_2/base/aster3.c
File deleted
/demos/tags/rel_1_2/base/mdemo.c
File deleted
/demos/tags/rel_1_2/base/aster4.c
File deleted
/demos/tags/rel_1_2/base/isemdemo.c
File deleted
/demos/tags/rel_1_2/base/aster5.c
File deleted
/demos/tags/rel_1_2/base/hello.c
File deleted
/demos/tags/rel_1_2/base/aster6.c
File deleted
/demos/tags/rel_1_2/base/aster7.c
File deleted
/demos/tags/rel_1_2/base/aster8.c
File deleted
/demos/tags/rel_1_2/base/cabs.c
File deleted
/demos/tags/rel_1_2/base/imdemo.c
File deleted
/demos/tags/rel_1_2/base/ihello.c
File deleted
/demos/tags/rel_1_2/mpeg2/const.h
File deleted
/demos/tags/rel_1_2/mpeg2/mpeg2dec.h
File deleted
/demos/tags/rel_1_2/mpeg2/store.c
File deleted
/demos/tags/rel_1_2/mpeg2/makefile
File deleted
/demos/tags/rel_1_2/mpeg2/examples
File deleted
/demos/tags/rel_1_2/mpeg2/ieee1180
File deleted
/demos/tags/rel_1_2/mpeg2/makefile.lib
File deleted
/demos/tags/rel_1_2/mpeg2/jetctrl.c
File deleted
/demos/tags/rel_1_2/mpeg2/config.h
File deleted
/demos/tags/rel_1_2/mpeg2/getpic.c
File deleted
/demos/tags/rel_1_2/mpeg2/idctref.c
File deleted
/demos/tags/rel_1_2/mpeg2/spatial.doc
File deleted
/demos/tags/rel_1_2/mpeg2/getbits.c
File deleted
/demos/tags/rel_1_2/mpeg2/test.m2v
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/mpeg2/store.ori
File deleted
/demos/tags/rel_1_2/mpeg2/initfile.c
File deleted
/demos/tags/rel_1_2/mpeg2/verify.c
File deleted
/demos/tags/rel_1_2/mpeg2/motion.c
File deleted
/demos/tags/rel_1_2/mpeg2/global.h
File deleted
/demos/tags/rel_1_2/mpeg2/recon.c
File deleted
/demos/tags/rel_1_2/mpeg2/systems.c
File deleted
/demos/tags/rel_1_2/mpeg2/getblk.c
File deleted
/demos/tags/rel_1_2/mpeg2/subspic.c
File deleted
/demos/tags/rel_1_2/mpeg2/spatscal.c
File deleted
/demos/tags/rel_1_2/mpeg2/readme
File deleted
/demos/tags/rel_1_2/mpeg2/gvideo.c
File deleted
/demos/tags/rel_1_2/mpeg2/gethdr.c
File deleted
/demos/tags/rel_1_2/mpeg2/m.bat
File deleted
/demos/tags/rel_1_2/mpeg2/idct.c
File deleted
/demos/tags/rel_1_2/mpeg2/todo
File deleted
/demos/tags/rel_1_2/mpeg2/makefile.ori
File deleted
/demos/tags/rel_1_2/mpeg2/getvlc.c
File deleted
/demos/tags/rel_1_2/mpeg2/mpeg2dec.c
File deleted
/demos/tags/rel_1_2/mpeg2/changes
File deleted
/demos/tags/rel_1_2/mpeg2/getvlc.h
File deleted
/demos/tags/rel_1_2/kalm3d/carrello.c
File deleted
/demos/tags/rel_1_2/kalm3d/initfile.c
File deleted
/demos/tags/rel_1_2/kalm3d/readme.txt
File deleted
/demos/tags/rel_1_2/kalm3d/const.h
File deleted
/demos/tags/rel_1_2/kalm3d/kalm3d.c
File deleted
/demos/tags/rel_1_2/kalm3d/makefile
File deleted
/demos/tags/rel_1_2/readme.txt
File deleted
/demos/tags/rel_1_2/advtimer/initfile.c
File deleted
/demos/tags/rel_1_2/advtimer/readme.txt
File deleted
/demos/tags/rel_1_2/advtimer/advtimer.c
File deleted
/demos/tags/rel_1_2/advtimer/makefile
File deleted
/demos/tags/rel_1_2/base_cpp/hello.cpp
File deleted
/demos/tags/rel_1_2/base_cpp/readme
File deleted
/demos/tags/rel_1_2/base_cpp/ihello.c
File deleted
/demos/tags/rel_1_2/base_cpp/makefile
File deleted
/demos/tags/rel_1_2/oldexamples/fs/testw0.c
File deleted
/demos/tags/rel_1_2/oldexamples/fs/testw1.c
File deleted
/demos/tags/rel_1_2/oldexamples/fs/common.c
File deleted
/demos/tags/rel_1_2/oldexamples/fs/initfs.c
File deleted
/demos/tags/rel_1_2/oldexamples/fs/makefile
File deleted
/demos/tags/rel_1_2/oldexamples/fs/common.h
File deleted
/demos/tags/rel_1_2/oldexamples/fs/test0.c
File deleted
/demos/tags/rel_1_2/oldexamples/fs/tree1.c
File deleted
/demos/tags/rel_1_2/oldexamples/fs/test1.c
File deleted
/demos/tags/rel_1_2/oldexamples/fs/test2.c
File deleted
/demos/tags/rel_1_2/oldexamples/fs/tree2.c
File deleted
/demos/tags/rel_1_2/oldexamples/fs/hello.c
File deleted
/demos/tags/rel_1_2/oldexamples/fs/testu.c
File deleted
/demos/tags/rel_1_2/oldexamples/mpeg/common.c
File deleted
/demos/tags/rel_1_2/oldexamples/mpeg/mpg123.c
File deleted
/demos/tags/rel_1_2/oldexamples/mpeg/initfs.c
File deleted
/demos/tags/rel_1_2/oldexamples/mpeg/makefile
File deleted
/demos/tags/rel_1_2/oldexamples/mpeg/mplay.c
File deleted
/demos/tags/rel_1_2/oldexamples/mpeg/mplay2.c
File deleted
/demos/tags/rel_1_2/oldexamples/makefile
File deleted
/demos/tags/rel_1_2/oldexamples/stdio/initfs.c
File deleted
/demos/tags/rel_1_2/oldexamples/stdio/makefile
File deleted
/demos/tags/rel_1_2/oldexamples/stdio/test0.c
File deleted
/demos/tags/rel_1_2/oldexamples/stdio/test1.c
File deleted
/demos/tags/rel_1_2/oldexamples/stdio/test2.c
File deleted
/demos/tags/rel_1_2/oldexamples/stdio/test3.c
File deleted
/demos/tags/rel_1_2/oldexamples/stdio/test4.c
File deleted
/demos/tags/rel_1_2/oldexamples/stdio/common.c
File deleted
/demos/tags/rel_1_2/makefile
File deleted
/demos/tags/rel_1_2/dosfs/myfile.txt
File deleted
/demos/tags/rel_1_2/dosfs/initfile.c
File deleted
/demos/tags/rel_1_2/dosfs/readme.txt
File deleted
/demos/tags/rel_1_2/dosfs/makefile
File deleted
/demos/tags/rel_1_2/dosfs/dosfs.c
File deleted
/demos/tags/rel_1_2/orbit/orbit.c
File deleted
/demos/tags/rel_1_2/orbit/initfile.c
File deleted
/demos/tags/rel_1_2/orbit/orbit.dat
File deleted
/demos/tags/rel_1_2/orbit/makefile
File deleted
/demos/tags/rel_1_2/tracer/readme
File deleted
/demos/tags/rel_1_2/tracer/makefile
File deleted
/demos/tags/rel_1_2/tracer/utils/types.h
File deleted
/demos/tags/rel_1_2/tracer/utils/tdump.c
File deleted
/demos/tags/rel_1_2/tracer/utils/readme
File deleted
/demos/tags/rel_1_2/tracer/utils/makefile
File deleted
/demos/tags/rel_1_2/tracer/utils/util.c
File deleted
/demos/tags/rel_1_2/tracer/utils/udpdump.c
File deleted
/demos/tags/rel_1_2/tracer/utils/jdump.c
File deleted
/demos/tags/rel_1_2/tracer/utils/util.h
File deleted
/demos/tags/rel_1_2/tracer/utils/sa.c
File deleted
/demos/tags/rel_1_2/tracer/utils/wait.c
File deleted
/demos/tags/rel_1_2/tracer/utils/distr.c
File deleted
/demos/tags/rel_1_2/tracer/utils/road.c
File deleted
/demos/tags/rel_1_2/tracer/dfixed/readme
File deleted
/demos/tags/rel_1_2/tracer/dfixed/makefile
File deleted
/demos/tags/rel_1_2/tracer/dfixed/dfixed.c
File deleted
/demos/tags/rel_1_2/tracer/dfixed/initfile.c
File deleted
/demos/tags/rel_1_2/tracer/udp/initfile.c
File deleted
/demos/tags/rel_1_2/tracer/udp/udptrace.c
File deleted
/demos/tags/rel_1_2/tracer/udp/readme
File deleted
/demos/tags/rel_1_2/tracer/udp/makefile
File deleted
/demos/tags/rel_1_2/tracer/small/treec1.c
File deleted
/demos/tags/rel_1_2/tracer/small/hello.c
File deleted
/demos/tags/rel_1_2/tracer/small/treec2.c
File deleted
/demos/tags/rel_1_2/tracer/small/hello1.c
File deleted
/demos/tags/rel_1_2/tracer/small/hello2.c
File deleted
/demos/tags/rel_1_2/tracer/small/treef1.c
File deleted
/demos/tags/rel_1_2/tracer/small/common.c
File deleted
/demos/tags/rel_1_2/tracer/small/simple.c
File deleted
/demos/tags/rel_1_2/tracer/small/readme
File deleted
/demos/tags/rel_1_2/tracer/small/initfs.c
File deleted
/demos/tags/rel_1_2/tracer/small/makefile
File deleted
/demos/tags/rel_1_2/tracer/small/common.h
File deleted
/demos/tags/rel_1_2/tracer/small/test0.c
File deleted
/demos/tags/rel_1_2/simcity/keyfunct.c
File deleted
/demos/tags/rel_1_2/simcity/img/car_000n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/Bb0.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/bb1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_210n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_120n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_030n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_300n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/street.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_240n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_015n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_150n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_060n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_105n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_330n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_045n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/old_sk.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_180n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_090n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_270n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_135n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_225n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_315n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_075n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_165n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_255n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_345n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/old.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_195n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/img/car_285n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/misc.c
File deleted
/demos/tags/rel_1_2/simcity/sem.raw
File deleted
/demos/tags/rel_1_2/simcity/makefile
File deleted
/demos/tags/rel_1_2/simcity/draw.c
File deleted
/demos/tags/rel_1_2/simcity/keyboard.c
File deleted
/demos/tags/rel_1_2/simcity/include/constant.h
File deleted
/demos/tags/rel_1_2/simcity/include/misc.h
File deleted
/demos/tags/rel_1_2/simcity/include/draw.h
File deleted
/demos/tags/rel_1_2/simcity/include/simcity.h
File deleted
/demos/tags/rel_1_2/simcity/include/proc.h
File deleted
/demos/tags/rel_1_2/simcity/include/states.h
File deleted
/demos/tags/rel_1_2/simcity/include/car.h
File deleted
/demos/tags/rel_1_2/simcity/include/keyfunct.h
File deleted
/demos/tags/rel_1_2/simcity/proc.c
File deleted
/demos/tags/rel_1_2/simcity/initfile.c
File deleted
/demos/tags/rel_1_2/simcity/sem/red_r.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sem/green_l.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sem/yellow_r.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sem/red_d.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sem/red_u.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sem/yellow_d.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sem/yellow_u.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sem/green_r.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sem/green_d.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sem/green_u.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sem/red_l.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sem/yellow_l.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/car.c
File deleted
/demos/tags/rel_1_2/simcity/reading.c
File deleted
/demos/tags/rel_1_2/simcity/simcity.c
File deleted
/demos/tags/rel_1_2/simcity/tasks.c
File deleted
/demos/tags/rel_1_2/simcity/sprite/sp_0.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sprite/sp_1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sprite/sp_2.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sprite/sp_3.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sprite/sp_4.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sprite/sp_5.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sprite/sp_6.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/simcity/sprite/sp_7.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/mesaref/test.png
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/mesaref/mesaref.c
File deleted
/demos/tags/rel_1_2/mesaref/initfile.c
File deleted
/demos/tags/rel_1_2/mesaref/readme.txt
File deleted
/demos/tags/rel_1_2/mesaref/makefile
File deleted
/demos/tags/rel_1_2/bttvdemo/bttv.c
File deleted
/demos/tags/rel_1_2/bttvdemo/initfile.c
File deleted
/demos/tags/rel_1_2/bttvdemo/readme.txt
File deleted
/demos/tags/rel_1_2/bttvdemo/makefile
File deleted
/demos/tags/rel_1_2/bca/control.c
File deleted
/demos/tags/rel_1_2/bca/cannone.c
File deleted
/demos/tags/rel_1_2/bca/esplo.c
File deleted
/demos/tags/rel_1_2/bca/bca.c
File deleted
/demos/tags/rel_1_2/bca/bca.h
File deleted
/demos/tags/rel_1_2/bca/aereo.c
File deleted
/demos/tags/rel_1_2/bca/dummy.c
File deleted
/demos/tags/rel_1_2/bca/makefile
File deleted
/demos/tags/rel_1_2/bca/fab_lib/fab_msg.h
File deleted
/demos/tags/rel_1_2/bca/fab_lib/fab_grx.sys
File deleted
/demos/tags/rel_1_2/bca/fab_lib/fab_tool.h
File deleted
/demos/tags/rel_1_2/bca/fab_lib/fab_grx.h
File deleted
/demos/tags/rel_1_2/bca/fab_lib/fab_show.h
File deleted
/demos/tags/rel_1_2/bca/scenario.c
File deleted
/demos/tags/rel_1_2/bca/initfile.c
File deleted
/demos/tags/rel_1_2/bca/missile.c
File deleted
/demos/tags/rel_1_2/bca/bca_lib.c
File deleted
/demos/tags/rel_1_2/bca/readme
File deleted
/demos/tags/rel_1_2/bca/bca_raw/aereo1_h.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/bca/bca_raw/cannon_h.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/bca/bca_raw/esplo1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/bca/bca_raw/aereo2_h.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/bca/bca_raw/esplo2.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/bca/bca_raw/esplo3.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/bca/bca_raw/bca.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/bca/bca_raw/esplo4.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/bca/bca_raw/missile1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/bca/bca_raw/esplo5.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/bca/bca_raw/missile2.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/bca/bca_raw/sfondo.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/bca/bca_raw/aereo1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/bca/bca_raw/cannon.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/bca/bca_raw/aereo2.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/bca/fab_lib.c
File deleted
/demos/tags/rel_1_2/astro/astro.c
File deleted
/demos/tags/rel_1_2/astro/asteroid.c
File deleted
/demos/tags/rel_1_2/astro/stat.c
File deleted
/demos/tags/rel_1_2/astro/makefile
File deleted
/demos/tags/rel_1_2/astro/rock.c
File deleted
/demos/tags/rel_1_2/astro/asteroid.h
File deleted
/demos/tags/rel_1_2/astro/initfile.c
File deleted
/demos/tags/rel_1_2/pngdemo/test.png
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/pngdemo/initfile.c
File deleted
/demos/tags/rel_1_2/pngdemo/pngdemo.c
File deleted
/demos/tags/rel_1_2/pngdemo/readme.txt
File deleted
/demos/tags/rel_1_2/pngdemo/makefile
File deleted
/demos/tags/rel_1_2/servo/makefile
File deleted
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: rel_1_2/servo/servo.c
===================================================================
--- rel_1_2/servo/servo.c (revision 1198)
+++ rel_1_2/servo/servo.c (nonexistent)
@@ -1,18 +0,0 @@
-#include "kernel/kern.h"
-#include "servo.h"
-
-int main () {
-
- int res;
-
- servo_open(SERVO_COM2);
-
- res = servo_set_angle_sec(0,ANGLE2SEC(45,0,0));
- cprintf("Res = %d",res);
-
- servo_close();
-
- return 0;
-
-}
-
Index: rel_1_2/servo/initfile.c
===================================================================
--- rel_1_2/servo/initfile.c (revision 1198)
+++ rel_1_2/servo/initfile.c (nonexistent)
@@ -1,83 +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
- */
-
-/*
- * 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;
-
- HARTPORT_init();
-
- KEYB_init(NULL);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
/rel_1_2/servo/initfile.c
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: rel_1_2/telesco/moon.h
===================================================================
--- rel_1_2/telesco/moon.h (revision 1198)
+++ rel_1_2/telesco/moon.h (nonexistent)
@@ -1,43 +0,0 @@
-// Immagine luna
-BYTE luna[900]={
-0, 0 , 0, 0, 0, 0, 0, 0, 4, 57, 212, 228, 204, 214, 235, 237, 208, 190, 179, 197, 229, 89, 4, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 208, 213, 178, 155, 139, 129, 123, 169, 170, 173, 157,
-191, 209, 236, 215, 5, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 36, 103, 146, 116, 93, 143, 119, 96,
-134, 123, 117, 120, 113, 102, 93, 156, 210, 184, 66, 4, 0, 0, 0, 0, 0, 0, 0, 0, 2, 64, 83, 88,
-72, 156, 144, 127, 99, 87, 91, 156, 158, 124, 144, 120, 109, 119, 175, 167, 180, 119, 3, 0,
-0, 0, 0, 0, 0, 5, 56, 59, 63, 58, 138, 104, 71, 46, 55, 68, 79, 89, 172, 146, 141, 152, 110, 126,
-134, 179, 148, 145, 134, 4, 0, 0, 0, 0, 4, 32, 58, 50, 49, 56, 105, 58, 38, 42, 45, 69, 64, 93,
-144, 155, 157, 147, 95, 111, 122, 158, 162, 174, 171, 79, 4, 0, 0, 0, 4, 67, 49, 47, 54, 63,
-51, 55, 43, 38, 48, 62, 55, 86, 89, 145, 92, 60, 99, 72, 97, 130, 184, 169, 195, 171, 3, 0, 0,
-3, 77, 52, 37, 51, 72, 54, 63, 48, 46, 46, 48, 55, 54, 92, 95, 80, 55, 47, 47, 52, 56, 170, 187,
-196, 190, 177, 190, 6, 0, 45, 84, 38, 40, 79, 73, 56, 43, 41, 46, 45, 51, 74, 98, 89, 68, 89,
-46, 40, 48, 45, 38, 171, 176, 152, 165, 133, 157, 107, 3, 154, 42, 34, 42, 68, 66, 47, 52, 62,
-55, 60, 50, 56, 50, 106, 127, 74, 38, 39, 58, 38, 42, 116, 87, 128, 148, 69, 59, 170, 2, 100,
-41, 31, 38, 41, 53, 53, 62, 63, 64, 62, 65, 63, 58, 105, 71, 60, 57, 44, 43, 38, 36, 81, 58, 125,
-205, 61, 43, 130, 37, 88, 39, 31, 33, 43, 52, 76, 66, 97, 116, 101, 96, 90, 56, 76, 47, 43, 135,
-46, 87, 40, 30, 33, 37, 84, 152, 86, 43, 131, 81, 131, 36, 35, 33, 36, 53, 91, 73, 124, 145,
-132, 95, 80, 50, 45, 45, 35, 49, 70, 59, 32, 30, 30, 30, 39, 75, 158, 92, 133, 138, 151, 41,
-39, 38, 39, 82, 125, 59, 89, 98, 84, 64, 68, 40, 104, 107, 85, 78, 115, 75, 34, 43, 39, 36, 47,
-78, 98, 142, 104, 122, 155, 49, 32, 36, 32, 57, 71, 58, 85, 97, 69, 49, 53, 40, 88, 124, 133,
-169, 141, 94, 40, 40, 46, 53, 52, 81, 49, 77, 107, 122, 146, 79, 31, 38, 31, 37, 37, 51, 64,
-59, 84, 72, 64, 96, 88, 132, 153, 158, 154, 149, 140, 109, 77, 125, 120, 54, 51, 59, 123, 86,
-111, 122, 35, 44, 35, 34, 38, 63, 55, 55, 87, 76, 103, 133, 148, 146, 160, 151, 145, 163, 194,
-92, 104, 136, 109, 54, 46, 65, 123, 53, 160, 144, 56, 46, 41, 39, 39, 91, 41, 47, 70, 75, 57,
-112, 116, 140, 168, 179, 161, 164, 188, 123, 100, 145, 162, 87, 51, 111, 140, 5, 172, 148,
-134, 86, 72, 75, 48, 50, 40, 45, 53, 106, 60, 108, 137, 135, 160, 157, 152, 169, 179, 191,
-109, 70, 150, 122, 94, 104, 128, 4, 167, 144, 140, 103, 98, 116, 64, 56, 84, 62, 60, 59, 48,
-80, 150, 143, 151, 187, 161, 147, 178, 219, 79, 69, 163, 132, 87, 108, 128, 0, 83, 195, 195,
-125, 138, 67, 35, 106, 98, 90, 58, 44, 60, 131, 161, 152, 178, 157, 149, 164, 164, 177, 107,
-119, 129, 119, 145, 133, 104, 0, 5, 181, 233, 190, 150, 78, 43, 62, 63, 87, 50, 53, 46, 81,
-157, 187, 155, 181, 189, 145, 166, 211, 170, 137, 166, 189, 188, 164, 5, 0, 0, 5, 167, 175,
-193, 193, 108, 114, 63, 118, 139, 125, 130, 202, 209, 221, 213, 180, 172, 201, 170, 175,
-186, 177, 210, 236, 204, 14, 0, 0, 0, 3, 62, 166, 183, 166, 106, 139, 102, 129, 179, 206, 212,
-240, 232, 224, 210, 208, 196, 173, 179, 177, 186, 191, 227, 185, 100, 2, 0, 0, 0, 0, 5, 125,
-196, 143, 163, 169, 169, 152, 181, 212, 239, 241, 237, 234, 217, 180, 206, 188, 199, 188,
-194, 202, 164, 120, 4, 0, 0, 0, 0, 0, 0, 5, 123, 180, 145, 147, 184, 184, 197, 223, 232, 224,
-227, 227, 220, 190, 179, 192, 192, 197, 204, 165, 120, 4, 0, 0, 0, 0, 0, 0, 0, 0, 5, 74, 162,
-135, 153, 176, 178, 204, 235, 232, 235, 231, 212, 201, 190, 189, 196, 202, 189, 70, 4, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 182, 167, 170, 184, 208, 218, 215, 206, 209, 179, 205, 196, 188,
-184, 193, 12, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 103, 202, 197, 201, 208, 235, 217, 203,
-197, 188, 185, 217, 131, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 89, 130, 218,
-195, 179, 165, 102, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0};
Index: rel_1_2/telesco/initfile.c
===================================================================
--- rel_1_2/telesco/initfile.c (revision 1198)
+++ rel_1_2/telesco/initfile.c (nonexistent)
@@ -1,133 +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 2003-06-04 09:41:01 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2003-06-04 09:41:01 $
- ------------
-
- 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
-
-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(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);
-
- read_cfg_file(argc, argv);
-
- //read_cfg_file(argc, argv);
-
- 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 *)main(argc,argv);
- //return (void *)0;
-}
-
Index: rel_1_2/telesco/tel.c
===================================================================
--- rel_1_2/telesco/tel.c (revision 1198)
+++ rel_1_2/telesco/tel.c (nonexistent)
@@ -1,709 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Bera Marco mbera@libero.it
- * Varasio Gabriele varasio@odino.unipv.it
- *
- * Universita' degli studi di Pavia
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: tel.c,v 1.1 2003-06-04 09:41:01 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2003-06-04 09:41:01 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 Paolo Gai and Giorgio Buttazzo
- *
- * 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
- *
- */
-
-/****************************************************************/
-/* PERIODIC PROCESS TEST */
-/****************************************************************/
-
-#include <ll/i386/x-dos.h>
-#include <kernel/kern.h>
-#include <modules/cabs.h>
-#include <drivers/glib.h>
-#include <drivers/keyb.h>
-#include <math.h>
-#include <semaphore.h>
-#include <stdlib.h>
-#include "moon.h"
-
-
-#define N_MAX_TELESCOPI 5
-#define X0 10
-#define pi 3.14
-#define ex 2.71
-#define NCAB N_MAX_TELESCOPI+1
-#define dim_msg 8
-#define dim_x 49
-#define dim_y 49
-#define radius 9
-#define Y_TELESCOPI 300
-/* task periods */
-#define PERIOD_T1 80000
-#define PERIOD_T4 100000
-#define PERIOD_T5 100000
-#define WCET_T 5000
-int period_t1=0;
-#define SOGLIA 8
-
-char *cname[NCAB] = {"cab1", "cab2", "cab3", "cab4","cab5","cab6"};
-
-// posizioni dei telescopi e rispettivi poli
-
-int x[5] = {100, 200, 300, 400,500};
-//double poli[5]={-50,-30,-1, -20, -5};
-double poli[5];
-// guadagno proporzionale
-double kp=0.0;
-// flag per rilevare la pressione del tasto spazio
-int numero_telescopi=0;
-int flag=0;
-KEY_EVT move_tasto;
-// Immagini ausiliarie per il disegno della luna
-BYTE lunabkg[900];
-BYTE lunadest[900];
-
-
-/* A semaphore used to access Video Cards in mutual exclusion */
-sem_t mutex;
-sem_t mutex_tasto;
-
-/***************************************************************/
-
-// cab necessari allo scambio delle coordinate dell'oggetto e delle
-// immagini dei rispettivi telescopi
-
-CAB cid[NCAB];
-
-// vettori per memorizzare le immagini
-BYTE videobuf[dim_x*dim_y];
-BYTE videobuf1[dim_x*dim_y];
-BYTE videobuf2[dim_x*dim_y];
-BYTE videobuf3[dim_x*dim_y];
-BYTE videobuf4[dim_x*dim_y];
-BYTE videobuf5[dim_x*dim_y];
-
- // Variabili per il disegno delle stelle sullo sfondo
- int num_p;
- int y_p[7];
- int x_p[7];
- int dim_p[7];
- int col_p[7];
-
-
-
-TASK media(void *arg)
-{
-char *p;
-
-int i=0;
-int j=0;
-while(1)
-{
- p = cab_getmes(cid[1]);
- memcpy(videobuf,p,dim_x*dim_y*sizeof(BYTE));
- cab_unget(cid[1], p);
- p = cab_getmes(cid[2]);
- memcpy(videobuf1,p,dim_x*dim_y*sizeof(BYTE));
- cab_unget(cid[2], p);
- p = cab_getmes(cid[3]);
- memcpy(videobuf2,p,dim_x*dim_y*sizeof(BYTE));
- cab_unget(cid[3], p);
- p = cab_getmes(cid[4]);
- memcpy(videobuf4,p,dim_x*dim_y*sizeof(BYTE));
- cab_unget(cid[4], p);
-
- p = cab_getmes(cid[5]);
- memcpy(videobuf5,p,dim_x*dim_y*sizeof(BYTE));
- cab_unget(cid[5], p);
-
- // calcolo media
-
- for (i=0;i<dim_x;i++)
-
- {
- for(j=0;j<dim_y;j++)
- {
- videobuf3[i*dim_x+j]=(double)(videobuf[i*dim_x+j]+videobuf1[i*dim_x+j]+videobuf2[i*dim_x+j]+videobuf4[i*dim_x+j]+videobuf5[i*dim_x+j])/numero_telescopi;
- }
- }
-
- // visualizza immagine mediata
- sem_wait(&mutex);
- grx_putimage(570,10,570+dim_x-1,10+dim_y-1,videobuf3);
- sem_post(&mutex);
- task_endcycle();
- }
-}
-
-TASK move(void *arg)
-{
-//int i = (int)arg;
-char *p;
-int x_object=300; // posizione dell'oggetto da rilevare
-int y_object=200;
-// variabile contatore
-int z=0;
-char coord_x[dim_msg];
-p = cab_reserve(cid[0]);
-sprintf(coord_x,"%d %d",x_object,y_object);
-memcpy(p,coord_x,dim_msg*sizeof(char));
-cab_putmes(cid[0], p);
-
- //Normalizzazione
- for(z=0;z<900;z++)
- {
- if (luna[z]>0)
- {
- luna[z]=((luna[z])*16.0/255.0)+16;
- }
-
- }
-
-
- task_endcycle();
- while (1)
- {
-
- // Cancellazione Luna
- sem_wait(&mutex);
- grx_box(x_object-15,y_object-15,x_object+14,y_object+14,0);
- sem_post(&mutex);
- if (keyb_getcode(&move_tasto,NON_BLOCK))
- {
- if (move_tasto.ascii=='4')
- x_object=x_object-5;
- if (move_tasto.ascii=='6')
- x_object=x_object+5;
- if (move_tasto.ascii=='2')
- y_object=y_object+5;
- if (move_tasto.ascii=='8')
- y_object=y_object-5;
- if (move_tasto.ascii=='9'){
- y_object=y_object-5;
- x_object=x_object+5; }
- if (move_tasto.ascii=='1'){
- y_object=y_object+5;
- x_object=x_object-5; }
- if (move_tasto.ascii=='7'){
- y_object=y_object-5;
- x_object=x_object-5; }
- if (move_tasto.ascii=='3'){
- y_object=y_object+5;
- x_object=x_object+5;}
- if (move_tasto.ascii==' '){
- sem_wait(&mutex_tasto);
- flag=1;
- if(numero_telescopi<N_MAX_TELESCOPI)
- {
- numero_telescopi++;
- }
- sem_post(&mutex_tasto);
- }
- //CONTROLLI SULLA POSIZIONE
- if(y_object<(dim_y/2+70)) y_object=dim_y/2+70;
- if(y_object>(240-dim_y/2)) y_object=(240-dim_y/2);
- if(x_object<(dim_x/2+20 )) x_object=dim_x/2+20;
- if(x_object>(630-dim_x/2-10)) x_object=(630-dim_x/2-10);
- }
- p = cab_reserve(cid[0]);
- sprintf(coord_x,"%d %d",x_object,y_object);
- memcpy(p,coord_x,dim_msg*sizeof(char));
- cab_putmes(cid[0], p);
-
- for(z=0;z<7;z++)
- {
- if (sqrt(pow((x_object-x_p[z]),2)+pow((y_object-y_p[z]),2))<20+dim_p[z]+radius)
- grx_disc(x_p[z],y_p[z],dim_p[z],col_p[z]);
- }
-
-
- sem_wait(&mutex);
- // Gestione sfondo
- grx_getimage(x_object-15,y_object-15,x_object+14, y_object+14,lunabkg);
- for(z=0;z<900;z++)
- {
- if( luna[z]==0 && lunabkg!=0 )
- {
- lunadest[z]=lunabkg[z];
- }
- else
- {
- lunadest[z]=luna[z];
- }
- }
- grx_putimage(x_object-15,y_object-15,x_object+14, y_object+14,lunadest);
- sem_post(&mutex);
- task_endcycle();
- }
-}
-
-
-TASK tele(void *arg)
-{
-int i = (int)arg;
-int passi;
-char s[100];
-int x_object=300; // posizione dell'oggetto da rilevare
-int y_object=200;
-int x_start=500; // posizione iniziale dei telescopi
-int y_start=190;
-int x_current=x_start; // posizione corrente dei telescopi
-int y_current=y_start;
-int x_current_d[9];
-int y_current_d[9];
-int y= Y_TELESCOPI; // coordinata y dei telescopi
-double alpha_new=atan((y-(double)y_current)/((x[i]-(double)x_current)));
-double alpha=alpha_new;
-double distance=0.0;
-double alpha_target=0.0;
-double tc=0.1;
-double u=0.0;
-double u_old=0.0;
-double errore=0.0;
-double delta_x=0;
-double delta_y=0;
-
-char *p;
-//int j=0;
-// indice matrice per aggiunta di rumore
-int k=0;
-int q=0;
-double polo=poli[i];
-int val=0;
-
-
-
-BYTE videobuf[dim_x*dim_y];
-
- passi = 0;
- //srand(i);
- //srand(i+sys_gettime(NULL));
- alpha_target=atan((y-(double)y_object)/((double)x_object-x[i]));
-
- sem_wait(&mutex);
- grx_text("targ",4,340,12,0);
- sprintf(s,"%f",poli[i]);
- grx_text(s,x[i],y+60,12,0);
- grx_text("polo",4,y+60,12,0);
- grx_text("new",4,y+50,12,0);
- sprintf(s,"%1.6f",alpha_target);
- grx_text(s, x[i]-25,y+50,12,0);
- grx_rect(x[i]-40,y+25,x[i]+40,y+85,2);
- grx_rect(x[i]-40,y+90,x[i]+40,y+150,2);
- sem_post(&mutex);
-
- // Disegno telescopio
- grx_disc(x[i],y,19,i+1);
- grx_box( x[i]-19,y,x[i]+19,y+20,i+1);
-
-
- task_endcycle();
-
- while (1) {
- // legge di controllo
- passi++;
- //sprintf(s,"%d",passi);
- //grx_text(s, 50,110,12,0);
- p = cab_getmes(cid[0]);
- sscanf(p,"%d %d",&val,&y_object);
- cab_unget(cid[0], p);
- x_object=val;
- alpha_target=atan((y-(double)y_object)/((double)x_object-x[i]));
- if (alpha_target <0)
- {
- alpha_target=3.14+alpha_target;
- }
-
- errore=alpha_target-alpha_new;
- u=u_old+kp*tc*errore;
- //alpha_new=0.13*alpha+0.87*u;
- alpha_new=(exp(polo*tc))*alpha+(1-exp(polo*tc))*u;
- u_old=u;
- alpha=alpha_new;
-
- // implementazione dei limiti degli attuattori
- if (alpha_new > 3.14)
- alpha_new=3.14;
- if (alpha_new <0)
- alpha_new=0;
-
- distance=sqrt(((y-y_object)*(y-y_object))+((x_object-x[i])*(x_object-x[i])));
-
- sem_wait(&mutex);
- // Cancello braccio telescopio
- if (passi>1)
- {
- for (k=0; k<9 ; k++)
- {
- grx_line(delta_x,delta_y,x_current_d[k],y_current_d[k],0);
- }
- }
- x_current=x[i]+distance*cos(alpha_new);
- y_current=300-distance*sin(alpha_new);
-
- // lettura immagine
-
- grx_getimage(x_current-(dim_x/2),y_current-(dim_y/2),x_current+(dim_x/2),y_current+(dim_y/2),videobuf);
-
- //aggiunta rumore
-
- sem_post(&mutex);
- for (k=0;k<dim_x;k++)
- {
- for(q=0;q<dim_y;q++)
- {
- int num=0;
- num=rand();
- num=(num%10)+1;
- if (num>SOGLIA)
- {
- videobuf[k*dim_x+q]=videobuf[k*dim_x+q]+1;
- }
- }
- }
- sem_wait(&mutex);
-
- grx_putimage(x[i]-25,y+92,x[i]-25+dim_x-1,y+92+dim_y-1,videobuf);
-
- sprintf(s,"%3.4f",(180*(alpha_target/pi)));
- grx_text(s, x[i]-25,y+40,12,0);
- sprintf(s,"%3.4f",180*(alpha_new/pi));
- grx_text(s, x[i]-25,y+50,12,0);
-
- delta_x=x[i]+20*cos(alpha_new);
- delta_y=y-20*sin(alpha_new);
-
- for ( k=0; k<9 ; k++) {
- x_current_d[k]=x[i]+50*cos(alpha_new+(k-4)*0.01);
- y_current_d[k]=300-50*sin(alpha_new+(k-4)*0.01); }
-
- // Disegno braccio telescopio
- for(k=0 ; k<9 ; k++)
- grx_line(delta_x,delta_y,x_current_d[k],y_current_d[k],i+1);
-
- sem_post(&mutex);
-
- // scrive immagine nel cab
- p = cab_reserve(cid[i+1]);
- memcpy(p,videobuf,dim_x*dim_y*sizeof(BYTE));
- cab_putmes(cid[i+1], p);
-
- task_endcycle();
-
- }
-
-}
-
-
-/****************************************************************/
-
-/* This is the exception handler. It is called when an exception
- is raised.
- It exits from the graphical mode, then it prints a message and
- shutdown the kernel using sys_abort()
-*/
-
-void demo_exc_handler(int signo, siginfo_t *info, void *extra)
-{
- struct timespec t;
-
- grx_close();
-
- /* Default action for an kern exception is */
- kern_cli();
- ll_gettime(TIME_EXACT, &t),
- kern_printf("\nS.Ha.R.K. Exception raised!!!"
- "\nTime (s:ns) :%ld:%ld"
- "\nException number:%d (numbers in include/bits/errno.h)"
- "\nPID :%d\n",
- t.tv_sec, t.tv_nsec, info->si_value.sival_int,
- info->si_task);
- sys_abort(1);
-}
-
-/******************************************************************/
-
-/* This function is called when Alt-X is pressed.
- It simply shutdown the system using sys_end.
- Note that the byebye() function is called only if we exit from
- the system using sys_end()!!!!
-*/
-void my_end(KEY_EVT* e)
-{
- sys_end();
-}
-
-/******************************************************************/
-
-/* This function is called when the system exit correctly after Alt-X.
- It exits from the graphic mode and then it prints a small greeting.
- Note that:
- - The function calls grx_exit, so it must be registered using
- RUNLEVEL_BEFORE_EXIT (RUNLEVEL_AFTER_EXIT does not work because
- at that point the kernel is already returned in real mode!!!)
- - When an exception is raised, the exception handler is called.
- Since the exception handler already exits from the graphic mode,
- this funcion has not to be called. For this reason:
- . we registered byebye using the flag NO_AT_ABORT
- . the exception handler exits using sys_abort; in that way byebye is
- NOT called
-*/
-
-void byebye(void *arg)
-{
- grx_close();
- kern_printf("Bye Bye!\n");
-}
-
-/****************************** MAIN ******************************/
-
-int main(int argc, char **argv)
-{
- PID pid1, pid4,pid5;
- KEY_EVT emerg;
- int i=0;
- int z=0; // contatore per disegno dei pianeti
- HARD_TASK_MODEL m1, m4,m5;
- //FILE *fp;
-
- struct sigaction action;
-
- cid[0] = cab_create(cname[0], dim_msg, 5);
- cid[1] = cab_create(cname[1], dim_x*dim_y, 3);
- cid[2] = cab_create(cname[2], dim_x*dim_y, 3);
- cid[3] = cab_create(cname[3], dim_x*dim_y, 3);
- cid[4] = cab_create(cname[4], dim_x*dim_y, 4);
- cid[5] = cab_create(cname[5], dim_x*dim_y, 3);
- cid[6] = cab_create(cname[6], dim_x*dim_y, 3);
-
- /*fp=fopen("file.txt","r");
- fscanf(fp,"%d",a);
- fclose(fp);
- */
-
- /* Init the standard S.Ha.R.K. exception handler */
- action.sa_flags = SA_SIGINFO; /* Set the signal action */
- action.sa_sigaction = demo_exc_handler;
- action.sa_handler = 0;
- sigfillset(&action.sa_mask); /* we block all the other signals... */
-
- if (sigaction(SIGHEXC, &action, NULL) == -1) { /* set the signal */
- perror("Error initializing signals...");
- sys_end();
- }
-
- /* Set the closing function */
- sys_atrunlevel(byebye, NULL, RUNLEVEL_BEFORE_EXIT|NO_AT_ABORT);
-
- /* Initializes the semaphore */
- sem_init(&mutex,0,1);
-
- /* graphic card Initialization */
- if (grx_init() < 1) {
- sys_abort(1);
- }
-
- if (grx_open(640, 480, 8) < 0) {
- kern_printf("GRX Err\n");
- sys_abort(1);
- }
- kern_printf("Video card ok!\n");
-
-
-
- /* set the keyboard handler to exit correctly */
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTL_BIT;
- keyb_hook(emerg,my_end);
-
- srand(i+sys_gettime(NULL));
-
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTR_BIT;
- keyb_hook(emerg,my_end);
- sem_wait(&mutex);
- /* a small banner */
- grx_clear(0);
-
- grx_text("REALTIME TELESCOPES di Marco Bera e Gabriele Varasio",8,8,WHITE,0);
- grx_text("Premere Spazio per creare un telescopio",8,22,WHITE,0);
- grx_text("Premere Alt-X per uscire",8,32,WHITE,0);
- grx_text("Usare il tastierino numerico per muovere l'oggetto",8,42,WHITE,0);
-
- // DISEGNARE BORDI
- grx_rect(1,1,638,478,2);
- grx_rect(558,1,638,61,2);
- grx_rect(1,1,638,61,2);
-
-
- // Disegno sfondo
- for(z=0;z<7;z++)
- {
- num_p=rand();
- y_p[z]=100+((num_p%130)+1);
- x_p[z]=50+((num_p%540)+1);
- dim_p[z]=2+((num_p%5)+1);
- col_p[z]=((num_p%10)+1);
- grx_disc(x_p[z],y_p[z],dim_p[z],col_p[z]);
- }
- sem_post(&mutex);
-
-
- hard_task_default_model(m4);
- hard_task_def_ctrl_jet (m4);
- hard_task_def_arg (m4, (void *)3);
- hard_task_def_wcet (m4, 19000);
- hard_task_def_mit (m4, PERIOD_T4);
- hard_task_def_group (m4,1);
- pid4 = task_create("move", move, &m4, NULL);
- if (pid4 == NIL) {
- grx_close();
- perror("Could not create task <move>");
- sys_abort(1);
- }
- task_activate(pid4);
- hard_task_default_model(m5);
- hard_task_def_ctrl_jet (m5);
- hard_task_def_arg (m5, (void *)3);
- hard_task_def_wcet (m5, 19000);
- hard_task_def_mit (m5, PERIOD_T5);
- hard_task_def_group (m5,1);
- pid5 = task_create("media", media, &m5, NULL);
-
- if (pid5 == NIL) {
- grx_close();
- perror("Could not create task <move>");
- sys_abort(1);
- }
- task_activate(pid5);
- /* and finally we activate the three threads... */
-
-
-
- do {
- int val_flag=0;
- sem_wait(&mutex_tasto);
- val_flag=flag;
- sem_post(&mutex_tasto);
-
- if ((val_flag==1) && (i < N_MAX_TELESCOPI))
- {
- flag=0;
- hard_task_default_model(m1);
- hard_task_def_ctrl_jet (m1);
- hard_task_def_arg (m1, (void *)i);
- hard_task_def_wcet (m1, WCET_T);
-// hard_task_def_mit (m1, PERIOD_T1);
- hard_task_def_mit (m1, period_t1);
-
- hard_task_def_group (m1,1);
- pid1 = task_create("tele1", tele, &m1, NULL);
- if (pid1 == NIL)
- {
- grx_close();
- perror("Could not create task <tele1>");
- sys_abort(1);
- }
- task_activate(pid1);
- i++;
- }
- } while (1);
-
- /*
- now the task main ends, but the system does not shutdown because
- there are others.
-
- The demo will finish if a Alt-X key is pressed.
- */
-
- return 0;
-}
-/*********** lettura da file ********************/
-void read_cfg_file(int argc, char **argv)
-{
- int err;
- DOS_FILE *fp;
- char myfilebuf[1000];
- int myfilebuf_length;
-
-
-
- if (2)
- {
- fp = DOS_fopen("dati.cnf","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
- sscanf(myfilebuf,"%lf %lf %lf %lf %lf %lf %d",&poli[0],&poli[1],&poli[2],&poli[3],&poli[4],&kp,&period_t1);
- }
-
- 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);
- }
-
- }
- else {
- cprintf("Wrong number of arguments...\n");
- l1_exit(0);
- }
-}
-
-
-/****************************************************************/
Index: rel_1_2/telesco/dati.cnf
===================================================================
--- rel_1_2/telesco/dati.cnf (revision 1198)
+++ rel_1_2/telesco/dati.cnf (nonexistent)
@@ -1,3 +0,0 @@
--1 -20 -30 -40 -50 0.5 100000
-# 5 poli kp(guadagno) periodo telescopio
-
Index: rel_1_2/telesco/makefile
===================================================================
--- rel_1_2/telesco/makefile (revision 1198)
+++ rel_1_2/telesco/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= tel
-
-include $(BASE)/config/example.mk
-
-tel:
- make -f $(SUBMAKE) APP=tel INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
-
Index: rel_1_2/autostr/makefile
===================================================================
--- rel_1_2/autostr/makefile (revision 1198)
+++ rel_1_2/autostr/makefile (nonexistent)
@@ -1,17 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= autostr
-
-include $(BASE)/config/example.mk
-
-autostr:
- make -f $(SUBMAKE) APP=autostr INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
-
-
Index: rel_1_2/autostr/autostr.c
===================================================================
--- rel_1_2/autostr/autostr.c (revision 1198)
+++ rel_1_2/autostr/autostr.c (nonexistent)
@@ -1,1171 +0,0 @@
-/***************************************************************************
- **************************************************************************
- *** Universita' di Pavia ***
- *** Corso : Informatoca Industriale ***
- **************************************************************************
- *** Progetto : MONITORAGGIO AUTOSTRADA ***
- **************************************************************************
- *** Realizzato da : Nino Verzellesi e Quadrubbi Giacomo ***
- **************************************************************************
- ***************************************************************************/
-
-
-/* ----------------------------------------------------------------------------- */
-
-#include <kernel/kern.h>
-#include <drivers/glib.h>
-#include <drivers/keyb.h>
-#include <semaphore.h>
-#include <stdlib.h>
-#include <math.h>
-
-/* ----------------------------------------------------------------------------- */
-
-
-/********************* DEFINIZIONE DELLE COSTANTI **************************/
-
-#define ESC 27 /* codice ASCII del tasto ESCAPE */
-#define MAX_V 35 /* massimo numero di veicoli */
-#define GRUPPO 1
-#define LUNGCAMION 40 /* lunghezza del camion */
-#define LARGCAMION 10 /* larghezza del camion */
-#define LUNGLENTA 16 /* lunghezza della macchina lenta */
-#define LARGLENTA 8 /* larghezza della macchina lenta */
-#define LUNGVELOCE 20 /* lunghezza della macchina veloce */
-#define LARGVELOCE 8 /* larghezza della macchina veloce */
-#define DT 0.04 /* passo del campionamento */
-#define CENTROCORSIA1 477 /* coordinata del centro della corsia 1 */
-#define CENTROCORSIA2 459 /* coordinata del centro della corsia 2 */
-#define CENTROCARREGGIATA 469 /* coordinata del centro della carreggiata */
-
-
-/* ----------------------------------------------------------------------------- */
-
-
-/****************** DEFINIZIONE DELLE VARIABILI GLOBALI ********************/
-
-double tick = 1.0; /* system tick = 1 ms */
-int periodo = 40000; /* periodo */
-int wcet = 1000; /* deadline */
-PID pid;
-sem_t mutex; /* semaforo per la grafica */
-sem_t strada; /* semaforo per le variabili corsia1 e corsia2 */
-int MAX_X; /* dimensione x della modalita' di visualizzazione dello schermo */
-int MAX_Y; /* dimensione y della modalita' di visualizzazione dello schermo */
-short corsia1[40000]; /* vettore della corsia1 */
-short corsia2[40000]; /* vettore della corsia2 */
-int xelic; /* cordinata dell'elicottero */
-char c; /* carattere da tastiera */
-
-
-/* ----------------------------------------------------------------------------- */
-
-
-/****************** FUNZIONE CHE DISEGNA I VEICOLI *************************/
-
-void draw_veicolo(int x, int y, int colore,int lunghezza,int larghezza)
-{
- int u; /* indice di ciclo */
- int v; /* variabile ausiliaria per la ricostruzione della segnaletica */
- int xreal; /* coordinata di fine veicolo */
-
- xreal=x-lunghezza; /* calcola la coordinata di fine veicolo */
- if (xreal<0) /* la pone a zero nel caso in cui sia minore di zero (veicolo non ancora interamente entrato in autostrada) */
- xreal=0;
-
- /* disegna il veicolo nella posizione indicata e con il colore indicato */
- sem_wait(&mutex);
- grx_box(xreal,(int)(y-larghezza/2),x,(int)(y+larghezza/2),colore);
- sem_post(&mutex);
-
- /* ricostruisce la segnaletica orrizzontale della strada nel caso in cui si sta' cancellando il veicolo dalla posizione precedente (ridisegna solo quella parte che e' stata cancellata) */
- if (colore==0)
- for (u=xreal;u<x;u++)
- {
- v=u%8;
- if ((v==0) || (v==1))
- {
- sem_wait(&mutex);
- grx_plot(u,CENTROCARREGGIATA,rgb16(255,255,255));
- sem_post(&mutex);
- }
- }
-}
-
-
-/* ----------------------------------------------------------------------------- */
-
-
-/** FUNZIONE CHE CALCOLA LA DISTANZA DAL VEICOLO CHE PRECEDE SULLA CORSIA **/
-
-int dist_ant(int pos_x,int pos_y,int distsic)
-{
- int libero; /* variabile che indica se l'attuale posizione puntata dal veicolo e' libera */
- int distant; /* distanza dal veicolo che ci precede */
- int fine; /* variabile ausiliaria per capire se sto' arrivando alla fine della strada */
-
- /* inizializzazione delle variabili */
- libero=0;
- distant=0;
-
- /* calcola la distanza da un eventuale veicolo che ci precede */
- sem_wait(&strada);
- if (pos_y<CENTROCARREGGIATA) /* controlla se il veicolo e' nella prima corsia, altrimenti e' in seconda corsia */
- while (libero==0 && distant<distsic) /* il calcolo della distanza da un veicolo che ci precede termina quando viene trovato un veicolo o si raggiunge la lunghezza massima di visione del sensore */
- {
- fine=pos_x+distant; /* nel caso in cui il veicolo si giunto alla fine dell'autostrada si assume che il sensore ritorni un valore come nel caso in cui non sia preceduto da nessun veicolo */
- if (fine>40000)
- distant=distsic;
- else
- if (corsia2[fine]!=0) /* se la strada e' occupata da un'altro veicolo pongo la variabile libero ad uno (strada occupata), altrimenti in caso contrario incremento la distanza analizzata dal sensore */
- libero=1;
- else
- distant++;
- }
- else /* il veicolo e' nella seconda corsia */
- while (libero==0 && distant<distsic) /* il calcolo della distanza da un veicolo che ci precede termina quando viene trovato un veicolo o si raggiunge la lunghezza massima di visione del sensore */
- {
- fine=pos_x+distant; /* nel caso in cui il veicolo si giunto alla fine dell'autostrada si assume che il sensore ritorni un valore come nel caso in cui non sia preceduto da nessun veicolo */
- if (fine>40000)
- distant=distsic;
- else
- if (corsia1[fine]!=0) /* se la strada e' occupata da un'altro veicolo pongo la variabile libero ad uno (strada occupata), altrimenti in caso contrario incremento la distanza analizzata dal sensore */
- libero=1;
- else
- distant++;
- }
- sem_post(&strada);
-
- return(distant); /* ritorna il valore della distanza misurata dal sensore , se non ha trovato nessun veicolo tale distanza e' pari alla massima lunghezza a cui puo' arrivare il sensore */
-}
-
-
-/* ----------------------------------------------------------------------------- */
-
-
-/** FUNZIONE CHE CALCOLA LA DISTANZA ANTERIORE DESTRA DI UN VEICOLO CHE PRECEDE **/
-
-int dist_ant_dx(int pos_x,int pos_y,int distsicdx)
-{
- int distantdx; /* distanza dal veicolo che ci precede a destra */
- int libero; /* variabile che indica se l'attuale posizione puntata dal veicolo e' libera */
- int fine; /* variabile ausiliaria per capire se sto' arrivando alla fine della strada */
-
- /* inizializzazione delle variabili */
- libero=0;
- distantdx=0;
-
- sem_wait(&strada);
- while (libero==0 && distantdx<distsicdx) /* il calcolo della distanza da un veicolo che ci precede a destra termina quando viene trovato un veicolo o si raggiunge la lunghezza massima di visione del sensore */
- {
- fine=pos_x+distantdx; /* nel caso in cui il veicolo sia giunto alla fine dell'autostrada si assume che il sensore ritorni un valore come nel caso in cui non sia preceduto da nessun veicolo */
- if (fine>40000)
- distantdx=distsicdx;
- else
- if (corsia1[fine]!=0) /* se la strada e' occupata da un'altro veicolo pongo la variabile libero ad uno (strada occupata), altrimenti in caso contrario incremento la distanza analizzata dal sensore */
- libero=1;
- else
- distantdx++;
- }
- sem_post(&strada);
-
- return(distantdx); /* ritorna il valore della distanza misurata dal sensore , se non ha trovato nessun veicolo tale distanza e' pari alla massima lunghezza a cui puo' arrivare il sensore */
-}
-
-
-/* ----------------------------------------------------------------------------- */
-
-
-/** FUNZIONE CHE CALCOLA LA DISTANZA ANTERIORE SINISTRA DI UN VEICOLO CHE PRECEDE **/
-
-int dist_ant_sx(int pos_x,int pos_y,int distsicsx)
-{
- int distantsx; /* distanza dal veicolo che ci precede a sinistra */
- int libero; /* variabile che indica se l'attuale posizione puntata dal veicolo e' libera */
- int fine; /* variabile ausiliaria per capire se sto' arrivando alla fine della strada */
-
- /* inizializzazione delle variabili */
- libero=0;
- distantsx=0;
-
- sem_wait(&strada);
- while (libero==0 && distantsx<distsicsx) /* il calcolo della distanza da un veicolo che ci precede a sinistra termina quando viene trovato un veicolo o si raggiunge la lunghezza massima di visione del sensore */
- {
- fine=pos_x+distantsx; /* nel caso in cui il veicolo si giunto alla fine dell'autostrada si assume che il sensore ritorni un valore come nel caso in cui non sia preceduto da nessun veicolo */
- if (fine>40000)
- distantsx=distsicsx;
- else
- if (corsia2[fine]!=0) /* se la strada e' occupata da un'altro veicolo pongo la variabile libero ad uno (strada occupata), altrimenti in caso contrario incremento la distanza analizzata dal sensore */
- libero=1;
- else
- distantsx++;
- }
- sem_post(&strada);
-
- return(distantsx); /* ritorna il valore della distanza misurata dal sensore , se non ha trovato nessun veicolo tale distanza e' pari alla massima lunghezza a cui puo' arrivare il sensore */
-}
-
-
-/* ----------------------------------------------------------------------------- */
-
-
-/** FUNZIONE CHE CALCOLA LA DISTANZA POSTERIORE SINISTRA DI UN VEICOLO CHE INSEGUE **/
-
-int dist_postsx (int pos_x,int pos_y,int distsorp)
-{
- int distpostsx; /* distanza dal veicolo che ci insegue a sinistra */
- int libero; /* variabile che indica se l'attuale posizione puntata dal veicolo e' libera */
- int inizio; /* variabile ausiliaria per capire se sono all'inizio della strada */
-
- /* inizializzazione delle variabili */
- distpostsx=0;
- libero=0;
-
- sem_wait(&strada);
- while (libero==0 && distpostsx<distsorp) /* il calcolo della distanza da un veicolo che ci insegue a sinistra termina quando viene trovato un veicolo o si raggiunge la lunghezza massima di visione del sensore */
- {
- inizio=pos_x-distpostsx; /* nel caso in cui il veicolo si giunto alla fine dell'autostrada si assume che il sensore ritorni un valore come nel caso in cui non sia insuguito da nessun veicolo */
- if (inizio<0)
- distpostsx=distsorp;
- else
- if (corsia2[inizio]!=0) /* se la strada e' occupata da un'altro veicolo pongo la variabile libero ad uno (strada occupata), altrimenti in caso contrario incremento la distanza analizzata dal sensore */
- libero=1;
- else
- distpostsx++;
- }
- sem_post(&strada);
-
- return(distpostsx); /* ritorna il valore della distanza misurata dal sensore , se non ha trovato nessun veicolo tale distanza e' pari alla massima lunghezza a cui puo' arrivare il sensore */
-}
-
-
-/* ----------------------------------------------------------------------------- */
-
-
-/** FUNZIONE CHE CALCOLA LA DISTANZA POSTERIORE DESTRA DI UN VEICOLO CHE INSEGUE **/
-
-int dist_postdx (int pos_x,int pos_y,int distrientro)
-{
- int distpostdx; /* distanza dal veicolo che ci insegue a destra */
- int libero; /* variabile che indica se l'attuale posizione puntata dal veicolo e' libera */
- int inizio; /* variabile ausiliaria per capire se sono all'inizio della strada */
-
- /* inizializzazione delle variabili */
- libero=0;
- distpostdx=0;
-
- sem_wait(&strada);
- while (libero==0 && distpostdx<distrientro) /* il calcolo della distanza da un veicolo che ci insegue a destra termina quando viene trovato un veicolo o si raggiunge la lunghezza massima di visione del sensore */
- {
- inizio=pos_x-distpostdx; /* nel caso in cui il veicolo si giunto alla fine dell'autostrada si assume che il sensore ritorni un valore come nel caso in cui non sia inseguito da nessun veicolo */
- if (inizio<0)
- distpostdx=distrientro;
- else
- if (corsia1[inizio]!=0) /* se la strada e' occupata da un'altro veicolo pongo la variabile libero ad uno (strada occupata), altrimenti in caso contrario incremento la distanza analizzata dal sensore */
- libero=1;
- else
- distpostdx++;
- }
- sem_post(&strada);
-
- return(distpostdx); /* ritorna il valore della distanza misurata dal sensore , se non ha trovato nessun veicolo tale distanza e' pari alla massima lunghezza a cui puo' arrivare il sensore */
-}
-
-
-/* ----------------------------------------------------------------------------- */
-
-
-/**************************** TASK AUTO LENTA ******************************/
-
-TASK auto_lenta(void *arg)
-{
- int x; /* posizione x assunta dal veicolo */
- int y; /* posizione y assunta dal veicolo */
- int oxelic; /* posizione vecchia dell'elicottero */
- int ox; /* posizione vecchia x dall'auto lenta */
- int oy; /* posizione vecchia y dall'auto lenta */
- int k; /* indice di ciclo */
- int estremo; /* distanza massima a cui ci possiamo spostare dall'elicottero (sia a destra che a sinistra) */
- int sorpasso; /* indica se il veicolo e' in fase di sorpasso */
- int rientro; /* indica se il veicolo e' in fase di rientro */
- int precedentedritto; /* distanza anteriore da un veicolo */
- int od; /* vecchia distanza anteriore da un veicolo */
- int tot; /* distanza massima raggiungibile del sensore posteriore sinistro */
- int tot3; /* distanza massima raggiungibile del sensore anteriore destro */
- int tot2; /* distanza massima raggiungibile del sensore posteriore destro */
- int i = (int)arg;
- int sensore_ant=200; /* distanza massima raggiungibile del sensore anteriore */
- char stri[22]; /* vettore di caratteri */
- char ostri[22]; /* vettore di caratteri */
- float vcrociera; /* velocita' desiderata */
- float vmax2=35.0; /* velocita' massima raggiungibile in seconda corsia */
- float vmax1=25.0; /* velocita' massima raggiungibile in prima corsia */
- float frenata=-7.0; /* valore massimo della frenata */
- float amax=10.0; /* valore massimo dell'accellerazione */
- float v; /* velocita' attuale */
- float a; /* accellerazione attuale */
- float ov; /* velocita' precedente */
- float oa; /* accellerazione precedente */
-
- /* inizializzazione delle variabili */
- v=5.0;
- a=0.0;
- x=LUNGLENTA;
- y=CENTROCORSIA1;
- sorpasso=0;
- rientro=0;
- tot=100;
- tot2=150;
- tot3=100;
- vcrociera=vmax1;
- oa=a;
- ov=v;
- od=0;
- oxelic=xelic;
- estremo=(int)((MAX_X/2)-1);
-
- while (1)
- {
- /* cancella il veicolo se era presente sull'autostrada vista dall'elicottero */
- if (abs(oxelic-ox)<estremo)
- draw_veicolo(ox-oxelic+estremo, oy, 0,LUNGLENTA,LARGLENTA);
-
- /* salva le vecchie coordinate */
- ox = x;
- oy = y;
-
- /* cancella il veicolo dalla vecchia posizione sulla corsia , andando a cancellarlo nel vettore della corsia in cui si trovava */
- sem_wait(&strada);
- for (k=0;k<LUNGLENTA;k++)
- {
- if ((oy<CENTROCORSIA1) && (oy>CENTROCORSIA2))
- {
- corsia1[ox-k]=0;
- corsia2[ox-k]=0;
- }
- else
- if (oy==CENTROCORSIA1)
- corsia1[ox-k]=0;
- else
- if (oy==CENTROCORSIA2)
- corsia2[ox-k]=0;
- }
- sem_post(&strada);
-
- /* cancella tutte le vecchie informazioni che compaiono sullo schermo */
- sprintf(stri,"posizione %d",(int)(ox*0.25));
- sem_wait(&mutex);
- grx_text(stri,70,50+i*10,rgb16(0,0,0),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(ostri,"a %nf",oa);
- sem_wait(&mutex);
- grx_text(ostri,300,50+i*10,rgb16(0,0,0),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(ostri,"v %nf",ov);
- sem_wait(&mutex);
- grx_text(ostri,200,50+i*10,rgb16(0,0,0),rgb16(0,0,0));
- sem_post(&mutex);
-
- /* legge la distanza dal sensore anteriore e nel caso in cui sia attaccato alla macchina che precede vengo eliminato */
- precedentedritto=dist_ant(x,y,sensore_ant);
- if (precedentedritto==1)
- task_abort(i);
-
- /* disegna il veicolo nella nuova posizione */
- if (abs(xelic-x)<estremo)
- draw_veicolo(x-xelic+estremo, y, rgb16(255,0,0),LUNGLENTA,LARGLENTA);
-
- /* varia la massima distanza vista dal sensore posteriore sinistro a seconda della velocita' */
- tot=(int)(v*4);
- if (tot<50)
- tot=50;
-
- if (precedentedritto<100) /* ci siamo avvicinando troppo alla macchina che ci precede */
- if ((sorpasso==0) && (dist_postsx(x,y,200)>tot)&&(dist_ant_sx(x,y,50)>40))
- {
- /* c'e' uno davanti e non sopraggiunge nessuno sulla corsia di sorpasso */
- sorpasso=1;
- rientro=0;
- vcrociera=vmax2;
- }
- else
- a=frenata; /* c'e qualcuno davanti ,ma non possiamo sorpassare */
- else /* siamo lontani da un veicolo che ci precede o non ci precede nessuno */
- if (v<vcrociera) /* accelleriamo gradualmente fino a portarci alla velocita' di crociera desiderata */
- a=amax-(amax/vcrociera)*v;
- else
- if(v>vcrociera) /* freniamo per portarci al valore della velocita'di crociera */
- a=frenata/3;
- else
- a=0.0; /* siamo alla velocita' di crociera */
-
- /* controlla se e' possibile la manovra di rientro dal sorpasso, aggiustando tutti i parametri nel modo corretto */
- if ((dist_postdx(x,y,200)>tot2) && (dist_ant_dx(x,y,200)>tot3) && (sorpasso==1))
- {
- rientro=1;
- sorpasso=0;
- vcrociera=vmax1;
- }
-
- /* aggiusta la cordinata y per far visualizzare il sorpasso o il rientro della macchina in modo graduale */
- if(y>CENTROCORSIA2 && sorpasso==1)
- y=y-1;
-
- if(y<CENTROCORSIA1 && rientro==1)
- y=y+1;
-
- /* calcola la velocita' e nel caso di v elocita' negative la pone a zero (non sono permesse le retromarcie) */
- v=v+a*DT;
- if (v<0)
- v=0.0;
-
- /* calcola la cordinata x a cui si trova la macchina */
- x=x+(int)((v*DT)/0.25);
-
- /* scrive a video i nuovi parametri appena calcolati */
- sprintf(stri,"posizione %d",(int)(x*0.25));
- sem_wait(&mutex);
- grx_text(stri,70,50+i*10,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(ostri,"v %nf",v);
- sem_wait(&mutex);
- grx_text(ostri,200,50+i*10,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(ostri,"a %nf",a);
- sem_wait(&mutex);
- grx_text(ostri,300,50+i*10,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- /* quando il veicolo arriva alla fine dell'autostrada viene eliminato */
- if (x>=40000)
- task_abort(i);
-
- /* salva la nuova posizione del veicolo */
- sem_wait(&strada);
- for (k=0;k<LUNGLENTA;k++)
- {
- if ((y<CENTROCORSIA1) && (y>CENTROCORSIA2))
- {
- corsia2[x-k]=1;
- corsia1[x-k]=1;
- }
- else
- if (y==CENTROCORSIA1)
- corsia1[x-k]=1;
- else
- if (y==CENTROCORSIA2)
- corsia2[x-k]=1;
- }
- sem_post(&strada);
-
- /* salvo i parametri che occorrono per il prossimo ciclo */
- oxelic=xelic;
- od=precedentedritto;
- ov=v;
- oa=a;
-
- task_endcycle(); /* termina le operazioni che il task deve eseguire */
- }
-}
-
-
-/* ----------------------------------------------------------------------------- */
-
-
-/************************** TASK AUTO VELOCE *******************************/
-
-TASK auto_veloce(void *arg)
-{
- int x; /* posizione x assunta dal veicolo */
- int y; /* posizione y assunta dal veicolo */
- int oxelic; /* posizione vecchia dell'elicottero */
- int ox; /* posizione vecchia x dall'auto veloce */
- int oy; /* posizione vecchia y dall'auto veloce */
- int k; /* indice di ciclo */
- int estremo; /* distanza massima a cui ci possiamo spostare dall'elicottero (sia a destra che a sinistra) */
- int sorpasso; /* indica se il veicolo e' in fase di sorpasso */
- int rientro; /* indica se il veicolo e' in fase di rientro */
- int precedentedritto; /* distanza anteriore da un veicolo */
- int od; /* vecchia distanza anteriore da un veicolo */
- int tot; /* distanza massima raggiungibile del sensore posteriore sinistro */
- int tot3; /* distanza massima raggiungibile del sensore anteriore destro */
- int tot2; /* distanza massima raggiungibile del sensore posteriore destro */
- int i = (int)arg;
- int sensore_ant=200; /* distanza massima raggiungibile del sensore anteriore */
- char stri[22]; /* vettore di caratteri */
- char ostri[22]; /* vettore di caratteri */
- float vcrociera; /* velocita' desiderata */
- float vmax1=35.0; /* velocita' massima raggiungibile in prima corsia */
- float vmax2=40.0; /* velocita' massima raggiungibile in seconda corsia */
- float frenata=-7.0; /* valore massimo della frenata */
- float amax=15.0; /* valore massimo del'accellerazione */
- float v; /* velocita' attuale */
- float a; /* accellerazione attuale */
- float ov; /* velocita' precedente */
- float oa; /* accellerazione precedente */
-
- /* inizializzazione delle variabili */
- v=5.0;
- a=0.0;
- x=LUNGVELOCE;
- y=CENTROCORSIA1;
- sorpasso=0;
- rientro=0;
- tot=100;
- tot2=150;
- tot3=100;
- oa=a;
- vcrociera=vmax1;
- ov=v;
- od=0;
- oxelic=xelic;
- estremo=(int)((MAX_X/2)-1);
-
- while (1)
- {
- /* cancella il veicolo se era presente sull'autostrada vista dall'elicottero */
- if (abs(oxelic-ox)<estremo)
- draw_veicolo(ox-oxelic+estremo, oy, 0,LUNGVELOCE,LARGVELOCE);
-
- /* salva le vecchie coordinate */
- ox = x;
- oy = y;
-
- /* cancella il veicolo dalla vecchia posizione sulla corsia , andando a cancellarlo nel vettore della corsia in cui si trovava */
- sem_wait(&strada);
- for (k=0;k<LUNGVELOCE;k++)
- {
- if ((oy<CENTROCORSIA1) && (oy>CENTROCORSIA2))
- {
- corsia1[ox-k]=0;
- corsia2[ox-k]=0;
- }
- else
- if (oy==CENTROCORSIA1)
- corsia1[ox-k]=0;
- else
- if (oy==CENTROCORSIA2)
- corsia2[ox-k]=0;
- }
- sem_post(&strada);
-
- /* cancella tutte le vecchie informazioni che compaiono sullo schermo */
- sprintf(stri,"posizione %d",(int)(ox*0.25));
- sem_wait(&mutex);
- grx_text(stri,70,50+i*10,rgb16(0,0,0),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(ostri,"v %nf",ov);
- sem_wait(&mutex);
- grx_text(ostri,200,50+i*10,rgb16(0,0,0),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(ostri,"a %nf",oa);
- sem_wait(&mutex);
- grx_text(ostri,300,50+i*10,rgb16(0,0,0),rgb16(0,0,0));
- sem_post(&mutex);
-
- /* legge la distanza dal sensore anteriore e nel caso in cui sia attaccato alla macchina che precede vengo eliminato */
- precedentedritto=dist_ant(x,y,sensore_ant);
- if (precedentedritto==1)
- task_abort(i);
-
- /* disegna il veicolo nella nuova posizione */
- if (abs(xelic-x)<estremo)
- draw_veicolo(x-xelic+estremo, y, rgb16(0,255,0),LUNGVELOCE,LARGVELOCE);
-
-
- /* varia la massima distanza vista dal sensore posteriore sinistro a seconda della velocita' */
- tot=(int)(v*4);
- if (tot<50)
- tot=50;
-
- if (precedentedritto<150) /* ci siamo avvicinando troppo alla macchina che ci precede */
- if ((sorpasso==0) && (dist_postsx(x,y,200)>tot)&&(dist_ant_sx(x,y,50)>40))
- {
- /* c'e' uno davanti e non sopraggiunge nessuno sulla corsia di sorpasso */
- sorpasso=1;
- rientro=0;
- vcrociera=vmax2;
- }
- else /* c'e qualcuno davanti ,ma non possiamo sorpassare */
- a=frenata;
- else /* siamo lontani da un veicolo che ci precede o non ci precede nessuno */
- if (v<vcrociera) /* accelleriamo gradualmente fino a portarci alla velocita' di crociera desiderata */
- a=amax-(amax/vcrociera)*v;
- else
- if(v>vcrociera) /* freniamo per portarci al valore della velocita'di crociera */
- a=frenata/3;
- else
- a=0.0; /* siamo alla velocita' di crociera */
-
- /* controlla se e' possibile la manovra di rientro dal sorpasso, aggiustando tutti i parametri nel modo corretto */
- if ((dist_postdx(x,y,200)>tot2) && (dist_ant_dx(x,y,200)>tot3) && (sorpasso==1))
- {
- rientro=1;
- sorpasso=0;
- vcrociera=vmax1;
- }
-
- /* aggiusta la cordinata y per far visualizzare il sorpasso o il rientro della macchina in modo graduale */
- if(y>CENTROCORSIA2 && sorpasso==1)
- y=y-1;
-
- if(y<CENTROCORSIA1 && rientro==1)
- y=y+1;
-
- /* calcola la velocita' e nel caso di v elocita' negative la pone a zero (non sono permesse le retromarcie) */
- v=v+a*DT;
- if (v<0)
- v=0.0;
-
- /* calcola la cordinata x a cui si trova la macchina */
- x=x+(int)((v*DT)/0.25);
-
- /* scrive a video i nuovi parametri appena calcolati */
- sprintf(stri,"posizione %d",(int)(x*0.25));
- sem_wait(&mutex);
- grx_text(stri,70,50+i*10,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(ostri,"v %nf",v);
- sem_wait(&mutex);
- grx_text(ostri,200,50+i*10,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(ostri,"a %nf",a);
- sem_wait(&mutex);
- grx_text(ostri,300,50+i*10,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- /* quando il veicolo arriva alla fine dell'autostrada viene eliminato */
- if (x>=40000)
- task_abort(i);
-
- /* salva la nuova posizione del veicolo */
- sem_wait(&strada);
- for (k=0;k<LUNGVELOCE;k++)
- {
- if ((y<CENTROCORSIA1) && (y>CENTROCORSIA2))
- {
- corsia2[x-k]=1;
- corsia1[x-k]=1;
- }
- else
- if (y==CENTROCORSIA1)
- corsia1[x-k]=1;
- else
- if (y==CENTROCORSIA2)
- corsia2[x-k]=1;
- }
- sem_post(&strada);
-
- /* salvo i parametri che occorrono per il prossimo ciclo */
- oxelic=xelic;
- od=precedentedritto;
- ov=v;
- oa=a;
-
- task_endcycle(); /* termina le operazioni che il task deve eseguire */
- }
-}
-
-
-/* ----------------------------------------------------------------------------- */
-
-
-/***************************** TASK AUTOCARRO ******************************/
-
-TASK auto_carro(void *arg)
-{
- int x; /* posizione x assunta dal veicolo */
- int y; /* posizione y assunta dal veicolo */
- int oxelic; /* posizione vecchia dell'elicottero */
- int ox; /* posizione vecchia x assunta dal camion */
- int oy; /* posizione vecchia y assunta dal camion */
- int k; /* indice di ciclo */
- int estremo; /* distanza massima a cui ci possiamo spostare dall'elicottero (sia a destra che a sinistra) */
- int sorpasso; /* indica se il veicolo e' in fase di sorpasso */
- int rientro; /* indica se il veicolo e' in fase di rientro */
- int precedentedritto; /* distanza anteriore da un veicolo */
- int od; /* vecchia distanza anteriore da un veicolo */
- int tot; /* distanza massima raggiungibile del sensore posteriore sinistro */
- int tot3; /* distanza massima raggiungibile del sensore anteriore destro */
- int tot2; /* distanza massima raggiungibile del sensore posteriore destro */
- int i = (int)arg;
- int sensore_ant=200; /* distanza massima raggiungibile del sensore anteriore */
- char stri[22]; /* vettore di caratteri */
- char ostri[22]; /* vettore di caratteri */
- float vcrociera; /* velocita' desiderata */
- float vmax1=15.0; /* velocita' massima raggiungibile in prima corsia */
- float vmax2=20.0; /* velocita' massima raggiungibile in seconda corsia */
- float frenata=-5.0; /* valore massimo della frenata */
- float amax=3.0; /* valore massimo del'accellerazione */
- float v; /* velocita' attuale */
- float a; /* accellerazione attuale */
- float ov; /* velocita' precedente */
- float oa; /* accellerazione precedente */
-
- /* inizializzazione delle variabili */
- v=5.0;
- a=0.0;
- x=LUNGCAMION;
- y=CENTROCORSIA1;
- sorpasso=0;
- rientro=0;
- tot=100;
- tot2=150;
- tot3=100;
- oa=a;
- vcrociera=vmax1;
- ov=v;
- od=0;
- oxelic=xelic;
- estremo=(int)((MAX_X/2)-1);
-
- while (1)
- {
- /* cancella il veicolo se era presente sull'autostrada vista dall'elicottero */
- if (abs(oxelic-ox)<estremo)
- draw_veicolo(ox-oxelic+estremo, oy, 0,LUNGCAMION,LARGCAMION);
-
- /* salva le vecchie coordinate */
- ox = x;
- oy = y;
-
- /* cancella il veicolo dalla vecchia posizione sulla corsia , andando a cancellarlo nel vettore della corsia in cui si trovava */
- sem_wait(&strada);
- for (k=0;k<LUNGCAMION;k++)
- {
- if ((oy<CENTROCORSIA1) && (oy>CENTROCORSIA2))
- {
- corsia1[ox-k]=0;
- corsia2[ox-k]=0;
- }
- else
- if (oy==CENTROCORSIA1)
- corsia1[ox-k]=0;
- else
- if (oy==CENTROCORSIA2)
- corsia2[ox-k]=0;
- }
- sem_post(&strada);
-
- /* cancella tutte le vecchie informazioni che compaiono sullo schermo */
- sprintf(stri,"posizione %d",(int)(ox*0.25));
- sem_wait(&mutex);
- grx_text(stri,70,50+i*10,rgb16(0,0,0),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(ostri,"v %nf",ov);
- sem_wait(&mutex);
- grx_text(ostri,200,50+i*10,rgb16(0,0,0),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(ostri,"a %nf",oa);
- sem_wait(&mutex);
- grx_text(ostri,300,50+i*10,rgb16(0,0,0),rgb16(0,0,0));
- sem_post(&mutex);
-
- /* legge la distanza dal sensore anteriore e nel caso in cui sia attaccato alla macchina che precede vengo eliminato */
- precedentedritto=dist_ant(x,y,sensore_ant);
- if (precedentedritto==1)
- task_abort(i);
-
- /* disegna il veicolo nella nuova posizione */
- if (abs(xelic-x)<estremo)
- draw_veicolo(x-xelic+estremo, y, rgb16(0,0,255),LUNGCAMION,LARGCAMION);
-
- /* varia la massima distanza vista dal sensore posteriore sinistro a seconda della velocita' */
- tot=(int)(v*4);
- if (tot<50)
- tot=50;
-
- if (precedentedritto<100) /* ci siamo avvicinando troppo alla macchina che ci precede */
- if ((sorpasso==0) && (dist_postsx(x,y,200)>tot)&&(dist_ant_sx(x,y,50)>40))
- {
- /* c'e' uno davanti e non sopraggiunge nessuno sulla corsia di sorpasso */
- sorpasso=1;
- rientro=0;
- vcrociera=vmax2;
- }
- else /* c'e qualcuno davanti ,ma non possiamo sorpassare */
- a=frenata;
- else /* siamo lontani da un veicolo che ci precede o non ci precede nessuno */
- if (v<vcrociera) /* accelleriamo gradualmente fino a portarci alla velocita' di crociera desiderata */
- a=amax-(amax/vcrociera)*v;
- else
- if(v>vcrociera) /* freniamo per portarci al valore della velocita'di crociera */
- a=frenata/3;
- else
- a=0.0; /* siamo alla velocita' di crociera */
-
- /* controlla se e' possibile la manovra di rientro dal sorpasso, aggiustando tutti i parametri nel modo corretto */
- if ((dist_postdx(x,y,200)>tot2) && (dist_ant_dx(x,y,200)>tot3) && (sorpasso==1))
- {
- rientro=1;
- sorpasso=0;
- vcrociera=vmax1;
- }
-
- /* aggiusta la cordinata y per far visualizzare il sorpasso o il rientro della macchina in modo graduale */
- if(y>CENTROCORSIA2 && sorpasso==1)
- y=y-1;
-
- if(y<CENTROCORSIA1 && rientro==1)
- y=y+1;
-
- /* calcola la velocita' e nel caso di v elocita' negative la pone a zero (non sono permesse le retromarcie) */
- v=v+a*DT;
- if (v<0)
- v=0.0;
-
- /* calcola la cordinata x a cui si trova la macchina */
- x=x+(int)((v*DT)/0.25);
-
- /* scrive a video i nuovi parametri appena calcolati */
- sprintf(stri,"posizione %d",(int)(x*0.25));
- sem_wait(&mutex);
- grx_text(stri,70,50+i*10,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(ostri,"v %nf",v);
- sem_wait(&mutex);
- grx_text(ostri,200,50+i*10,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(ostri,"a %nf",a);
- sem_wait(&mutex);
- grx_text(ostri,300,50+i*10,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- /* quando il veicolo arriva alla fine dell'autostrada viene eliminato */
- if (x>=40000)
- task_abort(i);
-
- /* salva la nuova posizione del veicolo */
- sem_wait(&strada);
- for (k=0;k<LUNGCAMION;k++)
- {
- if ((y<CENTROCORSIA1) && (y>CENTROCORSIA2))
- {
- corsia2[x-k]=1;
- corsia1[x-k]=1;
- }
- else
- if (y==CENTROCORSIA1)
- corsia1[x-k]=1;
- else
- if (y==CENTROCORSIA2)
- corsia2[x-k]=1;
- }
- sem_post(&strada);
-
- /* salvo i parametri che occorrono per il prossimo ciclo */
- oxelic=xelic;
- od=precedentedritto;
- ov=v;
- oa=a;
-
- task_endcycle(); /* termina le operazioni che il task deve eseguire */
- }
-}
-
-
-/* ----------------------------------------------------------------------------- */
-
-
-/***************************** TASK ELICOTTERO *****************************/
-
-TASK eli_cottero(void *arg)
-{
- int i = (int)arg;
- int oxelic; /* vecchia posizione dell'elicottero */
- char stri[22]; /* vettore di caratteri */
- char ostri[22]; /* vettore di caratteri */
-
- /* disegna le scritte per l'indicatore a barra e finestra della posizione dell'elicottero */
- sprintf(stri,"0 Km");
- sem_wait(&mutex);
- grx_text(stri,100,560,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(stri,"10 Km");
- sem_wait(&mutex);
- grx_text(stri,700,560,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- while (1)
- {
- oxelic=xelic; /* salva la posizione precedente dell'elicottero */
-
- if (c == '+') /* sposta l'elicottero a destra (verso la fine dell'autostrada */
- {
- xelic=xelic+50;
- if (xelic>40000-(int)((MAX_X/2)-1))
- xelic=40000-(int)((MAX_X/2)-1);
- }
- else
- if (c =='-') /* sposta l'elicottero a sinistra (verso l'inizio dell'autostrada */
- {
- xelic=xelic-30;
- if (xelic<(int)((MAX_X/2)-1))
- xelic=(int)((MAX_X/2)-1);
- }
-
- /* disegna le scritte innerenti all'elicottero e il valore della sua posizione (mediante scritta ed indicatore a barra con una finestra scorrevole) */
- sprintf(stri,"- <- xelic %d -> +",(int)(xelic*0.25));
- sprintf(ostri,"- <- xelic %d -> +",(int)(oxelic*0.25));
-
- sem_wait(&mutex);
- grx_text(ostri,MAX_X/2-50,500,rgb16(0,0,0),rgb16(0,0,0));
- grx_text(stri,MAX_X/2-50,500,rgb16(255,255,255),rgb16(0,0,0));
- grx_line(150,560,650,560,rgb16(255,255,255));
- grx_rect((int)((oxelic-(MAX_X/2))/80+150),540,(int)((oxelic+(MAX_X/2))/80+150) ,580 ,rgb16(0,0,0));
- grx_rect((int)((xelic-(MAX_X/2))/80+150),540,(int)((xelic+(MAX_X/2))/80+150) ,580 ,rgb16(255,255,255));
- sem_post(&mutex);
-
- c=' '; /* setta il carattere c */
-
- task_endcycle(); /* termina le operazioni che il task deve eseguire */
- }
-}
-
-
-/* -----------------------------------------------------------------------------*/
-
-
-/************* FUNZIONE DI USCITA DAL SISTEMA ******************************/
-
-void byebye(void *arg)
-{ /* questa funzione e' chiamata quando il sistema esce */
- grx_close(); /* chiude la grafica */
- kern_printf("Ciao Ciao "); /* scrive il messaggio indicato sul terminale */
-}
-
-
-/* -----------------------------------------------------------------------------*/
-
-
-/********************************* MAIN ************************************/
-
-int main(int argc, char **argv)
-{
- int n_task = 0; /* numero di task creati */
- int u;
- int v;
- char introduzione[100]; /* vettore di caratteri */
- HARD_TASK_MODEL autolenta; /* task auto lenta */
- HARD_TASK_MODEL autoveloce; /* task auto veloce */
- HARD_TASK_MODEL autocarro; /* task camion */
- HARD_TASK_MODEL elicottero; /* task elicottero */
-
-
- /* inizializza le corsie dell'autostrada */
- sem_wait(&strada);
- for (u=0;u<=40000;u++)
- {
- corsia1[u]=0;
- corsia2[u]=0;
- }
- sem_post(&strada);
-
- /* Set the exception handler */
- //set_exchandler_grx();
-
- /* Set the closing function */
- sys_atrunlevel(byebye, NULL, RUNLEVEL_BEFORE_EXIT);
-
- /* inizializzazione grafica */
- if (grx_init() < 1)
- sys_abort(1);
-
- /* scelta automatica della risoluzione applicabile con quella scheda video (scegliendola tra 800*600 e 1024*768 ) */
- if(grx_getmode(1024,768,16)==-1)
- {
- if (grx_open(800, 600, 16) < 0)
- {
- kern_printf("GRX Err\n");
- sys_abort(1);
- }
- MAX_X=800;
- MAX_Y=600;
- }
- else
- {
- if (grx_open(1024,768, 16) < 0)
- {
- kern_printf("GRX Err\n");
- sys_abort(1);
- }
- MAX_X=1024;
- MAX_Y=768;
- }
-
- kern_printf("La scheda video va'!!\n");
-
- /* posizione iniziale elicottero */
- xelic=(int)((MAX_X/2)-1);
-
- /* disegna lo scenario della strada ed il menu */
- sprintf(introduzione,"Monitoraggio dei mezzi che transitano su una autostrada.");
- sem_wait(&mutex);
- grx_text(introduzione,50,10,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(introduzione,"Sviluppato da: Verzellesi Quadrubbi");
- sem_wait(&mutex);
- grx_text(introduzione,50,20,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(introduzione,"MENU");
- sem_wait(&mutex);
- grx_text(introduzione,480,70,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(introduzione,"s = macchina sportiva");
- sem_wait(&mutex);
- grx_text(introduzione,480,80,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(introduzione,"c = mezzo pesante");
- sem_wait(&mutex);
- grx_text(introduzione,480,90,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(introduzione,"l = macchina lenta");
- sem_wait(&mutex);
- grx_text(introduzione,480,100,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(introduzione,"+ = sposta l'elicottero verso destra");
- sem_wait(&mutex);
- grx_text(introduzione,480,110,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(introduzione,"- = sposta l'elicottero verso sinistra");
- sem_wait(&mutex);
- grx_text(introduzione,480,120,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(introduzione,"esc = uscita");
- sem_wait(&mutex);
- grx_text(introduzione,480,130,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(introduzione,"NOTA");
- sem_wait(&mutex);
- grx_text(introduzione,480,140,rgb16(255,0,0),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(introduzione,"Se i veicoli tamponano ");
- sem_wait(&mutex);
- grx_text(introduzione,480,150,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- sprintf(introduzione," vengono eliminati");
- sem_wait(&mutex);
- grx_text(introduzione,480,160,rgb16(255,255,255),rgb16(0,0,0));
- sem_post(&mutex);
-
- grx_line(1,450,MAX_X,450,rgb16(255,255,255));
- grx_line(1,486,MAX_X,486,rgb16(255,255,255));
-
- for (u=0;u<MAX_X;u++)
- {
- v=u%8;
- if ((v==0) || (v==1))
- {
- sem_wait(&mutex);
- grx_plot(u,CENTROCARREGGIATA,rgb16(255,255,255));
- sem_post(&mutex);
- }
- }
-
- n_task=0; /* inizializzazione del numero dei task */
-
- /* definisce e crea il task elicottero */
- kern_printf("elicottero");
- hard_task_default_model (elicottero);
- hard_task_def_ctrl_jet (elicottero);
- hard_task_def_arg (elicottero, (void *)n_task);
- hard_task_def_wcet (elicottero,wcet);
- hard_task_def_mit (elicottero, periodo);
- hard_task_def_group (elicottero, GRUPPO);
- hard_task_def_usemath (elicottero);
- pid = task_create ("elicottero",eli_cottero, &elicottero, NULL);
- if (pid == NIL)
- {
- grx_close();
- perror("Non si puo' creare il task");
- sys_abort(1);
- }
- task_activate(pid);
-
- n_task=1; /* incremente il numero dei task (ha creato l'elicottero */
-
- /*Attesa di un carattere per creare un veicolo */
- c = keyb_getch(BLOCK);
- do {
- if (((c == 'c')||(c=='s')||(c=='l')) && (n_task < MAX_V)) /* in base al tasto premuto crea il task opportuno */
- {
- if (c == 'l') /* definisce e crea il task autolenta */
- {
- kern_printf("lenta");
- hard_task_default_model (autolenta);
- hard_task_def_ctrl_jet (autolenta);
- hard_task_def_arg (autolenta, (void *)n_task);
- hard_task_def_wcet (autolenta, wcet);
- hard_task_def_mit (autolenta, periodo);
- hard_task_def_group (autolenta, GRUPPO);
- hard_task_def_usemath (autolenta);
- pid = task_create ("autolenta",auto_lenta, &autolenta, NULL);
- }
- else
- if (c == 's') /* definisce e crea il task autoveloce */
- {
- hard_task_default_model (autoveloce);
- hard_task_def_ctrl_jet (autoveloce);
- hard_task_def_arg (autoveloce, (void *)n_task);
- hard_task_def_wcet (autoveloce, wcet);
- hard_task_def_mit (autoveloce, periodo);
- hard_task_def_group (autoveloce, GRUPPO);
- hard_task_def_usemath (autoveloce);
- pid = task_create ("autoveloce",auto_veloce, &autoveloce, NULL);
- }
- else
- if (c == 'c') /* definisce e crea il task autocarro */
- {
- hard_task_default_model (autocarro);
- hard_task_def_ctrl_jet (autocarro);
- hard_task_def_arg (autocarro, (void *)n_task);
- hard_task_def_wcet (autocarro, wcet);
- hard_task_def_mit (autocarro, periodo);
- hard_task_def_group (autocarro, GRUPPO);
- hard_task_def_usemath (autocarro);
- pid = task_create ("camion",auto_carro, &autocarro, NULL);
- }
-
- if (pid == NIL) /* nel caso in non si possano creare dei task chiude la grafica e con un messaggio segnala l'errore */
- {
- grx_close();
- perror("Non si puo' creare il task");
- sys_abort(1);
- }
-
- task_activate(pid); /* attiva i task */
- n_task++; /* incrementa il numero dei task creati */
- }
-
- c = keyb_getch(BLOCK);
-
- } while (c != ESC); /* termino il tutto solo quando e' stato premuto il tasto esc */
-
- sys_end(); /* esco dal sistema */
-
- return 0;
-}
Index: rel_1_2/autostr/initfile.c
===================================================================
--- rel_1_2/autostr/initfile.c (revision 1198)
+++ rel_1_2/autostr/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 2003-06-04 09:41:15 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2003-06-04 09:41:15 $
- ------------
-
- 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: rel_1_2/mesatex/initfile.c
===================================================================
--- rel_1_2/mesatex/initfile.c (revision 1198)
+++ rel_1_2/mesatex/initfile.c (nonexistent)
@@ -1,119 +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.2 2003-04-28 11:14:08 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.2 $
- Last update: $Date: 2003-04-28 11:14:08 $
- ------------
-
- 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 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(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_init(&kparms);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
Index: rel_1_2/mesatex/mesatex.c
===================================================================
--- rel_1_2/mesatex/mesatex.c (revision 1198)
+++ rel_1_2/mesatex/mesatex.c (nonexistent)
@@ -1,407 +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 <drivers/vga.h>
-#include <drivers/keyb.h>
-
-#include <GL/osmesa.h>
-#include <GL/glut.h>
-
-#include <math.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <kernel/log.h>
-#include <kernel/kern.h>
-
-#ifndef M_PI
-#define M_PI 3.14159265
-#endif
-
-#define WIDTH 640
-#define HEIGHT 480
-#define BYTES_PP 2 //BytesPerPixel
-#define INITSTR G640x480x64K //SVGAlib standard mode definitions
-#define CARD VESA //Video driver
-
-OSMesaContext ctx;
-
-static GLuint TexObj[2];
-static GLfloat Angle = 0.0f;
-static GLboolean UseObj = GL_FALSE;
-
-#if defined(GL_VERSION_1_1) || defined(GL_VERSION_1_2)
-# define TEXTURE_OBJECT 1
-#elif defined(GL_EXT_texture_object)
-# define TEXTURE_OBJECT 1
-# define glBindTexture(A,B) glBindTextureEXT(A,B)
-# define glGenTextures(A,B) glGenTexturesEXT(A,B)
-# define glDeleteTextures(A,B) glDeleteTexturesEXT(A,B)
-#endif
-
-unsigned char *rgb_565_buf = NULL; //RGB 16 bpp Buffer
-unsigned char *video_buf = NULL; //Video Buffer
-
-unsigned long int VMEMLONG = WIDTH * HEIGHT * BYTES_PP / 4; // Used by copy_videomem_16to16
-unsigned long int RGB565MEM = WIDTH * HEIGHT * BYTES_PP; // Total video mem
-
-unsigned long int PERIOD_REFRESH = 60000;
-unsigned long int PERIOD_DISEGNA = 60000;
-
-unsigned long int WCET_REFRESH, WCET_DISEGNA;
-
-TASK refesh(void);
-TASK disegna(void);
-
-PID refresh_PID, disegna_PID;
-
-static void draw( void )
-{
- glDepthFunc(GL_EQUAL);
- /* glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );*/
- glClear( GL_COLOR_BUFFER_BIT );
-
- glColor3f( 1.0, 1.0, 1.0 );
-
- /* draw first polygon */
- glPushMatrix();
- glTranslatef( -1.0, 0.0, 0.0 );
- glRotatef( Angle, 0.0, 0.0, 1.0 );
- if (UseObj) {
-#ifdef TEXTURE_OBJECT
- glBindTexture( GL_TEXTURE_2D, TexObj[0] );
-#endif
- }
- else {
- glCallList( TexObj[0] );
- }
- glBegin( GL_POLYGON );
- glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 );
- glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 );
- glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 );
- glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 );
- glEnd();
- glPopMatrix();
-
- /* draw second polygon */
- glPushMatrix();
- glTranslatef( 1.0, 0.0, 0.0 );
- glRotatef( Angle-90.0, 0.0, 1.0, 0.0 );
- if (UseObj) {
-#ifdef TEXTURE_OBJECT
- glBindTexture( GL_TEXTURE_2D, TexObj[1] );
-#endif
- }
- else {
- glCallList( TexObj[1] );
- }
- glBegin( GL_POLYGON );
- glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 );
- glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 );
- glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 );
- glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 );
- glEnd();
- glPopMatrix();
-
-}
-
-
-static void gl_init()
-{
-
- static GLfloat h = (GLfloat) HEIGHT / (GLfloat) WIDTH;
- static int twidth=8, theight=8;
- static GLubyte tex1[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0 };
-
- static GLubyte tex2[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 2, 2, 0, 0, 0,
- 0, 0, 2, 0, 0, 2, 0, 0,
- 0, 0, 0, 0, 0, 2, 0, 0,
- 0, 0, 0, 0, 2, 0, 0, 0,
- 0, 0, 0, 2, 0, 0, 0, 0,
- 0, 0, 2, 2, 2, 2, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0 };
-
- GLubyte tex[64][3];
- GLint i, j;
-
- //Create the OSMesa Context
- ctx = OSMesaCreateContext(OSMESA_RGB_565, NULL);
-
- //Make Current Context
- OSMesaMakeCurrent(ctx, rgb_565_buf, GL_UNSIGNED_SHORT_5_6_5, WIDTH, HEIGHT);
-
- UseObj = GL_TRUE;
-
- glDisable( GL_DITHER );
-
- /* Setup texturing */
- glEnable( GL_TEXTURE_2D );
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
- glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST );
-
- /* generate texture object IDs */
- if (UseObj) {
-#ifdef TEXTURE_OBJECT
- glGenTextures( 2, TexObj );
-#endif
- }
- else {
- TexObj[0] = glGenLists(2);
- TexObj[1] = TexObj[0]+1;
- }
-
- /* setup first texture object */
- if (UseObj) {
-#ifdef TEXTURE_OBJECT
- glBindTexture( GL_TEXTURE_2D, TexObj[0] );
- assert(glIsTexture(TexObj[0]));
-#endif
- }
- else {
- glNewList( TexObj[0], GL_COMPILE );
- }
- /* red on white */
- for (i=0;i<theight;i++) {
- for (j=0;j<twidth;j++) {
- int p = i*twidth+j;
- if (tex1[(theight-i-1)*twidth+j]) {
- tex[p][0] = 255; tex[p][1] = 0; tex[p][2] = 0;
- }
- else {
- tex[p][0] = 255; tex[p][1] = 255; tex[p][2] = 255;
- }
- }
- }
-
- glTexImage2D( GL_TEXTURE_2D, 0, 3, twidth, theight, 0,
- GL_RGB, GL_UNSIGNED_BYTE, tex );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- if (!UseObj) {
- glEndList();
- }
- /* end of texture object */
-
- /* setup second texture object */
- if (UseObj) {
-#ifdef TEXTURE_OBJECT
- glBindTexture( GL_TEXTURE_2D, TexObj[1] );
- assert(glIsTexture(TexObj[1]));
-#endif
- assert(!glIsTexture(TexObj[1] + 999));
- }
- else {
- glNewList( TexObj[1], GL_COMPILE );
- }
- /* green on blue */
- for (i=0;i<theight;i++) {
- for (j=0;j<twidth;j++) {
- int p = i*twidth+j;
- if (tex2[(theight-i-1)*twidth+j]) {
- tex[p][0] = 0; tex[p][1] = 255; tex[p][2] = 0;
- }
- else {
- tex[p][0] = 0; tex[p][1] = 0; tex[p][2] = 255;
- }
- }
- }
- glTexImage2D( GL_TEXTURE_2D, 0, 3, twidth, theight, 0,
- GL_RGB, GL_UNSIGNED_BYTE, tex );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- if (!UseObj) {
- glEndList();
- }
- /* end texture object */
-
- glViewport(0, 0, (GLint)WIDTH, (GLint)HEIGHT);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- /* glOrtho( -3.0, 3.0, -3.0, 3.0, -10.0, 10.0 );*/
- glFrustum( -2.0, 2.0, 2.0, -2.0, 6.0, 20.0 );
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -8.0 );
-
-}
-
-static int screen(int mode)
-{
-
- vga_modeinfo *minf;
-
- vga_setmode(mode,CARD);
- minf = vga_getmodeinfo(mode);
- if(! (minf->flags & CAPABLE_LINEAR)){
- vga_setmode(TEXT,CARD);
- printk(KERN_INFO "The mode %d is not capable of linear\n",mode);
- return 1;
- }
- vga_setpage(0);
- if(vga_setlinearaddressing() == -1) {
- vga_setmode(TEXT,CARD);
- printk(KERN_INFO "Could not set linear addressing for mode %d\n",mode);
- return 1;
- }
-
- video_buf = vga_getgraphmem();
-
- grx_setbuffer(rgb_565_buf, WIDTH, HEIGHT); //Init of RGB16 version of grx functions
- //created to work with Mesa buffer
- return 0;
-
-}
-
-void program_end(void *arg)
-{
-
- OSMesaDestroyContext(ctx);
- free(rgb_565_buf);
-
- vga_setmode(TEXT,CARD);
-
- sys_end();
-
-}
-
-void program_key_end(KEY_EVT *k)
-{
-
- sys_end();
-
-}
-
-TASK refresh(void)
-{
-
- while(1) {
-
- copy_videomem_16to16(rgb_565_buf, video_buf, VMEMLONG);
- task_endcycle();
-
- }
-
- sys_end();
-
-}
-
-
-TASK disegna(void)
-{
-
- char text[100];
- TIME disegna_TIME, refresh_TIME;
-
- while(1) {
-
- jet_gettable(refresh_PID, &refresh_TIME, 1);
- jet_gettable(disegna_PID, &disegna_TIME, 1);
-
- Angle += 2.0;
-
- draw();
-
- sprintf(text,"Hard Task Refresh PER:%6d us EX:%6d us",(int)PERIOD_REFRESH,(int)refresh_TIME);
- grx_text(text,10,5,rgb16(0,0,255),0);
- sprintf(text,"Hard Task Draw PER:%6d us EX:%6d us",(int)PERIOD_DISEGNA,(int)disegna_TIME);
- grx_text(text,10,15,rgb16(0,0,255),0);
-
- task_endcycle();
-
- }
-
- sys_end();
-
-}
-
-int main (int argc, char *argv[])
-{
-
- HARD_TASK_MODEL ht_refresh, ht_disegna;
-
- sys_atrunlevel(program_end,NULL, RUNLEVEL_BEFORE_EXIT);
-
- clear();
-
- WCET_REFRESH =((long int) PERIOD_REFRESH * (0.45));
- WCET_DISEGNA =((long int) PERIOD_DISEGNA * (0.45));
-
- hard_task_default_model(ht_refresh);
- hard_task_def_wcet(ht_refresh,WCET_REFRESH);
- hard_task_def_mit(ht_refresh,PERIOD_REFRESH);
- hard_task_def_usemath(ht_refresh);
- hard_task_def_group(ht_refresh,1);
- hard_task_def_ctrl_jet(ht_refresh);
-
- refresh_PID = task_create("refresh", refresh, &ht_refresh, NULL);
- if (refresh_PID == -1) {
- 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,30000);
-
- 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);
- }
-
- rgb_565_buf = malloc(RGB565MEM);
-
- gl_init();
-
- if (screen(INITSTR)) {
- printk(KERN_INFO "Graphical initialization failed !!\n");
- sys_end();
- }
-
- memset(rgb_565_buf, 0, RGB565MEM);
-
- group_activate(1);
-
- return 0;
-
-}
Index: rel_1_2/mesatex/readme.txt
===================================================================
--- rel_1_2/mesatex/readme.txt (revision 1198)
+++ rel_1_2/mesatex/readme.txt (nonexistent)
@@ -1,44 +0,0 @@
---------------------------------------
-MESA Demo (tex)
-
-by
-
-Giacomo Guidi <giacomo@gandalf.sssup.it>
-
-Last update 17/03/2003
---------------------------------------
-
-This is a simple test demo for the MESA (5.0)
-libraries, the low level graphic drivers is
-the SVGA (from the SVGAlib)
-
-See drivers/svga/readme for supported cards
-
---------------------------------------
-
-The demo is composed by:
-
-MAKEFILE The makefile used to compile the application
-README.TXT This file
-INITFILE.C The init file
-MESATEX.C The MESA Demo
-
---------------------------------------
-
-- To specify your card change the line
-
-#define CARD <driver name>
-
-- The demo calls the grx and off-screen Mesa functions.
-The resolution must be 16 bitsperpixel (64K colors) and
-the graphic access mode must be linear.
-
-- There are two buffers
-
- The video buffer (video_buf)
- The virtual buffer (rgb_565_buf)
-
- copy_videomem_16to16 links these buffers
-
-
-
Index: rel_1_2/mesatex/makefile
===================================================================
--- rel_1_2/mesatex/makefile (revision 1198)
+++ rel_1_2/mesatex/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = mesatex
-
-include $(BASE)/config/example.mk
-
-mesatex:
- make -f $(SUBMAKE) APP=mesatex INIT= OTHEROBJS="initfile.o" SHARKOPT="__OSMESA__ __OLDCHAR__ __SVGA__"
-
Index: rel_1_2/auto/jetctrl.c
===================================================================
--- rel_1_2/auto/jetctrl.c (revision 1198)
+++ rel_1_2/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 2002-09-02 09:37:42 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:42 $
- ------------
-**/
-
-/*
- * 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: rel_1_2/auto/cars/car0.raw
===================================================================
--- rel_1_2/auto/cars/car0.raw (revision 1198)
+++ rel_1_2/auto/cars/car0.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/cars/car1.raw
===================================================================
--- rel_1_2/auto/cars/car1.raw (revision 1198)
+++ rel_1_2/auto/cars/car1.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/cars/car2.raw
===================================================================
--- rel_1_2/auto/cars/car2.raw (revision 1198)
+++ rel_1_2/auto/cars/car2.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/cars/car3.raw
===================================================================
--- rel_1_2/auto/cars/car3.raw (revision 1198)
+++ rel_1_2/auto/cars/car3.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/cars/car4.raw
===================================================================
--- rel_1_2/auto/cars/car4.raw (revision 1198)
+++ rel_1_2/auto/cars/car4.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/cars/car5.raw
===================================================================
--- rel_1_2/auto/cars/car5.raw (revision 1198)
+++ rel_1_2/auto/cars/car5.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/cars/car6.raw
===================================================================
--- rel_1_2/auto/cars/car6.raw (revision 1198)
+++ rel_1_2/auto/cars/car6.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/cars/car7.raw
===================================================================
--- rel_1_2/auto/cars/car7.raw (revision 1198)
+++ rel_1_2/auto/cars/car7.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/cars/boom.raw
===================================================================
--- rel_1_2/auto/cars/boom.raw (revision 1198)
+++ rel_1_2/auto/cars/boom.raw (nonexistent)
@@ -1 +0,0 @@
-      
\ No newline at end of file
Index: rel_1_2/auto/cars/car8.raw
===================================================================
--- rel_1_2/auto/cars/car8.raw (revision 1198)
+++ rel_1_2/auto/cars/car8.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/cars/car9.raw
===================================================================
--- rel_1_2/auto/cars/car9.raw (revision 1198)
+++ rel_1_2/auto/cars/car9.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/cars/car10.raw
===================================================================
--- rel_1_2/auto/cars/car10.raw (revision 1198)
+++ rel_1_2/auto/cars/car10.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/cars/fumo.raw
===================================================================
--- rel_1_2/auto/cars/fumo.raw (revision 1198)
+++ rel_1_2/auto/cars/fumo.raw (nonexistent)
@@ -1 +0,0 @@
-!!!!!!!!!!!!!!!!!!!!!!
\ No newline at end of file
Index: rel_1_2/auto/cars/car11.raw
===================================================================
--- rel_1_2/auto/cars/car11.raw (revision 1198)
+++ rel_1_2/auto/cars/car11.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/cars/car12.raw
===================================================================
--- rel_1_2/auto/cars/car12.raw (revision 1198)
+++ rel_1_2/auto/cars/car12.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/cars/car13.raw
===================================================================
--- rel_1_2/auto/cars/car13.raw (revision 1198)
+++ rel_1_2/auto/cars/car13.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/cars/car14.raw
===================================================================
--- rel_1_2/auto/cars/car14.raw (revision 1198)
+++ rel_1_2/auto/cars/car14.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/cars/car15.raw
===================================================================
--- rel_1_2/auto/cars/car15.raw (revision 1198)
+++ rel_1_2/auto/cars/car15.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/auto.c
===================================================================
--- rel_1_2/auto/auto.c (revision 1198)
+++ rel_1_2/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.2 2003-01-07 17:10:15 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.2 $
- Last update: $Date: 2003-01-07 17:10:15 $
- ------------
-**/
-
-/*
- * 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: rel_1_2/auto/sensor.c
===================================================================
--- rel_1_2/auto/sensor.c (revision 1198)
+++ rel_1_2/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 2002-09-02 09:37:42 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:42 $
- ------------
-**/
-
-/*
- * 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: rel_1_2/auto/readme
===================================================================
--- rel_1_2/auto/readme (revision 1198)
+++ rel_1_2/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: rel_1_2/auto/initfil1.c
===================================================================
--- rel_1_2/auto/initfil1.c (revision 1198)
+++ rel_1_2/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 2002-09-02 09:37:42 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:42 $
- ------------
-**/
-
-/*
- * 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: rel_1_2/auto/initfil2.c
===================================================================
--- rel_1_2/auto/initfil2.c (revision 1198)
+++ rel_1_2/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 2002-09-02 09:37:42 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:42 $
- ------------
-**/
-
-/*
- * 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: rel_1_2/auto/control.c
===================================================================
--- rel_1_2/auto/control.c (revision 1198)
+++ rel_1_2/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.2 2003-03-24 13:29:08 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.2 $
- Last update: $Date: 2003-03-24 13:29:08 $
- ------------
-**/
-
-/*
- * 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: rel_1_2/auto/initfil3.c
===================================================================
--- rel_1_2/auto/initfil3.c (revision 1198)
+++ rel_1_2/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 2002-09-02 09:37:42 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:42 $
- ------------
-**/
-
-/*
- * 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: rel_1_2/auto/edfact.c
===================================================================
--- rel_1_2/auto/edfact.c (revision 1198)
+++ rel_1_2/auto/edfact.c (nonexistent)
@@ -1,567 +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.4 2003-01-07 17:10:15 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.4 $
- Last update: $Date: 2003-01-07 17:10:15 $
- ------------
-**/
-
-/*
- * 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>
-#include <kernel/trace.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... */
- trc_logevent(TRC_ENDCYCLE,&exec_shadow); /* tracer stuff */
-
- 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: rel_1_2/auto/tracks.c
===================================================================
--- rel_1_2/auto/tracks.c (revision 1198)
+++ rel_1_2/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 2002-09-02 09:37:42 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:42 $
- ------------
-**/
-
-/*
- * 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: rel_1_2/auto/keyb.c
===================================================================
--- rel_1_2/auto/keyb.c (revision 1198)
+++ rel_1_2/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 2002-09-02 09:37:42 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:42 $
- ------------
-**/
-
-/*
- * 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: rel_1_2/auto/edfact.h
===================================================================
--- rel_1_2/auto/edfact.h (revision 1198)
+++ rel_1_2/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.2 2003-01-07 17:10:15 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.2 $
- Last update: $Date: 2003-01-07 17:10:15 $
- ------------
-
- 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: rel_1_2/auto/info.c
===================================================================
--- rel_1_2/auto/info.c (revision 1198)
+++ rel_1_2/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 2002-09-02 09:37:42 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:42 $
- ------------
-**/
-
-/*
- * 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: rel_1_2/auto/makefile
===================================================================
--- rel_1_2/auto/makefile (revision 1198)
+++ rel_1_2/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: rel_1_2/auto/utils.c
===================================================================
--- rel_1_2/auto/utils.c (revision 1198)
+++ rel_1_2/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 2002-09-02 09:37:42 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:42 $
- ------------
-**/
-
-/*
- * 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: rel_1_2/auto/include/const.h
===================================================================
--- rel_1_2/auto/include/const.h (revision 1198)
+++ rel_1_2/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 2002-09-02 09:37:42 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:42 $
- ------------
-**/
-
-/*
- * 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: rel_1_2/auto/include/auto.h
===================================================================
--- rel_1_2/auto/include/auto.h (revision 1198)
+++ rel_1_2/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 2002-09-02 09:37:42 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:42 $
- ------------
-**/
-
-/*
- * 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: rel_1_2/auto/include/utils.h
===================================================================
--- rel_1_2/auto/include/utils.h (revision 1198)
+++ rel_1_2/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 2002-09-02 09:37:42 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:42 $
- ------------
-**/
-
-/*
- * 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: rel_1_2/auto/tracks/monaco.raw
===================================================================
--- rel_1_2/auto/tracks/monaco.raw (revision 1198)
+++ rel_1_2/auto/tracks/monaco.raw (nonexistent)
@@ -1 +0,0 @@
-
\ No newline at end of file
Index: rel_1_2/auto/tracks/brazil.raw
===================================================================
--- rel_1_2/auto/tracks/brazil.raw (revision 1198)
+++ rel_1_2/auto/tracks/brazil.raw (nonexistent)
@@ -1,2 +0,0 @@
- -