Reputation: 11441
In Vxworks we have various clocks like system clock and auxiliary clock and has various API's according like below
My question is what is difference between system clock and auxillary clock. When programmer should use what and under what scenarios?
Upvotes: 4
Views: 4662
Reputation: 39094
The system clock forms the basis of how VxWorks tracks time and timeouts.
Most of the OS objects supporting timeouts (semaphores, message queues, events) as well as the taskDelay call are in units of clock ticks, which is based on the system clock.
Generally speaking, the system clock rate is chosen by the board designer for a reason.
Cranking up the clock speed increases system overhead slightly since during every system clock ticks, the OS needs to service various timeout elements, time slice counters and other internal stuff.
If you need to perform a task at a high rate of speed (2000 - 8000 Hz), you can use the auxiliary clock. The auxClock API is a simplified interface to an Interrupt Service Routine. Whenever the clock expires, the routine specified by sysAuxClockConnect will be invoked from the aux clock ISR.
There is no system overhead associated with the aux Clock beyound the ISR servicing time.
Of course, you do need a 2nd hardware clock in order to use the auxClock. Also, some vxWorks components like spy make use of the auxClock. If you have such a component, you might not be able to use it as there is a conflict.
Note that if you have more than 2 timers on your hardware platform, you could write your own routines to essentially do the same thing that the aux Clock API does.
Upvotes: 6
Reputation: 5204
The auxillary clock (when supported by the hardware) can for example be used for high speed polling. It's clock rate can be set by sysAuxClkRateSet()
to deviate from the system clock interrupt period.
Example: Programming Interrupts: Example for MVME 162 Using VxWorks.
Upvotes: 0