xtUML provides a model of time. Time can be read, time can be measured and delayed events can be generated. BridgePoint Builder provides a "standard" interface to time through an external entity (EE) called Time (TIM). A set of bridge operations on the TIM external entity have become somewhat standardized. Among these are TIM::timer_start, TIM::get_date, TIM::timer_cancel. etc.
Since measuring time is often dependendent upon the target platform, MC-3020 provides no formal support for time in the generated code. However, a sample Time EE is generated and can easily be modified by the user. This sample provides an excellent head start when building a timer on a particular target.
In order to use these timers:
TIM_bridge.c and
TIM_bridge.h are automatically generated
into the system/skel folder.
The generated TIM_bridge.c
will have a pause and
resume that will be used to suspend time)
when generated with Model Debugging enabled.
To use the sample TIM, references to the TIM
routines in sys_user_co.c must be
uncommented. These calls initialize and periodically "tick" the
timer subsystem. These references are are found in
UserInitializationCalloutf and
UserBackgroundProcessingCalloutf.
Modifications made to define timer routines must
be made in sys_user_co.h
(UserInitializationCallout
UserBackgroundProcessingCallout). The
initial macros defining these routines as empty must be commented
out or deleted.
TIM_init must be invoked at
start-up (this is normally done by uncommenting the line found in
UserInitializationCalloutf.
TIM_tick must be invoked
periodically and as often as practical (normally done by
uncommenting the line found in
UserBackgroundProcessingCalloutf.
Many users have enhanced the given sample to be asynchronous.
Instead of calling TIM_tick periodically from
the background loop, it can be asynchronously invoked with a
signal. It can also be spawned into its own thread. The TIM as
generated for the Nucleus PLUS environment does this. The user may
augument and enhance this sample as desired.