Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1217 → Rev 1216

/demos/tags/rel_1_21/auto/include/const.h
File deleted
/demos/tags/rel_1_21/auto/include/auto.h
File deleted
/demos/tags/rel_1_21/auto/include/utils.h
File deleted
/demos/tags/rel_1_21/auto/tracks/monaco.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/tracks/brazil.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/tracks/demo1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/tracks/demo2.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/jetctrl.c
File deleted
/demos/tags/rel_1_21/auto/cars/car3.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/car4.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/car5.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/car6.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/car7.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/boom.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/car8.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/car9.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/car10.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/fumo.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/car11.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/car12.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/car13.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/car14.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/car15.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/car0.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/car1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/cars/car2.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/auto/auto.c
File deleted
/demos/tags/rel_1_21/auto/sensor.c
File deleted
/demos/tags/rel_1_21/auto/readme
File deleted
/demos/tags/rel_1_21/auto/initfil1.c
File deleted
/demos/tags/rel_1_21/auto/initfil2.c
File deleted
/demos/tags/rel_1_21/auto/control.c
File deleted
/demos/tags/rel_1_21/auto/initfil3.c
File deleted
/demos/tags/rel_1_21/auto/edfact.c
File deleted
/demos/tags/rel_1_21/auto/tracks.c
File deleted
/demos/tags/rel_1_21/auto/keyb.c
File deleted
/demos/tags/rel_1_21/auto/edfact.h
File deleted
/demos/tags/rel_1_21/auto/info.c
File deleted
/demos/tags/rel_1_21/auto/makefile
File deleted
/demos/tags/rel_1_21/auto/utils.c
File deleted
/demos/tags/rel_1_21/robots/readme
File deleted
/demos/tags/rel_1_21/robots/makefile
File deleted
/demos/tags/rel_1_21/robots/lab3.txt
File deleted
/demos/tags/rel_1_21/robots/initfile.c
File deleted
/demos/tags/rel_1_21/robots/lab1m.txt
File deleted
/demos/tags/rel_1_21/robots/mouse2.c
File deleted
/demos/tags/rel_1_21/robots/lab.txt
File deleted
/demos/tags/rel_1_21/eli/eli.c
File deleted
/demos/tags/rel_1_21/eli/makefile
File deleted
/demos/tags/rel_1_21/eli/draw.c
File deleted
/demos/tags/rel_1_21/eli/eli.h
File deleted
/demos/tags/rel_1_21/eli/initfile.c
File deleted
/demos/tags/rel_1_21/mpeg2/motion.c
File deleted
/demos/tags/rel_1_21/mpeg2/global.h
File deleted
/demos/tags/rel_1_21/mpeg2/jetctrl.c
File deleted
/demos/tags/rel_1_21/mpeg2/getblk.c
File deleted
/demos/tags/rel_1_21/mpeg2/spatscal.c
File deleted
/demos/tags/rel_1_21/mpeg2/readme
File deleted
/demos/tags/rel_1_21/mpeg2/gvideo.c
File deleted
/demos/tags/rel_1_21/mpeg2/gethdr.c
File deleted
/demos/tags/rel_1_21/mpeg2/idctref.c
File deleted
/demos/tags/rel_1_21/mpeg2/spatial.doc
File deleted
/demos/tags/rel_1_21/mpeg2/idct.c
File deleted
/demos/tags/rel_1_21/mpeg2/todo
File deleted
/demos/tags/rel_1_21/mpeg2/makefile.ori
File deleted
/demos/tags/rel_1_21/mpeg2/getvlc.c
File deleted
/demos/tags/rel_1_21/mpeg2/mpeg2dec.c
File deleted
/demos/tags/rel_1_21/mpeg2/getvlc.h
File deleted
/demos/tags/rel_1_21/mpeg2/mpeg2dec.h
File deleted
/demos/tags/rel_1_21/mpeg2/makefile
File deleted
/demos/tags/rel_1_21/mpeg2/examples
File deleted
/demos/tags/rel_1_21/mpeg2/ieee1180
File deleted
/demos/tags/rel_1_21/mpeg2/makefile.lib
File deleted
/demos/tags/rel_1_21/mpeg2/getbits.c
File deleted
/demos/tags/rel_1_21/mpeg2/store.ori
File deleted
/demos/tags/rel_1_21/mpeg2/recon.c
File deleted
/demos/tags/rel_1_21/mpeg2/systems.c
File deleted
/demos/tags/rel_1_21/mpeg2/subspic.c
File deleted
/demos/tags/rel_1_21/mpeg2/config.h
File deleted
/demos/tags/rel_1_21/mpeg2/getpic.c
File deleted
/demos/tags/rel_1_21/mpeg2/m.bat
File deleted
/demos/tags/rel_1_21/mpeg2/changes
File deleted
/demos/tags/rel_1_21/mpeg2/const.h
File deleted
/demos/tags/rel_1_21/mpeg2/store.c
File deleted
/demos/tags/rel_1_21/mpeg2/test.m2v
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/mpeg2/initfile.c
File deleted
/demos/tags/rel_1_21/mpeg2/verify.c
File deleted
/demos/tags/rel_1_21/tftptest/makefile
File deleted
/demos/tags/rel_1_21/tftptest/tftptest.c
File deleted
/demos/tags/rel_1_21/tftptest/initfile.c
File deleted
/demos/tags/rel_1_21/oldexamples/makefile
File deleted
/demos/tags/rel_1_21/oldexamples/stdio/initfs.c
File deleted
/demos/tags/rel_1_21/oldexamples/stdio/makefile
File deleted
/demos/tags/rel_1_21/oldexamples/stdio/test0.c
File deleted
/demos/tags/rel_1_21/oldexamples/stdio/test1.c
File deleted
/demos/tags/rel_1_21/oldexamples/stdio/test2.c
File deleted
/demos/tags/rel_1_21/oldexamples/stdio/test3.c
File deleted
/demos/tags/rel_1_21/oldexamples/stdio/test4.c
File deleted
/demos/tags/rel_1_21/oldexamples/stdio/common.c
File deleted
/demos/tags/rel_1_21/oldexamples/fs/test2.c
File deleted
/demos/tags/rel_1_21/oldexamples/fs/tree2.c
File deleted
/demos/tags/rel_1_21/oldexamples/fs/hello.c
File deleted
/demos/tags/rel_1_21/oldexamples/fs/testu.c
File deleted
/demos/tags/rel_1_21/oldexamples/fs/testw0.c
File deleted
/demos/tags/rel_1_21/oldexamples/fs/testw1.c
File deleted
/demos/tags/rel_1_21/oldexamples/fs/common.c
File deleted
/demos/tags/rel_1_21/oldexamples/fs/initfs.c
File deleted
/demos/tags/rel_1_21/oldexamples/fs/makefile
File deleted
/demos/tags/rel_1_21/oldexamples/fs/common.h
File deleted
/demos/tags/rel_1_21/oldexamples/fs/test0.c
File deleted
/demos/tags/rel_1_21/oldexamples/fs/tree1.c
File deleted
/demos/tags/rel_1_21/oldexamples/fs/test1.c
File deleted
/demos/tags/rel_1_21/oldexamples/mpeg/mplay.c
File deleted
/demos/tags/rel_1_21/oldexamples/mpeg/mplay2.c
File deleted
/demos/tags/rel_1_21/oldexamples/mpeg/common.c
File deleted
/demos/tags/rel_1_21/oldexamples/mpeg/mpg123.c
File deleted
/demos/tags/rel_1_21/oldexamples/mpeg/initfs.c
File deleted
/demos/tags/rel_1_21/oldexamples/mpeg/makefile
File deleted
/demos/tags/rel_1_21/fsdemo/config.h
File deleted
/demos/tags/rel_1_21/fsdemo/readme
File deleted
/demos/tags/rel_1_21/fsdemo/gvideo.c
File deleted
/demos/tags/rel_1_21/fsdemo/gbuffer.c
File deleted
/demos/tags/rel_1_21/fsdemo/gvideo.h
File deleted
/demos/tags/rel_1_21/fsdemo/mplay.c
File deleted
/demos/tags/rel_1_21/fsdemo/gbuffer.h
File deleted
/demos/tags/rel_1_21/fsdemo/gload.c
File deleted
/demos/tags/rel_1_21/fsdemo/gphoto.ok
File deleted
/demos/tags/rel_1_21/fsdemo/oldmakefile
File deleted
/demos/tags/rel_1_21/fsdemo/gload.h
File deleted
/demos/tags/rel_1_21/fsdemo/makefile
File deleted
/demos/tags/rel_1_21/fsdemo/gphoto.c
File deleted
/demos/tags/rel_1_21/fsdemo/gclock.c
File deleted
/demos/tags/rel_1_21/fsdemo/initfile.c
File deleted
/demos/tags/rel_1_21/fsdemo/xread.c
File deleted
/demos/tags/rel_1_21/fsdemo/gphoto.h
File deleted
/demos/tags/rel_1_21/fsdemo/gclock.h
File deleted
/demos/tags/rel_1_21/fsdemo/mutex.h
File deleted
/demos/tags/rel_1_21/fsdemo/xread.h
File deleted
/demos/tags/rel_1_21/cash/readme.txt
File deleted
/demos/tags/rel_1_21/cash/makefile
File deleted
/demos/tags/rel_1_21/cash/testcash.c
File deleted
/demos/tags/rel_1_21/cash/cash.c
File deleted
/demos/tags/rel_1_21/cash/initcash.c
File deleted
/demos/tags/rel_1_21/cash/cash.h
File deleted
/demos/tags/rel_1_21/soccer/initfile.c
File deleted
/demos/tags/rel_1_21/soccer/calc.h
File deleted
/demos/tags/rel_1_21/soccer/stadio.h
File deleted
/demos/tags/rel_1_21/soccer/calc2.h
File deleted
/demos/tags/rel_1_21/soccer/position.h
File deleted
/demos/tags/rel_1_21/soccer/images.h
File deleted
/demos/tags/rel_1_21/soccer/readme
File deleted
/demos/tags/rel_1_21/soccer/makefile
File deleted
/demos/tags/rel_1_21/soccer/iniziali.h
File deleted
/demos/tags/rel_1_21/soccer/soccer.c
File deleted
/demos/tags/rel_1_21/dosfs/initfile.c
File deleted
/demos/tags/rel_1_21/dosfs/readme.txt
File deleted
/demos/tags/rel_1_21/dosfs/makefile
File deleted
/demos/tags/rel_1_21/dosfs/dosfs.c
File deleted
/demos/tags/rel_1_21/dosfs/myfile.txt
File deleted
/demos/tags/rel_1_21/orbit/makefile
File deleted
/demos/tags/rel_1_21/orbit/orbit.c
File deleted
/demos/tags/rel_1_21/orbit/initfile.c
File deleted
/demos/tags/rel_1_21/orbit/orbit.dat
File deleted
/demos/tags/rel_1_21/thdemo/demo.h
File deleted
/demos/tags/rel_1_21/thdemo/readme.txt
File deleted
/demos/tags/rel_1_21/thdemo/camera2.c
File deleted
/demos/tags/rel_1_21/thdemo/ball.c
File deleted
/demos/tags/rel_1_21/thdemo/camera4.c
File deleted
/demos/tags/rel_1_21/thdemo/ball2.c
File deleted
/demos/tags/rel_1_21/thdemo/makefile
File deleted
/demos/tags/rel_1_21/thdemo/fft.c
File deleted
/demos/tags/rel_1_21/thdemo/initfile.c
File deleted
/demos/tags/rel_1_21/thdemo/demo.c
File deleted
/demos/tags/rel_1_21/thdemo/fftplay.c
File deleted
/demos/tags/rel_1_21/thdemo/jetctrl.c
File deleted
/demos/tags/rel_1_21/thdemo/camera.c
File deleted
/demos/tags/rel_1_21/simcity/reading.c
File deleted
/demos/tags/rel_1_21/simcity/simcity.c
File deleted
/demos/tags/rel_1_21/simcity/tasks.c
File deleted
/demos/tags/rel_1_21/simcity/sprite/sp_1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sprite/sp_2.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sprite/sp_3.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sprite/sp_4.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sprite/sp_5.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sprite/sp_6.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sprite/sp_7.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sprite/sp_0.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/keyfunct.c
File deleted
/demos/tags/rel_1_21/simcity/img/car_000n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/Bb0.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/bb1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_210n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_120n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_030n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_300n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/street.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_240n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_015n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_150n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_060n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_105n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_330n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_045n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/old_sk.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_180n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_090n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_270n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_135n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_225n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_315n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_075n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_165n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_255n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_345n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/old.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_195n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/img/car_285n.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/misc.c
File deleted
/demos/tags/rel_1_21/simcity/sem.raw
File deleted
/demos/tags/rel_1_21/simcity/makefile
File deleted
/demos/tags/rel_1_21/simcity/draw.c
File deleted
/demos/tags/rel_1_21/simcity/keyboard.c
File deleted
/demos/tags/rel_1_21/simcity/include/simcity.h
File deleted
/demos/tags/rel_1_21/simcity/include/proc.h
File deleted
/demos/tags/rel_1_21/simcity/include/states.h
File deleted
/demos/tags/rel_1_21/simcity/include/car.h
File deleted
/demos/tags/rel_1_21/simcity/include/keyfunct.h
File deleted
/demos/tags/rel_1_21/simcity/include/constant.h
File deleted
/demos/tags/rel_1_21/simcity/include/misc.h
File deleted
/demos/tags/rel_1_21/simcity/include/draw.h
File deleted
/demos/tags/rel_1_21/simcity/proc.c
File deleted
/demos/tags/rel_1_21/simcity/initfile.c
File deleted
/demos/tags/rel_1_21/simcity/sem/yellow_r.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sem/red_d.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sem/red_u.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sem/yellow_d.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sem/yellow_u.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sem/green_r.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sem/green_d.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sem/green_u.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sem/red_l.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sem/yellow_l.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sem/red_r.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/sem/green_l.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/simcity/car.c
File deleted
/demos/tags/rel_1_21/mesaref/readme.txt
File deleted
/demos/tags/rel_1_21/mesaref/makefile
File deleted
/demos/tags/rel_1_21/mesaref/test.png
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/mesaref/mesaref.c
File deleted
/demos/tags/rel_1_21/mesaref/initfile.c
File deleted
/demos/tags/rel_1_21/bca/bca_lib.c
File deleted
/demos/tags/rel_1_21/bca/readme
File deleted
/demos/tags/rel_1_21/bca/bca_raw/aereo1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/bca/bca_raw/cannon.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/bca/bca_raw/aereo2.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/bca/bca_raw/aereo1_h.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/bca/bca_raw/cannon_h.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/bca/bca_raw/esplo1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/bca/bca_raw/aereo2_h.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/bca/bca_raw/esplo2.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/bca/bca_raw/esplo3.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/bca/bca_raw/bca.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/bca/bca_raw/esplo4.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/bca/bca_raw/missile1.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/bca/bca_raw/esplo5.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/bca/bca_raw/missile2.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/bca/bca_raw/sfondo.raw
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/bca/fab_lib.c
File deleted
/demos/tags/rel_1_21/bca/control.c
File deleted
/demos/tags/rel_1_21/bca/cannone.c
File deleted
/demos/tags/rel_1_21/bca/esplo.c
File deleted
/demos/tags/rel_1_21/bca/bca.c
File deleted
/demos/tags/rel_1_21/bca/bca.h
File deleted
/demos/tags/rel_1_21/bca/aereo.c
File deleted
/demos/tags/rel_1_21/bca/dummy.c
File deleted
/demos/tags/rel_1_21/bca/makefile
File deleted
/demos/tags/rel_1_21/bca/fab_lib/fab_msg.h
File deleted
/demos/tags/rel_1_21/bca/fab_lib/fab_grx.sys
File deleted
/demos/tags/rel_1_21/bca/fab_lib/fab_tool.h
File deleted
/demos/tags/rel_1_21/bca/fab_lib/fab_grx.h
File deleted
/demos/tags/rel_1_21/bca/fab_lib/fab_show.h
File deleted
/demos/tags/rel_1_21/bca/scenario.c
File deleted
/demos/tags/rel_1_21/bca/initfile.c
File deleted
/demos/tags/rel_1_21/bca/missile.c
File deleted
/demos/tags/rel_1_21/biliardo/makefile
File deleted
/demos/tags/rel_1_21/biliardo/posizion.h
File deleted
/demos/tags/rel_1_21/biliardo/initfil1.c
File deleted
/demos/tags/rel_1_21/biliardo/biliardo.c
File deleted
/demos/tags/rel_1_21/biliardo/jetctrl.c
File deleted
/demos/tags/rel_1_21/biliardo/demo.h
File deleted
/demos/tags/rel_1_21/biliardo/palla.c
File deleted
/demos/tags/rel_1_21/biliardo/biliardo.h
File deleted
/demos/tags/rel_1_21/edfact/initfile.c
File deleted
/demos/tags/rel_1_21/edfact/edfact.c
File deleted
/demos/tags/rel_1_21/edfact/testact.c
File deleted
/demos/tags/rel_1_21/edfact/edfact.h
File deleted
/demos/tags/rel_1_21/edfact/readme
File deleted
/demos/tags/rel_1_21/edfact/makefile
File deleted
/demos/tags/rel_1_21/static/static.c
File deleted
/demos/tags/rel_1_21/static/test1st.c
File deleted
/demos/tags/rel_1_21/static/static.h
File deleted
/demos/tags/rel_1_21/static/readme
File deleted
/demos/tags/rel_1_21/static/makefile
File deleted
/demos/tags/rel_1_21/static/initfile.c
File deleted
/demos/tags/rel_1_21/astro/rock.c
File deleted
/demos/tags/rel_1_21/astro/asteroid.h
File deleted
/demos/tags/rel_1_21/astro/initfile.c
File deleted
/demos/tags/rel_1_21/astro/astro.c
File deleted
/demos/tags/rel_1_21/astro/asteroid.c
File deleted
/demos/tags/rel_1_21/astro/stat.c
File deleted
/demos/tags/rel_1_21/astro/makefile
File deleted
/demos/tags/rel_1_21/pngdemo/test.png
File deleted
\ No newline at end of file
/demos/tags/rel_1_21/pngdemo/initfile.c
File deleted
/demos/tags/rel_1_21/pngdemo/pngdemo.c
File deleted
/demos/tags/rel_1_21/pngdemo/readme.txt
File deleted
/demos/tags/rel_1_21/pngdemo/makefile
File deleted
/demos/tags/rel_1_21/mesademo/mesademo.c
File deleted
/demos/tags/rel_1_21/mesademo/readme.txt
File deleted
/demos/tags/rel_1_21/mesademo/makefile
File deleted
/demos/tags/rel_1_21/mesademo/initfile.c
File deleted
/demos/tags/rel_1_21/lights/makefile
File deleted
/demos/tags/rel_1_21/lights/simlight.c
File deleted
/demos/tags/rel_1_21/lights/blaster.h
File deleted
/demos/tags/rel_1_21/lights/initfile.c
File deleted
/demos/tags/rel_1_21/lights/param.dat
File deleted
/demos/tags/rel_1_21/lights/readme.txt
File deleted
/demos/tags/rel_1_21/perf/readme
File deleted
/demos/tags/rel_1_21/perf/makefile
File deleted
/demos/tags/rel_1_21/perf/perf1.c
File deleted
/demos/tags/rel_1_21/perf/perf2.c
File deleted
/demos/tags/rel_1_21/perf/perf3.c
File deleted
/demos/tags/rel_1_21/perf/perf4.c
File deleted
/demos/tags/rel_1_21/perf/initfile.c
File deleted
/demos/tags/rel_1_21/pci6025e/readme
File deleted
/demos/tags/rel_1_21/pci6025e/makefile
File deleted
/demos/tags/rel_1_21/pci6025e/test_bms.c
File deleted
/demos/tags/rel_1_21/pci6025e/wave.c
File deleted
/demos/tags/rel_1_21/pci6025e/initfile.c
File deleted
/demos/tags/rel_1_21/pci6025e/test_mes.c
File deleted
/demos/tags/rel_1_21/pci6025e/test_ec.c
File deleted
/demos/tags/rel_1_21/pci6025e/test_dac.c
File deleted
/demos/tags/rel_1_21/pci6025e/test_ppi.c
File deleted
/demos/tags/rel_1_21/pci6025e/test_bec.c
File deleted
/demos/tags/rel_1_21/pci6025e/test_dio.c
File deleted
/demos/tags/rel_1_21/servo/leg.c
File deleted
/demos/tags/rel_1_21/servo/leg.h
File deleted
/demos/tags/rel_1_21/servo/makefile
File deleted
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: rel_1_21/servo/servo.c
===================================================================
--- rel_1_21/servo/servo.c (revision 1217)
+++ rel_1_21/servo/servo.c (nonexistent)
@@ -1,131 +0,0 @@
-#include "kernel/kern.h"
-
-#include "drivers/keyb.h"
-
-#include "servo.h"
-#include "leg.h"
-
-int main () {
-
- int res;
- char ch;
-/*
- servo_open(SERVO_COM2);
-
- cprintf("servo_set_RS232_baudrate\n");
- res = servo_set_RS232_baudrate(9600);
- cprintf("Res = %d\n",res);
-
- cprintf("servo_get_RS232_baudrate\n");
- res = servo_get_RS232_baudrate();
- cprintf("Res = %d\n",res);
-
- cprintf("servo_store_RS232_baudrate\n");
- res = servo_store_RS232_baudrate();
- cprintf("Res = %d\n",res);
-
- cprintf("servo_set_period\n");
- res = servo_set_period(20000);
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- cprintf("servo_get_period\n");
- res = servo_get_period();
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- cprintf("servo_store_period\n");
- res = servo_store_period();
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- cprintf("servo_get_setup_switch\n");
- res = servo_get_setup_switch();
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- cprintf("servo_set_RC5_switch\n");
- res = servo_set_RC5_switch(1);
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- cprintf("servo_turn_off\n");
- res = servo_turn_off(1);
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- cprintf("servo_turn_on\n");
- res = servo_turn_on(1);
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- cprintf("servo_turn_off_all\n");
- res = servo_turn_off_all();
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- cprintf("servo_turn_on_all\n");
- res = servo_turn_on_all();
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- cprintf("servo_set_levels\n");
- res = servo_set_levels(0x00,0x01);
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- cprintf("servo_get_levels\n");
- res = servo_get_levels();
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- cprintf("servo_store_levels\n");
- res = servo_store_levels();
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- cprintf("servo_set_angle_sec\n");
- res = servo_set_angle_sec(0,ANGLE2SEC(45,0,0));
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- cprintf("servo_store_default_position\n");
- res = servo_store_default_position(0);
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- cprintf("servo_get_angle_sec\n");
- res = servo_get_angle_sec(0);
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- cprintf("servo_get_analog\n");
- res = servo_get_analog(0);
- cprintf("Res = %d\n",res);
-
- ch = keyb_getch(BLOCK);
-
- servo_close();
-*/
- set_leg_position(8.0,-5.0,0.0);
- set_leg_position(8.0,0.0,0.0);
-
- return 0;
-
-}
-
Index: rel_1_21/servo/initfile.c
===================================================================
--- rel_1_21/servo/initfile.c (revision 1217)
+++ rel_1_21/servo/initfile.c (nonexistent)
@@ -1,83 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Giacomo Guidi <giacomo@gandalf.sssup.it>
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Paolo Gai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include "kernel/kern.h"
-#include "modules/edf.h"
-#include "modules/cbs.h"
-#include "modules/rr.h"
-#include "modules/dummy.h"
-
-#include "modules/sem.h"
-#include "modules/hartport.h"
-#include "modules/cabs.h"
-
-#include "drivers/keyb.h"
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- EDF_register_level(EDF_ENABLE_ALL);
- //CBS_register_level(CBS_ENABLE_ALL, 0);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- //KEYB_init(NULL);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
/rel_1_21/servo/initfile.c
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: rel_1_21/telesco/initfile.c
===================================================================
--- rel_1_21/telesco/initfile.c (revision 1217)
+++ rel_1_21/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_21/telesco/tel.c
===================================================================
--- rel_1_21/telesco/tel.c (revision 1217)
+++ rel_1_21/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_21/telesco/dati.cnf
===================================================================
--- rel_1_21/telesco/dati.cnf (revision 1217)
+++ rel_1_21/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_21/telesco/makefile
===================================================================
--- rel_1_21/telesco/makefile (revision 1217)
+++ rel_1_21/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_21/telesco/moon.h
===================================================================
--- rel_1_21/telesco/moon.h (revision 1217)
+++ rel_1_21/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_21/cbs_ft/makefile
===================================================================
--- rel_1_21/cbs_ft/makefile (revision 1217)
+++ rel_1_21/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_21/cbs_ft/cbs_ft.c
===================================================================
--- rel_1_21/cbs_ft/cbs_ft.c (revision 1217)
+++ rel_1_21/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_21/cbs_ft/initfile.c
===================================================================
--- rel_1_21/cbs_ft/initfile.c (revision 1217)
+++ rel_1_21/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_21/cbs_ft/cbs_ft.h
===================================================================
--- rel_1_21/cbs_ft/cbs_ft.h (revision 1217)
+++ rel_1_21/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_21/cbs_ft/prova.c
===================================================================
--- rel_1_21/cbs_ft/prova.c (revision 1217)
+++ rel_1_21/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_21/cbs_ft/readme.txt
===================================================================
--- rel_1_21/cbs_ft/readme.txt (revision 1217)
+++ rel_1_21/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_21/autostr/autostr.c
===================================================================
--- rel_1_21/autostr/autostr.c (revision 1217)
+++ rel_1_21/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_21/autostr/initfile.c
===================================================================
--- rel_1_21/autostr/initfile.c (revision 1217)
+++ rel_1_21/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_21/autostr/makefile
===================================================================
--- rel_1_21/autostr/makefile (revision 1217)
+++ rel_1_21/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_21/svgademo/makefile
===================================================================
--- rel_1_21/svgademo/makefile (revision 1217)
+++ rel_1_21/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_21/svgademo/initfile.c
===================================================================
--- rel_1_21/svgademo/initfile.c (revision 1217)
+++ rel_1_21/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_21/svgademo/svgademo.c
===================================================================
--- rel_1_21/svgademo/svgademo.c (revision 1217)
+++ rel_1_21/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_21/svgademo/readme.txt
===================================================================
--- rel_1_21/svgademo/readme.txt (revision 1217)
+++ rel_1_21/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_21/mesatex/makefile
===================================================================
--- rel_1_21/mesatex/makefile (revision 1217)
+++ rel_1_21/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_21/mesatex/initfile.c
===================================================================
--- rel_1_21/mesatex/initfile.c (revision 1217)
+++ rel_1_21/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_21/mesatex/mesatex.c
===================================================================
--- rel_1_21/mesatex/mesatex.c (revision 1217)
+++ rel_1_21/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_21/mesatex/readme.txt
===================================================================
--- rel_1_21/mesatex/readme.txt (revision 1217)
+++ rel_1_21/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_21/loader/loadfile.txt
===================================================================
--- rel_1_21/loader/loadfile.txt (revision 1217)
+++ rel_1_21/loader/loadfile.txt (nonexistent)
@@ -1,55 +0,0 @@
-# TASK TYPE:TASK LEVEL:NUMBER OF:TASK ACT TYPE (PAR1,PAR2,...):DEADLINE:WCET
-# :TASK EXEC TYPE (PAR1,PAR2,...):CRITICAL SESSION (PAR1,PAR2,PAR3,PAR4);
-#
-# TASK TYPE
-# NRT - NON REAL TIME
-# HARD - HARD REAL TIME
-# SOFT - SOFT REAL TIME
-# BACK - BACKGROUND TASK
-#
-# TASK EXEC TYPE
-# EXEC_CONST(TIME)
-# - CONSTANT EXEC TIME
-# EXEC_MEAN(MEAN, DELTA)
-# - VARIABLE EXEC TIME WITH CONSTANT DISTRIBUTION
-# EXEC_GAUSS(MEAN, SIGMA)
-# - VARIABLE EXEC TIME WITH GAUSSIAN DISTRIBUTION
-# EXEC_GAUSS_MAX(MEAN, SIGMA, MAX)
-# - VARIABLE EXEC TIME WITH GAUSSIAN DISTRIBUTION MAXIMIZED
-#
-# TASK ACTIVATION TIME
-# ACT_SINGLE(START_TIME)
-# ACT_PERIODIC(START_TIME, PERIOD)
-# ACT_MEAN(START_TIME, MEAN, DELTA)
-# ACT_GAUSS(START_TIME, MEAN, SIGMA)
-# ACT_GAUSS_MAX(START_TIME, MEAN, SIGMA, MAX)
-#
-# CRITICAL SESSION
-# CRIT(RES NUMBER, MEAN_START, DELTA_START, MEAN_LEN, DELTA_LEN)
-# NO_CRIT
-#
-
-TOTAL_EXEC_TIME:[20][0];
-
-BACK:[1]:[1]:ACT_SINGLE([4][0]):[0][0]:[0][0]
-:EXEC_CONST([0][5000]):NO_CRIT;
-
-HARD:[0]:[10]:ACT_PERIODIC([5][0],[0][100000]):[0][100000]:[0][1000]
-:EXEC_CONST([0][50]):CRIT([0],[0][5],[0][10],[0][20],[0][1]);
-
-FSF:[S0]:POSIX:[1]:ACT_SINGLE([0][0]):[0][0]:[0][0]
-:EXEC_CONST([0][5000]):CRIT([1],[0][500],[0][1000],[0][2000],[0][1]);
-
-FSF:[S1]:POSIX:[1]:ACT_SINGLE([0][0]):[0][0]:[0][0]
-:EXEC_CONST([0][5000]):CRIT([1],[0][500],[0][1000],[0][2000],[0][1]);
-
-FSF:[S2]:POSIX:[20]:ACT_SINGLE([0][0]):[0][0]:[0][0]
-:EXEC_CONST([0][16000]):CRIT([2],[0][500],[0][1000],[0][5000],[0][10000]);
-
-FSF:[S3]:EDF:[5]:ACT_PERIODIC([0][0],[0][200000]):[0][200000]:[0][20000]
-:EXEC_CONST([0][15000]):CRIT([2],[0][5000],[0][10000],[0][5000],[0][1]);
-
-FSF:[S3]:EDF:[5]:ACT_PERIODIC([0][0],[0][111111]):[0][111111]:[0][11111]
-:EXEC_MEAN([0][10000],[0][5000]):NO_CRIT;
-
-END
Index: rel_1_21/loader/parser.c
===================================================================
--- rel_1_21/loader/parser.c (revision 1217)
+++ rel_1_21/loader/parser.c (nonexistent)
@@ -1,485 +0,0 @@
-#include <kernel/kern.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include "parser.h"
-
-//#define PARSER_DEBUG
-
-static int find_break(char **buf, int find_type, struct timespec *time, int *val)
-{
-
- int i;
- char str[20];
-
- i = 0;
- while (((char *)(*buf))[i] == ' ' || ((char *)(*buf))[i] == ':' ||
- ((char *)(*buf))[i] == '\n' || ((char *)(*buf))[i] == '\r') i++;
- *buf += i;
-
- if (!strncmp(*buf,"END",3) && find_type == PAR_NOTHING) {
- *buf += 5;
- return PAR_END;
- }
-
- i = 0;
- if (((char *)(*buf))[0] == '#' && find_type == PAR_NOTHING) {
- while (((char *)(*buf))[i] != '\n' && ((char *)(*buf))[i] != '\r') i++;
- *buf += i;
- return PAR_FOUND;
- }
-
- switch (find_type) {
-
- case PAR_NOTHING:
- if (((char *)(*buf))[0] == ';' ||
- ((char *)(*buf))[0] < 32) {
- *buf += 1;
- return PAR_FOUND;
- }
- break;
-
- case PAR_TOTAL_EXEC_TIME:
- if (!strncmp(*buf, "TOTAL_EXEC_TIME:",16)) {
- *buf += 16;
- return PAR_FOUND;
- }
- break;
-
- case PAR_TIME:
- if (((char *)(*buf))[0] != '[') return PAR_ERROR;
- *buf += 1;
- i = 0;
- while (((char *)(*buf))[i] >= '0' && ((char *)(*buf))[i] <= '9') {
- str[i] = ((char *)(*buf))[i];
- i++;
- }
- if (((char *)(*buf))[i] != ']') return PAR_ERROR;
- str[i] = 0;
- time->tv_sec = atoi(str);
- i += 2;
- *buf += i;
- i = 0;
- while (((char *)(*buf))[i] >= '0' && ((char *)(*buf))[i] <= '9') {
- str[i] = ((char *)(*buf))[i];
- i++;
- }
- if (((char *)(*buf))[i] != ']') return PAR_ERROR;
- str[i] = 0;
- time->tv_nsec = atoi(str) * 1000;
- i += 2;
- *buf += i;
- return PAR_FOUND;
- break;
-
- case PAR_TASK_TYPE:
- if (!strncmp(*buf, "NRT:",4)) {
- *val = PAR_TASK_NRT;
- *buf += 4;
- return PAR_FOUND;
- }
- if (!strncmp(*buf, "HARD:",5)) {
- *val = PAR_TASK_HARD;
- *buf += 5;
- return PAR_FOUND;
- }
- if (!strncmp(*buf, "SOFT:",5)) {
- *val = PAR_TASK_SOFT;
- *buf += 5;
- return PAR_FOUND;
- }
- if (!strncmp(*buf, "BACK:",5)) {
- *val = PAR_TASK_BACK;
- *buf += 5;
- return PAR_FOUND;
- }
- if (!strncmp(*buf, "FSF:",4)) {
- *val = PAR_TASK_FSF;
- *buf += 4;
- return PAR_FOUND;
- }
- break;
-
- case PAR_TASK_NUMBER:
- if (((char *)(*buf))[0] != '[') return PAR_ERROR;
- *buf += 1;
- i = 0;
- while (((char *)(*buf))[i] >= '0' && ((char *)(*buf))[i] <= '9') {
- str[i] = ((char *)(*buf))[i];
- i++;
- }
- if (((char *)(*buf))[i] != ']') return PAR_ERROR;
- str[i] = 0;
- *val = atoi(str);
- i += 2;
- *buf += i;
- return PAR_FOUND;
- break;
-
- case PAR_LOCAL_SCHEDULER:
- if (!strncmp(*buf,"POSIX",5)) {
- *buf += 5;
- *val = PAR_POSIX;
- return PAR_FOUND;
- }
- if (!strncmp(*buf,"EDF",3)) {
- *buf += 3;
- *val = PAR_EDF;
- return PAR_FOUND;
- }
- if (!strncmp(*buf,"RM",2)) {
- *buf += 2;
- *val = PAR_RM;
- return PAR_FOUND;
- }
- break;
-
- case PAR_ACT_TYPE:
- if (!strncmp(*buf,"ACT_SINGLE(",11)) {
- *buf += 11;
- *val = PAR_ACT_SINGLE;
- return PAR_FOUND;
- }
- if (!strncmp(*buf,"ACT_PERIODIC(",13)) {
- *buf += 13;
- *val = PAR_ACT_PERIODIC;
- return PAR_FOUND;
- }
- if (!strncmp(*buf,"ACT_MEAN(",9)) {
- *buf += 9;
- *val = PAR_ACT_MEAN;
- return PAR_FOUND;
- }
- if (!strncmp(*buf,"ACT_GAUSS(",10)) {
- *buf += 10;
- *val = PAR_ACT_GAUSS;
- return PAR_FOUND;;
- }
- if (!strncmp(*buf,"ACT_GAUSS_MAX(",14)) {
- *buf += 14;
- *val = PAR_ACT_GAUSS_MAX;
- return PAR_FOUND;
- }
- return PAR_ERROR;
- break;
-
- case PAR_EXEC_TYPE:
- if (!strncmp(*buf,"EXEC_CONST(",11)) {
- *buf += 11;
- *val = PAR_EXEC_CONST;
- return PAR_FOUND;
- }
- if (!strncmp(*buf,"EXEC_MEAN(",10)) {
- *buf += 10;
- *val = PAR_EXEC_MEAN;
- return PAR_FOUND;
- }
- if (!strncmp(*buf,"EXEC_GAUSS(",11)) {
- *buf += 11;
- *val = PAR_EXEC_GAUSS;
- return PAR_FOUND;
- }
- if (!strncmp(*buf,"EXEC_GAUSS_MAX(",15)) {
- *buf += 15;
- *val = PAR_EXEC_GAUSS_MAX;
- return PAR_FOUND;
- }
- return PAR_ERROR;
- break;
-
- case PAR_CRIT_SESSION:
- if (!strncmp(*buf,"NO_CRIT",7)) {
- *buf += 7;
- *val = PAR_NO_CRIT;
- return PAR_FOUND;
- }
- if (!strncmp(*buf,"CRIT(",5)) {
- *buf += 5;
- *val = PAR_CRIT;
- return PAR_FOUND;
- }
- return PAR_ERROR;
- break;
-
- case PAR_FSF_SERVER:
- if (!strncmp(*buf,"[S",2)) {
- *buf += 2;
- i = 0;
- while (((char *)(*buf))[i] >= '0' && ((char *)(*buf))[i] <= '9') {
- str[i] = ((char *)(*buf))[i];
- i++;
- }
- if (((char *)(*buf))[i] != ']') return PAR_ERROR;
- str[i] = 0;
- *val = atoi(str);
- i += 2;
- *buf += i;
- return PAR_FOUND;
- } else return PAR_ERROR;
- break;
-
- }
-
- return PAR_ERROR;
-
-}
-
-void par_error(int line_num)
-{
-
- cprintf("\nParser error: line [%d]\n",line_num);
- sys_end();
-
-}
-
-/* result:
- * 0 -> nothing
- * 1 -> total
- * 2 -> new task-loader
- * 3 -> end file
- */
-int line_parser(char **pbuf, int line_num, struct timespec *total, struct loader_task **last)
-{
- struct timespec time;
- struct loader_task *ld = NULL;
- int val, res;
-
- res = find_break(pbuf, PAR_NOTHING, &time, &val);
- if (res == PAR_FOUND) return 0;
- if (res == PAR_END) return 3;
-
- res = find_break(pbuf,PAR_TOTAL_EXEC_TIME, &time, &val);
- if (res == PAR_FOUND) {
- NULL_TIMESPEC(total);
- res = find_break(pbuf, PAR_TIME, &time, &val);
- if (res == PAR_FOUND) {
- TIMESPEC_ASSIGN(total,&time);
- #ifdef PARSER_DEBUG
- cprintf("TOTAL EXEC TIME SEC = %ld NSEC = %ld\n",total->tv_sec,total->tv_nsec);
- #endif
- return 1;
- } else par_error(line_num);
- }
-
- res = find_break(pbuf,PAR_TASK_TYPE, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf("TASK TYPE = %d\n",val);
- #endif
-
- ld = malloc(sizeof(struct loader_task));
- if (ld == NULL) par_error(line_num);
-
- ld->next = NULL;
- *last = ld;
-
- ld->task_type = val;
-
- } else par_error(line_num);
-
- if (ld->task_type == PAR_TASK_FSF) {
- res = find_break(pbuf,PAR_FSF_SERVER, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf("TASK SERVER = %d\n",val);
- #endif
-
- ld->server = val;
- } else par_error(line_num);
-
- res = find_break(pbuf,PAR_LOCAL_SCHEDULER, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf("TASK LOCAL SCHEDULER = %d\n",val);
- #endif
-
- ld->local_scheduler = val;
- } else par_error(line_num);
-
- } else {
- res = find_break(pbuf,PAR_TASK_NUMBER, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf("TASK LEVEL = %d\n",val);
- #endif
-
- ld->task_level = val;
-
- } else par_error(line_num);
- }
-
- res = find_break(pbuf,PAR_TASK_NUMBER, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf("TASK NUMBER = %d\n",val);
- #endif
-
- ld->number = val;
-
- } else par_error(line_num);
-
- res = find_break(pbuf,PAR_ACT_TYPE, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf("ACTIVATION TYPE: %d (",val);
- #endif
-
- ld->act_type = val;
-
- res = find_break(pbuf,PAR_TIME, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf("[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
- #endif
- TIMESPEC_ASSIGN(&ld->act_par_1,&time);
- } else par_error(line_num);
-
- if (ld->act_type != PAR_ACT_SINGLE) {
- res = find_break(pbuf,PAR_TIME, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
- #endif
- TIMESPEC_ASSIGN(&ld->act_par_2,&time);
- } else par_error(line_num);
- }
-
- if (ld->act_type != PAR_ACT_SINGLE && ld->act_type != PAR_ACT_PERIODIC) {
- res = find_break(pbuf,PAR_TIME, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
- #endif
- TIMESPEC_ASSIGN(&ld->act_par_3,&time);
- } else par_error(line_num);
- }
-
- if (ld->act_type != PAR_ACT_SINGLE && ld->act_type != PAR_ACT_PERIODIC &&
- ld->act_type != PAR_ACT_MEAN && ld->act_type != PAR_ACT_GAUSS) {
- res = find_break(pbuf,PAR_TIME, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
- #endif
- TIMESPEC_ASSIGN(&ld->act_par_4,&time);
- } else par_error(line_num);
- }
-
- #ifdef PARSER_DEBUG
- cprintf(")\n");
- #endif
-
- } else par_error(line_num);
-
- res = find_break(pbuf,PAR_TIME, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf("DEADLINE: [%ld][%ld]\n",time.tv_sec,time.tv_nsec/1000);
- #endif
- TIMESPEC_ASSIGN(&ld->deadline,&time);
- } else par_error(line_num);
-
- res = find_break(pbuf,PAR_TIME, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf("WCET: [%ld][%ld]\n",time.tv_sec,time.tv_nsec/1000);
- #endif
- TIMESPEC_ASSIGN(&ld->wcet,&time);
- } else par_error(line_num);
-
- res = find_break(pbuf,PAR_EXEC_TYPE, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf("EXEC TYPE: %d (",val);
- #endif
- ld->exec_type = val;
- res = find_break(pbuf,PAR_TIME, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf("[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
- #endif
- TIMESPEC_ASSIGN(&ld->exec_par_1,&time);
- } else par_error(line_num);
-
- if (ld->exec_type != PAR_EXEC_CONST) {
- res = find_break(pbuf,PAR_TIME, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
- #endif
- TIMESPEC_ASSIGN(&ld->exec_par_2,&time);
- } else par_error(line_num);
- }
-
- if (ld->exec_type != PAR_EXEC_CONST && ld->exec_type != PAR_EXEC_MEAN &&
- ld->exec_type != PAR_EXEC_GAUSS) {
- res = find_break(pbuf,PAR_TIME, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
- #endif
- TIMESPEC_ASSIGN(&ld->exec_par_3,&time);
- } else par_error(line_num);
- }
-
- #ifdef PARSER_DEBUG
- cprintf(")\n");
- #endif
-
- } else par_error(line_num);
-
- res = find_break(pbuf,PAR_CRIT_SESSION, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf("CRITITCAL SESSION: %d (",val);
- #endif
- ld->crit_type = val;
- if (ld->crit_type == PAR_CRIT) {
- res = find_break(pbuf,PAR_TASK_NUMBER, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf("[%d]",val);
- #endif
- ld->resource = val;
- } else par_error(line_num);
- res = find_break(pbuf,PAR_TIME, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
- #endif
- TIMESPEC_ASSIGN(&ld->crit_par_1,&time);
- } else par_error(line_num);
- res = find_break(pbuf,PAR_TIME, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
- #endif
- TIMESPEC_ASSIGN(&ld->crit_par_2,&time);
- } else par_error(line_num);
- res = find_break(pbuf,PAR_TIME, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
- #endif
- TIMESPEC_ASSIGN(&ld->crit_par_3,&time);
- } else par_error(line_num);
- res = find_break(pbuf,PAR_TIME, &time, &val);
- if (res == PAR_FOUND) {
- #ifdef PARSER_DEBUG
- cprintf(",[%ld][%ld]",time.tv_sec,time.tv_nsec/1000);
- #endif
- TIMESPEC_ASSIGN(&ld->crit_par_4,&time);
- } else par_error(line_num);
-
- }
-
- #ifdef PARSER_DEBUG
- cprintf(")\n");
- #endif
-
- } else par_error(line_num);
-
- return 2;
-
-}
-
Index: rel_1_21/loader/makefile
===================================================================
--- rel_1_21/loader/makefile (revision 1217)
+++ rel_1_21/loader/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = loader
-
-include $(BASE)/config/example.mk
-
-loader:
- make -f $(SUBMAKE) APP=loader INIT= OTHEROBJS="fsfinit.o initfile.o parser.o dosread.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __FIRST__"
-
Index: rel_1_21/loader/parser.h
===================================================================
--- rel_1_21/loader/parser.h (revision 1217)
+++ rel_1_21/loader/parser.h (nonexistent)
@@ -1,77 +0,0 @@
-#ifndef __PARSER_H__
-#define __PARSER_H__
-
-#include <kernel/kern.h>
-
-#define PAR_TOTAL_EXEC_TIME 0
-#define PAR_TIME 1
-#define PAR_ACT_TYPE 2
-#define PAR_TASK_NUMBER 3
-#define PAR_EXEC_TYPE 4
-#define PAR_TASK_TYPE 5
-#define PAR_NOTHING 6
-#define PAR_DEADLINE 7
-#define PAR_ERROR 8
-#define PAR_FOUND 9
-#define PAR_CRIT_SESSION 10
-#define PAR_END 11
-
-#define PAR_EXEC_CONST 12
-#define PAR_EXEC_MEAN 13
-#define PAR_EXEC_GAUSS 14
-#define PAR_EXEC_GAUSS_MAX 15
-
-#define PAR_ACT_SINGLE 16
-#define PAR_ACT_PERIODIC 17
-#define PAR_ACT_MEAN 18
-#define PAR_ACT_GAUSS 19
-#define PAR_ACT_GAUSS_MAX 20
-
-#define PAR_TASK_NRT 21
-#define PAR_TASK_HARD 22
-#define PAR_TASK_SOFT 23
-#define PAR_TASK_BACK 24
-#define PAR_TASK_FSF 25
-
-#define PAR_NO_CRIT 26
-#define PAR_CRIT 27
-
-#define PAR_FSF_SERVER 28
-
-#define PAR_LOCAL_SCHEDULER 29
-#define PAR_POSIX 30
-#define PAR_EDF 31
-#define PAR_RM 32
-
-struct loader_task {
- int number;
- int group;
- bandwidth_t bandwidth;
- int task_level;
- int task_type;
- struct timespec deadline;
- struct timespec wcet;
- int exec_type;
- struct timespec exec_par_1;
- struct timespec exec_par_2;
- struct timespec exec_par_3;
- int act_type;
- struct timespec act_par_1;
- struct timespec act_par_2;
- struct timespec act_par_3;
- struct timespec act_par_4;
- int crit_type;
- int resource;
- struct timespec crit_par_1;
- struct timespec crit_par_2;
- struct timespec crit_par_3;
- struct timespec crit_par_4;
- int server;
- int local_scheduler;
- struct loader_task *next;
-};
-
-int line_parser(char **buf, int line_num, struct timespec *total, struct loader_task **last);
-
-#endif
-
Index: rel_1_21/loader/dosread.c
===================================================================
--- rel_1_21/loader/dosread.c (revision 1217)
+++ rel_1_21/loader/dosread.c (nonexistent)
@@ -1,68 +0,0 @@
-#include <kernel/kern.h>
-#include <stdlib.h>
-#include "parser.h"
-
-int dos_preload(char *file_name, long max_size, void **start_file, void **end_file)
-{
- DOS_FILE* file;
- void *buf;
- long rd;
-
-
- file = DOS_fopen(file_name,"r");
- if (file == NULL) return -1;
-
- buf = malloc(max_size);
- *start_file = buf;
-
- while(((rd = DOS_fread(buf, sizeof(BYTE), 2048, file)) == 2048) &&
- ((buf - *start_file + rd) < (max_size-2048))) {
- buf += rd;
- }
-
- *end_file = buf + rd;
-
- DOS_fclose(file);
- return(0);
-
-}
-
-int line_reader(void *start_file, void *end_file, struct timespec *total, struct loader_task **start_loader_task)
-{
-
- char *pbuf = start_file;
- int res,line_num,total_loader_task;
- struct loader_task *current = NULL;
-
- NULL_TIMESPEC(total);
-
- line_num = 0;
- total_loader_task = 0;
- while ((void *)(pbuf) < end_file) {
-
- line_num++;
-
- if (*start_loader_task == NULL)
- res = line_parser(&pbuf, line_num, total, &current);
- else
- res = line_parser(&pbuf, line_num, total, &current->next);
-
- if (res == 2) {
- total_loader_task++;
- if (*start_loader_task == NULL)
- *start_loader_task = current;
- else
- current = current->next;
- }
-
- if (res == 3) break;
-
- }
-
- cprintf("Total decoded lines %d\n",line_num);
- cprintf("Total loader task %d\n",total_loader_task);
- cprintf("Simulation time sec = %ld usec = %ld\n",total->tv_sec,total->tv_nsec/1000);
-
- return 0;
-
-}
Index: rel_1_21/loader/fsfinit.c
===================================================================
--- rel_1_21/loader/fsfinit.c (revision 1217)
+++ rel_1_21/loader/fsfinit.c (nonexistent)
@@ -1,51 +0,0 @@
-#include "kernel/kern.h"
-#include "fsf_server.h"
-#include "fsf_contract.h"
-
-void fsfinit()
-{
-
- struct timespec period1 = {0,10000000}; //30%
- struct timespec period2 = {0,30000000}; //20%
- struct timespec period3 = {0,30000000}; //10%
- struct timespec budget1 = {0,3000000};
- struct timespec budget2 = {0,6000000};
- struct timespec budget3 = {0,3000000};
-
- fsf_server_id_t server1 = -1;
- fsf_server_id_t server2 = -1;
- fsf_server_id_t server3 = -1;
- fsf_server_id_t server4 = -1;
-
- fsf_contract_parameters_t contract;
-
- int bw;
-
- fsf_initialize_contract(&contract);
-
- fsf_set_contract_basic_parameters(&contract,&budget1,&period1,NULL,NULL,FSF_DEFAULT_WORKLOAD);
- fsf_negotiate_contract(&contract,&server1);
- bw = MAX_BANDWIDTH / TIMESPEC2USEC(&period1) * TIMESPEC2USEC(&budget1);
- cprintf("FSF SERVER LEVEL %d BW %d.%03d\n",server1, (int)( (long long)bw * 100 / MAX_BANDWIDTH),
- (int)( (long long)bw * 100000 / MAX_BANDWIDTH % 1000));
-
- fsf_set_contract_basic_parameters(&contract,&budget2,&period2,NULL,NULL,FSF_DEFAULT_WORKLOAD);
- fsf_negotiate_contract(&contract,&server2);
- bw = MAX_BANDWIDTH / TIMESPEC2USEC(&period2) * TIMESPEC2USEC(&budget2);
- cprintf("FSF SERVER LEVEL %d BW %d.%03d\n",server2, (int)( (long long)bw * 100 / MAX_BANDWIDTH),
- (int)( (long long)bw * 100000 / MAX_BANDWIDTH % 1000));
-
- fsf_set_contract_basic_parameters(&contract,&budget3,&period3,NULL,NULL,FSF_DEFAULT_WORKLOAD);
- fsf_negotiate_contract(&contract,&server3);
- bw = MAX_BANDWIDTH / TIMESPEC2USEC(&period3) * TIMESPEC2USEC(&budget3);
- cprintf("FSF SERVER LEVEL %d BW %d.%03d\n",server3, (int)( (long long)bw * 100 / MAX_BANDWIDTH),
- (int)( (long long)bw * 100000 / MAX_BANDWIDTH % 1000));
-
- fsf_set_contract_basic_parameters(&contract,&budget2,&period2,NULL,NULL,FSF_DEFAULT_WORKLOAD);
- fsf_set_local_scheduler_parameter(&contract, FSF_SCHEDULER_EDF);
- fsf_negotiate_contract(&contract,&server4);
- bw = MAX_BANDWIDTH / TIMESPEC2USEC(&period2) * TIMESPEC2USEC(&budget2);
- cprintf("FSF SERVER LEVEL %d BW %d.%03d\n",server4, (int)( (long long)bw * 100 / MAX_BANDWIDTH),
- (int)( (long long)bw * 100000 / MAX_BANDWIDTH % 1000));
-
-}
Index: rel_1_21/loader/initfile.c
===================================================================
--- rel_1_21/loader/initfile.c (revision 1217)
+++ rel_1_21/loader/initfile.c (nonexistent)
@@ -1,98 +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>
- * (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
- *
- */
-
-#include "kernel/kern.h"
-#include "modules/edf.h"
-#include "modules/cbs.h"
-#include "modules/posix.h"
-#include "pthread.h"
-#include "drivers/keyb.h"
-#include "modules/sem.h"
-#include "modules/dummy.h"
-#include "modules/hartport.h"
-
-#include "fsf_contract.h"
-#include "fsf_server.h"
-
-#include "modules/pi.h"
-#include "modules/pc.h"
-
-#include "dosread.h"
-
-#define TICK 0
-
-#define RRTICK 10000
-
-void *start_file;
-void *end_file;
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
- int grubstar_level;
-
- EDF_register_level(EDF_ENABLE_ALL);
- POSIX_register_level(RRTICK, 1, mb, 32);
- grubstar_level = GRUBSTAR_register_level(FSF_MAX_N_SERVERS, 0);
- FSF_register_module(grubstar_level);
- dummy_register_level();
-
- CBS_register_level(CBS_ENABLE_ALL,0);
-
- SEM_register_module();
-
- PI_register_module();
- PC_register_module();
-
- PTHREAD_register_module(1, 0, 1);
-
- dos_preload("loadfile.txt",100000,&start_file,&end_file);
-
- return TICK;
-
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- __call_main__(mb);
-
- return (void *)0;
-}
Index: rel_1_21/loader/loader.c
===================================================================
--- rel_1_21/loader/loader.c (revision 1217)
+++ rel_1_21/loader/loader.c (nonexistent)
@@ -1,648 +0,0 @@
-#include <kernel/kern.h>
-#include "parser.h"
-#include "dosread.h"
-
-#include "fsf_contract.h"
-#include "fsf_server.h"
-
-/* Memory pointers on loaded file */
-extern void *start_file;
-extern void *end_file;
-
-/* Calibration Loops */
-#define CALIBRATION_DELTA 10000
-
-/* Mutex number */
-#define MAX_MUTEX 10
-
-/* Activate task output */
-#define TASK_OUTPUT
-
-struct timespec zero_time;
-int cal_cycles = 0;
-
-mutex_t mux_table[MAX_MUTEX];
-
-/* Not Real-Time Task */
-TASK nrt_test_task(void *arg)
-{
- long long i,exec_cycles = 0;
- int exec_1,exec_2,exec_3;
- int act_1,act_2,act_3,next_act;
- int crit_1 = 0,crit_2 = 0,crit_3 = 0,crit_4 = 0;
- int crit_start,crit_len;
- long long crit_start_cycles = 0, crit_len_cycles = 0;
- struct timespec next_time;
- struct loader_task *l = (struct loader_task *)(arg);
- char tmp[20];
-
- act_1 = TIMESPEC2USEC(&l->act_par_2);
- act_2 = TIMESPEC2USEC(&l->act_par_3);
- act_3 = TIMESPEC2USEC(&l->act_par_4);
-
- if (l->act_type == PAR_ACT_PERIODIC) {
- kern_gettime(&next_time);
- ADDUSEC2TIMESPEC(act_1,&next_time);
- kern_event_post(&next_time,(void *)((void *)task_activate),(void *)exec_shadow);
- }
-
- if (l->act_type == PAR_ACT_MEAN) {
- next_act = act_1 + rand() % act_2 - act_2/2;
- kern_gettime(&next_time);
- ADDUSEC2TIMESPEC(next_act,&next_time);
- kern_event_post(&next_time,(void *)((void *)task_activate),(void *)exec_shadow);
- }
-
- if (l->act_type == PAR_ACT_GAUSS) {
- }
-
- if (l->act_type == PAR_ACT_GAUSS_MAX) {
- }
-
- exec_1 = TIMESPEC2USEC(&l->exec_par_1);
- exec_2 = TIMESPEC2USEC(&l->exec_par_2);
- exec_3 = TIMESPEC2USEC(&l->exec_par_3);
-
- if (l->crit_type == PAR_CRIT) {
- crit_1 = TIMESPEC2USEC(&l->crit_par_1);
- crit_2 = TIMESPEC2USEC(&l->crit_par_2);
- crit_3 = TIMESPEC2USEC(&l->crit_par_3);
- crit_4 = TIMESPEC2USEC(&l->crit_par_4);
- }
-
- #ifdef TASK_OUTPUT
- printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, GREEN, "R[000000]");
- #endif
-
- if (l->exec_type == PAR_EXEC_CONST)
- exec_cycles = (long long)(exec_1) * CALIBRATION_DELTA / cal_cycles;
-
- if (l->exec_type == PAR_EXEC_MEAN)
- exec_cycles = (long long)(exec_1 + rand() % exec_2 - exec_2/2)
- * CALIBRATION_DELTA / cal_cycles;
-
- if (l->exec_type == PAR_EXEC_GAUSS)
- exec_cycles = 0;
-
- if (l->exec_type == PAR_EXEC_GAUSS_MAX)
- exec_cycles = 0;
-
- if (l->crit_type == PAR_CRIT) {
- crit_start = crit_1 + rand() % crit_2 - crit_2/2;
- crit_len = crit_3 + rand() % crit_4 - crit_4/2;
- crit_start_cycles = (long long)(crit_start) * CALIBRATION_DELTA / cal_cycles;
- crit_len_cycles = (long long)(crit_len) * CALIBRATION_DELTA / cal_cycles;
- exec_cycles -= crit_start_cycles + crit_len_cycles;
- if (exec_cycles < 0) {
- cprintf("Error: exec_cycles < 0\n");
- sys_end();
- }
- }
-
- if (l->crit_type == PAR_NO_CRIT)
- for (i=0;i<exec_cycles;i++) kern_gettime(NULL);
- else {
- for (i=0;i<crit_start_cycles;i++) kern_gettime(NULL);
- #ifdef TASK_OUTPUT
- sprintf(tmp,"B[%02d][%02d]",exec_shadow,l->resource);
- printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, RED,tmp);
- #endif
- mutex_lock(&mux_table[l->resource]);
- for (i=0;i<crit_len_cycles;i++) kern_gettime(NULL);
- mutex_unlock(&mux_table[l->resource]);
- #ifdef TASK_OUTPUT
- printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, GREEN,"R[000000]");
- #endif
- for (i=0;i<exec_cycles;i++) kern_gettime(NULL);
- }
-
- #ifdef TASK_OUTPUT
- printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, BLUE, "E[000000]");
- #endif
-
- return NULL;
-
-}
-
-/* Soft and hard Task */
-TASK test_task(void *arg)
-{
- long long i,exec_cycles = 0;
- int exec_1,exec_2,exec_3;
- int act_1,act_2,act_3,next_act;
- int crit_1 = 0,crit_2 = 0,crit_3 = 0,crit_4 = 0;
- int crit_start,crit_len;
- long long crit_start_cycles = 0, crit_len_cycles = 0;
- struct timespec next_time;
- int act = 0;
- struct loader_task *l = (struct loader_task *)(arg);
- char tmp[20];
-
- act_1 = TIMESPEC2USEC(&l->act_par_2);
- act_2 = TIMESPEC2USEC(&l->act_par_3);
- act_3 = TIMESPEC2USEC(&l->act_par_4);
-
- exec_1 = TIMESPEC2USEC(&l->exec_par_1);
- exec_2 = TIMESPEC2USEC(&l->exec_par_2);
- exec_3 = TIMESPEC2USEC(&l->exec_par_3);
-
- if (l->crit_type == PAR_CRIT) {
- crit_1 = TIMESPEC2USEC(&l->crit_par_1);
- crit_2 = TIMESPEC2USEC(&l->crit_par_2);
- crit_3 = TIMESPEC2USEC(&l->crit_par_3);
- crit_4 = TIMESPEC2USEC(&l->crit_par_4);
- }
-
- while(1) {
-
- task_testcancel();
-
- act++;
-
- #ifdef TASK_OUTPUT
- sprintf(tmp,"X[%06d]",act);
- printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, GREEN, tmp);
- #endif
-
- if (l->act_type == PAR_ACT_MEAN) {
- next_act = act_1 + rand() % act_2 - act_2/2;
- kern_gettime(&next_time);
- ADDUSEC2TIMESPEC(next_act,&next_time);
- kern_event_post(&next_time,(void *)((void *)task_activate),(void *)exec_shadow);
- }
-
- if (l->act_type == PAR_ACT_GAUSS) {
- }
-
- if (l->act_type == PAR_ACT_GAUSS_MAX) {
- }
-
- if (l->exec_type == PAR_EXEC_CONST)
- exec_cycles = (long long)(exec_1) * CALIBRATION_DELTA / cal_cycles;
-
- if (l->exec_type == PAR_EXEC_MEAN)
- exec_cycles = (long long)(exec_1 + rand() % exec_2 - exec_2/2)
- * CALIBRATION_DELTA / cal_cycles;
-
- if (l->exec_type == PAR_EXEC_GAUSS)
- exec_cycles = 0;
-
- if (l->exec_type == PAR_EXEC_GAUSS_MAX)
- exec_cycles = 0;
-
- if (l->crit_type == PAR_CRIT) {
- crit_start = crit_1 + rand() % crit_2 - crit_2/2;
- crit_len = crit_3 + rand() % crit_4 - crit_4/2;
- crit_start_cycles = (long long)(crit_start) * CALIBRATION_DELTA / cal_cycles;
- crit_len_cycles = (long long)(crit_len) * CALIBRATION_DELTA / cal_cycles;
- exec_cycles -= crit_start_cycles + crit_len_cycles;
- if (exec_cycles < 0) {
- cprintf("Error: exec_cycles < 0\n");
- sys_end();
- }
- }
-
- if (l->crit_type == PAR_NO_CRIT)
- for (i=0;i<exec_cycles;i++) kern_gettime(NULL);
- else {
- for (i=0;i<crit_start_cycles;i++) kern_gettime(NULL);
- #ifdef TASK_OUTPUT
- sprintf(tmp,"B[%02d][%02d]",exec_shadow,l->resource);
- printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, RED, tmp);
- #endif
- mutex_lock(&mux_table[l->resource]);
- for (i=0;i<crit_len_cycles;i++) kern_gettime(NULL);
- mutex_unlock(&mux_table[l->resource]);
- #ifdef TASK_OUTPUT
- sprintf(tmp,"X[%06d]",act);
- printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, GREEN, tmp);
- #endif
- for (i=0;i<exec_cycles;i++) kern_gettime(NULL);
- }
-
- task_endcycle();
-
- }
-
- return NULL;
-
-}
-
-/* Background Task */
-TASK back_task(void *arg)
-{
- long long i,exec_cycles = 0;
- int exec_1,exec_2,exec_3;
- int act_1,act_2,act_3,next_act;
- int crit_1 = 0,crit_2 = 0,crit_3 = 0,crit_4 = 0;
- int crit_start,crit_len;
- long long crit_start_cycles = 0, crit_len_cycles = 0;
- struct timespec next_time;
- int act = 0;
- struct loader_task *l = (struct loader_task *)(arg);
- char tmp[20];
-
- act_1 = TIMESPEC2USEC(&l->act_par_2);
- act_2 = TIMESPEC2USEC(&l->act_par_3);
- act_3 = TIMESPEC2USEC(&l->act_par_4);
-
- exec_1 = TIMESPEC2USEC(&l->exec_par_1);
- exec_2 = TIMESPEC2USEC(&l->exec_par_2);
- exec_3 = TIMESPEC2USEC(&l->exec_par_3);
-
- if (l->crit_type == PAR_CRIT) {
- crit_1 = TIMESPEC2USEC(&l->crit_par_1);
- crit_2 = TIMESPEC2USEC(&l->crit_par_2);
- crit_3 = TIMESPEC2USEC(&l->crit_par_3);
- crit_4 = TIMESPEC2USEC(&l->crit_par_4);
- }
-
- while(1) {
-
- task_testcancel();
-
- act++;
-
- #ifdef TASK_OUTPUT
- sprintf(tmp,"X[%06d]",act);
- printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, GREEN, tmp);
- #endif
-
- if (l->act_type == PAR_ACT_MEAN) {
- next_act = act_1 + rand() % act_2 - act_2/2;
- kern_gettime(&next_time);
- ADDUSEC2TIMESPEC(next_act,&next_time);
- kern_event_post(&next_time,(void *)((void *)task_activate),(void *)exec_shadow);
- }
-
- if (l->act_type == PAR_ACT_GAUSS) {
- }
-
- if (l->act_type == PAR_ACT_GAUSS_MAX) {
- }
-
- if (l->exec_type == PAR_EXEC_CONST)
- exec_cycles = (long long)(exec_1) * CALIBRATION_DELTA / cal_cycles;
-
- if (l->exec_type == PAR_EXEC_MEAN)
- exec_cycles = (long long)(exec_1 + rand() % exec_2 - exec_2/2)
- * CALIBRATION_DELTA / cal_cycles;
-
- if (l->exec_type == PAR_EXEC_GAUSS)
- exec_cycles = 0;
-
- if (l->exec_type == PAR_EXEC_GAUSS_MAX)
- exec_cycles = 0;
-
- if (l->crit_type == PAR_CRIT) {
- crit_start = crit_1 + rand() % crit_2 - crit_2/2;
- crit_len = crit_3 + rand() % crit_4 - crit_4/2;
- crit_start_cycles = (long long)(crit_start) * CALIBRATION_DELTA / cal_cycles;
- crit_len_cycles = (long long)(crit_len) * CALIBRATION_DELTA / cal_cycles;
- exec_cycles -= crit_start_cycles + crit_len_cycles;
- if (exec_cycles < 0) {
- cprintf("Error: exec_cycles < 0\n");
- sys_end();
- }
- }
-
- if (l->crit_type == PAR_NO_CRIT)
- for (i=0;i<exec_cycles;i++) kern_gettime(NULL);
- else {
- for (i=0;i<crit_start_cycles;i++) kern_gettime(NULL);
- #ifdef TASK_OUTPUT
- sprintf(tmp,"B[%02d][%02d]",exec_shadow,l->resource);
- printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, RED, tmp);
- #endif
- mutex_lock(&mux_table[l->resource]);
- for (i=0;i<crit_len_cycles;i++) kern_gettime(NULL);
- mutex_unlock(&mux_table[l->resource]);
- #ifdef TASK_OUTPUT
- sprintf(tmp,"X[%06d]",act);
- printf_xy((exec_shadow % 5) * 9 + 34, exec_shadow / 5 + 5, GREEN, tmp);
- #endif
- for (i=0;i<exec_cycles;i++) kern_gettime(NULL);
- }
-
- }
-
- return NULL;
-
-}
-
-/* Delay Calibration */
-int calibrate_cycle()
-{
- long long i;
- struct timespec start,end,diff;
-
- kern_cli();
- kern_gettime(&start);
- for (i=0;i<CALIBRATION_DELTA;i++) kern_gettime(NULL);
- kern_gettime(&end);
- kern_sti();
-
- SUBTIMESPEC(&end,&start,&diff);
- cal_cycles = TIMESPEC2USEC(&diff);
-
- cprintf("Calibration usec/[%d cycles] = %d\n",CALIBRATION_DELTA,cal_cycles);
-
- return 0;
-
-}
-
-/* Mutex create */
-void loader_mutex_create(struct loader_task *start_loader_task)
-{
-
- struct loader_task *current = start_loader_task;
- int i,res = 0;
- PI_mutexattr_t a;
- int init_array[MAX_MUTEX];
-
- PI_mutexattr_default(a);
-
- for (i = 0;i < MAX_MUTEX;i++) init_array[i] = 0;
-
- while (current != NULL) {
-
- if (current->crit_type == PAR_CRIT) {
- if (init_array[current->resource] == 0) {
- mutex_init(&mux_table[current->resource],&a);
- init_array[current->resource] = 1;
- res++;
- }
- }
-
- current = current->next;
-
- }
-
- cprintf("Created %d mutex\n",res);
-
-}
-
-/* Task create */
-void loader_task_create(struct loader_task *start_loader_task)
-{
-
- struct loader_task *current = start_loader_task;
- char tmp[30];
- int i, total_task;
- int total_group = 0;
- PID p;
-
- total_task = 0;
-
- while (current != NULL) {
-
- total_group++;
- current->group = total_group;
- current->bandwidth = 0;
-
- for (i=0; i < current->number; i++) {
-
- if (current->task_type == PAR_TASK_NRT) {
- NRT_TASK_MODEL nrt;
-
- nrt_task_default_model(nrt);
- nrt_task_def_save_arrivals(nrt);
- nrt_task_def_arg(nrt,(void *)(current));
- nrt_task_def_ctrl_jet(nrt);
- nrt_task_def_level(nrt,current->task_level);
- nrt_task_def_group(nrt,total_group);
- nrt_task_def_usemath(nrt);
-
- sprintf(tmp,"NRT %d:%d",current->group,i);
- p = task_create(tmp,nrt_test_task,&nrt,NULL);
- if (p == NIL) {
- cprintf("Error nrt task creating\n");
- sys_end();
- }
-
- total_task++;
-
- }
-
- if (current->task_type == PAR_TASK_BACK) {
- NRT_TASK_MODEL nrt;
-
- nrt_task_default_model(nrt);
- nrt_task_def_save_arrivals(nrt);
- nrt_task_def_arg(nrt,(void *)(current));
- nrt_task_def_ctrl_jet(nrt);
- nrt_task_def_level(nrt,current->task_level);
- nrt_task_def_group(nrt,total_group);
- nrt_task_def_usemath(nrt);
-
- sprintf(tmp,"BACK %d:%d",current->group,i);
- p = task_create(tmp,back_task,&nrt,NULL);
- if (p == NIL) {
- cprintf("Error back task creating\n");
- sys_end();
- }
-
- total_task++;
-
- }
-
- if (current->task_type == PAR_TASK_HARD) {
- HARD_TASK_MODEL ht;
-
- hard_task_default_model(ht);
- hard_task_def_arg(ht,(void *)(current));
- hard_task_def_wcet(ht,TIMESPEC2USEC(&current->wcet));
- hard_task_def_ctrl_jet(ht);
- hard_task_def_level(ht,current->task_level);
- hard_task_def_group(ht,total_group);
- hard_task_def_usemath(ht);
-
- if (current->act_type != PAR_ACT_PERIODIC) {
- hard_task_def_mit(ht,TIMESPEC2USEC(&current->deadline));
- current->bandwidth += MAX_BANDWIDTH / TIMESPEC2USEC(&current->deadline)
- * TIMESPEC2USEC(&current->wcet);
- hard_task_def_aperiodic(ht);
- } else {
- hard_task_def_mit(ht,TIMESPEC2USEC(&current->act_par_2));
- current->bandwidth += MAX_BANDWIDTH / TIMESPEC2USEC(&current->act_par_2)
- * TIMESPEC2USEC(&current->wcet);
- }
-
- sprintf(tmp,"HARD %d:%d",current->group,i);
- p = task_create(tmp,test_task,&ht,NULL);
- if (p == NIL) {
- cprintf("Error hard task creating\n");
- sys_end();
- }
-
- total_task++;
-
- }
-
- if (current->task_type == PAR_TASK_SOFT) {
- SOFT_TASK_MODEL st;
-
- soft_task_default_model(st);
- soft_task_def_save_arrivals(st);
- soft_task_def_arg(st,(void *)(current));
- soft_task_def_met(st,TIMESPEC2USEC(&current->wcet));
- soft_task_def_ctrl_jet(st);
- soft_task_def_level(st,current->task_level);
- soft_task_def_group(st,total_group);
- soft_task_def_usemath(st);
-
- if (current->act_type == PAR_ACT_PERIODIC) {
- soft_task_def_period(st,TIMESPEC2USEC(&current->act_par_2));
- current->bandwidth += MAX_BANDWIDTH / TIMESPEC2USEC(&current->act_par_2)
- * TIMESPEC2USEC(&current->wcet);
- } else if (current->act_type != PAR_ACT_SINGLE) {
- soft_task_def_period(st,TIMESPEC2USEC(&current->act_par_2));
- current->bandwidth += MAX_BANDWIDTH / TIMESPEC2USEC(&current->act_par_2)
- * TIMESPEC2USEC(&current->wcet);
- soft_task_def_aperiodic(st);
- } else {
- soft_task_def_period(st,TIMESPEC2USEC(&current->wcet)*1000);
- current->bandwidth += MAX_BANDWIDTH / 1000;
- soft_task_def_aperiodic(st);
- }
-
- sprintf(tmp,"SOFT %d:%d",current->group,i);
- p = task_create(tmp,test_task,&st,NULL);
- if (p == NIL) {
- cprintf("Error soft task creating\n");
- sys_end();
- }
-
- total_task++;
-
- }
-
- if (current->task_type == PAR_TASK_FSF) {
-
- if (current->local_scheduler == PAR_POSIX) {
- NRT_TASK_MODEL nrt;
- pthread_t j;
- int err;
-
- nrt_task_default_model(nrt);
- nrt_task_def_save_arrivals(nrt);
- nrt_task_def_ctrl_jet(nrt);
- nrt_task_def_usemath(nrt);
-
- err = fsf_create_thread(current->server,&j,NULL,back_task,(void *)current,&nrt);
- if (err) {
- cprintf("Error fsf task creating\n");
- sys_end();
- }
- }
-
- if (current->local_scheduler == PAR_EDF) {
- HARD_TASK_MODEL ht;
- pthread_t j;
- int err;
-
- hard_task_default_model(ht);
- hard_task_def_ctrl_jet(ht);
- hard_task_def_mit(ht,TIMESPEC2USEC(&current->deadline));
- hard_task_def_wcet(ht,TIMESPEC2USEC(&current->wcet));
- hard_task_def_usemath(ht);
-
- err = fsf_create_thread(current->server,&j,NULL,test_task,(void *)current,&ht);
- if (err) {
- cprintf("Error fsf task creating\n");
- sys_end();
- }
-
- }
-
- if (current->local_scheduler == PAR_RM) {
- HARD_TASK_MODEL ht;
- pthread_t j;
- int err;
-
- hard_task_default_model(ht);
- hard_task_def_mit(ht,TIMESPEC2USEC(&current->deadline));
- hard_task_def_wcet(ht,TIMESPEC2USEC(&current->wcet));
- hard_task_def_ctrl_jet(ht);
- hard_task_def_usemath(ht);
-
- err = fsf_create_thread(current->server,&j,NULL,test_task,(void *)current,&ht);
- if (err) {
- cprintf("Error fsf task creating\n");
- sys_end();
- }
-
- }
-
- total_task++;
-
- }
-
- }
-
- cprintf("Task group %d created. Worst case BW = %d.%d \n",
- current->group,(int)( (long long)current->bandwidth * 100 / MAX_BANDWIDTH),
- (int)( (long long)current->bandwidth* 100000 / MAX_BANDWIDTH % 1000));
-
- current = current->next;
-
- }
-
- cprintf("Created %d tasks\n",total_task);
-
-}
-
-/* Set the first extivation events */
-void loader_first_execution(struct loader_task *start_loader_task)
-{
-
- struct loader_task *current = start_loader_task;
- struct timespec start_time;
-
- while (current != NULL) {
-
- if (current->task_type != PAR_TASK_FSF) {
-
- ADDTIMESPEC(&zero_time,&current->act_par_1,&start_time);
-
- kern_event_post(&start_time, (void *)((void *)group_activate), (void *)(current->group));
-
- }
-
- current = current->next;
-
- }
-
-}
-
-void fsfinit(void);
-
-int main()
-{
-
- struct loader_task *start_loader_task = NULL;
- struct timespec total;
- struct timespec end_time;
-
- line_reader(start_file, end_file, &total, &start_loader_task);
-
- srand(kern_gettime(NULL));
-
- calibrate_cycle();
-
- fsfinit();
-
- loader_mutex_create(start_loader_task);
-
- loader_task_create(start_loader_task);
-
- kern_gettime(&zero_time);
-
- loader_first_execution(start_loader_task);
-
- ADDTIMESPEC(&zero_time,&total,&end_time);
- kern_event_post(&end_time,(void *)((void *)(sys_end)),NULL);
-
- return 0;
-
-}
Index: rel_1_21/loader/dosread.h
===================================================================
--- rel_1_21/loader/dosread.h (revision 1217)
+++ rel_1_21/loader/dosread.h (nonexistent)
@@ -1,10 +0,0 @@
-#ifndef __DOSREAD_H__
-#define __DOSREAD_H__
-
-#include "parser.h"
-
-int dos_preload(char *file_name, long max_size, void **start, void **end);
-
-int line_reader(void *start, void *end, struct timespec *total, struct loader_task **start_loader_task);
-
-#endif
Index: rel_1_21/jumpball/demo.h
===================================================================
--- rel_1_21/jumpball/demo.h (revision 1217)
+++ rel_1_21/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_21/jumpball/readme.txt
===================================================================
--- rel_1_21/jumpball/readme.txt (revision 1217)
+++ rel_1_21/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_21/jumpball/ball.c
===================================================================
--- rel_1_21/jumpball/ball.c (revision 1217)
+++ rel_1_21/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_21/jumpball/makefile
===================================================================
--- rel_1_21/jumpball/makefile (revision 1217)
+++ rel_1_21/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_21/jumpball/rrn.c
===================================================================
--- rel_1_21/jumpball/rrn.c (revision 1217)
+++ rel_1_21/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_21/jumpball/rrp.c
===================================================================
--- rel_1_21/jumpball/rrp.c (revision 1217)
+++ rel_1_21/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_21/jumpball/demo.c
===================================================================
--- rel_1_21/jumpball/demo.c (revision 1217)
+++ rel_1_21/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_21/jumpball/ern.c
===================================================================
--- rel_1_21/jumpball/ern.c (revision 1217)
+++ rel_1_21/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_21/jumpball/ecp.c
===================================================================
--- rel_1_21/jumpball/ecp.c (revision 1217)
+++ rel_1_21/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_21/jumpball/jetctrl.c
===================================================================
--- rel_1_21/jumpball/jetctrl.c (revision 1217)
+++ rel_1_21/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_21/slsh/makefile
===================================================================
--- rel_1_21/slsh/makefile (revision 1217)
+++ rel_1_21/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_21/slsh/slshinit.c
===================================================================
--- rel_1_21/slsh/slshinit.c (revision 1217)
+++ rel_1_21/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_21/slsh/slsh.h
===================================================================
--- rel_1_21/slsh/slsh.h (revision 1217)
+++ rel_1_21/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_21/slsh/slshtest.c
===================================================================
--- rel_1_21/slsh/slshtest.c (revision 1217)
+++ rel_1_21/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_21/slsh/slsh.c
===================================================================
--- rel_1_21/slsh/slsh.c (revision 1217)
+++ rel_1_21/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_21/slsh/readme.txt
===================================================================
--- rel_1_21/slsh/readme.txt (revision 1217)
+++ rel_1_21/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_21/base/pcdemo.c
===================================================================
--- rel_1_21/base/pcdemo.c (revision 1217)
+++ rel_1_21/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_21/base/iaster1.c
===================================================================
--- rel_1_21/base/iaster1.c (revision 1217)
+++ rel_1_21/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_21/base/srpdemo.c
===================================================================
--- rel_1_21/base/srpdemo.c (revision 1217)
+++ rel_1_21/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_21/base/iaster3.c
===================================================================
--- rel_1_21/base/iaster3.c (revision 1217)
+++ rel_1_21/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_21/base/ego.c
===================================================================
--- rel_1_21/base/ego.c (revision 1217)
+++ rel_1_21/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_21/base/iaster4.c
===================================================================
--- rel_1_21/base/iaster4.c (revision 1217)
+++ rel_1_21/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_21/base/preempt.c
===================================================================
--- rel_1_21/base/preempt.c (revision 1217)
+++ rel_1_21/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_21/base/readme
===================================================================
--- rel_1_21/base/readme (revision 1217)
+++ rel_1_21/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_21/base/iaster6.c
===================================================================
--- rel_1_21/base/iaster6.c (revision 1217)
+++ rel_1_21/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_21/base/pidemo.c
===================================================================
--- rel_1_21/base/pidemo.c (revision 1217)
+++ rel_1_21/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_21/base/iaster7.c
===================================================================
--- rel_1_21/base/iaster7.c (revision 1217)
+++ rel_1_21/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_21/base/aster.c
===================================================================
--- rel_1_21/base/aster.c (revision 1217)
+++ rel_1_21/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_21/base/iaster8.c
===================================================================
--- rel_1_21/base/iaster8.c (revision 1217)
+++ rel_1_21/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_21/base/pcidemo.c
===================================================================
--- rel_1_21/base/pcidemo.c (revision 1217)
+++ rel_1_21/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_21/base/sig.c
===================================================================
--- rel_1_21/base/sig.c (revision 1217)
+++ rel_1_21/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_21/base/condtest.c
===================================================================
--- rel_1_21/base/condtest.c (revision 1217)
+++ rel_1_21/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_21/base/keycode.c
===================================================================
--- rel_1_21/base/keycode.c (revision 1217)
+++ rel_1_21/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_21/base/mousfind.c
===================================================================
--- rel_1_21/base/mousfind.c (revision 1217)
+++ rel_1_21/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_21/base/semdemo.c
===================================================================
--- rel_1_21/base/semdemo.c (revision 1217)
+++ rel_1_21/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_21/base/talk.c
===================================================================
--- rel_1_21/base/talk.c (revision 1217)
+++ rel_1_21/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_21/base/makefile
===================================================================
--- rel_1_21/base/makefile (revision 1217)
+++ rel_1_21/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_21/base/cabs.dat
===================================================================
--- rel_1_21/base/cabs.dat (revision 1217)
+++ rel_1_21/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_21/base/aster1.c
===================================================================
--- rel_1_21/base/aster1.c (revision 1217)
+++ rel_1_21/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_21/base/jointest.c
===================================================================
--- rel_1_21/base/jointest.c (revision 1217)
+++ rel_1_21/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_21/base/aster2.c
===================================================================
--- rel_1_21/base/aster2.c (revision 1217)
+++ rel_1_21/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_21/base/aster3.c
===================================================================
--- rel_1_21/base/aster3.c (revision 1217)
+++ rel_1_21/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_21/base/mdemo.c
===================================================================
--- rel_1_21/base/mdemo.c (revision 1217)
+++ rel_1_21/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