Commit 284a7229 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add SDL implementation of timer manager (for simulation)

parent ff27696b
-- Timer Manager autogenerated code (from TASTE/Kazoo) : DO NOT EDIT
system @_LOWER:Name_@;
/* CIF TEXT (0, 0), (100, 100) */
use dataview comment 'dataview-uniq.asn';
signal tick;
@@TABLE@@
signal @_Timers_@;
exported procedure set_@_Timers_@;
fpar in val T_UInt32;
referenced;
exported procedure reset_@_Timers_@;
referenced;
@@END_TABLE@@
/* CIF ENDTEXT */
channel c
from env to @_LOWER:Name_@ with tick;
from @_LOWER:Name_@ to env with
@@INLINE@@( )(, )(;\n)@@
@@TABLE@@
@_Timers_@
@@END_TABLE@@
@@END_INLINE@@
endchannel;
block @_LOWER:Name_@;
signalroute r
from env to @_LOWER:Name_@ with tick;
from @_LOWER:Name_@ to env with
@@INLINE@@( )(, )(;\n)@@
@@TABLE@@
@_Timers_@
@@END_TABLE@@
@@END_INLINE@@
connect c and r;
process @_LOWER:Name_@;
/* CIF TEXT (0, 0), (100, 100) */
synonym running T_UInt32 = 1;
synonym stopped T_UInt32 = 0;
@@TABLE@@
dcl @_Timers_@_state, @_Timers_@_value T_UInt32 := 0;
procedure set_@_Timers_@;
fpar in val T_UInt32;
start;
task @_Timers_@_state := running, @_Timers_@_value := val / 10;
return;
endprocedure;
procedure reset_@_Timers_@;
start;
task @_Timers_@_state := stopped, @_Timers_@_value := 0;
return;
endprocedure;
@@END_TABLE@@
/* CIF ENDTEXT */
start;
nextstate wait;
state wait;
input tick;
@@TABLE@@
decision @_Timers_@_state;
(running):
task @_Timers_@_value := @_Timers_@_value - 1;
decision @_Timers_@_value;
(0):
task @_Timers_@_state := stopped;
output @_Timers_@;
else:
enddecision;
else:
enddecision;
@@END_TABLE@@
nextstate wait;
endstate;
endprocess @_LOWER:Name_@;
endblock;
endsystem;
@@-- For the simulator the timer manager is generated in SDL
@@-- in order to have an easily accessible context/state
@@IF@@ @_Language_@ = Timer_Manager and @_Target_@ = SIMU
TRUE
@@END_IF@@
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment