Subversion Repositories shark

Compare Revisions

Regard whitespace Rev 1198 → Rev 1197

/demos/tags/rel_1_2/fsf/test1.c
File deleted
/demos/tags/rel_1_2/fsf/test2.c
File deleted
/demos/tags/rel_1_2/fsf/test3.c
File deleted
/demos/tags/rel_1_2/fsf/initfile.c
File deleted
/demos/tags/rel_1_2/fsf/demos.txt
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/getvlc.h
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/const.h
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/mpeg2dec.h
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/store.c
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/getbits.c
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/verify.c
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/global.h
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/motion.c
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/recon.c
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/systems.c
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/subspic.c
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/getblk.c
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/spatscal.c
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/config.h
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/getpic.c
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/gvideo.c
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/gethdr.c
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/idctref.c
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/idct.c
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/getvlc.c
File deleted
/demos/tags/rel_1_2/fsf/mpeg2/mpeg2dec.c
File deleted
/demos/tags/rel_1_2/fsf/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/dfixed.c
File deleted
/demos/tags/rel_1_2/tracer/dfixed/initfile.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/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/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/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/readme
File deleted
/demos/tags/rel_1_2/tracer/makefile
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/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/bttvdemo/readme.txt
File deleted
/demos/tags/rel_1_2/bttvdemo/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/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/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/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/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/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/pse51/makefile
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/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/auto/include/const.h
File deleted
/demos/tags/rel_1_2/auto/include/auto.h
File deleted
/demos/tags/rel_1_2/auto/include/utils.h
File deleted
/demos/tags/rel_1_2/auto/tracks/brazil.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/tracks/demo1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/tracks/demo2.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/tracks/monaco.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/jetctrl.c
File deleted
/demos/tags/rel_1_2/auto/cars/car0.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/car1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/car2.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/car3.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/car4.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/car5.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/car6.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/car7.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/boom.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/car8.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/car9.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/car10.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/fumo.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/car11.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/car12.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/car13.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/car14.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/cars/car15.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_2/auto/auto.c
File deleted
/demos/tags/rel_1_2/auto/sensor.c
File deleted
/demos/tags/rel_1_2/auto/readme
File deleted
/demos/tags/rel_1_2/auto/initfil1.c
File deleted
/demos/tags/rel_1_2/auto/initfil2.c
File deleted
/demos/tags/rel_1_2/auto/control.c
File deleted
/demos/tags/rel_1_2/auto/initfil3.c
File deleted
/demos/tags/rel_1_2/auto/edfact.c
File deleted
/demos/tags/rel_1_2/auto/tracks.c
File deleted
/demos/tags/rel_1_2/auto/keyb.c
File deleted
/demos/tags/rel_1_2/auto/edfact.h
File deleted
/demos/tags/rel_1_2/auto/info.c
File deleted
/demos/tags/rel_1_2/auto/makefile
File deleted
/demos/tags/rel_1_2/auto/utils.c
File deleted
/demos/tags/rel_1_2/robots/mouse2.c
File deleted
/demos/tags/rel_1_2/robots/lab.txt
File deleted
/demos/tags/rel_1_2/robots/readme
File deleted
/demos/tags/rel_1_2/robots/makefile
File deleted
/demos/tags/rel_1_2/robots/lab3.txt
File deleted
/demos/tags/rel_1_2/robots/initfile.c
File deleted
/demos/tags/rel_1_2/robots/lab1m.txt
File deleted
/demos/tags/rel_1_2/eli/eli.h
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/mpeg2/getpic.c
File deleted
/demos/tags/rel_1_2/mpeg2/m.bat
File deleted
/demos/tags/rel_1_2/mpeg2/changes
File deleted
/demos/tags/rel_1_2/mpeg2/const.h
File deleted
/demos/tags/rel_1_2/mpeg2/store.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/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/jetctrl.c
File deleted
/demos/tags/rel_1_2/mpeg2/getblk.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/idctref.c
File deleted
/demos/tags/rel_1_2/mpeg2/spatial.doc
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/getvlc.h
File deleted
/demos/tags/rel_1_2/mpeg2/mpeg2dec.h
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/getbits.c
File deleted
/demos/tags/rel_1_2/mpeg2/store.ori
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/subspic.c
File deleted
/demos/tags/rel_1_2/mpeg2/config.h
File deleted
/demos/tags/rel_1_2/tftptest/makefile
File deleted
/demos/tags/rel_1_2/tftptest/tftptest.c
File deleted
/demos/tags/rel_1_2/tftptest/initfile.c
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/oldexamples/stdio/initfs.c
File deleted
/demos/tags/rel_1_2/oldexamples/stdio/makefile
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/fs/testw0.c
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/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/makefile
File deleted
/demos/tags/rel_1_2/fsdemo/gphoto.h
File deleted
/demos/tags/rel_1_2/fsdemo/gclock.h
File deleted
/demos/tags/rel_1_2/fsdemo/mutex.h
File deleted
/demos/tags/rel_1_2/fsdemo/xread.h
File deleted
/demos/tags/rel_1_2/fsdemo/config.h
File deleted
/demos/tags/rel_1_2/fsdemo/readme
File deleted
/demos/tags/rel_1_2/fsdemo/gvideo.c
File deleted
/demos/tags/rel_1_2/fsdemo/gbuffer.c
File deleted
/demos/tags/rel_1_2/fsdemo/gvideo.h
File deleted
/demos/tags/rel_1_2/fsdemo/mplay.c
File deleted
/demos/tags/rel_1_2/fsdemo/gbuffer.h
File deleted
/demos/tags/rel_1_2/fsdemo/gload.c
File deleted
/demos/tags/rel_1_2/fsdemo/gphoto.ok
File deleted
/demos/tags/rel_1_2/fsdemo/oldmakefile
File deleted
/demos/tags/rel_1_2/fsdemo/gload.h
File deleted
/demos/tags/rel_1_2/fsdemo/makefile
File deleted
/demos/tags/rel_1_2/fsdemo/gphoto.c
File deleted
/demos/tags/rel_1_2/fsdemo/gclock.c
File deleted
/demos/tags/rel_1_2/fsdemo/initfile.c
File deleted
/demos/tags/rel_1_2/fsdemo/xread.c
File deleted
/demos/tags/rel_1_2/cash/makefile
File deleted
/demos/tags/rel_1_2/cash/testcash.c
File deleted
/demos/tags/rel_1_2/cash/cash.c
File deleted
/demos/tags/rel_1_2/cash/initcash.c
File deleted
/demos/tags/rel_1_2/cash/cash.h
File deleted
/demos/tags/rel_1_2/cash/readme.txt
File deleted
/demos/tags/rel_1_2/soccer/calc.h
File deleted
/demos/tags/rel_1_2/soccer/stadio.h
File deleted
/demos/tags/rel_1_2/soccer/calc2.h
File deleted
/demos/tags/rel_1_2/soccer/position.h
File deleted
/demos/tags/rel_1_2/soccer/images.h
File deleted
/demos/tags/rel_1_2/soccer/readme
File deleted
/demos/tags/rel_1_2/soccer/makefile
File deleted
/demos/tags/rel_1_2/soccer/iniziali.h
File deleted
/demos/tags/rel_1_2/soccer/soccer.c
File deleted
/demos/tags/rel_1_2/soccer/initfile.c
File deleted
/demos/tags/rel_1_2/dosfs/dosfs.c
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/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/orbit/orbit.c
File deleted
/demos/tags/rel_1_2/thdemo/demo.c
File deleted
/demos/tags/rel_1_2/thdemo/fftplay.c
File deleted
/demos/tags/rel_1_2/thdemo/jetctrl.c
File deleted
/demos/tags/rel_1_2/thdemo/camera.c
File deleted
/demos/tags/rel_1_2/thdemo/demo.h
File deleted
/demos/tags/rel_1_2/thdemo/readme.txt
File deleted
/demos/tags/rel_1_2/thdemo/camera2.c
File deleted
/demos/tags/rel_1_2/thdemo/ball.c
File deleted
/demos/tags/rel_1_2/thdemo/camera4.c
File deleted
/demos/tags/rel_1_2/thdemo/ball2.c
File deleted
/demos/tags/rel_1_2/thdemo/makefile
File deleted
/demos/tags/rel_1_2/thdemo/fft.c
File deleted
/demos/tags/rel_1_2/thdemo/initfile.c
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/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/proc.c
File deleted
/demos/tags/rel_1_2/simcity/initfile.c
File deleted
/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/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/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/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/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/mesaref/test.png
File deleted
\ No newline at end of file
/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_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/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/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/bca/control.c
File deleted
/demos/tags/rel_1_2/bca/cannone.c
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.c
File deleted
/demos/tags/rel_1_2/edfact/testact.c
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/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/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/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/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/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/mesademo/makefile
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/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/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/perf/initfile.c
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/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/servo/initfile.c
File deleted
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: rel_1_2/servo/makefile
===================================================================
--- rel_1_2/servo/makefile (revision 1198)
+++ rel_1_2/servo/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = servo
-
-include $(BASE)/config/example.mk
-
-servo:
- make -f $(SUBMAKE) APP=servo INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __SERVO__"
-
/rel_1_2/servo/makefile
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/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/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/cbs_ft/readme.txt
===================================================================
--- rel_1_2/cbs_ft/readme.txt (revision 1198)
+++ rel_1_2/cbs_ft/readme.txt (nonexistent)
@@ -1,6 +0,0 @@
-This Example has been made by Marco Caccamo.
-
-There is not a lot of documentation available, so if you have problems please
-send an e-mail to Marco ( http://gandalf.sssup.it/~caccamo/ )
-
-Paolo
Index: rel_1_2/cbs_ft/makefile
===================================================================
--- rel_1_2/cbs_ft/makefile (revision 1198)
+++ rel_1_2/cbs_ft/makefile (nonexistent)
@@ -1,17 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= prova
-
-include $(BASE)/config/example.mk
-
-prova:
- make -f $(SUBMAKE) APP=prova INIT= OTHEROBJS="initfile.o cbs_ft.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
-
-
Index: rel_1_2/cbs_ft/cbs_ft.c
===================================================================
--- rel_1_2/cbs_ft/cbs_ft.c (revision 1198)
+++ rel_1_2/cbs_ft/cbs_ft.c (nonexistent)
@@ -1,812 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@hartik.sssup.it>
- *
- * Authors : Marco Caccamo and Paolo Gai
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: cbs_ft.c,v 1.4 2003-01-07 17:10:16 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.4 $
- Last update: $Date: 2003-01-07 17:10:16 $
- ------------
-
- This file contains the server CBS_FT
-
- Read CBS_FT.h for further details.
-
-**/
-
-/*
- * Copyright (C) 2000 Marco Caccamo and Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-
-#include "cbs_ft.h"
-
-/*+ Status used in the level +*/
-#define CBS_FT_IDLE APER_STATUS_BASE /*+ waiting the activation +*/
-#define CBS_FT_ZOMBIE APER_STATUS_BASE+1 /*+ waiting the period end +*/
-
-/* structure of an element of the capacity queue */
-struct cap_queue {
- int cap;
- struct timespec dead;
- struct cap_queue *next;
-};
-
-/*+ the level redefinition for the CBS_FT level +*/
-typedef struct {
- level_des l; /*+ the standard level descriptor +*/
-
- /* The wcet are stored in the task descriptor, but we need
- an array for the deadlines. We can't use the timespec_priority
- field because it is used by the master level!!!...
- Notice that however the use of the timespec_priority field
- does not cause any problem... */
-
- struct timespec cbs_ft_dline[MAX_PROC]; /*+ CBS_FT deadlines +*/
-
-
- TIME period[MAX_PROC]; /*+ CBS_FT activation period +*/
-
-
- int maxcap[MAX_PROC]; /* amount of capacity reserved to a primary+backup
- couple */
-
- PID backup[MAX_PROC]; /* Backup task pointers, defined for primary tasks */
-
- char CP[MAX_PROC]; /* checkpoint flag */
-
- char P_or_B[MAX_PROC]; /* Type of task: PRIMARY or BACKUP */
-
-
- struct timespec reactivation_time[MAX_PROC];
- /*+ the time at witch the reactivation timer is post +*/
-
- int reactivation_timer[MAX_PROC]; /*+ the recativation timer +*/
-
- struct cap_queue *queue; /* pointer to the spare capacity queue */
-
- int flags; /*+ the init flags... +*/
-
- bandwidth_t U; /*+ the used bandwidth by the server +*/
-
- int idle; /* the idle flag... */
-
- struct timespec start_idle; /*gives the start time of the last idle period */
-
- LEVEL scheduling_level;
-
-} CBS_FT_level_des;
-
-
-
-/* insert a capacity in the queue capacity ordering by deadline */
-
-static int c_insert(struct timespec dead, int cap, struct cap_queue **que,
- PID p)
-{
- struct cap_queue *prev, *n, *new;
-
- prev = NULL;
- n = *que;
-
- while ((n != NULL) &&
- !TIMESPEC_A_LT_B(&dead, &n->dead)) {
- prev = n;
- n = n->next;
- }
-
-
- new = (struct cap_queue *)kern_alloc(sizeof(struct cap_queue));
- if (new == NULL) {
- kern_printf("\nNew cash_queue element failed\n");
- kern_raise(XINVALID_TASK, p);
- return -1;
- }
- new->next = NULL;
- new->cap = cap;
- new->dead = dead;
-
- if (prev != NULL)
- prev->next = new;
- else
- *que = new;
-
- if (n != NULL)
- new->next = n;
- return 0;
-
-}
-
-/* extract the first element from the capacity queue */
-
-int c_extractfirst(struct cap_queue **que)
-{
- struct cap_queue *p = *que;
-
-
- if (*que == NULL) return(-1);
-
- *que = (*que)->next;
-
- kern_free(p, sizeof(struct cap_queue));
- return(1);
-}
-
-/* read data of the first element from the capacity queue */
-
-static void c_readfirst(struct timespec *d, int *c, struct cap_queue *que)
-{
- *d = que->dead;
- *c = que->cap;
-}
-
-/* write data of the first element from the capacity queue */
-
-static void c_writefirst(struct timespec dead, int cap, struct cap_queue *que)
-{
- que->dead = dead;
- que->cap = cap;
-}
-
-
-static void CBS_FT_activation(CBS_FT_level_des *lev,
- PID p,
- struct timespec *acttime)
-{
- JOB_TASK_MODEL job;
- int capacity;
-
- /* This rule is used when we recharge the budget at initial task activation
- and each time a new task instance must be activated */
-
- if (TIMESPEC_A_GT_B(acttime, &lev->cbs_ft_dline[p])) {
- /* we modify the deadline ... */
- TIMESPEC_ASSIGN(&lev->cbs_ft_dline[p], acttime);
- }
-
-
- if (proc_table[p].avail_time > 0)
- proc_table[p].avail_time = 0;
-
-
-
- /* A spare capacity is inserted in the capacity queue!! */
- ADDUSEC2TIMESPEC(lev->period[p], &lev->cbs_ft_dline[p]);
- capacity = lev->maxcap[p] - proc_table[ lev->backup[p] ].wcet;
- c_insert(lev->cbs_ft_dline[p], capacity, &lev->queue, p);
-
-
- /* it exploits available capacities from the capacity queue */
- while (proc_table[p].avail_time < proc_table[p].wcet &&
- lev->queue != NULL) {
- struct timespec dead;
- int cap, delta;
- delta = proc_table[p].wcet - proc_table[p].avail_time;
- c_readfirst(&dead, &cap, lev->queue);
- if (!TIMESPEC_A_GT_B(&dead, &lev->cbs_ft_dline[p])) {
- if (cap > delta) {
- proc_table[p].avail_time += delta;
- c_writefirst(dead, cap - delta, lev->queue);
- }
- else {
- proc_table[p].avail_time += cap;
- c_extractfirst(&lev->queue);
- }
- }
- else
- break;
- }
-
- /* If the budget is still less than 0, an exception is raised */
- if (proc_table[p].avail_time <= 0) {
- kern_printf("\nnegative value for the budget!\n");
- kern_raise(XINVALID_TASK, p);
- return;
- }
-
-
-
- /*if (p==6)
- kern_printf("(act_time:%d dead:%d av_time:%d)\n",
- acttime->tv_sec*1000000+
- acttime->tv_nsec/1000,
- lev->cbs_ft_dline[p].tv_sec*1000000+
- lev->cbs_ft_dline[p].tv_nsec/1000,
- proc_table[p].avail_time); */
-
-
-
-
-
-
-#ifdef TESTG
- if (starttime && p == 3) {
- oldx = x;
- x = ((lev->cbs_ft_dline[p].tv_sec*1000000+lev->cbs_ft_dline[p].tv_nsec/1000)/5000 - starttime) + 20;
- // kern_printf("(a%d)",lev->cbs_ft_dline[p].tv_sec*1000000+lev->cbs_ft_dline[p].tv_nsec/1000);
- if (oldx > x) sys_end();
- if (x<640)
- grx_plot(x, 15, 8);
- }
-#endif
-
- /* and, finally, we reinsert the task in the master level */
- job_task_default_model(job, lev->cbs_ft_dline[p]);
- job_task_def_yesexc(job);
- level_table[ lev->scheduling_level ]->
- private_insert(lev->scheduling_level, p, (TASK_MODEL *)&job);
-}
-
-
-/* this is the periodic reactivation of the task... */
-static void CBS_FT_timer_reactivate(void *par)
-{
- PID p = (PID) par;
- CBS_FT_level_des *lev;
- struct timespec t;
-
- lev = (CBS_FT_level_des *)level_table[proc_table[p].task_level];
-
- if (proc_table[p].status == CBS_FT_IDLE) {
- /* the task has finished the current activation and must be
- reactivated */
-
- /* request_time represents the time of the last instance release!! */
- TIMESPEC_ASSIGN(&t, &lev->reactivation_time[p]);
-
- /* If idle=1, then we have to discharge the capacities stored in
- the capacity queue up to the length of the idle interval */
- if (lev->idle == 1) {
- TIME interval;
- struct timespec delta;
- lev->idle = 0;
- SUBTIMESPEC(&t, &lev->start_idle, &delta);
- /* length of the idle interval expressed in usec! */
- interval = TIMESPEC2NANOSEC(&delta) / 1000;
-
- /* it discharges the available capacities from the capacity queue */
- while (interval > 0 && lev->queue != NULL) {
- struct timespec dead;
- int cap;
- c_readfirst(&dead, &cap, lev->queue);
- if (cap > interval) {
- c_writefirst(dead, cap - interval, lev->queue);
- interval = 0;
- }
- else {
- interval -= cap;
- c_extractfirst(&lev->queue);
- }
- }
- }
-
- CBS_FT_activation(lev,p,&lev->reactivation_time[p]);
-
-
- /* Set the reactivation timer */
- TIMESPEC_ASSIGN(&lev->reactivation_time[p], &lev->cbs_ft_dline[p]);
- lev->reactivation_timer[p] = kern_event_post(&lev->reactivation_time[p],
- CBS_FT_timer_reactivate,
- (void *)p);
- event_need_reschedule();
- }
- else {
- /* this situation cannot occur */
- kern_printf("\nTrying to reactivate a primary task which is not IDLE!\n");
- kern_raise(XINVALID_TASK,p);
- }
-}
-
-
-
-static void CBS_FT_avail_time_check(CBS_FT_level_des *lev, PID p)
-{
-
- /*+ if the capacity became negative the remaining computation time
- is diminuished.... +*/
- /* if (p==4)
- kern_printf("(old dead:%d av_time:%d)\n",
- lev->cbs_ft_dline[p].tv_sec*1000000+
- lev->cbs_ft_dline[p].tv_nsec/1000,
- proc_table[p].avail_time); */
-
-
- int newcap = proc_table[p].wcet / 100 * 30;
- if (newcap <= 0)
- newcap = proc_table[p].wcet;
- /* it exploits available capacities from the capacity queue */
- while (proc_table[p].avail_time < newcap
- && lev->queue != NULL) {
- struct timespec dead;
- int cap, delta;
- delta = newcap - proc_table[p].avail_time;
- c_readfirst(&dead, &cap, lev->queue);
- if (!TIMESPEC_A_GT_B(&dead, &lev->cbs_ft_dline[p])) {
- if (cap > delta) {
- proc_table[p].avail_time += delta;
- c_writefirst(dead, cap - delta, lev->queue);
- }
- else {
- proc_table[p].avail_time += cap;
- c_extractfirst(&lev->queue);
- }
- }
- else
- break;
- }
-
-
-
- /*if (p==6)
- kern_printf("(ATC dead:%d av_time:%d)\n",
- lev->cbs_ft_dline[p].tv_sec*1000000+
- lev->cbs_ft_dline[p].tv_nsec/1000,
- proc_table[p].avail_time); */
-
-
-
- /* if the budget is still empty, the backup task must be woken up.
- Remind that a short chunk of primary will go ahead executing
- before the task switch occurs */
- if (proc_table[p].avail_time <= 0) {
- lev->CP[p] = 1;
- proc_table[p].avail_time += proc_table[ lev->backup[p] ].wcet;
- }
-
-
- /*if (p==6)
- kern_printf("(ATC1 dead:%d av_time:%d)\n",
- lev->cbs_ft_dline[p].tv_sec*1000000+
- lev->cbs_ft_dline[p].tv_nsec/1000,
- proc_table[p].avail_time); */
-
-
-
-}
-
-
-/*+ this function is called when a killed or ended task reach the
- period end +*/
-static void CBS_FT_timer_zombie(void *par)
-{
- PID p = (PID) par;
- CBS_FT_level_des *lev;
-
- lev = (CBS_FT_level_des *)level_table[proc_table[p].task_level];
-
- /* we finally put the task in the FREE status */
- proc_table[p].status = FREE;
- iq_insertfirst(p,&freedesc);
-
-
- /* and free the allocated bandwidth */
- lev->U -= (MAX_BANDWIDTH / lev->period[p]) * (TIME)lev->maxcap[p];
-}
-
-static PID CBS_FT_public_scheduler(LEVEL l)
-{
- CBS_FT_level_des *lev = (CBS_FT_level_des *)(level_table[l]);
-
- /* it stores the actual time and set the IDLE flag in order to handle
- the capacity queue discharging!!! */
- lev->idle = 1;
- kern_gettime(&lev->start_idle);
-
-
- /* the CBS_FT don't schedule anything...
- it's an EDF level or similar that do it! */
- return NIL;
-}
-
-
-/* The on-line guarantee is enabled only if the appropriate flag is set... */
-static int CBS_FT_public_guarantee(LEVEL l, bandwidth_t *freebandwidth)
-{
- CBS_FT_level_des *lev = (CBS_FT_level_des *)(level_table[l]);
-
- if (lev->flags & CBS_FT_FAILED_GUARANTEE) {
- *freebandwidth = 0;
- kern_printf("guarantee :garanzia fallita!!!!!!\n");
- return 0;
- }
- else if (*freebandwidth >= lev->U) {
- *freebandwidth -= lev->U;
- return 1;
- }
- else {
- kern_printf("guarantee :garanzia fallita per mancanza di banda!!!!!!\n");
- kern_printf("freeband: %d request band: %d", *freebandwidth, lev->U);
- return 0;
- }
-}
-
-
-static int CBS_FT_public_create(LEVEL l, PID p, TASK_MODEL *m)
-
-{
- CBS_FT_level_des *lev = (CBS_FT_level_des *)(level_table[l]);
- FT_TASK_MODEL *s;
-
- if (m->pclass != FT_PCLASS) return -1;
- if (m->level != 0 && m->level != l) return -1;
- s = (FT_TASK_MODEL *) m;
- //kern_printf("accept :FAULT TOLERANT TASK found!!!!!!\n"); */
- if (!(s->type == PRIMARY && s->execP > 0 && s->budget < (int)s->period
- && s->backup != NIL)) return -1;
- if (!(s->type == BACKUP && s->wcetB > 0))
- return -1;
- /* now we know that m is a valid model */
-
- /* Enable budget check */
- proc_table[p].control |= CONTROL_CAP;
-
- proc_table[p].avail_time = 0;
- NULL_TIMESPEC(&lev->cbs_ft_dline[p]);
-
-
- if (s->type == PRIMARY) {
- proc_table[p].wcet = (int)s->execP;
- lev->period[p] = s->period;
- lev->maxcap[p] = s->budget;
- lev->backup[p] = s->backup;
- lev->CP[p] = 0;
- lev->P_or_B[p] = PRIMARY;
-
- /* update the bandwidth... */
- if (lev->flags & CBS_FT_ENABLE_GUARANTEE) {
- bandwidth_t b;
- b = (MAX_BANDWIDTH / lev->period[p]) * (TIME)lev->maxcap[p];
-
- /* 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)...
- (see EDF.c) */
- lev->flags |= CBS_FT_FAILED_GUARANTEE;
- }
- }
- else {
- proc_table[p].wcet = (int)s->wcetB;
- lev->P_or_B[p] = BACKUP;
-
- /* Backup tasks are unkillable tasks! */
- proc_table[p].control |= NO_KILL;
- }
-
- return 0; /* OK, also if the task cannot be guaranteed... */
-}
-
-
-static void CBS_FT_public_detach(LEVEL l, PID p)
-{
- /* the CBS_FT level doesn't introduce any dynamic allocated new field.
- we have only to reset the NO_GUARANTEE FIELD and decrement the allocated
- bandwidth */
-
- CBS_FT_level_des *lev = (CBS_FT_level_des *)(level_table[l]);
-
- if (lev->flags & CBS_FT_FAILED_GUARANTEE)
- lev->flags &= ~CBS_FT_FAILED_GUARANTEE;
- else
- lev->U -= (MAX_BANDWIDTH / lev->period[p]) * (TIME)lev->maxcap[p];
-}
-
-
-static void CBS_FT_public_dispatch(LEVEL l, PID p, int nostop)
-{
- CBS_FT_level_des *lev = (CBS_FT_level_des *)(level_table[l]);
- level_table[ lev->scheduling_level ]->
- private_dispatch(lev->scheduling_level,p,nostop);
-}
-
-static void CBS_FT_public_epilogue(LEVEL l, PID p)
-{
- CBS_FT_level_des *lev = (CBS_FT_level_des *)(level_table[l]);
-
- /* check if the budget is finished... */
- if (proc_table[p].avail_time <= 0) {
-
- /* A backup task cannot ever exhaust its budget! */
- if (lev->P_or_B[p] == BACKUP) {
- kern_printf("\nBACKUP wcet violation!\n");
- kern_raise(XWCET_VIOLATION,p);
- /* we kill the current activation */
- level_table[ lev->scheduling_level ]->
- private_extract(lev->scheduling_level, p);
- return;
- }
-
- /* we try to recharge the budget */
- CBS_FT_avail_time_check(lev, p);
-
- /* The budget must be greater than 0! */
- if (proc_table[p].avail_time <= 0) {
- kern_printf("\nBackup task starting with exhausted budget\n");
- kern_raise(XINVALID_TASK, p);
- lev->CP[p] = 0;
- /* we kill the current activation */
- level_table[ lev->scheduling_level ]->
- private_extract(lev->scheduling_level, p);
- return;
- }
- }
-
- /* the task returns into the ready queue by
- calling the guest_epilogue... */
- level_table[ lev->scheduling_level ]->
- private_epilogue(lev->scheduling_level,p);
-}
-
-
-static void CBS_FT_public_activate(LEVEL l, PID p)
-{
- CBS_FT_level_des *lev = (CBS_FT_level_des *)(level_table[l]);
- struct timespec t;
-
- kern_gettime(&t);
-
- if (lev->P_or_B[p] == BACKUP) {
- kern_printf("\nTrying to activate a BACKUP task!\n");
- kern_raise(XINVALID_TASK, p);
- }
- else {
-
- /* If idle=1, then we have to discharge the capacities stored in
- the capacity queue up to the length of the idle interval */
- if (lev->idle == 1) {
- TIME interval;
- struct timespec delta;
- lev->idle = 0;
- SUBTIMESPEC(&t, &lev->start_idle, &delta);
- /* length of the idle interval expressed in usec! */
- interval = TIMESPEC2NANOSEC(&delta) / 1000;
-
- /* it discharge the available capacities from the capacity queue */
- while (interval > 0 && lev->queue != NULL) {
- struct timespec dead;
- int cap;
- c_readfirst(&dead, &cap, lev->queue);
- if (cap > interval) {
- c_writefirst(dead, cap - interval, lev->queue);
- interval = 0;
- }
- else {
- interval -= cap;
- c_extractfirst(&lev->queue);
- }
- }
- }
-
- CBS_FT_activation(lev, p, &t);
-
-
- /* Set the reactivation timer */
- TIMESPEC_ASSIGN(&lev->reactivation_time[p], &lev->cbs_ft_dline[p]);
- lev->reactivation_timer[p] = kern_event_post(&lev->reactivation_time[p],
- CBS_FT_timer_reactivate,
- (void *)p);
-
- // kern_printf("act : %d %d |",lev->cbs_ft_dline[p].tv_nsec/1000,p);
- }
-}
-
-static int CBS_FT_public_message(LEVEL l, PID p, void *m)
-{
- CBS_FT_level_des *lev = (CBS_FT_level_des *)(level_table[l]);
-
-
- level_table[ lev->scheduling_level ]->
- private_extract(lev->scheduling_level,p);
-
-
- proc_table[p].status = CBS_FT_IDLE;
-
-
- if (lev->P_or_B[p] == PRIMARY) {
- if (lev->CP[p]) {
- JOB_TASK_MODEL job;
-
- /* We have to start the backup task */
- TIMESPEC_ASSIGN(&lev->cbs_ft_dline[ lev->backup[p] ],
- &lev->cbs_ft_dline[p]);
- proc_table[ lev->backup[p] ].avail_time = proc_table[p].avail_time;
- lev->CP[p] = 0;
-
- /* and, finally, we insert the backup task in the master level */
- job_task_default_model(job, lev->cbs_ft_dline[p]);
- job_task_def_yesexc(job);
- level_table[ lev->scheduling_level ]->
- private_insert(lev->scheduling_level, lev->backup[p],
- (TASK_MODEL *)&job);
- }
- else {
- /* A spare capacity is inserted in the capacity queue!! */
- proc_table[p].avail_time += proc_table[ lev->backup[p] ].wcet;
- if (proc_table[p].avail_time > 0) {
- c_insert(lev->cbs_ft_dline[p], proc_table[p].avail_time,
- &lev->queue, p);
- proc_table[p].avail_time = 0;
- }
- }
- }
- else {
- /* this branch is for backup tasks:
- A spare capacity is inserted in the capacity queue!! */
- if (proc_table[p].avail_time > 0) {
- c_insert(lev->cbs_ft_dline[p], proc_table[p].avail_time,
- &lev->queue, p);
- proc_table[p].avail_time = 0;
- }
- }
-
- jet_update_endcycle(); /* Update the Jet data... */
- trc_logevent(TRC_ENDCYCLE,&exec_shadow); /* tracer stuff */
-
- return 0;
-}
-
-
-static void CBS_FT_public_end(LEVEL l, PID p)
-{
- CBS_FT_level_des *lev = (CBS_FT_level_des *)(level_table[l]);
-
- /* A backup task cannot be killed, this behaviour can be modified
- in a new release */
- if (lev->P_or_B[p] == BACKUP) {
- kern_printf("\nKilling a BACKUP task!\n");
- kern_raise(XINVALID_TASK, p);
- return;
- }
-
- /* check if the capacity becomes negative... */
- /* there is a while because if the wcet is << than the system tick
- we need to postpone the deadline many times */
- while (proc_table[p].avail_time < 0) {
- /* the CBS_FT rule for recharging the capacity */
- proc_table[p].avail_time += lev->maxcap[p];
- ADDUSEC2TIMESPEC(lev->period[p], &lev->cbs_ft_dline[p]);
- }
-
- level_table[ lev->scheduling_level ]->
- private_extract(lev->scheduling_level,p);
-
-
- /* we delete the reactivation timer */
- kern_event_delete(lev->reactivation_timer[p]);
- lev->reactivation_timer[p] = -1;
-
-
- /* Finally, we post the zombie event. when the end period is reached,
- the task descriptor and banwidth are freed */
- proc_table[p].status = CBS_FT_ZOMBIE;
- lev->reactivation_timer[p] = kern_event_post(&lev->cbs_ft_dline[p],
- CBS_FT_timer_zombie,
- (void *)p);
-}
-
-/* Registration functions */
-
-/*+ Registration function:
- int flags the init flags ... see CBS.h +*/
-LEVEL CBS_FT_register_level(int flags, LEVEL master)
-{
- LEVEL l; /* the level that we register */
- CBS_FT_level_des *lev; /* for readableness only */
- PID i; /* a counter */
-
- printk("CBS_FT_register_level\n");
-
- /* request an entry in the level_table */
- l = level_alloc_descriptor(sizeof(CBS_FT_level_des));
-
- lev = (CBS_FT_level_des *)level_table[l];
-
- printk(" lev=%d\n",(int)lev);
-
- /* fill the standard descriptor */
- lev->l.public_scheduler = CBS_FT_public_scheduler;
-
- if (flags & CBS_FT_ENABLE_GUARANTEE)
- lev->l.public_guarantee = CBS_FT_public_guarantee;
- else
- lev->l.public_guarantee = NULL;
-
- lev->l.public_create = CBS_FT_public_create;
- lev->l.public_detach = CBS_FT_public_detach;
- lev->l.public_end = CBS_FT_public_end;
- lev->l.public_dispatch = CBS_FT_public_dispatch;
- lev->l.public_epilogue = CBS_FT_public_epilogue;
- lev->l.public_activate = CBS_FT_public_activate;
- lev->l.public_message = CBS_FT_public_message;
-
- /* fill the CBS_FT descriptor part */
- for (i=0; i<MAX_PROC; i++) {
- NULL_TIMESPEC(&lev->cbs_ft_dline[i]);
- lev->period[i] = 0;
- NULL_TIMESPEC(&lev->reactivation_time[i]);
- lev->reactivation_timer[i] = -1;
- lev->maxcap[i] = 0;
- lev->backup[i] = NIL;
- lev->CP[i] = 0;
- lev->P_or_B[i] = PRIMARY;
- }
-
- lev->U = 0;
- lev->idle = 0;
- lev->queue = NULL;
-
- lev->scheduling_level = master;
-
- lev->flags = flags & 0x07;
-
- return l;
-}
-
-
-
-bandwidth_t CBS_FT_usedbandwidth(LEVEL l)
-{
- CBS_FT_level_des *lev = (CBS_FT_level_des *)(level_table[l]);
-
- return lev->U;
-}
-
-
-
-void CBS_FT_Primary_Abort()
-{
- PID p;
- CBS_FT_level_des *lev;
-
- kern_cli();
- p = exec_shadow;
- lev = (CBS_FT_level_des *)level_table[proc_table[p].task_level];
- lev->CP[p] = 1;
- kern_sti();
-}
-
-
-char CBS_FT_Checkpoint()
-{
- char f;
- PID p;
- CBS_FT_level_des *lev;
-
- kern_cli();
- p = exec_shadow;
- lev = (CBS_FT_level_des *)level_table[proc_table[p].task_level];
- f = lev->CP[p];
- kern_sti();
- return f;
-}
-
Index: rel_1_2/cbs_ft/initfile.c
===================================================================
--- rel_1_2/cbs_ft/initfile.c (revision 1198)
+++ rel_1_2/cbs_ft/initfile.c (nonexistent)
@@ -1,112 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@hartik.sssup.it>
- *
- * Authors : Marco caccamo and Paolo Gai
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: initfile.c,v 1.1.1.1 2002-09-02 09:37:41 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:41 $
- ------------
-
- This file contains the server CBS_FT
-
- Read CBS_FT.h for further details.
-
-**/
-
-/*
- * Copyright (C) 2000 Marco Caccamo and Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include "kernel/kern.h"
-#include <modules/edf.h>
-#include <modules/rr.h>
-#include "cbs_ft.h"
-#include <modules/cbs.h>
-#include <modules/dummy.h>
-#include <drivers/keyb.h>
-#include <modules/hartport.h>
-#include <modules/sem.h>
-#include <modules/cabs.h>
-
-/*+ system tick in us +*/
-#define TICK 300
-#define RRTICK 5000
-
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- EDF_register_level(EDF_ENABLE_ALL);
- CBS_FT_register_level(CBS_FT_ENABLE_ALL, 0);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- CBS_register_level(CBS_ENABLE_ALL, 0);
- dummy_register_level();
-
- SEM_register_module();
- CABS_register_module();
-
- // periodic timer
- return TICK;
- // one-shot timer
- // return 0
-}
-
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- KEYB_init(NULL);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rel_1_2/cbs_ft/cbs_ft.h
===================================================================
--- rel_1_2/cbs_ft/cbs_ft.h (revision 1198)
+++ rel_1_2/cbs_ft/cbs_ft.h (nonexistent)
@@ -1,167 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@hartik.sssup.it>
- *
- * Authors : Marco Caccamo and Paolo Gai
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: cbs_ft.h,v 1.2 2003-01-07 17:10:16 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.2 $
- Last update: $Date: 2003-01-07 17:10:16 $
- ------------
-
- This file contains the server CBS_FT
-
- Read CBS_FT.h for further details.
-
-**/
-
-/*
- * Copyright (C) 2000 Marco Caccamo and Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#ifndef __CBS_FT__
-#define __CBS_FT__
-
-
-
-#include <ll/string.h>
-#include <kernel/model.h>
-#include <kernel/descr.h>
-#include <kernel/var.h>
-#include <kernel/func.h>
-#include <kernel/trace.h>
-
-
-
-
-
-
-/*+ flags... +*/
-#define CBS_FT_ENABLE_GUARANTEE 1 /*+ Task Guarantee enabled +*/
-#define CBS_FT_ENABLE_ALL 1
-
-#define CBS_FT_FAILED_GUARANTEE 8 /*+ used in the module, unsettable
- in EDF_register_level... +*/
-
-
-#define PRIMARY 1
-#define BACKUP 2
-#define FT_PCLASS 0x0700 // Nuova classe di task, quelli fault_tolerant
-
-#define CBS_FT_LEVELNAME "CBSFT base"
-#define CBS_FT_LEVEL_CODE 110
-#define CBS_FT_LEVEL_VERSION 1
-
-
-/* The Fault-Tolerant Task model extends the base task model
- This model cannot be APERIODIC, only PERIODIC tasks are allowed.
- A faut-tolerant application is composed by two different tasks (primary and
- backup). The backup task is characterized by its WCET and its type (BACKUP).
- The primary task must define the task period, its average execution time
- (used as sort of prediction in order to recharge the budget using the
- capacity cash queue!), the budget (budget / period = U that is, the
- bandwidth assigned to the fault-tolerant application), its type (PRIMARY)
- and finally the PID of the corresponding backup task. */
-
-typedef struct {
- TASK_MODEL t;
-
- TIME wcetB; // WCET of the backup job (BACKUP TASK ONLY)
-
- TIME execP; // average exec. time of the primary job (PRIMARY TASK ONLY)
-
- TIME period; // period of the fault-tolerant task (PRIMARY TASK ONLY)
-
- int budget; // amount of guaranteed capacity (PRIMARY TASK ONLY)
-
- char type; // PRIMARY or BACKUP
-
- PID backup; // (PRIMARY TASK ONLY)
-
-} FT_TASK_MODEL;
-
-
-#define ft_task_default_model(m) \
- task_default_model((m).t,FT_PCLASS), \
- (m).period = 0, \
- (m).wcetB = 0, \
- (m).execP = 0, \
- (m).budget = 0, \
- (m).type = BACKUP, \
- (m).backup = NIL
-
-#define ft_task_def_level(m,l) task_def_level((m).t,l)
-#define ft_task_def_arg(m,a) task_def_arg((m).t,a)
-#define ft_task_def_stack(m,s) task_def_stack((m).t,s)
-#define ft_task_def_stackaddr(m,s) task_def_stackaddr((m).t,s)
-#define ft_task_def_usemath(m) task_def_usemath((m).t)
-#define ft_task_def_ctrl_jet(m) task_def_ctrl_jet((m).t)
-#define ft_task_def_group(m,g) task_def_group((m).t,g)
-#define ft_task_def_period(m,o) (m).period = (o)
-#define ft_task_def_budget(m,o) (m).budget = (o)
-#define ft_task_def_backup(m) (m).type = BACKUP
-#define ft_task_def_primary(m) (m).type = PRIMARY
-#define ft_task_def_backup_task(m,b) (m).backup = b
-#define ft_task_def_backup_wcet(m,b) (m).wcetB = b
-#define ft_task_def_primary_exec(m,b) (m).execP = b
-
-/************************************************************************/
-LEVEL CBS_FT_register_level(int flags, LEVEL master);
-
-
-bandwidth_t CBS_FT_usedbandwidth(LEVEL l);
-
-
-
-/* This function notifies to a primary task that the task itself has to
- suspend its execution (the task has to suspend itself with a
- task_endcycle() */
-char CBS_FT_Checkpoint(void);
-
-
-
-/* This function sets the checkpoint flag! hence, at the next checkpoint,
- that is:
-
- if (CBS_FT_Checkpoint()) {
- task_endcycle();
- continue;
- }
-
- the primary task will suspend itself switching to the backup task */
-void CBS_FT_Primary_Abort(void);
-
-/***************************************************************************/
-
-
-
-
-#endif
Index: rel_1_2/cbs_ft/prova.c
===================================================================
--- rel_1_2/cbs_ft/prova.c (revision 1198)
+++ rel_1_2/cbs_ft/prova.c (nonexistent)
@@ -1,429 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@hartik.sssup.it>
- *
- * Authors : Marco Caccamo and Paolo Gai
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: prova.c,v 1.1.1.1 2002-09-02 09:37:41 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:41 $
- ------------
-
- testcash.c
- test for the CASH Module, directly derived from Test Number 13 (D)
-
-**/
-
-/*
- * Copyright (C) 2000 Marco Caccamo and Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-
-#include <modules/edf.h>
-#include "cbs_ft.h"
-#include <math.h>
-#include <stdlib.h>
-
-#define ASTER_LIM 60
-#define DISPLAY_MAX 15
-
-#define STAT_Y 9
-
-#define INPUT 0.5
-
-
-
-#define MAX_STAT 10000
-#define RVAL 1
-#define XVAL 2
-#define DVAL 3
-
-
-struct statistic {
- TIME r_time;
- TIME ex_time;
- long dead_post;
-};
-
-
-
- struct statistic stat[MAX_STAT];
- TIME val[MAX_STAT];
-
-int n_stat = 0;
-
-TASK hard_aster1p(void)
-{
- int i;
- int y = 1;
- int load1,j;
-
- char s[2];
-
- s[0] = 'P'; s[1] = 0;
-
-
- for (;;) {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = 20000; //+ rand() % 25000;
- for (j=0; j<load1; j++) {
- if (CBS_FT_Checkpoint())
- break;
- puts_xy(i,y,rand()%15+1,s);
- }
- //kern_cli();
- //stat[n_stat].r_time = CBSGHD_get_response_time(1, exec_shadow);
- //jet_gettable(exec_shadow, &stat[n_stat].ex_time, 1);
- //kern_sti();
- //n_stat++;
- task_endcycle();
- puts_xy(i,y,WHITE," ");
- i++;
- }
- }
-}
-
-
-TASK hard_aster1b(void)
-{
- int i;
- int y = 1;
-
- int load1,j;
-
- char s[2];
-
- s[0] = 'B'; s[1] = 0;
-
- for (;;) {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = 20000;// + rand()%4000;
- for (j=0; j<load1; j++) {
- puts_xy(i,y,rand()%15+1,s);
- }
- //kern_cli();
- //stat[n_stat].r_time = CBSGHD_get_response_time(1, exec_shadow);
- //jet_gettable(exec_shadow, &stat[n_stat].ex_time, 1);
- //kern_sti();
- //n_stat++;
- task_endcycle();
- puts_xy(i,y,WHITE," ");
- i++;
- }
- }
-}
-
-
-TASK hard_aster2p(void)
-{
- int i;
- int y = 3;
-
- int load1,j;
-
- char s[2];
-
- s[0] = 'P'; s[1] = 0;
-
- for (;;) {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = 20000 + rand() % 20000;
- for (j=0; j<load1; j++) {
- if (CBS_FT_Checkpoint())
- break;
- puts_xy(i,y,rand()%15+1,s);
- }
- //kern_cli();
- //stat[n_stat].r_time = CBSGHD_get_response_time(5, exec_shadow);
- //jet_gettable(exec_shadow, &stat[n_stat].ex_time, 1);
- //kern_sti();
- //n_stat++;
- task_endcycle();
- puts_xy(i,y,WHITE," ");
- i++;
- }
- }
-}
-
-TASK hard_aster2b(void)
-{
- int i;
- int y = 3;
-
- int load1,j;
-
- char s[2];
-
- s[0] = 'T'; s[1] = 0;
-
- for (;;) {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = 20000;
- for (j=0; j<load1; j++) {
- puts_xy(i,y,rand()%15+1,s);
- }
- //kern_cli();
- //stat[n_stat].r_time = CBSGHD_get_response_time(5, exec_shadow);
- //jet_gettable(exec_shadow, &stat[n_stat].ex_time, 1);
- //kern_sti();
- //n_stat++;
- task_endcycle();
- puts_xy(i,y,WHITE," ");
- i++;
- }
- }
-}
-
-
-TASK clock()
-{
- int s = 0, m = 0;
-
- while(1) {
- printf_xy(62,1,WHITE,"%2d:%2d",m,s);
- printf_xy(62,2,WHITE,"Utot=%12u",MAX_BANDWIDTH);
- printf_xy(62,3,WHITE,"Uedf=%12u",EDF_usedbandwidth(0));
- printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_FT_usedbandwidth(1));
- task_endcycle();
-
- if (++s > 59) {
- s = 0;
- m++;
- }
- printf_xy(62,1,WHITE,"%2d:%2d",m,s);
- printf_xy(62,2,WHITE,"Utot=%12u",MAX_BANDWIDTH);
- printf_xy(62,3,WHITE,"Uedf=%12u",EDF_usedbandwidth(0));
- printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_FT_usedbandwidth(1));
- task_endcycle();
- }
-}
-
-
-
-/* we consider the first ASTER_MAX + 2 tasks from the PID 2
- and plot on the screen the elapsed times... */
-TASK jetcontrol()
-{
- int i; /* a counter */
- TIME sum, max, curr, last[5];
- int nact;
- int j; /* the elements set by jet_gettable */
- PID p;
-
-
- kern_cli();
- printf_xy(0,STAT_Y,WHITE,"PID ³ Mean T.³ Max T. ³ N.A. ³ Curr. ³ Last1 ³ Last2 ³ Last3 ³ Last4 ³ Last5");
- kern_sti();
-
- for (;;) {
- for (i=0,p=0; i<DISPLAY_MAX+5 && p<MAX_PROC; p++) {
- if (jet_getstat(p, &sum, &max, &nact, &curr) == -1) continue;
-
- for (j=0; j<5; j++) last[j] = 0;
- jet_gettable(p, &last[0], 5);
- kern_cli();
- printf_xy(0,STAT_Y+i+1,WHITE,"%-3d ³ %-6ld ³ %-6ld ³ %-4d ³ %-7ld ³ %-5ld ³ %-5ld ³ %-5ld ³ %-5ld ³ %-5ld", p, sum/(nact==0 ? 1 : nact), max,
- nact, curr, last[0], last[1], last[2], last[3], last[4]);
- kern_sti();
- i++;
- }
- task_endcycle();
- }
-}
-
-
-void save_stat(struct statistic p[], int n, char *name, int type)
-{
- DOS_FILE *f;
- int i;
- char outstring[500];
-
-
- for(i = 0; i < 500; i++)
- outstring[i] = '0';
-
- f = DOS_fopen(name, "w");
- if (!f) {
- cprintf("Cannot open %s!!!", name);
- goto end1;
- }
-
- for(i = 0; i < n; i++) {
- if (type == RVAL)
- val[i] = p[i].r_time;
- if (type == XVAL)
- val[i] = p[i].ex_time;
- if (type == DVAL)
- val[i] = p[i].dead_post;
- }
-
- memset(outstring, 0, 300);
- sprintf(outstring, "%ld \n", (long int)n);
- cprintf("%s", outstring);
- DOS_fwrite(outstring, 1, strlen(outstring), f);
-
- for(i = 0; i < n; i++) {
- memset(outstring, 0, 300);
- sprintf(outstring, "%ld %lu\n", (long int)i, val[i]);
- //cprintf("%s", outstring);
- DOS_fwrite(outstring, 1, strlen(outstring), f);
- }
- DOS_fclose(f);
-end1:cprintf("OK?");
-}
-
-
-void result_save(void *p)
-{
- save_stat(stat, n_stat, "stat1.tim", RVAL);
-}
-
-
-void fine()
-{
- ll_abort(666);
-}
-
-int main(int argc, char **argv)
-{
- PID p1,p2,p3, p4, p5, p6;
-
- HARD_TASK_MODEL m;
- FT_TASK_MODEL ftb;
- FT_TASK_MODEL ftp;
-
- // int i;
- struct timespec fineprg;
-
-
- //sys_atrunlevel(result_save, NULL, RUNLEVEL_AFTER_EXIT);
- srand(7);
-
- hard_task_default_model(m);
- hard_task_def_wcet(m,500);
- hard_task_def_mit(m,500000);
- hard_task_def_periodic(m);
- hard_task_def_group(m,1);
- hard_task_def_ctrl_jet(m);
-
-
- p1 = task_create("Clock",clock,&m,NULL);
- if (p1 == -1) {
- perror("testhd.c(main): Could not create task <Clock> ...");
- sys_end();
- }
-
-
- hard_task_def_wcet(m,500);
- hard_task_def_periodic(m);
- hard_task_def_mit(m,100000);
-
-
- p2 = task_create("JetControl",jetcontrol,&m,NULL);
- if (p2 == -1) {
- perror("testhd.c(main): Could not create task <JetControl> ...");
- sys_end();
- }
-
-
- ft_task_default_model(ftb);
- ft_task_def_usemath(ftb);
- ft_task_def_backup(ftb);
- ft_task_def_ctrl_jet(ftb);
- ft_task_def_backup_wcet(ftb, 7000);
-
-
-
- p3 = task_create("Hard_aster1b", hard_aster1b, &ftb,NULL);
- if (p3 == -1) {
- perror("testhd.c(main): Could not create task <aster1b> ...");
- sys_end();
- }
-
- ft_task_default_model(ftp);
- ft_task_def_usemath(ftp);
- ft_task_def_ctrl_jet(ftp);
- ft_task_def_group(ftp, 1);
- ft_task_def_period(ftp, 50000);
- ft_task_def_budget(ftp, 15000);
- ft_task_def_primary_exec(ftp, 7300);
- ft_task_def_primary(ftp);
- ft_task_def_backup_task(ftp, p3);
-
-
- p4 = task_create("Hard_aster1p", hard_aster1p, &ftp, NULL);
- if (p4 == -1) {
- perror("testhd.c(main): Could not create task <aster1p> ...");
- sys_end();
- }
-
-
- ft_task_def_backup_wcet(ftb, 6700);
-
-
- p5 = task_create("Hard_aster2b", hard_aster2b, &ftb, NULL);
- if (p5 == -1) {
- perror("testhd.c(main): Could not create task <aster2b> ...");
- sys_end();
- }
-
-
- ft_task_def_period(ftp, 100000);
- ft_task_def_budget(ftp, 8000);
- ft_task_def_primary_exec(ftp, 11000);
- ft_task_def_backup_task(ftp, p5);
-
-
- p6 = task_create("Hard_aster2p", hard_aster2p, &ftp, NULL);
- if (p6 == -1) {
- perror("testhd.c(main): Could not create task <aster2p> ...");
- sys_end();
- }
-
-
- printf_xy(0,STAT_Y + 15,WHITE,"Hard asteroide PID= %-3d ",p3);
- printf_xy(0,STAT_Y + 17,WHITE,"Clock PID= %-3d ",p1);
- printf_xy(0,STAT_Y + 18,WHITE,"JetControl PID= %-3d ",p2);
-
-
-
- task_nopreempt();
- fineprg.tv_sec = 10;
- fineprg.tv_nsec = 0;
- kern_event_post(&fineprg,fine,NULL);
- group_activate(1);
- return 0;
-}
-
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/svgademo/readme.txt
===================================================================
--- rel_1_2/svgademo/readme.txt (revision 1198)
+++ rel_1_2/svgademo/readme.txt (nonexistent)
@@ -1,34 +0,0 @@
---------------------------------------
-SVGA Demo
-
-by
-
-Giacomo Guidi <giacomo@gandalf.sssup.it>
-
-Last update 17/03/2003
---------------------------------------
-
-This is a simple test demo for the new graphic
-drivers ported from SVGAlib 1.9.17
-
-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
-SVGADEMO.C The SVGA Demo
-
---------------------------------------
-
-- To specify your card change the line
-
-#define CARD <driver name>
-
-- The demo calls the grx functions modified for the new
-drivers. The resolution must be 16 bitsperpixel (64K colors)
-and the graphic access mode must be linear.
-
Index: rel_1_2/svgademo/makefile
===================================================================
--- rel_1_2/svgademo/makefile (revision 1198)
+++ rel_1_2/svgademo/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = svgademo
-
-include $(BASE)/config/example.mk
-
-svgademo:
- make -f $(SUBMAKE) APP=svgademo INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __SVGA__"
-
Index: rel_1_2/svgademo/initfile.c
===================================================================
--- rel_1_2/svgademo/initfile.c (revision 1198)
+++ rel_1_2/svgademo/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:51:11 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.2 $
- Last update: $Date: 2003-04-28 11:51:11 $
- ------------
-
- 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/svgademo/svgademo.c
===================================================================
--- rel_1_2/svgademo/svgademo.c (revision 1198)
+++ rel_1_2/svgademo/svgademo.c (nonexistent)
@@ -1,196 +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 <math.h>
-#include <stdlib.h>
-
-#include <kernel/log.h>
-#include <kernel/kern.h>
-
-#define WIDTH 800
-#define HEIGHT 600
-#define BYTES_PP 2
-#define INITSTR G800x600x64K //SVGAlib standard mode definitions
-#define CARD VESA //Video driver
-
-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 = 100000;
-unsigned long int PERIOD_DISEGNA = 100000;
-
-unsigned long int WCET_REFRESH, WCET_DISEGNA;
-
-TASK refesh(void);
-TASK disegna(void);
-
-PID refresh_PID, disegna_PID;
-
-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();
- rgb_565_buf = malloc(RGB565MEM);
-
- grx_setbuffer(rgb_565_buf, WIDTH, HEIGHT); //Init of RGBA version of grx functions
- //created to work with Mesa buffer
- return 0;
-
-}
-
-void program_end(void *arg)
-{
-
- 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);
-
- 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);
-
- grx_text("SVGADEMO", 10,25,rgb16(255,0,0), 0);
- grx_line(50,50,100,100,rgb16(0,255,0));
- grx_box(110,50,160,100,rgb16(0,0,255));
- grx_rect(170,50,220,100,rgb16(0,255,255));
-
- 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);
-
- 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);
- }
-
- 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/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/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/jumpball/demo.c
===================================================================
--- rel_1_2/jumpball/demo.c (revision 1198)
+++ rel_1_2/jumpball/demo.c (nonexistent)
@@ -1,217 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: demo.c,v 1.4 2003-05-01 19:43:16 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.4 $
- Last update: $Date: 2003-05-01 19:43:16 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000-2003 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include "demo.h"
-#include <kernel/func.h>
-#include <string.h>
-#include <stdlib.h>
-#include <drivers/keyb.h>
-#include <drivers/glib.h>
-
-/* graphic mutex... */
-mutex_t mutex;
-
-/* useful colors... */
-int white;
-int black;
-int red;
-int gray;
-
-void app_mutex_init(mutex_t *m);
-
-static void version( void )
-{
- cprintf( "S.Ha.R.K. Jumpball Demo 1.0\n" );
- cprintf( "---------------------------\n" );
- cprintf( "by Paolo Gai 1999-2001\n" );
- cprintf( " <pj@sssup.it>\n" );
- cprintf( "---------------------------\n" );
-}
-
-int myrand(int x)
-{
- return rand()%x;
-}
-
-void reverse(char s[])
-{
- int c, i, j;
-
- for (i = 0, j = strlen(s)-1; i<j; i++, j--)
- {
- c = s[i];
- s[i] = s[j];
- s[j] = c;
- }
-}
-
-char * itoa(int n, char *s)
-{
- int i, sign;
-
- if ((sign = n) < 0)
- n = -n;
-
- i = 0;
-
- do
- {
- s[i++] = n % 10 + '0';
- } while ((n /= 10) > 0);
-
- if (sign < 0)
- s[i++] = '-';
-
- s[i] = 0;
-
- reverse(s);
-
- return s;
-}
-
-
-void scenario()
-{
- grx_text("S.Ha.R.K. Jumpball Demo 1.0", 0, 0, rgb16(0,255,0), black );
- grx_text(" by Paolo Gai 1999-2001" , 0, 8, rgb16(0,255,0), black );
- grx_text(" pj@sssup.it" , 0,16, rgb16(0,255,0), black );
-
- grx_text("Ctrl-C, Ctrr-C, Enter: exit" ,320, 0, gray, black );
- grx_text("Alt-C : void statistics" ,320, 8, gray, black );
- grx_text("Space : create noise ball",320,16, gray, black );
- grx_text("Backspace : kill noise balls" ,320,24, gray, black );
-
-
- #ifdef JET_ON
- scenario_jetcontrol();
- #endif
-
- #ifdef BALL_ON
- scenario_ball();
- #endif
-}
-
-void my_close(void *arg)
-{
- grx_close();
- kern_printf("my_close\n");
-}
-
-
-void endfun(KEY_EVT *k)
-{
- cprintf("Ending...\n");
- sys_end();
-}
-
-void zerofun(KEY_EVT *k)
-{
- int i;
- for (i=0; i<MAX_PROC; i++) jet_delstat(i);
-}
-
-int main(int argc, char **argv)
-{
- int modenum;
-
- KEY_EVT k;
-
- srand(4);
-
- version();
-
- keyb_set_map(itaMap);
- k.flag = CNTR_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- keyb_hook(k,endfun);
- k.flag = CNTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- keyb_hook(k,endfun);
- k.flag = ALTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- keyb_hook(k,zerofun);
- k.flag = 0;
- k.scan = KEY_ENT;
- k.ascii = 13;
- keyb_hook(k,endfun);
-
- sys_atrunlevel(my_close, NULL, RUNLEVEL_BEFORE_EXIT);
-
-
- grx_init();
- modenum = grx_getmode(640, 480, 16);
-
- grx_setmode(modenum);
-
- /* init the graphic mutex */
- app_mutex_init(&mutex);
-
- /* useful colors ... */
- white = rgb16(255,255,255);
- black = rgb16(0,0,0);
- red = rgb16(255,0,0);
- gray = rgb16(128,128,128);
-
- scenario();
-
- #ifdef JET_ON
- init_jetcontrol();
- #endif
-
- #ifdef BALL_ON
- init_ball();
- #endif
-
- group_activate(1);
-
- return 0;
-}
-
-
Index: rel_1_2/jumpball/ern.c
===================================================================
--- rel_1_2/jumpball/ern.c (revision 1198)
+++ rel_1_2/jumpball/ern.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: ern.c,v 1.1 2003-05-01 19:43:16 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2003-05-01 19:43:16 $
- ------------
-**/
-
-/*
- * Copyright (C) 2003 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include "kernel/kern.h"
-#include "modules/edf.h"
-#include "modules/rr.h"
-#include "modules/rrsoft.h"
-#include "modules/dummy.h"
-
-#include "modules/sem.h"
-#include "modules/hartport.h"
-#include "modules/cabs.h"
-#include "modules/nop.h"
-
-#include "drivers/keyb.h"
-
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-//#define RRTICK 10000
-#define RRTICK 2000
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- EDF_register_level(EDF_ENABLE_ALL);
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD|RRSOFT_ONLY_SOFT);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
-
- SEM_register_module();
-
- CABS_register_module();
-
- NOP_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- KEYB_init(NULL);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-void app_mutex_init(mutex_t *m)
-{
- NOP_mutexattr_t attr;
-
- NOP_mutexattr_default(attr);
-
- mutex_init(m, &attr);
-}
Index: rel_1_2/jumpball/ecp.c
===================================================================
--- rel_1_2/jumpball/ecp.c (revision 1198)
+++ rel_1_2/jumpball/ecp.c (nonexistent)
@@ -1,106 +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: ecp.c,v 1.1 2003-05-01 19:43:16 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2003-05-01 19:43:16 $
- ------------
-**/
-
-/*
- * Copyright (C) 2003 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include "kernel/kern.h"
-#include "modules/edf.h"
-#include "modules/cbs.h"
-#include "modules/rr.h"
-#include "modules/dummy.h"
-
-#include "modules/sem.h"
-#include "modules/hartport.h"
-#include "modules/cabs.h"
-#include "modules/pi.h"
-
-#include "drivers/keyb.h"
-
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-//#define RRTICK 10000
-#define RRTICK 2000
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, 0);
-
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
- CABS_register_module();
- PI_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- KEYB_init(NULL);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-void app_mutex_init(mutex_t *m)
-{
- PI_mutexattr_t attr;
-
- PI_mutexattr_default(attr);
-
- mutex_init(m, &attr);
-}
Index: rel_1_2/jumpball/jetctrl.c
===================================================================
--- rel_1_2/jumpball/jetctrl.c (revision 1198)
+++ rel_1_2/jumpball/jetctrl.c (nonexistent)
@@ -1,244 +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.2 2003-05-01 19:43:17 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.2 $
- Last update: $Date: 2003-05-01 19:43:17 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-
-// JetControl
-
-#include "demo.h"
-#include "kernel/func.h"
-
-TASK jetdummy_task(void *arg)
-{
- TIME now_dummy, last_dummy, diff_dummy, slice;
- struct timespec now, last, diff;
- int x = 0;
- int height;
-
- NULL_TIMESPEC(&last);
- last_dummy = 0;
- for (;;) {
- task_nopreempt();
- jet_getstat(DUMMY_PID, NULL, NULL, NULL, &now_dummy);
- sys_gettime(&now);
- task_preempt();
-
- SUBTIMESPEC(&now, &last, &diff);
- slice = diff.tv_sec * 1000000 + diff.tv_nsec/1000;
- diff_dummy = now_dummy - last_dummy;
-
- height = (int)(JET_DUMMY_HEIGHT*((float)diff_dummy)/((float)slice));
-
- TIMESPEC_ASSIGN(&last, &now);
- last_dummy = now_dummy;
-
- mutex_lock(&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);
- mutex_unlock(&mutex);
-
- x = (x+1)%JET_DUMMY_WIDTH;
-
- task_endcycle();
- }
-}
-
-
-TASK jetctrl_task(void *arg)
-{
- char st[50];
- TIME sum, max;
- int n;
-
- PID i;
- int printed = 0;
-
- for (;;) {
- for (i=2, printed=0; i<MAX_PROC && printed<JET_NTASK; i++) {
- if (jet_getstat(i, &sum, &max, &n, NULL) != -1) {
- if (!n) n=1;
- sprintf(st, "%6d %6d %10s", (int)sum/n, (int)max, proc_table[i].name);
- mutex_lock(&mutex);
- grx_text(st, 384, JET_Y_NAME+16+printed*8, gray, black);
- mutex_unlock(&mutex);
- printed++;
- }
- }
- while (printed<JET_NTASK) {
- mutex_lock(&mutex);
- grx_text(" ",
- 384, JET_Y_NAME+16+printed*8, gray, black);
- mutex_unlock(&mutex);
- printed++;
- }
- task_endcycle();
- }
-}
-
-TASK jetslide_task(void *arg)
-{
- TIME sum, curr, max;
-
- TIME total[JET_NTASK];
- int slides[JET_NTASK];
-
- PID i;
- int printed = 0;
-
- for (;;) {
- // Fill the total array in a nonpreemptive section
- task_nopreempt();
- for (i=2, printed=0; i<MAX_PROC && printed<JET_NTASK; i++) {
- if (jet_getstat(i, &sum, NULL, NULL, &curr) != -1) {
- total[printed] = sum+curr;
- printed++;
- }
- }
- task_preempt();
-
- while (printed < JET_NTASK)
- total[printed++] = 0;
-
- // Compute the Max elapsed time
- max = 0;
- for (i=0; i<JET_NTASK; i++)
- if (total[i] > max) max = total[i];
- if (!max) max = 1;
-
- // Compute the slides width
- for (i=0; i<JET_NTASK; i++)
- slides[i] = (int)( (((float)total[i])/max) * JET_SLIDE_WIDTH);
-
- // print the data
- mutex_lock(&mutex);
- for (i=0; i<JET_NTASK; i++) {
- grx_box(JET_SLIDE_X, JET_Y_NAME+16+i*8,
- JET_SLIDE_X+slides[i], JET_Y_NAME+23+i*8, gray);
- grx_box(JET_SLIDE_X+slides[i], JET_Y_NAME+16+i*8,
- JET_SLIDE_X+JET_SLIDE_WIDTH, JET_Y_NAME+23+i*8, black);
- }
-
- while (i<JET_NTASK) {
- grx_box(JET_SLIDE_X, JET_Y_NAME+16+i*8,
- JET_SLIDE_X+JET_SLIDE_WIDTH, JET_Y_NAME+20+i*8, black);
- i++;
- }
- mutex_unlock(&mutex);
- task_endcycle();
- }
-}
-
-
-void scenario_jetcontrol(void)
-{
- grx_text("System load" , 384, 45, rgb16(0,0,255), black);
- grx_line(384,55,639,55,red);
-
- grx_text(" Mean Max Name Slide", 384, JET_Y_NAME, gray, black);
- grx_line(384,JET_Y_NAME+10,639,JET_Y_NAME+10,gray);
-
- grx_rect(JET_DUMMY_X-1, JET_DUMMY_Y-1,
- JET_DUMMY_X+JET_DUMMY_WIDTH, JET_DUMMY_Y+JET_DUMMY_HEIGHT+1, gray);
-
- grx_text("100%", JET_DUMMY_X-40, JET_DUMMY_Y, gray, black);
- grx_text(" 0%", JET_DUMMY_X-40, JET_DUMMY_Y+JET_DUMMY_HEIGHT-8, gray, black);
-
- grx_line(JET_DUMMY_X-1, JET_DUMMY_Y, JET_DUMMY_X-5, JET_DUMMY_Y, gray);
- grx_line(JET_DUMMY_X-1, JET_DUMMY_Y+JET_DUMMY_HEIGHT, JET_DUMMY_X-5, JET_DUMMY_Y+JET_DUMMY_HEIGHT, gray);
-}
-
-void init_jetcontrol(void)
-{
- SOFT_TASK_MODEL m3, m4, m5;
-
- PID p3, p4, p5;
-
- soft_task_default_model(m3);
- soft_task_def_level(m3,1);
- soft_task_def_period(m3, PERIOD_JETCTRL);
- soft_task_def_met(m3, WCET_JETCTRL);
- soft_task_def_ctrl_jet(m3);
- soft_task_def_group(m3, 1);
- p3 = task_create("jctrl", jetctrl_task, &m3, NULL);
- if (p3 == -1) {
- sys_shutdown_message("Could not create task <jetctrl> errno=%d",
- errno);
- sys_end();
- }
-
- soft_task_default_model(m4);
- soft_task_def_level(m4,1);
- soft_task_def_period(m4, PERIOD_JETDUMMY);
- soft_task_def_met(m4, WCET_JETDUMMY);
- soft_task_def_group(m4, 1);
- soft_task_def_usemath(m4);
- soft_task_def_ctrl_jet(m4);
- p4 = task_create("jdmy", jetdummy_task, &m4, NULL);
- if (p4 == -1) {
- sys_shutdown_message("Could not create task <jetdummy> errno=%d",
- errno);
- sys_end();
- }
-
- soft_task_default_model(m5);
- soft_task_def_level(m5,1);
- soft_task_def_period(m5, PERIOD_JETSLIDE);
- soft_task_def_met(m5, WCET_JETSLIDE);
- soft_task_def_group(m5, 1);
- soft_task_def_usemath(m5);
- soft_task_def_ctrl_jet(m5);
- p5 = task_create("jsli", jetslide_task, &m5, NULL);
- if (p5 == -1) {
- sys_shutdown_message("Could not create task <jetslide> errno=%d",
- errno);
- sys_end();
- }
-}
-
Index: rel_1_2/jumpball/demo.h
===================================================================
--- rel_1_2/jumpball/demo.h (revision 1198)
+++ rel_1_2/jumpball/demo.h (nonexistent)
@@ -1,171 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: demo.h,v 1.3 2003-05-05 09:21:55 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.3 $
- Last update: $Date: 2003-05-05 09:21:55 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-
-#include <ll/ll.h>
-#include <kernel/types.h>
-#include <kernel/descr.h>
-#include <math.h>
-#include <drivers/glib.h>
-#include <drivers/keyb.h>
-
-
-/* Subparts */
-#define JET_ON
-#define BALL_ON
-
-
-/* CPU Speed Selection
- --------------------------------------------------------------------
- 1700 - Pentium 4 1.7 GHz
- 400 - Pentium 2 400 MHz
- 133 - Pentium 1 133 MHz
-*/
-#define CPU 1700
-
-/*
- *
- * WCET, Periods and Models
- *
- */
-
-#if CPU==133
-#define WCET_JETCTRL 10000
-#define WCET_JETDUMMY 300
-#define WCET_JETSLIDE 2000
-#define WCET_BALL 250
-#define WCET_HARD_BALL 1000
-#define BALL_DELAY 10000
-#endif
-
-#if CPU==400
-#define WCET_JETCTRL 7500
-#define WCET_JETDUMMY 200
-#define WCET_JETSLIDE 2100
-#define WCET_BALL 100
-#define WCET_HARD_BALL 380
-#define BALL_DELAY 10000
-#endif
-
-#if CPU==1700
-#define WCET_JETCTRL 4500
-#define WCET_JETDUMMY 100
-#define WCET_JETSLIDE 1300
-#define WCET_BALL 100
-#define WCET_HARD_BALL 410
-#define BALL_DELAY 100000
-#endif
-
-#define PERIOD_JETCTRL 100000
-#define PERIOD_JETDUMMY 100000
-#define PERIOD_JETSLIDE 100000
-#define PERIOD_BALL 10000
-
-/*
- *
- * Global Stuffs
- *
- */
-
-/* graphic mutex... */
-extern mutex_t mutex;
-
-/* useful colors... */
-extern int white;
-extern int black;
-extern int red;
-extern int gray;
-
-void init_jetcontrol();
-void init_ball(void);
-void scenario_jetcontrol();
-void scenario_ball();
-char *itoa(int n, char *s);
-int myrand(int x);
-
-
-
-/*
- *
- * JETCONTROL stuffs
- *
- */
-
-#define JET_NTASK 35
-#define JET_Y_NAME 170
-
-#define DUMMY_PID 1
-
-#define JET_DUMMY_WIDTH 210
-#define JET_DUMMY_HEIGHT 80
-
-/* the point (x, y) is the top left corner */
-#define JET_DUMMY_X 428
-#define JET_DUMMY_Y 65
-
-#define JET_SLIDE_WIDTH 50
-#define JET_SLIDE_X 576
-
-
-
-
-/*
- *
- * BALL stuffs
- *
- */
-
-// x and y corners are specified whithout consider a border of 3 pixels
-#define BALL_Y 450 /* position of the floor */
-#define BALL_HEIGHT 385 /* initial height of the ball */
-#define BALL_XMIN 10 /* min position X of the ball */
-#define BALL_XMAX 370 /* max position X of the ball */
-#define BALL_VELX 5. /* horizontal ball velocity */
-#define BALL_VYMIN 11. /* min ground speed */
-#define BALL_MAX_P 60 /* max number of balls */
-
-#define BALL_GROUP 2 /* task group of the balls */
Index: rel_1_2/jumpball/readme.txt
===================================================================
--- rel_1_2/jumpball/readme.txt (revision 1198)
+++ rel_1_2/jumpball/readme.txt (nonexistent)
@@ -1,75 +0,0 @@
-----------------------------------
-Jumping Balls demo
-
-by
-
-Paolo Gai 1999-2001 - pj@sssup.it
-
-----------------------------------
-
-This demo was created to show some S.Ha.R.K. functionalities in the course
-of Informatica Industriale , University of Pavia, Italy.
-
-The demo is composed by an application (derived by the template application
-distributed on the web site) and two init files.
-
-The demo is composed by:
-
-MAKEFILE The makefile used to compile the application;
- demo is the rule to compile the application with a CBS scheduler
- demo2 is the rule to compile the application with a RR scheduler
-README.TXT This file
-DEMO.H Some constants used into the demo
-INITFIL1.C The CBS initfile
-INITFIL2.C The EDF initfile
-INITFILE.C A makefile that cover either EDF+CBS and RR
-BALL.C The Jumping balls part of the demo
-DEMO.C The main() function and some other utility function
-JETCTRL.C The JET part of the demo
-
-
-The demo works as follows:
-- It works at 640x480 16 bit colors
-- on the left, there is the jumping ball arena, on the rigth there is the
- statistics about the tasks into the system.
-
-- the tasks are guaranteed using CBS and EDF. The wcet and mean execution
- time on my portable after a few minutes are (us):
-
- JetCtrl 7400 max 7500 CBS met
- JetDummy 135 max 200 CBS met
- JetSlide 2100 max 2100 CBS met
- Balls 276 max 380 EDF wcet for hard ball,100 CBS met for soft ones
-
- The system should go overloaded with 40 soft balls.
-
-- The idea is the following:
- - first, an edf guaranteed ball is created.
- - then, create a set of soft ball using space. since their met is < than the
- real met, they posticipate the deadlines.
- - if they are killed, they remain for some seconds in the zombie state
- - if a set of soft ball arde created (i.e., 10), and after a while all the
- others are created, the bandwidth is fully used, and the task posticipate
- their deadlines. the first set of tasks stops jumping when the bandwidth
- is full utilized by the newest balls until all the tasks have similar
- deadlines.
- - Note on the left the slides that represents the relative ratio
- between the tasks.
- - Note that in overload conditions the EDF task is still guaranteed
- - Note that PI is used with EDF, also if no theory says that it is good:
- - S.Ha.R.K. allows that, it is the user that have to choose if that is
- a non-sense
- - PI is independent from the implemnentation of the scheduling modules
- - if the second init file is used, RR is used instead of EDF+CBS.
- - In overload condition RR perform differently from EDF+CBS, giving to
- each task an equal fraction of bandwidth
-
- - note also:
- - the redefinition of the standard exception handler
- - the redefinition of the keys and the initialization of the keyboard
- - the myend exit function
- - the main() that terminates
- - the two parts (ball and jet) can be excluded using a #define
-
-If You have any question, please contact the author...
-
Index: rel_1_2/jumpball/ball.c
===================================================================
--- rel_1_2/jumpball/ball.c (revision 1198)
+++ rel_1_2/jumpball/ball.c (nonexistent)
@@ -1,246 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: ball.c,v 1.3 2003-05-05 09:21:55 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.3 $
- Last update: $Date: 2003-05-05 09:21:55 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-/*--------------------------------------------------------------*/
-/* SIMULATION OF JUMPING BALLS */
-/*--------------------------------------------------------------*/
-
-#include "demo.h"
-#include <kernel/func.h>
-#include <stdlib.h>
-
-#define R 8 /* dimension of a ball */
-#define G 9.8 /* acceleration of gravity */
-
-static int ballexit = 0;
-static int npc = 0; /* number of tasks created */
-
-/*--------------------------------------------------------------*/
-/* Delay function for jumping balls */
-/*--------------------------------------------------------------*/
-
-void my_delay(void)
-{
- int xxx;
- for (xxx=0; xxx<BALL_DELAY; xxx++);
-}
-
-/*--------------------------------------------------------------*/
-/* Periodic task for ball simulation */
-/*--------------------------------------------------------------*/
-
-TASK palla(int i)
-{
-int x, y; /* coordinate grafiche pallina */
-int ox, oy; /* vecchia posizione pallina */
-int x0, y0; /* posizione iniziale X pallina */
-float vx, vy; /* velocitÂ… della pallina */
-float vy0; /* velocita' pallina al primo rimbalzo */
-float ty, tx; /* variabile temporale */
-float dt; /* incremento temporale */
-
- y = oy = y0 = BALL_HEIGHT;
- x = ox = x0 = BALL_XMIN;
-
- vy0= sqrt(2. * G * (float)BALL_HEIGHT);
- vy = 0;
- vx = BALL_VELX + myrand(9);
- tx = 0;
- ty = 0;
- dt = ((float)PERIOD_BALL)/100000;
-
- while (1) {
- y = y0 + vy*ty - .5*G*ty*ty;
- x = x0 + vx * tx;
-
- if (y < 0) {
- y = 0;
-
- if (vy == 0.0)
- vy = vy0;
- else if (vy < BALL_VYMIN)
- vy = vy0 * (1.0 - myrand(50)/100.0);
- else
- vy = 0.9 * vy;
-
- ty = 0.0;
- y0 = 0;
- }
-
- if (x > BALL_XMAX) {
- tx = 0.0;
- x0 = BALL_XMAX;
- vx = -vx;
- x = x0 + vx * tx;
- }
-
- if (x < BALL_XMIN) {
- tx = 0.0;
- x0 = BALL_XMIN;
- vx = -vx;
- x = x0 + vx * tx;
- }
-
- mutex_lock(&mutex);
- grx_disc(ox, oy, R, 0);
- ox = x;
- oy = BALL_Y - y;
- mutex_unlock(&mutex);
-
- if (ballexit && i!=0xFFFF) {
- npc--;
- return 0;
- }
-
- mutex_lock(&mutex);
- grx_disc(ox, oy, R, i);
- mutex_unlock(&mutex);
-
- my_delay();
-
- ty += dt;
- tx += dt;
- task_endcycle();
- }
-}
-
-void killball(KEY_EVT *k)
-{
- ballexit = 1;
-}
-
-void ballfun(KEY_EVT *k)
-{
- SOFT_TASK_MODEL mp;
- int r,g,b;
- PID pid;
- char palla_str[]="palla ";
-
- if (npc == BALL_MAX_P) return;
-
- ballexit = 0;
-
- r = 64 + myrand(190);
- g = 64 + myrand(190);
- b = 64 + myrand(190);
-
- itoa(npc,palla_str+5);
-
- soft_task_default_model(mp);
- soft_task_def_level(mp,1);
- soft_task_def_ctrl_jet(mp);
- soft_task_def_arg(mp, (void *)rgb16(r,g,b));
- soft_task_def_group(mp, BALL_GROUP);
- soft_task_def_met(mp, WCET_BALL);
- soft_task_def_period(mp,PERIOD_BALL);
- soft_task_def_usemath(mp);
- pid = task_create(palla_str, palla, &mp, NULL);
-
- if (pid != NIL) {
- task_activate(pid);
- npc++;
- }
-}
-
-void hardball()
-{
- HARD_TASK_MODEL mp;
- int r,g,b;
- PID pid;
-
- r = 255;
- g = 255;
- b = 255;
-
- hard_task_default_model(mp);
- hard_task_def_ctrl_jet(mp);
- hard_task_def_arg(mp, (void *)rgb16(r,g,b));
- hard_task_def_wcet(mp, WCET_HARD_BALL);
- hard_task_def_mit(mp,PERIOD_BALL);
- hard_task_def_usemath(mp);
- pid = task_create("pallaEDF", palla, &mp, NULL);
- if (pid == NIL) {
- sys_shutdown_message("Could not create task <pallaEDF>");
- sys_end();
- }
- else
- task_activate(pid);
-}
-
-
-/*--------------------------------------------------------------*/
-/* MAIN process */
-/*--------------------------------------------------------------*/
-
-void scenario_ball()
-{
- grx_text("Noise", 0, 45 /*BALL_Y-BALL_HEIGHT-15*/, rgb16(0,0,255), black);
- grx_line(0,55,383,55,red);
-//grx_line(0,BALL_Y-BALL_HEIGHT-6,383,BALL_Y-BALL_HEIGHT-6,red);
-
- grx_rect(BALL_XMIN-R-1, BALL_Y-BALL_HEIGHT-R-1,
- BALL_XMAX+R+1, BALL_Y+R+1, rgb16(0,200,0));
-}
-
-void init_ball(void)
-{
- KEY_EVT k;
-
- hardball();
-
- k.flag = 0;
- k.scan = KEY_SPC;
- k.ascii = ' ';
- keyb_hook(k,ballfun);
-
- k.flag = 0;
- k.scan = KEY_BKS;
- k.ascii = ' ';
- keyb_hook(k,killball);
-}
-
-/*--------------------------------------------------------------*/
Index: rel_1_2/jumpball/makefile
===================================================================
--- rel_1_2/jumpball/makefile (revision 1198)
+++ rel_1_2/jumpball/makefile (nonexistent)
@@ -1,24 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= ecp ern rrp rrn
-
-include $(BASE)/config/example.mk
-
-ecp:
- make -f $(SUBMAKE) APP=ecp INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
-
-ern:
- make -f $(SUBMAKE) APP=ern INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
-
-rrp:
- make -f $(SUBMAKE) APP=rrp INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
-
-rrn:
- make -f $(SUBMAKE) APP=rrn INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
Index: rel_1_2/jumpball/rrn.c
===================================================================
--- rel_1_2/jumpball/rrn.c (revision 1198)
+++ rel_1_2/jumpball/rrn.c (nonexistent)
@@ -1,109 +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: rrn.c,v 1.1 2003-05-01 19:43:17 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2003-05-01 19:43:17 $
- ------------
-**/
-
-/*
- * Copyright (C) 2003 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include "kernel/kern.h"
-#include "modules/edf.h"
-#include "modules/rr.h"
-#include "modules/rrsoft.h"
-#include "modules/dummy.h"
-
-#include "modules/sem.h"
-#include "modules/hartport.h"
-#include "modules/cabs.h"
-#include "modules/nop.h"
-
-#include "drivers/keyb.h"
-
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-//#define RRTICK 10000
-#define RRTICK 2000
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- RR_register_level(RRTICK, RR_MAIN_NO, mb); // this module remains empty!!!
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD|RRSOFT_ONLY_SOFT);
-
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
-
- SEM_register_module();
-
- CABS_register_module();
-
- NOP_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- KEYB_init(NULL);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-void app_mutex_init(mutex_t *m)
-{
- NOP_mutexattr_t attr;
-
- NOP_mutexattr_default(attr);
-
- mutex_init(m, &attr);
-}
Index: rel_1_2/jumpball/rrp.c
===================================================================
--- rel_1_2/jumpball/rrp.c (revision 1198)
+++ rel_1_2/jumpball/rrp.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: rrp.c,v 1.1 2003-05-01 19:43:17 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2003-05-01 19:43:17 $
- ------------
-**/
-
-/*
- * Copyright (C) 2003 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include "kernel/kern.h"
-#include "modules/edf.h"
-#include "modules/rr.h"
-#include "modules/rrsoft.h"
-#include "modules/dummy.h"
-
-#include "modules/sem.h"
-#include "modules/hartport.h"
-#include "modules/cabs.h"
-#include "modules/pi.h"
-
-#include "drivers/keyb.h"
-
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-//#define RRTICK 10000
-#define RRTICK 2000
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD);
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_SOFT);
-
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
-
- SEM_register_module();
- CABS_register_module();
- PI_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- KEYB_init(NULL);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-void app_mutex_init(mutex_t *m)
-{
- PI_mutexattr_t attr;
-
- PI_mutexattr_default(attr);
-
- mutex_init(m, &attr);
-}
Index: rel_1_2/slsh/slshtest.c
===================================================================
--- rel_1_2/slsh/slshtest.c (revision 1198)
+++ rel_1_2/slsh/slshtest.c (nonexistent)
@@ -1,173 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * 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: slshtest.c,v 1.1.1.1 2002-09-02 09:37:41 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:41 $
- ------------
-
- Slot shifting test
-
-
-**/
-
-/*
- * Copyright (C) 2000 Paolo Gai and Tomas Lennvall
- *
- * 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/config.h>
-#include "kernel/kern.h"
-#include "slsh.h"
-#include "drivers/keyb.h"
-
-/* a slot length of 100 ms */
-#define SLOT_LENGTH 100000
-
-
-TASK static1(void)
-{
- int i = 0;
-
- kern_printf("Static1\n");
- while(sys_gettime(NULL) < 10000) i++;
-
- return 0;
-}
-
-TASK static2(void)
-{
- int i = 0;
-
- kern_printf("Static2\n");
- while(sys_gettime(NULL) < 10000) i++;
-
- return 0;
-}
-
-
-TASK static3(void)
-{
- kern_printf("Static3\n");
-
- return 0;
-}
-
-void my_end(KEY_EVT *e)
-{
- sys_end();
-}
-
-int main(int argc, char** argv)
-{
- STATIC_TASK_MODEL s;
- // HARD_TASK_MODEL h_aper;
- // SOFT_TASK_MODEL u;
- PID p1,p2,p3;
- struct timespec x;
-
- KEY_EVT emerg;
-
- kern_cli();
- x.tv_sec=5;
- kern_event_post(&x,(void (*)(void *))sys_end,NULL);
- kern_sti();
-
- //keyb_set_map(itaMap);
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTL_BIT;
- keyb_hook(emerg,my_end);
-
- /* set som variables in the scheduling level */
- SLSH_set_interval(0, 0, 8, 5);
- SLSH_set_interval(0, 8, 17, 7);
- SLSH_set_interval(0, 17, 20, 1);
-
- SLSH_set_variables(0, SLOT_LENGTH);
-
- static_task_default_model(s);
- static_task_def_group(s, 1);
-
- /* define time i ms */
- /* static1 task */
- static_task_def_est(s, 0);
- static_task_def_dabs(s, 800000);
- static_task_def_wcet(s, 500000);
- static_task_def_interval(s, 0);
-
- kern_printf("In main, before task creation\n");
-
- p1 = task_create("Static 1", static1, &s, NULL);
- if(p1 == NIL)
- kern_printf("Cannot create: Static1!\n");
-
- /* Static2 task */
- static_task_def_est(s, 800000);
- static_task_def_dabs(s, 1700000);
- static_task_def_wcet(s, 700000);
- static_task_def_interval(s, 1);
-
- p2 = task_create("Static 2", static2, &s, NULL);
- if(p2 == NIL)
- kern_printf("Cannot create: Static2!\n");
-
- /* Static3 task */
- static_task_def_est(s, 1700000);
- static_task_def_dabs(s, 2000000);
- static_task_def_wcet(s, 100000);
- static_task_def_interval(s, 2);
-
-
- p3 = task_create("Static3", static3, &s, NULL);
- if(p3 == NIL)
- kern_printf("Cannot create: Static3!\n");
-
-
- /* End task */
- /*hard_task_default_model(h_aper);
-
-
- hard_task_def_wcet(h_aper, 100000);
- */
- kern_printf("After task creation\n");
-
- group_activate(1);
-
- return 0;
-}
Index: rel_1_2/slsh/slsh.c
===================================================================
--- rel_1_2/slsh/slsh.c (revision 1198)
+++ rel_1_2/slsh/slsh.c (nonexistent)
@@ -1,751 +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: slsh.c,v 1.4 2003-01-07 17:10:18 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.4 $
- Last update: $Date: 2003-01-07 17:10:18 $
- ------------
-
- This file contains the scheduling module for Slot-Shifting.
-
- Read slsh.h for further details.
-
-**/
-
-/*
- * 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 "slsh.h"
-#include <ll/stdio.h>
-#include <ll/stdlib.h>
-#include <ll/string.h>
-#include <ll/math.h> /* for ceil(...) */
-#include <ll/ll.h> /* for memcpy(...) */
-#include <kernel/model.h>
-#include <kernel/descr.h>
-#include <kernel/var.h>
-#include <kernel/func.h>
-#include <kernel/trace.h>
-
-//#define eslsh_printf kern_printf
-#define slsh_printf printk
-
-/* Keeps information about static and guaranteed tasks */
-typedef struct {
- int est;
- int dabs;
- int interval;
-} SLSH_task;
-
-/*+ Status used in the level +*/
-#define SLSH_READY MODULE_STATUS_BASE
-#define SLSH_WAIT MODULE_STATUS_BASE + 1
-#define SLSH_IDLE MODULE_STATUS_BASE + 2
-#define SLSH_WCET_VIOLATED MODULE_STATUS_BASE + 3
-
-/*+ defines +*/
-#define MAX_INTERVALS 1000 /* 1000 intervals is max, for now */
-
-/******+ the level redefinition for the SLOT SHIFT level +*******/
-typedef struct {
- level_des l; /*+ the standard level descriptor+*/
-
- /* task lists */
- SLSH_task tasks[MAX_PROC]; /* est and dl's for static and guaranteed task */
-
- IQUEUE idle_statics; /* finished static tasks */
-
- IQUEUE unspecified; /* tasks with only a wcet */
-
- /* the Intervals list */
- SLSH_interval intervals[MAX_INTERVALS];
- int current; /* current interval */
- int last; /* last interval */
-
- int slot; /* slot shifting time */
- TIME slot_length; /* slothlength in real system time*/
- int LCM; /* length (in slots) of ofline schedule */
-
- int slot_event; /* save the event */
-} SLSH_level_des;
-
-
-/* check if some tasks are ready, return 0 if ready, -1 otherwise */
-static int SLSH_R(SLSH_task* tasks)
-{
- int s;
-
- /* for all static tasks */
- for(s = 0; tasks[s].est != -1; ++s)
- {
- if(proc_table[s].status == SLSH_READY)
- return 0;
- }
- return -1;
-}
-
-/* check if unspecified exists, return 0 if it exists, -1 otherwise */
-static int SLSH_T(IQUEUE *unspecified)
-{
- if(!iq_isempty(unspecified))
- return 0;
- else
- return -1;
-}
-
-/* return the sc in an interval */
-static int SLSH_sc(SLSH_interval* intervals, int i)
-{
- return intervals[i].sc;
-}
-/* return a static task from current interval or a guaranted task */
-static PID SLSH_staticOrGuaranteed(SLSH_level_des* lev)
-{
- int lowest_dl = 0; /* lowest dl found */
- PID pid = 0; /* static or guaranteed task */
- int t;
-
- /* Decide according to EDF, go through all static & guaranteed tasks */
- for(t = 0; t < MAX_PROC; ++t)
- {
- /* static tasks */
- if(proc_table[t].pclass == STATIC_PCLASS)
- {
- /* static task must belong to current interval */
- if(lev->tasks[t].interval == lev->current)
- {
- /* only ready tasks */
- if(proc_table[t].status == SLSH_READY)
- {
- /* a new lower dl was found */
- if(lev->tasks[t].dabs < lowest_dl)
- {
- lowest_dl = lev->tasks[t].dabs;
- pid = t;
- }
- }
- }
- } /* guaranteed tasks */
- else if(proc_table[t].pclass == HARD_PCLASS)
- {
- /* only ready tasks */
- if(proc_table[t].status == SLSH_READY)
- {
- /* a new lower dl was found */
- if(lev->tasks[t].dabs < lowest_dl)
- {
- lowest_dl = lev->tasks[t].dabs;
- pid = t;
- }
- }
- }
- }/* for all tasks */
-
- return pid;
-}
-
-/* return a static task among the candidates, all ready statics */
-static PID SLSH_candidates(SLSH_task* tasks)
-{
- int lowest_dl = 0;
- PID pid = -1;
- int t;
-
- /* Use the EDL algorithm again to decide which task to run */
- for(t = 0; t < MAX_PROC; ++t)
- {
- /* only static tasks */
- if(proc_table[t].pclass == STATIC_PCLASS)
- {
- /* only ready tasks */
- if(proc_table[t].status == SLSH_READY)
- {
- /* a new lower dl was found */
- if(tasks[t].dabs < lowest_dl)
- {
- lowest_dl = tasks[t].dabs;
- pid = t;
- }
- }/* all ready tasks */
- }/* all static tasks */
- }/* for all tasks */
-
- return pid;
-}
-
-/* decrease the sc in a interval by amount */
-void SLSH_decSc(SLSH_interval* intervals, int i, int amount)
-{
- intervals[i].sc -= amount;
-}
-
-void SLSH_incSc(SLSH_interval* intervals, int i, int amount)
-{
- intervals[i].sc += amount;
-}
-
-/* swap the sc between intervals, also consider intervals with negative sc */
-void SLSH_swapSc(SLSH_interval* intervals, int current, int task_interval)
-{
- /* decrease the sc in the current interval */
- SLSH_decSc(intervals, current, 1);
-
- /* update the other interval(s) */
- if(intervals[task_interval].sc < 0) /* negative sc */
- {
- /* special case, increase next interval sc by 1 and also current interval (borrowing) */
- if(task_interval == current + 1)
- {
- SLSH_incSc(intervals, task_interval, 1);
- SLSH_incSc(intervals, current, 1);
- }
- else /* increase every interval sc that is negative between current and task_interval */
- {
- while(task_interval > current && intervals[task_interval].sc < 0)
- {
- SLSH_incSc(intervals, task_interval, 1);
- task_interval--;
- }
- }
- }
- else /* ordinary swapping */
- SLSH_incSc(intervals, task_interval, 1);
-}
-
-/* The scheduler, decides which task to run. */
-static PID SLSH_public_scheduler(LEVEL l)
-{
- SLSH_level_des* lev = (SLSH_level_des *)(level_table[l]);
- PID pid;
-
- /* The scheduler choses among static, guaranteed (hard aperiodic) and
- unspecified (soft aperiodic) tasks */
- /* no ready tasks and no sc, execute idle task */
- if(SLSH_R(lev->tasks) == 0 && SLSH_sc(lev->intervals, lev->current) == 0)
- return NIL;
- /* must execute a static from current intervall or a guaranteed task */
- else if(SLSH_R(lev->tasks) > 0 && SLSH_sc(lev->intervals, lev->current) == 0)
- return SLSH_staticOrGuaranteed(lev);
- /* sc available... */
- else if(SLSH_R(lev->tasks) > 0 && SLSH_sc(lev->intervals, lev->current) > 0)
- {
- /* If unspecified exist, execute it according to FIFO order */
- if(SLSH_T(&lev->unspecified) == 0)
- {
- SLSH_decSc(lev->intervals, lev->current, 1); /* decrease sc by 1 */
- return iq_getfirst(&lev->unspecified);
- }
- else /* No unspecified, execute task from candidates (statics) */
- {
- pid = SLSH_candidates(lev->tasks);
-
- /* sc needs to be swapped */
- if(lev->tasks[pid].interval != lev->current)
- SLSH_swapSc(lev->intervals, lev->tasks[pid].interval, lev->current);
-
- return pid;
- }
- }
-
- kern_printf("(SLSH s)");
- return NIL;
-}
-
-/* not used, slot-shifting handles all guarantees itself, it handles all bandwidth */
-static int SLSH_public_guarantee(LEVEL l, bandwidth_t *freebandwidth)
-{
- *freebandwidth = 0;
- return 1;
-}
-
-/* get the interval that x is in */
-static int SLSH_getInterval(SLSH_interval* intervals, int x, int last)
-{
- int i;
-
- /* search through the intervals */
- for(i = 0; i <= last; ++i)
- {
- /* I is in the interval where start is smaller or equal and end is bigger */
- if(intervals[i].start <= x && x < intervals[i].end)
- return i;
- }
- return -1;
-}
-
-/* get the start of the interval I */
-static int SLSH_intervalStart(SLSH_interval* intervals, int I)
-{
- return intervals[I].start;
-}
-
-/* split interval I into two parts, slow because of copying. OBS!!! no check if there is
- enough space in the intervals array */
-static void SLSH_splitInterval(SLSH_level_des* lev, int I, int dabs)
-{
- SLSH_interval left_interval;
- int i;
-
-
- lev->last++;
-
- /* move every interval above and including I */
- for(i = lev->last; i > I; --i)
- memcpy(&lev->intervals[i], &lev->intervals[i - 1], sizeof(SLSH_interval));
-
- /* Left interval start, end and length */
- left_interval.start = lev->intervals[I].start;
- left_interval.end = dabs;
- left_interval.length = left_interval.end - left_interval.start;
-
- /* Right interval (uses old interval struct) start and length end remains as the old value */
- lev->intervals[I + 1].start = dabs;
- lev->intervals[I + 1].length = lev->intervals[I + 1].end - lev->intervals[I + 1].start;
-
- /* check if sc still exists in the right interval */
- if(lev->intervals[I + 1].length - lev->intervals[I + 1].maxt > 0)
- {
- lev->intervals[I + 1].sc = lev->intervals[I + 1].length - lev->intervals[I + 1].maxt;
- left_interval.sc = left_interval.length; /* the whole interval is free, for now... */
- }
- else /* no sc in the right interval */
- {
- lev->intervals[I + 1].maxt = lev->intervals[I + 1].length;
- left_interval.sc = lev->intervals[I + 1].sc; /* all sc in left interval */
- lev->intervals[I + 1].sc = 0;
- }
-
- /* insert the new interval */
- memcpy(&lev->intervals[I], &left_interval, sizeof(SLSH_interval));
-}
-
-/* Reduce the sc from back to front by the wcet amount, interval splitting may be neccesary */
-static void SLSH_updateSc(SLSH_level_des* lev, HARD_TASK_MODEL* h)
-{
- int dabs = ceil((lev->slot + h->drel)/lev->slot_length); /* absolute deadline of request */
- int dabs_interval = SLSH_getInterval(lev->intervals, dabs, lev->last); /* interval where dabs is */
- int C = ceil(h->wcet/lev->slot_length); /* amount of sc to reduce */
- int sc = 0;
- int i;
-
- /* check if interval splitting is neccesary */
- if(lev->intervals[dabs_interval].end != dabs)
- SLSH_splitInterval(lev, dabs_interval, dabs);
-
- /* decrease sc in all intervals that are neccesary from dabs_interval o current */
- for(i = dabs_interval; i >= lev->current && C > 0; --i)
- {
- if((sc = SLSH_sc(lev->intervals, i)) >= 0) /* only decrease where sc exists */
- {
- if(sc > C) /* the last sc dec */
- {
- SLSH_decSc(lev->intervals, i, C);
- C = 0;
- }
- else /* to little sc in this interval, decrease it to 0 */
- {
- C -= SLSH_sc(lev->intervals, i);
- SLSH_decSc(lev->intervals, i, SLSH_sc(lev->intervals, i));
- }
- }
- }/* for all intervals */
-}
-
-/* the guarantee algorithm for hard aperiodic requests */
-static int SLSH_guarantee(SLSH_level_des* lev, HARD_TASK_MODEL* h)
-{
- int total_sc = 0;
- int temp, i;
- int dabs = ceil((lev->slot + h->drel)/lev->slot_length); /* absolute deadline of request */
- int dabs_interval = SLSH_getInterval(lev->intervals, dabs, lev->last); /* interval where dabs is */
-
- /* check if the sc up until request deadline is >= request wcet */
- /* 1. the sc of the current interal */
- total_sc = SLSH_sc(lev->intervals, lev->current);
-
- /* 2. the sc for all whole intervals between current and the interval
- with the request deadline */
- for(i = (lev->current) + 1; i < dabs_interval; ++i)
- {
- if((temp = SLSH_sc(lev->intervals, i)) > 0)
- total_sc += temp;
- }
-
- /* 3. the min of sc or the execution need in the last interval */
- total_sc += min(SLSH_sc(lev->intervals, dabs_interval),
- dabs - SLSH_intervalStart(lev->intervals,
- dabs_interval));
-
- if(total_sc >= h->wcet)
- { /* update the sc in the intervals from back to front */
- SLSH_updateSc(lev, h);
- return 0;
- }
- else
- return -1;
-}
-
-/* check if task model is accepted and store nessecary parameters */
-static int SLSH_public_create(LEVEL l, PID p, TASK_MODEL *m)
-{
- SLSH_level_des *lev = (SLSH_level_des *)(level_table[l]);
- STATIC_TASK_MODEL* s;
- HARD_TASK_MODEL* h;
- SOFT_TASK_MODEL* u;
-
-
- /* Check the models */
- switch(m->pclass)
- {
- case STATIC_PCLASS: /* offline scheduled tasks */
- break;
- case HARD_PCLASS: /* hard aperiodic tasks */
- h = (HARD_TASK_MODEL *) m;
- if (h->drel == 0 || h->wcet == 0) /* must be set */
- return -1;
- break;
- case SOFT_PCLASS: /* soft aperiodic tasks */
- u = (SOFT_TASK_MODEL *) m;
- if(u->wcet == 0) /* must be set */
- return -1;
- break;
- default:
- return -1;
- }
-
-
- /* if the SLSH_task_create is called, then the pclass must be a
- valid pclass. Slot-shifting accepts STATIC_TASK, HARD_TASK
- and SOFT_TASK models with some restrictions */
-
- /* est, dl and wcet is saved in slotlengths */
- switch(m->pclass)
- {
- case STATIC_PCLASS: /* offline scheduled tasks */
- s = (STATIC_TASK_MODEL *) m;
- lev->tasks[p].est = ceil(s->est/lev->slot_length);
- lev->tasks[p].dabs = ceil(s->dabs/lev->slot_length);
- lev->tasks[p].interval = s->interval;
- proc_table[p].avail_time = s->wcet;
- proc_table[p].wcet = s->wcet;
- break;
- case HARD_PCLASS: /* hard aperiodic tasks */
- h = (HARD_TASK_MODEL *) m;
- if(SLSH_guarantee(lev, h) == 0)
- {
- /* convert drel to dabs */
- lev->tasks[p].dabs = ceil((lev->slot + h->drel)/lev->slot_length);
- proc_table[p].avail_time = h->wcet;
- proc_table[p].wcet = h->wcet;
- }
- else /* task not guaranteed */
- return -1;
- break;
- case SOFT_PCLASS:
- u = (SOFT_TASK_MODEL *) m;
- proc_table[p].avail_time = u->wcet;
- proc_table[p].wcet = u->wcet;
- iq_insertlast(p, &lev->unspecified); /* respect FIFO order */
- break;
- default: /* a task model not supported */
- return -1;
- }
- /* enable wcet check in the kernel */
- proc_table[p].control |= CONTROL_CAP;
-
- return 0;
-}
-
-/************* The slot end event handler *************/
-static void SLSH_slot_end(void* p)
-{
- SLSH_level_des* lev = (SLSH_level_des *) p;
- PID pid;
- int i;
-
- /* increase slot "time" by 1 */
- if(lev->slot < lev->LCM)
- {
- lev->slot++;
- /* check if new statics are ready */
- for(i = 0; lev->tasks[i].interval != -1; ++i)
- {
- if(lev->tasks[i].est <= lev->slot && proc_table[i].status == SLSH_WAIT)
- proc_table[i].status = SLSH_READY;
- }
-
- /* check if current (interval) needs updating */
- if(lev->current < SLSH_getInterval(lev->intervals, lev->slot, lev->last))
- lev->current++;
-
- }
- else /* restart from the beginning of the offline schedule */
- {
- lev->slot = 0;
-
- while((pid = iq_getfirst(&lev->idle_statics)) != NIL)
- {
- if(lev->tasks[pid].est <= lev->slot)
- proc_table[pid].status = SLSH_READY;
- else
- proc_table[pid].status = SLSH_WAIT;
- }
- }
-
- /* call for a rescheduling, reset event flag and increase slot by 1 */
- lev->slot_event = -1;
- kern_printf("*");
- event_need_reschedule();
-}
-
-/* when a task becomes executing (EXE status) */
-static void SLSH_public_dispatch(LEVEL l, PID pid, int nostop)
-{
- SLSH_level_des *lev = (SLSH_level_des *)(level_table[l]);
- struct timespec t;
-
- /* the task state is set EXE by the scheduler()
- we extract the task from the unspecified queue.
- NB: we can't assume that p is the first task in the queue!!! */
-
- if(proc_table[pid].pclass == SOFT_PCLASS)
- iq_extract(pid, &lev->unspecified);
-
- /* also start the timer for one slot length */
- lev->slot_event = kern_event_post(&TIME2TIMESPEC(lev->slot_length, t),
- SLSH_slot_end, (void*) lev);
-}
-
-/* called when task is moved from EXE status */
-static void SLSH_public_epilogue(LEVEL l, PID pid)
-{
- SLSH_level_des *lev = (SLSH_level_des *)(level_table[l]);
-
- /* check if the wcet is finished... */
- if (proc_table[pid].avail_time <= 0)
- {
- /* if it is, raise a XWCET_VIOLATION exception */
- kern_raise(XWCET_VIOLATION, pid);
- proc_table[pid].status = SLSH_WCET_VIOLATED;
- }
- else /* the end of a slot. the task returns into the ready queue... */
- {
- if(proc_table[pid].pclass == SOFT_PCLASS)
- iq_insertfirst(pid,&lev->unspecified);
-
- proc_table[pid].status = SLSH_READY;
- }
-}
-
-/* when task go from SLEEP to SLSH_READY or SLSH_WAIT */
-static void SLSH_public_activate(LEVEL l, PID pid)
-{
- SLSH_level_des *lev = (SLSH_level_des *)(level_table[l]);
- WORD type = proc_table[pid].pclass;
-
- /* Test if we are trying to activate a non sleeping task */
- /* Ignore this; the task is already active */
- if (proc_table[pid].status != SLEEP && proc_table[pid].status != SLSH_WCET_VIOLATED)
- return;
-
- /* make task ready or waiting, dependong on slot (the time) for static tasks only*/
- if(type == STATIC_PCLASS && lev->tasks[pid].est <= lev->slot)
- proc_table[pid].status = SLSH_READY;
- else
- proc_table[pid].status = SLSH_WAIT;
-
- if(type == HARD_PCLASS)
- proc_table[pid].status = SLSH_READY;
-
- /* insert unspecified tasks in QQUEUE and make it ready */
- if(type == SOFT_PCLASS)
- {
- iq_insertlast(pid ,&lev->unspecified);
- proc_table[pid].status = SLSH_READY;
- }
-}
-
-/* when a task i returned to module from a semaphore, mutex ... */
-static void SLSH_public_unblock(LEVEL l, PID pid)
-{
- SLSH_level_des *lev = (SLSH_level_des *)(level_table[l]);
-
- /* change staus of task */
- proc_table[pid].status = SLSH_READY;
-
- if(proc_table[pid].pclass == SOFT_PCLASS)
- iq_insertfirst(pid ,&lev->unspecified);
-}
-
-/* when a semaphore, mutex ... taskes a task from module */
-static void SLSH_public_block(LEVEL l, PID pid)
-{
- /* Extract the running task from the level
- . we have already extract it from the ready queue at the dispatch time.
- . the capacity event have to be removed by the generic kernel
- . the wcet don't need modification...
- . the state of the task is set by the calling function
- . the deadline must remain...
-
- So, we do nothing!!!
- */
-}
-
-/* the task has finihed its wcet, kill task (dont kill static tasks) */
-static void SLSH_public_end(LEVEL l, PID pid)
-{
- SLSH_level_des *lev = (SLSH_level_des *)(level_table[l]);
-
- if(proc_table[pid].pclass == SOFT_PCLASS)
- {
- if (proc_table[pid].status == SLSH_READY)
- iq_extract(pid, &lev->unspecified);
- }
- else if(proc_table[pid].pclass == HARD_PCLASS)
- {
- if (proc_table[pid].status == SLSH_READY)
- lev->tasks[pid].dabs = 0;
-
- }
- /* static tasks: put them in idle QUEUE, reset status and avail_time */
- else if(proc_table[pid].pclass == STATIC_PCLASS)
- {
- proc_table[pid].avail_time = proc_table[pid].wcet;
- proc_table[pid].status = SLSH_IDLE;
- iq_priority_insert(pid, &lev->idle_statics);
- }
-
- proc_table[pid].status = FREE;
-}
-
-/* called when a task should sleep but not execute for awhile, mabe a mode change */
-//static void SLSH_task_sleep(LEVEL l, PID pid)
-//{
-//
-// /* the task has terminated his job before it consume the wcet. All OK! */
-// proc_table[pid].status = SLEEP;
-//
-// /* we reset the capacity counters... only for static tasks */
-// if (proc_table[pid].pclass == STATIC_PCLASS)
-// proc_table[pid].avail_time = proc_table[pid].wcet;
-//
-//}
-
-
-/** Guest Functions, slot shifing accepts no guests, so all generates exceptions **/
-
-/******* Registration functions *******/
-
-/*+ Registration function: */
-LEVEL SLSH_register_level()
-{
- LEVEL l; /* the level that we register */
- SLSH_level_des *lev; /* for readableness only */
- PID i; /* a counter */
-
- kern_printf("SLSH_register_level\n");
-
- /* request an entry in the level_table */
- l = level_alloc_descriptor(sizeof(SLSH_level_des));
-
- lev = (SLSH_level_des *)level_table[l];
-
- printk(" lev=%d\n",(int)lev);
-
- /* fill the standard descriptor */
- lev->l.public_scheduler = SLSH_public_scheduler;
- lev->l.public_guarantee = SLSH_public_guarantee;
- lev->l.public_create = SLSH_public_create;
- lev->l.public_end = SLSH_public_end;
- lev->l.public_dispatch = SLSH_public_dispatch;
- lev->l.public_epilogue = SLSH_public_epilogue;
- lev->l.public_activate = SLSH_public_activate;
- lev->l.public_unblock = SLSH_public_unblock;
- lev->l.public_block = SLSH_public_block;
-
- /* fill the SLSH descriptor part */
- for(i = 0; i < MAX_PROC; i++)
- {
- lev->tasks[i].est = -1;
- lev->tasks[i].dabs = 0;
- lev->tasks[i].interval = -1;
- }
-
- for(i = 0; i < MAX_INTERVALS; i++)
- {
- lev->intervals[i].start = -1;
- lev->intervals[i].end = -1;
- lev->intervals[i].length = 0;
- lev->intervals[i].maxt = 0;
- lev->intervals[i].sc = 0;
- }
-
- lev->current = 0;
- lev->last = NIL;
- lev->slot = 0;
- lev->slot_length = 0;
- lev->slot_event = -1;
-
- return l;
-}
-
-
-void SLSH_set_interval(LEVEL l, int start, int end, int maxt)
-{
- SLSH_level_des* lev = (SLSH_level_des *)(level_table[l]);
- static int i = -1;
-
- i++;
- lev->intervals[i].start = start;
- lev->intervals[i].end = end;
- lev->intervals[i].length = end - start;
- lev->intervals[i].maxt = maxt;
- lev->intervals[i].sc = lev->intervals[i].length - maxt;
-
- lev->last = i;
-}
-
-void SLSH_set_variables(LEVEL l, TIME length)
-{
- SLSH_level_des* lev = (SLSH_level_des *)(level_table[l]);
-
- lev->slot_length = length;
-}
Index: rel_1_2/slsh/readme.txt
===================================================================
--- rel_1_2/slsh/readme.txt (revision 1198)
+++ rel_1_2/slsh/readme.txt (nonexistent)
@@ -1,6 +0,0 @@
-This Example has been made by Tomas Lenvall.
-
-There is not a lot of documentation available, so if you have problems please
-send an e-mail to Tomas ( mailto:tlv@mdh.se )
-
-Paolo
Index: rel_1_2/slsh/makefile
===================================================================
--- rel_1_2/slsh/makefile (revision 1198)
+++ rel_1_2/slsh/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-
-include $(BASE)/config/config.mk
-
-PROGS=slshtest
-
-include $(BASE)/config/example.mk
-
-slshtest:
- make -f $(SUBMAKE) APP=slshtest INIT= OTHEROBJS="slshinit.o slsh.o" OTHERINCL= SHARKOPT=__OLDCHAR__
Index: rel_1_2/slsh/slshinit.c
===================================================================
--- rel_1_2/slsh/slshinit.c (revision 1198)
+++ rel_1_2/slsh/slshinit.c (nonexistent)
@@ -1,117 +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: slshinit.c,v 1.1.1.1 2002-09-02 09:37:41 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:41 $
- ------------
-
- System initialization file
-
- The tick is set to TICK ms.
-
- This file contains the 2 functions needed to initialize the system.
-
- These functions register the following levels:
-
- a Slot Shifting level
- a Dummy level
-
- It can accept these task models:
-
- STATIC_TASK_MODEL
- HARD_TASK_MODEL(aperiodic)
- SOFT_TASK_MODEL
-
-**/
-
-/*
- * 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 "slsh.h"
-#include "modules/rr2.h"
-#include "modules/sem.h"
-#include "modules/hartport.h"
-#include "drivers/keyb.h"
-#include "modules/dummy.h"
-
-/*+ sysyem tick in us +*/
-#define TICK 300
-
-/* define RR tick in us*/
-#define RRTICK 10000
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- SLSH_register_level();
- RR2_register_level(RRTICK, RR2_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- return TICK;
-}
-
-NRT_TASK_MODEL nrt;
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- KEYB_PARMS k = BASE_KEYB;
-
- nrt_task_default_model(nrt);
- keyb_def_task(k,&nrt);
-
-
-
- HARTPORT_init();
-
- KEYB_init(NULL);
-
- __call_main__(mb);
-
- return 0;
-}
-
-
Index: rel_1_2/slsh/slsh.h
===================================================================
--- rel_1_2/slsh/slsh.h (revision 1198)
+++ rel_1_2/slsh/slsh.h (nonexistent)
@@ -1,204 +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: slsh.h,v 1.2 2003-01-07 17:10:18 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.2 $
- Last update: $Date: 2003-01-07 17:10:18 $
- ------------
- Author: Tomas Lennvall, Date: Feb 2000.
-
- This file contains the scheduling module for Slot shifting.
-
- Title:
- Slot Shifting
-
- Task Models Accepted:
- STATIC_TASK_MODEL - Periodic Hard tasks that are scheduled by
- an off-line scheduler, so that all guarantees regarding precedence, mutex
- deadline violation is taken care of. The tasks are in an executione schedule,
- that is the order in when they become ready. They have the following fields:
- est (earliest start time), wcet and absolute deadline.
-
- HARD_TASK_MODEL - Hard Tasks (Hard aperiodic requests)
- wcet field and drel field must be != 0. They are used to set the wcet
- and deadline of the tasks.
- periodicity field must be APERIODIC
- mit field is ignored.
-
- SOFT_TASK_MODEL - Soft Tasks (Unspecified tasks)
- wcet field must be != 0. periodicity filed must be APERIODIC
- period and met filed is ignored.
-
- Guest Models Accepted:
- NONE - Slot shifting handles all tasks by itself (at this moment).
-
- Description:
- This module schedules the offline scheduled tasks according to the slot-
- shifting paradigm, dividing time into slots of a fixed length and assigning
- tasks to execute in those slots. Slot-shifting also keeps track of the free
- bandwidth in the schedule by using disjoint intervals and sc (spare capacity).
- Each interval has a sc nr that represents the free bandwidth in that interval,
- the sc can be used by hard aperiodic tasks, static tasks from later interval or
- soft aperiodic tasks. Hard aperiodic tasks are guaranteed an incorporated in
- the schedule by reduction of sc before they execute. No guarantee is
- performed on the soft aperiodic tasks, they are run when no other task wants
- to execute and sc is available.
-
- Description:
- This module implements the Slot shifting algorithm, by Gerhard Fohler. Slot shifting
- schedules off-line scheduled tasks and also handles hard aperiodic requests by the
- guarantee alorithm. Slot shifting can also handle soft aperiodic tasks,
- called unspecified. That is tasks without a deadline.
-
- Exceptions raised:
- These exceptions are pclass-dependent...
- XDEADLINE_MISS
- If a task miss his deadline, the exception is raised.
-
- XWCET_VIOLATION
- If a task doesn't end the current cycle before if consume the wcet,
- an exception is raised, and the task is put in the EDF_WCET_VIOLATED
- state. To reactivate it, use EDF_task_activate via task_activate or
- manage directly the EDF data structure. Note that the exception is not
- handled properly, an XDEADLINE_MISS exeeption will also be raised at
- the period end...
-
- Restrictions & special features:
- - This level doesn't manage the main task.
- - At init time we can choose if the level have to activate
- . the wcet check
- (If a task require more time than declared, it is stopped and put in
- the state EDF_WCET_VIOLATED; a XWCET_VIOLATION exception is raised)
- . the task guarantee algorithm
- (when all task are created the system will check that the task_set
- will not use more than the available bandwidth)
- - The level use the priority and timespec_priority fields.
- - A function to return the used bandwidth of a level is provided.
- - The guest tasks don't provide the guest_endcycle function
-
-**/
-
-/*
- * 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
- *
- */
-
-
-#ifndef __SLSH_H__
-#define __SLSH_H__
-
-#include <ll/ll.h>
-#include <kernel/config.h>
-#include <sys/types.h>
-#include <kernel/types.h>
-
-#define STATIC_PCLASS 0x0500
-
-#define SLSH_LEVELNAME "Slot Shifting"
-#define SLSH_LEVEL_CODE 5
-#define SLSH_LEVEL_VERSION 1
-
-
-
-/* -----------------------------------------------------------------------
- STATIC_TASK_MODEL: offline scheduled Tasks
- ----------------------------------------------------------------------- */
-/* Offline-scheduled tasks are hard periodic tasks that have been
- scheduled before runtime. All guarantees are made by the off-
- line scheduler so the tasks are already guaranteed.
-*/
-
-typedef struct {
- TASK_MODEL t;
- TIME est;
- TIME wcet;
- TIME dabs;
- int interval; /* used in slot shifting */
-} STATIC_TASK_MODEL;
-
-#define static_task_default_model(m) \
- task_default_model((m).t,STATIC_PCLASS), \
- (m).est = -1, \
- (m).dabs = 0, \
- (m).wcet = 0, \
- (m).interval = -1;
-#define static_task_def_level(m,l) task_def_level((m).t,l)
-#define static_task_def_arg(m,a) task_def_arg((m).t,a)
-#define static_task_def_stack(m,s) task_def_stack((m).t,s)
-#define static_task_def_group(m,g) task_def_group((m).t,g)
-#define static_task_def_usemath(m) task_def_usemath((m).t)
-#define static_task_def_system(m) task_def_system((m).t)
-#define static_task_def_nokill(m) task_def_nokill((m).t)
-#define static_task_def_ctrl_jet(m) task_def_ctrl_jet((m).t)
-#define static_task_def_est(m,p) (m).est = (p)
-#define static_task_def_dabs(m,d) (m).dabs = (d)
-#define static_task_def_wcet(m,w) (m).wcet = (w)
-#define static_task_def_interval(m,i) (m).interval = (i)
-#define static_task_def_trace(m) task_def_trace((m).t)
-#define static_task_def_notrace(m) task_def_notrace((m).t)
-
-
-
-
-/*#define min(a, b) ((a) < (b) ? (a) : (b))*/
-
-#define TIME2TIMESPEC(T, TS) \
-( \
- ((TS).tv_sec = ((T)/1000000)), \
- ((TS).tv_nsec = (((T)%1000000) * 1000)), \
- (TS) \
-)
-
-/* define the interval struct */
-typedef struct {
- int start; /* start of interval */
- int end; /* end of interval */
- int length; /* Length of interval */
- int maxt; /* maximum execution time in interval */
- int sc; /* spare capacity in interval */
-} SLSH_interval;
-
-/*+ Registration function: */
-LEVEL SLSH_register_level();
-
-void SLSH_set_interval(LEVEL l, int start, int end, int maxt);
-void SLSH_set_variables(LEVEL l, TIME length);
-
-#endif
-
Index: rel_1_2/base/semdemo.c
===================================================================
--- rel_1_2/base/semdemo.c (revision 1198)
+++ rel_1_2/base/semdemo.c (nonexistent)
@@ -1,97 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 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
- *
- *
- * CVS : $Id: semdemo.c,v 1.1 2002-11-11 08:22:46 pj Exp $
-
- This is a really simple semaphore demo.
-
-*/
-
-#include "kernel/kern.h"
-
-#include "semaphore.h"
-
-sem_t s;
-
-void *goofy(void *a)
-{
- struct timespec t;
- char *n = proc_table[exec_shadow].name;
-
- cprintf("Task %s: Locking semaphore...\n", n);
-
- sem_wait(&s);
- cprintf("Task %s: Semaphore locked...\n", n);
-
- do {
- sys_gettime(&t);
- } while (t.tv_sec < (int)a);
-
- cprintf("Task %s: Unlocking semaphore...\n", n);
-
- sem_post(&s);
-
- cprintf("Task %s: Semaphore unlocked...\n", n);
-
- return 0;
-}
-
-int main(int argc, char **argv)
-{
- NRT_TASK_MODEL m;
- PID p2,p3;
-
- nrt_task_default_model(m);
- nrt_task_def_group(m,1);
-
- nrt_task_def_arg(m,(void *)1);
- p2 = task_create("goofy1", goofy, &m, NULL);
- if (p2 == NIL)
- { cprintf("Can't create goofy1 task...\n"); return 1; }
-
- nrt_task_def_arg(m,(void *)2);
- p3 = task_create("goofy2", goofy, &m, NULL);
- if (p3 == NIL)
- { cprintf("Can't create goofy2 task...\n"); return 1; }
-
- cprintf("Initializing semaphore...\n");
-
- sem_init(&s,0,1);
-
- group_activate(1);
-
- return 0;
-}
Index: rel_1_2/base/time.c
===================================================================
--- rel_1_2/base/time.c (revision 1198)
+++ rel_1_2/base/time.c (nonexistent)
@@ -1,69 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 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
- *
- *
- * CVS : $Id: time.c,v 1.1 2002-10-28 08:13:37 pj Exp $
- *
- * Timer correctness test
- */
-
-#include "kernel/kern.h"
-
-#define NT 10
-
-int main(int argc, char **argv)
-{
- struct timespec t[NT];
- int i;
-
- cprintf("Timer correctness test (1 second).\n");
-
- for (i=0; i<NT; i++) NULL_TIMESPEC(&t[i]);
-
- do {
- for (i=0; i<NT-1; i++) t[i+1] = t[i];
-
- sys_gettime(&t[0]);
-
- if (TIMESPEC_A_LT_B(&t[0],&t[1])) {
- for (i=0; i<NT; i++)
- cprintf("%d %ld\n",i, t[i].tv_nsec);
- sys_end();
- }
- } while (t[0].tv_sec < 1);
-
- return 0;
-}
-
Index: rel_1_2/base/intsem.c
===================================================================
--- rel_1_2/base/intsem.c (revision 1198)
+++ rel_1_2/base/intsem.c (nonexistent)
@@ -1,101 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Giorgio Buttazzo, Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * CVS : $Id: intsem.c,v 1.1 2002-11-11 08:22:45 pj Exp $
-
- this test is a simple main() function with one other task.
-
- This test verify the correctness of the internal_sem functions.
-
-*/
-
-#include "kernel/kern.h"
-
-#include <kernel/int_sem.h>
-
-internal_sem_t s;
-
-TASK pippo(void *a)
-{
- int i=0;
- struct timespec t;
-
- do {
- sys_gettime(&t);
-
- if (i==0 && t.tv_sec == (int)a) {
- i = 1;
- cprintf("before internal_sem_wait %d\n",(int)a);
- internal_sem_wait(&s);
- cprintf("after internal_sem_wait %d\n",(int)a);
- }
-
- if (i==1 && t.tv_sec == 2+(int)a) {
- i = 2;
- cprintf("before internal_sem_post %d\n",(int)a);
- internal_sem_post(&s);
- cprintf("after internal_sem_post %d\n",(int)a);
- return 0;
- }
-
-
- } while (1);
-}
-
-int main(int argc, char **argv)
-{
- NRT_TASK_MODEL m;
- PID p2,p3;
-
- nrt_task_default_model(m);
- nrt_task_def_group(m,1);
-
- nrt_task_def_arg(m,(void *)1);
- p2 = task_create("pippo1", pippo, &m, NULL);
- if (p2 == NIL)
- { cprintf("Can't create pippo1 task...\n"); return 1; }
-
- nrt_task_def_arg(m,(void *)2);
- p3 = task_create("pippo2", pippo, &m, NULL);
- if (p3 == NIL)
- { cprintf("Can't create pippo2 task...\n"); return 1; }
-
- internal_sem_init(&s,1);
-
- group_activate(1);
-
- return 0;
-}
Index: rel_1_2/base/isched.c
===================================================================
--- rel_1_2/base/isched.c (revision 1198)
+++ rel_1_2/base/isched.c (nonexistent)
@@ -1,207 +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: isched.c,v 1.1 2002-11-11 08:22:45 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2002-11-11 08:22:45 $
- ------------
-
- System initialization file
-
- The tick is set to TICK ms.
-
- This file contains the 2 functions needed to initialize the system.
-
- These functions register the following levels:
-
- 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
- NRT_TASK_MODEL at level 1
- SOFT_TASK_MODEL (met, period) at level 2
-
- This file is similar to the configuration of Hartik 3.3.1
-
-**/
-
-/*
- * Copyright (C) 2000 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-
-
-#include "kernel/kern.h"
-
-#include "modules/edf.h"
-#include "modules/rm.h"
-
-#include "modules/cbs.h"
-#include "modules/tbs.h"
-#include "modules/ps.h"
-#include "modules/ds.h"
-
-#include "modules/rr.h"
-#include "modules/rr2.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 300
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-
-/* the mouse task use 160 us approx on my Celeron 366 */
-#define NUM 2000
-#define DEN 64000
-//#define DEN 8000
-
-//#undef XXX
-//#define XXX
-
-int argc;
-char *argv[100];
-
-extern char *title;
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- int conf;
-
- __compute_args__(mb,&argc, argv);
-
- if (argc < 2)
- conf = '0'; // default
- else
- conf = *argv[1];
-
- switch (conf) {
- case '1':
- RM_register_level(0); // NO GUARANTEE!!!
- PS_register_level(PS_ENABLE_BACKGROUND, 0, NUM, DEN);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- title = "1 - RM + PS ( bkg, U=1/16) + RR, no check Ulub < 0.69";
- break;
-
- case '2':
- RM_register_level(0); // NO GUARANTEE!!!
- PS_register_level(0, 0, NUM, DEN);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- title = "2 - RM + PS (nobkg, U=1/16) + RR, no check Ulub < 0.69\n";
- break;
-
- case '3':
- EDF_register_level(2);
- PS_register_level(PS_ENABLE_ALL_EDF, 0, NUM, DEN);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- title = "3 - EDF + PS ( bkg, U=1/16) + RR";
- break;
-
- case '4':
- EDF_register_level(2);
- PS_register_level(PS_ENABLE_GUARANTEE_EDF, 0, NUM, DEN);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- title = "4 - EDF + PS (nobkg, U=1/16) + RR";
- break;
-
- case '5':
- EDF_register_level(2);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- TBS_register_level(TBS_ENABLE_ALL, 0, NUM, DEN);
- title = "5 - EDF + TBS( U=1/16) + RR";
- break;
-
- case '6':
- RM_register_level(0); // NO GUARANTEE!!!
- DS_register_level(DS_ENABLE_BACKGROUND, 0, NUM, DEN);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- title = "6 - RM + DS ( bkg, U=1/16) + RR, no check Ulub < 0.69";
- break;
-
- case '7':
- RM_register_level(0); // NO GUARANTEE!!!
- DS_register_level(0, 0, NUM, DEN);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- title = "7 - RM + DS (nobkg, U=1/16) + RR, no check Ulub < 0.69\n";
- break;
-
- default: // '0'
- EDF_register_level(2);
- RR2_register_level(RRTICK, RR2_MAIN_YES, mb);
- CBS_register_level(CBS_ENABLE_ALL, 0);
- title = "0 - EDF + CBS + RR";
- }
-
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- return TICK;
-}
-
-int main(int argc, char **argv);
-
-TASK __init__(void *arg)
-{
-// struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- KEYB_init(NULL);
-
- main(argc,argv);
-
- return (void *)0;
-}
-
Index: rel_1_2/base/mdemo.c
===================================================================
--- rel_1_2/base/mdemo.c (revision 1198)
+++ rel_1_2/base/mdemo.c (nonexistent)
@@ -1,200 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 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
- *
- *
- * CVS : $Id: mdemo.c,v 1.1 2002-11-11 08:22:46 pj Exp $
-
- This test verify the correctness of the NOP module. It works with the
- PI, PC, SRP module, too.
-
- The test uses one mutex
-
- the main task (NRT) creates three tasks.
-
- J1 with PC priority 0
- starts at t=0.5 sec and lock m0
-
- J2 with PC priority 1
- starts at t=1 sec and doesn't lock any mutex
-
- J3 with PC priority 2
- it starts and locks m0
- at t=2 sec it unlocks m1
-
-
- The example is similar to the scheduling diagram shown at p. 188 of the
- book "Sistemi in tempo Reale", by Giorgio Buttazzo, Pitagora Editrice
-
-*/
-
-#include "kernel/kern.h"
-#include "drivers/keyb.h"
-#include "modules/srp.h"
-
-mutex_t m0;
-
-
-void startJ(void *a)
-{
- task_activate((PID)a);
-}
-
-TASK j1()
-{
- cprintf("J1: before locking m0\n");
- mutex_lock(&m0);
- cprintf("J1: locked m0\n");
- mutex_unlock(&m0);
- cprintf("J1: unlocked m0, end task\n");
- return 0;
-}
-
-
-TASK j2()
-{
- cprintf("J2: waiting t=1.5 sec\n");
-
- while (sys_gettime(NULL) < 1500000);
-
- cprintf("J2: end task\n");
- return 0;
-}
-
-
-TASK j3()
-{
- cprintf("J3: before locking m0\n");
- mutex_lock(&m0);
- cprintf("J3: locked m0, waiting to t=2 sec\n");
-
- while (sys_gettime(NULL) < 2000000);
-
- cprintf("J3: t = 1 sec reached, unlocking m0\n");
- mutex_unlock(&m0);
- cprintf("J3: unlocked m0, end task\n");
- return 0;
-}
-
-void fine(KEY_EVT *e)
-{
- sys_end();
-}
-
-
-int main(int argc, char **argv)
-{
- struct timespec t;
-
- HARD_TASK_MODEL m;
- PID p0,p1,p2;
-
- PC_mutexattr_t a;
- PI_mutexattr_t a2;
- NOP_mutexattr_t a3;
- SRP_mutexattr_t a4;
- NPP_mutexattr_t a5;
-
- PC_RES_MODEL r;
- SRP_RES_MODEL srp;
-
- KEY_EVT emerg;
-
- //keyb_set_map(itaMap);
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTL_BIT;
- keyb_hook(emerg,fine);
-
- /* ---------------------------------------------------------------------
- Mutex creation
- --------------------------------------------------------------------- */
-
- PC_mutexattr_default(a,0);
- PI_mutexattr_default(a2);
- NOP_mutexattr_default(a3);
- SRP_mutexattr_default(a4);
- NPP_mutexattr_default(a5);
- mutex_init(&m0,&a4);
-
- /* ---------------------------------------------------------------------
- Task creation
- --------------------------------------------------------------------- */
-
- hard_task_default_model(m);
- hard_task_def_wcet(m,20000);
- hard_task_def_mit(m,10000000);
- PC_res_default_model(r,0);
- SRP_res_default_model(srp,3);
- p0 = task_createn("J1", j1, (TASK_MODEL *)&m, &r, &srp, SRP_usemutex(&m0), NULL);
- if (p0 == NIL)
- { cprintf("Can't create J1 task...\n"); return 1; }
-
- hard_task_def_wcet(m,1600000);
- hard_task_def_mit(m,21000000);
- PC_res_default_model(r,1);
- SRP_res_default_model(srp,2);
- p1 = task_createn("J2", j2, (TASK_MODEL *)&m, &r, &srp, NULL);
- if (p1 == NIL)
- { cprintf("Can't create J2 task...\n"); return 1; }
-
- hard_task_def_wcet(m,3000000);
- hard_task_def_mit(m,100000000);
- PC_res_default_model(r,2);
- SRP_res_default_model(srp,1);
- p2 = task_createn("J3", j3, (TASK_MODEL *)&m, &r, &srp, SRP_usemutex(&m0), NULL);
- if (p2 == NIL)
- { cprintf("Can't create J3 task...\n"); return 1; }
-
-
- /* ---------------------------------------------------------------------
- Event post
- --------------------------------------------------------------------- */
-
- t.tv_sec = 0;
- t.tv_nsec = 500000000;
-
- kern_cli();
- kern_event_post(&t,startJ,(void *)p0);
-
- t.tv_sec = 1;
- kern_event_post(&t,startJ,(void *)p1);
- kern_sti();
-
- task_activate(p2);
-
- cprintf("END main\n");
-
- return 0;
-}
Index: rel_1_2/base/hello.c
===================================================================
--- rel_1_2/base/hello.c (revision 1198)
+++ rel_1_2/base/hello.c (nonexistent)
@@ -1,53 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 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
- */
-
-/*
- CVS : $Id: hello.c,v 1.1 2002-10-28 08:13:37 pj Exp $
-
- hello.c:
-
- This test is a simple hello world function.
-
-*/
-
-#include "kernel/kern.h"
-
-int main(int argc, char **argv)
-{
- cprintf("Hello, world!\n");
-
- return 0;
-}
Index: rel_1_2/base/initfile.c
===================================================================
--- rel_1_2/base/initfile.c (revision 1198)
+++ rel_1_2/base/initfile.c (nonexistent)
@@ -1,120 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- ------------
- CVS : $Id: initfile.c,v 1.1.1.1 2002-09-02 09:37:41 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1.1.1 $
- Last update: $Date: 2002-09-02 09:37:41 $
- ------------
-
- 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/base/pcdemo.c
===================================================================
--- rel_1_2/base/pcdemo.c (revision 1198)
+++ rel_1_2/base/pcdemo.c (nonexistent)
@@ -1,214 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 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
- *
- *
- * CVS : $Id: pcdemo.c,v 1.2 2003-01-07 17:10:15 pj Exp $
-
- This test verify the correctness of the PC module.
-
- The test uses 3 mutexes
- m0 with ceiling 0
- m1 with ceiling 0
- m2 with ceiling 1
-
- the main task (NRT) creates three tasks.
-
- J0 with PC priority 0
- starts at t=1.5 sec and lock m0, unlock m0, then lock and unlock m1
-
- J1 with PC priority 1
- starts at t=0.5 sec and try to lock m2
-
- J2 with PC priority 2
- it starts and locks m2
- at t=1 sec it locks m1
- at t=1.5 sec it unlocks m1
-
-
- The example is similar to the scheduling diagram shown at p. 197 of the
- book "Sistemi in tempo Reale", by Giorgio Buttazzo, Pitagora Editrice
-
-*/
-
-#include "kernel/kern.h"
-#include "drivers/keyb.h"
-
-mutex_t m0,m1,m2;
-
-
-void startJ(void *a)
-{
- task_activate((PID)a);
-}
-
-TASK j0()
-{
- cprintf("J0: before locking m0\n");
- mutex_lock(&m0);
- cprintf("J0: locked m0\n");
- mutex_unlock(&m0);
- cprintf("J0: unlocked m0, locking m1\n");
-
- mutex_lock(&m1);
- cprintf("J0: locked m1\n");
- mutex_unlock(&m1);
- cprintf("J0: unlocked m1, end task\n");
- return 0;
-}
-
-
-TASK j1()
-{
- cprintf("J1: before locking m2\n");
- mutex_lock(&m2);
- cprintf("J1: locked m2\n");
- mutex_unlock(&m2);
- cprintf("J1: unlocked m2, end task\n");
- return 0;
-}
-
-
-TASK j2()
-{
- cprintf("J2: before locking m2\n");
- mutex_lock(&m2);
- cprintf("J2: locked m2, waiting to t=1 sec\n");
-
- while (sys_gettime(NULL) < 1000000);
-
- cprintf("J2: t = 1 sec reached\n");
- mutex_lock(&m1);
- cprintf("J2: locked m1, waiting to t=2 sec\n");
-
- while (sys_gettime(NULL) < 2000000);
-
- cprintf("J2: t = 2 sec reached\n");
- mutex_unlock(&m1);
- cprintf("J2: unlocked m1\n");
-
- mutex_unlock(&m2);
- cprintf("J2: unlocked m2, end task\n");
- return 0;
-}
-
-void fine(KEY_EVT *e)
-{
- sys_end();
-}
-
-
-int main(int argc, char **argv)
-{
- struct timespec t;
-
- HARD_TASK_MODEL m;
- PID p0,p1,p2;
-
- PC_mutexattr_t a;
- PI_mutexattr_t a2;
- PC_RES_MODEL r;
-
- KEY_EVT emerg;
-
- clear();
-
- cprintf("Priority Ceiling demo. Press Alt-X to exit the demo\n");
-
- //keyb_set_map(itaMap);
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTL_BIT;
- keyb_hook(emerg,fine);
-
- /* ---------------------------------------------------------------------
- Task creation
- --------------------------------------------------------------------- */
-
- hard_task_default_model(m);
- hard_task_def_mit(m, 1000000);
- hard_task_def_wcet(m, 20000);
- PC_res_default_model(r,0);
- p0 = task_create("J0", j0, &m, &r);
- if (p0 == NIL)
- { cprintf("Can't create J0 task...\n"); return 1; }
-
- hard_task_default_model(m);
- hard_task_def_mit(m, 2100000);
- hard_task_def_wcet(m, 20000);
- PC_res_default_model(r,1);
- p1 = task_create("J1", j1, &m, &r);
- if (p1 == NIL)
- { cprintf("Can't create J1 task...\n"); return 1; }
-
- hard_task_default_model(m);
- hard_task_def_mit(m, 10000000);
- hard_task_def_wcet(m, 3000000);
- PC_res_default_model(r,2);
- p2 = task_create("J2", j2, &m, &r);
- if (p2 == NIL)
- { cprintf("Can't create J2 task...\n"); return 1; }
-
- /* ---------------------------------------------------------------------
- Mutex creation
- --------------------------------------------------------------------- */
-
- PI_mutexattr_default(a2);
- PC_mutexattr_default(a,0);
- mutex_init(&m0,(mutexattr_t *)&a);
- mutex_init(&m1,(mutexattr_t *)&a);
-
- PC_mutexattr_default(a,1);
- mutex_init(&m2,(mutexattr_t *)&a);
-
- /* ---------------------------------------------------------------------
- Event post
- --------------------------------------------------------------------- */
-
- t.tv_sec = 0;
- t.tv_nsec = 500000000;
-
- kern_cli();
- kern_event_post(&t,startJ,(void *)p1);
-
- t.tv_sec = 1;
- kern_event_post(&t,startJ,(void *)p0);
- kern_sti();
-
- task_activate(p2);
-
- cprintf("END main\n");
-
- return 0;
-}
Index: rel_1_2/base/readme
===================================================================
--- rel_1_2/base/readme (revision 1198)
+++ rel_1_2/base/readme (nonexistent)
@@ -1,50 +0,0 @@
-This directory contains a set of simple examples, useful to understand
-How to make a Shark application.
-
-Text mode demos:
-- hello.c --> a hello world application
-- timer.c --> tests if the time reads are always increasing
- (useful for debugging purposes)
-- sig.c --> simple example that sends signals
-- semdemo.c --> simple example that uses a semaphore for mutual exclusion
-- pidemo.c --> simple example that uses PI mutexes between NRT and Hard tasks
-- pcdemo.c --> simple example that uses PC mutexes between NRT and Hard tasks
-- srpdemo.c --> simple example that uses SRP mutexes between NRT and Hard tasks
-- mdemo.c --> simple example that uses a mutex, initialized with whatever
- protocol you want ;-)
-- aster.c --> Wow! the original Hartik ASTER demo!!! (EDF, CABs, ...)
-- aster1.c --> a -lot- of periodic tasks that are created and then die
- (6 seconds demo)
-- aster2.c --> a simple stress test: a lot of tasks are created until Utot=1;
- uses jet functions to dump statistics. (60 seconds demo)
-- aster3.c --> aster2 + 8 tasks handled by 2 different TBS servers
-- aster4.c --> aster3 + CBS tasks + Shutdown demo with system tasks
-- aster5.c --> aster3 + only CBS tasks + mutexes... Really interesting!
-- aster6.c --> aster5 + Polling Server to serve the JetCtrl task
-- aster7.c --> another aster clone with Rate monotonic and Polling server
-- aster8.c --> aster5 + Sporadic Server
-- preempt.c --> simple test for CBS, task_preempt, task_nopreempt, and
- save/skip arrivals
-- pcidemo.c --> PCI Bus scan
-- talk.c --> UDP Unix Talk clone (useful to understand the network driver)
-- mousfind.c--> Simple text mouse protocol finder
-- jointest.c--> Simple test that uses the task_join primitive
-- condtest.c--> Simple test that uses condition variables
-- intsem.c --> Simple test that uses internal semaphores
-- keycode.c --> Prints Keyboard Keycodes on the screen
-- memtest.c --> Do you need to use malloc, kern_alloc & co?
-
-Graphical demos:
-- fly.c --> Random flies going around the screen
-- ego.c --> Periodic tasks that writes a phrease on the screen
-- cabs.c --> Example that uses cabs
-- sched.c --> Scheduling example (mouse, EDF, RM, DS, PS, TBS)
-
-Note on the init files:
-- ihello.c (RR+dummy)
-- isemdemo.c (iaster1+Semaphores)
-- iaster1.c (EDF+RR+dummy)
-- iaster3.c (EDF+RR+TBS(0.1)+TBS(0.3)+dummy)
-- iaster4.c (iaster3+CBS)
-- initfile.c (EDF+CBS+RR+dummy, SEMaphores, CABS, HARTPORTs and Keyboard)
-- isched.c (Configurable scheduling architecture)
Index: rel_1_2/base/pidemo.c
===================================================================
--- rel_1_2/base/pidemo.c (revision 1198)
+++ rel_1_2/base/pidemo.c (nonexistent)
@@ -1,114 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 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
- *
- *
- * CVS : $Id: pidemo.c,v 1.2 2003-01-07 17:10:15 pj Exp $
-
- This test verify the correctness of the PI module.
-
- the main task (NRT) lock a PI mutex.
- then 2 tasks arrives, with priority higher than the main
-
- the first try to lock the mutex, but it can't, so the main inherit
- his priority. The second simply prints a string.
-
- If all works, the string of the second task is printed after the end of
- the first task.
-
-*/
-
-#include "kernel/kern.h"
-
-mutex_t m1;
-
-
-TASK goofy1(void *a)
-{
- cprintf("goofy1 before mutex_lock\n");
- mutex_lock(&m1);
- cprintf("goofy1 after mutex_lock\n");
-
- mutex_unlock(&m1);
- cprintf("goofy1 after mutex_unlock\n");
-
- return 0;
-}
-
-TASK goofy2()
-{
- cprintf("goofy2 inside goofy2\n");
- return 0;
-}
-
-int main(int argc, char **argv)
-{
- HARD_TASK_MODEL m;
- PID p2,p3;
-
- PI_mutexattr_t a;
-
- hard_task_default_model(m);
- hard_task_def_mit(m,50000);
- hard_task_def_wcet(m,20000);
- hard_task_def_group(m,1);
-
- hard_task_def_arg(m,(void *)1);
- p2 = task_create("goofy1", goofy1, &m, NULL);
- if (p2 == NIL)
- { cprintf("Can't create goofy1 task...\n"); return 1; }
-
- hard_task_def_mit(m,100000);
- p3 = task_create("goofy2", goofy2, &m, NULL);
- if (p3 == NIL)
- { cprintf("Can't create goofy2 task...\n"); return 1; }
-
- PI_mutexattr_default(a);
- mutex_init(&m1,&a);
-
- cprintf("main before mutex_lock\n");
- mutex_lock(&m1);
- cprintf("main after mutex_lock\n");
-
- group_activate(1);
-
- cprintf("main after group_activate\n");
- mutex_unlock(&m1);
- cprintf("main after mutex_unlock\n");
-
- mutex_destroy(&m1);
- cprintf("main after mutex_destroy\n");
-
- return 0;
-}
Index: rel_1_2/base/memtest.c
===================================================================
--- rel_1_2/base/memtest.c (revision 1198)
+++ rel_1_2/base/memtest.c (nonexistent)
@@ -1,101 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Giorgio Buttazzo, Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * CVS : $Id: memtest.c,v 1.1 2002-11-11 08:22:46 pj Exp $
- */
-
-/*
- * 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 <stdlib.h>
-
-int main(int argc, char **argv)
-{
- void *a;
-
- clear();
-
- a = malloc(4500);
- cprintf("malloc : %ld\n", (DWORD)a);
- free(a);
-
- kern_cli(); a = DOS_alloc(4500); kern_sti();
- cprintf("below 1 M: %ld\n", (DWORD)a);
- kern_cli(); DOS_free(a,4500); kern_sti();
-
- kern_cli(); a = kern_alloc_aligned(10000,MEMORY_UNDER_16M,10,0); kern_sti();
- cprintf("below 16M: %ld\n", (DWORD)a);
- kern_cli(); kern_free(a,10000); kern_sti();
-
- kern_cli(); a = kern_alloc_aligned(10000,MEMORY_FROM_1M_TO_16M,2,0); kern_sti();
- cprintf(">1M <16M : %ld\n", (DWORD)a);
- kern_cli(); kern_free(a,10000); kern_sti();
-
- kern_cli(); a = kern_alloc(10000); kern_sti();
- cprintf("normal : %ld\n", (DWORD)a);
- kern_cli(); kern_free(a,10000); kern_sti();
-
- kern_cli(); a = kern_alloc_page(MEMORY_UNDER_1M); kern_sti();
- cprintf("page <1M : %ld\n", (DWORD)a);
- kern_cli(); kern_free_page(a); kern_sti();
-
- kern_cli(); a = kern_alloc_page(MEMORY_FROM_1M_TO_16M); kern_sti();
- cprintf("p>1<16M : %ld\n", (DWORD)a);
- kern_cli(); kern_free_page(a); kern_sti();
-
- kern_cli(); a = kern_alloc_page(0); kern_sti();
- cprintf("page : %ld\n", (DWORD)a);
- kern_cli(); kern_free_page(a); kern_sti();
-
- return 0;
-}
Index: rel_1_2/base/condtest.c
===================================================================
--- rel_1_2/base/condtest.c (revision 1198)
+++ rel_1_2/base/condtest.c (nonexistent)
@@ -1,222 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Giorgio Buttazzo, Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * CVS : $Id: condtest.c,v 1.1 2002-11-11 08:22:45 pj Exp $
-
- This test verify the correctness of the condition variables.
- (... it doesn't test all...)
-
- The test uses 1 mutex
-
- the main task (NRT) creates three tasks.
-
- J0, J1, J3
- starts, lock the mutex, and wait on a condition variable
-
- J2
- at t = 0.5 lock the mutex and call cond_signal
- at t = 1 lock the mutex and call cond_signal
-
-*/
-
-#include "kernel/kern.h"
-#include "drivers/keyb.h"
-
-
-mutex_t m0;
-cond_t c0;
-
-int number = 0;
-
-PID p0,p1,p2,p3;
-
-TASK j0()
-{
- cprintf("J0: before locking m0\n");
- mutex_lock(&m0);
- cprintf("J0: locked m0, waiting on c0, number =%d\n", number);
- while (!number) {
- cond_wait(&c0,&m0);
- cprintf("J0: number = %d, if >0 unlocking m0\n",number);
- }
- number--;
- mutex_unlock(&m0);
- cprintf("J0: unlocked m0, end task\n");
- return 0;
-}
-
-
-TASK j1()
-{
- cprintf("J1: before locking m0\n");
- mutex_lock(&m0);
- cprintf("J1: locked m0, waiting on c0, number =%d\n", number);
- while (!number) {
- cond_wait(&c0,&m0);
- cprintf("J1: number = %d, if >0 unlocking m0\n",number);
- }
- number--;
- mutex_unlock(&m0);
- cprintf("J1: unlocked m0, end task\n");
- return 0;
-}
-
-
-TASK j2()
-{
-// struct timespec t;
-
- cprintf("J2: started, waiting t=0.5 sec\n");
- while (sys_gettime(NULL) < 500000);
-
- cprintf("J2: before locking m0\n");
- mutex_lock(&m0);
- cprintf("J2: locked m0, number++ (was %d), cond_signal\n", number);
-
- number++;
- cond_signal(&c0);
-// cond_broadcast(&c0);
-
- cprintf("J2: unlocking m0\n");
- mutex_unlock(&m0);
-
- cprintf("J2: waiting t=1 sec\n");
- while (sys_gettime(NULL) < 1000000);
-
- cprintf("J2: Killing J3\n");
- task_kill(p3);
- cprintf("J2: before locking m0\n");
- mutex_lock(&m0);
- cprintf("J2: locked m0, number++ (was %d), cond_signal\n", number);
-
- number++;
- cond_signal(&c0);
-// cond_broadcast(&c0);
-
- cprintf("J2: unlocking m0\n");
- mutex_unlock(&m0);
- cprintf("J2: unlocked m0, end task\n");
- return 0;
-}
-
-void cleanup_lock(void *arg)
-{
- cprintf("J3: KILL!!!\n");
- mutex_unlock(&m0);
- cprintf("J3: unlocked m0 by the cleanup function\n");
-}
-
-TASK j3()
-{
- cprintf("J3: before locking m0\n");
- mutex_lock(&m0);
- cprintf("J3: locked m0, waiting on c0, number =%d\n", number);
- task_cleanup_push(cleanup_lock, (void *)&m0);
- while (!number) {
- cond_wait(&c0,&m0);
- cprintf("J3: number = %d, if >0 unlocking m0\n",number);
- }
- task_cleanup_pop(0);
- // I hope this task never reach this point... it is killed by J2!!!
- number--;
- mutex_unlock(&m0);
- cprintf("J3: unlocked m0, end task\n");
- return 0;
-}
-
-void fine(KEY_EVT *e)
-{
- sys_end();
-}
-
-
-int main(int argc, char **argv)
-{
-// struct timespec t;
-
- NRT_TASK_MODEL m;
-
- PI_mutexattr_t a;
-
- KEY_EVT emerg;
-
- //keyb_set_map(itaMap);
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTL_BIT;
- keyb_hook(emerg,fine);
-
- /* ---------------------------------------------------------------------
- Task creation
- --------------------------------------------------------------------- */
-
- nrt_task_default_model(m);
- nrt_task_def_group(m,1);
- p0 = task_create("J0", j0, &m, NULL);
- if (p0 == NIL)
- { cprintf("Can't create J0 task...\n"); return 1; }
-
- p1 = task_create("J1", j1, &m, NULL);
- if (p1 == NIL)
- { cprintf("Can't create J1 task...\n"); return 1; }
-
- p2 = task_create("J2", j2, &m, NULL);
- if (p2 == NIL)
- { cprintf("Can't create J2 task...\n"); return 1; }
-
- p3 = task_create("J3", j3, &m, NULL);
- if (p3 == NIL)
- { cprintf("Can't create J3 task...\n"); return 1; }
-
- /* ---------------------------------------------------------------------
- Mutex creation
- --------------------------------------------------------------------- */
-
- PI_mutexattr_default(a);
- mutex_init(&m0,&a);
-
- cond_init(&c0);
-
- /* ---------------------------------------------------------------------
- Event post
- --------------------------------------------------------------------- */
-
- group_activate(1);
-
- cprintf("END main\n");
-
- return 0;
-}
Index: rel_1_2/base/mousfind.c
===================================================================
--- rel_1_2/base/mousfind.c (revision 1198)
+++ rel_1_2/base/mousfind.c (nonexistent)
@@ -1,216 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Giorgio Buttazzo, Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * CVS : $Id: mousfind.c,v 1.2 2003-03-24 11:18:19 pj Exp $
- */
-
-/*
- * Copyright (C) 2000 Paolo Gai, Massimiliano Giorgi
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include <kernel/kern.h>
-#include <drivers/mouse.h>
-#include <drivers/keyb.h>
-
-/* don't include this into real applications!!! */
-#include <../drivers/oldchar/_mouse.h>
-
-int done;
-
-void my_mouse_hook(MOUSE_EVT *m)
-{
- static int buttons=-1;
- if (buttons!=m->buttons) {
- buttons=m->buttons;
- //mouse_off();
- if (isLeftButton(*m)) puts_xy(9,22,RED,"active");
- else puts_xy(9,22,RED," ");
- if (isCentralButton(*m)) puts_xy(9,23,RED,"active");
- else puts_xy(9,23,RED," ");
- if (isRightButton(*m)) puts_xy(9,24,RED,"active");
- else puts_xy(9,24,RED," ");
- //mouse_on();
- }
-
-
- /*
- if (tindex>20&&first) {
- int i;
- cprintf("\nSTART\n");
- for (i=0;i<tindex;i++) {
- cprintf("%i\n",(int)tdata[i]);
- }
- for (i=1;i<tindex;i++) {
- cprintf("%i ",(int)(tdata[i]-tdata[i-1]));
- }
- first=0;
- }
- */
-
-}
-
-int main(int argc,char *argv[])
-{
- MOUSE_PARMS mouse=BASE_MOUSE;
- int ch,running,nm;
- int sens=5;
-
- /* screen */
- clear();
-
- nm=0;
- while (*vmouse[nm].name!='\0') {
- cprintf("%c %s:\t %s\n",(char)('a'+nm),vmouse[nm].name,vmouse[nm].desc);
- nm++;
- }
-
- cprintf("\n[a-%c]\t select a mouse server\n",(char)(nm+'a'-1));
- cprintf("[z]\t decrement mouse threshold\n");
- cprintf("[x]\t incremnet mouse threshold\n");
- cprintf("[1-4]\t COM port\n");
- cprintf("[ENTER]\t exit\n");
- place(0,20);
- cputs("mouse server:\n");
- cputs("threshold:\n");
- cputs("left :\n");
- cputs("central:\n");
- cputs("right :");
- CRSR_OFF();
-
- /* main loop */
- running=done=0;
-
- mouse_def_ms(mouse,0);
-
- while (!done) {
- ch=keyb_getch(TRUE);
- switch(ch) {
-
- /* exit demo */
-
- case ENTER:
- done = 1;
- break;
-
- /* decrement threshold */
-
- case 'z':
- sens--;
- if (sens<2) sens=2;
- mouse_threshold(sens);
- /* threshold */
- place(11,21);
- cprintf("%i ",sens);
- break;
-
- /* increment threshold */
-
- case 'x':
- sens++;
- if (sens>100) sens=100;
- mouse_threshold(sens);
- /* threshold */
- place(11,21);
- cprintf("%i ",sens);
- break;
-
- /* change mouse protocol */
-
- default:
- if (ch>='a'&&ch<='a'+nm-1) {
- /* don't use this method to change a mouse protocol */
- /* use mouse_def_???? macros instead */
- mouse.type=ch-'a';
- } else
- if (ch>='1'&&ch<='4') {
- /* don't use this method to change a mouse com port */
- /* use mouse_def_???? macros instead */
- mouse.port = ch-'1';
- }
- else
- break;
-
- /* check if a mouse server is running... */
- if (running) {
- /* disable autocursor */
- mouse_txtcursor(DISABLE);
- /* destroy actual mouse server */
- mouse_end();
- }
- /* mouse server name */
- puts_xy(14,20,GREEN," ");
- puts_xy(14,20,GREEN,vmouse[mouse.type].name);
- /* threshold */
- place(11,21);
- cprintf("%i ",sens);
- /* start a new server */
- running=(mouse_init(&mouse)==0?1:0);
- /* if running ...*/
- if (running) {
- /* set mouse limit */
- mouse_limit(0,0,cons_columns-1,cons_rows-1);
- /* enable autocursor */
- mouse_txtcursor(ENABLE|AUTOOFF);
- /* hook my function */
- mouse_hook(my_mouse_hook);
- /* show mouse cursor */
- mouse_on();
- }
- break;
-
- }
- }
-
- CRSR_STD();
- clear();
- sys_end();
- return 0;
-}
Index: rel_1_2/base/sched.c
===================================================================
--- rel_1_2/base/sched.c (revision 1198)
+++ rel_1_2/base/sched.c (nonexistent)
@@ -1,472 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Giorgio Buttazzo, Paolo Gai, Massimiliano Giorgi
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * CVS : $Id: sched.c,v 1.3 2003-05-01 19:44:07 pj Exp $
-
- This demo is derived from the cbsmouse.c Hartik's example.
-
- It only prints the task scheduling in graphic mode...
-
- There is a parameter to choose the type of scheduling module
- to initialize.
-
- to init correctly the module and task bandwidth parameters, set the defines
- NUM and DEN in initg.c and testg.c and remember the "s" (soft) parameter!!!
-
- to plot the deadlines assigned by CBS or TBS, compile cbs.c or tbs.c with
- the TESTG define
- (gray dots over the mouse line are the deadlines, green dots are CBS
- shifts)
-
- Note that a lot of times the demo exits with an exception; to avoid
- these exception you have to properly tune the task parameters.
-
- On a well configured machine, you will notice the little differences
- between different servers when moving the mouse ;-)
-
-*/
-
-#include <kernel/kern.h>
-#include <drivers/glib.h>
-#include <drivers/keyb.h>
-#include <drivers/mouse.h>
-#include <semaphore.h>
-
-/*--------------------------------------------------------------*/
-/* TEST ON EDF SCHEDULING */
-/*--------------------------------------------------------------*/
-
-#define LMOUSE 20
-#define LM 40 /* line of main */
-#define OFFSET 20 /* initial phase */
-#define CHAR_DIM 8 /* Height of chars in pixels */
-
-#define DX (640/5-1)
-
-int col[3] = {2, 4, 14}; /* colors of timelines */
-int lev[3] = {80, 120, 160}; /* level of timelines */
-int ptime[3] = {10, 20, 25}; /* number of cycles */
-int period[3] = {40, 50,100}; /* tasks' periods */
-int tick = 1; /* system tick */
-int tscale = 1; /* time scale */
-TIME starttime = 0; /* Simulation start time (scaled) */
-
-char *title; /* used in initg.c */
-
-/* period[] is scaled with a factor of PERIODSCALE usec */
-#define PERIODSCALE 5000
-
-// update also isched.c!!!
-#define NUM 2000
-#define DEN 64000
-
-sem_t mutex; /* Semaphore for graphix*/
-
-//#define IY(y) (480 - y)
-#define IY(y) y
-
-/*
- * mouse cursor
- *
- */
-
-#define W WHITE
-#define R RED
-#define G GREEN
-#define M MAGENTA
-
-/* shape */
-
-BYTE mycursor[16*16]= {
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,W,W,W,W,0,0,0,0,0,0,W,W,W,W,0,
- 0,W,M,0,0,0,0,0,0,0,0,0,0,M,W,0,
- 0,W,0,M,0,0,0,0,0,0,0,0,M,0,W,0,
- 0,W,0,0,M,0,0,0,0,0,0,M,0,0,W,0,
- 0,0,0,0,0,M,0,0,0,0,M,0,0,0,0,0,
- 0,0,0,0,0,0,G,G,G,G,0,0,0,0,0,0,
- 0,0,0,0,0,0,G,0,0,G,0,0,0,0,0,0,
- 0,0,0,0,0,0,G,0,0,G,0,0,0,0,0,0,
- 0,0,0,0,0,0,G,0,0,G,0,0,0,0,0,0,
- 0,0,0,0,0,0,G,G,G,G,0,0,0,0,0,0,
- 0,0,0,0,0,0,M,M,M,M,0,0,0,0,0,0,
- 0,0,0,0,0,0,M,M,M,M,0,0,0,0,0,0,
- 0,0,0,0,0,M,M,M,M,M,M,0,0,0,0,0,
- 0,0,0,0,M,M,M,M,M,M,M,M,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-};
-
-#define F 0xff
-#define B 0x00
-
-/* mask */
-BYTE mybkg[16*16]= {
- B,B,B,B,B,B,F,F,F,F,B,B,B,B,B,B,
- B,0,0,0,0,B,F,F,F,F,B,0,0,0,0,B,
- B,0,0,B,B,F,F,F,F,F,B,B,B,0,0,B,
- B,0,B,0,B,F,F,F,F,F,F,B,0,B,0,B,
- B,0,B,B,0,B,F,F,F,F,B,0,B,B,0,B,
- B,B,B,F,B,0,B,B,B,B,0,B,F,B,B,B,
- F,F,F,F,F,B,0,0,0,0,B,F,F,F,F,F,
- F,F,F,F,F,B,0,B,B,0,B,F,F,F,F,F,
- F,F,F,F,F,B,0,B,B,0,B,F,F,F,F,F,
- F,F,F,F,F,B,0,B,B,0,B,F,F,F,F,F,
- F,F,F,F,F,B,0,0,0,0,B,F,F,F,F,F,
- F,F,F,F,F,B,0,0,0,0,B,F,F,F,F,F,
- F,F,F,F,F,B,0,0,0,0,B,F,F,F,F,F,
- F,F,F,F,B,0,0,0,0,0,0,B,F,F,F,F,
- F,F,F,B,0,0,0,0,0,0,0,0,B,F,F,F,
- F,F,F,B,B,B,B,B,B,B,B,B,B,F,F,F,
-};
-
-#undef B
-#define B 0xff
-
-/* bad mask */
-BYTE mybadbkg[16*16]= {
- B,B,B,B,B,B,F,F,F,F,B,B,B,B,B,B,
- B,0,0,0,0,B,F,F,F,F,B,0,0,0,0,B,
- B,0,0,B,B,F,F,F,F,F,B,B,B,0,0,B,
- B,0,B,0,B,F,F,F,F,F,F,B,0,B,0,B,
- B,0,B,B,0,B,F,F,F,F,B,0,B,B,0,B,
- B,B,B,F,B,0,B,B,B,B,0,B,F,B,B,B,
- F,F,F,F,F,B,0,0,0,0,B,F,F,F,F,F,
- F,F,F,F,F,B,0,B,B,0,B,F,F,F,F,F,
- F,F,F,F,F,B,0,B,B,0,B,F,F,F,F,F,
- F,F,F,F,F,B,0,B,B,0,B,F,F,F,F,F,
- F,F,F,F,F,B,0,0,0,0,B,F,F,F,F,F,
- F,F,F,F,F,B,0,0,0,0,B,F,F,F,F,F,
- F,F,F,F,F,B,0,0,0,0,B,F,F,F,F,F,
- F,F,F,F,B,0,0,0,0,0,0,B,F,F,F,F,
- F,F,F,B,0,0,0,0,0,0,0,0,B,F,F,F,
- F,F,F,B,B,B,B,B,B,B,B,B,B,F,F,F,
-};
-
-/* very bad mask */
-BYTE myverybadbkg[16*16]= {
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
-};
-
-
-/*--------------------------------------------------------------*/
-/* Prints a grid to show task periods during execution */
-/*--------------------------------------------------------------*/
-
-void print_grid()
-{
- int i;
- int a1, a2, a3;
- int temp;
-
- a1 = 0;
- a2 = 0;
- a3 = 0;
- temp = 0;
-
- grx_text(title, 0, 240-10 ,10, 0);
-
- grx_line(OFFSET, lev[0], 639, lev[0], 5);
- grx_line(OFFSET, lev[1], 639, lev[1], 5);
- grx_line(OFFSET, lev[2], 639, lev[2], 5);
- grx_text("T1", 0, lev[0]-8, 9, 0);
- grx_text("T2", 0, lev[1]-8, 9, 0);
- grx_text("T3", 0, lev[2]-8, 9, 0);
- grx_text("MA", 0, LM, 8, 0);
- grx_text("MO", 0, LMOUSE, 8, 0);
-
- for (i = OFFSET; i < 640; i++) {
- if (temp >= a1) {
- grx_line(i, lev[0] - 1, i, lev[0] - 20, 3);
- a1 += period[0];
- }
- if (temp >= a2) {
- grx_line(i, lev[1] - 1, i, lev[1] - 20, 3);
- a2 += period[1];
- }
- if (temp >= a3) {
- grx_line(i, lev[2] - 1, i, lev[2] - 20, 3);
- a3 += period[2];
- }
- temp += tick/tscale;
- }
-}
-
-/*--------------------------------------------------------------*/
-/* This function is called at system termination */
-/*--------------------------------------------------------------*/
-
-void my_end()
-{
- grx_close();
-}
-
-/*--------------------------------------------------------------*/
-/* GENERIC PERIODIC PROCESS */
-/*--------------------------------------------------------------*/
-
-TASK color(int k)
-{
- int i;
- DWORD x = OFFSET;
- TIME t;
- while ( x < 640L) {
- for (i = 0; i < ptime[k]; i++) {
-
- t = sys_gettime(NULL) / PERIODSCALE;
- x = (t - starttime) + OFFSET;
- if (x>=640) break;
- sem_wait(&mutex);
- grx_plot(x, lev[k] - 4, col[k]);
- grx_plot(x, lev[k] - 5, col[k]);
- grx_plot(x, lev[k] - 6, col[k]);
- grx_plot(x, lev[k] - 7, col[k]);
- sem_post(&mutex);
- while (sys_gettime(NULL)/PERIODSCALE == t);
- }
- task_endcycle();
- }
- return 0;
-}
-
-void my_mouse_handler(MOUSE_EVT *ev)
-{
- int x;
-
- x = (sys_gettime(NULL)/PERIODSCALE - starttime) + OFFSET;
- if (x>=640) return;
- sem_wait(&mutex);
- grx_plot(x, LMOUSE, 8);
- sem_post(&mutex);
-}
-
-/*--------------------------------------------------------------*/
-/* MAIN PROCESS */
-/*--------------------------------------------------------------*/
-
-int main(int argc, char *argv[])
-{
- int x = OFFSET;
-
- MOUSE_PARMS mouse = BASE_MOUSE;
- HARD_TASK_MODEL mouse_hard;
- SOFT_TASK_MODEL mouse_soft;
- NRT_TASK_MODEL mouse_nrt;
-
- char c;
- KEY_EVT emerg;
-
- HARD_TASK_MODEL m_per;
- int modenum;
-
- if (argc>=3)
- switch(*argv[2]) {
- case 'h':
- /* this is not correct, because it don't remember activations */
- hard_task_default_model(mouse_hard);
- hard_task_def_mit(mouse_hard,DEN);
- hard_task_def_wcet(mouse_hard,NUM);
- hard_task_def_system(mouse_hard);
- hard_task_def_nokill(mouse_hard);
- hard_task_def_aperiodic(mouse_hard);
- mouse_def_task(mouse,(TASK_MODEL *)&mouse_hard);
- break;
- case 's':
- soft_task_default_model(mouse_soft);
- soft_task_def_wcet(mouse_soft,NUM);
- soft_task_def_met(mouse_soft,NUM);
- soft_task_def_period(mouse_soft,DEN);
- soft_task_def_system(mouse_soft);
- soft_task_def_nokill(mouse_soft);
- soft_task_def_aperiodic(mouse_soft);
- mouse_def_task(mouse,(TASK_MODEL *)&mouse_soft);
- break;
- case 'n':
- /* this is not correct, because it don't remember activations */
- nrt_task_default_model(mouse_nrt);
- nrt_task_def_system(mouse_nrt);
- nrt_task_def_nokill(mouse_nrt);
- mouse_def_task(mouse,(TASK_MODEL *)&mouse_nrt);
- break;
- default:
- argc=0;
- break;
- }
-
- /* Serial mous on COM3 */
- mouse_def_ms(mouse,2);
-
- if (argc>=4) {
- period[0]=atoi(argv[3]);
- if (period[0]<ptime[0]) period[0]=ptime[0]+5;
- }
- if (argc>=5) {
- period[1]=atoi(argv[4]);
- if (period[1]<ptime[1]) period[1]=ptime[1]+5;
- }
- if (argc>=6) {
- period[2]=atoi(argv[5]);
- if (period[2]<ptime[2]) period[2]=ptime[2]+5;
- }
-
- if (argc<2) {
- cprintf("syntax: x testg <config> <mouse-task> [t1] [t2] [t3]\n");
- cprintf("where <config> can be:\n");
- cprintf("\t0 - EDF + CBS + RR\n");
- cprintf("\t1 - RM + PS ( bkg, U=1/16) + RR, no check Ulub < 0.69\n");
- cprintf("\t2 - RM + PS (nobkg, U=1/16) + RR, no check Ulub < 0.69\n");
- cprintf("\t3 - EDF + PS ( bkg, U=1/16) + RR\n");
- cprintf("\t4 - EDF + PS (nobkg, U=1/16) + RR\n");
- cprintf("\t5 - EDF + TBS( U=1/16) + RR\n");
- cprintf("\t6 - RM + DS ( bkg, U=1/16) + RR, no check Ulub < 0.69\n");
- cprintf("\t7 - RM + DS (nobkg, U=1/16) + RR, no check Ulub < 0.69\n");
- cprintf("\nwhere <mouse-task> can be:\n");
- cprintf("\th - Hard\n");
- cprintf("\ts - Soft (understimated wcet)\n");
- cprintf("\tn - NRT\n");
- sys_end();
- return -1;
- }
-
- if (grx_init() == -1) {
- sys_shutdown_message("Error initing GraphLib!!!\n");
- sys_end();
- }
- modenum = grx_getmode(640, 480, 8);
- cprintf("Modenum :%d\n", modenum);
-
- if (grx_setmode(modenum) == -1) {
- sys_shutdown_message("No SetMode!!!\n");
- sys_end();
- }
-
- /* this trick can be useful when debugging ... */
- //grx_close();
-
-
-
- print_grid();
- grx_box(DX*0,240,DX*1-1,479,GREEN);
- grx_box(DX*1,240,DX*2-1,479,WHITE);
- grx_box(DX*2,240,DX*3-1,479,RED);
- grx_box(DX*3,240,DX*4-1,479,MAGENTA);
- grx_box(DX*4,240,DX*5-1,479,BLACK);
-
-
- sys_atrunlevel(my_end, NULL, RUNLEVEL_BEFORE_EXIT);
-
- /* mutex */
- sem_init(&mutex,0,1);
-
- /* keyboard */
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTL_BIT;
- keyb_hook(emerg,(void (*)(KEY_EVT *))sys_end);
- keyb_getchar();
-
- /* mouse */
- mouse_init(&mouse);
- mouse_limit(XMINLIMIT(640,480),
- 240,
- XMAXLIMIT(640,480),
- YMAXLIMIT(640,480));
- mouse_position(320,280);
- mouse_threshold(2);
- //grx_setcolor(255,255,255,255);
- mouse_grxshape(mycursor,mybkg);
- mouse_grxcursor(ENABLE);
- mouse_on();
- mouse_hook(my_mouse_handler);
-
- /* hard task creation */
-
- hard_task_default_model(m_per);
- hard_task_def_mit(m_per,period[0]*PERIODSCALE);
- hard_task_def_wcet(m_per,ptime[0]*PERIODSCALE);
- hard_task_def_group(m_per, 1);
- //task_def_wcet(m, ptime[0] * sys_tick);
- if (task_create("verde", color, &m_per, NULL) == -1) {
- sys_shutdown_message("Edf.C(main) Could not create <green>:");
- sys_end();
- }
- hard_task_def_arg(m_per, (void *)1);
- hard_task_def_wcet(m_per, ptime[1]*PERIODSCALE);
- hard_task_def_mit(m_per,period[1]*PERIODSCALE);
- if (task_create("red", color, &m_per, NULL) == -1) {
- sys_shutdown_message("Edf.C(main) Could not create <red>:");
- sys_end();
- }
- hard_task_def_arg(m_per, (void *)2);
- hard_task_def_wcet(m_per, ptime[2]*PERIODSCALE);
- hard_task_def_mit(m_per,period[2]*PERIODSCALE);
- if (task_create("yellow", color, &m_per, NULL) == -1) {
- sys_shutdown_message("Edf.C(main) Could not create <yellow>:");
- sys_end();
- }
- starttime = sys_gettime(NULL) / PERIODSCALE;
- group_activate(1);
-
- /* main loop */
- while (x < 640L) {
- x = (sys_gettime(NULL)/PERIODSCALE - starttime) + OFFSET;
- if (x>=640) break;
- sem_wait(&mutex);
- grx_plot(x, LM, 7);
- sem_post(&mutex);
- }
-
- c = keyb_getchar();
-
- sys_end();
- return 0;
-}
-
-/*--------------------------------------------------------------*/
Index: rel_1_2/base/fly.c
===================================================================
--- rel_1_2/base/fly.c (revision 1198)
+++ rel_1_2/base/fly.c (nonexistent)
@@ -1,216 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (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: fly.c,v 1.3 2003-01-07 17:10:15 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.3 $
- Last update: $Date: 2003-01-07 17:10:15 $
- ------------
-**/
-
-/*
- * 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
- *
- */
-
-/*--------------------------------------------------------------*/
-/* SIMULATION OF RANDOM FLIES */
-/*--------------------------------------------------------------*/
-
-#include <kernel/kern.h>
-#include <drivers/glib.h>
-#include <drivers/keyb.h>
-#include <semaphore.h>
-#include <stdlib.h>
-#include <math.h>
-
-#define YMENU 10 /* menu level */
-#define XMIN 50
-#define XMAX 600
-#define YMIN 100
-#define YMAX 450
-#define VEL 5 /* linear velocity (def. = 5) */
-#define ANG 30 /* angolo massimo sterzata (30) */
-#define D 3 /* raggio mosca */
-#define ESC 27 /* ASCII code of ESCAPE key */
-#define MAX_P 35 /* max number of flies */
-#define FLYGROUP 1
-
-double tick = 1.0; /* system tick = 1 ms */
-int fly_period = 40000; /* task period */
-int fly_wcet = 1000; /* task wcet */
-PID pid;
-sem_t mutex;
-
-/*--------------------------------------------------------------*/
-
-void draw_fly(int x, int y, int c)
-{
- sem_wait(&mutex);
- grx_disc(x, y, D, c);
- sem_post(&mutex);
-}
-
-/******************************************************************/
-
-TASK fly(void *arg)
-{
-int x, y;
-int ox, oy;
-int dx, dy, da;
-int teta, col;
-int outx, outy;
-double r;
-int i = (int)arg;
-
- x = ox = (XMIN+XMAX)/2;
- y = oy = (YMIN+YMAX)/2;
- teta = 0;
- col = 2 + i; /* colore fly */
-
- while (1) {
-
- da = rand()%(2*ANG) - ANG; /* da = [-ANG,ANG] */
- teta += da;
-
- if (teta > 360) teta -= 360;
- if (teta < 0) teta += 360;
- r = (double)teta * PI / 180.;
-
- dx = (float)(VEL * cos(r));
- dy = (float)(VEL * sin(r));
- x += dx;
- y += dy;
-
- outx = (x >= XMAX) || (x <= XMIN);
- outy = (y >= YMAX) || (y <= YMIN);
-
- if (outx || outy) {
- x = x - dx;
- y = y - dy;
- if (outx) teta = 180 - teta;
- if (outy) teta = -teta;
- if (teta > 360) teta -= 360;
- if (teta < 0) teta += 360;
- r = (double)teta * PI / 180.;
-
- dx = (float)(VEL * cos(r));
- dy = (float)(VEL * sin(r));
-
- x += dx;
- y += dy;
- }
-
- draw_fly(ox, oy, 0);
- draw_fly(x, y, col);
- ox = x; oy = y;
-
- task_endcycle();
- }
-}
-
-/****************************************************************/
-
-/* This function is called when the system exits */
-void byebye(void *arg)
-{
- grx_close();
- cprintf("Bye Bye!\n");
-}
-
-/****************************** MAIN ******************************/
-
-int main(int argc, char **argv)
-{
- HARD_TASK_MODEL m;
-
- char c; /* character from keyboard */
- int i = 0; /* number of tasks created */
- TIME seme; /* used to init the random seed */
-
- /* Set the closing function */
- sys_atrunlevel(byebye, NULL, RUNLEVEL_BEFORE_EXIT);
-
- /* graphic card Initialization */
- if (grx_init() < 1) {
- sys_abort(1);
- }
-
- if (grx_open(640, 480, 8) < 0) {
- cprintf("GRX Err\n");
- sys_abort(1);
- }
-
- /* The scenario */
- grx_rect(XMIN-D-1, YMIN-D-1, XMAX+D+1, YMAX+D+1, 14);
- grx_text("Simulation of Random Flies", XMIN, YMENU+10, 13, 0);
- grx_text("SPACE create a fly" , XMIN, YMENU+20, 12, 0);
- grx_text("ESC exit to DOS" , XMIN, YMENU+30, 12, 0);
-
- /* The program waits a space to create a fly */
- c = keyb_getch(BLOCK);
-
- /* randomize!!!! */
- seme = sys_gettime(NULL);
- srand(seme);
-
- do {
- if ((c == ' ') && (i < MAX_P)) {
- hard_task_default_model(m);
- hard_task_def_ctrl_jet (m);
- hard_task_def_arg (m, (void *)i);
- hard_task_def_wcet (m, fly_wcet);
- hard_task_def_mit (m, fly_period);
- hard_task_def_group (m, FLYGROUP);
- hard_task_def_usemath (m);
- pid = task_create("fly", fly, &m, NULL);
- if (pid == NIL) {
- grx_close();
- perror("Could not create task <fly>");
- sys_abort(1);
- }
- task_activate(pid);
- i++;
- }
- c = keyb_getch(BLOCK);
-
- } while (c != ESC);
-
- sys_end();
-
- return 0;
-}
-
-/*--------------------------------------------------------------*/
Index: rel_1_2/base/talk.c
===================================================================
--- rel_1_2/base/talk.c (revision 1198)
+++ rel_1_2/base/talk.c (nonexistent)
@@ -1,209 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Luca Abeni, Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * CVS : $Id: aster1.c,v 1.1 2002/10/28 08:13:37 pj Exp
-
- This is the talkdx.c Hartik's example.
-
- File: Talk.C
- Revision: 1.00
- Author: Luca Abeni
-
-
- Simple Netlib demo: nothing of seriously real-time, only another Unix
- Talk clone.
- Read it to see how the UDP/IP layers of the networ library work.
-
-*/
-
-#include <kernel/kern.h>
-#include <string.h>
-
-#include <drivers/crtwin.h>
-#include <drivers/keyb.h>
-
-#include <drivers/udpip.h>
-
-
-WIN dbg;
-BYTE esc = FALSE;
-
-char talk_myipaddr[20];
-char talk_toipaddr[20];
-
-/*
- This non real-time task reads UDP packets from the network and writes
- them in a window
-*/
-TASK scrittore(void)
-{
- char str[2000];
- UDP_ADDR from, local;
- WIN displ;
- int s,n;
-
- /* Connect on the local port #100 */
- local.s_port = 100;
- s = udp_bind(&local, NULL);
-
- /* Open the window */
- win_init(&displ,0,0,79,6);
- win_frame(&displ,BLACK,WHITE,"Remote",2);
-
- while (1) {
- /* Clear the buffer for receiving the packet...*/
- memset(str, 0, 1999);
- /*...and receive the packet (block until a packet arrives */
- n = udp_recvfrom(s, str, &from);
- win_puts(&displ, str);
- }
-}
-
-/*
- This non real-time task reads strings from the keyoard and sends them
- to the remote host
-*/
-TASK write(void)
-{
- WIN wr;
- UDP_ADDR to,local;
- char str[80];
- int s;
- IP_ADDR bindlist[5];
-
- /* Create a socket for transitting */
- ip_str2addr(talk_myipaddr,&(local.s_addr));
- local.s_port = 101;
-
- /*
- If we want the address of the remote host in the ARP table before
- begginning the transmission (to eliminate a possible source of
- unpredictability), we can use the bindlist, otherwise we set the
- second parameter of udp_bind to NULL
- */
- ip_str2addr(talk_toipaddr,&(bindlist[0]));
- memset(&(bindlist[1]), 0, sizeof(IP_ADDR));
- s = udp_bind(&local, /*bindlist*/NULL);
-
- win_init(&wr,0,7,79,6);
- win_frame(&wr,BLACK,WHITE,"Local",2);
- ip_str2addr(talk_toipaddr,&(to.s_addr));
- to.s_port = 100;
- sprintf(str,"Local IP address %d.%d.%d.%d\n", local.s_addr.ad[0],
- local.s_addr.ad[1], local.s_addr.ad[2],
- local.s_addr.ad[3]);
- win_puts(&dbg,str);
- sprintf(str,"Talk to %d.%d.%d.%d ",to.s_addr.ad[0],to.s_addr.ad[1],
- to.s_addr.ad[2],to.s_addr.ad[3]);
- win_puts(&dbg,str);
- while (1) {
- /* Get the string...*/
- win_gets(&wr,str,78);
- strcat(str,"\n");
- /*...and send it!!! */
- udp_sendto(s,str,strlen(str)+2,&to);
- }
-}
-
-/* This function is called when the user presses CTRL-C (stops the systems) */
-void esci(KEY_EVT *k)
-{
- esc = TRUE;
- cprintf("Ctrl-Brk pressed!\n");
- sys_end();
-}
-
-int main(int argc, char **argv)
-{
- KEY_EVT k;
-
- struct net_model m = net_base;
-
- NRT_TASK_MODEL m_nrt;
-
- k.flag = CNTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- keyb_hook(k,esci);
- k.flag = CNTR_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- keyb_hook(k,esci);
-
- clear();
- cprintf(" Hartik Talk! Ver. 1.00\n");
-
- if (argc != 3) {
- cprintf("Hartik Talk usage: talk fromIP toIP\n");
- return 0;
- }
-
- strcpy(talk_myipaddr, argv[1]);
- strcpy(talk_toipaddr, argv[2]);
-
- /* We want a task for TX mutual exclusion */
- net_setmode(m, TXTASK);
- /* We use UDP/IP stack */
- net_setudpip(m, talk_myipaddr, "255.255.255.255");
- /* OK: let's start the NetLib! */
- if (net_init(&m) == 1) {
- cprintf("Net Init OK...\n");
- } else {
- cprintf("Net Init Failed...\n");
- sys_abort(300);
- }
-
-
- //dump_irq();
-
- cprintf("\n\n\n\tPress ENTER\n");
- while (!esc) {
- keyb_getcode(&k,BLOCK);
- if (k.ascii == 13) esc = TRUE;
- }
-
- esc = FALSE;
- clear();
- win_init(&dbg,0,20,60,3);
- win_frame(&dbg,BLACK,WHITE,"Debug",2);
-
- /* Start the sender and receiver tasks...*/
- nrt_task_default_model(m_nrt);
- task_activate(task_create("aaa",scrittore,&m_nrt,NULL));
- task_activate(task_create("bbb",write,&m_nrt,NULL));
-
- return 0;
-}
Index: rel_1_2/base/makefile
===================================================================
--- rel_1_2/base/makefile (revision 1198)
+++ rel_1_2/base/makefile (nonexistent)
@@ -1,111 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = hello sig time preempt
-PROGS += aster aster1 aster2 aster3 aster4 aster5 aster6 aster7 aster8
-PROGS += pcidemo talk mousfind keycode memtest
-PROGS += jointest condtest intsem semdemo pidemo pcdemo srpdemo mdemo
-PROGS += ego fly cabs sched
-
-include $(BASE)/config/example.mk
-
-
-# Text applications
-hello:
- make -f $(SUBMAKE) APP=hello INIT= OTHEROBJS="ihello.o" OTHERINCL=
-
-time:
- make -f $(SUBMAKE) APP=time INIT= OTHEROBJS="ihello.o" OTHERINCL=
-
-sig:
- make -f $(SUBMAKE) APP=sig INIT= OTHEROBJS="ihello.o" OTHERINCL=
-
-preempt:
- make -f $(SUBMAKE) APP=preempt INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-semdemo:
- make -f $(SUBMAKE) APP=semdemo INIT= OTHEROBJS="isemdemo.o" OTHERINCL=
-
-pidemo:
- make -f $(SUBMAKE) APP=pidemo INIT= OTHEROBJS="imdemo.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-pcdemo:
- make -f $(SUBMAKE) APP=pcdemo INIT= OTHEROBJS="imdemo.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-srpdemo:
- make -f $(SUBMAKE) APP=srpdemo INIT= OTHEROBJS="imdemo.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-mdemo:
- make -f $(SUBMAKE) APP=mdemo INIT= OTHEROBJS="imdemo.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-aster:
- make -f $(SUBMAKE) APP=aster INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-aster1:
- make -f $(SUBMAKE) APP=aster1 INIT= OTHEROBJS="iaster1.o" OTHERINCL=
-
-aster2:
- make -f $(SUBMAKE) APP=aster2 INIT= OTHEROBJS="iaster1.o" OTHERINCL=
-
-aster3:
- make -f $(SUBMAKE) APP=aster3 INIT= OTHEROBJS="iaster3.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-aster4:
- make -f $(SUBMAKE) APP=aster4 INIT= OTHEROBJS="iaster4.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-aster5:
- make -f $(SUBMAKE) APP=aster5 INIT= OTHEROBJS="imdemo.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-aster6:
- make -f $(SUBMAKE) APP=aster6 INIT= OTHEROBJS="iaster6.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-aster7:
- make -f $(SUBMAKE) APP=aster7 INIT= OTHEROBJS="iaster7.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-aster8:
- make -f $(SUBMAKE) APP=aster8 INIT= OTHEROBJS="iaster8.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-pcidemo:
- make -f $(SUBMAKE) APP=pcidemo INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-talk:
- make -f $(SUBMAKE) APP=talk INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-mousfind:
- make -f $(SUBMAKE) APP=mousfind INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-jointest:
- make -f $(SUBMAKE) APP=jointest INIT= OTHEROBJS="imdemo.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-condtest:
- make -f $(SUBMAKE) APP=condtest INIT= OTHEROBJS="imdemo.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-intsem:
- make -f $(SUBMAKE) APP=intsem INIT= OTHEROBJS="imdemo.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-keycode:
- make -f $(SUBMAKE) APP=keycode INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-memtest:
- make -f $(SUBMAKE) APP=memtest INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT=__OLDCHAR__
-
-# Graphical applications
-
-ego:
- make -f $(SUBMAKE) APP=ego INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
-
-fly:
- make -f $(SUBMAKE) APP=fly INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
-
-cabs:
- make -f $(SUBMAKE) APP=cabs INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
-
-sched:
- make -f $(SUBMAKE) APP=sched INIT= OTHEROBJS="isched.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __GRX__"
-
Index: rel_1_2/base/cabs.dat
===================================================================
--- rel_1_2/base/cabs.dat (revision 1198)
+++ rel_1_2/base/cabs.dat (nonexistent)
@@ -1,11 +0,0 @@
-----------------------------------------------------
-system tick (ms): 1
-----------------------------------------------------
-
-task periods (ticks)
-----------------------------------------------------
-producer 1: 200 consumer 1: 400
-producer 2: 100 consumer 2: 400
-producer 3: 300 consumer 3: 150
-producer 4: 800 consumer 4: 200
-----------------------------------------------------
Index: rel_1_2/base/aster1.c
===================================================================
--- rel_1_2/base/aster1.c (revision 1198)
+++ rel_1_2/base/aster1.c (nonexistent)
@@ -1,174 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 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
- *
- *
- * CVS : $Id: aster1.c,v 1.2 2003-01-07 17:10:15 pj Exp $
-
- this is a reduced verion of the classic Hartik demo Aster.
-
- It uses:
- - EDF module
- . periodic tasks
- - an high number of task executing concurrently
-
- The demo ends after 6 seconds.
-
-*/
-
-/*
- Well, this is only a stupid demo which intend to show many
- HARTIK+ capabilities; the application is structured in the followig
- way: there is an ASTER task wich randomly creates some ASTEROID tasks
- which are displayed into the first window; each task is HARD/PERIODIC
- and auto-kills itself when it reaches the window end!
- Finally a CLOCK task is implemented to test system clock.
- Please note that usually the HARTIK+ application is made up of a task
- group which interacts among them, while the main() function, which
- became a task itself when the kernel is activated, is suspended until
- the system is ready to terminate; the MAIN task can also be used to make
- other background activities, but it should not be killed; when the
- application terminates, the control is passed to MAIN which kills
- everybody, shut down the system and can handle other operations using
- the services available with the previou operating system (I.E. the DOS).
- If you need to manage sudden abort/exception you should install your own
- exception handler and raise it through the exc_raise() primitive to
- make the system abort safely!
- Remember that the exit functions posted through sys_atexit() will be
- executed in both cases, to allow clean system shutdown.
-*/
-
-#include "kernel/kern.h"
-
-int num_aster = 0;
-#define ASTER_LIM 67
-#define ASTER_MAX 90
-
-TASK asteroide(void)
-{
- int i = 1;
- int y = rand() % 20 + 1;
- while (i < ASTER_LIM) {
- puts_xy(i,y,WHITE,"*");
- task_endcycle();
-
- puts_xy(i,y,WHITE," ");
- i++;
- }
- num_aster--;
- return 0;
-}
-
-DWORD taskCreated = 0;
-
-TASK aster(void)
-{
- PID p;
-
- HARD_TASK_MODEL m;
- int r;
-
- hard_task_default_model(m);
- hard_task_def_wcet(m,500);
-
- srand(7);
- while (1) {
- if (num_aster < ASTER_MAX) {
- r = (rand() % 50) - 25;
-
- hard_task_def_arg(m,(void *)((rand() % 7)+1));
- hard_task_def_mit(m, (50+r)*1000);
- p = task_create("aaa",asteroide,&m,NULL);
- taskCreated++;
- task_activate(p);
- num_aster++;
- }
-
- task_endcycle();
- }
-}
-
-TASK clock()
-{
- int s = 0, m = 0;
-
- while(1) {
- printf_xy(70,1,WHITE,"%2d : %2d",m,s);
- task_endcycle();
-
- if (++s > 59) {
- s = 0;
- m++;
- }
- printf_xy(70,1,WHITE,"%2d : %2d",m,s);
- task_endcycle();
- }
-}
-
-int main(int argc, char **argv)
-{
- PID p1,p2;
- HARD_TASK_MODEL m;
- struct timespec t;
-
- clear();
-
- hard_task_default_model(m);
- hard_task_def_mit(m,10000);
- hard_task_def_wcet(m,2000);
- hard_task_def_group(m,1);
-
- p1 = task_create("Aster",aster,&m,NULL);
- if (p1 == -1) {
- perror("Aster.C(main): Could not create task <aster> ...");
- sys_end();
- }
-
- hard_task_def_mit(m,500000);
- p2 = task_create("Clock",clock,&m,NULL);
- if (p2 == -1) {
- perror("Aster.C(main): Could not create task <Clock> ...");
- sys_end();
- }
-
- group_activate(1);
-
- do {
- sys_gettime(&t);
- } while (t.tv_sec < 6);
-
- sys_end();
- return 0;
-}
-
Index: rel_1_2/base/jointest.c
===================================================================
--- rel_1_2/base/jointest.c (revision 1198)
+++ rel_1_2/base/jointest.c (nonexistent)
@@ -1,220 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Giorgio Buttazzo, Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * CVS : $Id: jointest.c,v 1.1 2002-11-11 08:22:45 pj Exp $
-
- This test verify the correctness of the task_join primitive. (that
- function is the same as pthread_join... someday I will change the
- names...)
-
- There are 4 taks, J1, J2, J3, are created as joinable, J4 as detached
-
- The main task:
- Creates J1 and J2, locks m1 (a PI mitex), creates C3.
- at t=0.8 sec it calls a task_join on J3 (that returns EDEADLK),
- it unlocks m1, then it makes task_join on J3 another time.
- Next it creates J4 as detached and finally it does a task_join on J4
- (that returns EINVAL).
-
- J1:
- at t=0.2 sec it calls task_join on J2, the it ends.
-
- J2:
- it simply waits t=0.4 sec and it ends.
-
- J3:
- First, it calls task_join on J1.
- Then, at t=0.6 sec it locks m1, then unlocks it
-
- J4:
- it simply waits t=1 sec and it ends.
-
-*/
-
-#include "kernel/kern.h"
-#include "drivers/keyb.h"
-
-
-PID j0, j1, j2, j3, j4;
-mutex_t m1;
-
-void fine(KEY_EVT *e)
-{
- sys_end();
-}
-
-TASK J1()
-{
- int err;
- void *ret;
-
- cprintf("J1: started, waiting 0.2 sec\n");
-
- while (sys_gettime(NULL) < 200000);
-
- cprintf("J1: 0.2 sec reached, joining J2\n");
-
- err = task_join(j2, &ret);
-
- cprintf("J1: join J2 returns %d error %d, exiting\n",
- (int)ret,err);
- return (void *)11;
-}
-
-TASK J2()
-{
- cprintf("J2: started, waiting 0.4 sec\n");
-
- while (sys_gettime(NULL) < 400000);
-
- cprintf("J2: 0.4 sec reached, exiting\n");
-
- return (void *)22;
-}
-
-TASK J3()
-{
- int err;
- void *ret;
-
- cprintf("J3: started, joining J1\n");
-
- err = task_join(j1, &ret);
-
- cprintf("J3: join J1 returns %d error %d, waiting 0.6sec\n", (int)ret, err);
-
- while (sys_gettime(NULL) < 600000);
-
- cprintf("J1: 0.6 sec reached, locking m1\n");
-
- mutex_lock(&m1);
-
- cprintf("J3: locked m1, unlocking m1\n");
-
- mutex_unlock(&m1);
-
- cprintf("J3: unlocked m1, exiting\n");
-
- return (void *)33;
-}
-
-TASK J4()
-{
- cprintf("J4: started, waiting 1 sec\n");
-
- while (sys_gettime(NULL) < 1000000);
-
- cprintf("J4: 1 sec reached, exiting\n");
-
- return (void *)44;
-}
-
-int main(int argc, char **argv)
-{
- NRT_TASK_MODEL m;
-
- PI_mutexattr_t a;
-
- KEY_EVT emerg;
-
- int err;
- void *ret;
-
- //keyb_set_map(itaMap);
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTL_BIT;
- keyb_hook(emerg,fine);
-
- j0 = exec_shadow;
- nrt_task_default_model(m);
- nrt_task_def_joinable(m);
-
- /* ---------------------------------------------------------------------
- Mutex creation
- --------------------------------------------------------------------- */
-
- PI_mutexattr_default(a);
- mutex_init(&m1,&a);
-
-
- /* ---------------------------------------------------------------------
- Let's go !!!!
- --------------------------------------------------------------------- */
-
- cprintf("main: creating J1,J2,J3, locking m1\n");
-
- j1 = task_create("J1", J1, &m, NULL);
- if (j1 == NIL) { cprintf("Can't create J1 task...\n"); return 1; }
- task_activate(j1);
-
- j2 = task_create("J2", J2, &m, NULL);
- if (j2 == NIL) { cprintf("Can't create J2 task...\n"); return 1; }
- task_activate(j2);
-
- mutex_lock(&m1);
-
- j3 = task_create("J3", J3, &m, NULL);
- if (j3 == NIL) { cprintf("Can't create J3 task...\n"); return 1; }
- task_activate(j3);
-
- cprintf("main: waiting t=0.8 sec\n");
-
- while (sys_gettime(NULL) < 800000);
-
- err = task_join(j3, NULL);
-
- cprintf("main: join J3 error %d, unlocking m1\n",err);
-
- mutex_unlock(&m1);
-
- err = task_join(j3, &ret);
-
- cprintf("main: join J3 returns %d error %d, unlocked m1, creating J4\n",
- (int)ret,err);
-
- nrt_task_def_unjoinable(m);
- j4 = task_create("J4", J4, &m, NULL);
- if (j4 == NIL) { cprintf("Can't create J4 task...\n"); return 1; }
-
- task_activate(j4);
-
- err = task_join(j4,&ret);
-
- cprintf("main: join J4 returns %d error %d, exiting\n", (int)ret, err);
-
- return 0;
-}
Index: rel_1_2/base/aster2.c
===================================================================
--- rel_1_2/base/aster2.c (revision 1198)
+++ rel_1_2/base/aster2.c (nonexistent)
@@ -1,241 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 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
- *
- *
- * CVS : $Id: aster2.c,v 1.2 2002-11-11 08:20:44 pj Exp $
-
- this is a part of the classic Hartik demo Aster.
-
- It checks:
- - jet functions
- - The EDF level with many task, with almost full bandwidth used
-
-*/
-
-
-#include "kernel/kern.h"
-#include "modules//edf.h"
-
-int num_aster = 0;
-#define ASTER_LIM 60
-#define DISPLAY_MAX 15
-#define ASTER_MAX 70
-#define STAT_Y 9
-
-// first numbers for wcet and periods are for a 486/25, the others for a
-// celeron 366
-
-#define PER_WCET 13000 /*6200*/
-#define CLOCK_WCET 1200 /* 100*/
-#define ASTER_WCET 1200 /* 100*/
-
-#define ASTER_MEAN_PERIOD 64 /*64*/
-
-#define END_TEST_TIME 60
-
-TASK asteroide(void)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
-
- char s[2];
-
- s[0] = '*'; s[1] = 0;
-
- /*for (;;)*/ {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = 1000; //10000; // 5000 + rand()%5000;
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
- puts_xy(i,y,rand()%15+1,s);
- }
-
- task_endcycle();
-
- puts_xy(i,y,WHITE," ");
- i++;
- }
- }
- num_aster--;
- return 0;
-}
-
-TASK aster()
-{
- PID p;
-
- HARD_TASK_MODEL m;
- int r;
- int x; // adaptive bandwidth...
-
- hard_task_default_model(m);
- hard_task_def_wcet(m,PER_WCET);
- hard_task_def_ctrl_jet(m);
-
- x = ASTER_MEAN_PERIOD;
-
- srand(7);
- while (1) {
- if (num_aster < ASTER_MAX) {
- r = (rand() % 200);
-
- hard_task_def_arg(m,(void *)((rand() % 7)+1));
- hard_task_def_mit(m, (x+r)*1000);
- p = task_create("aaa",asteroide,&m,NULL);
- if (p == -1)
- {
- if (x < 500 && errno != ENO_AVAIL_TASK) x += 1;
- printf_xy(62,3,WHITE,"adapt=%3u err=%d",
- iq_query_first(&freedesc),errno);
- }
- else {
- num_aster++;
- printf_xy(62,3,WHITE,"adapt=%3u ",x);//,errno);
- task_activate(p);
- x /= 2;
- if (x<50) x = 50;
- }
- }
- task_endcycle();
- }
-}
-
-TASK clock()
-{
- int s = 0, m = 0;
-
- while(1) {
- printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
- printf_xy(62,2,WHITE,"U=%12u",EDF_usedbandwidth(0));
- task_endcycle();
-
- if (++s > 59) {
- s = 0;
- m++;
- }
- printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
- printf_xy(62,2,WHITE,"U=%12u",EDF_usedbandwidth(0));
- task_endcycle();
- }
-}
-
-
-
-/* we consider the first ASTER_MAX + 2 tasks from the PID 2
- and plot on the screen the elapsed times... */
-TASK jetcontrol()
-{
- int i; /* a counter */
- TIME sum, max, curr, last[5];
- int nact;
- int j; /* the elements set by jet_gettable */
- PID p;
-
-
- kern_cli();
- printf_xy(0,STAT_Y,WHITE,"PID ³ Mean T.³ Max T. ³ N.A. ³ Curr. ³ Last1 ³ Last2 ³ Last3 ³ Last4 ³ Last5");
- kern_sti();
-
- for (;;) {
- for (i=0,p=0; i<DISPLAY_MAX+5 && p<MAX_PROC; p++) {
- if (jet_getstat(p, &sum, &max, &nact, &curr) == -1) continue;
-
- for (j=0; j<5; j++) last[j] = 0;
- jet_gettable(p, &last[0], 5);
- kern_cli();
- printf_xy(0,STAT_Y+i+1,WHITE,"%-3d ³ %-6d ³ %-6d ³ %-4d ³ %-7d ³ %-5d ³ %-5d ³ %-5d ³ %-5d ³ %-5d",
- p, (int)sum/(nact==0 ? 1 : nact), (int)max, nact, (int)curr, (int)last[0], (int)last[1], (int)last[2], (int)last[3], (int)last[4]);
- kern_sti();
- i++;
- }
- }
-}
-
-int main(int argc, char **argv)
-{
- PID p1,p2,p3; //,p4,p5,p6;
- HARD_TASK_MODEL m;
- NRT_TASK_MODEL m_nrt;
- struct timespec t;
-
- clear();
-
- hard_task_default_model(m);
- hard_task_def_wcet(m,ASTER_WCET);
- hard_task_def_mit(m,10000);
- hard_task_def_group(m,1);
- hard_task_def_ctrl_jet(m);
-
- nrt_task_default_model(m_nrt);
- nrt_task_def_group(m_nrt,1);
- nrt_task_def_ctrl_jet(m_nrt);
-
- p1 = task_create("Aster",aster,&m,NULL);
- if (p1 == -1) {
- perror("test7.c(main): Could not create task <aster> ...");
- sys_end();
- }
-
- hard_task_def_mit(m,500000);
- hard_task_def_wcet(m,CLOCK_WCET);
- p2 = task_create("Clock",clock,&m,NULL);
- if (p2 == -1) {
- perror("test7.c(main): Could not create task <Clock> ...");
- sys_end();
- }
-
- p3 = task_create("JetControl",jetcontrol,&m_nrt,NULL);
- if (p2 == -1) {
- perror("test7.c(main): Could not create task <JetControl> ...");
- sys_end();
- }
-
- group_activate(1);
-
- do {
- sys_gettime(&t);
- } while (t.tv_sec < END_TEST_TIME);
-
- sys_end();
-
- return 0;
-}
-
-
-
-
Index: rel_1_2/base/aster3.c
===================================================================
--- rel_1_2/base/aster3.c (revision 1198)
+++ rel_1_2/base/aster3.c (nonexistent)
@@ -1,300 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 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
- *
- *
- * CVS : $Id: aster3.c,v 1.3 2003-01-07 17:10:15 pj Exp $
-
- Test Number 10 (A):
-
- this is a part of the classic Hartik demo Aster.
-
- it is based on aster2.c, with the use of TBS to serve a set of aperiodic
- tasks.
-
- There are APER_MAX tasks sleeping, and when an asteroide task finish
- the current activation, it activate also an aperiodic task chosen
- randomly (if the task chosen is already active, the task_activate do
- nothing!)
-
-
-*/
-
-#include "kernel/kern.h"
-#include "modules//edf.h"
-
-int num_aster = 0;
-#define ASTER_LIM 60
-#define DISPLAY_MAX 15
-#define ASTER_MAX 70
-#define STAT_Y 9
-
-#define APER_MAX 8
-
-/* first numbers runs on a pentium 133, second numbers on a celeron 366 */
-#define PER_WCET 30000 /* 6200 */
-#define APER_WCET 50000 /* 18400 */
-#define CLOCK_WCET 1000 /* 200 */
-#define ASTER_WCET 1000 /* 200 */
-#define MIN_PERIOD 200 /* 64, in ms */
-
-#define APER_REP 22000
-
-PID aper_table[APER_MAX];
-
-TASK asteroide(void)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
-
- char s[2];
-
- s[0] = '*'; s[1] = 0;
-
- /*for (;;)*/ {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = 10000; //8000 + rand()%2000;
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
- puts_xy(i,y,rand()%15+1,s);
- }
-
- task_activate(aper_table[rand()%APER_MAX]);
- task_endcycle();
-
- puts_xy(i,y,WHITE," ");
- i++;
- }
- }
- num_aster--;
- return 0;
-}
-
-TASK aper_asteroid(void *a)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
- int c;
-
- char s[2];
-
- c = (int)a;
- s[0] = '*'; s[1] = 0;
-
- for (;;) {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = APER_REP; //8000 + rand()%2000;
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
- puts_xy(i,y,rand()%15+1,s);
- }
- s[0] = c;
- puts_xy(i,y,rand()%15+1,s);
-
- task_endcycle();
-
- puts_xy(i,y,WHITE," ");
- i++;
- }
- }
-}
-
-TASK aster()
-{
- PID p;
-
- HARD_TASK_MODEL m;
- int r;
- int x; // adaptive bandwidth...
-
- hard_task_default_model(m);
- hard_task_def_wcet(m,PER_WCET);
- hard_task_def_ctrl_jet(m);
-
- x = MIN_PERIOD;
-
- srand(7);
- while (1) {
- if (num_aster < ASTER_MAX) {
- r = (rand() % 200);
-
- hard_task_def_arg(m,(void *)((rand() % 7)+1));
- hard_task_def_mit(m, (x+r)*1000);
- p = task_create("aaa",asteroide,&m,NULL);
- if (p == -1)
- {
- if (x < 500 && errno != ENO_AVAIL_TASK) x += 1;
- printf_xy(62,3,WHITE,"adapt=%3u err=%d",
- iq_query_first(&freedesc),errno);
- }
- else {
- num_aster++;
- printf_xy(62,3,WHITE,"adapt=%3u ",x);//,errno);
- task_activate(p);
- x /= 2;
- if (x<50) x = 50;
- }
- }
- task_endcycle();
- }
-}
-
-TASK clock()
-{
- int s = 0, m = 0;
-
- while(1) {
- printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
- printf_xy(62,2,WHITE,"U=%12u",EDF_usedbandwidth(0));
- task_endcycle();
-
- if (++s > 59) {
- s = 0;
- m++;
- }
- printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
- printf_xy(62,2,WHITE,"U=%12u",EDF_usedbandwidth(0));
- task_endcycle();
- }
-}
-
-
-
-/* we consider the first ASTER_MAX + 2 tasks from the PID 2
- and plot on the screen the elapsed times... */
-TASK jetcontrol()
-{
- int i; /* a counter */
- TIME sum, max, curr, last[5];
- int nact;
- int j; /* the elements set by jet_gettable */
- PID p;
-
-
- kern_cli();
- printf_xy(0,STAT_Y,WHITE,"PID ³ Mean T.³ Max T. ³ N.A. ³ Curr. ³ Last1 ³ Last2 ³ Last3 ³ Last4 ³ Last5");
- kern_sti();
-
- for (;;) {
- for (i=0,p=0; i<DISPLAY_MAX+5 && p<MAX_PROC; p++) {
- if (jet_getstat(p, &sum, &max, &nact, &curr) == -1) continue;
-
- for (j=0; j<5; j++) last[j] = 0;
- jet_gettable(p, &last[0], 5);
- kern_cli();
- printf_xy(0,STAT_Y+i+1,WHITE,"%-3d ³ %-6d ³ %-6d ³ %-4d ³ %-7d ³ %-5d ³ %-5d ³ %-5d ³ %-5d ³ %-5d",
- p, (int)sum/(nact==0 ? 1 : nact), (int)max, (int)nact, (int)curr, (int)last[0], (int)last[1], (int)last[2], (int)last[3], (int)last[4]);
- kern_sti();
- i++;
- }
- task_endcycle();
- }
-}
-
-int main(int argc, char **argv)
-{
- PID p1,p2;//,p3,p4,p5,p6;
- HARD_TASK_MODEL m;
- NRT_TASK_MODEL m_nrt;
- SOFT_TASK_MODEL m_aper;
- int i;
-
- clear();
-
- hard_task_default_model(m);
- hard_task_def_wcet(m,ASTER_WCET);
- hard_task_def_mit(m,10000);
- hard_task_def_group(m,1);
- hard_task_def_ctrl_jet(m);
-
- nrt_task_default_model(m_nrt);
- nrt_task_def_group(m_nrt,1);
- nrt_task_def_ctrl_jet(m_nrt);
-
- p1 = task_create("Aster",aster,&m,NULL);
- if (p1 == -1) {
- perror("test7.c(main): Could not create task <aster> ...");
- sys_end();
- }
-
- hard_task_def_mit(m,500000);
- hard_task_def_wcet(m,CLOCK_WCET);
- p2 = task_create("Clock",clock,&m,NULL);
- if (p2 == -1) {
- perror("test7.c(main): Could not create task <Clock> ...");
- sys_end();
- }
-
- soft_task_default_model(m_aper);
- soft_task_def_wcet(m_aper,APER_WCET);
- soft_task_def_ctrl_jet(m_aper);
- soft_task_def_aperiodic(m_aper);
-
- soft_task_def_level(m_aper, 2);
- aper_table[0] = task_create("JetControl",jetcontrol,&m_aper,NULL);
- if (aper_table[0] == -1) {
- perror("test7.c(main): Could not create task <JetControl> ...");
- sys_end();
- }
-
- for (i=1; i<APER_MAX; i++) {
- soft_task_def_level(m_aper, i/4 + 2);
- soft_task_def_arg(m_aper, (void *)(i/4 ? 'Û' : '±'));
- aper_table[i] = task_create("aper",aper_asteroid,&m_aper,NULL);
- if (aper_table[i] == -1) {
- perror("test7.c(main): Could not create task <aper> ...");
- sys_end();
- }
- }
-
-
- group_activate(1);
-
- {
- struct timespec t;
- do {
- sys_gettime(&t);
- } while (t.tv_sec < 60);
- }
-
- sys_end();
- return 0;
-}
-
Index: rel_1_2/base/aster4.c
===================================================================
--- rel_1_2/base/aster4.c (revision 1198)
+++ rel_1_2/base/aster4.c (nonexistent)
@@ -1,399 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 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
- *
- *
- * CVS : $Id: aster4.c,v 1.1 2002-11-11 08:22:45 pj Exp $
-
- Test Number 13 (D):
-
- this is a part of the classic Hartik demo Aster, and it is based on aster 3.
-
- The demo creates:
- - a set of TBS tasks assigned to 2 TBS servers initialized with different bandwidth.
-
- - a set of periodic tasks, just to make noise (function asteroide)
-
- - a set of CBS tasks that are created to fill the available free
- bandwidth (function soft_aster)
-
- - a few service task (the one that creates the CBS tasks (aster), a clock,
- JET info visualization
-
- - a set of never ending "system tasks" that simulate a device driver
- task that will end only at shutdown (function aper_asteroid)
-
- - a keyboard task that will execute an hook to terminate the system
-
-*/
-
-/*
- * 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 "drivers/keyb.h"
-
-int num_aster = 0;
-#define ASTER_LIM 60
-#define DISPLAY_MAX 15
-#define ASTER_MAX 70
-#define STAT_Y 9
-
-#define PER_MAX 5
-#define APER_MAX 8
-
-// These numbers works on a Pentium 133 */
-#define PER_WCET 25000
-#define APER_WCET 53000
-#define CLOCK_WCET 1000
-#define ASTER_WCET 1000
-#define SOFT_MET 6300
-
-#define APER_REP 22000
-
-PID aper_table[APER_MAX];
-
-int shutting_down = 0;
-
-TASK asteroide(void)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
-
- char s[2];
-
- s[0] = '*'; s[1] = 0;
-
- for (;;) {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = 10000; //8000 + rand()%2000;
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
- puts_xy(i,y,rand()%15+1,s);
- }
-
- task_activate(aper_table[rand()%APER_MAX]);
- task_endcycle();
-
- puts_xy(i,y,WHITE," ");
- i++;
- }
- }
- //num_aster--;
-}
-
-TASK aper_asteroid(void *a)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
- int c;
-
- char s[2];
-
- c = (int)a;
- s[0] = '*'; s[1] = 0;
-
- for (;;) {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = APER_REP; //8000 + rand()%2000;
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
- puts_xy(i,y,rand()%15+1,s);
- }
- s[0] = c;
- puts_xy(i,y,rand()%15+1,s);
-
- if (shutting_down) {
- cprintf("Ending System Task %d\n",exec_shadow);
- return 0;
- }
-
- task_endcycle();
-
- puts_xy(i,y,WHITE," ");
- i++;
- }
- }
-}
-
-TASK soft_aster(void)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
-
- char s[2];
-
- s[0] = '*'; s[1] = 0;
-
- i = 1;
- while (i < ASTER_LIM) {
- load1 = 1000 + rand()%9000;
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
- puts_xy(i,y,rand()%15+1,s);
- }
- s[0] = 1;
- puts_xy(i,y,rand()%15+1,s);
-
- task_activate(aper_table[rand()%APER_MAX]);
- task_endcycle();
-
- puts_xy(i,y,WHITE," ");
- i++;
- }
- num_aster--;
- return 0;
-}
-
-TASK aster()
-{
- PID p;
-
- HARD_TASK_MODEL m;
- SOFT_TASK_MODEL m_soft;
- int r;
- int x; // adaptive bandwidth...
-
- srand(7);
-
- /* create a set of periodic tasks, just to make noise */
- hard_task_default_model(m);
- hard_task_def_wcet(m,PER_WCET);
- hard_task_def_ctrl_jet(m);
- for (x=0; x<PER_MAX; x++) {
- r = (rand() % 200);
- hard_task_def_mit(m, (64+r)*1000);
- p = task_create("per",asteroide,&m,NULL);
- if (p!=-1) task_activate(p);
- }
-
- soft_task_default_model(m_soft);
- soft_task_def_met(m_soft,SOFT_MET);
- soft_task_def_ctrl_jet(m_soft);
-
- x = 64;
-
- while (1) {
- if (num_aster < ASTER_MAX) {
- r = (rand() % 200);
-
- soft_task_def_period(m_soft, (x+r)*1000);
- p = task_create("aaa",soft_aster,&m_soft,NULL);
- if (p == -1)
- {
- if (x < 500 && errno != ENO_AVAIL_TASK) x += 1;
- printf_xy(62,3,WHITE,"adapt=%3u err=%d",
- iq_query_first(&freedesc),errno);
- }
- else {
- num_aster++;
- printf_xy(62,3,WHITE,"adapt=%3u ",x);//,errno);
- task_activate(p);
- x /= 2;
- if (x<50) x = 50;
- }
- }
- task_endcycle();
- }
-}
-
-TASK clock()
-{
- int s = 0, m = 0;
-
- while(1) {
- printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
- printf_xy(62,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(0));
- printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(4));
- task_endcycle();
-
- if (++s > 59) {
- s = 0;
- m++;
- }
- printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
- printf_xy(62,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(0));
- printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(4));
- task_endcycle();
- }
-}
-
-
-
-/* we consider the first ASTER_MAX + 2 tasks from the PID 2
- and plot on the screen the elapsed times... */
-TASK jetcontrol()
-{
- int i; /* a counter */
- TIME sum, max, curr, last[5];
- int nact;
- int j; /* the elements set by jet_gettable */
- PID p;
-
-
- kern_cli();
- printf_xy(0,STAT_Y,WHITE,"PID ³ Mean T.³ Max T. ³ N.A. ³ Curr. ³ Last1 ³ Last2 ³ Last3 ³ Last4 ³ Last5");
- kern_sti();
-
- for (;;) {
- for (i=0,p=0; i<DISPLAY_MAX+5 && p<MAX_PROC; p++) {
- if (jet_getstat(p, &sum, &max, &nact, &curr) == -1 ||
- (proc_table[p].pclass & 0xFF00) == HARD_PCLASS) continue;
-
- for (j=0; j<5; j++) last[j] = 0;
- jet_gettable(p, &last[0], 5);
- kern_cli();
- if (proc_table[p].task_level == 4)
- printf_xy(0,STAT_Y+i+1,WHITE,"%-3d ³ %-6d ³ %-6d ³ %-4d ³ %-7d ³ %-5d ³ %-5d ³ %-5d ³ %-5d ³ %-5d",
- p, (int)sum/(nact==0 ? 1 : nact), (int)max, nact, (int)CBS_get_nact(4,p), (int)last[0], (int)last[1], (int)last[2], (int)last[3], (int)last[4]);
- else
- printf_xy(0,STAT_Y+i+1,WHITE,"%-3d ³ %-6d ³ %-6d ³ %-4d ³ %-7d ³ %-5d ³ %-5d ³ %-5d ³ %-5d ³ %-5d",
- p, (int)sum/(nact==0 ? 1 : nact), (int)max, nact, (int)curr, (int)last[0], (int)last[1], (int)last[2], (int)last[3], (int)last[4]);
- kern_sti();
- i++;
- }
- }
-}
-
-void endfun(KEY_EVT *k)
-{
- sys_end();
-}
-
-void exiting(void *arg)
-{
- cprintf("System shut down...\n");
- shutting_down = 1;
-}
-
-int main(int argc, char **argv)
-{
- KEY_EVT k;
-
- PID p1,p2,p3;
- HARD_TASK_MODEL m;
- SOFT_TASK_MODEL m_aper;
- SOFT_TASK_MODEL m_soft;
- int i;
-
- k.flag = 0;
- k.scan = KEY_ENT;
- k.ascii = 13;
- keyb_hook(k, endfun);
-
- clear();
- cprintf("Press ENTER to end the demo...");
-
- sys_atrunlevel(exiting, NULL, RUNLEVEL_SHUTDOWN);
-
- hard_task_default_model(m);
- hard_task_def_wcet(m,ASTER_WCET);
- hard_task_def_mit(m,10000);
- hard_task_def_group(m,1);
- hard_task_def_ctrl_jet(m);
-
- soft_task_default_model(m_soft);
- soft_task_def_met(m_soft,1000);
- soft_task_def_period(m_soft,100000);
- soft_task_def_group(m_soft,1);
- soft_task_def_ctrl_jet(m_soft);
- soft_task_def_aperiodic(m_soft);
-
-
- p1 = task_create("Aster",aster,&m,NULL);
- if (p1 == -1) {
- perror("aster4.c(main): Could not create task <aster> ...");
- sys_end();
- }
-
- hard_task_def_mit(m,500000);
- hard_task_def_wcet(m,CLOCK_WCET);
- p2 = task_create("Clock",clock,&m,NULL);
- if (p2 == -1) {
- perror("aster4.c(main): Could not create task <Clock> ...");
- sys_end();
- }
-
- p3 = task_create("JetControl",jetcontrol,&m_soft,NULL);
- if (p3 == -1) {
- perror("aster4.c(main): Could not create task <JetControl> ...");
- sys_end();
- }
-
- soft_task_default_model(m_aper);
- soft_task_def_wcet(m_aper,APER_WCET);
- soft_task_def_ctrl_jet(m_aper);
- soft_task_def_system(m_aper);
- soft_task_def_aperiodic(m_aper);
-
- for (i=0; i<APER_MAX; i++) {
- soft_task_def_level(m_aper, i/4 + 2);
- soft_task_def_arg(m_aper, (void *)(i/4 ? 'Û' : '±'));
- aper_table[i] = task_create("aper",aper_asteroid,&m_aper,NULL);
- if (aper_table[i] == -1) {
- perror("aster4.c(main): Could not create task <aper> ...");
- sys_end();
- }
- }
-
- group_activate(1);
- return 0;
-}
-
Index: rel_1_2/base/isemdemo.c
===================================================================
--- rel_1_2/base/isemdemo.c (revision 1198)
+++ rel_1_2/base/isemdemo.c (nonexistent)
@@ -1,98 +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: isemdemo.c,v 1.1 2002-11-11 08:22:45 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2002-11-11 08:22:45 $
- ------------
-
- The simplest initialization file
-
- The tick is set to TICK ms.
-
- This file contains the 2 functions needed to initialize the system.
-
- These functions register the following levels:
-
- a RR (Round Robin) level
- a Dummy level
-
- It can accept these task models:
-
- NRT_TASK_MODEL at level 0
-
-**/
-
-/*
- * Copyright (C) 2000 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-
-
-#include "kernel/kern.h"
-#include "modules/rr.h"
-#include "modules/dummy.h"
-#include "modules/sem.h"
-
-
-/*+ sysyem tick in us +*/
-#define TICK 300
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
Index: rel_1_2/base/aster5.c
===================================================================
--- rel_1_2/base/aster5.c (revision 1198)
+++ rel_1_2/base/aster5.c (nonexistent)
@@ -1,490 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Paolo Gai, Gerardo Lamastra and Giuseppe Lipari
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * CVS : $Id: aster5.c,v 1.2 2003-01-07 17:10:15 pj Exp $
-
- this is a part of the classic Hartik demo Aster.
-
- it is based on test 13 (d), and use the CBS to serve the periodic tasks.
-
- There are not periodic tasks, only CBS tasks.
-
- The tasks use a PI, NPP or NOP mutex to access the video memory.
-
- A flag (LONGSC) is provided to try long and short critical sections.
-
- This demo is really interesting because you can note the behavior of
- the system, and the differences between the various protocols...
-
-*/
-
-#include "kernel/kern.h"
-#include "modules/edf.h"
-#include "modules/cbs.h"
-#include "drivers/keyb.h"
-
-int num_aster = 0;
-#define ASTER_LIM 60
-#define DISPLAY_MAX 15
-#define ASTER_MAX 70
-#define STAT_Y 9
-
-#define PER_MAX 5
-#define APER_MAX 8
-
-#define PER_WCET 6200
-#define APER_WCET 18400
-#define JET_WCET 10000
-#define JET_PERIOD 100000
-
-#define APER_REP 22000
-
-//PID aper_table[APER_MAX];
-
-mutex_t m1;
-
-
-#define PIMUTEX
-//#define NPPMUTEX
-//#define NOPMUTEX
-
-#define LONGSC
-
-#ifdef LONGSC
-#define SOFT_MET 3000 /* 3000 12000 */
-#define CLOCK_WCET 400 /* 200 300*/
-#define ASTER_WCET 400 /* 200 300*/
-#else
-#define SOFT_MET 80000 /* 4500 */
-#define CLOCK_WCET 2000 /* 200*/
-#define ASTER_WCET 2000 /* 200*/
-#endif
-
-TASK asteroide(void)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
-
- char s[2];
-
- s[0] = '*'; s[1] = 0;
-
- for (;;) {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = 10000; //8000 + rand()%2000;
-#ifdef LONGSC
- mutex_lock(&m1);
-#endif
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
-#ifndef LONGSC
- mutex_lock(&m1);
-#endif
- puts_xy(i,y,rand()%15+1,s);
-#ifndef LONGSC
- mutex_unlock(&m1);
-#endif
- }
-#ifdef LONGSC
- mutex_unlock(&m1);
-#endif
-
- // task_activate(aper_table[rand()%APER_MAX]);
- task_endcycle();
-
- mutex_lock(&m1);
- puts_xy(i,y,WHITE," ");
- mutex_unlock(&m1);
- i++;
- }
- }
- //num_aster--;
-}
-
-TASK aper_asteroid(void *a)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
- int c;
-
- char s[2];
-
- c = (int)a;
- s[0] = '*'; s[1] = 0;
-
- for (;;) {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = APER_REP; //8000 + rand()%2000;
-#ifdef LONGSC
- mutex_lock(&m1);
-#endif
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
-#ifndef LONGSC
- mutex_lock(&m1);
-#endif
- puts_xy(i,y,rand()%15+1,s);
-#ifndef LONGSC
- mutex_unlock(&m1);
-#endif
- }
- s[0] = c;
-#ifndef LONGSC
- mutex_lock(&m1);
-#endif
- puts_xy(i,y,rand()%15+1,s);
- mutex_unlock(&m1);
-
- task_endcycle();
-
- mutex_lock(&m1);
- puts_xy(i,y,WHITE," ");
- mutex_unlock(&m1);
- i++;
- }
- }
-}
-
-TASK soft_aster(void)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
-
- char s[2];
-
- s[0] = '*'; s[1] = 0;
-
- /*for (;;)*/ {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = 1000 + rand()%9000;
-#ifdef LONGSC
- mutex_lock(&m1);
-#endif
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
-#ifndef LONGSC
- mutex_lock(&m1);
-#endif
- puts_xy(i,y,rand()%15+1,s);
-#ifndef LONGSC
- mutex_unlock(&m1);
-#endif
- }
- s[0] = 1;
-#ifndef LONGSC
- mutex_lock(&m1);
-#endif
- puts_xy(i,y,rand()%15+1,s);
- mutex_unlock(&m1);
-
- // task_activate(aper_table[rand()%APER_MAX]);
- task_endcycle();
-
- mutex_lock(&m1);
- puts_xy(i,y,WHITE," ");
- mutex_unlock(&m1);
- i++;
- }
- }
- num_aster--;
- return 0;
-}
-
-TASK aster()
-{
- PID p;
- // HARD_TASK_MODEL m;
- SOFT_TASK_MODEL m_soft;
- int r;
- int x; // adaptive bandwidth...
-
- srand(7);
-
- /* periodic_task_default_model(m,0,PER_WCET);
- periodic_task_def_ctrl_jet(m);
- for (x=0; x<PER_MAX; x++) {
- r = (rand() % 200);
- periodic_task_def_period(m, (64+r)*1000);
- p = task_create("per",asteroide,&m,NULL);
- if (p!=-1) task_activate(p);
- }
- */
- soft_task_default_model(m_soft);
- soft_task_def_met(m_soft,SOFT_MET);
- soft_task_def_ctrl_jet(m_soft);
-
- x = 128; //64;
-
- while (1) {
- /* {
- PID p;
- int x;
- p = level_table[0]->level_scheduler(0);
- printf_xy(1,8,WHITE," ");
-
- x = 0;
- do {
- printf_xy(3*x+1,8,WHITE,"%3d",p);
- p = proc_table[p].next;
- x++;
- } while (p != NIL);
- }
- */
- if (num_aster < ASTER_MAX) {
- r = (rand() % 200);
-
- soft_task_def_period(m_soft, (x+r)*1000);
- p = task_create("aaa",soft_aster,&m_soft,NULL);
- if (p == -1)
- {
- if (x < 500 && errno != ENO_AVAIL_TASK) x += 1;
- mutex_lock(&m1);
- printf_xy(62,3,WHITE,"adapt=%3u err=%d",
- iq_query_first(&freedesc),errno);
- mutex_unlock(&m1);
- }
- else {
- num_aster++;
- mutex_lock(&m1);
- printf_xy(62,3,WHITE,"adapt=%3u ",x);//,errno);
- mutex_unlock(&m1);
-
- task_activate(p);
- x /= 2;
- if (x<50) x = 50;
- }
- }
- task_endcycle();
- }
-}
-
-TASK clock()
-{
- int s = 0, m = 0;
-
- while(1) {
- mutex_lock(&m1);
- printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
- printf_xy(62,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(0));
- printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(2));
-
- mutex_unlock(&m1);
- task_endcycle();
-
- if (++s > 59) {
- s = 0;
- m++;
- }
- mutex_lock(&m1);
- printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
- printf_xy(62,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(0));
- printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(2));
- mutex_unlock(&m1);
- task_endcycle();
- }
-}
-
-
-
-/* we consider the first ASTER_MAX + 2 tasks from the PID 2
- and plot on the screen the elapsed times... */
-TASK jetcontrol()
-{
- int i; /* a counter */
- TIME sum, max, curr, last[5];
- int nact;
- int j; /* the elements set by jet_gettable */
- PID p;
-
-
- mutex_lock(&m1);
- printf_xy(0,STAT_Y,WHITE,"PID ³ Mean T.³ Max T. ³ N.A. ³ Curr. ³ Last1 ³ Last2 ³ Last3 ³ Last4 ³ Last5");
- mutex_unlock(&m1);
-
- for (;;) {
- for (i=0,p=0; i<DISPLAY_MAX+5 && p<MAX_PROC; p++) {
- if (jet_getstat(p, &sum, &max, &nact, &curr) == -1 /*||
- (proc_table[p].pclass & 0xFF00) == APERIODIC_PCLASS ||
- (proc_table[p].pclass & 0xFF00) == PERIODIC_PCLASS*/ ) continue;
-
- for (j=0; j<5; j++) last[j] = 0;
- jet_gettable(p, &last[0], 5);
- mutex_lock(&m1);
- if (proc_table[p].task_level == 2)
- printf_xy(0,STAT_Y+i+1,WHITE,"%-3d ³ %-6d ³ %-6d ³ %-4d ³p%-7d ³ %-5d ³ %-5d ³ %-5d ³ %-5d ³ %-5d",
- p, (int)sum/(nact==0 ? 1 : nact), (int)max, nact, (int)CBS_get_nact(2,p), (int)last[0], (int)last[1], (int)last[2], (int)last[3], (int)last[4]);
- // p, sum/(nact==0 ? 1 : nact), max, proc_table[p].avail_time, proc_table[p].status, proc_table[p].shadow, proc_table[p].timespec_priority.tv_sec,proc_table[p].timespec_priority.tv_nsec/1000 , CBS_get_nact(2,p), last[4]);
- else
- printf_xy(0,STAT_Y+i+1,WHITE,"%-3d ³ %-6d ³ %-6d ³ %-4d ³ %-7d ³ %-5d ³ %-5d ³ %-5d ³ %-5d ³ %-5d",
- p, (int)sum/(nact==0 ? 1 : nact), (int)max, nact, (int)curr, (int)last[0], (int)last[1], (int)last[2], (int)last[3], (int)last[4]);
- // p, (int)sum/(nact==0 ? 1 : nact), (int)max, nact, (int)proc_table[p].status, (int)proc_table[p].shadow, (int)proc_table[p].timespec_priority.tv_sec,(int)proc_table[p].timespec_priority.tv_nsec/1000 , (int)last[3], (int)last[4]);
- mutex_unlock(&m1);
- i++;
- }
- }
-}
-
-void fine(KEY_EVT *e)
-{
- sys_end();
-}
-
-int main(int argc, char **argv)
-{
- PID p1,p2,p3;//,p4,p5,p6;
- HARD_TASK_MODEL m;
- // NRT_TASK_MODEL m_nrt;
- SOFT_TASK_MODEL m_aper;
- SOFT_TASK_MODEL m_soft;
- // int i;
- struct timespec fineprg;
-
-#ifdef PIMUTEX
- PI_mutexattr_t a;
-#endif
-
-#ifdef NPPMUTEX
- NPP_mutexattr_t a;
-#endif
-
-#ifdef NOPMUTEX
- NOP_mutexattr_t a;
-#endif
-
- KEY_EVT emerg;
- //keyb_set_map(itaMap);
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTL_BIT;
- keyb_hook(emerg,fine);
-
- clear();
-
- hard_task_default_model(m);
- hard_task_def_wcet(m,ASTER_WCET);
- hard_task_def_mit(m,100000);
- hard_task_def_group(m,1);
- hard_task_def_ctrl_jet(m);
-
- // nrt_task_default_model(m_nrt);
- // nrt_task_def_group(m_nrt,1);
- // nrt_task_def_ctrl_jet(m_nrt);
-
-
- soft_task_default_model(m_aper);
- soft_task_def_group(m_aper,1);
- soft_task_def_ctrl_jet(m_aper);
- soft_task_def_aperiodic(m_aper);
-
- soft_task_default_model(m_soft);
- soft_task_def_period(m_soft,JET_PERIOD);
- soft_task_def_met(m_soft,JET_WCET);
- soft_task_def_group(m_soft,1);
- soft_task_def_ctrl_jet(m_soft);
- soft_task_def_aperiodic(m_soft);
-
-
- p1 = task_create("Aster",aster,&m,NULL);
- if (p1 == -1) {
- perror("test7.c(main): Could not create task <aster> ...");
- sys_end();
- l1_exit(-1);
- }
-
- hard_task_def_mit(m,500000);
- hard_task_def_wcet(m,CLOCK_WCET);
- p2 = task_create("Clock",clock,&m,NULL);
- if (p2 == -1) {
- perror("test7.c(main): Could not create task <Clock> ...");
- sys_end();
- l1_exit(-1);
- }
-
- // p3 = task_create("JetControl",jetcontrol,&m_nrt,NULL);
- p3 = task_create("JetControl",jetcontrol,&m_soft,NULL);
- if (p2 == -1) {
- perror("test7.c(main): Could not create task <JetControl> ...");
- sys_end();
- l1_exit(-1);
- }
- /*
- aperiodic_task_default_model(m_aper,APER_WCET);
- aperiodic_task_def_ctrl_jet(m_aper);
- aperiodic_task_def_system(m_aper);
-
- for (i=0; i<APER_MAX; i++) {
- aperiodic_task_def_level(m_aper, i/4 + 2);
- aperiodic_task_def_arg(m_aper, (i/4 ? 'Û' : '±'));
- aper_table[i] = task_create("aper",aper_asteroid,&m_aper,NULL);
- if (aper_table[i] == -1) {
- perror("test7.c(main): Could not create task <aper> ...");
- sys_end();
- l1_exit(-1);
- }
- }
- */
- task_nopreempt();
-
-#ifdef PIMUTEX
- PI_mutexattr_default(a);
-#endif
-
-#ifdef NPPMUTEX
- NPP_mutexattr_default(a);
-#endif
-
-#ifdef NOPMUTEX
- NOP_mutexattr_default(a);
-#endif
-
- mutex_init(&m1, &a);
-
- fineprg.tv_sec = 1800;
- fineprg.tv_nsec = 0;
- //kern_event_post(&fineprg,(void (*)(void *))fine,NULL);
- group_activate(1);
- return 0;
-}
-
Index: rel_1_2/base/aster6.c
===================================================================
--- rel_1_2/base/aster6.c (revision 1198)
+++ rel_1_2/base/aster6.c (nonexistent)
@@ -1,484 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Paolo Gai, Gerardo Lamastra and Giuseppe Lipari
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * CVS : $Id: aster6.c,v 1.2 2003-01-07 17:10:15 pj Exp $
-
- this is a part of the classic Hartik demo Aster.
-
- it is based on test 17 (h), and the JobControl Task uses an
- SOFT_TASK_MODEL served by a polling server
-
-*/
-
-#include "kernel/kern.h"
-#include "modules/edf.h"
-#include "modules/cbs.h"
-#include "drivers/keyb.h"
-
-int num_aster = 0;
-#define ASTER_LIM 60
-#define DISPLAY_MAX 15
-#define ASTER_MAX 70
-#define STAT_Y 9
-
-#define PER_MAX 5
-#define APER_MAX 8
-
-#define PER_WCET 6200
-#define APER_WCET 18400
-#define JET_WCET 10000
-
-#define APER_REP 22000
-
-PID aper_table[APER_MAX];
-
-mutex_t m1;
-
-
-#define PIMUTEX
-//#define NPPMUTEX
-//#define NOPMUTEX
-
-#define LONGSC
-
-#ifdef LONGSC
-#define SOFT_MET 3000 /* 12000 */
-#define CLOCK_WCET 200 /* 300*/
-#define ASTER_WCET 200 /* 300*/
-#else
-#define SOFT_MET 80000 /* 4500 */
-#define CLOCK_WCET 2000 /* 200*/
-#define ASTER_WCET 2000 /* 200*/
-#endif
-
-TASK asteroide(void)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
-
- char s[2];
-
- s[0] = '*'; s[1] = 0;
-
- for (;;) {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = 10000; //8000 + rand()%2000;
-#ifdef LONGSC
- mutex_lock(&m1);
-#endif
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
-#ifndef LONGSC
- mutex_lock(&m1);
-#endif
- puts_xy(i,y,rand()%15+1,s);
-#ifndef LONGSC
- mutex_unlock(&m1);
-#endif
- }
-#ifdef LONGSC
- mutex_unlock(&m1);
-#endif
-
- task_activate(aper_table[rand()%APER_MAX]);
- task_endcycle();
-
- mutex_lock(&m1);
- puts_xy(i,y,WHITE," ");
- mutex_unlock(&m1);
- i++;
- }
- }
- //num_aster--;
-}
-
-TASK aper_asteroid(void *a)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
- int c;
-
- char s[2];
-
- c = (int)a;
- s[0] = '*'; s[1] = 0;
-
- for (;;) {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = APER_REP; //8000 + rand()%2000;
-#ifdef LONGSC
- mutex_lock(&m1);
-#endif
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
-#ifndef LONGSC
- mutex_lock(&m1);
-#endif
- puts_xy(i,y,rand()%15+1,s);
-#ifndef LONGSC
- mutex_unlock(&m1);
-#endif
- }
- s[0] = c;
-#ifndef LONGSC
- mutex_lock(&m1);
-#endif
- puts_xy(i,y,rand()%15+1,s);
- mutex_unlock(&m1);
-
- task_endcycle();
-
- mutex_lock(&m1);
- puts_xy(i,y,WHITE," ");
- mutex_unlock(&m1);
- i++;
- }
- }
-}
-
-TASK soft_aster(void)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
-
- char s[2];
-
- s[0] = '*'; s[1] = 0;
-
- /*for (;;)*/ {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = 1000 + rand()%9000;
-#ifdef LONGSC
- mutex_lock(&m1);
-#endif
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
-#ifndef LONGSC
- mutex_lock(&m1);
-#endif
- puts_xy(i,y,rand()%15+1,s);
-#ifndef LONGSC
- mutex_unlock(&m1);
-#endif
- }
- s[0] = 1;
-#ifndef LONGSC
- mutex_lock(&m1);
-#endif
- puts_xy(i,y,rand()%15+1,s);
- mutex_unlock(&m1);
-
- task_activate(aper_table[rand()%APER_MAX]);
- task_endcycle();
-
- mutex_lock(&m1);
- puts_xy(i,y,WHITE," ");
- mutex_unlock(&m1);
- i++;
- }
- }
- num_aster--;
- return 0;
-}
-
-TASK aster()
-{
- PID p;
-
- // HARD_TASK_MODEL m;
- SOFT_TASK_MODEL m_soft;
- int r;
- int x; // adaptive bandwidth...
-
- srand(7);
-
- /* periodic_task_default_model(m,0,PER_WCET);
- periodic_task_def_ctrl_jet(m);
- for (x=0; x<PER_MAX; x++) {
- r = (rand() % 200);
- periodic_task_def_period(m, (64+r)*1000);
- p = task_create("per",asteroide,&m,NULL);
- if (p!=-1) task_activate(p);
- }
- */
- soft_task_default_model(m_soft);
- soft_task_def_met(m_soft,SOFT_MET);
- soft_task_def_ctrl_jet(m_soft);
-
- x = 128; //64;
-
- while (1) {
- /* {
- PID p;
- int x;
- p = level_table[0]->level_scheduler(0);
- printf_xy(1,8,WHITE," ");
-
- x = 0;
- do {
- printf_xy(3*x+1,8,WHITE,"%3d",p);
- p = proc_table[p].next;
- x++;
- } while (p != NIL);
- }
- */
- if (num_aster < ASTER_MAX) {
- r = (rand() % 200);
-
- soft_task_def_period(m_soft, (x+r)*1000);
- p = task_create("aaa",soft_aster,&m_soft,NULL);
- if (p == -1)
- {
- if (x < 500 && errno != ENO_AVAIL_TASK) x += 1;
- mutex_lock(&m1);
- printf_xy(62,3,WHITE,"adapt=%3u err=%d",
- iq_query_first(&freedesc),errno);
- mutex_unlock(&m1);
- }
- else {
- num_aster++;
- mutex_lock(&m1);
- printf_xy(62,3,WHITE,"adapt=%3u ",x);//,errno);
- mutex_unlock(&m1);
- task_activate(p);
- x /= 2;
- if (x<50) x = 50;
- }
- }
- task_endcycle();
- }
-}
-
-TASK clock()
-{
- int s = 0, m = 0;
-
- while(1) {
- mutex_lock(&m1);
- printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
- printf_xy(62,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(0));
- printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(2));
-
- mutex_unlock(&m1);
-
- task_endcycle();
-
- if (++s > 59) {
- s = 0;
- m++;
- }
- mutex_lock(&m1);
- printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
- printf_xy(62,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(0));
- printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(2));
- mutex_unlock(&m1);
- task_endcycle();
- }
-}
-
-
-
-/* we consider the first ASTER_MAX + 2 tasks from the PID 2
- and plot on the screen the elapsed times... */
-TASK jetcontrol()
-{
- int i; /* a counter */
- TIME sum, max, curr, last[5];
- int nact;
- int j; /* the elements set by jet_gettable */
- PID p;
-
-
- mutex_lock(&m1);
- printf_xy(0,STAT_Y,WHITE,"PID ³ Mean T.³ Max T. ³ N.A. ³ Curr. ³ Last1 ³ Last2 ³ Last3 ³ Last4 ³ Last5");
- mutex_unlock(&m1);
-
- for (;;) {
- for (i=0,p=0; i<DISPLAY_MAX+5 && p<MAX_PROC; p++) {
- if (jet_getstat(p, &sum, &max, &nact, &curr) == -1 /*||
- (proc_table[p].pclass & 0xFF00) == APERIODIC_PCLASS ||
- (proc_table[p].pclass & 0xFF00) == PERIODIC_PCLASS*/ ) continue;
-
- for (j=0; j<5; j++) last[j] = 0;
- jet_gettable(p, &last[0], 5);
- mutex_lock(&m1);
- if (proc_table[p].task_level == 2)
- printf_xy(0,STAT_Y+i+1,WHITE,"%-3d ³ %-6d ³ %-6d ³ %-4d ³ %-7d ³ %-5d ³ %-5d ³ %-5d ³ %-5d ³ %-5d",
- p, (int)sum/(nact==0 ? 1 : nact), (int)max, nact, (int)CBS_get_nact(2,p), (int)last[0], (int)last[1], (int)last[2], (int)last[3], (int)last[4]);
- // p, sum/(nact==0 ? 1 : nact), max, proc_table[p].avail_time, proc_table[p].status, proc_table[p].shadow, proc_table[p].timespec_priority.tv_sec,proc_table[p].timespec_priority.tv_nsec/1000 , CBS_get_nact(2,p), last[4]);
- else
- printf_xy(0,STAT_Y+i+1,WHITE,"%-3d ³ %-6d ³ %-6d ³ %-4d ³ %-7d ³ %-5d ³ %-5d ³ %-5d ³ %-5d ³ %-5d",
- p, (int)sum/(nact==0 ? 1 : nact), (int)max, (int)nact, (int)curr, (int)last[0], (int)last[1], (int)last[2], (int)last[3], (int)last[4]);
- // p, sum/(nact==0 ? 1 : nact), max, nact, proc_table[p].status, proc_table[p].shadow, proc_table[p].timespec_priority.tv_sec,proc_table[p].timespec_priority.tv_nsec/1000 , last[3], last[4]);
- mutex_unlock(&m1);
- i++;
- }
- }
-}
-
-void fine(KEY_EVT *e)
-{
- sys_end();
-}
-
-int main(int argc, char **argv)
-{
- PID p1,p2,p3; //,p4,p5,p6;
- HARD_TASK_MODEL m;
- // NRT_TASK_MODEL m_nrt;
- SOFT_TASK_MODEL m_aper;
- SOFT_TASK_MODEL m_soft;
- // int i;
- struct timespec fineprg;
-
-#ifdef PIMUTEX
- PI_mutexattr_t a;
-#endif
-
-#ifdef NPPMUTEX
- NPP_mutexattr_t a;
-#endif
-
-#ifdef NOPMUTEX
- NOP_mutexattr_t a;
-#endif
-
-
- KEY_EVT emerg;
- //keyb_set_map(itaMap);
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTL_BIT;
- keyb_hook(emerg,fine);
-
- clear();
-
- hard_task_default_model(m);
- hard_task_def_mit(m,100000);
- hard_task_def_wcet(m,ASTER_WCET);
- hard_task_def_group(m,1);
- hard_task_def_ctrl_jet(m);
-
- // nrt_task_default_model(m_nrt);
- // nrt_task_def_group(m_nrt,1);
- // nrt_task_def_ctrl_jet(m_nrt);
-
-
- soft_task_default_model(m_aper);
- soft_task_def_group(m_aper,1);
- soft_task_def_ctrl_jet(m_aper);
- soft_task_def_aperiodic(m_aper);
-
- soft_task_default_model(m_soft);
- soft_task_def_period(m_soft,100000);
- soft_task_def_met(m_soft,JET_WCET);
- soft_task_def_group(m_soft,1);
- soft_task_def_ctrl_jet(m_soft);
- soft_task_def_aperiodic(m_soft);
-
-
- p1 = task_create("Aster",aster,&m,NULL);
- if (p1 == -1) {
- perror("test7.c(main): Could not create task <aster> ...");
- sys_end();
- l1_exit(-1);
- }
-
- hard_task_def_mit(m,500000);
- hard_task_def_wcet(m,CLOCK_WCET);
- p2 = task_create("Clock",clock,&m,NULL);
- if (p2 == -1) {
- perror("test7.c(main): Could not create task <Clock> ...");
- sys_end();
- l1_exit(-1);
- }
-
- // p3 = task_create("JetControl",jetcontrol,&m_nrt,NULL);
- p3 = task_create("JetControl",jetcontrol,&m_aper,NULL);
- if (p3 == -1) {
- perror("test7.c(main): Could not create task <JetControl> ...");
- sys_end();
- l1_exit(-1);
- }
- /*
- aperiodic_task_default_model(m_aper,APER_WCET);
- aperiodic_task_def_ctrl_jet(m_aper);
- aperiodic_task_def_system(m_aper);
-
- for (i=0; i<APER_MAX; i++) {
- aperiodic_task_def_level(m_aper, i/4 + 2);
- aperiodic_task_def_arg(m_aper, (i/4 ? 'Û' : '±'));
- aper_table[i] = task_create("aper",aper_asteroid,&m_aper,NULL);
- if (aper_table[i] == -1) {
- perror("test7.c(main): Could not create task <aper> ...");
- sys_end();
- l1_exit(-1);
- }
- }
- */
- task_nopreempt();
-
-#ifdef PIMUTEX
- PI_mutexattr_default(a);
-#endif
-
-#ifdef NPPMUTEX
- NPP_mutexattr_default(a);
-#endif
-
-#ifdef NOPMUTEX
- NOP_mutexattr_default(a);
-#endif
-
- mutex_init(&m1, &a);
-
- fineprg.tv_sec = 1800;
- fineprg.tv_nsec = 0;
- kern_event_post(&fineprg,(void (*)(void *))fine,NULL);
- group_activate(1);
-
- return 0;
-}
-
Index: rel_1_2/base/aster7.c
===================================================================
--- rel_1_2/base/aster7.c (revision 1198)
+++ rel_1_2/base/aster7.c (nonexistent)
@@ -1,307 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Giorgio Buttazzo, Paolo Gai, Massimiliano Giorgi
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * CVS : $Id: aster7.c,v 1.2 2003-01-07 17:10:15 pj Exp $
-
- this is a part of the classic Hartik demo Aster.
-
- it is based on test 10(A), and test the PS with RM.
-
- The JetControl is served by a dedicated Polling Server, too.
-
- There are APER_MAX tasks sleeping, and when an asteroide task finish
- the current activation, it activate also an aperiodic task chosen
- randomly (if the task chosen is already active, the task_activate do
- nothing!)
-
-*/
-
-#include "kernel/kern.h"
-#include "modules//edf.h"
-#include "drivers/keyb.h"
-
-int num_aster = 0;
-#define ASTER_LIM 60
-#define DISPLAY_MAX 15
-#define ASTER_MAX 70
-#define STAT_Y 9
-
-#define APER_MAX 8
-
-/* Pentium 133 / Celeron 366 */
-#define PER_WCET 25000 /* 7800 */
-#define APER_WCET 5500 /* 1400 */
-#define CLOCK_WCET 500 /* 200 */
-#define ASTER_WCET 500 /* 200 */
-
-#define APER_REP 2200
-
-PID aper_table[APER_MAX];
-
-TASK asteroide(void)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
-
- char s[2];
-
- s[0] = '*'; s[1] = 0;
-
- /*for (;;)*/ {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = 10000; //8000 + rand()%2000;
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
- puts_xy(i,y,rand()%15+1,s);
- }
-
- task_activate(aper_table[rand()%APER_MAX]);
- task_endcycle();
-
- puts_xy(i,y,WHITE," ");
- i++;
- }
- }
- num_aster--;
- return 0;
-}
-
-TASK aper_asteroid(void *a)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
- int c;
-
- char s[2];
-
- c = (int)a;
- s[0] = '*'; s[1] = 0;
-
- for (;;) {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = APER_REP; //8000 + rand()%2000;
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
- puts_xy(i,y,rand()%15+1,s);
- }
- s[0] = c;
- puts_xy(i,y,rand()%15+1,s);
-
- task_endcycle();
-
- puts_xy(i,y,WHITE," ");
- i++;
- }
- }
-}
-
-TASK aster()
-{
- PID p;
-
- HARD_TASK_MODEL m;
- int r;
- int x; // adaptive bandwidth...
-
- hard_task_default_model(m);
- hard_task_def_wcet(m,PER_WCET);
- hard_task_def_ctrl_jet(m);
-
- x = 200;
-
- srand(7);
- while (1) {
- if (num_aster < ASTER_MAX) {
- r = (rand() % 200);
-
- hard_task_def_arg(m,(void *)((rand() % 7)+1));
- hard_task_def_mit(m, (x+r)*1000);
- p = task_create("aaa",asteroide,&m,NULL);
- if (p == -1)
- {
- if (x < 500 && errno != ENO_AVAIL_TASK) x += 1;
- printf_xy(62,3,WHITE,"adapt=%3u err=%d",
- iq_query_first(&freedesc),errno);
- }
- else {
- num_aster++;
- printf_xy(62,3,WHITE,"adapt=%3u ",x);//,errno);
- task_activate(p);
- x /= 2;
- if (x<50) x = 50;
- }
- }
- task_endcycle();
- }
-}
-
-TASK clock()
-{
- int s = 0, m = 0;
-
- while(1) {
- printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
- printf_xy(62,2,WHITE,"U=%12u",EDF_usedbandwidth(0));
- task_endcycle();
-
- if (++s > 59) {
- s = 0;
- m++;
- }
- printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
- printf_xy(62,2,WHITE,"U=%12u",EDF_usedbandwidth(0));
- task_endcycle();
- }
-}
-
-
-
-/* we consider the first ASTER_MAX + 2 tasks from the PID 2
- and plot on the screen the elapsed times... */
-TASK jetcontrol()
-{
- int i; /* a counter */
- TIME sum, max, curr, last[5];
- int nact;
- int j; /* the elements set by jet_gettable */
- PID p;
-
-
- kern_cli();
- printf_xy(0,STAT_Y,WHITE,"PID ³ Mean T.³ Max T. ³ N.A. ³ Curr. ³ Last1 ³ Last2 ³ Last3 ³ Last4 ³ Last5");
- kern_sti();
-
- for (;;) {
- for (i=0,p=0; i<DISPLAY_MAX+5 && p<MAX_PROC; p++) {
- if (jet_getstat(p, &sum, &max, &nact, &curr) == -1) continue;
-
- for (j=0; j<5; j++) last[j] = 0;
- jet_gettable(p, &last[0], 5);
- kern_cli();
- printf_xy(0,STAT_Y+i+1,WHITE,"%-3d ³ %-6d ³ %-6d ³ %-4d ³ %-7d ³ %-5d ³ %-5d ³ %-5d ³ %-5d ³ %-5d",
- p, (int)sum/(nact==0 ? 1 : nact), (int)max, nact, (int)curr, (int)last[0], (int)last[1], (int)last[2], (int)last[3], (int)last[4]);
- kern_sti();
- i++;
- }
- }
-}
-
-
-void fine(KEY_EVT *e)
-{
- sys_end();
-}
-
-
-int main(int argc, char **argv)
-{
- PID p1,p2,p3; //,p4,p5,p6;
- HARD_TASK_MODEL m;
- NRT_TASK_MODEL m_nrt;
- SOFT_TASK_MODEL m_aper;
- int i;
-
- KEY_EVT emerg;
-
- clear();
-
- cprintf("Press Alt-x to end the demo...");
-
- //keyb_set_map(itaMap);
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTL_BIT;
- keyb_hook(emerg,fine);
-
- hard_task_default_model(m);
- hard_task_def_wcet(m,ASTER_WCET);
- hard_task_def_mit(m,10000);
- hard_task_def_group(m,1);
- hard_task_def_ctrl_jet(m);
-
- nrt_task_default_model(m_nrt);
- nrt_task_def_group(m_nrt,1);
- nrt_task_def_ctrl_jet(m_nrt);
-
- p1 = task_create("Aster",aster,&m,NULL);
- if (p1 == -1) {
- perror("test7.c(main): Could not create task <aster> ...");
- sys_end();
- }
-
- hard_task_def_mit(m,500000);
- hard_task_def_wcet(m,CLOCK_WCET);
- p2 = task_create("Clock",clock,&m,NULL);
- if (p2 == -1) {
- perror("test7.c(main): Could not create task <Clock> ...");
- sys_end();
- }
-
- soft_task_default_model(m_aper);
- soft_task_def_ctrl_jet(m_aper);
- soft_task_def_level(m_aper, 1);
- soft_task_def_group(m_aper,1);
- soft_task_def_aperiodic(m_aper);
- p3 = task_create("JetControl",jetcontrol,&m_aper,NULL);
- if (p3 == -1) {
- perror("test7.c(main): Could not create task <JetControl> ...");
- sys_end();
- }
-
- soft_task_def_wcet(m_aper,APER_WCET);
- soft_task_def_ctrl_jet(m_aper);
- soft_task_def_aperiodic(m_aper);
-
- for (i=0; i<APER_MAX; i++) {
- soft_task_def_level(m_aper, i/4 + 3);
- soft_task_def_arg(m_aper, (void *)(i/4 ? 'Û' : '±'));
- aper_table[i] = task_create("aper",aper_asteroid,&m_aper,NULL);
- if (aper_table[i] == -1) {
- perror("test7.c(main): Could not create task <aper> ...");
- sys_end();
- }
- }
-
- group_activate(1);
- return 0;
-}
-
Index: rel_1_2/base/aster8.c
===================================================================
--- rel_1_2/base/aster8.c (revision 1198)
+++ rel_1_2/base/aster8.c (nonexistent)
@@ -1,542 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Giorgio Buttazzo, Paolo Gai, Massimiliano Giorgi
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * CVS : $Id: aster8.c,v 1.2 2003-01-07 17:10:15 pj Exp $
-
- Test for Sporadic Server (ss):
-
- this is a part of the classic Hartik demo Aster.
-
- it is based on test 17 (h), and the JobControl Task uses an
- SOFT_TASK_MODEL served by a sporadic server
- There are two "dummy" tasks that increment a counter and print
- the value. One uses a SOFT_TASK_MODEL served by sporadic server,
- the other uses a NRT_TASK_MODEL handled by RR module.
-
-*/
-
-#include "kernel/kern.h"
-#include "modules/edf.h"
-#include "modules/cbs.h"
-#include "modules/ss.h"
-#include "drivers/keyb.h"
-
-int num_aster = 0;
-#define EDF_LEV 0
-#define CBS_LEV 1
-#define SS_LEV 2
-
-#define ASTER_LIM 60
-#define DISPLAY_MAX 8
-#define ASTER_MAX 70
-#define STAT_Y 9
-
-#define PER_MAX 5
-#define APER_MAX 8
-
-#define PER_WCET 16000
-#define APER_WCET 22000
-#define JET_WCET 20000
-
-#define APER_REP 22000
-
-PID aper_table[APER_MAX];
-
-mutex_t m1;
-
-
-#define PIMUTEX
-//#define PCMUTEX
-//#define NPPMUTEX
-//#define NOPMUTEX
-
-#define LONGSC
-
-#ifdef LONGSC
-#define SOFT_MET 12000 /* 12000 */
-#define CLOCK_WCET 300 /* 300*/
-#define ASTER_WCET 300 /* 300*/
-#else
-#define SOFT_MET 5000 /* 4500 */
-#define CLOCK_WCET 2000 /* 200*/
-#define ASTER_WCET 2000 /* 200*/
-#endif
-
-PID p1,p2,p3,p4,p5;
-
-TASK asteroide(void)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
-
- char s[2];
-
- s[0] = '*'; s[1] = 0;
-
- for (;;) {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = 10000; //8000 + rand()%2000;
- #ifdef LONGSC
- mutex_lock(&m1);
- #endif
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
- #ifndef LONGSC
- mutex_lock(&m1);
- #endif
- puts_xy(i,y,rand()%15+1,s);
- #ifndef LONGSC
- mutex_unlock(&m1);
- #endif
- }
- #ifdef LONGSC
- mutex_unlock(&m1);
- #endif
-
- task_activate(aper_table[rand()%APER_MAX]);
- task_endcycle();
-
- mutex_lock(&m1);
- puts_xy(i,y,WHITE," ");
- mutex_unlock(&m1);
- i++;
- }
- }
- //num_aster--;
-}
-
-TASK aper_asteroid(void *a)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
- int c;
-
- char s[2];
-
- c = (int)a;
- s[0] = '*'; s[1] = 0;
-
- for (;;) {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = APER_REP; //8000 + rand()%2000;
- #ifdef LONGSC
- mutex_lock(&m1);
- #endif
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
- #ifndef LONGSC
- mutex_lock(&m1);
- #endif
- puts_xy(i,y,rand()%15+1,s);
- #ifndef LONGSC
- mutex_unlock(&m1);
- #endif
- }
- s[0] = c;
- #ifndef LONGSC
- mutex_unlock(&m1);
- #endif
- mutex_lock(&m1);
- puts_xy(i,y,rand()%15+1,s);
- mutex_unlock(&m1);
-
- task_endcycle();
-
- mutex_lock(&m1);
- puts_xy(i,y,WHITE," ");
- mutex_unlock(&m1);
- i++;
- }
- }
-}
-
-TASK soft_aster(void)
-{
- int i;
- int y = rand() % 7 + 1;
-
- int load1,j;
-
- char s[2];
-
- s[0] = '*'; s[1] = 0;
-
- /*for (;;)*/ {
- i = 1;
- while (i < ASTER_LIM) {
- load1 = 1000 + rand()%9000;
- #ifdef LONGSC
- mutex_lock(&m1);
- #endif
- for (j=0; j<load1; j++) {
- s[0] = '*' + rand() % 100;
- #ifndef LONGSC
- mutex_lock(&m1);
- #endif
- puts_xy(i,y,rand()%15+1,s);
- #ifndef LONGSC
- mutex_unlock(&m1);
- #endif
- }
- s[0] = 1;
- #ifndef LONGSC
- mutex_lock(&m1);
- #endif
- //mutex_lock(&m1);
- puts_xy(i,y,rand()%15+1,s);
- mutex_unlock(&m1);
-
- task_activate(aper_table[rand()%APER_MAX]);
- task_endcycle();
-
- mutex_lock(&m1);
- puts_xy(i,y,WHITE," ");
- mutex_unlock(&m1);
- i++;
- }
- }
- num_aster--;
- return 0;
-}
-
-TASK aster()
-{
- PID p;
-
-// HARD_TASK_MODEL m;
- SOFT_TASK_MODEL m_soft;
- int r;
- int x; // adaptive bandwidth...
-
- srand(7);
-
-/* periodic_task_default_model(m,0,PER_WCET);
- periodic_task_def_ctrl_jet(m);
- for (x=0; x<PER_MAX; x++) {
- r = (rand() % 200);
- periodic_task_def_period(m, (64+r)*1000);
- p = task_create("per",asteroide,&m,NULL);
- if (p!=-1) task_activate(p);
- }
-*/
- soft_task_default_model(m_soft);
- soft_task_def_met(m_soft,SOFT_MET);
- soft_task_def_ctrl_jet(m_soft);
-// soft_task_def_aperiodic(m_soft);
-
- x = 128; //64;
-
- while (1) {
-/* {
- PID p;
- int x;
- p = level_table[0]->level_scheduler(0);
- printf_xy(1,8,WHITE," ");
-
- x = 0;
- do {
- printf_xy(3*x+1,8,WHITE,"%3d",p);
- p = proc_table[p].next;
- x++;
- } while (p != NIL);
- }
-*/
- if (num_aster < ASTER_MAX) {
- r = (rand() % 200);
-
- soft_task_def_period(m_soft, (x+r)*1000);
- p = task_create("aaa",soft_aster,&m_soft,NULL);
- if (p == -1)
- {
- if (x < 500 && errno != ENO_AVAIL_TASK) x += 1;
- mutex_lock(&m1);
- printf_xy(62,3,WHITE,"adapt=%3u err=%d",
- iq_query_first(&freedesc), errno);
- mutex_unlock(&m1);
- }
- else {
- num_aster++;
- mutex_lock(&m1);
- printf_xy(62,3,WHITE,"adapt=%3u ",x);
- mutex_unlock(&m1);
- task_activate(p);
- x /= 2;
- if (x<50) x = 50;
- }
- }
- task_endcycle();
- }
-}
-
-TASK clock()
-{
- int s = 0, m = 0;
-
- while(1) {
- mutex_lock(&m1);
- printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
- printf_xy(62,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(EDF_LEV));
- printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(CBS_LEV));
- printf_xy(62,5,WHITE,"CSss=%6d",SS_availCs(SS_LEV));
- mutex_unlock(&m1);
-
- task_endcycle();
-
- if (++s > 59) {
- s = 0;
- m++;
- }
- mutex_lock(&m1);
- printf_xy(62,1,WHITE,"%2d:%2d ast=%d",m,s, num_aster);
- printf_xy(62,2,WHITE,"Uedf=%12u",EDF_usedbandwidth(EDF_LEV));
- printf_xy(62,4,WHITE,"Ucbs=%12u",CBS_usedbandwidth(CBS_LEV));
- printf_xy(62,5,WHITE,"CSss=%6d",SS_availCs(SS_LEV));
- mutex_unlock(&m1);
- task_endcycle();
- }
-}
-
-
-
-/* we consider the first ASTER_MAX + 2 tasks from the PID 2
- and plot on the screen the elapsed times... */
-TASK jetcontrol()
-{
- int i; /* a counter */
- TIME sum, max, curr, last[5];
- int nact;
- int j; /* the elements set by jet_gettable */
- PID p;
-
-
- mutex_lock(&m1);
- printf_xy(0,STAT_Y,WHITE,"PID ³ Mean T.³ Max T. ³ N.A. ³ Curr. ³ Last1 ³ Last2 ³ Last3 ³ Last4 ³ Last5");
- mutex_unlock(&m1);
-
- for (;;) {
- for (i=0,p=0; i<DISPLAY_MAX+5 && p<MAX_PROC; p++) {
- if (jet_getstat(p, &sum, &max, &nact, &curr) == -1 /*||
- (proc_table[p].pclass & 0xFF00) == APERIODIC_PCLASS ||
- (proc_table[p].pclass & 0xFF00) == PERIODIC_PCLASS*/ ) continue;
-
- for (j=0; j<5; j++) last[j] = 0;
- jet_gettable(p, &last[0], 5);
- mutex_lock(&m1);
- if (proc_table[p].task_level == 1)
- printf_xy(0,STAT_Y+i+1,WHITE,"%-3d ³ %-6d ³ %-6d ³ %-4d ³ %-7d ³ %-5d ³ %-5d ³ %-5d ³ %-5d ³ %-5d",
- p, (int)sum/(nact==0 ? 1 : nact), (int)max, nact, (int)CBS_get_nact(2,p), (int)last[0], (int)last[1], (int)last[2], (int)last[3], (int)last[4]);
-// p, sum/(nact==0 ? 1 : nact), max, proc_table[p].avail_time, proc_table[p].status, proc_table[p].shadow, proc_table[p].timespec_priority.tv_sec,proc_table[p].timespec_priority.tv_nsec/1000 , CBS_get_nact(2,p), last[4]);
- else
- printf_xy(0,STAT_Y+i+1,WHITE,"%-3d ³ %-6d ³ %-6d ³ %-4d ³ %-7d ³ %-5d ³ %-5d ³ %-5d ³ %-5d ³ %-5d",
- p, (int)sum/(nact==0 ? 1 : nact), (int)max, (int)nact, (int)curr, (int)last[0], (int)last[1], (int)last[2], (int)last[3], (int)last[4]);
-// p, sum/(nact==0 ? 1 : nact), max, nact, proc_table[p].status, proc_table[p].shadow, proc_table[p].timespec_priority.tv_sec,proc_table[p].timespec_priority.tv_nsec/1000 , last[3], last[4]);
- mutex_unlock(&m1);
- i++;
- task_activate(p3);
- task_endcycle();
- }
- }
-}
-
-void fine(KEY_EVT *e)
-{
- sys_end();
-}
-
-void mydummyaper(void) {
- int i=0;
- while(1) {
- mutex_lock(&m1);
- printf_xy(1,24,RED,"dummyAPER pid=%d: %d",p4,i++);
- mutex_unlock(&m1);
- task_activate(p4);
- task_endcycle();
- }
-}
-
-void mydummynrt(void) {
- int i=0;
- while(1) {
- mutex_lock(&m1);
- printf_xy(40,24,RED,"dummyNRT pid=%d: %d",p5,i++);
- mutex_unlock(&m1);
- }
-}
-
-int main(int argc, char **argv)
-{
-// PID p1,p2,p5;
- HARD_TASK_MODEL m;
- NRT_TASK_MODEL m_nrt;
- SOFT_TASK_MODEL m_aper;
- SOFT_TASK_MODEL m_soft;
-
- #ifdef PIMUTEX
- PI_mutexattr_t a;
- #endif
-
- #ifdef PCMUTEX
- PC_mutexattr_t a;
- #endif
-
- #ifdef NPPMUTEX
- NPP_mutexattr_t a;
- #endif
-
- #ifdef NOPMUTEX
- NOP_mutexattr_t a;
- #endif
-
-
- KEY_EVT emerg;
- //keyb_set_map(itaMap);
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTL_BIT;
- keyb_hook(emerg,fine);
-
- clear();
-
- cprintf("Press Alt-x to end the demo...");
-
- hard_task_default_model(m);
- hard_task_def_mit(m,100000);
- hard_task_def_wcet(m,ASTER_WCET);
- hard_task_def_group(m,1);
- hard_task_def_ctrl_jet(m);
-
- nrt_task_default_model(m_nrt);
- nrt_task_def_group(m_nrt,1);
- nrt_task_def_ctrl_jet(m_nrt);
-
-
- soft_task_default_model(m_aper);
- soft_task_def_group(m_aper,1);
- soft_task_def_ctrl_jet(m_aper);
- soft_task_def_aperiodic(m_aper);
-
- soft_task_default_model(m_soft);
- soft_task_def_period(m_soft,10000);
- soft_task_def_met(m_soft,JET_WCET);
- soft_task_def_group(m_soft,1);
- soft_task_def_ctrl_jet(m_soft);
- soft_task_def_aperiodic(m_soft);
-
-
- p1 = task_create("Aster",aster,&m,NULL);
- if (p1 == -1) {
- perror("test7.c(main): Could not create task <aster> ...");
- sys_end();
- l1_exit(-1);
- }
-
- hard_task_def_mit(m,50000);
- hard_task_def_wcet(m,CLOCK_WCET);
- p2 = task_create("Clock",clock,&m,NULL);
- if (p2 == -1) {
- perror("test7.c(main): Could not create task <Clock> ...");
- sys_end();
- l1_exit(-1);
- }
-
-// p3 = task_create("JetControl",jetcontrol,&m_nrt,NULL);
- p3 = task_create("JetControl",jetcontrol,&m_aper,NULL);
- if (p3 == -1) {
- perror("test7.c(main): Could not create task <JetControl> ...");
- sys_end();
- l1_exit(-1);
- }
-
- p4 = task_create("MyDummyAper",(void *(*)(void*))mydummyaper,&m_aper,NULL);
- if (p4 == -1) {
- perror("Could not create task <MyDummyAper> ...");
- sys_end();
- l1_exit(-1);
- }
-
- p5 = task_create("MyDummyNRT",(void *(*)(void*))mydummynrt,&m_nrt,NULL);
- if (p5 == -1) {
- perror("Could not create task <MyDummyNRT> ...");
- sys_end();
- l1_exit(-1);
- }
-/*
- aperiodic_task_default_model(m_aper,APER_WCET);
- aperiodic_task_def_ctrl_jet(m_aper);
- aperiodic_task_def_system(m_aper);
-
- for (i=0; i<APER_MAX; i++) {
- aperiodic_task_def_level(m_aper, i/4 + 2);
- aperiodic_task_def_arg(m_aper, (i/4 ? 'Û' : '±'));
- aper_table[i] = task_create("aper",aper_asteroid,&m_aper,NULL);
- if (aper_table[i] == -1) {
- perror("test7.c(main): Could not create task <aper> ...");
- sys_end();
- l1_exit(-1);
- }
- }
-*/
-// task_nopreempt();
-
-
- #ifdef PIMUTEX
- PI_mutexattr_default(a);
- #endif
-
- #ifdef PCMUTEX
- PC_mutexattr_default(a);
- #endif
-
- #ifdef NPPMUTEX
- NPP_mutexattr_default(a);
- #endif
-
- #ifdef NOPMUTEX
- NOP_mutexattr_default(a);
- #endif
-
- mutex_init(&m1, &a);
-
- group_activate(1);
- return 0;
-}
-
Index: rel_1_2/base/cabs.c
===================================================================
--- rel_1_2/base/cabs.c (revision 1198)
+++ rel_1_2/base/cabs.c (nonexistent)
@@ -1,322 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Giorgio Buttazzo, Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * CVS : $Id: cabs.c,v 1.3 2003-01-07 17:10:15 pj Exp $
- */
-
-/*--------------------------------------------------------------*/
-/* TEST ON CABS */
-/*--------------------------------------------------------------*/
-
-#include <kernel/kern.h>
-#include <modules/cabs.h>
-#include <drivers/glib.h>
-#include <drivers/keyb.h>
-#include <string.h>
-
-#define NCAB 4 /* max number of CABs */
-#define NCAR 26 /* generated characters */
-
-#define YP 32 /* level of arrows */
-#define R 20 /* task radius */
-#define YY (YP+R+32) /* level of writing */
-#define DELTA (2*R+72) /* total channel hight */
-#define X1 120 /* start column for P1 */
-#define X2 360 /* start column for P2 */
-
-#define XP1 (X1+64) /* X position of task 1 */
-#define XP2 (X2+64) /* X position of task 2 */
-#define XC (XP1+96) /* X position of CAB */
-#define L 52 /* CAB rectangle length */
-
-void my_exit(KEY_EVT *k);
-void draw_channel(int i);
-void create_channel(int i);
-void get_data();
-
-TASK producer(void *arg);
-TASK consumer(void *arg);
-
-char *cname[NCAB] = {"cab1", "cab2", "cab3", "cab4"};
-char *pname1[NCAB] = {"wr1", "wr2", "wr3", "wr4"};
-char *pname2[NCAB] = {"rd1", "rd2", "rd3", "rd4"};
-
-CAB cid[NCAB]; /* CAB identifiers */
-PID p1[NCAB], p2[NCAB]; /* task identifiers */
-
-/* Task Periods */
-TIME t1[NCAB] = {200000, 100000, 300000, 800000};
-TIME t2[NCAB] = {400000, 400000, 150000, 200000};
-
-/* Task WCETS */
-TIME w1[NCAB] = {10000, 10000, 10000, 10000};
-TIME w2[NCAB] = {10000, 10000, 10000, 10000};
-
-
-/****************************************************************/
-
-/* 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
-*/
-
-
-/*--------------------------------------------------------------*/
-/* User exit function */
-/*--------------------------------------------------------------*/
-
-void byebye(void *arg)
-{
- grx_close();
- cprintf("Bye Bye!\n");
-}
-
-/*--------------------------------------------------------------*/
-/* Main task */
-/*--------------------------------------------------------------*/
-
-
-/****************************** MAIN ******************************/
-
-int main(int argc, char **argv)
-{
- char c = 0; /* character from keyboard */
-
- /* Set the closing function */
- sys_atrunlevel(byebye, NULL, RUNLEVEL_BEFORE_EXIT);
-
- /* graphic card Initialization */
- if (grx_init() < 1) {
- sys_abort(1);
- }
-
- if (grx_open(640, 480, 8) < 0) {
- cprintf("GRX Err\n");
- sys_abort(1);
- }
-
- grx_clear(BLACK);
-
- grx_text("Press a key [1-4]", 10, 16, 7, 0);
- grx_text("to create a pair", 10, 24, 7, 0);
- grx_text("ESC to exit demo", 10, 48, 7, 0);
-
- while (c != 27) {
- c = keyb_getch(BLOCK);
- if ((c >= '1') && (c <= '1'+NCAB-1))
- create_channel(c-'1');
- }
-
- sys_end();
-
- return 0;
-}
-
-
-/*--------------------------------------------------------------*/
-/* write data in a cab */
-/*--------------------------------------------------------------*/
-
-TASK producer(void *arg)
-{
-int i = (int)arg;
-char c; /* message character */
-char *p; /* pointer to a cab buffer */
-char s[2]; /* string to display */
-int k = 0;
-int x, y;
-int col = 13;
-int ybase = YY + i*DELTA;
-
- x = X1;
- y = ybase;
- s[1] = 0;
-
- k = 0;
- while (1) {
- c = 'A' + k;
- p = cab_reserve(cid[i]);
- *p = c;
- cab_putmes(cid[i], p);
-
- s[0] = c;
- k = (k + 1) % NCAR;
- grx_text(s,x,y,col,0);
-
- x += 8;
- if (x >= (X1 + NCAR*8)) {
- x = X1;
- y = y + 8;
- if (y >= ybase+16) {
- y = ybase;
- col = col % 15 + 1;
- }
- }
-
- task_endcycle();
- }
-}
-
-/*--------------------------------------------------------------*/
-/* read data from a cab */
-/*--------------------------------------------------------------*/
-
-TASK consumer(void *arg)
-{
-int i = (int)arg;
-char *p;
-char s[2];
-int x, y;
-int col = 13;
-int ybase = YY + i*DELTA;
-
- x = X2;
- y = ybase;
- s[1] = 0;
-
- while (1) {
- p = cab_getmes(cid[i]);
- s[0] = *p - 'A' + 'a';
- cab_unget(cid[i], p);
-
- grx_text(s,x,y,col,0);
- x += 8;
-
- if (x >= (X2 + NCAR*8)) {
- x = X2;
- y = y + 8;
- if (y >= ybase+16) {
- y = ybase;
- col = col % 15 + 1;
- }
- }
- task_endcycle();
- }
-}
-
-/*--------------------------------------------------------------*/
-/* create the two tasks and a channel */
-/*--------------------------------------------------------------*/
-
-void create_channel(int i)
-{
- HARD_TASK_MODEL m;
-
- draw_channel(i);
- cid[i] = cab_create(cname[i], 1, 2);
-
- hard_task_default_model(m);
- hard_task_def_ctrl_jet (m);
- hard_task_def_arg (m, (void *)i);
- hard_task_def_wcet (m, w1[i]);
- hard_task_def_mit (m, t1[i]);
- hard_task_def_usemath (m);
- p1[i] = task_create(pname1[i], producer, &m, NULL);
- if (p1[i] == NIL) {
- grx_close();
- perror("Could not create task <producer>");
- sys_abort(1);
- }
- task_activate(p1[i]);
-
- hard_task_default_model(m);
- hard_task_def_ctrl_jet (m);
- hard_task_def_arg (m, (void *)i);
- hard_task_def_wcet (m, w2[i]);
- hard_task_def_mit (m, t2[i]);
- hard_task_def_usemath (m);
- p2[i] = task_create(pname2[i], consumer, &m, NULL);
- if (p2[i] == NIL) {
- grx_close();
- perror("Could not create task <consumer>");
- sys_abort(1);
- }
- task_activate(p2[i]);
-}
-
-/*--------------------------------------------------------------*/
-/* Disegna i processi e il canale di comunicazione */
-/*--------------------------------------------------------------*/
-
-void draw_channel(int i)
-{
-char buffer[32]; /* buffer per sprintf */
-int yc = YP + i*DELTA; /* altezza del canale */
-
- grx_circle(XP1,yc,R,2);
- grx_text("P1",XP1-8,yc-4,12,0);
-
- grx_circle(XP2,yc,R,2);
- grx_text("P2",XP2-8,yc-4,12,0);
-
- grx_rect(XC,yc-R,XC+L,yc+R,3);
- grx_text("CAB",XC+16,yc-4,12,0);
-
- grx_line(XP1+R,yc,XC,yc,4);
- grx_line(XC+L,yc,XP2-R,yc,4);
-
- grx_text("T1 = ms",X1+40,yc+R+16,14,0);
- sprintf(buffer,"%ld", t1[i]);
- grx_text(buffer,X1+88,yc+R+16,14,0);
-
- grx_text("T2 = ms",X2+40,yc+R+16,14,0);
- sprintf(buffer,"%ld", t2[i]);
- grx_text(buffer,X2+88,yc+R+16,14,0);
-}
-
-/*--------------------------------------------------------------*/
-
Index: rel_1_2/base/iaster1.c
===================================================================
--- rel_1_2/base/iaster1.c (revision 1198)
+++ rel_1_2/base/iaster1.c (nonexistent)
@@ -1,99 +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: iaster1.c,v 1.2 2003-04-15 10:21:22 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.2 $
- Last update: $Date: 2003-04-15 10:21:22 $
- ------------
-
- System initialization file
-
- The tick is set to TICK ms.
-
- This file contains the 2 functions needed to initialize the system.
-
- These functions register the following levels:
-
- an EDF (Earliest Deadline First) level
- a RR (Round Robin) level
- a Dummy level
-
- It can accept these task models (into () the mandatory fields):
-
- HARD_TASK_MODEL (wcet+mit) at level 0
- NRT_TASK_MODEL at level 1
-
-**/
-
-/*
- * Copyright (C) 2000 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-
-
-#include "kernel/kern.h"
-#include "modules/edf.h"
-#include "modules/rr.h"
-#include "modules/dummy.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);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
Index: rel_1_2/base/srpdemo.c
===================================================================
--- rel_1_2/base/srpdemo.c (revision 1198)
+++ rel_1_2/base/srpdemo.c (nonexistent)
@@ -1,246 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * 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
- *
- *
- * CVS : $Id: srpdemo.c,v 1.2 2003-01-07 17:10:16 pj Exp $
-
- This test verify the correctness of the SRP module.
-
- There are 3 taks, Jh, Jm, Jl that uses 3 mutexes m1, m2, m3
-
- the main task (NRT) creates the three tasks.
-
- Jh with preemption level 3
- starts at t=1.5 sec and lock m3, lock m1, unlock m1, unlock m3
-
- Jm with preemption level 2
- starts at t=0.5 sec and lock m3, lock m2, unlock m2, unlock m3
- then lock and unlock m1
-
- Jl with preemption level 1
- it starts and locks m2
- at t=1 sec it locks m1
- at t=1.5 sec it unlocks m1
- then it unlocks m2, and finally it locks and unlocks m3
-
-
- The example is similar to the scheduling diagram shown at p. 210 of the
- book "Sistemi in tempo Reale", by Giorgio Buttazzo, Pitagora Editrice
-
-*/
-
-#include "kernel/kern.h"
-#include "drivers/keyb.h"
-
-#include "modules/srp.h"
-
-mutex_t m1,m2,m3;
-
-void startJ(void *a)
-{
- task_activate((PID)a);
-}
-
-TASK Jlobby()
-{
- cprintf("(*) JLobby!!!\n");
- return 0;
-}
-
-TASK Jh()
-{
- PID l;
- HARD_TASK_MODEL m;
- SRP_RES_MODEL r;
-
- cprintf("JH: creating Jy before locking m3\n");
-
- hard_task_default_model(m);
- hard_task_def_mit(m,30000);
- hard_task_def_wcet(m,1000);
- SRP_res_default_model(r,4);
- l = task_create("Jlobby",Jlobby,&m,&r);
- task_activate(l);
-
- mutex_lock(&m3);
- cprintf("JH: locked m3, locking m1\n");
- mutex_lock(&m1);
- cprintf("JH: locked m1, unlocking m1\n");
- mutex_unlock(&m1);
- cprintf("JH: unlocked m1, unlocking m3\n");
- mutex_unlock(&m3);
- cprintf("JH: unlocked m3, end task\n");
- return 0;
-}
-
-
-TASK Jm()
-{
- cprintf("JM: before locking m3\n");
- mutex_lock(&m3);
- cprintf("JM: locked m3, locking m2\n");
- mutex_lock(&m2);
- cprintf("JM: locked m2, unlocking m2\n");
- mutex_unlock(&m2);
- cprintf("JM: unlocked m2, unlocking m3\n");
- mutex_unlock(&m3);
- cprintf("JM: unlocked m3, locking m1\n");
- mutex_lock(&m1);
- cprintf("JM: locked m1, unlocking m1\n");
- mutex_unlock(&m1);
- cprintf("JM: unlocked m1, end task\n");
- return 0;
-}
-
-
-TASK Jl()
-{
- cprintf("JL: before locking m2\n");
- mutex_lock(&m2);
- cprintf("JL: locked m2, waiting to t=1 sec\n");
-
- while (sys_gettime(NULL) < 1000000);
-
- cprintf("JL: t = 1 sec reached, locking m1\n");
- mutex_lock(&m1);
- cprintf("JL: locked m1, waiting to t=2 sec\n");
-
- while (sys_gettime(NULL) < 2000000);
-
- cprintf("JL: t = 2 sec reached, unlocking m1\n");
- mutex_unlock(&m1);
- cprintf("JL: unlocked m1, unlocking m2\n");
-
- mutex_unlock(&m2);
-
- cprintf("JL: unlocked m2, locking m3\n");
- mutex_lock(&m3);
- cprintf("JL: locked m3, unlocking m3\n");
- mutex_unlock(&m3);
- cprintf("JL: unlocked m3, end task\n");
- return 0;
-}
-
-void fine(KEY_EVT *e)
-{
- sys_end();
-}
-
-
-int main(int argc, char **argv)
-{
- struct timespec t;
-
- HARD_TASK_MODEL m;
- PID p0,p1,p2;
-
- SRP_mutexattr_t a;
- SRP_RES_MODEL r;
-
- PI_mutexattr_t a2;
-
- KEY_EVT emerg;
-
- clear();
-
- cprintf("Stack resource Policy demo. Press Alt-X to exit the demo\n");
-
- //keyb_set_map(itaMap);
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTL_BIT;
- keyb_hook(emerg,fine);
-
- /* ---------------------------------------------------------------------
- Mutex creation
- --------------------------------------------------------------------- */
-
- PI_mutexattr_default(a2);
- SRP_mutexattr_default(a);
- mutex_init(&m1,&a);
- mutex_init(&m2,&a);
- mutex_init(&m3,&a);
-
-
- /* ---------------------------------------------------------------------
- Task creation
- --------------------------------------------------------------------- */
-
- hard_task_default_model(m);
- hard_task_def_mit(m, 1000000);
- hard_task_def_wcet(m, 80000);
- SRP_res_default_model(r, 3);
- p0 = task_createn("JH", Jh, (TASK_MODEL *)&m, &r, SRP_usemutex(&m3), SRP_usemutex(&m1), NULL);
- if (p0 == NIL)
- { cprintf("Can't create JH task...\n"); return 1; }
-
- hard_task_default_model(m);
- hard_task_def_mit(m, 2100000);
- hard_task_def_wcet(m, 80000);
- SRP_res_default_model(r, 2);
- p1 = task_createn("JM", Jm, (TASK_MODEL *)&m, &r, SRP_usemutex(&m3), SRP_usemutex(&m1),
- SRP_usemutex(&m2), NULL);
- if (p1 == NIL)
- { cprintf("Can't create JM task...\n"); return 1; }
-
- hard_task_default_model(m);
- hard_task_def_mit(m, 10000000);
- hard_task_def_wcet(m, 3000000);
- SRP_res_default_model(r, 1);
- p2 = task_createn("JL", Jl, (TASK_MODEL *)&m, &r, SRP_usemutex(&m3), SRP_usemutex(&m1),
- SRP_usemutex(&m2), NULL);
- if (p2 == NIL)
- { cprintf("Can't create JL task...\n"); return 1; }
-
- /* ---------------------------------------------------------------------
- Event post
- --------------------------------------------------------------------- */
-
- t.tv_sec = 0;
- t.tv_nsec = 500000000;
-
- kern_cli();
- kern_event_post(&t,startJ,(void *)p1);
-
- t.tv_sec = 1;
- kern_event_post(&t,startJ,(void *)p0);
- kern_sti();
-
- task_activate(p2);
-
- cprintf("END main\n");
-
- return 0;
-}
Index: rel_1_2/base/imdemo.c
===================================================================
--- rel_1_2/base/imdemo.c (revision 1198)
+++ rel_1_2/base/imdemo.c (nonexistent)
@@ -1,99 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 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
- *
- *
- * CVS : $Id: imdemo.c,v 1.1 2002-11-11 08:22:45 pj Exp $
-**/
-
-#include "kernel/kern.h"
-#include "modules/edf.h"
-#include "modules/cbs.h"
-#include "modules/rr.h"
-#include "modules/dummy.h"
-
-#include "modules/sem.h"
-#include "modules/hartport.h"
-#include "modules/cabs.h"
-#include "modules/pi.h"
-#include "modules/pc.h"
-#include "modules/srp.h"
-#include "modules/npp.h"
-#include "modules/nop.h"
-
-#include "drivers/keyb.h"
-
-
-/*+ sysyem tick in us +*/
-//#define TICK 1000
-#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);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- CBS_register_level(CBS_ENABLE_ALL, 0);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- PI_register_module();
- PC_register_module();
- NPP_register_module();
- SRP_register_module();
- NOP_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- KEYB_init(NULL);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
Index: rel_1_2/base/iaster3.c
===================================================================
--- rel_1_2/base/iaster3.c (revision 1198)
+++ rel_1_2/base/iaster3.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>
- * (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: iaster3.c,v 1.1 2002-10-28 08:13:37 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2002-10-28 08:13:37 $
- ------------
-
- System initialization file
-
- The tick is set to TICK ms.
-
- This file contains the 2 functions needed to initialize the system.
-
- These functions register the following levels:
-
- an EDF (Earliest Deadline First) level
- a RR (Round Robin) level
- a TBS (Total Bandwidth Server) level 0.1 Us
- a TBS (Total Bandwidth Server) level 0.3 Us
- a Dummy level
-
- The TBS bandwidth is TBS_NUM/TBS_DEN
-
-
- It can accept these task models (into () the mandatory fields):
-
- HARD_TASK_MODEL (wcet+mit) at level 0
- NRT_TASK_MODEL at level 1
- SOFT_TASK_MODEL (wcet, periodicity=APERIODIC) at level 2,3
-
-**/
-
-/*
- * 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/rr.h"
-#include "modules/tbs.h"
-#include "modules/dummy.h"
-#include "drivers/keyb.h"
-
-
-/*+ sysyem tick in us +*/
-#define TICK 1200
-
-#define RRTICK 5000
-#define TBS_NUM 1
-#define TBS_DEN 10
-
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- EDF_register_level(EDF_ENABLE_ALL);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- TBS_register_level(TBS_ENABLE_ALL, 0, TBS_NUM, TBS_DEN);
- TBS_register_level(TBS_ENABLE_ALL, 0, TBS_NUM*3, TBS_DEN);
- dummy_register_level();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
Index: rel_1_2/base/ego.c
===================================================================
--- rel_1_2/base/ego.c (revision 1198)
+++ rel_1_2/base/ego.c (nonexistent)
@@ -1,240 +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: ego.c,v 1.3 2003-01-07 17:10:15 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.3 $
- Last update: $Date: 2003-01-07 17:10:15 $
- ------------
-**/
-
-/*
- * 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 <kernel/kern.h>
-#include <drivers/glib.h>
-#include <drivers/keyb.h>
-
-#include <semaphore.h>
-
-#define X0 10
-
-/* task periods */
-#define PERIOD_T1 100000
-#define PERIOD_T2 200000
-#define PERIOD_T3 300000
-
-/* X position of the text printed by each task */
-int y[3] = {100, 180, 260};
-
-/* text printed by each task */
-char talk[3][50] = { "I am ego1 and I print a character every 100 ms",
- "I am ego2 and I print a character every 200 ms",
- "I am ego3 and I print a character every 300 ms"};
-
-/* A semaphore used to access Video Cards in mutual exclusion */
-sem_t mutex;
-
-/***************************************************************/
-
-TASK ego(void *arg)
-{
-int i = (int)arg;
-int leng;
-char s[2];
-int x;
-int j = 0;
-
- /* compute the length of the string to print */
- leng = 0;
- while (talk[i][leng] != 0) leng++;
-
- x = X0;
- s[1] = 0;
- task_endcycle();
-
- while (1) {
- s[0] = talk[i][j];
- sem_wait(&mutex);
- /* grx_text("TEST", 100,100,12,0); */
- grx_text(s,x,y[i],12+i,0);
- sem_post(&mutex);
- x += 8;
- if (++j == leng) {
- j = 0;
- x = X0;
- y[i] += 8;
- if (y[i]>340) y[i]=100;
- }
- task_endcycle();
- }
-}
-
-
-/****************************************************************/
-
-/* 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();
- cprintf("Bye Bye!\n");
-}
-
-/****************************** MAIN ******************************/
-
-int main(int argc, char **argv)
-{
- PID pid1, pid2, pid3;
- KEY_EVT emerg;
- HARD_TASK_MODEL m1, m2, m3;
-
- /* Set the closing function */
- sys_atrunlevel(byebye, NULL, RUNLEVEL_BEFORE_EXIT);
-
- /* 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) {
- cprintf("GRX Err\n");
- sys_abort(1);
- }
-
- /* set the keyboard handler to exit correctly */
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTL_BIT;
- keyb_hook(emerg,my_end);
-
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTR_BIT;
- keyb_hook(emerg,my_end);
-
- /* a small banner */
- grx_text("EGO Test",8,8,WHITE,0);
- grx_text("Press Alt-X to exit",8,16,WHITE,0);
-
- /* ego1 creation */
- hard_task_default_model(m1);
- hard_task_def_ctrl_jet (m1);
- hard_task_def_arg (m1, (void *)0);
- hard_task_def_wcet (m1, 5000);
- hard_task_def_mit (m1, PERIOD_T1);
- hard_task_def_group (m1,1);
- pid1 = task_create("ego1", ego, &m1, NULL);
- if (pid1 == NIL) {
- grx_close();
- perror("Could not create task <ego1>");
- sys_abort(1);
- }
-
- /* ego2 creation */
- hard_task_default_model(m2);
- hard_task_def_ctrl_jet (m2);
- hard_task_def_arg (m2, (void *)1);
- hard_task_def_wcet (m2, 5000);
- hard_task_def_mit (m2, PERIOD_T2);
- hard_task_def_group (m2,1);
- pid2 = task_create("ego2", ego, &m2, NULL);
- if (pid2 == NIL) {
- grx_close();
- perror("Could not create task <ego2>");
- sys_abort(1);
- }
-
- /* ego3 creation */
- hard_task_default_model(m3);
- hard_task_def_ctrl_jet (m3);
- hard_task_def_arg (m3, (void *)2);
- hard_task_def_wcet (m3, 5000);
- hard_task_def_mit (m3, PERIOD_T3);
- hard_task_def_group (m3,1);
- pid3 = task_create("ego3", ego, &m3, NULL);
- if (pid3 == NIL) {
- grx_close();
- perror("Could not create task <ego3>");
- sys_abort(1);
- }
-
- /* and finally we activate the three threads... */
- group_activate(1);
-
- /*
- now the task main ends, but the system does not shutdown because
- there are the three task ego1, ego2, and ego3 running.
-
- The demo will finish if a Alt-X key is pressed.
- */
-
- return 0;
-}
-
-/****************************************************************/
Index: rel_1_2/base/iaster4.c
===================================================================
--- rel_1_2/base/iaster4.c (revision 1198)
+++ rel_1_2/base/iaster4.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: iaster4.c,v 1.1 2002-11-11 08:22:45 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2002-11-11 08:22:45 $
- ------------
-
- System initialization file
-
- The tick is set to TICK ms.
-
- This file contains the 2 functions needed to initialize the system.
-
- These functions register the following levels:
-
- an EDF (Earliest Deadline First) level
- a RR (Round Robin) level
- a TBS (Total Bandwidth Server) level 0.1 Us
- a TBS (Total Bandwidth Server) level 0.3 Us
- a CBS (Constant Bandwidth Server) level
- a Dummy level
-
- The TBS bandwidth is TBS_NUM/TBS_DEN
-
-
- It can accept these task models (into () the mandatory fields):
-
- HARD_TASK_MODEL (wcet+mit) at level 0
- NRT_TASK_MODEL at level 1
- SOFT_TASK_MODEL (wcet, periodicity=APERIODIC) at level 2,3
- SOFT_TASK_MODEL (met,period) at level 4
-
-**/
-
-/*
- * 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/rr.h"
-#include "modules/tbs.h"
-#include "modules/cbs.h"
-#include "modules/rrsoft.h"
-#include "modules/dummy.h"
-#include "drivers/keyb.h"
-#include "modules/sem.h"
-#include "modules/hartport.h"
-
-/*+ sysyem tick in us +*/
-//#define TICK 300
-#define TICK 0
-
-#define RRTICK 5000
-#define TBS_NUM 1
-#define TBS_DEN 10
-
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- EDF_register_level(EDF_ENABLE_ALL);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- TBS_register_level(TBS_ENABLE_ALL, 0, TBS_NUM, TBS_DEN);
- TBS_register_level(TBS_ENABLE_ALL, 0, TBS_NUM*3, TBS_DEN);
- CBS_register_level(CBS_ENABLE_ALL, 0);
-
-/* RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD);
- RR_register_level(RRTICK, RR_MAIN_NO, mb);
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_SOFT); //cbs
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_SOFT); //tbs
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_SOFT); //tbs
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
-*/
-
- dummy_register_level();
-
- SEM_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- KEYB_init(NULL);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
Index: rel_1_2/base/preempt.c
===================================================================
--- rel_1_2/base/preempt.c (revision 1198)
+++ rel_1_2/base/preempt.c (nonexistent)
@@ -1,149 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 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
- *
- *
- * CVS : $Id: preempt.c,v 1.2 2003-01-07 17:10:15 pj Exp $
-
- CBS test with preemption disabling
-
-*/
-
-#include "kernel/kern.h"
-
-void *periodic(void *arg)
-{
- int i;
- int y = (int)arg;
-
- for (i = 19; i < 60; i++) {
- puts_xy(i,y,7,"*");
-
- task_endcycle();
- }
-
- cprintf("Periodic: Task %d end.\n", exec_shadow);
-
- return 0;
-}
-
-void *blocker(void *arg)
-{
- struct timespec t;
-
- task_nopreempt();
- cprintf("Blocker: Task nopreempt\n");
-
- do {
- sys_gettime(&t);
- } while (t.tv_sec < 5);
-
- cprintf("Blocker: Task preempt\n");
- task_preempt();
-
- cprintf("Blocker: end\n");
-
- return 0;
-}
-
-
-
-int main(int argc, char **argv)
-{
- struct timespec t;
- NRT_TASK_MODEL m;
- SOFT_TASK_MODEL m_aper;
- PID p;
-
- clear();
- cprintf("Preemption Test.\n");
- cprintf("Start time: two periodic tasks and a blocker are created and activated.\n");
- cprintf("2 seconds : blocker calls task_nopreempt.\n");
- cprintf("5 seconds : task_preempt is called.\n");
- cprintf(" The blocked task exec its pending activations.\n");
- cprintf("10 seconds: the test stops.\n");
- puts_xy(1,20,7,"save task:");
- puts_xy(1,21,7,"skip task:");
-
- nrt_task_default_model(m);
-
- soft_task_default_model(m_aper);
- soft_task_def_met(m_aper,10000);
- soft_task_def_period(m_aper,200000);
- soft_task_def_group(m_aper,1);
- soft_task_def_arg(m_aper, (void *)20);
- soft_task_def_periodic(m_aper);
-
- p = task_create("save", periodic, &m_aper, NULL);
- if (p == NIL)
- {
- perror("Can't create save task...\n");
- sys_end();
- }
-
- soft_task_def_skip_arrivals(m_aper);
- soft_task_def_arg(m_aper, (void *)21);
-
- p = task_create("skip", periodic, &m_aper, NULL);
- if (p == NIL)
- {
- perror("Can't create skip task...\n");
- sys_end();
- }
-
- p = task_create("blocker", blocker, &m, NULL);
- if (p == NIL)
- {
- perror("Can't create blocker task...\n");
- sys_end();
- }
-
- cprintf("main : save & skip tasks activated.\n");
- group_activate(1);
-
- do {
- sys_gettime(&t);
- } while (t.tv_sec < 2);
-
- cprintf("main : blocker activated.\n");
- task_activate(p);
-
- do {
- sys_gettime(&t);
- } while (t.tv_sec < 10);
-
- cprintf("main : End!!!\n");
-
- return 0;
-}
Index: rel_1_2/base/ihello.c
===================================================================
--- rel_1_2/base/ihello.c (revision 1198)
+++ rel_1_2/base/ihello.c (nonexistent)
@@ -1,95 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: ihello.c,v 1.1 2002-10-28 08:13:37 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2002-10-28 08:13:37 $
- ------------
-
- The simplest initialization file
-
- The tick is set to TICK ms.
-
- This file contains the 2 functions needed to initialize the system.
-
- These functions register the following levels:
-
- a RR (Round Robin) level
- a Dummy level
-
- It can accept these task models:
-
- NRT_TASK_MODEL at level 0
-
-**/
-
-/*
- * Copyright (C) 2000 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-
-
-#include "kernel/kern.h"
-#include "modules/rr.h"
-#include "modules/dummy.h"
-
-
-/*+ sysyem tick in us +*/
-#define TICK 300
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
Index: rel_1_2/base/iaster6.c
===================================================================
--- rel_1_2/base/iaster6.c (revision 1198)
+++ rel_1_2/base/iaster6.c (nonexistent)
@@ -1,130 +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: iaster6.c,v 1.1 2002-11-11 08:22:45 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2002-11-11 08:22:45 $
- ------------
-
- System initialization file
-
- h3pips.c
-
- These functions register the following levels:
-
- an EDF (Earliest Deadline First) level
- a RR (Round Robin) level
- a CBS (Costant Bandwidth Server) level
- a PS (Polling Server) level
- a Dummy level
-
- It can accept these task models:
-
- HARD_TASK_MODEL (wcet+mit) at level 0
- NRT_TASK_MODEL at level 1
- SOFT_TASK_MODEL (met, period) at level 2
- SOFT_TASK_MODEL (periodicity=APERIODIC) at level 3
-
-**/
-
-/*
- * 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/ps.h"
-
-#include "modules/sem.h"
-#include "modules/hartport.h"
-#include "modules/cabs.h"
-#include "modules/pi.h"
-#include "modules/pc.h"
-#include "modules/srp.h"
-#include "modules/npp.h"
-#include "modules/nop.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);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- CBS_register_level(CBS_ENABLE_ALL, 0);
- PS_register_level(2 /*PS_ENABLE_ALL_EDF*/,0,500,100000);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- PI_register_module();
- PC_register_module();
- NPP_register_module();
- SRP_register_module();
- NOP_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- KEYB_init(NULL);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
Index: rel_1_2/base/iaster7.c
===================================================================
--- rel_1_2/base/iaster7.c (revision 1198)
+++ rel_1_2/base/iaster7.c (nonexistent)
@@ -1,144 +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: iaster7.c,v 1.1 2002-11-11 08:22:45 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2002-11-11 08:22:45 $
- ------------
-
- System initialization file
-
- The tick is set to TICK ms.
-
- This file contains the 2 functions needed to initialize the system.
-
- These functions register a set of scheduling modules, in a fixed or
- dynamic priority way...
-
- It can accept these task models:
-
- HARD_TASK_MODEL (wcet+mit) at level 0
- SOFT_TASK_MODEL (periodicity=APERIODIC) at level 1
- NRT_TASK_MODEL at level 2
- SOFT_TASK_MODEL (periodicity=APERIODIC, wcet (only if TBS) ) at level 3,4
-
-**/
-
-/*
- * 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/tbs.h"
-
-#include "modules/rm.h"
-#include "modules/rr.h"
-#include "modules/ps.h"
-
-#include "modules/dummy.h"
-
-#include "modules/sem.h"
-#include "modules/hartport.h"
-
-#include "drivers/keyb.h"
-
-#include <ll/stdio.h>
-
-
-/*+ sysyem tick in us +*/
-#define TICK 300
-
-#define RRTICK 5000
-
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
-// EDF_register_level(EDF_ENABLE_ALL);
-// PS_register_level(2 /*PS_ENABLE_ALL_EDF*/,0,1000,100000);
-// RR_register_level(RRTICK, RR_MAIN_YES, mb);
-// TBS_register_level(TBS_ENABLE_ALL, 0, 1, 10);
-// PS_register_level(2,0,3000,10000);
-// TBS_register_level(TBS_ENABLE_ALL, 0, 3, 10);
-
-
- RM_register_level(RM_ENABLE_ALL);
- PS_register_level(PS_ENABLE_ALL_RM,0,1000,100000);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- PS_register_level(4,0,10000,100000);
- PS_register_level(4,0,30000,100000);
-
-
-
- dummy_register_level();
-
- SEM_register_module();
-
- return TICK;
-}
-
-SOFT_TASK_MODEL m;
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
- KEYB_PARMS k = BASE_KEYB;
-
- soft_task_default_model(m);
- soft_task_def_wcet(m,2000);
- soft_task_def_met(m,800);
- soft_task_def_period(m,25000);
- soft_task_def_system(m);
- soft_task_def_nokill(m);
- soft_task_def_aperiodic(m);
- soft_task_def_level(m,4);
- keyb_def_task(k,&m);
-
- HARTPORT_init();
-
- if (KEYB_init(&k) < 0)
- cprintf("Error during the init of the Keyboard!!!");
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
Index: rel_1_2/base/aster.c
===================================================================
--- rel_1_2/base/aster.c (revision 1198)
+++ rel_1_2/base/aster.c (nonexistent)
@@ -1,413 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Paolo Gai, Gerardo Lamastra and Giuseppe Lipari
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * CVS : $Id: aster.c,v 1.2 2003-01-07 17:10:15 pj Exp $
-
- Author: Gerardo Lamastra
- Giuseppe Lipari
- Date: 1/10/96
-
- File: Aster.C
- Revision: 1.6
-
-*/
-
-/*
- Well, this is only a stupid demo which intend to show many
- HARTIK+ capabilities; the application is structured in the followig
- way: there is an ASTER task wich randomly creates some ASTEROID tasks
- which are displayed into the first window; each task is HARD/PERIODIC
- and auto-kills itself when it reaches the window end!
- An other couple of tasks, TITLE & PUT give an example of port
- communication facility; the server task creates the port, the client
- task connect to it and uses the server to accomplish some stuff.
- Port can be declared READ/WRITE and can model ONE-TO-ONE communication
- or MANY-TO-ONE communication.
- Finally a second couple of tasks realizes a communiation through CABs;
- each time a key is pressed, the ascii code is posted into the CAB by the
- CCC task while the second task, WRITE, displays it on the screen and
- perform other silly actions.
- Finally a CLOCK task is implemented to test system clock.
- Please note that usually the HARTIK+ application is made up of a task
- group which interacts among them, while the main() function, which
- became a task itself when the kernel is activated, is suspended until
- the system is ready to terminate; the MAIN task can also be used to make
- other background activities, but it should not be killed; when the
- application terminates, the control is passed to MAIN which kills
- everybody, shut down the system and can handle other operations using
- the services available with the previou operating system (I.E. the DOS).
- If you need to manage sudden abort/exception you should install your own
- exception handler and raise it through the exc_raise() primitive to
- make the system abort safely!
- Remember that the exit functions posted through sys_atexit() will be
- executed in both cases, to allow clean system shutdown.
-*/
-
-//#include <string.h>
-//#include <stdlib.h>
-
-#include <kernel/kern.h>
-#include <modules/sem.h>
-#include <modules/hartport.h>
-#include <modules/cabs.h>
-#include <drivers/keyb.h>
-#include <string.h>
-
-
-#define __VPAGING__
-
-#include <drivers/keyb.h>
-#include <drivers/crtwin.h>
-
-int num_aster = 0;
-#define ASTER_LIM 67
-
-CAB cc;
-BYTE esc = FALSE;
-
-TASK asteroide(void)
-{
- int i = 1;
- int y = rand() % 7 + 1;
- while (i < ASTER_LIM) {
- puts_xy(i,y,WHITE,"*");
- task_endcycle();
-
- puts_xy(i,y,WHITE," ");
- i++;
- }
- num_aster--;
- return 0;
-}
-
-DWORD taskCreated = 0;
-
-TASK aster(void)
-{
- PID p;
- SOFT_TASK_MODEL m_soft;
- int r;
- WIN w;
-
- win_init(&w,0,0,ASTER_LIM,8);
- win_frame(&w,BLACK,WHITE,"Asteroids",2);
-
- soft_task_default_model(m_soft);
- soft_task_def_met(m_soft,2000);
- soft_task_def_ctrl_jet(m_soft);
-
- srand(7);
- while (1) {
- if (num_aster < 5) {
- r = (rand() % 50) - 25;
- soft_task_def_arg(m_soft,(void *)((rand() % 7)+1));
- soft_task_def_period(m_soft,(50 + r)*1000);
- p = task_create("aaa",asteroide,(TASK_MODEL *)&m_soft,NULL);
- taskCreated++;
- task_activate(p);
- num_aster++;
- }
-
- task_endcycle();
- }
-}
-
-TASK clock()
-{
- WIN w;
- int s = 0, m = 0;
-
- win_init(&w,68,0,11,2);
- win_frame(&w,BLACK,WHITE,"Clk",1);
-
- while(1) {
- printf_xy(70,1,WHITE,"%2d : %2d",m,s);
- task_endcycle();
-
- if (++s > 59) {
- s = 0;
- m++;
- }
- printf_xy(70,1,WHITE,"%2d : %2d",m,s);
- task_endcycle();
- }
-}
-
-TASK title()
-{
- PORT t;
- WIN w;
- int i,pos = 77;
- char msg[85],tmp[85],ss[2];
- BYTE c;
-
- win_init(&w,0,9,79,2);
- win_frame(&w,BLACK,WHITE,"Title",2);
-
- for (i=0; i < 77; i++) msg[i] = ' ';
- msg[77] = 0;
-
- t = port_connect("title",1,STREAM,READ);
-
- while (1) {
- port_receive(t,&c,BLOCK);
- ss[0] = c;
- ss[1] = 0;
- strcat(msg,ss);
- puts_xy(1,10,WHITE,msg);
- pos++;
- if (pos > 77) {
- strcpy(tmp,&(msg[1]));
- tmp[pos-1] = 0;
- pos -= 1;
- strcpy(msg,tmp);
- }
- task_endcycle();
- }
-}
-
-#define STR "..................... Hartik+ ....................."\
- " Guarantees hard tasks "\
- " Includes soft periodic tasks "\
- "TB server for decrementing the aperiodic response time "\
- "SRP for both hard & soft aperiodic tasks "\
- "Portability toward other compilers/system "\
- "Support for different C compiler: Watcom C 16 bit & 32 bit"\
- " -- GNU C (32 bit) -- Borland C (16 bit) -- MS C (16 bit)"\
- " "\
- "Programmers : Gerardo Lamastra (lamastra@sssup2.sssup.it) "\
- " Giuseppe Lipari (lipari@sssup2.sssup.it) "\
- "Alpha AXP PCI-33 porting by Antonino Casile "\
- "(casile@sssup1.sssup.it) "\
- "Research coordinator: Giorgio Buttazzo (giorgio@sssup1.sssup.it)"\
- " "\
- " "\
- " "
-
-static char GreetMsg[1600];
-
-TASK put(void)
-{
- PORT p;
-
- strcpy(GreetMsg,STR);
-
- p = port_create("title",strlen(GreetMsg),1,STREAM,WRITE);
- while(1) {
- port_send(p,GreetMsg,BLOCK);
- task_endcycle();
- }
-}
-
-TASK ccc(void)
-{
- WIN w;
- char *m;
-
- win_init(&w,68,3,10,3);
- win_frame(&w,BLACK,WHITE,"CCC",2);
- puts_xy(70,4,WHITE,"Cab");
-
- while(1) {
- m = cab_getmes(cc);
- puts_xy(72,5,WHITE,m);
- cab_unget(cc,m);
- task_endcycle();
- }
-}
-
-
-TASK write_keyb()
-{
- BYTE c;
- char *msg;
-
- while (1) {
- c = keyb_getchar();
- if (c == ESC) {
- esc = TRUE;
- task_endcycle();
- }
- else {
-#ifdef __VPAGING__
- if (c == 's') {
- if (get_visual_page() == 0) set_visual_page(1);
- else if (get_visual_page() == 1) set_visual_page(0);
- }
-#endif
- msg = cab_reserve(cc);
- msg[0] = c;
- msg[1] = 0;
- cab_putmes(cc,msg);
- }
- }
-}
-
-#define DELTA 200000.0
-double carico(double rif,BYTE init)
-{
- double i;
- DWORD t1 = 0,t2 = 1000;
- double u;
-
- i = 0.0;
- do {
- i += 1;
- } while (i <= DELTA);
-
- u = i / ((double) (t2 - t1));
-
- if (init) return u;
- else return (1.0 - u/rif);
-}
-
-void my_end(KEY_EVT *e)
-{
- set_active_page(0);
- set_visual_page(0);
- cprintf("Ctrl-Brk pressed!\n");
- sys_end();
-}
-
-int main(int argc, char **argv)
-{
- PID p1,p2,p3,p4,p5,p6;
-
- HARD_TASK_MODEL m_per;
- SOFT_TASK_MODEL m_soft;
- NRT_TASK_MODEL m_nrt;
-
- KEY_EVT emerg;
- // double rif;
- struct timespec t;
-
- //keyb_set_map(itaMap);
- emerg.ascii = 'x';
- emerg.scan = KEY_X;
- emerg.flag = ALTL_BIT;
- keyb_hook(emerg,my_end);
-
-#ifdef __VPAGING__
- set_active_page(1);
- set_visual_page(1);
-#endif
-
-
- CRSR_OFF();
- clear();
- puts_xy(0,20,WHITE,"Press ESC to exit demo.");
- cc = cab_create("Cab",2,2);
-
- soft_task_default_model(m_soft);
- soft_task_def_period(m_soft,500000);
- soft_task_def_met(m_soft,1000);
- soft_task_def_group(m_soft, 1);
- p1 = task_create("Aster",aster,&m_soft,NULL);
- if (p1 == -1) {
- perror("Aster.C(main): Could not create task <aster>");
- sys_abort(-1);
- }
-
- hard_task_default_model(m_per);
- hard_task_def_mit(m_per,500000);
- hard_task_def_wcet(m_per,1000);
- hard_task_def_group(m_per, 1);
- p2 = task_create("Clock",clock,&m_per,NULL);
- if (p2 == -1) {
- perror("Aster.C(main): Could not create task <Clock>");
- sys_abort(-1);
- }
-
- soft_task_def_period(m_soft, 50000);
- p3 = task_create("Title",title,&m_soft, NULL);
- if (p3 == -1) {
- perror("Aster.C(main): Could not create task <Title>");
- sys_abort(-1);
- }
-
- soft_task_def_period(m_soft, 1000000);
- p4 = task_create("Put",put,&m_soft, NULL);
- if (p4 == -1) {
- perror("Aster.C(main): Could not create task <Put>");
- sys_abort(-1);
- }
-
- nrt_task_default_model(m_nrt);
- nrt_task_def_group(m_nrt, 1);
- p5 = task_create("Write",write_keyb,&m_nrt,NULL);
- if (p5 == -1) {
- perror("Aster.C(main): Could not create task <Write>");
- sys_abort(-1);
- }
-
- hard_task_def_mit(m_per, 50000);
- p6 = task_create("CabTask",ccc,&m_per,NULL);
- if (p6 == -1) {
- perror("Aster.C(main): Could not create task <CabTask>\n");
- sys_abort(-1);
- }
-
- /*
- task_activate(p1);
- task_activate(p2);
- task_activate(p3);
- task_activate(p4);
- task_activate(p5);
- task_activate(p6);
- */
- group_activate(1);
-
- while (!esc) {
- sys_gettime(&t);
- printf_xy(0,21,WHITE,"Clock : %-9ds %-9dns",(int)t.tv_sec, (int)t.tv_nsec);
- }
-
- group_kill(1);
- clear();
- CRSR_STD();
-#ifdef __VPAGING__
- set_active_page(0);
- set_visual_page(0);
-#endif
- cprintf("System closed\n");
- sys_end();
- /*
- sys_status(NORM_STATUS|BLOCKED_STATUS|SLEEP_STATUS|IDLE_STATUS);
- sys_status(NORM_STATUS|SLEEP_STATUS);
- */
- return 0;
-}
-
Index: rel_1_2/base/iaster8.c
===================================================================
--- rel_1_2/base/iaster8.c (revision 1198)
+++ rel_1_2/base/iaster8.c (nonexistent)
@@ -1,128 +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: iaster8.c,v 1.1 2002-11-11 08:22:45 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2002-11-11 08:22:45 $
- ------------
-
- System initialization file
-
- h3piss.c
-
- These functions register the following levels:
-
- an EDF (Earliest Deadline First) level
- a CBS (Costant Bandwidth Server) level
- a SS (Sporadic Server) level
- a RR (Round Robin) 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
- SOFT_TASK_MODEL (periodicity=APERIODIC) at level 2
- NRT_TASK_MODEL at level 3
-
-**/
-
-/*
- * 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/rm.h"
-#include "modules/edf.h"
-#include "modules/cbs.h"
-#include "modules/rr.h"
-#include "modules/dummy.h"
-#include "modules/ss.h"
-
-#include "modules/sem.h"
-#include "modules/hartport.h"
-#include "modules/cabs.h"
-#include "modules/pi.h"
-#include "modules/pc.h"
-#include "modules/srp.h"
-#include "modules/npp.h"
-#include "modules/nop.h"
-
-#include "drivers/keyb.h"
-
-
-/*+ system 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);
- SS_register_level(SS_ENABLE_GUARANTEE_EDF,0,5000,20000);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- PC_register_module();
- PI_register_module();
- NPP_register_module();
- SRP_register_module();
- NOP_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
- KEYB_init(NULL);
- __call_main__(mb);
- return (void *)0;
-}
-
Index: rel_1_2/base/pcidemo.c
===================================================================
--- rel_1_2/base/pcidemo.c (revision 1198)
+++ rel_1_2/base/pcidemo.c (nonexistent)
@@ -1,86 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Paolo Gai, Luca Abeni
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * CVS : $Id: pcidemo.c,v 1.1 2002-11-11 08:22:46 pj Exp $
-
- This is the pcitest Hartik's example.
-
-*/
-
-#include "kernel/kern.h"
-#include "drivers/keyb.h"
-
-#include "drivers/llpci.h"
-#include "drivers/pci.h"
-
-void scan()
-{
- BYTE bus, dev;
-
- /* Scan the devices connected to the PCI bus */
- if (pci_init() == 1) {
- clear();
- pci_show();
- bus = 0; dev = 0;
- if (pcibios_find_device(0x8086, 0x7000, 0, &bus, &dev) == NULL)
- cprintf("Not found... %d %d\n", bus, dev);
- else cprintf("Found: %d \t %d\n", bus, dev);
-
- if (pcibios_find_class(0x300, 0, &bus, &dev) == NULL)
- cprintf("Not found... %d %d\n", bus, dev);
- else cprintf("Found: %d \t %d\n", bus, dev);
- } else cprintf("PCI not found!!!\n");
-}
-
-void endfun(KEY_EVT *k)
-{
- sys_end();
-}
-
-int main (int argc, char *argv[])
-{
- KEY_EVT k;
-
- k.flag = CNTR_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- keyb_hook(k,endfun);
-
- scan();
-
- sys_end();
- return 0;
-}
Index: rel_1_2/base/sig.c
===================================================================
--- rel_1_2/base/sig.c (revision 1198)
+++ rel_1_2/base/sig.c (nonexistent)
@@ -1,168 +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: sig.c,v 1.3 2003-01-07 17:10:15 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.3 $
- Last update: $Date: 2003-01-07 17:10:15 $
- ------------
-**/
-
-/*
- * 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
- *
- */
-
-/*
- Test Number 5:
-
- this test is a simple main() function with one other task
-
- This test can be useful to test functions like:
-
- sys_gettime
- sigemptyset
- sigaddset
- hartik_deliver_pending_signals
- sys_end
- task_sigmask
- sigaction
- sigqueue
- task_signal
-*/
-
-#include "kernel/kern.h"
-
-
-TASK goofy(void *arg)
-{
- struct timespec t;
-
- cprintf("Goofy: waiting 2 secs...\n");
-
- do {
- sys_gettime(&t);
- } while (t.tv_sec < 2); // wait until 2 sec
-
- cprintf("Goofy: ok, I'm ready :-)\n");
-
- return 0;
-}
-
-void catchit_RT(int signo, siginfo_t *info, void *extra)
-{
- cprintf("RT signal: Current Running Task = %d signo=%d code=%d value=%d from pid=%d\n",
- exec_shadow,
- info->si_signo, info->si_code,
- info->si_value.sival_int, info->si_task);
-}
-
-void catchit(int signo)
-{
- cprintf("RT signal: Current Running Task = %d signo=%d\n",
- exec_shadow, signo);
-}
-
-int main(int argc, char **argv)
-{
- struct timespec t;
- NRT_TASK_MODEL m;
- PID p2;
-
- sigset_t newmask;
- sigset_t oldmask;
- struct sigaction action;
- union sigval sval;
-
- clear();
-
- /* Set the signal action */
- action.sa_flags = SA_SIGINFO;
- action.sa_sigaction = catchit_RT;
- action.sa_handler = 0;
- action.sa_mask = 0;
-
- if (sigaction(SIGUSR1, &action, NULL) == -1) {
- perror("Error using sigaction.");
- return -1;
- }
-
- action.sa_flags = 0;
- action.sa_handler = (void (*)(int))catchit;
-
- if (sigaction(SIGILL, &action, NULL) == -1) {
- perror("Error using sigaction.");
- return -1;
- }
-
- /* create another task */
- nrt_task_default_model(m);
- nrt_task_def_group(m,1);
-
- p2 = task_create("goofy", goofy, &m, NULL);
- if (p2 == NIL)
- {
- cprintf("Can't create goofy task...\n");
- return 1;
- }
-
- group_activate(1);
-
- /* block the signal for the main task */
- sigemptyset(&newmask);
- sigaddset(&newmask,SIGUSR1);
- task_sigmask(SIG_BLOCK, &newmask, &oldmask); // pthread_sigmask
-
- cprintf("main: Sending 2 signals ...\n");
-
- sval.sival_int = 123;
- sigqueue(0,SIGUSR1,sval);
- sval.sival_int = 999;
- sigqueue(0,SIGUSR1,sval);
-
- cprintf("main: Now sending a signal to myself,"
- " then wait until 4 secs...\n");
-
- task_signal(0 /* main */, SIGILL); // pthread_kill
-
- NULL_TIMESPEC(&t);
- do {
- sys_gettime(&t);
- } while (t.tv_sec < 4); // wait until 4 s
-
- cprintf("main: ending...\n");
-
- return 0;
-}
Index: rel_1_2/base/keycode.c
===================================================================
--- rel_1_2/base/keycode.c (revision 1198)
+++ rel_1_2/base/keycode.c (nonexistent)
@@ -1,80 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Giorgio Buttazzo, Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * CVS : $Id: keycode.c,v 1.1 2002-11-11 08:22:46 pj Exp $
- */
-
-#include <kernel/kern.h>
-#include <drivers/keyb.h>
-
-int main(int argc, char **argv)
-{
- KEY_EVT k;
-
- clear();
- k.ascii = 0;
-
- cprintf("Press ESC to end the demo, 2 for itamap, 3 for engmap\n");
- while (k.ascii != ESC) {
- keyb_getcode(&k,BLOCK);
- if (k.ascii == '2') {
- keyb_set_map(itaMap);
- cprintf("\nItalian Keymap set\n");
- }
- if (k.ascii == '3') {
- keyb_set_map(engMap);
- cprintf("\nEnglish Keymap set\n");
- }
- if (isLeftCtrl(k)) putc_xy(72+0,0,RED,'L');
- else putc_xy(72+0,0,RED,' ');
- if (isRightCtrl(k)) putc_xy(72+1,0,RED,'R');
- else putc_xy(72+1,0,RED,' ');
- if (isLeftAlt(k)) putc_xy(72+2,0,GREEN,'L');
- else putc_xy(72+2,0,RED,' ');
- if (isRightAlt(k)) putc_xy(72+3,0,GREEN,'R');
- else putc_xy(72+3,0,RED,' ');
- if (isLeftShift(k)) putc_xy(72+4,0,YELLOW,'L');
- else putc_xy(72+4,0,RED,' ');
- if (isRightShift(k)) putc_xy(72+5,0,YELLOW,'R');
- else putc_xy(72+5,0,RED,' ');
-
- cprintf("%d [%c]\t",k.scan,k.ascii);
-
- }
-
- sys_end();
- return 0;
-}
Index: rel_1_2/kalm3d/carrello.c
===================================================================
--- rel_1_2/kalm3d/carrello.c (revision 1198)
+++ rel_1_2/kalm3d/carrello.c (nonexistent)
@@ -1,198 +0,0 @@
-#include <math.h>
-
-#include <modules/hartport.h>
-#include <kernel/kern.h>
-#include <kernel/func.h>
-#include <ll/i386/x-dos.h>
-
-#include "drivers/pclab.h"
-
-#include "const.h"
-
-float vmax = 0.0, vmin = 0.0, vmaxth = 0.0, vminth = 0.0;
-
-int da_motor(float v)
-{
-
- da_conv( 2.5 , 2 );
- da_conv( v + 2.5 , 1 );
-
- return(0);
-
-}
-
-float v2x(float v)
-{
- float x;
-
- x= LUNGH * (v-(vmax+vmin)/2 ) / (vmax-vmin);
-
- return x;
-
-}
-
-float v2theta(float v)
-{
- float theta;
-
- theta=2.0*(THETAMAX/FCA) * (v-(vmaxth+vminth)/2 ) / (vmaxth-vminth);
-
- return theta;
-
-}
-
-float bass1(float u)
-{
- float y;
- static float oldy=0;
-
- y=(oldy + prm.WCUT * DEADSECX(PERIOD_CARRELLO) *u)/(1+ prm.WCUT * DEADSECX(PERIOD_CARRELLO));
- oldy=y;
-
- return y;
-
-}
-
-float bass2(float u)
-{
- float y;
- static float oldy=0;
-
- y=(oldy + prm.WCUT1 * DEADSECX(PERIOD_CARRELLO) *u)/(1+ prm.WCUT1 * DEADSECX(PERIOD_CARRELLO));
- oldy=y;
-
- return y;
-
-}
-
-float bass3(float u)
-{
- float y;
- static float oldy=0;
-
- y=(oldy + prm.WCUT * DEADSECTH(PERIOD_CARRELLO) *u)/(1+ prm.WCUT * DEADSECTH(PERIOD_CARRELLO));
- oldy=y;
-
- return y;
-
-}
-
-float bass4(float u)
-{
- float y;
- static float oldy=0;
-
- y=(oldy + prm.WCUT1 * DEADSECTH(PERIOD_CARRELLO) *u)/(1+ prm.WCUT1 * DEADSECTH(PERIOD_CARRELLO));
- oldy=y;
-
- return y;
-
-}
-
-float dx(float u)
-{
- static float oldu=0;
- float y;
-
- y=(u-oldu)/DEADSECX(PERIOD_CARRELLO);
- oldu=u;
-
- return y;
-
-}
-
-float dth(float u)
-{
- static float oldu=0;
- float y;
-
- y=(u-oldu)/DEADSECTH(PERIOD_CARRELLO);
- oldu=u;
-
- return y;
-
-}
-
-TASK carrello(void)
-{
- float y[2]={0,0}, yp[2]={0,0};
- PORT px, pth;
-
- float th_input = 0.0,arr_th_input[AVR],th_eff,av_th_input;
- float x_input = 0.0,arr_x_input[AVR],x_eff,av_x_input;
-
- int flag_th=1,flag_x=1,index_th=0,index_x=0;
-
- int i;
- float offset,vout,vout_total;
-
- px = port_create("porta1",sizeof(float),1,STICK,WRITE);
- pth = port_create("porta2",sizeof(float),1,STICK,WRITE);
-
- while (1) {
-
- task_nopreempt();
- th_input=ad_conv(10);
- task_preempt();
-
- if(flag_th==1) {
- for(i=0; i<AVR;++i) arr_th_input[i] = th_input;
- flag_th=0;
- }
- av_th_input=0;
- for(i=0;i<AVR;++i) av_th_input += arr_th_input[i];
- av_th_input /= AVR ;
-
- if(fabs(th_input-av_th_input)>=prm.NOISE) th_input=av_th_input;
-
- arr_th_input[index_th]=th_input;
- index_th = (index_th+1) % AVR ;
-
- th_eff = v2theta(th_input);
- y[1] = bass3(th_eff);
- yp[1] = bass4(dth(y[1]));
-
- task_nopreempt();
- x_input=ad_conv(11);
- task_preempt();
-
- if(flag_x==1) {
- for(i=0; i<AVR;++i) arr_x_input[i] = x_input;
- flag_x=0;
- }
- av_x_input=0;
- for(i=0;i<AVR;++i) av_x_input += arr_x_input[i];
- av_x_input /= AVR;
- if(fabs(x_input-av_x_input)>=prm.NOISE) x_input = av_x_input;
-
- arr_x_input[index_x] = x_input;
- index_x = (index_x+1) % AVR ;
-
- x_eff = v2x(x_input);
- y[0] = bass1(x_eff);
- yp[0] = bass2(dx(y[0]));
-
- vout = prm.COST * (prm.GUAD[0] * (y[0]-v2x((vmax+vmin)/2)) + prm.GUAD[1] * th_eff\
- + prm.GUAD[2] * yp[0] + prm.GUAD[3] * yp[1]);
-
- if(vout >= 0) offset=prm.OFFSVAL;
- else offset=-prm.OFFSVAL;
-
- vout_total = vout + offset;
-
- if(vout_total >= VDANG ) vout_total = VDANG ;
- if(vout_total <= -VDANG ) vout_total = -VDANG ;
-
- da_motor(vout_total);
-
- port_send(px, &y[0], NON_BLOCK);
- port_send(pth, &y[1], NON_BLOCK);
-
- task_endcycle();
-
- }
-
- port_delete(px);
- port_delete(pth);
-
-} /* FINE DEL TASK CARRELLO */
Index: rel_1_2/kalm3d/initfile.c
===================================================================
--- rel_1_2/kalm3d/initfile.c (revision 1198)
+++ rel_1_2/kalm3d/initfile.c (nonexistent)
@@ -1,120 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- ------------
- CVS : $Id: initfile.c,v 1.1 2003-03-13 13:11:40 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2003-03-13 13:11:40 $
- ------------
-
- 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/kalm3d/readme.txt
===================================================================
--- rel_1_2/kalm3d/readme.txt (revision 1198)
+++ rel_1_2/kalm3d/readme.txt (nonexistent)
@@ -1,51 +0,0 @@
---------------------------------------
-Inverted Pendulum Demo with Mesa
-
-by
-
-Giacomo Guidi <giacomo@gandalf.sssup.it>
-
-Last update 17/03/2003
---------------------------------------
-
-This is the old Inverted Pendulum control
-demo rewrited usigng the Mesa support
-
-The demo needs a PCL812 card present and
-the inv.pendulum hardware
-
-The graphic cards actually supported are:
-
-GEFORCE TNT TNT2 - driver name NV3
-RAGE128 RADEON - driver name R128
-SAVAGE VIRGE - driver neme SAVAGE
-
---------------------------------------
-
-The demo is composed by:
-
-MAKEFILE The makefile used to compile the application
-README.TXT This file
-INITFILE.C The init file
-KALM3D.C The Inv.Pendulum Demo
-CARRELLO.C The control task
-
---------------------------------------
-
-- To specify your card change the line
-
-#define CARD <driver name>
-
-- The demo calls the grx and off-screen Mesa functions.
-The resolution must be 16 bitsperpixel (64K colors) and
-the graphic access mode must be linear.
-
-- There are two buffers
-
- The video buffer (video_buf)
- The virtual buffer (rgb_565_buf)
-
- copy_videomem_16to16 links these buffers
-
-
-
Index: rel_1_2/kalm3d/const.h
===================================================================
--- rel_1_2/kalm3d/const.h (revision 1198)
+++ rel_1_2/kalm3d/const.h (nonexistent)
@@ -1,36 +0,0 @@
-#ifndef __CONST__
-#define __CONST__
-
-extern unsigned long int PERIOD_CARRELLO;
-extern unsigned long int PERIOD_DISEGNA;
-
-#define DEADSECX(x) (x * 1.0e-6 )
-#define DEADSECTH(x) (x * 1.0e-6 )
-
-#define PARAM {{ 1. , 300 , 0.79 , 23 },0.70 ,2.5 ,20.,20., 0.1, 1 , 1, 0.}
-
-#define LUNGH 35.0
-#define THETAMAX 45.0
-#define FCA 57.29578
-#define AVR 10
-#define VDANG 2.4
-#define NMAX 300
-#define SEC_ID 7.0
-#define MAXRUN_ID 9 //16
-
-struct Parametri{
- float GUAD[4];
- float COST;
- float NOISE;
- float WCUT;
- float WCUT1;
- float OFFSVAL;
- int DEADLINE;
- int SCAN;
- float XTRASL;
-};
-
-extern struct Parametri prm;
-extern float vmax, vmin, vmaxth, vminth;
-
-#endif
Index: rel_1_2/kalm3d/kalm3d.c
===================================================================
--- rel_1_2/kalm3d/kalm3d.c (revision 1198)
+++ rel_1_2/kalm3d/kalm3d.c (nonexistent)
@@ -1,454 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Giacomo Guidi <giacomo@gandalf.sssup.it>
- *
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-#include <ll/i386/defs.h>
-
-#include <drivers/vga.h>
-#include <drivers/pclab.h>
-
-#include <math.h>
-#include <stdlib.h>
-#include <kernel/log.h>
-#include <GL/osmesa.h>
-#include <GL/glut.h>
-
-#include <modules/hartport.h>
-#include <kernel/kern.h>
-#include <kernel/func.h>
-#include <ll/i386/x-dos.h>
-#include <drivers/keyb.h>
-
-#include "const.h"
-
-#define WIDTH 640
-#define HEIGHT 480
-#define BYTES_PP 2
-#define INITSTR G640x480x64K
-#define CARD SAVAGE
-
-unsigned long int PERIOD_CARRELLO = 10000;
-unsigned long int PERIOD_DISEGNA = 80000;
-struct Parametri prm=PARAM;
-
-unsigned long int WCET_CARRELLO, WCET_DISEGNA;
-
-TASK carrello(void *);
-
-PID carrello_PID, disegna_PID;
-
-unsigned char *buffers = NULL;
-unsigned char *vbuf = NULL;
-OSMesaContext ctx;
-
-static GLfloat view_rotx = 170.0, view_roty = -200.0, view_rotz = 0.0;
-static GLfloat angle;
-
-GLUquadricObj *quadratic;
-
-static GLfloat SUP_W = 110.0;
-static GLfloat SUP_P = 30.0;
-
-extern void da_motor(float v);
-
-#ifndef M_PI
-#define M_PI 3.14159265
-#endif
-
-void program_end(void)
-{
-
- da_motor(0.0);
-
- OSMesaDestroyContext(ctx);
- free(buffers);
-
- vga_setmode(TEXT,CARD);
-
- sys_end();
-
-}
-
-void program_key_end(KEY_EVT *k)
-{
-
- sys_end();
-
-}
-
-static void draw_box(GLfloat p1x, GLfloat p1y ,GLfloat p1z, GLfloat p2x, GLfloat p2y, GLfloat p2z) {
-
- glBegin(GL_QUADS);
-
- // Front Face
- glVertex3f(p1x, p1y, p1z);
- glVertex3f(p2x, p1y, p1z);
- glVertex3f(p2x, p2y, p1z);
- glVertex3f(p1x, p2y, p1z);
-
- // Back Face
- glVertex3f(p1x, p1y, p2z);
- glVertex3f(p1x, p2y, p2z);
- glVertex3f(p2x, p2y, p2z);
- glVertex3f(p2x, p1y, p2z);
-
- // Top Face
- glVertex3f(p1x, p2y, p2z);
- glVertex3f(p1x, p2y, p1z);
- glVertex3f(p2x, p2y, p1z);
- glVertex3f(p2x, p2y, p2z);
-
- // Bottom Face
- glVertex3f(p1x, p1y, p2z);
- glVertex3f(p2x, p1y, p2z);
- glVertex3f(p2x, p1y, p1z);
- glVertex3f(p1x, p1y, p1z);
-
- // Right face
- glVertex3f(p2x, p1y, p2z);
- glVertex3f(p2x, p2y, p2z);
- glVertex3f(p2x, p2y, p1z);
- glVertex3f(p2x, p1y, p1z);
-
- // Left Face
- glVertex3f(p1x, p1y, p2z);
- glVertex3f(p1x, p1y, p1z);
- glVertex3f(p1x, p2y, p1z);
- glVertex3f(p1x, p2y, p2z);
-
- glEnd();
-
-}
-
-static void draw_carrello(GLfloat x_scene, GLfloat angle_scene) {
-
- static GLfloat gl_white[3] = {1.0f, 1.0f, 1.0f};
- static GLfloat gl_dark_gray[3] = {0.3f, 0.3f, 0.3f};
- static GLfloat gl_gray[3] = {0.7f, 0.7f, 0.7f};
-
- glPushMatrix();
-
- glColor3fv(gl_dark_gray);
-
- glShadeModel(GL_FLAT);
-
- glTranslatef(x_scene, 0.0f, 0.0f);
-
- draw_box(-6.0f, -6.0f, 9.0f, 6.0f, -2.0f, -9.0f);
- draw_box(-6.0f, -2.0f, 9.0f, 6.0f, -1.0f, 4.0f);
-
- glColor3fv(gl_white);
-
- draw_box(-8.0f, -2.0f, -3.0f, 8.0f, -1.0f, -10.0f);
-
- glColor3fv(gl_dark_gray);
-
- draw_box(-5.0f, 1.0f, 8.0f, 5.0f, 9.0f, 6.0f);
- draw_box(-5.0f,1.0f,-6.0f,5.0f,9.0f,-8.0f);
- draw_box(-5.0f,-1.0f,8.0f,5.0f,1.0f,-8.0f);
-
- glShadeModel(GL_SMOOTH);
-
- glColor3fv(gl_white);
-
- glTranslatef(0.0f, 4.5f, -6.0f);
- gluCylinder(quadratic, 2.2f, 2.2f, 12.0f, 16, 16);
-
- glColor3fv(gl_gray);
-
- glTranslatef(0.0f, 0.0f, 6.0f);
- glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
- glRotatef(angle_scene, 0.0f, 1.0f, 0.0f);
- gluCylinder(quadratic, 1.3f, 1.3f, 160.0f, 16, 16);
- glRotatef(-angle_scene, 0.0f, 1.0f, 0.0f);
- glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
-
- glTranslatef(-4.0f, -2.5f, -6.0f);
- gluCylinder(quadratic, 0.5f, 0.5f, 12.0f, 16, 16);
-
- glTranslatef(8.0f, 0.0f, 0.0f);
- gluCylinder(quadratic, 0.5f, 0.5f, 12.0f, 16, 16);
-
- glPopMatrix();
-
-}
-
-static void draw_support() {
-
- static GLfloat gl_dark_gray[3] = {0.3f, 0.3f, 0.3f};
- static GLfloat gl_gray[3] = {0.7f, 0.7f, 0.7f};
-
- glPushMatrix();
-
- glColor3fv(gl_gray);
-
- glShadeModel(GL_FLAT);
-
- draw_box(-SUP_W/2, -0.1f, SUP_P/2, SUP_W/2, 0.1f, -SUP_P/2);
-
- glColor3fv(gl_dark_gray);
-
- draw_box(-SUP_W/2-3.0f, -0.1f, SUP_P/2, -SUP_W/2, 14.0f, -SUP_P/2-0.2f);
- draw_box(SUP_W/2, -0.1f, SUP_P/2, SUP_W/2+3.0f, 14.0f, -SUP_P/2-0.2f);
-
- glShadeModel(GL_SMOOTH);
-
- glColor3fv(gl_gray);
-
- glTranslatef(-SUP_W/2, 6.0f, 0.0f);
- glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
- gluCylinder(quadratic, 1.5f, 1.5f, SUP_W, 16, 16);
-
- glPopMatrix();
-
-}
-
-static void draw(GLfloat prm_x, GLfloat prm_th)
-{
-
- prm_x = -prm_x / LUNGH * (SUP_W-20.0f);
- prm_th = -prm_th * FCA;
-
- glPushMatrix();
-
- glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
- glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
- glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glRotatef(angle, 0.0f, 1.0f, 0.0f);
-
- draw_support();
- glTranslatef(0.0f, 10.0f, -4.0f);
- draw_carrello(prm_x,prm_th);
-
- glPopMatrix();
-
- glFinish();
-
-}
-
-static void init_gl()
-{
-
- static GLfloat pos0[4] = {40.0f, -70.0f, 180.0f, 1.0f};
-
- glClearColor(0.8f, 0.8f, 0.8f, 1.0f);
-
- glLightfv(GL_LIGHT0, GL_POSITION, pos0);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_CULL_FACE);
-
- glViewport(0, 0, (GLint) WIDTH, (GLint) HEIGHT);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(45.0f,(GLfloat)WIDTH/(GLfloat)HEIGHT,0.1f,250.0f);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0f, 30.0f, -120.0f);
-
- glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
-
- quadratic=gluNewQuadric();
-
- glEnable(GL_AUTO_NORMAL);
- glEnable(GL_COLOR_MATERIAL);
- glEnable(GL_NORMALIZE);
- glDepthFunc(GL_LEQUAL);
-
-}
-
-TASK disegna(void)
-{
-
- PORT pr_x, pr_th;
- float prm_x, prm_th;
-
- char text[100];
- TIME disegna_TIME, carrello_TIME;
-
- static unsigned long int count = WIDTH * HEIGHT / 2;
-
- pr_x = port_connect("porta1",sizeof(float),STICK,READ);
- pr_th = port_connect("porta2",sizeof(float),STICK,READ);
-
- //vbuf = malloc(WIDTH * HEIGHT * 2); //Debug line
-
- while(1) {
-
- port_receive(pr_x, &prm_x, BLOCK);
- port_receive(pr_th, &prm_th, BLOCK);
-
- angle += 0.2;
-
- draw(prm_x,prm_th);
-
- jet_gettable(carrello_PID, &carrello_TIME, 1);
- jet_gettable(disegna_PID, &disegna_TIME, 1);
-
- sprintf(text,"Hard Task Control PER:%6d us EX:%6d us",(int)PERIOD_CARRELLO,(int)carrello_TIME);
- grx_text(text,10,5,rgb16(0,0,255),rgb16(255,255,255));
- sprintf(text,"Hard Task Draw PER:%6d us EX:%6d us",(int)PERIOD_DISEGNA,(int)disegna_TIME);
- grx_text(text,10,15,rgb16(0,0,255),rgb16(255,255,255));
-
- copy_videomem_16to16(buffers,vbuf,count);
-
- task_endcycle();
-
- }
-
- port_disconnect(pr_x);
- port_disconnect(pr_th);
-
- sys_end();
-
-}
-
-static void screen(int mode)
-{
- vga_modeinfo *minf;
- int mem;
-
- 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;
- }
- 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;
- }
-
- mem = minf->linewidth*minf->height;
-
- vbuf = vga_getgraphmem();
- printk(KERN_INFO "Memory mapped to %08x. Mode = %d.\n",(int) vbuf,mode);
- memset(vbuf,0,mem);
-
-}
-
-void waitenter() {
-
- KEY_EVT k;
- char esc = FALSE;
-
- while(!esc) {
- keyb_getcode(&k,BLOCK);
- if (k.ascii == 13) esc = TRUE;
- }
-
-}
-
-
-void init_motor(void)
-{
-
- da_motor(0.0);
-
- cprintf("Calibrazione pendolo inverso...\n");
-
- cprintf("Carr a sx e premi enter\n");
- waitenter();
- vmin=ad_conv(11);
-
- cprintf("Carr a dx e premi enter\n");
- waitenter();
- vmax=ad_conv(11);
-
- cprintf("Asta a sx e premi enter\n");
- waitenter();
- vminth=ad_conv(10);
-
- cprintf("Asta a dx e premi enter\n");
- waitenter();
- vmaxth=ad_conv(10);
-
- cprintf("Vxmax:%f Vxmin:%f Vthmax:%f Vthmin:%f\n",vmax,vmin,vmaxth,vminth);
- waitenter();
-
-}
-
-int main (int argc, char *argv[])
-{
- HARD_TASK_MODEL ht_carrello, ht_disegna;
-
- WCET_CARRELLO =((long int) PERIOD_CARRELLO * (0.05));
- WCET_DISEGNA =((long int) PERIOD_DISEGNA * (0.875));
-
- clear();
-
- sys_atrunlevel((void *) program_end,NULL, RUNLEVEL_BEFORE_EXIT);
-
- hard_task_default_model(ht_carrello);
- hard_task_def_wcet(ht_carrello,WCET_CARRELLO);
- hard_task_def_mit(ht_carrello,PERIOD_CARRELLO);
- hard_task_def_usemath(ht_carrello);
- hard_task_def_group(ht_carrello,1);
- hard_task_def_ctrl_jet(ht_carrello);
-
- carrello_PID = task_create("carrello", carrello, &ht_carrello, NULL);
- if (carrello_PID == -1) {
- sys_end();
- exit(4);
- }
-
- hard_task_default_model(ht_disegna);
- hard_task_def_mit(ht_disegna,PERIOD_DISEGNA);
- hard_task_def_wcet(ht_disegna,WCET_DISEGNA);
- hard_task_def_group(ht_disegna,1);
- hard_task_def_ctrl_jet(ht_disegna);
- hard_task_def_usemath(ht_disegna);
- hard_task_def_stack(ht_disegna,60000);
-
- disegna_PID = task_create("disegna", disegna, &ht_disegna, NULL);
- if (disegna_PID == -1) {
- sys_end();
- exit(4);
- }
-
- {
- KEY_EVT k;
- k.flag = ALTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- keyb_hook(k,program_key_end);
- }
-
- init_motor();
-
- screen(INITSTR);
-
- ctx = OSMesaCreateContext(OSMESA_RGB_565, NULL );
- buffers = malloc(WIDTH * HEIGHT * 2);
-
- grx_setbuffer(buffers, WIDTH, HEIGHT);
- OSMesaMakeCurrent(ctx, buffers, GL_UNSIGNED_SHORT_5_6_5, WIDTH, HEIGHT);
-
- init_gl();
-
- group_activate(1);
-
- return 0;
-
-}
Index: rel_1_2/kalm3d/makefile
===================================================================
--- rel_1_2/kalm3d/makefile (revision 1198)
+++ rel_1_2/kalm3d/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = kalm3d
-
-include $(BASE)/config/example.mk
-
-kalm3d:
- make -f $(SUBMAKE) APP=kalm3d INIT= OTHEROBJS="initfile.o carrello.o" SHARKOPT="__OSMESA__ __PCLAB__ __OLDCHAR__ __SVGA__"
-
Index: rel_1_2/readme.txt
===================================================================
--- rel_1_2/readme.txt (revision 1198)
+++ rel_1_2/readme.txt (nonexistent)
@@ -1,7 +0,0 @@
-Hi, these are the S.Ha.R.K. demos...
-
-the old examples directory is now called demos/oldexamples...
-
-Enjoy
-
-PJ
Index: rel_1_2/advtimer/readme.txt
===================================================================
--- rel_1_2/advtimer/readme.txt (revision 1198)
+++ rel_1_2/advtimer/readme.txt (nonexistent)
@@ -1,39 +0,0 @@
---------------------------------------
-Advanced Timer Demo
-
-by
-
-Giacomo Guidi <giacomo@gandalf.sssup.it>
-
-Last update 23/04/2003
---------------------------------------
-
-This demo shows the new timer management
-code of S.Ha.R.K.
-
---------------------------------------
-
-The demo is composed by:
-
-MAKEFILE The makefile used to compile the application
-README.TXT This file
-INITFILE.C The init file
-ADVTIMER.C The Advanced Timer Demo
-
---------------------------------------
-
-To change the timer mode, you have to
-modify two global variable in:
-
-oslib/kl/advtimer.c
-
-use_tsc (BOOL)
-use_cmos (BOOL)
-
-and to recompile.
-
-The default setting is
-
-use_tsc = 1;
-use_cmos = 0;
-
Index: rel_1_2/advtimer/advtimer.c
===================================================================
--- rel_1_2/advtimer/advtimer.c (revision 1198)
+++ rel_1_2/advtimer/advtimer.c (nonexistent)
@@ -1,189 +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
- */
-
-/*
- * Advanced Timer Demo
- *
- */
-
-#include "kernel/kern.h"
-#include "ll/i386/cons.h"
-
-#include "ll/i386/advtimer.h"
-
-#include "drivers/keyb.h"
-
-#define UPDATE_PERIOD 10000
-#define UPDATE_WCET 1000
-
-extern signed long long clk_per_msec;
-
-extern signed long last_delta_clk_per_msec;
-extern signed long total_delta_clk_per_msec;
-
-extern unsigned char use_tsc;
-extern unsigned char use_cmos;
-
-void program_key_end(KEY_EVT *k)
-{
-
- sys_end();
-
-}
-
-TASK Update(void *arg)
-{
- struct timespec actual_timer;
-
- long nsec,sec,min,hrs,day;
- long mean_delay,tot_delay,num_delay;
- long total_percent;
-
- signed long long start,end,res;
- struct timespec s_test,startts,endts;
-
- task_nopreempt();
-
- num_delay = tot_delay = mean_delay = 0;
-
- while (1) {
-
- if (clk_per_msec != 0) {
-
- rdtscll(start);
- sys_gettime(&actual_timer);
- rdtscll(end);
- res = end - start;
- rdtscll(start);
- rdtscll(end);
- res -= (end - start);
- s_test.tv_nsec = res * 1000000 / clk_per_msec;
-
-
- } else {
-
- sys_gettime(&startts);
- sys_gettime(&actual_timer);
- sys_gettime(&endts);
- SUBTIMESPEC(&endts,&startts,&s_test);
- sys_gettime(&startts);
- sys_gettime(&endts);
- SUBTIMESPEC(&endts,&startts,&endts);
- SUBTIMESPEC(&s_test,&endts,&s_test);
-
- }
-
- if (tot_delay < 1000000000) {
- tot_delay += s_test.tv_nsec;
- num_delay ++;
- mean_delay = tot_delay / num_delay;
- }
-
- nsec = actual_timer.tv_nsec;
- sec = actual_timer.tv_sec;
- min = sec / 60;
- sec %= 60;
- hrs = min / 60;
- min %= 60;
- day = hrs / 24;
- hrs %= 24;
-
- if (use_tsc)
- if (use_cmos)
- printf_xy(0,4,WHITE,"Timer Mode: TSC + CMOS");
- else
- printf_xy(0,4,WHITE,"Timer Mode: TSC");
- else
- printf_xy(0,4,WHITE,"Timer Mode: 8254");
-
- printf_xy(0,5,WHITE,"Actual Clk/msec: %12ld",(long)clk_per_msec);
- printf_xy(0,6,WHITE,"Actual Timer: %2ld d %2ld h %2ld m %2ld s %12ld ns",day,hrs,min,sec,(long)nsec);
-
- printf_xy(0,8,WHITE,"CMOS Adjustement setting");
- printf_xy(0,9,WHITE,"CMOS last delta Clk/msec: %12ld",(long)last_delta_clk_per_msec);
-
- if (total_delta_clk_per_msec != 0)
- total_percent = clk_per_msec / abs(total_delta_clk_per_msec);
- else
- total_percent = 0;
-
- printf_xy(0,10,WHITE,"CMOS total delta Clk/msec: %12ld (1/%ld)",(long)total_delta_clk_per_msec,total_percent);
-
- printf_xy(0,12,WHITE,"Timer Access Delay: %12ld ns",mean_delay);
-
- task_endcycle();
-
- }
-
- sys_end();
-
-}
-
-void set_screen()
-{
-
- printf_xy(20,0,WHITE," Advanced Timer Demo ");
- printf_xy(20,1,WHITE,"Giacomo Guidi <giacomo@gandalf.sssup.it>");
- printf_xy(20,2,WHITE," Press Alt + c to exit ");
-
-}
-
-
-int main(int argc, char **argv)
-{
-
- HARD_TASK_MODEL mp; //Show current setting
- PID update;
- KEY_EVT k;
-
- k.flag = ALTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- keyb_hook(k,program_key_end);
-
- set_screen();
-
- hard_task_default_model(mp);
- hard_task_def_ctrl_jet(mp);
- hard_task_def_group(mp, 1);
- hard_task_def_wcet(mp,UPDATE_WCET);
- hard_task_def_mit(mp,UPDATE_PERIOD);
- hard_task_def_usemath(mp);
- update = task_create("Update", Update, &mp, NULL);
- if (update != NIL) task_activate(update);
-
- return 0;
-
-}
Index: rel_1_2/advtimer/makefile
===================================================================
--- rel_1_2/advtimer/makefile (revision 1198)
+++ rel_1_2/advtimer/makefile (nonexistent)
@@ -1,18 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = advtimer
-
-include $(BASE)/config/example.mk
-
-# Text applications
-advtimer:
- make -f $(SUBMAKE) APP=advtimer INIT= OTHEROBJS="initfile.o" SHARKOPT="__OLDCHAR__"
-
-
Index: rel_1_2/advtimer/initfile.c
===================================================================
--- rel_1_2/advtimer/initfile.c (revision 1198)
+++ rel_1_2/advtimer/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-04-23 09:15:48 giacomo Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2003-04-23 09:15:48 $
- ------------
-
- 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_def_map(kparms,itaMap);
- KEYB_init(&kparms);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
Index: rel_1_2/base_cpp/hello.cpp
===================================================================
--- rel_1_2/base_cpp/hello.cpp (revision 1198)
+++ rel_1_2/base_cpp/hello.cpp (nonexistent)
@@ -1,72 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2003 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- CVS : $Id: hello.cpp,v 1.1 2003-03-17 09:29:39 pj Exp $
-
- hello.c:
-
- This test is a simple hello world function.
-
-*/
-
-#include "kernel/kern.h"
-
-class myHello {
- int i;
-public:
-
- myHello(int anumber)
- {
- i = anumber;
- }
-
- void myprint(void)
- {
- cprintf("myHello objecy prints %d.", i);
- }
-};
-
-int main(int argc, char **argv)
-{
- cprintf("Hello, world!\n");
-
- myHello h(1234);
-
- h.myprint();
-
- return 0;
-}
Index: rel_1_2/base_cpp/readme
===================================================================
--- rel_1_2/base_cpp/readme (revision 1198)
+++ rel_1_2/base_cpp/readme (nonexistent)
@@ -1,8 +0,0 @@
-This directory contains a few C++ demos:
-
-- hello.cpp - this is a simple hello world written in C++, similar to that in demos/base
-
-
-Initialization files:
-
-- ihello.c - same as in demos/base
Index: rel_1_2/base_cpp/ihello.c
===================================================================
--- rel_1_2/base_cpp/ihello.c (revision 1198)
+++ rel_1_2/base_cpp/ihello.c (nonexistent)
@@ -1,95 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: ihello.c,v 1.1 2003-03-17 09:29:39 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.1 $
- Last update: $Date: 2003-03-17 09:29:39 $
- ------------
-
- The simplest initialization file
-
- The tick is set to TICK ms.
-
- This file contains the 2 functions needed to initialize the system.
-
- These functions register the following levels:
-
- a RR (Round Robin) level
- a Dummy level
-
- It can accept these task models:
-
- NRT_TASK_MODEL at level 0
-
-**/
-
-/*
- * Copyright (C) 2000 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-
-
-#include "kernel/kern.h"
-#include "modules/rr.h"
-#include "modules/dummy.h"
-
-
-/*+ sysyem tick in us +*/
-#define TICK 300
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
Index: rel_1_2/base_cpp/makefile
===================================================================
--- rel_1_2/base_cpp/makefile (revision 1198)
+++ rel_1_2/base_cpp/makefile (nonexistent)
@@ -1,13 +0,0 @@
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = hello
-
-include $(BASE)/config/example.mk
-
-
-# Text applications
-hello:
- make -f $(SUBMAKE) APP=hello INIT= OTHEROBJS="ihello.o" OTHERINCL=
Index: rel_1_2/makefile
===================================================================
--- rel_1_2/makefile (revision 1198)
+++ rel_1_2/makefile (nonexistent)
@@ -1,22 +0,0 @@
-
-dirs := $(filter-out CVS cvs base_cpp makefile readme.txt README.TXT, $(wildcard *))
-p_all := $(addprefix prefixall_, $(dirs))
-p_install := $(addprefix prefixinstall_, $(dirs))
-p_clean := $(addprefix prefixclean_, $(dirs))
-pcleanall := $(addprefix prefixcleanall_, $(dirs))
-pdepend := $(addprefix prefixdepend_, $(dirs))
-
-
-.PHONY: all clean
-
-
-
-all: $(p_all)
-
-clean: $(p_clean)
-
-prefixall_%:
- make -C $*
-
-prefixclean_%:
- make -C $* clean