As exemples, periodic sync emission, heartbeat production or SDO timeout need to set some alarms that will be called later and do the job.
µC generaly do not have enough free timers to handle all the CanOpen needs directly. Moreover, CanFestival internal data may be corrupt by reentrant calls.
CanFestival implement a micro-scheduler (timer.c). It uses only one timer to mimic many timers. It manage an alarm table, and call alarms at desired time.
Scheduler can handle short clock value ranges limitation found on some µC. As an example, value range for a 16bit clock counter with 4µs tick is crossed within 0.26 seconds... Long alarms must be segmented.
Chronogram illustrate a long alarm (A) and a short periodic alarm (B), with a A value > clock range > B value. Values t0...t8 are successive setTimer call parameter values. t1 illustrates an intermediate call to TimeDispatch, caused by a delay longer than clock range. Because of long alarm segmentation, at the end of t1, TimeDispatch call will not trig any alarm callback.
epimerde 2007-06-05